Followup r81583, break some of the long lines and centralize the regex.
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index fc63dce..6d7057f 100644 (file)
@@ -132,7 +132,7 @@ class SkinTemplate extends Skin {
         * @param $out OutputPage
         */
        function outputPage( OutputPage $out ) {
-               global $wgArticle, $wgUser, $wgLang, $wgContLang;
+               global $wgUser, $wgLang, $wgContLang;
                global $wgScript, $wgStylePath, $wgLanguageCode;
                global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
                global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
@@ -201,6 +201,8 @@ class SkinTemplate extends Skin {
                        $tpl->setRef( 'usercss', $this->usercss );
 
                        $this->userjs = $this->userjsprev = false;
+                       # FIXME: this is the only use of OutputPage::isUserJsAllowed() anywhere; can we
+                       # get rid of it?  For that matter, why is any of this here at all?
                        $this->setupUserJs( $out->isUserJsAllowed() );
                        $tpl->setRef( 'userjs', $this->userjs );
                        $tpl->setRef( 'userjsprev', $this->userjsprev );
@@ -387,7 +389,7 @@ class SkinTemplate extends Skin {
                        if( $wgMaxCredits != 0 ){
                                $this->credits = Credits::getCredits( $article, $wgMaxCredits, $wgShowCreditsIfMax );
                        } else {
-                               $tpl->set( 'lastmod', $this->lastModified() );
+                               $tpl->set( 'lastmod', $this->lastModified( $article ) );
                        }
 
                        $tpl->setRef( 'credits', $this->credits );
@@ -496,14 +498,14 @@ class SkinTemplate extends Skin {
 
                wfProfileIn( __METHOD__ . '-stuff5' );
                # Personal toolbar
-               $tpl->set( 'personal_urls', $this->buildPersonalUrls() );
-               $content_navigation = $this->buildContentNavigationUrls();
+               $tpl->set( 'personal_urls', $this->buildPersonalUrls( $out ) );
+               $content_navigation = $this->buildContentNavigationUrls( $out );
                $content_actions = $this->buildContentActionUrls( $content_navigation );
                $tpl->setRef( 'content_navigation', $content_navigation );
                $tpl->setRef( 'content_actions', $content_actions );
 
                $tpl->set( 'sidebar', $this->buildSidebar() );
-               $tpl->set( 'nav_urls', $this->buildNavUrls() );
+               $tpl->set( 'nav_urls', $this->buildNavUrls( $out ) );
 
                // Set the head scripts near the end, in case the above actions resulted in added scripts
                if ( $this->useHeadElement ) {
@@ -560,12 +562,11 @@ class SkinTemplate extends Skin {
        /**
         * build array of urls for personal toolbar
         * @return array
-        * @private
         */
-       function buildPersonalUrls() {
-               global $wgOut, $wgRequest;
+       protected function buildPersonalUrls( OutputPage $out ) {
+               global $wgRequest;
 
-               $title = $wgOut->getTitle();
+               $title = $out->getTitle();
                $pageurl = $title->getLocalURL();
                wfProfileIn( __METHOD__ );
 
@@ -791,10 +792,9 @@ class SkinTemplate extends Skin {
         *                believes that the accesskey should not be added to the tab.
         * 
         * @return array
-        * @private
         */
-       function buildContentNavigationUrls() {
-               global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest;
+       protected function buildContentNavigationUrls( OutputPage $out ) {
+               global $wgContLang, $wgLang, $wgUser, $wgRequest;
                global $wgDisableLangConversion;
 
                wfProfileIn( __METHOD__ );
@@ -893,9 +893,9 @@ class SkinTemplate extends Skin {
                                );
                                // Checks if this is a current rev of talk page and we should show a new
                                // section link
-                               if ( ( $isTalk && $this->isRevisionCurrent() ) || ( $wgOut->showNewSectionLink() ) ) {
+                               if ( ( $isTalk && $this->isRevisionCurrent() ) || ( $out->showNewSectionLink() ) ) {
                                        // Checks if we should ever show a new section link
-                                       if ( !$wgOut->forceHideNewSectionLink() ) {
+                                       if ( !$out->forceHideNewSectionLink() ) {
                                                // Adds new section link
                                                //$content_navigation['actions']['addsection']
                                                $content_navigation['views']['addsection'] = array(
@@ -1133,8 +1133,8 @@ class SkinTemplate extends Skin {
         * @return array
         * @private
         */
-       function buildNavUrls() {
-               global $wgUseTrackbacks, $wgOut, $wgUser, $wgRequest;
+       protected function buildNavUrls( OutputPage $out ) {
+               global $wgUseTrackbacks, $wgUser, $wgRequest;
                global $wgUploadNavigationUrl;
 
                wfProfileIn( __METHOD__ );
@@ -1158,7 +1158,7 @@ class SkinTemplate extends Skin {
                // A print stylesheet is attached to all pages, but nobody ever
                // figures that out. :)  Add a link...
                if( $this->iscontent && ( $action == 'view' || $action == 'purge' ) ) {
-                       if ( !$wgOut->isPrintable() ) {
+                       if ( !$out->isPrintable() ) {
                                $nav_urls['print'] = array(
                                        'text' => wfMsg( 'printableversion' ),
                                        'href' => $wgRequest->appendQuery( 'printable=yes' )
@@ -1169,7 +1169,7 @@ class SkinTemplate extends Skin {
                        if ( $this->mRevisionId ) {
                                $nav_urls['permalink'] = array(
                                        'text' => wfMsg( 'permalink' ),
-                                       'href' => $wgOut->getTitle()->getLocalURL( "oldid=$this->mRevisionId" )
+                                       'href' => $out->getTitle()->getLocalURL( "oldid=$this->mRevisionId" )
                                );
                        }
 
@@ -1193,7 +1193,7 @@ class SkinTemplate extends Skin {
                        }
                        if( $wgUseTrackbacks )
                                $nav_urls['trackbacklink'] = array(
-                                       'href' => $wgOut->getTitle()->trackbackURL()
+                                       'href' => $out->getTitle()->trackbackURL()
                                );
                }
 
@@ -1257,6 +1257,7 @@ class SkinTemplate extends Skin {
 
        /**
         * @private
+        * FIXME: why is this duplicated in/from OutputPage::getHeadScripts()??
         */
        function setupUserJs( $allowUserJs ) {
                global $wgRequest, $wgJsMimeType;
@@ -1729,7 +1730,6 @@ abstract class BaseTemplate extends QuickTemplate {
                                }
                        }
                } elseif ( $option == 'nocopyright' ) {
-                       $footericons = $this->data['footericons'];
                        unset( $footericons['copyright']['copyright'] );
                        if ( count( $footericons['copyright'] ) <= 0 ) {
                                unset( $footericons['copyright'] );