Add SVG versions of enhanced recent changes collapse/show arrows
[lhc/web/wiklou.git] / includes / OutputPage.php
index 6a1ce19..2c4c64e 100644 (file)
@@ -255,6 +255,11 @@ class OutputPage extends ContextSource {
         */
        private $mTarget = null;
 
+       /**
+        * @var bool: Whether output should contain table of contents
+        */
+       private $mEnableTOC = true;
+
        /**
         * Constructor for OutputPage. This should not be called directly.
         * Instead a new RequestContext should be created and it will implicitly create
@@ -1606,6 +1611,7 @@ class OutputPage extends ContextSource {
         */
        function addParserOutput( &$parserOutput ) {
                $this->addParserOutputNoText( $parserOutput );
+               $parserOutput->setTOCEnabled( $this->mEnableTOC );
                $text = $parserOutput->getText();
                wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
                $this->addHTML( $text );
@@ -1617,10 +1623,7 @@ class OutputPage extends ContextSource {
         * @param $template QuickTemplate
         */
        public function addTemplate( &$template ) {
-               ob_start();
-               $template->execute();
-               $this->addHTML( ob_get_contents() );
-               ob_end_clean();
+               $this->addHTML( $template->getHTML() );
        }
 
        /**
@@ -2974,9 +2977,11 @@ $templates
                $ns = $title->getNamespace();
                $canonicalNamespace = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
 
+               $sk = $this->getSkin();
                // Get the relevant title so that AJAX features can use the correct page name
                // when making API requests from certain special pages (bug 34972).
-               $relevantTitle = $this->getSkin()->getRelevantTitle();
+               $relevantTitle = $sk->getRelevantTitle();
+               $relevantUser = $sk->getRelevantUser();
 
                if ( $ns == NS_SPECIAL ) {
                        list( $canonicalSpecialPageName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
@@ -3053,6 +3058,9 @@ $templates
                if ( $this->mRedirectedFrom ) {
                        $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
                }
+               if ( $relevantUser ) {
+                       $vars['wgRelevantUserName'] = $relevantUser->getName();
+               }
 
                // Allow extensions to add their custom variables to the mw.config map.
                // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not
@@ -3648,4 +3656,20 @@ $templates
                return array();
        }
 
+       /**
+        * Enables/disables TOC, doesn't override __NOTOC__
+        * @param bool $flag
+        * @since 1.22
+        */
+       public function enableTOC( $flag = true ) {
+               $this->mEnableTOC = $flag;
+       }
+
+       /**
+        * @return bool
+        * @since 1.22
+        */
+       public function isTOCEnabled() {
+               return $this->mEnableTOC;
+       }
 }