Removes deprecated $wgUseCommaCount variable
[lhc/web/wiklou.git] / includes / OutputPage.php
index 8fd7812..8967938 100644 (file)
@@ -885,10 +885,7 @@ class OutputPage extends ContextSource {
         * @return string
         */
        public function getPageTitleActionText() {
-               if ( isset( $this->mPageTitleActionText ) ) {
-                       return $this->mPageTitleActionText;
-               }
-               return '';
+               return $this->mPageTitleActionText;
        }
 
        /**
@@ -1345,18 +1342,6 @@ class OutputPage extends ContextSource {
                );
        }
 
-       /**
-        * Return whether user JavaScript is allowed for this page
-        * @deprecated since 1.18 Load modules with ResourceLoader, and origin and
-        *     trustworthiness is identified and enforced automagically.
-        * @return bool
-        */
-       public function isUserJsAllowed() {
-               wfDeprecated( __METHOD__, '1.18' );
-               return $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS ) >=
-                       ResourceLoaderModule::ORIGIN_USER_INDIVIDUAL;
-       }
-
        /**
         * Show what level of JavaScript / CSS untrustworthiness is allowed on this page
         * @see ResourceLoaderModule::$origin
@@ -1608,7 +1593,7 @@ class OutputPage extends ContextSource {
                $oldTidy = $popts->setTidy( $tidy );
                $popts->setInterfaceMessage( (bool)$interface );
 
-               $parserOutput = $wgParser->parse(
+               $parserOutput = $wgParser->getFreshParser()->parse(
                        $text, $title, $popts,
                        $linestart, true, $this->mRevisionId
                );
@@ -1621,11 +1606,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 +1671,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 );
        }
 
        /**
@@ -1726,7 +1753,7 @@ class OutputPage extends ContextSource {
                        $oldLang = $popts->setTargetLanguage( $language );
                }
 
-               $parserOutput = $wgParser->parse(
+               $parserOutput = $wgParser->getFreshParser()->parse(
                        $text, $this->getTitle(), $popts,
                        $linestart, true, $this->mRevisionId
                );
@@ -2027,19 +2054,6 @@ class OutputPage extends ContextSource {
                }
        }
 
-       /**
-        * Get the message associated with the HTTP response code $code
-        *
-        * @param int $code Status code
-        * @return string|null Message or null if $code is not in the list of messages
-        *
-        * @deprecated since 1.18 Use HttpStatus::getMessage() instead.
-        */
-       public static function getStatusMessage( $code ) {
-               wfDeprecated( __METHOD__, '1.18' );
-               return HttpStatus::getMessage( $code );
-       }
-
        /**
         * Finally, all the text has been munged and accumulated into
         * the object, let's actually output it:
@@ -3070,16 +3084,13 @@ $templates
        /**
         * Get an array containing the variables to be set in mw.config in JavaScript.
         *
-        * DO NOT CALL THIS FROM OUTSIDE OF THIS CLASS OR Skin::makeGlobalVariablesScript().
-        * This is only public until that function is removed. You have been warned.
-        *
         * Do not add things here which can be evaluated in ResourceLoaderStartUpModule
         * - in other words, page-independent/site-wide variables (without state).
         * You will only be adding bloat to the html page and causing page caches to
         * have to be purged on configuration changes.
         * @return array
         */
-       public function getJSVars() {
+       private function getJSVars() {
                global $wgContLang;
 
                $curRevisionId = 0;