Index: trunk/phase3/includes/parser/ParserOutput.php |
— | — | @@ -50,6 +50,7 @@ |
51 | 51 | function &getImages() { return $this->mImages; } |
52 | 52 | function &getExternalLinks() { return $this->mExternalLinks; } |
53 | 53 | function getNoGallery() { return $this->mNoGallery; } |
| 54 | + function getHeadItems() { return $this->mHeadItems; } |
54 | 55 | function getSubtitle() { return $this->mSubtitle; } |
55 | 56 | function getOutputHooks() { return (array)$this->mOutputHooks; } |
56 | 57 | function getWarnings() { return array_keys( $this->mWarnings ); } |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -605,7 +605,7 @@ |
606 | 606 | $this->enableClientCache( false ); |
607 | 607 | } |
608 | 608 | $this->mNoGallery = $parserOutput->getNoGallery(); |
609 | | - $this->mHeadItems = array_merge( $this->mHeadItems, (array)$parserOutput->mHeadItems ); |
| 609 | + $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() ); |
610 | 610 | // Versioning... |
611 | 611 | foreach ( (array)$parserOutput->mTemplateIds as $ns => $dbks ) { |
612 | 612 | if ( isset( $this->mTemplateIds[$ns] ) ) { |
Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -157,6 +157,10 @@ |
158 | 158 | $result_array['displaytitle'] = $p_result->getDisplayTitle() ? |
159 | 159 | $p_result->getDisplayTitle() : |
160 | 160 | $titleObj->getPrefixedText(); |
| 161 | + |
| 162 | + if( isset( $prop['headitems'] ) ) |
| 163 | + $result_array['headitems'] = $this->formatHeadItems( $p_result->getHeadItems() ); |
| 164 | + |
161 | 165 | if ( !is_null( $oldid ) ) |
162 | 166 | $result_array['revid'] = intval( $oldid ); |
163 | 167 | |
— | — | @@ -169,6 +173,7 @@ |
170 | 174 | 'images' => 'img', |
171 | 175 | 'externallinks' => 'el', |
172 | 176 | 'sections' => 's', |
| 177 | + 'headitems' => 'hi' |
173 | 178 | ); |
174 | 179 | $this->setIndexedTagNames( $result_array, $result_mapping ); |
175 | 180 | $result->addValue( null, $this->getModuleName(), $result_array ); |
— | — | @@ -212,6 +217,17 @@ |
213 | 218 | return $result; |
214 | 219 | } |
215 | 220 | |
| 221 | + private function formatHeadItems( $headItems ) { |
| 222 | + $result = array(); |
| 223 | + foreach( $headItems as $tag => $content ) { |
| 224 | + $entry = array(); |
| 225 | + $entry['tag'] = $tag; |
| 226 | + $this->getResult()->setContent( $entry, $content ); |
| 227 | + $result[] = $entry; |
| 228 | + } |
| 229 | + return $result; |
| 230 | + } |
| 231 | + |
216 | 232 | private function setIndexedTagNames( &$array, $mapping ) { |
217 | 233 | foreach ( $mapping as $key => $name ) { |
218 | 234 | if ( isset( $array[$key] ) ) |
— | — | @@ -242,6 +258,7 @@ |
243 | 259 | 'sections', |
244 | 260 | 'revid', |
245 | 261 | 'displaytitle', |
| 262 | + 'headitems' |
246 | 263 | ) |
247 | 264 | ), |
248 | 265 | 'pst' => false, |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -787,6 +787,7 @@ |
788 | 788 | * Expand the thumburl to an absolute url to make it consistent with url and |
789 | 789 | descriptionurl |
790 | 790 | * (bug 20233) ApiLogin::execute() doesn't handle LoginForm :: RESET_PASS |
| 791 | +* (bug 22061) API: add prop=headitems to action=parse |
791 | 792 | |
792 | 793 | === Languages updated in 1.16 === |
793 | 794 | |