$img = '';
$success = wfRunHooks('LinkerMakeExternalImage', array( &$url, &$alt, &$img ) );
if(!$success) {
- wfDebug("Hook LinkerMakeExternalImage changed the output of external image with url {$url} and alt text {$alt} to {$img}", true);
+ wfDebug("Hook LinkerMakeExternalImage changed the output of external image with url {$url} and alt text {$alt} to {$img}\n", true);
return $img;
}
return Xml::element( 'img',
$link = '';
$success = wfRunHooks('LinkerMakeExternalLink', array( &$url, &$text, &$link ) );
if(!$success) {
- wfDebug("Hook LinkerMakeExternalLink changed the output of link with url {$url} and text {$text} to {$link}", true);
+ wfDebug("Hook LinkerMakeExternalLink changed the output of link with url {$url} and text {$text} to {$link}\n", true);
return $link;
}
return '<a href="'.$url.'"'.$attribsText.'>'.$text.'</a>';
* @return string
*/
public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits=null ) {
- global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans;
+ global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans, $wgLang;
$talkable = !( $wgDisableAnonTalk && 0 == $userId );
$blockable = ( $wgSysopUserBans || 0 == $userId ) && !$flags & self::TOOL_LINKS_NOBLOCK;
}
if( $items ) {
- return ' <span class="mw-usertoollinks">(' . implode( ' | ', $items ) . ')</span>';
+ return ' <span class="mw-usertoollinks">(' . $wgLang->pipeList( $items ) . ')</span>';
} else {
return '';
}
* @param string $anchor The anchor to give the headline (the bit after the #)
* @param string $text The text of the header
* @param string $link HTML to add for the section edit link
+ * @param mixed $legacyAnchor A second, optional anchor to give for
+ * backward compatibility (false to omit)
*
* @return string HTML headline
*/
- public function makeHeadline( $level, $attribs, $anchor, $text, $link ) {
- return "<a name=\"$anchor\" id=\"$anchor\"></a><h$level$attribs$link <span class=\"mw-headline\">$text</span></h$level>";
+ public function makeHeadline( $level, $attribs, $anchor, $text, $link, $legacyAnchor = false ) {
+ $ret = "<a name=\"$anchor\" id=\"$anchor\"></a>"
+ . "<h$level$attribs"
+ . $link
+ . " <span class=\"mw-headline\">$text</span>"
+ . "</h$level>";
+ if ( $legacyAnchor !== false ) {
+ $ret = "<a name=\"$legacyAnchor\" id=\"$legacyAnchor\"></a>$ret";
+ }
+ return $ret;
}
/**
);
if( $wgRequest->getBool( 'bot' ) ) {
$query['bot'] = '1';
+ $query['hidediff'] = '1'; // bug 15999
}
$query['token'] = $wgUser->editToken( array( $title->getPrefixedText(),
$rev->getUserText() ) );
* @param bool $section Whether this is for a section edit
* @return string HTML output
*/
- public function formatTemplates( $templates, $preview = false, $section = false) {
- global $wgUser;
+ public function formatTemplates( $templates, $preview = false, $section = false ) {
wfProfileIn( __METHOD__ );
- $sk = $wgUser->getSkin();
-
$outText = '';
if ( count( $templates ) > 0 ) {
# Do a batch existence check
} else {
$outText .= wfMsgExt( 'templatesused', array( 'parse' ) );
}
- $outText .= '</div><ul>';
+ $outText .= "</div><ul>\n";
usort( $templates, array( 'Title', 'compare' ) );
foreach ( $templates as $titleObj ) {
$protected = '';
}
if( $titleObj->quickUserCan( 'edit' ) ) {
- $editLink = $sk->link( $titleObj, wfMsg( 'editlink' ), array(), array( 'action' => 'edit' ), 'known' );
+ $editLink = $this->makeLinkObj( $titleObj, wfMsg('editlink'), 'action=edit' );
} else {
- $editLink = $sk->link( $titleObj, wfMsg( 'viewsourcelink' ), array(), array( 'action' => 'edit' ), 'known' );
+ $editLink = $this->makeLinkObj( $titleObj, wfMsg('viewsourcelink'), 'action=edit' );
}
- $talkLink = $sk->link( $titleObj->getTalkPage(), wfMsg( 'talkpagelinktext' ) );
- $outText .= Xml::tags( 'li', array(),
- $sk->link( $titleObj ) . ' (' . $editLink . ' ' . wfMsg( 'pipe-separator' ) . ' ' . $talkLink . ') ' . $protected );
+ $outText .= '<li>' . $this->link( $titleObj ) . ' (' . $editLink . ') ' . $protected . '</li>';
}
$outText .= '</ul>';
}
* or similar
* @return string HTML output
*/
- public function formatHiddenCategories( $hiddencats) {
- global $wgUser, $wgLang;
+ public function formatHiddenCategories( $hiddencats ) {
+ global $wgLang;
wfProfileIn( __METHOD__ );
- $sk = $wgUser->getSkin();
-
$outText = '';
if ( count( $hiddencats ) > 0 ) {
# Construct the HTML
$outText = '<div class="mw-hiddenCategoriesExplanation">';
$outText .= wfMsgExt( 'hiddencategories', array( 'parse' ), $wgLang->formatnum( count( $hiddencats ) ) );
- $outText .= '</div><ul>';
+ $outText .= "</div><ul>\n";
foreach ( $hiddencats as $titleObj ) {
- $outText .= '<li>' . $sk->link( $titleObj, null, array(), array(), 'known' ) . '</li>'; # If it's hidden, it must exist - no need to check with a LinkBatch
+ $outText .= '<li>' . $this->link( $titleObj, null, array(), array(), 'known' ) . "</li>\n"; # If it's hidden, it must exist - no need to check with a LinkBatch
}
$outText .= '</ul>';
}
# FIXME: Per standard MW behavior, a value of '-' means to suppress the
# attribute, but this is broken for accesskey: that might be a useful
# value.
- if( $accesskey != ''
- && $accesskey != '-'
- && !wfEmptyMsg( "accesskey-$name", $accesskey ) ) {
+ if( $accesskey != '' && $accesskey != '-' && !wfEmptyMsg( "accesskey-$name", $accesskey ) ) {
wfProfileOut( __METHOD__ );
return $accesskey;
}
wfProfileOut( __METHOD__ );
return false;
}
+
+ /**
+ * Creates a (show/hide) link for deleting revisions/log entries
+ *
+ * @param array $query Query parameters to be passed to link()
+ * @param bool $restricted Set to true to use a <strong> instead of a <span>
+ *
+ * @return string HTML <a> link to Special:Revisiondelete, wrapped in a
+ * span to allow for customization of appearance with CSS
+ */
+ public function revDeleteLink( $query = array(), $restricted = false ) {
+ $sp = SpecialPage::getTitleFor( 'Revisiondelete' );
+ $text = wfMsgHtml( 'rev-delundel' );
+ $tag = $restricted ? 'strong' : 'span';
+ $link = $this->link( $sp, $text, array(), $query, array( 'known', 'noclasses' ) );
+ return Xml::tags( $tag, array( 'class' => 'mw-revdelundel-link' ), "($link)" );
+ }
}