Remove a single space that breaks a parser test
[lhc/web/wiklou.git] / includes / SkinPHPTal.php
index b291300..24bb15c 100644 (file)
@@ -41,7 +41,7 @@ global $IP;
 require_once $IP.'/PHPTAL-NP-0.7.0/libs/PHPTAL.php';
 
 /**
- *
+ * @todo document
  * @package MediaWiki
  */
 class MediaWiki_I18N extends PHPTAL_I18N {
@@ -70,12 +70,36 @@ class MediaWiki_I18N extends PHPTAL_I18N {
  * @package MediaWiki
  */
 class SkinPHPTal extends Skin {
+       /**#@+
+        * @access private
+        */
+
+       /**
+        * Name of our skin, set in initPage()
+        * It probably need to be all lower case.
+        */
+       var $skinname;
+
+       /**
+        * Stylesheets set to use
+        * Sub directory in ./skins/ where various stylesheets are located
+        */
+       var $stylename;
+
+       /**
+        * PHPTal template to be used.
+        * '.pt' will be automaticly added to it on PHPTAL object creation
+        */
        var $template;
 
+       /**#@-*/
+
+       /** */
        function initPage( &$out ) {
                parent::initPage( $out );
-               $this->skinname = 'monobook';
-               $this->template = 'MonoBook';
+               $this->skinname  = 'monobook';
+               $this->stylename = 'monobook';
+               $this->template  = 'MonoBook';
        }
 
        /**
@@ -86,7 +110,7 @@ class SkinPHPTal extends Skin {
                global $wgScript, $wgStylePath, $wgLanguageCode, $wgUseNewInterlanguage;
                global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
                global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgSiteNotice;
-                       global $wgMaxCredits, $wgShowCreditsIfMax;
+               global $wgMaxCredits, $wgShowCreditsIfMax;
 
                extract( $wgRequest->getValues( 'oldid', 'diff' ) );
 
@@ -143,9 +167,12 @@ class SkinPHPTal extends Skin {
                $tpl->setRef( 'mimetype', $wgMimeType );
                $tpl->setRef( 'charset', $wgOutputEncoding );
                $tpl->set( 'headlinks', $out->getHeadLinks() );
+               $tpl->setRef( 'wgScript', $wgScript );
                $tpl->setRef( 'skinname', $this->skinname );
+               $tpl->setRef( 'stylename', $this->stylename );
                $tpl->setRef( 'loggedin', $this->loggedin );
                $tpl->set('nsclass', 'ns-'.$wgTitle->getNamespace());
+               $tpl->set('notspecialpage', $wgTitle->getNamespace() != NS_SPECIAL);
                /* XXX currently unused, might get useful later
                $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
                $tpl->set( "exists", $wgTitle->getArticleID() != 0 );
@@ -332,14 +359,14 @@ class SkinPHPTal extends Skin {
         * an array of edit links by default used for the tabs
         */
        function buildContentActionUrls () {
-               global $wgTitle, $wgUser, $wgRequest, $wgUseValidation;
+               global $wgTitle, $wgUser, $wgOut, $wgRequest, $wgUseValidation;
                $action = $wgRequest->getText( 'action' );
                $section = $wgRequest->getText( 'section' );
                $oldid = $wgRequest->getVal( 'oldid' );
                $diff = $wgRequest->getVal( 'diff' );
                $content_actions = array();
 
-               if( $this->iscontent ) {
+               if( $this->iscontent and !$wgOut->isQuickbarSuppressed() ) {
 
                        $nskey = $this->getNameSpaceKey();
                        $is_active = !Namespace::isTalk( $wgTitle->getNamespace()) ;
@@ -500,10 +527,8 @@ class SkinPHPTal extends Skin {
                $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
                $nav_urls['randompage'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage')));
                $nav_urls['recentchanges'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges')));
-               $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.urlencode( $this->thispage ))));
                $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : false;
                $nav_urls['portal'] = (wfMsg('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : false;
-               $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.urlencode( $this->thispage ))));
                $nav_urls['bugreports'] = array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage')));
                // $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $this->makeI18nUrl('sitesupportpage')));
                $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
@@ -513,6 +538,11 @@ class SkinPHPTal extends Skin {
                }
                $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
 
+               if( $wgTitle->getNamespace() != NS_SPECIAL) {
+               $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.urlencode( $this->thispage ))));
+               $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.urlencode( $this->thispage ))));
+               }
+
                if( $wgTitle->getNamespace() == NS_USER || $wgTitle->getNamespace() == NS_USER_TALK ) {
                        $id = User::idFromName($wgTitle->getText());
                        $ip = User::isIP($wgTitle->getText());
@@ -534,7 +564,6 @@ class SkinPHPTal extends Skin {
                        }
                }
 
-
                return $nav_urls;
        }
 
@@ -617,7 +646,7 @@ class SkinPHPTal extends Skin {
                $action = $wgRequest->getText('action');
                $maxage = $wgRequest->getText('maxage');
                $s = "/* generated user stylesheet */\n";
-               if($wgLang->isRTL()) $s .= '@import "'.$wgStylePath.'/'.$this->skinname.'/rtl.css";'."\n";
+               if($wgLang->isRTL()) $s .= '@import "'.$wgStylePath.'/'.$this->stylename.'/rtl.css";'."\n";
                $s .= '@import "'.
                $this->makeNSUrl(ucfirst($this->skinname).'.css', 'action=raw&ctype=text/css&smaxage='.$wgSquidMaxage, NS_MEDIAWIKI)."\";\n";
                if($wgUser->getID() != 0) {