* @ingroup Skins
*/
abstract class Skin extends ContextSource {
+ /**
+ * @var string|null
+ */
protected $skinname = null;
+
protected $mRelevantTitle = null;
protected $mRelevantUser = null;
}
/**
- * @return string Skin name
+ * @since 1.31
+ * @param string|null $skinname
+ */
+ public function __construct( $skinname = null ) {
+ if ( is_string( $skinname ) ) {
+ $this->skinname = $skinname;
+ }
+ }
+
+ /**
+ * @return string|null Skin name
*/
public function getSkinName() {
return $this->skinname;
* "<body>" tag, skins can override it if they have a need to add in any
* body attributes or classes of their own.
* @param OutputPage $out
- * @param array $bodyAttrs
+ * @param array &$bodyAttrs
*/
function addToBodyAttributes( $out, &$bodyAttrs ) {
// does nothing by default
$s = '';
}
- if ( wfGetLB()->getLaggedReplicaMode() ) {
+ if ( MediaWikiServices::getInstance()->getDBLoadBalancer()->getLaggedReplicaMode() ) {
$s .= ' <strong>' . $this->msg( 'laggedslavemode' )->parse() . '</strong>';
}
$targetUser = User::newFromId( $id );
}
- # The sending user must have a confirmed email address and the target
- # user must have a confirmed email address and allow emails from users.
- return $this->getUser()->canSendEmail() &&
- $targetUser->canReceiveEmail();
+ # The sending user must have a confirmed email address and the receiving
+ # user must accept emails from the sender.
+ return $this->getUser()->canSendEmail()
+ && SpecialEmailUser::validateTarget( $targetUser, $this->getUser() ) === '';
}
/**
$title = Title::newMainPage();
self::checkTitle( $title, '' );
- return $title->getLocalURL( $urlaction );
+ return $title->getLinkURL( $urlaction );
}
/**
/**
* make sure we have some title to operate on
*
- * @param Title $title
+ * @param Title &$title
* @param string $name
*/
static function checkTitle( &$title, $name ) {
function buildSidebar() {
global $wgEnableSidebarCache, $wgSidebarCacheExpiry;
- $that = $this;
- $callback = function () use ( $that ) {
+ $callback = function () {
$bar = [];
- $that->addToSidebar( $bar, 'sidebar' );
- Hooks::run( 'SkinBuildSidebar', [ $that, &$bar ] );
+ $this->addToSidebar( $bar, 'sidebar' );
+ Hooks::run( 'SkinBuildSidebar', [ $this, &$bar ] );
return $bar;
};
*
* This is just a wrapper around addToSidebarPlain() for backwards compatibility
*
- * @param array $bar
+ * @param array &$bar
* @param string $message
*/
public function addToSidebar( &$bar, $message ) {
/**
* Add content from plain text
* @since 1.17
- * @param array $bar
+ * @param array &$bar
* @param string $text
* @return array
*/
$attribs = [];
if ( !is_null( $tooltip ) ) {
- # T27462: undo double-escaping.
- $tooltip = Sanitizer::decodeCharReferences( $tooltip );
$attribs['title'] = wfMessage( 'editsectionhint' )->rawParams( $tooltip )
->inLanguage( $lang )->text();
}
$result .= implode(
'<span class="mw-editsection-divider">'
- . wfMessage( 'pipe-separator' )->inLanguage( $lang )->text()
+ . wfMessage( 'pipe-separator' )->inLanguage( $lang )->escaped()
. '</span>',
$linksHtml
);