*/
private static function fnamePart( $url ) {
$basename = strrchr( $url, '/' );
- if ( false === $basename ) {
+ if ( $basename === false ) {
$basename = $url;
} else {
$basename = substr( $basename, 1 );
$prefix = $postfix = '';
- if ( 'center' == $frameParams['align'] ) {
+ if ( $frameParams['align'] == 'center' ) {
$prefix = '<div class="center">';
$postfix = '</div>';
$frameParams['align'] = 'none';
$userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits = null
) {
global $wgUser, $wgDisableAnonTalk, $wgLang;
- $talkable = !( $wgDisableAnonTalk && 0 == $userId );
+ $talkable = !( $wgDisableAnonTalk && $userId == 0 );
$blockable = !( $flags & self::TOOL_LINKS_NOBLOCK );
$addEmailLink = $flags & self::TOOL_LINKS_EMAIL && $userId;
);
if ( $comment === null ) {
- $link = '';
if ( $title ) {
$section = $auto;
# Remove links that a user may have manually put in the autosummary
$section = str_replace( '[[', '', $section );
$section = str_replace( ']]', '', $section );
+ // We don't want any links in the auto text to be linked, but we still
+ // want to show any [[ ]]
+ $sectionText = str_replace( '[[', '[[', $auto );
+
$section = substr( Parser::guessSectionNameFromStrippedText( $section ), 1 );
if ( $local ) {
$sectionTitle = Title::makeTitleSafe( NS_MAIN, '', $section );
$title->getDBkey(), $section );
}
if ( $sectionTitle ) {
- $link = Linker::makeCommentLink( $sectionTitle, $wgLang->getArrow(), $wikiId, 'noclasses' );
- } else {
- $link = '';
+ $auto = Linker::makeCommentLink(
+ $sectionTitle, $wgLang->getArrow() . $wgLang->getDirMark() . $sectionText,
+ $wikiId, 'noclasses'
+ );
}
}
if ( $pre ) {
# autocomment $postsep written summary (/* section */ summary)
$auto .= wfMessage( 'colon-separator' )->inContentLanguage()->escaped();
}
- $auto = '<span class="autocomment">' . $auto . '</span>';
- $comment = $pre . $link . $wgLang->getDirMark()
- . '<span dir="auto">' . $auto;
- $append .= '</span>';
+ if ( $auto ) {
+ $auto = '<span dir="auto"><span class="autocomment">' . $auto . '</span>';
+ $append .= '</span>';
+ }
+ $comment = $pre . $auto;
}
return $comment;
},
* @return string
*/
public static function commentBlock(
- $comment, $title = null, $local = false, $wikiId = null
+ $comment, $title = null, $local = false, $wikiId = null, $useParentheses = true
) {
// '*' used to be the comment inserted by the software way back
// in antiquity in case none was provided, here for backwards
return '';
} else {
$formatted = self::formatComment( $comment, $title, $local, $wikiId );
- $formatted = wfMessage( 'parentheses' )->rawParams( $formatted )->escaped();
- return " <span class=\"comment\">$formatted</span>";
+ if ( $useParentheses ) {
+ $formatted = wfMessage( 'parentheses' )->rawParams( $formatted )->escaped();
+ $classNames = 'comment';
+ } else {
+ $classNames = 'comment comment--without-parentheses';
+ }
+ return " <span class=\"$classNames\">$formatted</span>";
}
}
* @param Revision $rev
* @param bool $local Whether section links should refer to local page
* @param bool $isPublic Show only if all users can see it
+ * @param bool $useParentheses (optional) Wrap comments in parentheses where needed
* @return string HTML fragment
*/
- public static function revComment( Revision $rev, $local = false, $isPublic = false ) {
+ public static function revComment( Revision $rev, $local = false, $isPublic = false,
+ $useParentheses = true
+ ) {
if ( $rev->getComment( Revision::RAW ) == "" ) {
return "";
}
$block = " <span class=\"comment\">" . wfMessage( 'rev-deleted-comment' )->escaped() . "</span>";
} elseif ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
$block = self::commentBlock( $rev->getComment( Revision::FOR_THIS_USER ),
- $rev->getTitle(), $local );
+ $rev->getTitle(), $local, null, $useParentheses );
} else {
$block = " <span class=\"comment\">" . wfMessage( 'rev-deleted-comment' )->escaped() . "</span>";
}