* Has compatibility issues on some setups, so avoid wherever possible.
* 'http': Force a full URL with http:// as the scheme.
* 'https': Force a full URL with https:// as the scheme.
+ * 'stubThreshold' => (int): Stub threshold to use when determining link classes.
* @return string HTML <a> attribute
*/
public static function link(
- $target, $html = null, $customAttribs = array(), $query = array(), $options = array()
+ $target, $html = null, $customAttribs = [], $query = [], $options = []
) {
if ( !$target instanceof Title ) {
wfWarn( __METHOD__ . ': Requires $target to be a Title object.', 2 );
$ret = null;
if ( !Hooks::run( 'LinkBegin',
- array( $dummy, $target, &$html, &$customAttribs, &$query, &$options, &$ret ) )
+ [ $dummy, $target, &$html, &$customAttribs, &$query, &$options, &$ret ] )
) {
return $ret;
}
$target = self::normaliseSpecialPage( $target );
# If we don't know whether the page exists, let's find out.
- if ( !in_array( 'known', $options ) && !in_array( 'broken', $options ) ) {
+ if ( !in_array( 'known', $options, true ) && !in_array( 'broken', $options, true ) ) {
if ( $target->isKnown() ) {
$options[] = 'known';
} else {
}
}
- $oldquery = array();
- if ( in_array( "forcearticlepath", $options ) && $query ) {
+ $oldquery = [];
+ if ( in_array( "forcearticlepath", $options, true ) && $query ) {
$oldquery = $query;
- $query = array();
+ $query = [];
}
# Note: we want the href attribute first, for prettiness.
- $attribs = array( 'href' => self::linkUrl( $target, $query, $options ) );
- if ( in_array( 'forcearticlepath', $options ) && $oldquery ) {
+ $attribs = [ 'href' => self::linkUrl( $target, $query, $options ) ];
+ if ( in_array( 'forcearticlepath', $options, true ) && $oldquery ) {
$attribs['href'] = wfAppendQuery( $attribs['href'], $oldquery );
}
}
$ret = null;
- if ( Hooks::run( 'LinkEnd', array( $dummy, $target, $options, &$html, &$attribs, &$ret ) ) ) {
+ if ( Hooks::run( 'LinkEnd', [ $dummy, $target, $options, &$html, &$attribs, &$ret ] ) ) {
$ret = Html::rawElement( 'a', $attribs, $html );
}
* @return string
*/
public static function linkKnown(
- $target, $html = null, $customAttribs = array(),
- $query = array(), $options = array( 'known', 'noclasses' )
+ $target, $html = null, $customAttribs = [],
+ $query = [], $options = [ 'known', 'noclasses' ]
) {
return self::link( $target, $html, $customAttribs, $query, $options );
}
private static function linkUrl( $target, $query, $options ) {
# We don't want to include fragments for broken links, because they
# generally make no sense.
- if ( in_array( 'broken', $options ) && $target->hasFragment() ) {
+ if ( in_array( 'broken', $options, true ) && $target->hasFragment() ) {
$target = clone $target;
$target->setFragment( '' );
}
# If it's a broken link, add the appropriate query pieces, unless
# there's already an action specified, or unless 'edit' makes no sense
# (i.e., for a nonexistent special page).
- if ( in_array( 'broken', $options ) && empty( $query['action'] )
+ if ( in_array( 'broken', $options, true ) && empty( $query['action'] )
&& !$target->isSpecialPage() ) {
$query['action'] = 'edit';
$query['redlink'] = '1';
}
- if ( in_array( 'http', $options ) ) {
+ if ( in_array( 'http', $options, true ) ) {
$proto = PROTO_HTTP;
- } elseif ( in_array( 'https', $options ) ) {
+ } elseif ( in_array( 'https', $options, true ) ) {
$proto = PROTO_HTTPS;
} else {
$proto = PROTO_RELATIVE;
*/
private static function linkAttribs( $target, $attribs, $options ) {
global $wgUser;
- $defaults = array();
+ $defaults = [];
- if ( !in_array( 'noclasses', $options ) ) {
+ if ( !in_array( 'noclasses', $options, true ) ) {
# Now build the classes.
- $classes = array();
+ $classes = [];
- if ( in_array( 'broken', $options ) ) {
+ if ( in_array( 'broken', $options, true ) ) {
$classes[] = 'new';
}
$classes[] = 'extiw';
}
- if ( !in_array( 'broken', $options ) ) { # Avoid useless calls to LinkCache (see r50387)
- $colour = self::getLinkColour( $target, $wgUser->getStubThreshold() );
+ if ( !in_array( 'broken', $options, true ) ) { # Avoid useless calls to LinkCache (see r50387)
+ $colour = self::getLinkColour(
+ $target,
+ isset( $options['stubThreshold'] ) ? $options['stubThreshold'] : $wgUser->getStubThreshold()
+ );
if ( $colour !== '' ) {
$classes[] = $colour; # mw-redirect or stub
}
}
- if ( $classes != array() ) {
+ if ( $classes != [] ) {
$defaults['class'] = implode( ' ', $classes );
}
}
if ( $target->getPrefixedText() == '' ) {
# A link like [[#Foo]]. This used to mean an empty title
# attribute, but that's silly. Just don't output a title.
- } elseif ( in_array( 'known', $options ) ) {
+ } elseif ( in_array( 'known', $options, true ) ) {
$defaults['title'] = $target->getPrefixedText();
} else {
// This ends up in parser cache!
# Finally, merge the custom attribs with the default ones, and iterate
# over that, deleting all "false" attributes.
- $ret = array();
+ $ret = [];
$merged = Sanitizer::mergeAttributes( $defaults, $attribs );
foreach ( $merged as $key => $val ) {
# A false value suppresses the attribute, and we don't want the
*/
public static function makeSelfLinkObj( $nt, $html = '', $query = '', $trail = '', $prefix = '' ) {
$ret = "<strong class=\"selflink\">{$prefix}{$html}</strong>{$trail}";
- if ( !Hooks::run( 'SelfLinkBegin', array( $nt, &$html, &$trail, &$prefix, &$ret ) ) ) {
+ if ( !Hooks::run( 'SelfLinkBegin', [ $nt, &$html, &$trail, &$prefix, &$ret ] ) ) {
return $ret;
}
$alt = self::fnamePart( $url );
}
$img = '';
- $success = Hooks::run( 'LinkerMakeExternalImage', array( &$url, &$alt, &$img ) );
+ $success = Hooks::run( 'LinkerMakeExternalImage', [ &$url, &$alt, &$img ] );
if ( !$success ) {
wfDebug( "Hook LinkerMakeExternalImage changed the output of external image "
. "with url {$url} and alt text {$alt} to {$img}\n", true );
return $img;
}
return Html::element( 'img',
- array(
+ [
'src' => $url,
- 'alt' => $alt ) );
+ 'alt' => $alt ] );
}
/**
* @return string HTML for an image, with links, wrappers, etc.
*/
public static function makeImageLink( Parser $parser, Title $title,
- $file, $frameParams = array(), $handlerParams = array(), $time = false,
+ $file, $frameParams = [], $handlerParams = [], $time = false,
$query = "", $widthOption = null
) {
$res = null;
$dummy = new DummyLinker;
- if ( !Hooks::run( 'ImageBeforeProduceHTML', array( &$dummy, &$title,
- &$file, &$frameParams, &$handlerParams, &$time, &$res ) ) ) {
+ if ( !Hooks::run( 'ImageBeforeProduceHTML', [ &$dummy, &$title,
+ &$file, &$frameParams, &$handlerParams, &$time, &$res ] ) ) {
return $res;
}
$s = self::makeBrokenImageLinkObj( $title, $fp['title'], '', '', '', $time == true );
} else {
self::processResponsiveImages( $file, $thumb, $hp );
- $params = array(
+ $params = [
'alt' => $fp['alt'],
'title' => $fp['title'],
'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false,
- 'img-class' => $fp['class'] );
+ 'img-class' => $fp['class'] ];
if ( isset( $fp['border'] ) ) {
$params['img-class'] .= ( $params['img-class'] !== '' ? ' ' : '' ) . 'thumbborder';
}
* @return array
*/
private static function getImageLinkMTOParams( $frameParams, $query = '', $parser = null ) {
- $mtoParams = array();
+ $mtoParams = [];
if ( isset( $frameParams['link-url'] ) && $frameParams['link-url'] !== '' ) {
$mtoParams['custom-url-link'] = $frameParams['link-url'];
if ( isset( $frameParams['link-target'] ) ) {
* @return string
*/
public static function makeThumbLinkObj( Title $title, $file, $label = '', $alt,
- $align = 'right', $params = array(), $framed = false, $manualthumb = ""
+ $align = 'right', $params = [], $framed = false, $manualthumb = ""
) {
- $frameParams = array(
+ $frameParams = [
'alt' => $alt,
'caption' => $label,
'align' => $align
- );
+ ];
if ( $framed ) {
$frameParams['framed'] = true;
}
* @param string $query
* @return string
*/
- public static function makeThumbLink2( Title $title, $file, $frameParams = array(),
- $handlerParams = array(), $time = false, $query = ""
+ public static function makeThumbLink2( Title $title, $file, $frameParams = [],
+ $handlerParams = [], $time = false, $query = ""
) {
$exists = $file && $file->exists();
# zoom icon still needs it, so we make a unique query for it. See bug 14771
$url = $title->getLocalURL( $query );
if ( $page ) {
- $url = wfAppendQuery( $url, array( 'page' => $page ) );
+ $url = wfAppendQuery( $url, [ 'page' => $page ] );
}
if ( $manualthumb
&& !isset( $fp['link-title'] )
if ( !$noscale && !$manualthumb ) {
self::processResponsiveImages( $file, $thumb, $hp );
}
- $params = array(
+ $params = [
'alt' => $fp['alt'],
'title' => $fp['title'],
'img-class' => ( isset( $fp['class'] ) && $fp['class'] !== ''
? $fp['class'] . ' '
: '' ) . 'thumbimage'
- );
+ ];
$params = self::getImageLinkMTOParams( $fp, $query ) + $params;
$s .= $thumb->toHtml( $params );
if ( isset( $fp['framed'] ) ) {
$zoomIcon = "";
} else {
- $zoomIcon = Html::rawElement( 'div', array( 'class' => 'magnify' ),
- Html::rawElement( 'a', array(
+ $zoomIcon = Html::rawElement( 'div', [ 'class' => 'magnify' ],
+ Html::rawElement( 'a', [
'href' => $url,
'class' => 'internal',
- 'title' => wfMessage( 'thumbnail-more' )->text() ),
+ 'title' => wfMessage( 'thumbnail-more' )->text() ],
"" ) );
}
}
$redir = RepoGroup::singleton()->getLocalRepo()->checkRedirect( $title );
if ( $redir ) {
- return self::linkKnown( $title, $encLabel, array(), wfCgiToArray( $query ) );
+ return self::linkKnown( $title, $encLabel, [], wfCgiToArray( $query ) );
}
$href = self::getUploadUrl( $title, $query );
$encLabel . '</a>';
}
- return self::linkKnown( $title, $encLabel, array(), wfCgiToArray( $query ) );
+ return self::linkKnown( $title, $encLabel, [], wfCgiToArray( $query ) );
}
/**
* @return string HTML
*/
public static function makeMediaLinkObj( $title, $html = '', $time = false ) {
- $img = wfFindFile( $title, array( 'time' => $time ) );
+ $img = wfFindFile( $title, [ 'time' => $time ] );
return self::makeMediaLinkFile( $title, $img, $html );
}
}
$ret = '';
- $attribs = array(
+ $attribs = [
'href' => $url,
'class' => $class,
'title' => $alt
- );
+ ];
if ( !Hooks::run( 'LinkerMakeMediaLinkFile',
- array( $title, $file, &$html, &$attribs, &$ret ) ) ) {
+ [ $title, $file, &$html, &$attribs, &$ret ] ) ) {
wfDebug( "Hook LinkerMakeMediaLinkFile changed the output of link "
. "with url {$url} and text {$html} to {$ret}\n", true );
return $ret;
* @return string
*/
public static function makeExternalLink( $url, $text, $escape = true,
- $linktype = '', $attribs = array(), $title = null
+ $linktype = '', $attribs = [], $title = null
) {
global $wgTitle;
$class = "external";
$attribs['rel'] = Parser::getExternalLinkRel( $url, $title );
$link = '';
$success = Hooks::run( 'LinkerMakeExternalLink',
- array( &$url, &$text, &$link, &$attribs, $linktype ) );
+ [ &$url, &$text, &$link, &$attribs, $linktype ] );
if ( !$success ) {
wfDebug( "Hook LinkerMakeExternalLink changed the output of link "
. "with url {$url} and text {$text} to {$link}\n", true );
return self::link(
$page,
htmlspecialchars( $altUserName !== false ? $altUserName : $userName ),
- array( 'class' => $classes )
+ [ 'class' => $classes ]
);
}
$blockable = !( $flags & self::TOOL_LINKS_NOBLOCK );
$addEmailLink = $flags & self::TOOL_LINKS_EMAIL && $userId;
- $items = array();
+ $items = [];
if ( $talkable ) {
$items[] = self::userTalkLink( $userId, $userText );
}
if ( $userId ) {
// check if the user has an edit
- $attribs = array();
+ $attribs = [];
if ( $redContribsWhenNoEdits ) {
if ( intval( $edits ) === 0 && $edits !== 0 ) {
$user = User::newFromId( $userId );
$items[] = self::emailLink( $userId, $userText );
}
- Hooks::run( 'UserToolLinksEdit', array( $userId, $userText, &$items ) );
+ Hooks::run( 'UserToolLinksEdit', [ $userId, $userText, &$items ] );
if ( $items ) {
return wfMessage( 'word-separator' )->escaped()
global $wgLang;
// Ensure all match positions are defined
- $match += array( '', '', '', '' );
+ $match += [ '', '', '', '' ];
$pre = $match[1] !== '';
$auto = $match[2];
Hooks::run(
'FormatAutocomments',
- array( &$comment, $pre, $auto, $post, $title, $local, $wikiId )
+ [ &$comment, $pre, $auto, $post, $title, $local, $wikiId ]
);
if ( $comment === null ) {
if ( strpos( $match[1], '%' ) !== false ) {
$match[1] = strtr(
rawurldecode( $match[1] ),
- array( '<' => '<', '>' => '>' )
+ [ '<' => '<', '>' => '>' ]
);
}
} else {
$text = $match[1];
}
- $submatch = array();
+ $submatch = [];
$thelink = null;
if ( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) {
# Media link; trail not supported.
}
} else {
# Other kind of link
- if ( preg_match( $wgContLang->linkTrail(), $match[3], $submatch ) ) {
- $trail = $submatch[1];
- } else {
- $trail = "";
- }
- $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
+ # Make sure its target is non-empty
if ( isset( $match[1][0] ) && $match[1][0] == ':' ) {
$match[1] = substr( $match[1], 1 );
}
- list( $inside, $trail ) = Linker::splitTrail( $trail );
-
- $linkText = $text;
- $linkTarget = Linker::normalizeSubpageLink( $title, $match[1], $linkText );
-
- $target = Title::newFromText( $linkTarget );
- if ( $target ) {
- if ( $target->getText() == '' && !$target->isExternal()
- && !$local && $title
- ) {
- $newTarget = clone $title;
- $newTarget->setFragment( '#' . $target->getFragment() );
- $target = $newTarget;
+ if ( $match[1] !== false && $match[1] !== '' ) {
+ if ( preg_match( $wgContLang->linkTrail(), $match[3], $submatch ) ) {
+ $trail = $submatch[1];
+ } else {
+ $trail = "";
}
+ $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
+ list( $inside, $trail ) = Linker::splitTrail( $trail );
+
+ $linkText = $text;
+ $linkTarget = Linker::normalizeSubpageLink( $title, $match[1], $linkText );
+
+ $target = Title::newFromText( $linkTarget );
+ if ( $target ) {
+ if ( $target->getText() == '' && !$target->isExternal()
+ && !$local && $title
+ ) {
+ $newTarget = clone $title;
+ $newTarget->setFragment( '#' . $target->getFragment() );
+ $target = $newTarget;
+ }
- $thelink = Linker::makeCommentLink( $target, $linkText . $inside, $wikiId ) . $trail;
+ $thelink = Linker::makeCommentLink( $target, $linkText . $inside, $wikiId ) . $trail;
+ }
}
}
if ( $thelink ) {
* @return string HTML link
*/
public static function makeCommentLink(
- Title $title, $text, $wikiId = null, $options = array()
+ Title $title, $text, $wikiId = null, $options = []
) {
if ( $wikiId !== null && !$title->isExternal() ) {
$link = Linker::makeExternalLink(
/* escape = */ false // Already escaped
);
} else {
- $link = Linker::link( $title, $text, array(), array(), $options );
+ $link = Linker::link( $title, $text, [], [], $options );
}
return $link;
# Look at the first character
if ( $target != '' && $target[0] === '/' ) {
# / at end means we don't want the slash to be shown
- $m = array();
+ $m = [];
$trailingSlashes = preg_match_all( '%(/+)$%', $target, $m );
if ( $trailingSlashes ) {
$noslash = $target = substr( $target, 1, -strlen( $m[0][0] ) );
$regex = $wgContLang->linkTrail();
$inside = '';
if ( $trail !== '' ) {
- $m = array();
+ $m = [];
if ( preg_match( $regex, $trail, $m ) ) {
$inside = $m[1];
$trail = $m[2];
}
}
- return array( $inside, $trail );
+ return [ $inside, $trail ];
}
/**
* @return string
*/
public static function generateRollback( $rev, IContextSource $context = null,
- $options = array( 'verify' )
+ $options = [ 'verify' ]
) {
if ( $context === null ) {
$context = RequestContext::getMain();
}
$editCount = false;
- if ( in_array( 'verify', $options ) ) {
+ if ( in_array( 'verify', $options, true ) ) {
$editCount = self::getRollbackEditCount( $rev, true );
if ( $editCount === false ) {
return '';
$inner = self::buildRollbackLink( $rev, $context, $editCount );
- if ( !in_array( 'noBrackets', $options ) ) {
+ if ( !in_array( 'noBrackets', $options, true ) ) {
$inner = $context->msg( 'brackets' )->rawParams( $inner )->escaped();
}
// Up to the value of $wgShowRollbackEditCount revisions are counted
$res = $dbr->select(
'revision',
- array( 'rev_user_text', 'rev_deleted' ),
+ [ 'rev_user_text', 'rev_deleted' ],
// $rev->getPage() returns null sometimes
- array( 'rev_page' => $rev->getTitle()->getArticleID() ),
+ [ 'rev_page' => $rev->getTitle()->getArticleID() ],
__METHOD__,
- array(
- 'USE INDEX' => array( 'revision' => 'page_timestamp' ),
+ [
+ 'USE INDEX' => [ 'revision' => 'page_timestamp' ],
'ORDER BY' => 'rev_timestamp DESC',
'LIMIT' => $wgShowRollbackEditCount + 1
- )
+ ]
);
$editCount = 0;
global $wgShowRollbackEditCount, $wgMiserMode;
// To config which pages are affected by miser mode
- $disableRollbackEditCountSpecialPage = array( 'Recentchanges', 'Watchlist' );
+ $disableRollbackEditCountSpecialPage = [ 'Recentchanges', 'Watchlist' ];
if ( $context === null ) {
$context = RequestContext::getMain();
}
$title = $rev->getTitle();
- $query = array(
+ $query = [
'action' => 'rollback',
'from' => $rev->getUserText(),
- 'token' => $context->getUser()->getEditToken( array(
+ 'token' => $context->getUser()->getEditToken( [
$title->getPrefixedText(),
$rev->getUserText()
- ) ),
- );
+ ] ),
+ ];
if ( $context->getRequest()->getBool( 'bot' ) ) {
$query['bot'] = '1';
$query['hidediff'] = '1'; // bug 15999
return self::link(
$title,
$editCount_output,
- array( 'title' => $context->msg( 'tooltip-rollback' )->text() ),
+ [ 'title' => $context->msg( 'tooltip-rollback' )->text() ],
$query,
- array( 'known', 'noclasses' )
+ [ 'known', 'noclasses' ]
);
} else {
return self::link(
$title,
$context->msg( 'rollbacklink' )->escaped(),
- array( 'title' => $context->msg( 'tooltip-rollback' )->text() ),
+ [ 'title' => $context->msg( 'tooltip-rollback' )->text() ],
$query,
- array( 'known', 'noclasses' )
+ [ 'known', 'noclasses' ]
);
}
}
if ( $restrictions ) {
// Check backwards-compatible messages
$msg = null;
- if ( $restrictions === array( 'sysop' ) ) {
+ if ( $restrictions === [ 'sysop' ] ) {
$msg = wfMessage( 'template-protected' );
- } elseif ( $restrictions === array( 'autoconfirmed' ) ) {
+ } elseif ( $restrictions === [ 'autoconfirmed' ] ) {
$msg = wfMessage( 'template-semiprotected' );
}
if ( $msg && !$msg->isDisabled() ) {
} else {
// Construct the message from restriction-level-*
// e.g. restriction-level-sysop, restriction-level-autoconfirmed
- $msgs = array();
+ $msgs = [];
foreach ( $restrictions as $r ) {
$msgs[] = wfMessage( "restriction-level-$r" )->parse();
}
$editLink = self::link(
$titleObj,
wfMessage( 'editlink' )->escaped(),
- array(),
- array( 'action' => 'edit' )
+ [],
+ [ 'action' => 'edit' ]
);
} else {
$editLink = self::link(
$titleObj,
wfMessage( 'viewsourcelink' )->escaped(),
- array(),
- array( 'action' => 'edit' )
+ [],
+ [ 'action' => 'edit' ]
);
}
$outText .= '<li>' . self::link( $titleObj )
foreach ( $hiddencats as $titleObj ) {
# If it's hidden, it must exist - no need to check with a LinkBatch
$outText .= '<li>'
- . self::link( $titleObj, null, array(), array(), 'known' )
+ . self::link( $titleObj, null, [], [], 'known' )
. "</li>\n";
}
$outText .= '</ul>';
* @return string Contents of the title attribute (which you must HTML-
* escape), or false for no title attribute
*/
- public static function titleAttrib( $name, $options = null, array $msgParams = array() ) {
+ public static function titleAttrib( $name, $options = null, array $msgParams = [] ) {
$message = wfMessage( "tooltip-$name", $msgParams );
if ( !$message->exists() ) {
$tooltip = false;
if ( $rev->getId() ) {
// RevDelete links using revision ID are stable across
// page deletion and undeletion; use when possible.
- $query = array(
+ $query = [
'type' => 'revision',
'target' => $title->getPrefixedDBkey(),
'ids' => $rev->getId()
- );
+ ];
} else {
// Older deleted entries didn't save a revision ID.
// We have to refer to these by timestamp, ick!
- $query = array(
+ $query = [
'type' => 'archive',
'target' => $title->getPrefixedDBkey(),
'ids' => $rev->getTimestamp()
- );
+ ];
}
return Linker::revDeleteLink( $query,
$rev->isDeleted( Revision::DELETED_RESTRICTED ), $canHide );
* @return string HTML "<a>" link to Special:Revisiondelete, wrapped in a
* span to allow for customization of appearance with CSS
*/
- public static function revDeleteLink( $query = array(), $restricted = false, $delete = true ) {
+ public static function revDeleteLink( $query = [], $restricted = false, $delete = true ) {
$sp = SpecialPage::getTitleFor( 'Revisiondelete' );
$msgKey = $delete ? 'rev-delundel' : 'rev-showdeleted';
$html = wfMessage( $msgKey )->escaped();
$tag = $restricted ? 'strong' : 'span';
- $link = self::link( $sp, $html, array(), $query, array( 'known', 'noclasses' ) );
+ $link = self::link( $sp, $html, [], $query, [ 'known', 'noclasses' ] );
return Xml::tags(
$tag,
- array( 'class' => 'mw-revdelundel-link' ),
+ [ 'class' => 'mw-revdelundel-link' ],
wfMessage( 'parentheses' )->rawParams( $link )->escaped()
);
}
$msgKey = $delete ? 'rev-delundel' : 'rev-showdeleted';
$html = wfMessage( $msgKey )->escaped();
$htmlParentheses = wfMessage( 'parentheses' )->rawParams( $html )->escaped();
- return Xml::tags( 'span', array( 'class' => 'mw-revdelundel-link' ), $htmlParentheses );
+ return Xml::tags( 'span', [ 'class' => 'mw-revdelundel-link' ], $htmlParentheses );
}
/* Deprecated methods */
*
* @return array
*/
- public static function tooltipAndAccesskeyAttribs( $name, array $msgParams = array() ) {
+ public static function tooltipAndAccesskeyAttribs( $name, array $msgParams = [] ) {
# @todo FIXME: If Sanitizer::expandAttributes() treated "false" as "output
# no attribute" instead of "output '' as value for attribute", this
# would be three lines.
- $attribs = array(
+ $attribs = [
'title' => self::titleAttrib( $name, 'withaccess', $msgParams ),
'accesskey' => self::accesskey( $name )
- );
+ ];
if ( $attribs['title'] === false ) {
unset( $attribs['title'] );
}
if ( $tooltip === false ) {
return '';
}
- return Xml::expandAttributes( array(
+ return Xml::expandAttributes( [
'title' => $tooltip
- ) );
+ ] );
}
}
* @return mixed
*/
public function __call( $fname, $args ) {
- return call_user_func_array( array( 'Linker', $fname ), $args );
+ return call_user_func_array( [ 'Linker', $fname ], $args );
}
}