X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=includes%2FOutputPage.php;h=2a96891d207920d21e17ccf12ab533c1d0a046c1;hb=ddeadfc49b9c9c0fa7ac0fdea358906e39c28565;hp=815ac1244339bcdb79565a253d274dede2ca15a3;hpb=4e6b0e4f4dcd9cffe1d695d2f5f809409ef7b1fc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 815ac12443..2a96891d20 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1621,11 +1621,24 @@ class OutputPage extends ContextSource { } /** - * Add a ParserOutput object, but without Html + * Add a ParserOutput object, but without Html. * + * @deprecated since 1.24, use addParserOutputMetadata() instead. * @param ParserOutput $parserOutput */ public function addParserOutputNoText( &$parserOutput ) { + $this->addParserOutputMetadata( $parserOutput ); + } + + /** + * Add all metadata associated with a ParserOutput object, but without the actual HTML. This + * includes categories, language links, ResourceLoader modules, effects of certain magic words, + * and so on. + * + * @since 1.24 + * @param ParserOutput $parserOutput + */ + public function addParserOutputMetadata( &$parserOutput ) { $this->mLanguageLinks += $parserOutput->getLanguageLinks(); $this->addCategoryLinks( $parserOutput->getCategories() ); $this->mNewSectionLink = $parserOutput->getNewSection(); @@ -1673,21 +1686,50 @@ class OutputPage extends ContextSource { } /** - * Add a ParserOutput object + * Add the HTML and enhancements for it (like ResourceLoader modules) associated with a + * ParserOutput object, without any other metadata. + * + * @since 1.24 + * @param ParserOutput $parserOutput + */ + public function addParserOutputContent( &$parserOutput ) { + $this->addParserOutputText( $parserOutput ); + + $this->addModules( $parserOutput->getModules() ); + $this->addModuleScripts( $parserOutput->getModuleScripts() ); + $this->addModuleStyles( $parserOutput->getModuleStyles() ); + $this->addModuleMessages( $parserOutput->getModuleMessages() ); + + $this->addJsConfigVars( $parserOutput->getJsConfigVars() ); + } + + /** + * Add the HTML associated with a ParserOutput object, without any metadata. + * + * @since 1.24 + * @param ParserOutput $parserOutput + */ + public function addParserOutputText( &$parserOutput ) { + $text = $parserOutput->getText(); + wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) ); + $this->addHTML( $text ); + } + + /** + * Add everything from a ParserOutput object. * * @param ParserOutput $parserOutput */ function addParserOutput( &$parserOutput ) { - $this->addParserOutputNoText( $parserOutput ); + $this->addParserOutputMetadata( $parserOutput ); $parserOutput->setTOCEnabled( $this->mEnableTOC ); // Touch section edit links only if not previously disabled if ( $parserOutput->getEditSectionTokens() ) { $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks ); } - $text = $parserOutput->getText(); - wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) ); - $this->addHTML( $text ); + + $this->addParserOutputText( $parserOutput ); } /**