X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FSkin.php;h=9b40f6d3036279f89c2508b191808445a147af60;hb=60c94987aab3141a19d735fbc003d5cb646a8502;hp=28fa550435dc3fba9de13ddc01a5ec171bef3a0b;hpb=90155b8a9719ada6522a320a3315b4e698fdd970;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Skin.php b/includes/Skin.php index 28fa550435..9b40f6d303 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -2,6 +2,7 @@ /** * + * @package MediaWiki */ /** @@ -10,8 +11,6 @@ if( defined( "MEDIAWIKI" ) ) { # See skin.doc - -require_once( 'Feed.php' ); // should not be called if the actual page isn't feed enabled require_once( 'Image.php' ); # These are the INTERNAL names, which get mapped directly to class names and @@ -54,8 +53,18 @@ unset($matches); require_once( 'RecentChange.php' ); +global $wgLinkHolders; +$wgLinkHolders = array( + 'namespaces' => array(), + 'dbkeys' => array(), + 'queries' => array(), + 'texts' => array(), + 'titles' => array() +); + /** * @todo document + * @package MediaWiki */ class RCCacheEntry extends RecentChange { @@ -77,6 +86,7 @@ class RCCacheEntry extends RecentChange * The main skin class that provide methods and properties for all other skins * including PHPTal skins. * This base class is also the "Standard" skin. + * @package MediaWiki */ class Skin { /**#@+ @@ -102,9 +112,9 @@ class Skin { } function getStylesheet() { - return 'wikistandard.css'; + return 'common/wikistandard.css'; } - + function getSkinName() { return 'standard'; } @@ -203,7 +213,7 @@ class Skin { function getHeadScripts() { global $wgStylePath, $wgUser, $wgLang, $wgAllowUserJs; - $r = "\n"; + $r = "\n"; if( $wgAllowUserJs && $wgUser->getID() != 0 ) { # logged in $userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName(); $userjs = htmlspecialchars($this->makeUrl($userpage.'/'.$this->getSkinName().'.js', 'action=raw&ctype=text/javascript')); @@ -218,7 +228,7 @@ class Skin { $sheet = $this->getStylesheet(); $action = $wgRequest->getText('action'); $s = "@import \"$wgStylePath/$sheet\";\n"; - if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common_rtl.css\";\n"; + if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n"; if( $wgAllowUserCss && $wgUser->getID() != 0 ) { # logged in if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { $s .= $wgRequest->getText('wpTextbox1'); @@ -230,7 +240,7 @@ class Skin { $s .= $this->doGetUserStyles(); return $s."\n"; } - + /** * placeholder, returns generated js in monobook */ @@ -457,7 +467,7 @@ class Skin { # of categories an article belong to if($wgUseCategoryBrowser) { $s .= '

'; - + # get a big array of the parents tree $parenttree = $wgTitle->getCategorieBrowser(); @@ -481,7 +491,7 @@ class Skin { } return $return; } - + $s .= walkThrough($parenttree); } @@ -671,7 +681,7 @@ class Skin { $sub = $wgOut->getSubtitle(); if ( '' == $sub ) { global $wgExtraSubtitle; - $sub = wfMsg( 'fromwikipedia' ) . $wgExtraSubtitle; + $sub = wfMsg( 'tagline' ) . $wgExtraSubtitle; } $subpages = $this->subPageSubtitle(); $sub .= !empty($subpages)?"

$subpages":''; @@ -910,7 +920,7 @@ class Skin { function getPoweredBy() { global $wgStylePath; - $url = htmlspecialchars( "$wgStylePath/images/poweredby_mediawiki_88x31.png" ); + $url = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" ); $img = 'MediaWiki'; return $img; } @@ -1144,7 +1154,7 @@ class Skin { function aboutLink() { $s = $this->makeKnownLink( wfMsg( 'aboutpage' ), - wfMsg( 'aboutwikipedia' ) ); + wfMsg( 'aboutsite' ) ); return $s; } @@ -1496,7 +1506,7 @@ class Skin { * Pass a title object, not a title string */ function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' ) { - global $wgOut, $wgUser; + global $wgOut, $wgUser, $wgLinkHolders; $fname = 'Skin::makeLinkObj'; # Fail gracefully @@ -1533,8 +1543,13 @@ class Skin { } # Allows wiki to bypass using linkcache, see OutputPage::parseLinkHolders() - $retVal = '{$trail}"; + $nr = array_push( $wgLinkHolders['namespaces'], $nt->getNamespace() ); + $wgLinkHolders['dbkeys'][] = $nt->getDBkey(); + $wgLinkHolders['queries'][] = $query; + $wgLinkHolders['texts'][] = $prefix.$text.$inside; + $wgLinkHolders['titles'][] = $nt; + + $retVal = '{$trail}"; } else { # Work out link colour immediately $aid = $nt->getArticleID() ; @@ -1724,7 +1739,7 @@ class Skin { return $title->getLocalURL( $urlaction ); } /*static*/ function makeI18nUrl ( $name, $urlaction='' ) { - $title = Title::newFromText( wfMsg($name) ); + $title = Title::newFromText( wfMsgForContent($name) ); $this->checkTitle($title, $name); return $title->getLocalURL( $urlaction ); } @@ -1768,7 +1783,7 @@ class Skin { ); } /*static*/ function makeI18nUrlDetails ( $name, $urlaction='' ) { - $title = Title::newFromText( wfMsg($name) ); + $title = Title::newFromText( wfMsgForContent($name) ); $this->checkTitle($title, $name); return array( 'href' => $title->getLocalURL( $urlaction ), @@ -2016,7 +2031,7 @@ class Skin { } else { $zoomicon = '

'. ''. - ''.$more.'
'; } } @@ -2109,7 +2124,7 @@ class Skin { # Spacer image $r = '' ; - $r .= '' ; + $r .= '' ; $r .= '' ; if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { @@ -2200,8 +2215,8 @@ class Skin { $rcm = 'RCM'.$this->rcCacheIndex ; $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')" ; $arrowdir = $wgLang->isRTL() ? 'l' : 'r'; - $tl = '' ; - $tl .= '' ; + $tl = '' ; + $tl .= '' ; $r .= $tl ; # Main line @@ -2243,7 +2258,7 @@ class Skin { # Get rc_xxxx variables extract( $rcObj->mAttribs ); - $r .= ''; + $r .= ''; $r .= '       ' ; if ( $rc_new ) $r .= $N ; else $r .= ' ' ; @@ -2553,10 +2568,10 @@ class Skin { * comments. It escapes any HTML in the comment, but adds some CSS to format * auto-generated comments (from section editing) and formats [[wikilinks]]. * - * The &$title parameter must be a title OBJECT. It is used to generate a + * The &$title parameter must be a title OBJECT. It is used to generate a * direct link to the section in the autocomment. * @author Erik Moeller - * + * * Note: there's not always a title to pass to this function. * Since you can't set a default parameter for a reference, I've turned it * temporarily to a value pass. Should be adjusted further. --brion @@ -2576,7 +2591,7 @@ class Skin { $link=''; if($title) { $section=$auto; - + # This is hackish but should work in most cases. $section=str_replace('[[','',$section); $section=str_replace(']]','',$section); @@ -2715,6 +2730,12 @@ class Skin { * These two do not check for permissions: check $wgTitle->userCanEdit * before calling them */ + function editSectionScriptForOther( $title, $section, $head ) { + $ttl = Title::newFromText( $title ); + $url = $ttl->escapeLocalURL( 'action=edit§ion='.$section ); + return ''.$head.''; + } + function editSectionScript( $section, $head ) { global $wgTitle, $wgRequest; if( $wgRequest->getInt( 'oldid' ) && ( $wgRequest->getVal( 'diff' ) != '0' ) ) { @@ -2724,6 +2745,25 @@ class Skin { return ''.$head.''; } + function editSectionLinkForOther( $title, $section ) { + global $wgRequest; + global $wgUser, $wgLang; + + $title = Title::newFromText($title); + $editurl = '§ion='.$section; + $url = $this->makeKnownLink($title->getPrefixedText(),wfMsg('editsection'),'action=edit'.$editurl); + + if( $wgLang->isRTL() ) { + $farside = 'left'; + $nearside = 'right'; + } else { + $farside = 'right'; + $nearside = 'left'; + } + return "
[".$url."]
"; + + } + function editSectionLink( $section ) { global $wgRequest; global $wgTitle, $wgUser, $wgLang; @@ -2753,7 +2793,7 @@ class Skin { * This function is called by EditPage.php and shows a bulletin board style * toolbar for common editing functions. It can be disabled in the user * preferences. - * The necsesary JavaScript code can be found in style/wikibits.js. + * The necessary JavaScript code can be found in style/wikibits.js. */ function getEditToolbar() { global $wgStylePath, $wgLang, $wgMimeType; @@ -2853,7 +2893,7 @@ class Skin { $toolbar.="document.writeln(\"
\");\n"; foreach($toolarray as $tool) { - $image=$wgStylePath.'/images/'.$tool['image']; + $image=$wgStylePath.'/common/images/'.$tool['image']; $open=$tool['open']; $close=$tool['close']; $sample = addslashes( $tool['sample'] );