# while code from www.php.net
while (false !== ($file = $skinDir->read())) {
// Skip non-PHP files, hidden files, and '.dep' includes
+ $matches = array();
if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
$aSkin = $matches[1];
$wgValidSkinNames[strtolower($aSkin)] = $aSkin;
*/
static function normalizeKey( $key ) {
global $wgDefaultSkin;
- $skinNames = self::getSkinNames();
+ $skinNames = Skin::getSkinNames();
if( $key == '' ) {
// Don't return the default immediately;
static function &newFromKey( $key ) {
global $wgStyleDirectory;
- $key = self::normalizeKey( $key );
+ $key = Skin::normalizeKey( $key );
- $skinNames = self::getSkinNames();
+ $skinNames = Skin::getSkinNames();
$skinName = $skinNames[$key];
# Grab the skin class and initialise it.
- wfSuppressWarnings();
// Preload base classes to work around APC/PHP5 bug
- include_once( "{$wgStyleDirectory}/{$skinName}.deps.php" );
- wfRestoreWarnings();
+ $deps = "{$wgStyleDirectory}/{$skinName}.deps.php";
+ if( file_exists( $deps ) ) include_once( $deps );
require_once( "{$wgStyleDirectory}/{$skinName}.php" );
# Check if we got if not failback to default skin
global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
global $wgTitle, $wgCanonicalNamespaceNames, $wgOut;
- $nsname = @$wgCanonicalNamespaceNames[ $wgTitle->getNamespace() ];
- if ( $nsname === NULL ) $nsname = $wgTitle->getNsText();
-
+ $ns = $wgTitle->getNamespace();
+ $nsname = isset( $wgCanonicalNamespaceNames[ $ns ] ) ? $wgCanonicalNamespaceNames[ $ns ] : $wgTitle->getNsText();
+
$vars = array(
'jsmimetype' => $wgJsMimeType,
'skinname' => $this->getSkinName(),
$r = self::makeGlobalVariablesScript( $vars );
$r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>\n";
+ global $wgUseSiteJs;
+ if ($wgUseSiteJs) {
+ if ($wgUser->isLoggedIn()) {
+ $r .= "<script type=\"$wgJsMimeType\" src=\"".htmlspecialchars(self::makeUrl('-','action=raw&smaxage=0&gen=js'))."\"><!-- site js --></script>\n";
+ } else {
+ $r .= "<script type=\"$wgJsMimeType\" src=\"".htmlspecialchars(self::makeUrl('-','action=raw&gen=js'))."\"><!-- site js --></script>\n";
+ }
+ }
if( $wgAllowUserJs && $wgUser->isLoggedIn() ) {
$userpage = $wgUser->getUserPage();
$userjs = htmlspecialchars( self::makeUrl(
function getUserStylesheet() {
global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage, $wgStyleVersion;
$sheet = $this->getStylesheet();
- $action = $wgRequest->getText('action');
$s = "@import \"$wgStylePath/common/common.css?$wgStyleVersion\";\n";
$s .= "@import \"$wgStylePath/$sheet?$wgStyleVersion\";\n";
if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css?$wgStyleVersion\";\n";
}
/**
- * placeholder, returns generated js in monobook
+ * This returns MediaWiki:Common.js. For some bizarre reason, it does
+ * *not* return any custom user JS from user subpages. Huh?
+ *
+ * @return string
*/
- function getUserJs() { return; }
+ function getUserJs() {
+ $fname = 'Skin::getUserJs';
+ wfProfileIn( $fname );
+
+ global $wgStylePath;
+ $s = "/* generated javascript */\n";
+ $s .= "var skin = '{$this->skinname}';\nvar stylepath = '{$wgStylePath}';";
+ $s .= "\n\n/* MediaWiki:Common.js */\n";
+ $commonJs = wfMsgForContent('Common.js');
+ if ( !wfEmptyMsg ( 'Common.js', $commonJs ) ) {
+ $s .= $commonJs;
+ }
+
+ wfProfileOut( $fname );
+ return $s;
+ }
/**
* Return html code that include User stylesheets
else $a = array( 'bgcolor' => '#FFFFFF' );
if($wgOut->isArticle() && $wgUser->getOption('editondblclick') &&
$wgTitle->userCanEdit() ) {
- $t = wfMsg( 'editthispage' );
$s = $wgTitle->getFullURL( $this->editUrlOptions() );
$s = 'document.location = "' .wfEscapeJSString( $s ) .'";';
$a += array ('ondblclick' => $s);
$t = $embed . implode ( "{$pop} {$sep} {$embed}" , $wgOut->mCategoryLinks ) . $pop;
$msg = wfMsgExt( 'pagecategories', array( 'parsemag', 'escape' ), count( $wgOut->mCategoryLinks ) );
- $s = self::makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg )
+ $s = $this->makeLinkObj( Title::newFromText( wfMsgForContent('pagecategorieslink') ), $msg )
. ': ' . $t;
# optional 'dmoz-like' category browser. Will be shown under the list
$parenttree = $wgTitle->getParentCategoryTree();
# Skin object passed by reference cause it can not be
# accessed under the method subfunction drawCategoryBrowser
- $tempout = explode("\n", self::drawCategoryBrowser($parenttree, $this) );
+ $tempout = explode("\n", Skin::drawCategoryBrowser($parenttree, $this) );
# Clean out bogus first entry and sort them
unset($tempout[0]);
asort($tempout);
return $s;
}
- /**
- * Render the array as a series of links.
- * @param $tree Array categories tree returned by Title::getParentCategoryTree
- * @param &skin Object skin passed by reference
+ /** Render the array as a serie of links.
+ * @param $tree Array: categories tree returned by Title::getParentCategoryTree
+ * @param &skin Object: skin passed by reference
* @return String separated by >, terminate with "\n"
- * @static
*/
- static function drawCategoryBrowser($tree, &$skin) {
+ function drawCategoryBrowser($tree, &$skin) {
$return = '';
foreach ($tree as $element => $parent) {
if (empty($parent)) {
$return .= "\n";
} else {
# grab the others elements
- $return .= self::drawCategoryBrowser($parent, $skin) . ' > ';
+ $return .= Skin::drawCategoryBrowser($parent, $skin) . ' > ';
}
# add our current element to the list
$eltitle = Title::NewFromText($element);
- $return .= self::makeLinkObj( $eltitle, $eltitle->getText() ) ;
+ $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
}
return $return;
}
function pageTitleLinks() {
global $wgOut, $wgTitle, $wgUser, $wgRequest;
- extract( $wgRequest->getValues( 'oldid', 'diff' ) );
+ $oldid = $wgRequest->getVal( 'oldid' );
+ $diff = $wgRequest->getVal( 'diff' );
$action = $wgRequest->getText( 'action' );
$s = $this->printableLink();
$image = new Image( $wgTitle );
if( $image->exists() ) {
$link = htmlspecialchars( $image->getURL() );
- $style = self::getInternalLinkAttributes( $link, $name );
+ $style = $this->getInternalLinkAttributes( $link, $name );
$s .= " | <a href=\"{$link}\"{$style}>{$name}</a>";
}
}
}
if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
- $s .= ' | ' . self::makeKnownLinkObj( $wgTitle,
+ $s .= ' | ' . $this->makeKnownLinkObj( $wgTitle,
wfMsg( 'currentrev' ) );
}
# do not show "You have new messages" text when we are viewing our
# own talk page
if( !$wgTitle->equals( $wgUser->getTalkPage() ) ) {
- $tl = self::makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
- $dl = self::makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
+ $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessageslink' ), 'redirect=no' );
+ $dl = $this->makeKnownLinkObj( $wgUser->getTalkPage(), wfMsgHtml( 'newmessagesdifflink' ), 'diff=cur' );
$s.= ' | <strong>'. wfMsg( 'youhavenewmessages', $tl, $dl ) . '</strong>';
# disable caching
$wgOut->setSquidMaxage(0);
$msg = 'viewdeleted';
}
return wfMsg( $msg,
- self::makeKnownLink(
+ $this->makeKnownLink(
$wgContLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ),
wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $n ) ) );
}
$c++;
if ($c<count($links)) {
$growinglink .= $link;
- $getlink = self::makeLink( $growinglink, htmlspecialchars( $link ) );
+ $getlink = $this->makeLink( $growinglink, htmlspecialchars( $link ) );
if(preg_match('/class="new"/i',$getlink)) { break; } # this is a hack, but it saves time
if ($c>1) {
$subpages .= ' | ';
function nameAndLogin() {
global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader;
- $li = $wgContLang->specialPage( 'Userlogin' );
$lo = $wgContLang->specialPage( 'Userlogout' );
$s = '';
if( $wgShowIPinHeader && isset( $_COOKIE[ini_get('session.name')] ) ) {
$n = wfGetIP();
- $tl = self::makeKnownLinkObj( $wgUser->getTalkPage(),
+ $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
$wgLang->getNsText( NS_TALK ) );
$s .= $n . ' ('.$tl.')';
$q = '';
} else { $q = "returnto={$rt}"; }
- $s .= "\n<br />" . self::makeKnownLinkObj(
+ $s .= "\n<br />" . $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Userlogin' ),
wfMsg( 'login' ), $q );
} else {
$n = $wgUser->getName();
$rt = $wgTitle->getPrefixedURL();
- $tl = self::makeKnownLinkObj( $wgUser->getTalkPage(),
+ $tl = $this->makeKnownLinkObj( $wgUser->getTalkPage(),
$wgLang->getNsText( NS_TALK ) );
$tl = " ({$tl})";
- $s .= self::makeKnownLinkObj( $wgUser->getUserPage(),
+ $s .= $this->makeKnownLinkObj( $wgUser->getUserPage(),
$n ) . "{$tl}<br />" .
- self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
+ $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Userlogout' ), wfMsg( 'logout' ),
"returnto={$rt}" ) . ' | ' .
- self::specialLink( 'preferences' );
+ $this->specialLink( 'preferences' );
}
- $s .= ' | ' . self::makeKnownLink( wfMsgForContent( 'helppage' ),
+ $s .= ' | ' . $this->makeKnownLink( wfMsgForContent( 'helppage' ),
wfMsg( 'help' ) );
return $s;
}
function getSearchLink() {
- $searchPage =& SpecialPage::getTitleFor( 'Search' );
+ $searchPage = SpecialPage::getTitleFor( 'Search' );
return $searchPage->getLocalURL();
}
$sep = " |\n";
$s = $this->mainPageLink() . $sep
- . self::specialLink( 'recentchanges' );
+ . $this->specialLink( 'recentchanges' );
if ( $wgOut->isArticleRelated() ) {
$s .= $sep . $this->editThisPage()
global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers;
- extract( $wgRequest->getValues( 'oldid', 'diff' ) );
+ $oldid = $wgRequest->getVal( 'oldid' );
+ $diff = $wgRequest->getVal( 'diff' );
if ( ! $wgOut->isArticle() ) { return ''; }
if ( isset( $oldid ) || isset( $diff ) ) { return ''; }
if ( 0 == $wgArticle->getID() ) { return ''; }
if ($wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
$dbr =& wfGetDB( DB_SLAVE );
- extract( $dbr->tableNames( 'watchlist' ) );
+ $watchlist = $dbr->tableName( 'watchlist' );
$sql = "SELECT COUNT(*) AS n FROM $watchlist
WHERE wl_title='" . $dbr->strencode($wgTitle->getDBKey()) .
"' AND wl_namespace=" . $wgTitle->getNamespace() ;
$out = '';
if( $wgRightsPage ) {
- $link = self::makeKnownLink( $wgRightsPage, $wgRightsText );
+ $link = $this->makeKnownLink( $wgRightsPage, $wgRightsText );
} elseif( $wgRightsUrl ) {
- $link = self::makeExternalLink( $wgRightsUrl, $wgRightsText );
+ $link = $this->makeExternalLink( $wgRightsUrl, $wgRightsText );
} else {
# Give up now
return $out;
*/
function specialPagesList() {
global $wgUser, $wgContLang, $wgServer, $wgRedirectScript;
- $a = array();
$pages = array_merge( SpecialPage::getRegularPages(), SpecialPage::getRestrictedPages() );
foreach ( $pages as $name => $page ) {
$pages[$name] = $page->getDescription();
function mainPageLink() {
$mp = wfMsgForContent( 'mainpage' );
$mptxt = wfMsg( 'mainpage');
- $s = self::makeKnownLink( $mp, $mptxt );
+ $s = $this->makeKnownLink( $mp, $mptxt );
return $s;
}
function copyrightLink() {
- $s = self::makeKnownLink( wfMsgForContent( 'copyrightpage' ),
+ $s = $this->makeKnownLink( wfMsgForContent( 'copyrightpage' ),
wfMsg( 'copyrightpagename' ) );
return $s;
}
if ($privacy == '-') {
return '';
} else {
- return self::makeKnownLink( wfMsgForContent( 'privacypage' ), $privacy);
+ return $this->makeKnownLink( wfMsgForContent( 'privacypage' ), $privacy);
}
}
function aboutLink() {
- $s = self::makeKnownLink( wfMsgForContent( 'aboutpage' ),
+ $s = $this->makeKnownLink( wfMsgForContent( 'aboutpage' ),
wfMsg( 'aboutsite' ) );
return $s;
}
if ($disclaimers == '-') {
return '';
} else {
- return self::makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
+ return $this->makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
$disclaimers );
}
}
$t = wfMsg( 'viewsource' );
}
- $s = self::makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() );
+ $s = $this->makeKnownLinkObj( $wgTitle, $t, $this->editUrlOptions() );
}
return $s;
}
if ( $wgTitle->getArticleId() && ( ! $diff ) && $wgUser->isAllowed('delete') ) {
$t = wfMsg( 'deletethispage' );
- $s = self::makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
+ $s = $this->makeKnownLinkObj( $wgTitle, $t, 'action=delete' );
} else {
$s = '';
}
$t = wfMsg( 'protectthispage' );
$q = 'action=protect';
}
- $s = self::makeKnownLinkObj( $wgTitle, $t, $q );
+ $s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
} else {
$s = '';
}
$t = wfMsg( 'watchthispage' );
$q = 'action=watch';
}
- $s = self::makeKnownLinkObj( $wgTitle, $t, $q );
+ $s = $this->makeKnownLinkObj( $wgTitle, $t, $q );
} else {
$s = wfMsg( 'notanarticle' );
}
global $wgTitle;
if ( $wgTitle->userCanMove() ) {
- return self::makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
+ return $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ),
wfMsg( 'movethispage' ), 'target=' . $wgTitle->getPrefixedURL() );
} else {
// no message if page is protected - would be redundant
function historyLink() {
global $wgTitle;
- return self::makeKnownLinkObj( $wgTitle,
+ return $this->makeKnownLinkObj( $wgTitle,
wfMsg( 'history' ), 'action=history' );
}
function whatLinksHere() {
global $wgTitle;
- return self::makeKnownLinkObj(
+ return $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Whatlinkshere', $wgTitle->getPrefixedDBkey() ),
wfMsg( 'whatlinkshere' ) );
}
function userContribsLink() {
global $wgTitle;
- return self::makeKnownLinkObj(
+ return $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Contributions', $wgTitle->getDBkey() ),
wfMsg( 'contributions' ) );
}
function emailUserLink() {
global $wgTitle;
- return self::makeKnownLinkObj(
+ return $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Emailuser', $wgTitle->getDBkey() ),
wfMsg( 'emailuser' ) );
}
if ( ! $wgOut->isArticleRelated() ) {
return '(' . wfMsg( 'notanarticle' ) . ')';
} else {
- return self::makeKnownLinkObj(
+ return $this->makeKnownLinkObj(
SpecialPage::getTitleFor( 'Recentchangeslinked', $wgTitle->getPrefixedDBkey() ),
wfMsg( 'recentchangeslinked' ) );
}
$text = $wgContLang->getLanguageName( $nt->getInterwiki() );
if ( '' == $text ) { $text = $l; }
- $style = self::getExternalLinkAttributes( $l, $text );
+ $style = $this->getExternalLinkAttributes( $l, $text );
$s .= "<a href=\"{$url}\"{$style}>{$text}</a>";
}
if($wgContLang->isRTL()) $s .= '</span>';
}
function bugReportsLink() {
- $s = self::makeKnownLink( wfMsgForContent( 'bugreportspage' ),
+ $s = $this->makeKnownLink( wfMsgForContent( 'bugreportspage' ),
wfMsg( 'bugreports' ) );
return $s;
}
$id = $t1->getArticleID();
if ( 0 == $id ) {
- $s = self::makeBrokenLink( $t1->getText() );
+ $s = $this->makeBrokenLink( $t1->getText() );
} else {
- $s = self::makeKnownLink( $t1->getText() );
+ $s = $this->makeKnownLink( $t1->getText() );
}
$s .= ', ';
$id = $t2->getArticleID();
if ( 0 == $id ) {
- $s .= self::makeBrokenLink( $t2->getText() );
+ $s .= $this->makeBrokenLink( $t2->getText() );
} else {
- $s .= self::makeKnownLink( $t2->getText() );
+ $s .= $this->makeKnownLink( $t2->getText() );
}
return $s;
}
$text = wfMsg( 'talkpage' );
}
- $s = self::makeLinkObj( $link, $text );
+ $s = $this->makeLinkObj( $link, $text );
return $s;
}
$title =& $wgTitle->getTalkPage();
}
- return self::makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
+ return $this->makeKnownLinkObj( $title, wfMsg( 'postcomment' ), 'action=edit§ion=new' );
}
/* these are used extensively in SkinTemplate, but also some other places */
}
}
if ($cacheSidebar)
- $cachednotice = $parserMemc->set( $key, $bar, 86400 );
+ $parserMemc->set( $key, $bar, 86400 );
wfProfileOut( $fname );
return $bar;
}