Address CodeSniffer errors and warnings

Change-Id: Ie119db7d6d9e9eb3c1cd9c07b8f84fd155847c62
This commit is contained in:
Siebrand Mazeland 2013-11-18 23:03:29 +01:00
parent e25effa8b8
commit 511d594bf6
4 changed files with 64 additions and 31 deletions

View file

@ -23,7 +23,6 @@
*/
class ChangesList extends ContextSource {
/**
* @var Skin
*/
@ -140,8 +139,8 @@ class ChangesList extends ContextSource {
$flag = $map[$flag];
}
return "<abbr class='" . $flagInfos[$flag]['class'] . "' title='" . $flagInfos[$flag]['title'] . "'>" .
$flagInfos[$flag]['letter'] .
return "<abbr class='" . $flagInfos[$flag]['class'] . "' title='" .
$flagInfos[$flag]['title'] . "'>" . $flagInfos[$flag]['letter'] .
'</abbr>';
}
@ -313,7 +312,9 @@ class ChangesList extends ContextSource {
'action' => 'history'
)
);
$s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() . ' <span class="mw-changeslist-separator">. .</span> ';
// @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
$s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() .
' <span class="mw-changeslist-separator">. .</span> ';
}
/**
@ -353,8 +354,12 @@ class ChangesList extends ContextSource {
* @return string HTML fragment
*/
public function getTimestamp( $rc ) {
// @todo FIXME: Hard coded ". .". Is there a message for this? Should there be?
return $this->message['semicolon-separator'] . '<span class="mw-changeslist-date">' .
$this->getLanguage()->userTime( $rc->mAttribs['rc_timestamp'], $this->getUser() ) . '</span> <span class="mw-changeslist-separator">. .</span> ';
$this->getLanguage()->userTime(
$rc->mAttribs['rc_timestamp'],
$this->getUser()
) . '</span> <span class="mw-changeslist-separator">. .</span> ';
}
/**
@ -375,7 +380,8 @@ class ChangesList extends ContextSource {
*/
public function insertUserRelatedLinks( &$s, &$rc ) {
if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
$s .= ' <span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
$s .= ' <span class="history-deleted">' .
$this->msg( 'rev-deleted-user' )->escaped() . '</span>';
} else {
$s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
$rc->mAttribs['rc_user_text'] );
@ -405,7 +411,8 @@ class ChangesList extends ContextSource {
public function insertComment( $rc ) {
if ( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
return ' <span class="history-deleted">' . $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
return ' <span class="history-deleted">' .
$this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
} else {
return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
}
@ -435,7 +442,8 @@ class ChangesList extends ContextSource {
static $cache = array();
if ( $count > 0 ) {
if ( !isset( $cache[$count] ) ) {
$cache[$count] = $this->msg( 'number_of_watching_users_RCview' )->numParams( $count )->escaped();
$cache[$count] = $this->msg( 'number_of_watching_users_RCview' )
->numParams( $count )->escaped();
}
return $cache[$count];
} else {
@ -488,12 +496,16 @@ class ChangesList extends ContextSource {
* @param $rc RecentChange
*/
public function insertRollback( &$s, &$rc ) {
if ( $rc->mAttribs['rc_type'] == RC_EDIT && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
if ( $rc->mAttribs['rc_type'] == RC_EDIT
&& $rc->mAttribs['rc_this_oldid']
&& $rc->mAttribs['rc_cur_id']
) {
$page = $rc->getTitle();
/** Check for rollback and edit permissions, disallow special pages, and only
* show a link on the top-most revision */
if ( $this->getUser()->isAllowed( 'rollback' ) && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] )
{
if ( $this->getUser()->isAllowed( 'rollback' )
&& $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid']
) {
$rev = new Revision( array(
'title' => $page,
'id' => $rc->mAttribs['rc_this_oldid'],
@ -516,7 +528,10 @@ class ChangesList extends ContextSource {
return;
}
list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' );
list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
$rc->mAttribs['ts_tags'],
'changeslist'
);
$classes = array_merge( $classes, $newClasses );
$s .= ' ' . $tagSummary;
}

View file

@ -98,7 +98,8 @@ class EnhancedChangesList extends ChangesList {
$logtitle = SpecialPage::getTitleFor( 'Log', $logType );
$logpage = new LogPage( $logType );
$logname = $logpage->getName()->escaped();
$clink = $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logtitle, $logname ) )->escaped();
$clink = $this->msg( 'parentheses' )
->rawParams( Linker::linkKnown( $logtitle, $logname ) )->escaped();
} else {
$clink = Linker::link( $cacheEntry->getTitle() );
}
@ -162,7 +163,8 @@ class EnhancedChangesList extends ChangesList {
# Make user links
if ( $this->isDeleted( $cacheEntry, Revision::DELETED_USER ) ) {
$cacheEntry->userlink = ' <span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
$cacheEntry->userlink = ' <span class="history-deleted">' .
$this->msg( 'rev-deleted-user' )->escaped() . '</span>';
} else {
$cacheEntry->userlink = Linker::userLink(
$cacheEntry->mAttribs['rc_user'],
@ -286,7 +288,9 @@ class EnhancedChangesList extends ChangesList {
$text = $userlink;
$text .= $this->getLanguage()->getDirMark();
if ( $count > 1 ) {
$text .= ' ' . $this->msg( 'parentheses' )->rawParams( $this->getLanguage()->formatNum( $count ) . '×' )->escaped();
// @todo FIXME: Hardcoded '×'. Should be a message.
$formattedCount = $this->getLanguage()->formatNum( $count ) . '×';
$text .= ' ' . $this->msg( 'parentheses' )->rawParams( $formattedCount )->escaped();
}
array_push( $users, $text );
}
@ -296,7 +300,8 @@ class EnhancedChangesList extends ChangesList {
implode( $this->message['semicolon-separator'], $users )
)->escaped() . '</span>';
$tl = '<span class="mw-collapsible-toggle mw-collapsible-arrow mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
$tl = '<span class="mw-collapsible-toggle mw-collapsible-arrow ' .
'mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
$r .= "<td>$tl</td>";
# Main line
@ -312,7 +317,8 @@ class EnhancedChangesList extends ChangesList {
# Article link
if ( $namehidden ) {
$r .= ' <span class="history-deleted">' . $this->msg( 'rev-deleted-event' )->escaped() . '</span>';
$r .= ' <span class="history-deleted">' .
$this->msg( 'rev-deleted-event' )->escaped() . '</span>';
} elseif ( $allLogs ) {
$r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
} else {
@ -473,7 +479,11 @@ class EnhancedChangesList extends ChangesList {
$r .= $link . '</span>';
if ( !$type == RC_LOG || $type == RC_NEW ) {
$r .= ' ' . $this->msg( 'parentheses' )->rawParams( $rcObj->curlink . $this->message['pipe-separator'] . $rcObj->lastlink )->escaped();
$r .= ' ' . $this->msg( 'parentheses' )->rawParams(
$rcObj->curlink .
$this->message['pipe-separator'] .
$rcObj->lastlink
)->escaped();
}
$r .= ' <span class="mw-changeslist-separator">. .</span> ';
@ -598,19 +608,21 @@ class EnhancedChangesList extends ChangesList {
$logPage = new LogPage( $logType );
$logTitle = SpecialPage::getTitleFor( 'Log', $logType );
$logName = $logPage->getName()->escaped();
$r .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logTitle, $logName ) )->escaped();
$r .= $this->msg( 'parentheses' )
->rawParams( Linker::linkKnown( $logTitle, $logName ) )->escaped();
} else {
$this->insertArticleLink( $r, $rcObj, $rcObj->unpatrolled, $rcObj->watched );
}
# Diff and hist links
if ( $type != RC_LOG ) {
$query['action'] = 'history';
$r .= ' ' . $this->msg( 'parentheses' )->rawParams( $rcObj->difflink . $this->message['pipe-separator'] . Linker::linkKnown(
$rcObj->getTitle(),
$this->message['hist'],
array(),
$query
) )->escaped();
$r .= ' ' . $this->msg( 'parentheses' )
->rawParams( $rcObj->difflink . $this->message['pipe-separator'] . Linker::linkKnown(
$rcObj->getTitle(),
$this->message['hist'],
array(),
$query
) )->escaped();
}
$r .= ' <span class="mw-changeslist-separator">. .</span> ';
# Character diff

View file

@ -116,7 +116,8 @@ class OldChangesList extends ChangesList {
}
if ( $this->watchlist ) {
$classes[] = Sanitizer::escapeClass( 'watchlist-' . $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
$classes[] = Sanitizer::escapeClass( 'watchlist-' .
$rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
}
if ( !wfRunHooks( 'OldChangesListRecentChangesLine', array( &$this, &$s, $rc, &$classes ) ) ) {

View file

@ -406,7 +406,8 @@ class RecentChange {
/**
* Mark this RecentChange as patrolled
*
* NOTE: Can also return 'rcpatroldisabled', 'hookaborted' and 'markedaspatrollederror-noautopatrol' as errors
* NOTE: Can also return 'rcpatroldisabled', 'hookaborted' and
* 'markedaspatrollederror-noautopatrol' as errors
* @param $user User object doing the action
* @param $auto Boolean: for automatic patrol
* @return array of permissions errors, see Title::getUserPermissionsErrors()
@ -427,7 +428,9 @@ class RecentChange {
}
// Users without the 'autopatrol' right can't patrol their
// own revisions
if ( $user->getName() == $this->getAttribute( 'rc_user_text' ) && !$user->isAllowed( 'autopatrol' ) ) {
if ( $user->getName() == $this->getAttribute( 'rc_user_text' )
&& !$user->isAllowed( 'autopatrol' )
) {
$errors[] = array( 'markedaspatrollederror-noautopatrol' );
}
if ( $errors ) {
@ -602,9 +605,10 @@ class RecentChange {
* @return bool
*/
public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type,
$action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '' )
{
$action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = ''
) {
global $wgLogRestrictions;
# Don't add private logs to RC!
if ( isset( $wgLogRestrictions[$type] ) && $wgLogRestrictions[$type] != '*' ) {
return false;
@ -826,7 +830,8 @@ class RecentChange {
global $wgRequest;
if ( $ip ) {
if ( !IP::isIPAddress( $ip ) ) {
throw new MWException( "Attempt to write \"" . $ip . "\" as an IP address into recent changes" );
throw new MWException( "Attempt to write \"" . $ip .
"\" as an IP address into recent changes" );
}
} else {
$ip = $wgRequest->getIP();