Page MenuHomePhabricator

22061.patch

Authored By
bzimport
Nov 21 2014, 10:55 PM
Size
2 KB
Referenced Files
None
Subscribers
None

22061.patch

Index: api/ApiParse.php
===================================================================
--- api/ApiParse.php (revision 61004)
+++ api/ApiParse.php (working copy)
@@ -157,6 +157,10 @@
$result_array['displaytitle'] = $p_result->getDisplayTitle() ?
$p_result->getDisplayTitle() :
$titleObj->getPrefixedText();
+
+ if( isset( $prop['headitems'] ) )
+ $result_array['headitems'] = $this->formatHeadItems( $p_result->getHeadItems() );
+
if ( !is_null( $oldid ) )
$result_array['revid'] = intval( $oldid );
@@ -169,6 +173,7 @@
'images' => 'img',
'externallinks' => 'el',
'sections' => 's',
+ 'headitems' => 'hi'
);
$this->setIndexedTagNames( $result_array, $result_mapping );
$result->addValue( null, $this->getModuleName(), $result_array );
@@ -212,6 +217,17 @@
return $result;
}
+ private function formatHeadItems( $headItems ) {
+ $result = array();
+ foreach( $headItems as $tag => $content ) {
+ $entry = array();
+ $entry['tag'] = $tag;
+ $this->getResult()->setContent( $entry, $content );
+ $result[] = $entry;
+ }
+ return $result;
+ }
+
private function setIndexedTagNames( &$array, $mapping ) {
foreach ( $mapping as $key => $name ) {
if ( isset( $array[$key] ) )
@@ -242,6 +258,7 @@
'sections',
'revid',
'displaytitle',
+ 'headitems'
)
),
'pst' => false,
Index: OutputPage.php
===================================================================
--- OutputPage.php (revision 61004)
+++ OutputPage.php (working copy)
@@ -601,7 +601,7 @@
$this->enableClientCache( false );
}
$this->mNoGallery = $parserOutput->getNoGallery();
- $this->mHeadItems = array_merge( $this->mHeadItems, (array)$parserOutput->mHeadItems );
+ $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
// Versioning...
foreach ( (array)$parserOutput->mTemplateIds as $ns => $dbks ) {
if ( isset( $this->mTemplateIds[$ns] ) ) {
Index: parser/ParserOutput.php
===================================================================
--- parser/ParserOutput.php (revision 61004)
+++ parser/ParserOutput.php (working copy)
@@ -55,6 +55,7 @@
function &getImages() { return $this->mImages; }
function &getExternalLinks() { return $this->mExternalLinks; }
function getNoGallery() { return $this->mNoGallery; }
+ function getHeadItems() { return $this->mHeadItems; }
function getSubtitle() { return $this->mSubtitle; }
function getOutputHooks() { return (array)$this->mOutputHooks; }
function getWarnings() { return array_keys( $this->mWarnings ); }

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5872
Default Alt Text
22061.patch (2 KB)

Event Timeline