*
* @ingroup Skins
*/
-abstract class Skin {
+abstract class Skin extends ContextSource {
protected $skinname = 'standard';
protected $mRelevantTitle = null;
protected $mRelevantUser = null;
* Preload the existence of three commonly-requested pages in a single query
*/
function preloadExistence() {
- $user = $this->getContext()->getUser();
+ $user = $this->getUser();
// User/talk link
$titles = array( $user->getUserPage(), $user->getTalkPage() );
* Set some local variables
*/
protected function setMembers() {
- $this->userpage = $this->getContext()->getUser()->getUserPage()->getPrefixedText();
- }
-
- /**
- * Set the RequestContext used in this instance
- *
- * @param RequestContext $context
- */
- public function setContext( RequestContext $context ) {
- $this->mContext = $context;
- }
-
- /**
- * Get the RequestContext used in this instance
- *
- * @return RequestContext
- */
- public function getContext() {
- if ( !isset($this->mContext) ) {
- wfDebug( __METHOD__ . " called and \$mContext is null. Using RequestContext::getMain(); for sanity\n" );
- $this->mContext = RequestContext::getMain();
- }
- return $this->mContext;
- }
-
- /** Get the title
- *
- * @return Title
- */
- public function getTitle() {
- return $this->getContext()->getTitle();
- }
-
- /** Get the user
- *
- * @return User
- */
- public function getUser() {
- return $this->getContext()->getUser();
+ $this->userpage = $this->getUser()->getUserPage()->getPrefixedText();
}
/**
* @return Integer
*/
public function getRevisionId() {
- return $this->getContext()->getOutput()->getRevisionId();
+ return $this->getOutput()->getRevisionId();
}
/**
if ( $action != 'submit' ) {
return false;
}
- if ( !$this->getContext()->getRequest()->wasPosted() ) {
+ if ( !$this->getRequest()->wasPosted() ) {
return false;
}
if ( !$this->getTitle()->userCanEditCssSubpage() ) {
return false;
}
- return $this->getContext()->getUser()->matchEditToken(
- $this->getContext()->getRequest()->getVal( 'wpEditToken' ) );
+ return $this->getUser()->matchEditToken(
+ $this->getRequest()->getVal( 'wpEditToken' ) );
}
/**
// Per-site custom styles
if ( $wgUseSiteCss ) {
$out->addModuleStyles( array( 'site', 'noscript' ) );
- if( $this->getContext()->getUser()->isLoggedIn() ){
+ if( $this->getUser()->isLoggedIn() ){
$out->addModuleStyles( 'user.groups' );
}
}
// Per-user custom styles
if ( $wgAllowUserCss ) {
- if ( $this->getTitle()->isCssSubpage() && $this->userCanPreview( $this->getContext()->getRequest()->getVal( 'action' ) ) ) {
+ if ( $this->getTitle()->isCssSubpage() && $this->userCanPreview( $this->getRequest()->getVal( 'action' ) ) ) {
// @todo FIXME: Properly escape the cdata!
- $out->addInlineStyle( $this->getContext()->getRequest()->getText( 'wpTextbox1' ) );
+ $out->addInlineStyle( $this->getRequest()->getText( 'wpTextbox1' ) );
} else {
$out->addModuleStyles( 'user' );
}
/**
* Add skin specific stylesheets
* Calling this method with an $out of anything but the same OutputPage
- * inside ->getContext()->getOutput() is deprecated. The $out arg is kept
+ * inside ->getOutput() is deprecated. The $out arg is kept
* for compatibility purposes with skins.
* @param $out OutputPage
* @delete
function getCategoryLinks() {
global $wgUseCategoryBrowser;
- $out = $this->getContext()->getOutput();
+ $out = $this->getOutput();
if ( count( $out->mCategoryLinks ) == 0 ) {
return '';
# Hidden categories
if ( isset( $allCats['hidden'] ) ) {
- if ( $this->getContext()->getUser()->getBoolOption( 'showhiddencats' ) ) {
+ if ( $this->getUser()->getBoolOption( 'showhiddencats' ) ) {
$class = 'mw-hidden-cats-user-shown';
} elseif ( $this->getTitle()->getNamespace() == NS_CATEGORY ) {
$class = 'mw-hidden-cats-ns-shown';
}
function getCategories() {
- $out = $this->getContext()->getOutput();
+ $out = $this->getOutput();
$catlinks = $this->getCategoryLinks();
// Check what we're showing
$allCats = $out->getCategoryLinks();
- $showHidden = $this->getContext()->getUser()->getBoolOption( 'showhiddencats' ) ||
+ $showHidden = $this->getUser()->getBoolOption( 'showhiddencats' ) ||
$this->getTitle()->getNamespace() == NS_CATEGORY;
if ( empty( $allCats['normal'] ) && !( !empty( $allCats['hidden'] ) && $showHidden ) ) {
global $wgShowDebug;
if ( $wgShowDebug ) {
- $listInternals = $this->formatDebugHTML( $this->getContext()->getOutput()->mDebugtext );
+ $listInternals = $this->formatDebugHTML( $this->getOutput()->mDebugtext );
return "\n<hr />\n<strong>Debug data:</strong><ul id=\"mw-debug-html\">" .
$listInternals . "</ul>\n";
}
}
function getUndeleteLink() {
- $action = $this->getContext()->getRequest()->getVal( 'action', 'view' );
+ $action = $this->getRequest()->getVal( 'action', 'view' );
- if ( $this->getContext()->getUser()->isAllowed( 'deletedhistory' ) &&
+ if ( $this->getUser()->isAllowed( 'deletedhistory' ) &&
( $this->getTitle()->getArticleId() == 0 || $action == 'history' ) ) {
- $includeSuppressed = $this->getContext()->getUser()->isAllowed( 'suppressrevision' );
+ $includeSuppressed = $this->getUser()->isAllowed( 'suppressrevision' );
$n = $this->getTitle()->isDeleted( $includeSuppressed );
if ( $n ) {
- if ( $this->getContext()->getUser()->isAllowed( 'undelete' ) ) {
+ if ( $this->getUser()->isAllowed( 'undelete' ) ) {
$msg = 'thisisdeleted';
} else {
$msg = 'viewdeleted';
$msg,
Linker::link(
SpecialPage::getTitleFor( 'Undelete', $this->getTitle()->getPrefixedDBkey() ),
- wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $this->getContext()->getLang()->formatNum( $n ) ),
+ wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $n ) ),
array(),
array(),
array( 'known', 'noclasses' )
}
function subPageSubtitle() {
- $out = $this->getContext()->getOutput();
+ $out = $this->getOutput();
$subpages = '';
if ( !wfRunHooks( 'SkinSubPageSubtitle', array( &$subpages, $this, $out ) ) ) {
global $wgRightsPage, $wgRightsUrl, $wgRightsText;
if ( $type == 'detect' ) {
- $diff = $this->getContext()->getRequest()->getVal( 'diff' );
+ $diff = $this->getRequest()->getVal( 'diff' );
if ( is_null( $diff ) && !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) {
$type = 'history';
}
if ( $timestamp ) {
- $d = $this->getContext()->getLang()->date( $timestamp, true );
- $t = $this->getContext()->getLang()->time( $timestamp, true );
+ $d = $this->getLang()->date( $timestamp, true );
+ $t = $this->getLang()->time( $timestamp, true );
$s = ' ' . wfMsg( 'lastmodifiedat', $d, $t );
} else {
$s = '';
function showEmailUser( $id ) {
$targetUser = User::newFromId( $id );
- return $this->getContext()->getUser()->canSendEmail() && # the sending user must have a confirmed email address
+ return $this->getUser()->canSendEmail() && # the sending user must have a confirmed email address
$targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users
}
global $parserMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry;
wfProfileIn( __METHOD__ );
- $key = wfMemcKey( 'sidebar', $this->getContext()->getLang()->getCode() );
+ $key = wfMemcKey( 'sidebar', $this->getLang()->getCode() );
if ( $wgEnableSidebarCache ) {
$cachedsidebar = $parserMemc->get( $key );
* @return MediaWiki message or if no new talk page messages, nothing
*/
function getNewtalks() {
- $out = $this->getContext()->getOutput();
+ $out = $this->getOutput();
- $newtalks = $this->getContext()->getUser()->getNewMessageLinks();
+ $newtalks = $this->getUser()->getNewMessageLinks();
$ntl = '';
if ( count( $newtalks ) == 1 && $newtalks[0]['wiki'] === wfWikiID() ) {
}
if ( $needParse ) {
- $parsed = $this->getContext()->getOutput()->parse( $notice );
+ $parsed = $this->getOutput()->parse( $notice );
$parserMemc->set( $key, array( 'html' => $parsed, 'hash' => md5( $notice ) ), 600 );
$notice = $parsed;
}
$siteNotice = '';
if ( wfRunHooks( 'SiteNoticeBefore', array( &$siteNotice, $this ) ) ) {
- if ( is_object( $this->getContext()->getUser() ) && $this->getContext()->getUser()->isLoggedIn() ) {
+ if ( is_object( $this->getUser() ) && $this->getUser()->isLoggedIn() ) {
$siteNotice = $this->getCachedNotice( 'sitenotice' );
} else {
$anonNotice = $this->getCachedNotice( 'anonnotice' );