Swap else if for elseif

Trimming trailing whitespace also

Doing in 3 commits, so hopefully reviewable in CR...
This commit is contained in:
Sam Reed 2011-06-17 16:03:52 +00:00
parent 4ffe712c84
commit bdf84cb20e
25 changed files with 141 additions and 141 deletions

View file

@ -907,7 +907,7 @@ class Article {
'GROUP BY' => array( 'rev_user', 'rev_user_text' ),
'ORDER BY' => 'timestamp DESC',
);
$res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $jconds );
return new UserArrayFromResult( $res );
}
@ -957,7 +957,7 @@ class Article {
if ( $wgOut->isPrintable() ) {
$parserOptions->setIsPrintable( true );
$parserOptions->setEditSection( false );
} else if ( $wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) {
} elseif ( $wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) {
$parserOptions->setEditSection( false );
}
@ -974,7 +974,7 @@ class Article {
return;
# Try file cache
} else if ( $wgUseFileCache && $this->tryFileCache() ) {
} elseif ( $wgUseFileCache && $this->tryFileCache() ) {
wfDebug( __METHOD__ . ": done file cache\n" );
# tell wgOut that output is taken care of
$wgOut->disable();
@ -1440,7 +1440,7 @@ class Article {
if ( !$user->isLoggedIn() && !$ip ) { # User does not exist
$wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
array( 'userpage-userdoesnotexist-view', $rootPart ) );
} else if ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
} elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
LogEventsList::showLogExtract(
$wgOut,
'block',
@ -1520,7 +1520,7 @@ class Article {
return false;
// If the user needs to confirm that they want to see it...
} else if ( $wgRequest->getInt( 'unhide' ) != 1 ) {
} elseif ( $wgRequest->getInt( 'unhide' ) != 1 ) {
# Give explanation and add a link to view the revision...
$oldid = intval( $this->getOldID() );
$link = $this->mTitle->getFullUrl( "oldid={$oldid}&unhide=1" );
@ -3269,7 +3269,7 @@ class Article {
if ( $s === false ) {
# No one else ever edited this page
return array( array( 'cantrollback' ) );
} else if ( $s->rev_deleted & Revision::DELETED_TEXT || $s->rev_deleted & Revision::DELETED_USER ) {
} elseif ( $s->rev_deleted & Revision::DELETED_TEXT || $s->rev_deleted & Revision::DELETED_USER ) {
# Only admins can see this text
return array( array( 'notvisiblerev' ) );
}

View file

@ -279,7 +279,7 @@ class ChangesList {
# Diff link
if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
$diffLink = $this->message['diff'];
} else if( !self::userCan($rc,Revision::DELETED_TEXT) ) {
} elseif( !self::userCan($rc,Revision::DELETED_TEXT) ) {
$diffLink = $this->message['diff'];
} else {
$query = array(
@ -684,11 +684,11 @@ class EnhancedChangesList extends ChangesList {
array(), array( 'redirect' => 'no' ) ),
$this->skin->linkKnown( $rc->getMovedToTitle() ) );
// New unpatrolled pages
} else if( $rc->unpatrolled && $type == RC_NEW ) {
} elseif( $rc->unpatrolled && $type == RC_NEW ) {
$clink = $this->skin->linkKnown( $rc->getTitle(), null, array(),
array( 'rcid' => $rc->mAttribs['rc_id'] ) );
// Log entries
} else if( $type == RC_LOG ) {
} elseif( $type == RC_LOG ) {
if( $logType ) {
$logtitle = SpecialPage::getTitleFor( 'Log', $logType );
$clink = '(' . $this->skin->linkKnown( $logtitle,
@ -740,7 +740,7 @@ class EnhancedChangesList extends ChangesList {
if( !$showdifflinks ) {
$curLink = $this->message['cur'];
$diffLink = $this->message['diff'];
} else if( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
} elseif( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
if ( $type != RC_NEW ) {
$curLink = $this->message['cur'];
} else {
@ -758,7 +758,7 @@ class EnhancedChangesList extends ChangesList {
# Make "last" link
if( !$showdifflinks || !$lastOldid ) {
$lastLink = $this->message['last'];
} else if( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
} elseif( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
$lastLink = $this->message['last'];
} else {
$lastLink = $this->skin->linkKnown( $rc->getTitle(), $this->message['last'],
@ -903,7 +903,7 @@ class EnhancedChangesList extends ChangesList {
# Article link
if( $namehidden ) {
$r .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-event' ) . '</span>';
} else if( $allLogs ) {
} elseif( $allLogs ) {
$r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
} else {
$this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
@ -924,7 +924,7 @@ class EnhancedChangesList extends ChangesList {
$r .= '(';
if( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT ) ) {
$r .= $nchanges[$n];
} else if( $isnew ) {
} elseif( $isnew ) {
$r .= $nchanges[$n];
} else {
$params = $queryParams;
@ -944,7 +944,7 @@ class EnhancedChangesList extends ChangesList {
# History
if( $allLogs ) {
// don't show history link for logs
} else if( $namehidden || !$block[0]->getTitle()->exists() ) {
} elseif( $namehidden || !$block[0]->getTitle()->exists() ) {
$r .= $this->message['pipe-separator'] . $this->message['hist'] . ')';
} else {
$params = $queryParams;
@ -1012,7 +1012,7 @@ class EnhancedChangesList extends ChangesList {
if( $type == RC_LOG ) {
$link = $rcObj->timestamp;
# Revision link
} else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
} elseif( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
$link = '<span class="history-deleted">'.$rcObj->timestamp.'</span> ';
} else {
if ( $rcObj->unpatrolled && $type == RC_NEW) {

View file

@ -244,7 +244,7 @@ class EditPage {
// was created, or we may simply have got bogus input.
$this->editFormPageTop .= $wgOut->parse( '<div class="error mw-undo-norev">' . wfMsgNoTrans( 'undo-norev' ) . '</div>' );
}
} else if ( $section != '' ) {
} elseif ( $section != '' ) {
if ( $section == 'new' ) {
$text = $this->getPreloadedText( $preload );
} else {
@ -411,9 +411,9 @@ class EditPage {
} else {
if ( $this->save ) {
$this->formtype = 'save';
} else if ( $this->preview ) {
} elseif ( $this->preview ) {
$this->formtype = 'preview';
} else if ( $this->diff ) {
} elseif ( $this->diff ) {
$this->formtype = 'diff';
} else { # First time through
$this->firsttime = true;
@ -553,7 +553,7 @@ class EditPage {
} elseif ( $wgRequest->getVal( 'preview' ) == 'no' ) {
// Explicit override from request
return false;
} elseif ( $this->section == 'new' ) {
} elseif ( $this->section == 'new' ) {
// Nothing *to* preview for new sections
return false;
} elseif ( ( $wgRequest->getVal( 'preload' ) !== null || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) {
@ -662,7 +662,7 @@ class EditPage {
# The unmarked state will be assumed to be a save,
# if the form seems otherwise complete.
wfDebug( __METHOD__ . ": Passed token check.\n" );
} else if ( $this->diff ) {
} elseif ( $this->diff ) {
# Failed token check, but only requested "Show Changes".
wfDebug( __METHOD__ . ": Failed token check; Show Changes requested.\n" );
} else {
@ -793,7 +793,7 @@ class EditPage {
if ( !$user->isLoggedIn() && !$ip ) { # User does not exist
$wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
array( 'userpage-userdoesnotexist', $username ) );
} else if ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
} elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
LogEventsList::showLogExtract(
$wgOut,
'block',
@ -1003,7 +1003,7 @@ class EditPage {
}
$text = $this->textbox1;
if ( $this->section == 'new' && $this->summary != '' ) {
if ( $this->section == 'new' && $this->summary != '' ) {
$text = wfMsgForContent( 'newsectionheaderdefaultlevel', $this->summary ) . "\n\n" . $text;
}
@ -1053,7 +1053,7 @@ class EditPage {
wfDebug( __METHOD__ . ": activating conflict; section replace failed.\n" );
$this->isConflict = true;
$text = $this->textbox1; // do not try to merge here!
} else if ( $this->isConflict ) {
} elseif ( $this->isConflict ) {
# Attempt merge
if ( $this->mergeChangesInto( $text ) ) {
// Successful merge! Maybe we should tell the user the good news?
@ -1085,7 +1085,7 @@ class EditPage {
}
# Handle the user preference to force summaries here, but not for null edits
if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp( $oldtext, $text )
if ( $this->section != 'new' && !$this->allowBlankSummary && 0 != strcmp( $oldtext, $text )
&& !Title::newFromRedirect( $text ) ) # check if it's not a redirect
{
if ( md5( $this->summary ) == $this->autoSumm ) {
@ -1096,7 +1096,7 @@ class EditPage {
}
# And a similar thing for new sections
if ( $this->section == 'new' && !$this->allowBlankSummary ) {
if ( $this->section == 'new' && !$this->allowBlankSummary ) {
if ( trim( $this->summary ) == '' ) {
$this->missingSummary = true;
wfProfileOut( __METHOD__ );
@ -1107,7 +1107,7 @@ class EditPage {
# All's well
wfProfileIn( __METHOD__ . '-sectionanchor' );
$sectionanchor = '';
if ( $this->section == 'new' ) {
if ( $this->section == 'new' ) {
if ( $this->textbox1 == '' ) {
$this->missingComment = true;
wfProfileOut( __METHOD__ . '-sectionanchor' );
@ -1435,7 +1435,7 @@ HTML
}
$wgOut->addHTML( $this->editFormTextBeforeContent );
$wgOut->addHTML( $toolbar );
if ( $this->isConflict ) {
@ -1536,7 +1536,7 @@ HTML
if ( !$this->mArticle->mRevision->userCan( Revision::DELETED_TEXT ) ) {
$wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-permission' );
} else if ( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
} elseif ( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
$wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-view' );
}
@ -1997,7 +1997,7 @@ HTML
} else {
$note = wfMsg( 'session_fail_preview' );
}
} else if ( $this->incompleteForm ) {
} elseif ( $this->incompleteForm ) {
$note = wfMsg( 'edit_form_incomplete' );
} else {
$note = wfMsg( 'previewnote' );

View file

@ -518,7 +518,7 @@ class HistoryPager extends ReverseChronologicalPager {
array( 'name' => 'ids[' . $rev->getId() . ']' ) );
}
// User can only view deleted revisions...
} else if ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
} elseif ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
// If revision was hidden from sysops, disable the link
if ( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
$cdel = $this->getSkin()->revDeleteLinkDisabled( false );
@ -726,7 +726,7 @@ class HistoryPager extends ReverseChronologicalPager {
if ( !$rev->userCan( Revision::DELETED_TEXT ) ) {
$radio['disabled'] = 'disabled';
$checkmark = array(); // We will check the next possible one
} else if ( !$this->oldIdChecked ) {
} elseif ( !$this->oldIdChecked ) {
$checkmark = array( 'checked' => 'checked' );
$this->oldIdChecked = $id;
} else {

View file

@ -250,7 +250,7 @@ class Hooks {
'should return true to continue hook processing or false to abort.'
);
}
} else if ( !$retval ) {
} elseif ( !$retval ) {
return false;
}
}

View file

@ -62,7 +62,7 @@ class Licenses extends HTMLFormField {
}
if ( $level == count( $levels ) ) {
$levels[$level - 1] = $line;
} else if ( $level > count( $levels ) ) {
} elseif ( $level > count( $levels ) ) {
$levels[] = $line;
}
}

View file

@ -264,7 +264,7 @@ class Linker {
* @param $target Title
* @param $attribs
* @param $options
*
*
* @return array
*/
private static function linkAttribs( $target, $attribs, $options ) {
@ -521,7 +521,7 @@ class Linker {
// we don't want it to be limited by its "normal" width.
global $wgSVGMaxSize;
$hp['width'] = $wgSVGMaxSize;
} else {
} else {
$hp['width'] = $file->getWidth( $page );
}
@ -1013,7 +1013,7 @@ class Linker {
static function revUserLink( $rev, $isPublic = false ) {
if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
$link = wfMsgHtml( 'rev-deleted-user' );
} else if ( $rev->userCan( Revision::DELETED_USER ) ) {
} elseif ( $rev->userCan( Revision::DELETED_USER ) ) {
$link = self::userLink( $rev->getUser( Revision::FOR_THIS_USER ),
$rev->getUserText( Revision::FOR_THIS_USER ) );
} else {
@ -1034,7 +1034,7 @@ class Linker {
static function revUserTools( $rev, $isPublic = false ) {
if ( $rev->isDeleted( Revision::DELETED_USER ) && $isPublic ) {
$link = wfMsgHtml( 'rev-deleted-user' );
} else if ( $rev->userCan( Revision::DELETED_USER ) ) {
} elseif ( $rev->userCan( Revision::DELETED_USER ) ) {
$userId = $rev->getUser( Revision::FOR_THIS_USER );
$userText = $rev->getUserText( Revision::FOR_THIS_USER );
$link = self::userLink( $userId, $userText ) .
@ -1373,7 +1373,7 @@ class Linker {
}
if ( $rev->isDeleted( Revision::DELETED_COMMENT ) && $isPublic ) {
$block = " <span class=\"comment\">" . wfMsgHtml( 'rev-deleted-comment' ) . "</span>";
} else if ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
} elseif ( $rev->userCan( Revision::DELETED_COMMENT ) ) {
$block = self::commentBlock( $rev->getComment( Revision::FOR_THIS_USER ),
$rev->getTitle(), $local );
} else {
@ -1473,7 +1473,7 @@ class Linker {
foreach ( $tree as $section ) {
if ( $section['toclevel'] > $lastLevel )
$toc .= self::tocIndent();
else if ( $section['toclevel'] < $lastLevel )
elseif ( $section['toclevel'] < $lastLevel )
$toc .= self::tocUnindent(
$lastLevel - $section['toclevel'] );
else

View file

@ -98,7 +98,7 @@ class LogEventsList {
* @param $filter: array
* @param $tagFilter: array?
*/
public function showOptions( $types=array(), $user='', $page='', $pattern='', $year='',
public function showOptions( $types=array(), $user='', $page='', $pattern='', $year='',
$month = '', $filter = null, $tagFilter='' ) {
global $wgScript, $wgMiserMode;
@ -330,7 +330,7 @@ class LogEventsList {
return Xml::tags( 'li', array( "class" => implode( ' ', $classes ) ),
$del . "$time $userLink $action $comment $revert $tagDisplay" ) . "\n";
}
private function logTimestamp( $row ) {
global $wgLang;
$time = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->log_timestamp ), true );
@ -362,7 +362,7 @@ class LogEventsList {
}
return $action;
}
private function logComment( $row ) {
global $wgContLang;
if( self::isDeleted( $row, LogPage::DELETED_COMMENT ) ) {
@ -409,7 +409,7 @@ class LogEventsList {
) . ')';
}
// Show undelete link
} else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'delete', 'deletedhistory' ) ) {
} elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'delete', 'deletedhistory' ) ) {
if( !$wgUser->isAllowed( 'undelete' ) ) {
$viewdeleted = $this->message['undeleteviewlink'];
} else {
@ -423,7 +423,7 @@ class LogEventsList {
array( 'known', 'noclasses' )
) . ')';
// Show unblock/change block link
} else if( self::typeAction( $row, array( 'block', 'suppress' ), array( 'block', 'reblock' ), 'block' ) ) {
} elseif( self::typeAction( $row, array( 'block', 'suppress' ), array( 'block', 'reblock' ), 'block' ) ) {
$revert = '(' .
$this->skin->link(
SpecialPage::getTitleFor( 'Unblock', $row->log_title ),
@ -442,7 +442,7 @@ class LogEventsList {
) .
')';
// Show change protection link
} else if( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
} elseif( self::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
$revert .= ' (' .
$this->skin->link( $title,
$this->message['hist'],
@ -462,7 +462,7 @@ class LogEventsList {
}
$revert .= ')';
// Show unmerge link
} else if( self::typeAction( $row, 'merge', 'merge', 'mergehistory' ) ) {
} elseif( self::typeAction( $row, 'merge', 'merge', 'mergehistory' ) ) {
$revert = '(' . $this->skin->link(
SpecialPage::getTitleFor( 'MergeHistory' ),
$this->message['revertmerge'],
@ -475,11 +475,11 @@ class LogEventsList {
array( 'known', 'noclasses' )
) . ')';
// If an edit was hidden from a page give a review link to the history
} else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'revision', 'deletedhistory' ) ) {
} elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'revision', 'deletedhistory' ) ) {
$revert = RevisionDeleter::getLogLinks( $title, $paramArray,
$this->skin, $this->message );
// Hidden log items, give review link
} else if( self::typeAction( $row, array( 'delete', 'suppress' ), 'event', 'deletedhistory' ) ) {
} elseif( self::typeAction( $row, array( 'delete', 'suppress' ), 'event', 'deletedhistory' ) ) {
if( count($paramArray) >= 1 ) {
$revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
// $paramArray[1] is a CSV of the IDs
@ -487,7 +487,7 @@ class LogEventsList {
// Link to each hidden object ID, $paramArray[1] is the url param
$revert = '(' . $this->skin->link(
$revdel,
$this->message['revdel-restore'],
$this->message['revdel-restore'],
array(),
array(
'target' => $title->getPrefixedText(),
@ -498,7 +498,7 @@ class LogEventsList {
) . ')';
}
// Self-created users
} else if( self::typeAction( $row, 'newusers', 'create2' ) ) {
} elseif( self::typeAction( $row, 'newusers', 'create2' ) ) {
if( isset( $paramArray[0] ) ) {
$revert = $this->skin->userToolLinks( $paramArray[0], $title->getDBkey(), true );
} else {
@ -879,7 +879,7 @@ class LogPager extends ReverseChronologicalPager {
// Paranoia: avoid brute force searches (bug 17342)
if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
$this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::DELETED_USER) . ' = 0';
} else if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
} elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) {
$this->mConds[] = $this->mDb->bitAnd('log_deleted', LogPage::SUPPRESSED_USER) .
' != ' . LogPage::SUPPRESSED_USER;
}
@ -928,7 +928,7 @@ class LogPager extends ReverseChronologicalPager {
// Paranoia: avoid brute force searches (bug 17342)
if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
$this->mConds[] = $db->bitAnd('log_deleted', LogPage::DELETED_ACTION) . ' = 0';
} else if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
} elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) {
$this->mConds[] = $db->bitAnd('log_deleted', LogPage::SUPPRESSED_ACTION) .
' != ' . LogPage::SUPPRESSED_ACTION;
}
@ -957,12 +957,12 @@ class LogPager extends ReverseChronologicalPager {
# Avoid usage of the wrong index by limiting
# the choices of available indexes. This mainly
# avoids site-breaking filesorts.
} else if( $this->title || $this->pattern || $this->user ) {
} elseif( $this->title || $this->pattern || $this->user ) {
$index['logging'] = array( 'page_time', 'user_time' );
if( count($this->types) == 1 ) {
$index['logging'][] = 'log_user_type_time';
}
} else if( count($this->types) == 1 ) {
} elseif( count($this->types) == 1 ) {
$index['logging'] = 'type_time';
} else {
$index['logging'] = 'times';

View file

@ -846,7 +846,7 @@ abstract class ApiBase {
if ( $deprecated && $value !== false ) {
$this->setWarning( "The $encParamName parameter has been deprecated." );
}
} else if ( $required ) {
} elseif ( $required ) {
$this->dieUsageMsg( array( 'missingparam', $paramName ) );
}
@ -1140,7 +1140,7 @@ abstract class ApiBase {
'nouploadmodule' => array( 'code' => 'nouploadmodule', 'info' => 'No upload module set' ),
'uploaddisabled' => array( 'code' => 'uploaddisabled', 'info' => 'Uploads are not enabled. Make sure $wgEnableUploads is set to true in LocalSettings.php and the PHP ini setting file_uploads is true' ),
'copyuploaddisabled' => array( 'code' => 'copyuploaddisabled', 'info' => 'Uploads by URL is not enabled. Make sure $wgAllowCopyUploads is set to true in LocalSettings.php.' ),
'filename-tooshort' => array( 'code' => 'filename-tooshort', 'info' => 'The filename is too short' ),
'illegal-filename' => array( 'code' => 'illegal-filename', 'info' => 'The filename is not allowed' ),
'filetype-missing' => array( 'code' => 'filetype-missing', 'info' => 'The file is missing an extension' ),
@ -1191,7 +1191,7 @@ abstract class ApiBase {
wfMsgReplaceArgs( self::$messageMap[$key]['info'], $error )
);
}
// If the key isn't present, throw an "unknown error"
return $this->parseMsg( array( 'unknownerror', $key ) );
}

View file

@ -482,7 +482,7 @@ class ApiEditPage extends ApiBase {
'minor' => 'Minor edit',
'notminor' => 'Non-minor edit',
'bot' => 'Mark this edit as bot',
'basetimestamp' => array( 'Timestamp of the base revision (gotten through prop=revisions&rvprop=timestamp).',
'basetimestamp' => array( 'Timestamp of the base revision (obtained through prop=revisions&rvprop=timestamp).',
'Used to detect edit conflicts; leave unset to ignore conflicts.'
),
'starttimestamp' => array( 'Timestamp when you obtained the edit token.',

View file

@ -84,7 +84,7 @@ class ApiQueryAllmessages extends ApiQueryBase {
$skip = true;
}
$messages_filtered[] = $message;
} else if ( $skip ) {
} elseif ( $skip ) {
break;
}
}

View file

@ -228,7 +228,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
$h = $image->getHandler();
if ( !$h ) {
$this->setWarning( 'Could not create thumbnail because ' .
$this->setWarning( 'Could not create thumbnail because ' .
$image->getName() . ' does not have an associated image handler' );
return $thumbParams;
}
@ -361,12 +361,12 @@ class ApiQueryImageInfo extends ApiQueryBase {
}
if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
list( $ext, $mime ) = $file->getHandler()->getThumbType(
substr( $mto->getPath(), strrpos( $mto->getPath(), '.' ) + 1 ),
list( $ext, $mime ) = $file->getHandler()->getThumbType(
substr( $mto->getPath(), strrpos( $mto->getPath(), '.' ) + 1 ),
$file->getMimeType(), $thumbParams );
$vals['thumbmime'] = $mime;
}
} else if ( $mto && $mto->isError() ) {
} elseif ( $mto && $mto->isError() ) {
$vals['thumberror'] = $mto->toText();
}
}
@ -519,7 +519,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
/**
* Returns the descriptions for the properties provided by getPropertyNames()
*
*
* @param array $filter List of properties to filter out
*
* @return array
@ -547,7 +547,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
'limit' => 'How many image revisions to return',
'start' => 'Timestamp to start listing from',
'end' => 'Timestamp to stop listing at',
'metadataversion' => array( "Version of metadata to use. if 'latest' is specified, use latest version.",
'metadataversion' => array( "Version of metadata to use. if 'latest' is specified, use latest version.",
"Defaults to '1' for backwards compatibility" ),
'continue' => 'If the query response includes a continue value, use it here to get another page of results'
);
@ -564,7 +564,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
array( 'code' => 'urlparam', 'info' => "Invalid value for {$p}urlparam" ),
array( 'code' => 'urlparam_no_width', 'info' => "{$p}urlparam requires {$p}urlwidth" ),
array( 'code' => 'urlparam_urlwidth_mismatch', 'info' => "The width set in {$p}urlparm doesnt't " .
"match the one in {$p}urlwidth" ),
"match the one in {$p}urlwidth" ),
) );
}

View file

@ -217,7 +217,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
);
if ( $this->getModuleName() == self::LINKS ) {
$arr[$this->titlesParam] = 'Only list links to these titles. Useful for checking whether a certain page links to a certain title.';
} else if ( $this->getModuleName() == self::TEMPLATES ) {
} elseif ( $this->getModuleName() == self::TEMPLATES ) {
$arr[$this->titlesParam] = 'Only list these templates. Useful for checking whether a certain page uses a certain template.';
}
return $arr;

View file

@ -111,7 +111,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
list( $type, $action ) = explode( '/', $params['action'] );
$this->addWhereFld( 'log_type', $type );
$this->addWhereFld( 'log_action', $action );
} else if ( !is_null( $params['type'] ) ) {
} elseif ( !is_null( $params['type'] ) ) {
$this->addWhereFld( 'log_type', $params['type'] );
$index['logging'] = 'type_time';
}

View file

@ -78,7 +78,7 @@ class HTMLFileCache {
public function fileCacheTime() {
return wfTimestamp( TS_MW, filemtime( $this->fileCacheName() ) );
}
/**
* Check if pages can be cached for this request/user
* @return bool
@ -96,13 +96,13 @@ class HTMLFileCache {
}
// Normal page view in query form can have action=view.
// Raw hits for pages also stored, like .css pages for example.
else if( $query == 'action' && ($val == 'view' || $val == 'raw') ) {
elseif( $query == 'action' && ($val == 'view' || $val == 'raw') ) {
continue;
} else if( $query == 'usemsgcache' && $val == 'yes' ) {
} elseif( $query == 'usemsgcache' && $val == 'yes' ) {
continue;
}
// Below are header setting params
else if( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) {
elseif( $query == 'maxage' || $query == 'smaxage' || $query == 'ctype' || $query == 'gen' ) {
continue;
} else {
return false;

View file

@ -1766,12 +1766,12 @@ abstract class DatabaseBase implements DatabaseType {
$retJOIN[] = $tableClause;
// Is there an INDEX clause?
} else if ( isset( $use_index_safe[$alias] ) ) {
} elseif ( isset( $use_index_safe[$alias] ) ) {
$tableClause = $this->tableNameWithAlias( $table, $alias );
$tableClause .= ' ' . $this->useIndexClause( implode( ',', (array)$use_index_safe[$alias] ) );
$ret[] = $tableClause;
// Is there a JOIN clause?
} else if ( isset( $join_conds_safe[$alias] ) ) {
} elseif ( isset( $join_conds_safe[$alias] ) ) {
$tableClause = $join_conds_safe[$alias][0] . ' ' . $this->tableNameWithAlias( $table, $alias );
$on = $this->makeList( (array)$join_conds_safe[$alias][1], LIST_AND );
if ( $on != '' ) {
@ -2663,7 +2663,7 @@ abstract class DatabaseBase implements DatabaseType {
$dollarquote = true;
}
}
else if ( !$dollarquote ) {
elseif ( !$dollarquote ) {
if ( ';' == $line { $sl } && ( $sl < 2 || ';' != $line { $sl - 1 } ) ) {
$done = true;
$line = substr( $line, 0, $sl );

View file

@ -345,7 +345,7 @@ class DatabaseMssql extends DatabaseBase {
$row->Column_name = trim( $col );
$result[] = clone $row;
}
} else if ( $index == 'PRIMARY' && stristr( $row->index_description, 'PRIMARY' ) ) {
} elseif ( $index == 'PRIMARY' && stristr( $row->index_description, 'PRIMARY' ) ) {
$row->Non_unique = 0;
$cols = explode( ", ", $row->index_keys );
foreach ( $cols as $col ) {
@ -927,12 +927,12 @@ class DatabaseMssql extends DatabaseBase {
$tableClause .= ' ON (' . $this->makeList( (array)$join_conds_safe[$table][1], LIST_AND ) . ')';
$retJOIN[] = $tableClause;
// Is there an INDEX clause?
} else if ( isset( $use_index_safe[$table] ) ) {
} elseif ( isset( $use_index_safe[$table] ) ) {
$tableClause = $this->tableName( $table );
$tableClause .= ' ' . $this->useIndexClause( implode( ',', (array)$use_index_safe[$table] ) );
$ret[] = $tableClause;
// Is there a JOIN clause?
} else if ( isset( $join_conds_safe[$table] ) ) {
} elseif ( isset( $join_conds_safe[$table] ) ) {
$tableClause = $join_conds_safe[$table][0] . ' ' . $this->tableName( $table );
$tableClause .= ' ON (' . $this->makeList( (array)$join_conds_safe[$table][1], LIST_AND ) . ')';
$retJOIN[] = $tableClause;

View file

@ -16,7 +16,7 @@ class ORAResult {
private $rows;
private $cursor;
private $nrows;
private $columns = array();
private function array_unique_md( $array_in ) {
@ -246,7 +246,7 @@ class DatabaseOracle extends DatabaseBase {
$this->mServer = $server;
if ( !$dbName ) {
$this->mDBname = $user;
} else {
} else {
$this->mDBname = $dbName;
}
}
@ -359,7 +359,7 @@ class DatabaseOracle extends DatabaseBase {
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
$res->free();
}
@ -367,7 +367,7 @@ class DatabaseOracle extends DatabaseBase {
if ( $res instanceof ResultWrapper ) {
$res = $res->result;
}
return $res->fetchObject();
}
@ -485,11 +485,11 @@ class DatabaseOracle extends DatabaseBase {
if ( is_numeric( $col ) ) {
$bind = $val;
$val = null;
return $bind;
} else if ( $includeCol ) {
return $bind;
} elseif ( $includeCol ) {
$bind = "$col = ";
}
if ( $val == '' && $val !== 0 && $col_type != 'BLOB' && $col_type != 'CLOB' ) {
$val = null;
}
@ -503,7 +503,7 @@ class DatabaseOracle extends DatabaseBase {
} else {
$bind .= ':' . $col;
}
return $bind;
}
@ -523,7 +523,7 @@ class DatabaseOracle extends DatabaseBase {
} else {
$first = false;
}
$sql .= $this->fieldBindStatement( $table, $col, $val );
}
$sql .= ')';
@ -757,7 +757,7 @@ class DatabaseOracle extends DatabaseBase {
$this->delete( $table, $deleteConds, $fname );
}
if ( $sequenceData !== false && !isset( $row[$sequenceData['column']] ) ) {
$row[$sequenceData['column']] = $this->nextSequenceValue( $sequenceData['sequence'] );
}
@ -835,7 +835,7 @@ class DatabaseOracle extends DatabaseBase {
if (!empty($prefix)) {
$listWhere = ' AND table_name LIKE \''.strtoupper($prefix).'%\'';
}
$owner = strtoupper( $this->mDBname );
$result = $this->doQuery( "SELECT table_name FROM all_tables WHERE owner='$owner' AND table_name NOT LIKE '%!_IDX\$_' ESCAPE '!' $listWhere" );
@ -858,7 +858,7 @@ class DatabaseOracle extends DatabaseBase {
if( !$this->tableExists( $tableName ) ) {
return false;
}
return $this->doQuery( "DROP TABLE $tableName CASCADE CONSTRAINTS PURGE" );
}
@ -902,7 +902,7 @@ class DatabaseOracle extends DatabaseBase {
$rset = $this->doQuery( 'SELECT version FROM product_component_version WHERE UPPER(product) LIKE \'ORACLE DATABASE%\'' );
if ( !( $row = $rset->fetchRow() ) ) {
return oci_server_version( $this->mConn );
}
}
return $row['version'];
}
@ -1163,7 +1163,7 @@ class DatabaseOracle extends DatabaseBase {
private function wrapFieldForWhere( $table, &$col, &$val ) {
global $wgContLang;
$col_info = $this->fieldInfoMulti( $table, $col );
$col_type = $col_info != false ? $col_info->type() : 'CONSTANT';
if ( $col_type == 'CLOB' ) {
@ -1250,15 +1250,15 @@ class DatabaseOracle extends DatabaseBase {
function update( $table, $values, $conds, $fname = 'DatabaseOracle::update', $options = array() ) {
global $wgContLang;
$table = $this->tableName( $table );
$opts = $this->makeUpdateOptions( $options );
$sql = "UPDATE $opts $table SET ";
$first = true;
foreach ( $values as $col => &$val ) {
$sqlSet = $this->fieldBindStatement( $table, $col, $val, true );
if ( !$first ) {
$sqlSet = ', ' . $sqlSet;
} else {
@ -1304,8 +1304,8 @@ class DatabaseOracle extends DatabaseBase {
throw new DBUnexpectedError( $this, "Cannot create LOB descriptor: " . $e['message'] );
}
if ( $col_type == 'BLOB' ) {
$lob[$col]->writeTemporary( $val );
if ( $col_type == 'BLOB' ) {
$lob[$col]->writeTemporary( $val );
oci_bind_by_name( $stmt, ":$col", $lob[$col], - 1, SQLT_BLOB );
} else {
$lob[$col]->writeTemporary( $val );

View file

@ -352,7 +352,7 @@ class _DiffEngine {
$this->in_seq[$this->seq[$k]] = false;
$this->seq[$k] = $y;
$this->in_seq[$y] = 1;
} else if ( empty( $this->in_seq[$y] ) ) {
} elseif ( empty( $this->in_seq[$y] ) ) {
$k = $this->_lcs_pos( $y );
assert( $k > 0 );
$ymids[$k] = $ymids[$k -1];

View file

@ -764,7 +764,7 @@ CONTROL;
wfDl( 'php_wikidiff' );
wfProfileOut( __METHOD__ . '-php_wikidiff.so' );
}
else if ( $wgExternalDiffEngine == 'wikidiff2' && !function_exists( 'wikidiff2_do_diff' ) ) {
elseif ( $wgExternalDiffEngine == 'wikidiff2' && !function_exists( 'wikidiff2_do_diff' ) ) {
wfProfileIn( __METHOD__ . '-php_wikidiff2.so' );
wfDl( 'wikidiff2' );
wfProfileOut( __METHOD__ . '-php_wikidiff2.so' );
@ -1050,7 +1050,7 @@ CONTROL;
}
if ( !$this->mNewRev->userCan( Revision::DELETED_TEXT ) ) {
$this->mNewtitle = "<span class='history-deleted'>{$this->mPagetitle}</span>";
} else if ( $this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) {
} elseif ( $this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) {
$this->mNewtitle = "<span class='history-deleted'>{$this->mNewtitle}</span>";
}
@ -1105,7 +1105,7 @@ CONTROL;
if ( !$this->mOldRev->userCan( Revision::DELETED_TEXT ) ) {
$this->mOldtitle = '<span class="history-deleted">' . $this->mOldPagetitle . '</span>';
} else if ( $this->mOldRev->isDeleted( Revision::DELETED_TEXT ) ) {
} elseif ( $this->mOldRev->isDeleted( Revision::DELETED_TEXT ) ) {
$this->mOldtitle = '<span class="history-deleted">' . $this->mOldtitle . '</span>';
}
}

View file

@ -239,7 +239,7 @@ class WikiDiff3 {
$starty - 1, $V, $snake )
+ $this->lcs_rec( $startx + $len, $topl1, $starty + $len,
$topl2, $V, $snake );
} else if ( $d == 1 ) {
} elseif ( $d == 1 ) {
/*
* In this case the sequences differ by exactly 1 line. We have
* already saved all the lines after the difference in the for loop
@ -332,7 +332,7 @@ class WikiDiff3 {
// check to see if we can cut down the diagonal range
if ( $x >= $N && $end_forward > $k - 1 ) {
$end_forward = $k - 1;
} else if ( $absy - $bottoml2 >= $M ) {
} elseif ( $absy - $bottoml2 >= $M ) {
$start_forward = $k + 1;
$value_to_add_forward = 0;
}
@ -366,7 +366,7 @@ class WikiDiff3 {
if ( $x <= 0 ) {
$start_backward = $k + 1;
$value_to_add_backward = 0;
} else if ( $y <= 0 && $end_backward > $k - 1 ) {
} elseif ( $y <= 0 && $end_backward > $k - 1 ) {
$end_backward = $k - 1;
}
}
@ -400,7 +400,7 @@ class WikiDiff3 {
// check to see if we can cut down the diagonal range
if ( $x >= $N && $end_forward > $k - 1 ) {
$end_forward = $k - 1;
} else if ( $absy -$bottoml2 >= $M ) {
} elseif ( $absy -$bottoml2 >= $M ) {
$start_forward = $k + 1;
$value_to_add_forward = 0;
}
@ -441,7 +441,7 @@ class WikiDiff3 {
if ( $x <= 0 ) {
$start_backward = $k + 1;
$value_to_add_backward = 0;
} else if ( $y <= 0 && $end_backward > $k - 1 ) {
} elseif ( $y <= 0 && $end_backward > $k - 1 ) {
$end_backward = $k - 1;
}
}
@ -510,7 +510,7 @@ class WikiDiff3 {
$max_progress[0][0] = $x;
$max_progress[0][1] = $y;
$max_progress[0][2] = $progress;
} else if ( $progress == $max_progress[0][2] ) {
} elseif ( $progress == $max_progress[0][2] ) {
++$num_progress;
$max_progress[$num_progress][0] = $x;
$max_progress[$num_progress][1] = $y;
@ -537,7 +537,7 @@ class WikiDiff3 {
$max_progress[0][0] = $x;
$max_progress[0][1] = $y;
$max_progress[0][2] = $progress;
} else if ( $progress == $max_progress[0][2] && !$max_progress_forward ) {
} elseif ( $progress == $max_progress[0][2] && !$max_progress_forward ) {
++$num_progress;
$max_progress[$num_progress][0] = $x;
$max_progress[$num_progress][1] = $y;

View file

@ -40,7 +40,7 @@ abstract class FileRepo {
$this->initialCapital = MWNamespace::isCapitalized( NS_FILE );
foreach ( array( 'descBaseUrl', 'scriptDirUrl', 'articleUrl', 'fetchDescription',
'thumbScriptUrl', 'initialCapital', 'pathDisclosureProtection',
'descriptionCacheExpiry', 'hashLevels', 'url', 'thumbUrl', 'scriptExtension' )
'descriptionCacheExpiry', 'hashLevels', 'url', 'thumbUrl', 'scriptExtension' )
as $var )
{
if ( isset( $info[$var] ) ) {
@ -132,7 +132,7 @@ abstract class FileRepo {
if ( $img && $img->exists() ) {
if ( !$img->isDeleted(File::DELETED_FILE) ) {
return $img;
} else if ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) {
} elseif ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) {
return $img;
}
}
@ -233,7 +233,7 @@ abstract class FileRepo {
if ( $img && $img->exists() ) {
if ( !$img->isDeleted(File::DELETED_FILE) ) {
return $img;
} else if ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) {
} elseif ( !empty( $options['private'] ) && $img->userCan(File::DELETED_FILE) ) {
return $img;
}
}
@ -308,18 +308,18 @@ abstract class FileRepo {
function getName() {
return $this->name;
}
/**
* Make an url to this repo
*
*
* @param $query mixed Query string to append
* @param $entry string Entry point; defaults to index
* @return string
*/
function makeUrl( $query = '', $entry = 'index' ) {
$ext = isset( $this->scriptExtension ) ? $this->scriptExtension : '.php';
return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}{$ext}", $query );
}
return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}{$ext}", $query );
}
/**
* Get the URL of an image description page. May return false if it is
@ -369,7 +369,7 @@ abstract class FileRepo {
$query .= '&uselang=' . $lang;
}
if ( isset( $this->scriptDirUrl ) ) {
return $this->makeUrl(
return $this->makeUrl(
'title=' .
wfUrlencode( 'Image:' . $name ) .
"&$query" );
@ -382,7 +382,7 @@ abstract class FileRepo {
}
}
}
/**
* Get the URL of the stylesheet to apply to description pages
* @return string
@ -703,7 +703,7 @@ abstract class FileRepo {
array_unshift( $args, 'filerepo', $this->getName() );
return call_user_func_array( 'wfMemcKey', $args );
}
/**
* Get an UploadStash associated with this repo.
*

View file

@ -1003,12 +1003,12 @@ abstract class Installer {
$c = hexdec($c);
if ($c <= 0x7F) {
return chr($c);
} else if ($c <= 0x7FF) {
} elseif ($c <= 0x7FF) {
return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);
} else if ($c <= 0xFFFF) {
} elseif ($c <= 0xFFFF) {
return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);
} else if ($c <= 0x10FFFF) {
} elseif ($c <= 0x10FFFF) {
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
. chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);

View file

@ -1,24 +1,24 @@
<?php
/*
* Copyright 2010 Wikimedia Foundation
*
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
* OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* specific language governing permissions and limitations under the License.
*/
/**
* Transforms CSS data
*
*
* This class provides minification, URL remapping, URL extracting, and data-URL embedding.
*
*
* @file
* @version 0.1.1 -- 2010-09-11
* @author Trevor Parscal <tparscal@wikimedia.org>
@ -26,9 +26,9 @@
* @license http://www.apache.org/licenses/LICENSE-2.0
*/
class CSSMin {
/* Constants */
/**
* Maximum file size to still qualify for in-line embedding as a data-URI
*
@ -37,9 +37,9 @@ class CSSMin {
*/
const EMBED_SIZE_LIMIT = 24576;
const URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\'"]*)(?P<query>\??[^\)\'"]*)[\'"]?\s*\)';
/* Protected Static Members */
/** @var array List of common image files extensions and mime-types */
protected static $mimeTypes = array(
'gif' => 'image/gif',
@ -51,9 +51,9 @@ class CSSMin {
'tiff' => 'image/tiff',
'xbm' => 'image/x-xbitmap',
);
/* Static Methods */
/**
* Gets a list of local file paths which are referenced in a CSS style sheet
*
@ -78,7 +78,7 @@ class CSSMin {
}
return $files;
}
protected static function getMimeType( $file ) {
$realpath = realpath( $file );
// Try a couple of different ways to get the mime-type of a file, in order of
@ -92,7 +92,7 @@ class CSSMin {
// As of PHP 5.3, this is how you get the mime-type of a file; it uses the Fileinfo
// PECL extension
return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath );
} else if ( function_exists( 'mime_content_type' ) ) {
} elseif ( function_exists( 'mime_content_type' ) ) {
// Before this was deprecated in PHP 5.3, this was how you got the mime-type of a file
return mime_content_type( $file );
} else {
@ -104,7 +104,7 @@ class CSSMin {
}
return false;
}
/**
* Remaps CSS URL paths and automatically embeds data URIs for URL rules
* preceded by an /* @embed * / comment
@ -175,9 +175,9 @@ class CSSMin {
}
if ( $replacement === false ) {
// Assume that all paths are relative to $remote, and make them absolute
$replacement = "{$embed}{$pre}url({$url}){$post};";
$replacement = "{$embed}{$pre}url({$url}){$post};";
}
} else if ( $local === false ) {
} elseif ( $local === false ) {
// Assume that all paths are relative to $remote, and make them absolute
$replacement = "{$embed}{$pre}url({$url}{$query}){$post};";
}

View file

@ -5,7 +5,7 @@
* @file
* @ingroup Media
*/
/**
* Handler for DjVu images
*
@ -207,11 +207,11 @@ class DjVuHandler extends ImageHandler {
$image->djvuTextTree = false;
$tree = new SimpleXMLElement( $metadata );
if( $tree->getName() == 'mw-djvu' ) {
foreach($tree->children() as $b){
foreach($tree->children() as $b){
if( $b->getName() == 'DjVuTxt' ) {
$image->djvuTextTree = $b;
}
else if ( $b->getName() == 'DjVuXML' ) {
elseif ( $b->getName() == 'DjVuXML' ) {
$image->dejaMetaTree = $b;
}
}