From 370e83bb0dfd0c70de268c93bf07ad5ee0897192 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 15 Aug 2008 01:29:47 +0200 Subject: Update auf 1.13.0 --- includes/Skin.php | 229 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 140 insertions(+), 89 deletions(-) (limited to 'includes/Skin.php') diff --git a/includes/Skin.php b/includes/Skin.php index 30d2c2bc..a9e44ab4 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1,22 +1,26 @@ addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) ); } - + if( false !== $wgAppleTouchIcon ) { $out->addLink( array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) ); - } - - $code = $wgContLang->getCode(); - $name = $wgContLang->getLanguageName( $code ); - $langName = $name ? $name : $code; + } # OpenSearch description link - $out->addLink( array( - 'rel' => 'search', + $out->addLink( array( + 'rel' => 'search', 'type' => 'application/opensearchdescription+xml', 'href' => "$wgScriptPath/opensearch_desc{$wgScriptExtension}", - 'title' => "$wgSitename ($langName)", + 'title' => wfMsgForContent( 'opensearch-desc' ), )); $this->addMetadataLinks($out); $this->mRevisionId = $out->mRevisionId; - + $this->preloadExistence(); wfProfileOut( __METHOD__ ); @@ -207,7 +207,7 @@ class Skin extends Linker { $lb = new LinkBatch( $titles ); $lb->execute(); } - + function addMetadataLinks( &$out ) { global $wgTitle, $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf; global $wgRightsPage, $wgRightsUrl; @@ -271,7 +271,7 @@ class Skin extends Linker { $out->out( $this->bottomScripts() ); - $out->out( $out->reportTime() ); + $out->out( wfReportTime() ); $out->out( "\n" ); wfProfileOut( __METHOD__ ); @@ -300,19 +300,23 @@ class Skin extends Linker { global $wgScript, $wgStylePath, $wgUser; global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang; global $wgTitle, $wgCanonicalNamespaceNames, $wgOut, $wgArticle; - global $wgBreakFrames, $wgRequest; + global $wgBreakFrames, $wgRequest, $wgVariantArticlePath, $wgActionPaths; global $wgUseAjax, $wgAjaxWatch; global $wgVersion, $wgEnableAPI, $wgEnableWriteAPI; + global $wgRestrictionTypes, $wgLivePreview; + global $wgMWSuggestTemplate, $wgDBname, $wgEnableMWSuggest; $ns = $wgTitle->getNamespace(); $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText(); - $vars = array( + $vars = array( 'skin' => $data['skinname'], 'stylepath' => $wgStylePath, 'wgArticlePath' => $wgArticlePath, 'wgScriptPath' => $wgScriptPath, 'wgScript' => $wgScript, + 'wgVariantArticlePath' => $wgVariantArticlePath, + 'wgActionPaths' => $wgActionPaths, 'wgServer' => $wgServer, 'wgCanonicalNamespace' => $nsname, 'wgCanonicalSpecialPageName' => SpecialPage::resolveAlias( $wgTitle->getDBkey() ), @@ -320,8 +324,6 @@ class Skin extends Linker { 'wgPageName' => $wgTitle->getPrefixedDBKey(), 'wgTitle' => $wgTitle->getText(), 'wgAction' => $wgRequest->getText( 'action', 'view' ), - 'wgRestrictionEdit' => $wgTitle->getRestrictions( 'edit' ), - 'wgRestrictionMove' => $wgTitle->getRestrictions( 'move' ), 'wgArticleId' => $wgTitle->getArticleId(), 'wgIsArticle' => $wgOut->isArticle(), 'wgUserName' => $wgUser->isAnon() ? NULL : $wgUser->getName(), @@ -334,8 +336,17 @@ class Skin extends Linker { 'wgEnableAPI' => $wgEnableAPI, 'wgEnableWriteAPI' => $wgEnableWriteAPI, ); + + if( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false )){ + $vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate(); + $vars['wgDBname'] = $wgDBname; + $vars['wgSearchNamespaces'] = SearchEngine::userNamespaces( $wgUser ); + $vars['wgMWSuggestMessages'] = array( wfMsg('search-mwsuggest-enabled'), wfMsg('search-mwsuggest-disabled')); + } + + foreach( $wgRestrictionTypes as $type ) + $vars['wgRestriction' . ucfirst( $type )] = $wgTitle->getRestrictions( $type ); - global $wgLivePreview; if ( $wgLivePreview && $wgUser->getOption( 'uselivepreview' ) ) { $vars['wgLivepreviewMessageLoading'] = wfMsg( 'livepreview-loading' ); $vars['wgLivepreviewMessageReady'] = wfMsg( 'livepreview-ready' ); @@ -507,7 +518,7 @@ a.stub:after, #quickbar a.stub:after { END; } if( $wgUser->getOption( 'justify' ) ) { - $s .= "#article, #bodyContent { text-align: justify; }\n"; + $s .= "#article, #bodyContent, #mw_content { text-align: justify; }\n"; } if( !$wgUser->getOption( 'showtoc' ) ) { $s .= "#toc { display: none; }\n"; @@ -535,14 +546,10 @@ END; } $a['onload'] = $wgOut->getOnloadHandler(); - if( $wgUser->getOption( 'editsectiononrightclick' ) ) { - if( $a['onload'] != '' ) { - $a['onload'] .= ';'; - } - $a['onload'] .= 'setupRightClickEdit()'; - } - $a['class'] = 'ns-'.$wgTitle->getNamespace().' '.($wgContLang->isRTL() ? "rtl" : "ltr"). - ' '.Sanitizer::escapeClass( 'page-'.$wgTitle->getPrefixedText() ); + $a['class'] = + 'mediawiki ns-'.$wgTitle->getNamespace(). + ' '.($wgContLang->isRTL() ? "rtl" : "ltr"). + ' '.Sanitizer::escapeClass( 'page-'.$wgTitle->getPrefixedText() ); return $a; } @@ -625,9 +632,9 @@ END; } - function getCategoryLinks () { + function getCategoryLinks() { global $wgOut, $wgTitle, $wgUseCategoryBrowser; - global $wgContLang; + global $wgContLang, $wgUser; if( count( $wgOut->mCategoryLinks ) == 0 ) return ''; @@ -639,11 +646,33 @@ END; $dir = $wgContLang->isRTL() ? 'rtl' : 'ltr'; $embed = ""; $pop = ''; - $t = $embed . implode ( "{$pop} {$sep} {$embed}" , $wgOut->mCategoryLinks ) . $pop; - $msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escape' ), count( $wgOut->mCategoryLinks ) ); - $s = $this->makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg ) - . ': ' . $t; + $allCats = $wgOut->getCategoryLinks(); + $s = ''; + $colon = wfMsgExt( 'colon-separator', 'escapenoentities' ); + if ( !empty( $allCats['normal'] ) ) { + $t = $embed . implode ( "{$pop} {$sep} {$embed}" , $allCats['normal'] ) . $pop; + + $msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escapenoentities' ), count( $allCats['normal'] ) ); + $s .= ''; + } + + # Hidden categories + if ( isset( $allCats['hidden'] ) ) { + if ( $wgUser->getBoolOption( 'showhiddencats' ) ) { + $class ='mw-hidden-cats-user-shown'; + } elseif ( $wgTitle->getNamespace() == NS_CATEGORY ) { + $class = 'mw-hidden-cats-ns-shown'; + } else { + $class = 'mw-hidden-cats-hidden'; + } + $s .= "
" . + wfMsgExt( 'hidden-categories', array( 'parsemag', 'escapenoentities' ), count( $allCats['hidden'] ) ) . + $colon . $embed . implode( "$pop $sep $embed", $allCats['hidden'] ) . $pop . + "
"; + } # optional 'dmoz-like' category browser. Will be shown under the list # of categories an article belong to @@ -689,8 +718,16 @@ END; function getCategories() { $catlinks=$this->getCategoryLinks(); - if(!empty($catlinks)) { - return ""; + + $classes = 'catlinks'; + + if( strpos( $catlinks, '