r92054 : Remove leftover space
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index fad14f5..6002cc0 100644 (file)
@@ -299,36 +299,31 @@ class SkinTemplate extends Skin {
                $tpl->setRef( 'serverurl', $wgServer );
                $tpl->setRef( 'logopath', $wgLogo );
 
-               $lang = wfUILang();
-               $tpl->set( 'lang', $lang->getCode() );
-               $tpl->set( 'dir', $lang->getDir() );
-               $tpl->set( 'rtl', $lang->isRTL() );
+               $contentlang = $wgContLang->getCode();
+               $contentdir  = $wgContLang->getDir();
+               $userlang = $wgLang->getCode();
+               $userdir  = $wgLang->getDir();
+
+               $tpl->set( 'lang', $userlang );
+               $tpl->set( 'dir', $userdir );
+               $tpl->set( 'rtl', $wgLang->isRTL() );
 
                $tpl->set( 'capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '' );
                $tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) );
                $tpl->set( 'username', $wgUser->isAnon() ? null : $this->username );
                $tpl->setRef( 'userpage', $this->userpage );
                $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href'] );
-               $tpl->set( 'userlang', $wgLang->getCode() );
+               $tpl->set( 'userlang', $userlang );
 
                // Users can have their language set differently than the
                // content of the wiki. For these users, tell the web browser
                // that interface elements are in a different language.
                $tpl->set( 'userlangattributes', '' );
-               $tpl->set( 'specialpageattributes', '' );
-
-               $lang = $wgLang->getCode();
-               $dir  = $wgLang->getDir();
-               if ( $lang !== $wgContLang->getCode() || $dir !== $wgContLang->getDir() ) {
-                       $attrs = " lang='$lang' dir='$dir'";
+               $tpl->set( 'specialpageattributes', '' ); # obsolete
 
+               if ( $userlang !== $contentlang || $userdir !== $contentdir ) {
+                       $attrs = " lang='$userlang' dir='$userdir'";
                        $tpl->set( 'userlangattributes', $attrs );
-
-                       // The content of SpecialPages should be presented in the
-                       // user's language. Content of regular pages should not be touched.
-                       if( $this->getTitle()->isSpecialPage() ) {
-                               $tpl->set( 'specialpageattributes', $attrs );
-                       }
                }
 
                $newtalks = $this->getNewtalks( $out );
@@ -454,19 +449,18 @@ class SkinTemplate extends Skin {
                $tpl->set( 'bottomscripts', $this->bottomScripts( $out ) );
                $tpl->set( 'printfooter', $this->printSource() );
 
-               global $wgBetterDirectionality;
-               if ( $wgBetterDirectionality ) {
-                       // not for special pages AND only when viewing AND if the page exists
-                       // (or is in MW namespace, because that has default content)
-                       if( $this->getTitle()->getNamespace() != NS_SPECIAL &&
-                               in_array( $action, array( 'view', 'render', 'print' ) ) &&
-                               ( $this->getTitle()->exists() || $this->getTitle()->getNamespace() == NS_MEDIAWIKI ) ) {
-                               $getPageLang = $out->parserOptions()->getTargetLanguage( $this->getTitle() );
-                               $pageLang = ( $getPageLang ? $getPageLang : $wgContLang );
-                               $realBodyAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() );
-                               $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext );
-                       }
+               # Add a <div class="mw-content-ltr/rtl"> around the body text
+               # not for special pages or file pages AND only when viewing AND if the page exists
+               # (or is in MW namespace, because that has default content)
+               if( !in_array( $this->getTitle()->getNamespace(), array( NS_SPECIAL, NS_FILE ) ) &&
+                       in_array( $action, array( 'view', 'historysubmit' ) ) &&
+                       ( $this->getTitle()->exists() || $this->getTitle()->getNamespace() == NS_MEDIAWIKI ) ) {
+                       $pageLang = $this->getTitle()->getPageLanguage();
+                       $realBodyAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
+                               'class' => 'mw-content-'.$pageLang->getDir() );
+                       $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext );
                }
+
                $tpl->setRef( 'bodytext', $out->mBodytext );
 
                # Language links
@@ -988,7 +982,8 @@ class SkinTemplate extends Skin {
                        } else {
                                // article doesn't exist or is deleted
                                if ( $wgUser->isAllowed( 'deletedhistory' ) ) {
-                                       $n = $title->isDeleted();
+                                       $includeSuppressed = $wgUser->isAllowed( 'suppressrevision' );
+                                       $n = $title->isDeleted( $includeSuppressed );
                                        if( $n ) {
                                                $undelTitle = SpecialPage::getTitleFor( 'Undelete' );
                                                // If the user can't undelete but can view deleted history show them a "View .. deleted" tab instead
@@ -1576,7 +1571,7 @@ abstract class BaseTemplate extends QuickTemplate {
                }
 
                $attrs = array();
-               foreach ( array( 'href', 'id', 'class', 'rel', 'type' ) as $attr ) {
+               foreach ( array( 'href', 'id', 'class', 'rel', 'type', 'target') as $attr ) {
                        if ( isset( $item[$attr] ) ) {
                                $attrs[$attr] = $item[$attr];
                        }
@@ -1594,7 +1589,7 @@ abstract class BaseTemplate extends QuickTemplate {
                        } else {
                                $attrs = array_merge(
                                        $attrs,
-                                       $this->skin->tooltipAndAccesskeyAttribs( $item['single-id'] )
+                                       Linker::tooltipAndAccesskeyAttribs( $item['single-id'] )
                                );
                        }
                }
@@ -1629,7 +1624,7 @@ abstract class BaseTemplate extends QuickTemplate {
                        }
                } else {
                        $link = array();
-                       foreach ( array( 'text', 'msg', 'href', 'rel', 'type', 'tooltiponly' ) as $k ) {
+                       foreach ( array( 'text', 'msg', 'href', 'rel', 'type', 'tooltiponly', 'target' ) as $k ) {
                                if ( isset( $item[$k] ) ) {
                                        $link[$k] = $item[$k];
                                }
@@ -1665,7 +1660,7 @@ abstract class BaseTemplate extends QuickTemplate {
                        'name' => 'search',
                        'value' => isset( $this->data['search'] ) ? $this->data['search'] : '',
                );
-               $realAttrs = array_merge( $realAttrs, $this->skin->tooltipAndAccesskeyAttribs( 'search' ), $attrs );
+               $realAttrs = array_merge( $realAttrs, Linker::tooltipAndAccesskeyAttribs( 'search' ), $attrs );
                return Html::element( 'input', $realAttrs );
        }
 
@@ -1681,7 +1676,7 @@ abstract class BaseTemplate extends QuickTemplate {
                                );
                                $realAttrs = array_merge(
                                        $realAttrs,
-                                       $this->skin->tooltipAndAccesskeyAttribs( "search-$mode" ),
+                                       Linker::tooltipAndAccesskeyAttribs( "search-$mode" ),
                                        $attrs
                                );
                                return Html::element( 'input', $realAttrs );
@@ -1692,7 +1687,7 @@ abstract class BaseTemplate extends QuickTemplate {
                                );
                                $buttonAttrs = array_merge(
                                        $buttonAttrs,
-                                       $this->skin->tooltipAndAccesskeyAttribs( 'search-fulltext' ),
+                                       Linker::tooltipAndAccesskeyAttribs( 'search-fulltext' ),
                                        $attrs
                                );
                                unset( $buttonAttrs['src'] );