return $skin;
}
- /** @return string path to the skin stylesheet */
- function getStylesheet() {
- return 'common/wikistandard.css';
- }
-
/** @return string skin name */
public function getSkinName() {
return $this->skinname;
wfProfileIn( __METHOD__ );
$this->preloadExistence();
- $this->setMembers();
wfProfileOut( __METHOD__ );
}
$lb->execute();
}
- /**
- * Set some local variables
- */
- protected function setMembers() {
- $this->userpage = $this->getUser()->getUserPage()->getPrefixedText();
- }
-
/**
* Get the current revision ID
*
global $wgUseCategoryBrowser;
$out = $this->getOutput();
+ $allCats = $out->getCategoryLinks();
- if ( count( $out->mCategoryLinks ) == 0 ) {
+ if ( !count( $allCats ) ) {
return '';
}
$embed = "<li>";
$pop = "</li>";
- $allCats = $out->getCategoryLinks();
$s = '';
$colon = wfMsgExt( 'colon-separator', 'escapenoentities' );
# add our current element to the list
$eltitle = Title::newFromText( $element );
- $return .= Linker::link( $eltitle, $eltitle->getText() );
+ $return .= Linker::link( $eltitle, htmlspecialchars( $eltitle->getText() ) );
}
return $return;
/**
* This gets called shortly before the </body> tag.
- * @param $out OutputPage object
+ *
* @return String HTML-wrapped JS code to be put before </body>
*/
- function bottomScripts( $out ) {
+ function bottomScripts() {
// TODO and the suckage continues. This function is really just a wrapper around
// OutputPage::getBottomScripts() which takes a Skin param. This should be cleaned
// up at some point
- $bottomScriptText = $out->getBottomScripts();
+ $bottomScriptText = $this->getOutput()->getBottomScripts();
wfRunHooks( 'SkinAfterBottomScripts', array( $this, &$bottomScriptText ) );
return $bottomScriptText;
return wfMsg(
$msg,
- Linker::link(
+ Linker::linkKnown(
SpecialPage::getTitleFor( 'Undelete', $this->getTitle()->getPrefixedDBkey() ),
- wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $n ) ),
- array(),
- array(),
- array( 'known', 'noclasses' )
+ wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $n ) )
)
);
}
$linkObj = Title::newFromText( $growinglink );
if ( is_object( $linkObj ) && $linkObj->exists() ) {
- $getlink = $this->link(
+ $getlink = Linker::linkKnown(
$linkObj,
- htmlspecialchars( $display ),
- array(),
- array(),
- array( 'known', 'noclasses' )
+ htmlspecialchars( $display )
);
$c++;
$a = '';
}
- $mp = wfMsg( 'mainpage' );
+ $mp = wfMsgHtml( 'mainpage' );
$mptitle = Title::newMainPage();
$url = ( is_object( $mptitle ) ? $mptitle->escapeLocalURL() : '' );
* @return string
*/
function mainPageLink() {
- $s = Linker::link(
+ $s = Linker::linkKown(
Title::newMainPage(),
- wfMsg( 'mainpage' ),
- array(),
- array(),
- array( 'known', 'noclasses' )
+ wfMsgHtml( 'mainpage' )
);
return $s;
$userTalkTitle = $userTitle->getTalkPage();
if ( !$userTalkTitle->equals( $out->getTitle() ) ) {
- $newMessagesLink = $this->link(
+ $newMessagesLink = Linker::linkKown(
$userTalkTitle,
wfMsgHtml( 'newmessageslink' ),
array(),
- array( 'redirect' => 'no' ),
- array( 'known', 'noclasses' )
+ array( 'redirect' => 'no' )
);
- $newMessagesDiffLink = $this->link(
+ $newMessagesDiffLink = Linker::linkKown(
$userTalkTitle,
wfMsgHtml( 'newmessagesdifflink' ),
array(),
- array( 'diff' => 'cur' ),
- array( 'known', 'noclasses' )
+ array( 'diff' => 'cur' )
);
$ntl = wfMsg(
wfProfileIn( __METHOD__ );
Profiler::instance()->setTemplated( true );
- $oldid = $wgRequest->getVal( 'oldid' );
- $diff = $wgRequest->getVal( 'diff' );
- $action = $wgRequest->getVal( 'action', 'view' );
-
wfProfileIn( __METHOD__ . '-init' );
$this->initPage( $out );
wfProfileIn( __METHOD__ . '-stuff' );
$this->thispage = $this->getTitle()->getPrefixedDBkey();
+ $this->userpage = $this->getUser()->getUserPage()->getPrefixedText();
$query = array();
if ( !$wgRequest->wasPosted() ) {
$query = $wgRequest->getValues();
}
$this->thisquery = wfArrayToCGI( $query );
$this->loggedin = $wgUser->isLoggedIn();
- $this->iscontent = ( $this->getTitle()->getNamespace() != NS_SPECIAL );
- $this->iseditable = ( $this->iscontent and !( $action == 'edit' or $action == 'submit' ) );
$this->username = $wgUser->getName();
if ( $wgUser->isLoggedIn() || $this->showIPinHeader() ) {
wfProfileIn( __METHOD__ . '-stuff-head' );
if ( !$this->useHeadElement ) {
- $this->setupUserCss( $out );
-
$tpl->set( 'pagecss', false );
$tpl->set( 'usercss', false );
} else {
$tpl->set( 'trackbackhtml', null );
}
+
+ $tpl->set( 'pageclass', $this->getPageClasses( $this->getTitle() ) );
+ $tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) );
}
wfProfileOut( __METHOD__ . '-stuff-head' );
$tpl->set( 'title', $out->getPageTitle() );
$tpl->set( 'pagetitle', $out->getHTMLTitle() );
$tpl->set( 'displaytitle', $out->mPageLinkTitle );
- $tpl->set( 'pageclass', $this->getPageClasses( $this->getTitle() ) );
- $tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) );
- $nsname = MWNamespace::exists( $this->getTitle()->getNamespace() ) ?
- MWNamespace::getCanonicalName( $this->getTitle()->getNamespace() ) :
- $this->getTitle()->getNsText();
-
- $tpl->set( 'nscanonical', $nsname );
- $tpl->set( 'nsnumber', $this->getTitle()->getNamespace() );
$tpl->set( 'titleprefixeddbkey', $this->getTitle()->getPrefixedDBKey() );
$tpl->set( 'titletext', $this->getTitle()->getText() );
$tpl->set( 'articleid', $this->getTitle()->getArticleId() );
- $tpl->set( 'currevisionid', $this->getTitle()->getLatestRevID() );
$tpl->set( 'isarticle', $out->isArticle() );
$tpl->set( 'userlangattributes', $attrs );
}
- $newtalks = $this->getNewtalks( $out );
-
wfProfileOut( __METHOD__ . '-stuff2' );
wfProfileIn( __METHOD__ . '-stuff3' );
- $tpl->setRef( 'newtalk', $newtalks );
+ $tpl->set( 'newtalk', $this->getNewtalks() );
$tpl->setRef( 'skin', $this );
$tpl->set( 'logo', $this->logoText() );
- if ( $out->isArticle() && ( !isset( $oldid ) || isset( $diff ) ) &&
- $this->getTitle()->exists() )
- {
- $article = new Article( $this->getTitle(), 0 );
- if ( !$wgDisableCounters ) {
- $viewcount = $wgLang->formatNum( $article->getCount() );
- if ( $viewcount ) {
- $tpl->set( 'viewcount', wfMsgExt( 'viewcount', array( 'parseinline' ), $viewcount ) );
- } else {
- $tpl->set( 'viewcount', false );
+
+ $tpl->set( 'copyright', false );
+ $tpl->set( 'viewcount', false );
+ $tpl->set( 'lastmod', false );
+ $tpl->set( 'credits', false );
+ $tpl->set( 'numberofwatchingusers', false );
+ if ( $out->isArticle() && $this->getTitle()->exists() ) {
+ if ( $this->isRevisionCurrent() ) {
+ $article = new Article( $this->getTitle(), 0 );
+ if ( !$wgDisableCounters ) {
+ $viewcount = $wgLang->formatNum( $article->getCount() );
+ if ( $viewcount ) {
+ $tpl->set( 'viewcount', wfMsgExt( 'viewcount', array( 'parseinline' ), $viewcount ) );
+ }
}
- } else {
- $tpl->set( 'viewcount', false );
- }
- if( $wgPageShowWatchingUsers ) {
- $dbr = wfGetDB( DB_SLAVE );
- $res = $dbr->select( 'watchlist',
- array( 'COUNT(*) AS n' ),
- array( 'wl_title' => $dbr->strencode( $this->getTitle()->getDBkey() ), 'wl_namespace' => $this->getTitle()->getNamespace() ),
- __METHOD__
- );
- $x = $dbr->fetchObject( $res );
- $numberofwatchingusers = $x->n;
- if( $numberofwatchingusers > 0 ) {
- $tpl->set( 'numberofwatchingusers',
- wfMsgExt( 'number_of_watching_users_pageview', array( 'parseinline' ),
- $wgLang->formatNum( $numberofwatchingusers ) )
+ if( $wgPageShowWatchingUsers ) {
+ $dbr = wfGetDB( DB_SLAVE );
+ $num = $dbr->selectField( 'watchlist', 'COUNT(*)',
+ array( 'wl_title' => $this->getTitle()->getDBkey(), 'wl_namespace' => $this->getTitle()->getNamespace() ),
+ __METHOD__
);
- } else {
- $tpl->set( 'numberofwatchingusers', false );
+ if( $num > 0 ) {
+ $tpl->set( 'numberofwatchingusers',
+ wfMsgExt( 'number_of_watching_users_pageview', array( 'parseinline' ),
+ $wgLang->formatNum( $num ) )
+ );
+ }
}
- } else {
- $tpl->set( 'numberofwatchingusers', false );
- }
-
- $tpl->set( 'copyright', $this->getCopyright() );
-
- $this->credits = false;
- if( $wgMaxCredits != 0 ){
- $this->credits = Action::factory( 'credits', $article )->getCredits( $wgMaxCredits, $wgShowCreditsIfMax );
- } else {
- $tpl->set( 'lastmod', $this->lastModified( $article ) );
+ if ( $wgMaxCredits != 0 ) {
+ $tpl->set( 'credits', Action::factory( 'credits', $article )->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ) );
+ } else {
+ $tpl->set( 'lastmod', $this->lastModified( $article ) );
+ }
}
-
- $tpl->setRef( 'credits', $this->credits );
-
- } elseif ( isset( $oldid ) && !isset( $diff ) ) {
$tpl->set( 'copyright', $this->getCopyright() );
- $tpl->set( 'viewcount', false );
- $tpl->set( 'lastmod', false );
- $tpl->set( 'credits', false );
- $tpl->set( 'numberofwatchingusers', false );
- } else {
- $tpl->set( 'copyright', false );
- $tpl->set( 'viewcount', false );
- $tpl->set( 'lastmod', false );
- $tpl->set( 'credits', false );
- $tpl->set( 'numberofwatchingusers', false );
}
wfProfileOut( __METHOD__ . '-stuff3' );
$tpl->set( 'reporttime', wfReportTime() );
$tpl->set( 'sitenotice', $this->getSiteNotice() );
- $tpl->set( 'bottomscripts', $this->bottomScripts( $out ) );
+ $tpl->set( 'bottomscripts', $this->bottomScripts() );
$tpl->set( 'printfooter', $this->printSource() );
# 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' ) ) &&
+ $wgRequest->getVal( 'action', 'view' ) == 'view' &&
( $this->getTitle()->exists() || $this->getTitle()->getNamespace() == NS_MEDIAWIKI ) ) {
$pageLang = $this->getTitle()->getPageLanguage();
$realBodyAttribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
// A print stylesheet is attached to all pages, but nobody ever
// figures that out. :) Add a link...
- if( $this->iscontent && ( $action == 'view' || $action == 'purge' ) ) {
+ if( $this->getTitle()->getNamespace() != NS_SPECIAL && ( $action == 'view' || $action == 'purge' ) ) {
if ( !$out->isPrintable() ) {
$nav_urls['print'] = array(
'text' => wfMsg( 'printableversion' ),