From 16842c0b7378cbf8f5a5c97b42dca3bce4f09e21 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 17 Jun 2011 16:05:05 +0000 Subject: [PATCH] Swap else if for elseif Trimming trailing whitespace also Doing in 3 commits (2/3), so hopefully reviewable in CR... --- includes/Metadata.php | 4 +- includes/ProxyTools.php | 2 +- includes/RawPage.php | 2 +- includes/Skin.php | 10 +- includes/media/XMP.php | 20 +-- includes/normal/UtfNormalTest2.php | 6 +- includes/parser/Parser.php | 18 +-- includes/resourceloader/ResourceLoader.php | 126 +++++++++--------- .../ResourceLoaderFileModule.php | 94 ++++++------- .../ResourceLoaderStartUpModule.php | 32 ++--- includes/revisiondelete/RevisionDelete.php | 2 +- .../RevisionDeleteAbstracts.php | 2 +- includes/revisiondelete/RevisionDeleter.php | 54 ++++---- includes/search/SearchEngine.php | 28 ++-- includes/search/SearchPostgres.php | 4 +- includes/specials/SpecialAllmessages.php | 2 +- includes/specials/SpecialAllpages.php | 2 +- includes/specials/SpecialContributions.php | 12 +- .../specials/SpecialDeletedContributions.php | 2 +- includes/specials/SpecialExport.php | 4 +- includes/specials/SpecialListgrouprights.php | 8 +- includes/specials/SpecialListusers.php | 2 +- includes/specials/SpecialLockdb.php | 2 +- includes/specials/SpecialProtectedpages.php | 2 +- .../specials/SpecialRecentchangeslinked.php | 2 +- 25 files changed, 221 insertions(+), 221 deletions(-) diff --git a/includes/Metadata.php b/includes/Metadata.php index 62d10430b8..3e5beadc6d 100644 --- a/includes/Metadata.php +++ b/includes/Metadata.php @@ -138,9 +138,9 @@ abstract class RdfMetaData { if( $wgRightsPage && ( $nt = Title::newFromText( $wgRightsPage ) ) && ($nt->getArticleID() != 0)) { $this->page('rights', $nt); - } else if( $wgRightsUrl ){ + } elseif( $wgRightsUrl ){ $this->url('rights', $wgRightsUrl); - } else if( $wgRightsText ){ + } elseif( $wgRightsText ){ $this->element( 'rights', $wgRightsText ); } } diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index 17c203db80..76b92bffd7 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -31,7 +31,7 @@ function wfGetForwardedFor() { #Try a couple of headers if( isset( $set[$index] ) ) { return $set[$index]; - } else if( isset( $set[$index2] ) ) { + } elseif( isset( $set[$index2] ) ) { return $set[$index2]; } else { return null; diff --git a/includes/RawPage.php b/includes/RawPage.php index c6c4a66f7f..f37ef99577 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -160,7 +160,7 @@ class RawPage { $sk->initPage( $wgOut ); if( $this->mGen == 'css' ) { return $sk->generateUserStylesheet(); - } else if( $this->mGen == 'js' ) { + } elseif( $this->mGen == 'js' ) { return $sk->generateUserJs(); } } else { diff --git a/includes/Skin.php b/includes/Skin.php index 045aacd34c..64bfa95600 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -110,7 +110,7 @@ abstract class Skin { if ( isset( $skinNames[$key] ) ) { return $key; - } else if ( isset( $skinNames[$wgDefaultSkin] ) ) { + } elseif ( isset( $skinNames[$wgDefaultSkin] ) ) { return $wgDefaultSkin; } else { return 'vector'; @@ -184,7 +184,7 @@ abstract class Skin { */ function preloadExistence() { $user = $this->getContext()->getUser(); - + // User/talk link $titles = array( $user->getUserPage(), $user->getTalkPage() ); @@ -340,7 +340,7 @@ abstract class Skin { ); } else { return ''; - } + } } /** @@ -923,7 +923,7 @@ abstract class Skin { $url = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" ); $text = 'Powered by MediaWiki'; - wfRunHooks( 'SkinGetPoweredBy', array( &$text, $this ) ); + wfRunHooks( 'SkinGetPoweredBy', array( &$text, $this ) ); return $text; } @@ -1290,7 +1290,7 @@ abstract class Skin { 'id' => 'n-' . strtr( $line[1], ' ', '-' ), 'active' => false ); - } else if ( ( substr( $line, 0, 2 ) == '{{' ) && ( substr( $line, -2 ) == '}}' ) ) { + } elseif ( ( substr( $line, 0, 2 ) == '{{' ) && ( substr( $line, -2 ) == '}}' ) ) { global $wgParser; $line = substr( $line, 2, strlen( $line ) - 4 ); diff --git a/includes/media/XMP.php b/includes/media/XMP.php index b950647aab..1e578582a2 100644 --- a/includes/media/XMP.php +++ b/includes/media/XMP.php @@ -145,7 +145,7 @@ class XMPReader { // only apply to the dc:Creator prop, not the // exif:Artist prop. - $data['xmp-general']['Artist'][0] = + $data['xmp-general']['Artist'][0] = $data['xmp-special']['AuthorsPosition'] . ', ' . $data['xmp-general']['Artist'][0]; } @@ -226,7 +226,7 @@ class XMPReader { if ( !$this->charset ) { $bom = array(); if ( preg_match( '/\xEF\xBB\xBF|\xFE\xFF|\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\xFF\xFE/', - $content, $bom ) + $content, $bom ) ) { switch ( $bom[0] ) { case "\xFE\xFF": @@ -407,7 +407,7 @@ class XMPReader { * property value, and now have to save the result to the * results array * - * For example, when processing: + * For example, when processing: * 0/10 * this deals with when we hit . * @@ -571,7 +571,7 @@ class XMPReader { * * generally just calls a helper function depending on what * mode we're in. - * + * * Ignores the outer wrapping elements that are optional in * xmp and have no meaning. * @@ -692,7 +692,7 @@ class XMPReader { private function startElementModeSeq( $elm ) { if ( $elm === self::NS_RDF . ' Seq' ) { array_unshift( $this->mode, self::MODE_LI ); - } else if ( $elm === self::NS_RDF . ' Bag' ) { + } elseif ( $elm === self::NS_RDF . ' Bag' ) { # bug 27105 wfDebugLog( 'XMP', __METHOD__ . ' Expected an rdf:Seq, but got an rdf:Bag. Pretending' . ' it is a Seq, since some buggy software is known to screw this up.' ); @@ -854,9 +854,9 @@ class XMPReader { * 1 * * or: - * + * * True - * 1 + * 1 * * @param $ns String namespace * @param $tag String tag name (no ns) @@ -906,7 +906,7 @@ class XMPReader { * This method is called when we hit the element. * * @param $elm String: namespace . ' ' . tagname - * @param $attribs Array: Attributes. (needed for BAGSTRUCTS) + * @param $attribs Array: Attributes. (needed for BAGSTRUCTS) * @throws MWException if gets a tag other than */ private function startElementModeLi( $elm, $attribs ) { @@ -994,7 +994,7 @@ class XMPReader { function startElement( $parser, $elm, $attribs ) { if ( $elm === self::NS_RDF . ' RDF' - || $elm === 'adobe:ns:meta/ xmpmeta' + || $elm === 'adobe:ns:meta/ xmpmeta' || $elm === 'adobe:ns:meta/ xapmeta') { /* ignore. */ @@ -1080,7 +1080,7 @@ class XMPReader { * @param $attribs Array attribute=>value array. */ private function doAttribs( $attribs ) { - + // first check for rdf:parseType attribute, as that can change // how the attributes are interperted. diff --git a/includes/normal/UtfNormalTest2.php b/includes/normal/UtfNormalTest2.php index fafd5475f6..28be483858 100644 --- a/includes/normal/UtfNormalTest2.php +++ b/includes/normal/UtfNormalTest2.php @@ -194,12 +194,12 @@ echo "done.\n"; function unichr($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); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 94a6de59fb..e462ccdf67 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -841,11 +841,11 @@ class Parser { if ( $attributes !== '' ) { $table['attributes'] = $attributes; } - } else if ( !isset( $tables[0] ) ) { + } elseif ( !isset( $tables[0] ) ) { // we're outside the table $out .= $outLine . "\n"; - } else if ( $firstChars === '|}' ) { + } elseif ( $firstChars === '|}' ) { // trim the |} code from the line $line = substr ( $line , 2 ); @@ -886,7 +886,7 @@ class Parser { $output .= $o; - } else if ( $firstChars === '|-' ) { + } elseif ( $firstChars === '|-' ) { // start a new row element // but only when we haven't started one already if ( count( $currentRow ) != 0 ) { @@ -901,7 +901,7 @@ class Parser { $currentRow['attributes'] = $attributes; } - } else if ( $firstChars === '|+' ) { + } elseif ( $firstChars === '|+' ) { // a table caption, but only proceed if there isn't one already if ( !isset ( $table['caption'] ) ) { $line = substr ( $line , 2 ); @@ -913,7 +913,7 @@ class Parser { unset( $c ); $output =& $table['caption']['content']; } - } else if ( $firstChars === '|' || $firstChars === '!' || $firstChars === '!+' ) { + } elseif ( $firstChars === '|' || $firstChars === '!' || $firstChars === '!+' ) { // Which kind of cells are we dealing with $currentTag = 'td'; $line = substr ( $line , 1 ); @@ -930,7 +930,7 @@ class Parser { // decide whether thead to tbody if ( !array_key_exists( 'type', $currentRow ) ) { $currentRow['type'] = ( $firstChars === '!' ) ? 'thead' : 'tbody' ; - } else if ( $firstChars === '|' ) { + } elseif ( $firstChars === '|' ) { $currentRow['type'] = 'tbody'; } @@ -1000,7 +1000,7 @@ class Parser { if ( strpos( $cellData[0], '[[' ) !== false ) { $content = trim ( $cell ); } - else if ( count ( $cellData ) == 1 ) { + elseif ( count ( $cellData ) == 1 ) { $content = trim ( $cellData[0] ); } else { $attributes = $this->mStripState->unstripBoth( $cellData[0] ); @@ -1042,7 +1042,7 @@ class Parser { if ( !isset( $table[$i]['type'] ) ) $table[$i]['type'] = 'tbody'; if ( !$lastSection ) { $lastSection = $table[$i]['type']; - } else if ( $lastSection != $table[$i]['type'] ) { + } elseif ( $lastSection != $table[$i]['type'] ) { $simple = false; break; } @@ -3086,7 +3086,7 @@ class Parser { $args = ( null == $piece['parts'] ) ? array() : $piece['parts']; wfProfileOut( __METHOD__.'-setup' ); wfProfileIn( __METHOD__."-title-$originalTitle" ); - + # SUBST wfProfileIn( __METHOD__.'-modifiers' ); if ( !$found ) { diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 838bdab067..2f513b770d 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -40,15 +40,15 @@ class ResourceLoader { /** * Loads information stored in the database about modules. - * - * This method grabs modules dependencies from the database and updates modules + * + * This method grabs modules dependencies from the database and updates modules * objects. - * - * This is not inside the module code because it is much faster to - * request all of the information at once than it is to have each module + * + * This is not inside the module code because it is much faster to + * request all of the information at once than it is to have each module * requests its own information. This sacrifice of modularity yields a substantial * performance improvement. - * + * * @param $modules Array: List of module names to preload information for * @param $context ResourceLoaderContext: Context to load the information within */ @@ -59,7 +59,7 @@ class ResourceLoader { $dbr = wfGetDB( DB_SLAVE ); $skin = $context->getSkin(); $lang = $context->getLanguage(); - + // Get file dependency information $res = $dbr->select( 'module_deps', array( 'md_module', 'md_deps' ), array( 'md_module' => $modules, @@ -80,7 +80,7 @@ class ResourceLoader { foreach ( array_diff( $modules, $modulesWithDeps ) as $name ) { $this->getModule( $name )->setFileDependencies( $skin, array() ); } - + // Get message blob mtimes. Only do this for modules with messages $modulesWithMessages = array(); foreach ( $modules as $name ) { @@ -96,11 +96,11 @@ class ResourceLoader { ), __METHOD__ ); foreach ( $res as $row ) { - $this->getModule( $row->mr_resource )->setMsgBlobMtime( $lang, + $this->getModule( $row->mr_resource )->setMsgBlobMtime( $lang, wfTimestamp( TS_UNIX, $row->mr_timestamp ) ); unset( $modulesWithoutMessages[$row->mr_resource] ); } - } + } foreach ( array_keys( $modulesWithoutMessages ) as $name ) { $this->getModule( $name )->setMsgBlobMtime( $lang, 0 ); } @@ -108,14 +108,14 @@ class ResourceLoader { /** * Runs JavaScript or CSS data through a filter, caching the filtered result for future calls. - * + * * Available filters are: * - minify-js \see JavaScriptMinifier::minify * - minify-css \see CSSMin::minify - * - * If $data is empty, only contains whitespace or the filter was unknown, + * + * If $data is empty, only contains whitespace or the filter was unknown, * $data is returned unmodified. - * + * * @param $filter String: Name of filter to run * @param $data String: Text to filter, such as JavaScript or CSS text * @return String: Filtered data, or a comment containing an error message @@ -124,10 +124,10 @@ class ResourceLoader { global $wgResourceLoaderMinifierStatementsOnOwnLine, $wgResourceLoaderMinifierMaxLineLength; wfProfileIn( __METHOD__ ); - // For empty/whitespace-only data or for unknown filters, don't perform + // For empty/whitespace-only data or for unknown filters, don't perform // any caching or processing - if ( trim( $data ) === '' - || !in_array( $filter, array( 'minify-js', 'minify-css' ) ) ) + if ( trim( $data ) === '' + || !in_array( $filter, array( 'minify-js', 'minify-css' ) ) ) { wfProfileOut( __METHOD__ ); return $data; @@ -168,7 +168,7 @@ class ResourceLoader { } wfProfileOut( __METHOD__ ); - + return $result; } @@ -179,24 +179,24 @@ class ResourceLoader { */ public function __construct() { global $IP, $wgResourceModules; - + wfProfileIn( __METHOD__ ); - + // Register core modules $this->register( include( "$IP/resources/Resources.php" ) ); // Register extension modules wfRunHooks( 'ResourceLoaderRegisterModules', array( &$this ) ); $this->register( $wgResourceModules ); - + wfProfileOut( __METHOD__ ); } /** * Registers a module with the ResourceLoader system. - * + * * @param $name Mixed: Name of module as a string or List of name/object pairs as an array - * @param $info Module info array. For backwards compatibility with 1.17alpha, - * this may also be a ResourceLoaderModule object. Optional when using + * @param $info Module info array. For backwards compatibility with 1.17alpha, + * this may also be a ResourceLoaderModule object. Optional when using * multiple-registration calling style. * @throws MWException: If a duplicate module registration is attempted * @throws MWException: If a module name contains illegal characters (pipes or commas) @@ -220,11 +220,11 @@ class ResourceLoader { if ( isset( $this->moduleInfos[$name] ) ) { // A module has already been registered by this name throw new MWException( - 'ResourceLoader duplicate registration error. ' . + 'ResourceLoader duplicate registration error. ' . 'Another module has already been registered as ' . $name ); } - + // Check $name for illegal characters if ( preg_match( '/[|,!]/', $name ) ) { throw new MWException( "ResourceLoader module name '$name' is invalid. Names may not contain pipes (|), commas (,) or exclamation marks (!)" ); @@ -235,7 +235,7 @@ class ResourceLoader { // Old calling convention // Validate the input if ( !( $info instanceof ResourceLoaderModule ) ) { - throw new MWException( 'ResourceLoader invalid module error. ' . + throw new MWException( 'ResourceLoader invalid module error. ' . 'Instances of ResourceLoaderModule expected.' ); } @@ -298,7 +298,7 @@ class ResourceLoader { */ public function respond( ResourceLoaderContext $context ) { global $wgResourceLoaderMaxage, $wgCacheEpoch; - + // Buffer output to catch warnings. Normally we'd use ob_clean() on the // top-level output buffer to clear warnings, but that breaks when ob_gzhandler // is used: ob_clean() will clear the GZIP header in that case and it won't come @@ -322,13 +322,13 @@ class ResourceLoader { } } - // If a version wasn't specified we need a shorter expiry time for updates + // If a version wasn't specified we need a shorter expiry time for updates // to propagate to clients quickly if ( is_null( $context->getVersion() ) ) { $maxage = $wgResourceLoaderMaxage['unversioned']['client']; $smaxage = $wgResourceLoaderMaxage['unversioned']['server']; } - // If a version was specified we can use a longer expiry time since changing + // If a version was specified we can use a longer expiry time since changing // version numbers causes cache misses else { $maxage = $wgResourceLoaderMaxage['versioned']['client']; @@ -346,7 +346,7 @@ class ResourceLoader { wfProfileIn( __METHOD__.'-getModifiedTime' ); $private = false; - // To send Last-Modified and support If-Modified-Since, we need to detect + // To send Last-Modified and support If-Modified-Since, we need to detect // the last modified time $mtime = wfTimestamp( TS_UNIX, $wgCacheEpoch ); foreach ( $modules as $module ) { @@ -410,17 +410,17 @@ class ResourceLoader { for ( $i = 0; $i < ob_get_level(); $i++ ) { ob_end_clean(); } - + header( 'HTTP/1.0 304 Not Modified' ); header( 'Status: 304 Not Modified' ); wfProfileOut( __METHOD__ ); return; } } - + // Generate a response $response = $this->makeModuleResponse( $context, $modules, $missing ); - + // Prepend comments indicating exceptions $response = $exceptions . $response; @@ -439,21 +439,21 @@ class ResourceLoader { /** * Generates code for a response - * + * * @param $context ResourceLoaderContext: Context in which to generate a response * @param $modules Array: List of module objects keyed by module name * @param $missing Array: List of unavailable modules (optional) * @return String: Response data */ - public function makeModuleResponse( ResourceLoaderContext $context, - array $modules, $missing = array() ) + public function makeModuleResponse( ResourceLoaderContext $context, + array $modules, $missing = array() ) { $out = ''; $exceptions = ''; if ( $modules === array() && $missing === array() ) { return '/* No modules requested. Max made me put this here */'; } - + wfProfileIn( __METHOD__ ); // Pre-fetch blobs if ( $context->shouldIncludeMessages() ) { @@ -494,7 +494,7 @@ class ResourceLoader { case 'scripts': if ( is_string( $scripts ) ) { $out .= $scripts; - } else if ( is_array( $scripts ) ) { + } elseif ( is_array( $scripts ) ) { $out .= self::makeLoaderImplementScript( $name, $scripts, array(), array() ); } break; @@ -532,10 +532,10 @@ class ResourceLoader { // Update module states if ( $context->shouldIncludeScripts() ) { // Set the state of modules loaded as only scripts to ready - if ( count( $modules ) && $context->getOnly() === 'scripts' - && !isset( $modules['startup'] ) ) + if ( count( $modules ) && $context->getOnly() === 'scripts' + && !isset( $modules['startup'] ) ) { - $out .= self::makeLoaderStateScript( + $out .= self::makeLoaderStateScript( array_fill_keys( array_keys( $modules ), 'ready' ) ); } // Set the state of modules which were requested but unavailable as missing @@ -551,7 +551,7 @@ class ResourceLoader { $out = $this->filter( 'minify-js', $out ); } } - + wfProfileOut( __METHOD__ ); return $exceptions . $out; } @@ -559,14 +559,14 @@ class ResourceLoader { /* Static Methods */ /** - * Returns JS code to call to mw.loader.implement for a module with + * Returns JS code to call to mw.loader.implement for a module with * given properties. * * @param $name Module name * @param $scripts Mixed: List of URLs to JavaScript files or String of JavaScript code * @param $styles Mixed: List of CSS strings keyed by media type, or list of lists of URLs to * CSS files keyed by media type - * @param $messages Mixed: List of messages associated with this module. May either be an + * @param $messages Mixed: List of messages associated with this module. May either be an * associative array mapping message key to value, or a JSON-encoded message blob containing * the same data, wrapped in an XmlJsCode object. * @@ -575,11 +575,11 @@ class ResourceLoader { public static function makeLoaderImplementScript( $name, $scripts, $styles, $messages ) { if ( is_string( $scripts ) ) { $scripts = new XmlJsCode( "function( $ ) {{$scripts}}" ); - } else if ( !is_array( $scripts ) ) { + } elseif ( !is_array( $scripts ) ) { throw new MWException( 'Invalid scripts error. Array of URLs or string of code expected.' ); } - return Xml::encodeJsCall( - 'mw.loader.implement', + return Xml::encodeJsCall( + 'mw.loader.implement', array( $name, $scripts, @@ -601,7 +601,7 @@ class ResourceLoader { } /** - * Combines an associative array mapping media type to CSS into a + * Combines an associative array mapping media type to CSS into a * single stylesheet with @media blocks. * * @param $styles Array: List of CSS strings keyed by media type @@ -614,10 +614,10 @@ class ResourceLoader { // Transform the media type based on request params and config // The way that this relies on $wgRequest to propagate request params is slightly evil $media = OutputPage::transformCssMedia( $media ); - + if ( $media === null ) { // Skip - } else if ( $media === '' || $media == 'all' ) { + } elseif ( $media === '' || $media == 'all' ) { // Don't output invalid or frivolous @media statements $out .= "$style\n"; } else { @@ -628,7 +628,7 @@ class ResourceLoader { } /** - * Returns a JS call to mw.loader.state, which sets the state of a + * Returns a JS call to mw.loader.state, which sets the state of a * module or modules to a given value. Has two calling conventions: * * - ResourceLoader::makeLoaderStateScript( $name, $state ): @@ -652,9 +652,9 @@ class ResourceLoader { /** * Returns JS code which calls the script given by $script. The script will - * be called with local variables name, version, dependencies and group, - * which will have values corresponding to $name, $version, $dependencies - * and $group as supplied. + * be called with local variables name, version, dependencies and group, + * which will have values corresponding to $name, $version, $dependencies + * and $group as supplied. * * @param $name String: Module name * @param $version Integer: Module version number as a timestamp @@ -666,13 +666,13 @@ class ResourceLoader { */ public static function makeCustomLoaderScript( $name, $version, $dependencies, $group, $script ) { $script = str_replace( "\n", "\n\t", trim( $script ) ); - return Xml::encodeJsCall( + return Xml::encodeJsCall( "( function( name, version, dependencies, group ) {\n\t$script\n} )", array( $name, $version, $dependencies, $group ) ); } /** - * Returns JS code which calls mw.loader.register with the given + * Returns JS code which calls mw.loader.register with the given * parameters. Has three calling conventions: * * - ResourceLoader::makeLoaderRegisterScript( $name, $version, $dependencies, $group ): @@ -695,20 +695,20 @@ class ResourceLoader { * * @return string */ - public static function makeLoaderRegisterScript( $name, $version = null, - $dependencies = null, $group = null ) + public static function makeLoaderRegisterScript( $name, $version = null, + $dependencies = null, $group = null ) { if ( is_array( $name ) ) { return Xml::encodeJsCall( 'mw.loader.register', array( $name ) ); } else { $version = (int) $version > 1 ? (int) $version : 1; - return Xml::encodeJsCall( 'mw.loader.register', + return Xml::encodeJsCall( 'mw.loader.register', array( $name, $version, $dependencies, $group ) ); } } /** - * Returns JS code which runs given JS code if the client-side framework is + * Returns JS code which runs given JS code if the client-side framework is * present. * * @param $script String: JavaScript code @@ -721,7 +721,7 @@ class ResourceLoader { } /** - * Returns JS code which will set the MediaWiki configuration array to + * Returns JS code which will set the MediaWiki configuration array to * the given value. * * @param $configuration Array: List of configuration values keyed by variable name @@ -734,7 +734,7 @@ class ResourceLoader { /** * Convert an array of module names to a packed query string. - * + * * For example, array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' ) * becomes 'foo.bar,baz|bar.baz,quux' * @param $modules array of module names (strings) diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index f7b959c050..ec9c3f8bd0 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -97,7 +97,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Constructs a new module from an options array. - * + * * @param $options Array: List of options; if not given or empty, an empty module will be * constructed * @param $localBasePath String: Base path to prepend to all local paths in $options. Defaults @@ -105,7 +105,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * @param $remoteBasePath String: Base path to prepend to all remote paths in $options. Defaults * to $wgScriptPath * - * Below is a description for the $options array: + * Below is a description for the $options array: * @code * array( * // Base path to prepend to all local paths in $options. Defaults to $IP @@ -145,8 +145,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * ) * @endcode */ - public function __construct( $options = array(), $localBasePath = null, - $remoteBasePath = null ) + public function __construct( $options = array(), $localBasePath = null, + $remoteBasePath = null ) { global $IP, $wgScriptPath; $this->localBasePath = $localBasePath === null ? $IP : $localBasePath; @@ -172,14 +172,14 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { case 'skinStyles': if ( !is_array( $option ) ) { throw new MWException( - "Invalid collated file path list error. " . + "Invalid collated file path list error. " . "'$option' given, array expected." ); } foreach ( $option as $key => $value ) { if ( !is_string( $key ) ) { throw new MWException( - "Invalid collated file path list key error. " . + "Invalid collated file path list key error. " . "'$key' given, string expected." ); } @@ -210,7 +210,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets all scripts for a given context concatenated together. - * + * * @param $context ResourceLoaderContext: Context in which to generate script * @return String: JavaScript code for $context */ @@ -228,7 +228,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets loader script. - * + * * @return String: JavaScript code to be added to startup module */ public function getLoaderScript() { @@ -240,7 +240,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets all styles for a given context concatenated together. - * + * * @param $context ResourceLoaderContext: Context in which to generate styles * @return String: CSS code for $context */ @@ -277,7 +277,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets list of message keys used by this module. - * + * * @return Array: List of message keys */ public function getMessages() { @@ -286,7 +286,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets the name of the group this module should be loaded in. - * + * * @return String: Group name */ public function getGroup() { @@ -302,7 +302,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets list of names of modules this module depends on. - * + * * @return Array: List of module names */ public function getDependencies() { @@ -311,14 +311,14 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Get the last modified timestamp of this module. - * - * Last modified timestamps are calculated from the highest last modified - * timestamp of this module's constituent files as well as the files it - * depends on. This function is context-sensitive, only performing - * calculations on files relevant to the given language, skin and debug + * + * Last modified timestamps are calculated from the highest last modified + * timestamp of this module's constituent files as well as the files it + * depends on. This function is context-sensitive, only performing + * calculations on files relevant to the given language, skin and debug * mode. - * - * @param $context ResourceLoaderContext: Context in which to calculate + * + * @param $context ResourceLoaderContext: Context in which to calculate * the modified time * @return Integer: UNIX timestamp * @see ResourceLoaderModule::getFileDependencies @@ -328,23 +328,23 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { return $this->modifiedTime[$context->getHash()]; } wfProfileIn( __METHOD__ ); - + $files = array(); - + // Flatten style files into $files $styles = self::collateFilePathListByOption( $this->styles, 'media', 'all' ); foreach ( $styles as $styleFiles ) { $files = array_merge( $files, $styleFiles ); } $skinFiles = self::tryForKey( - self::collateFilePathListByOption( $this->skinStyles, 'media', 'all' ), - $context->getSkin(), + self::collateFilePathListByOption( $this->skinStyles, 'media', 'all' ), + $context->getSkin(), 'default' ); foreach ( $skinFiles as $styleFiles ) { $files = array_merge( $files, $styleFiles ); } - + // Final merge, this should result in a master list of dependent files $files = array_merge( $files, @@ -357,19 +357,19 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $files = array_map( array( $this, 'getLocalPath' ), $files ); // File deps need to be treated separately because they're already prefixed $files = array_merge( $files, $this->getFileDependencies( $context->getSkin() ) ); - - // If a module is nothing but a list of dependencies, we need to avoid + + // If a module is nothing but a list of dependencies, we need to avoid // giving max() an empty array if ( count( $files ) === 0 ) { wfProfileOut( __METHOD__ ); return $this->modifiedTime[$context->getHash()] = 1; } - + wfProfileIn( __METHOD__.'-filemtime' ); $filesMtime = max( array_map( 'filemtime', $files ) ); wfProfileOut( __METHOD__.'-filemtime' ); - $this->modifiedTime[$context->getHash()] = max( - $filesMtime, + $this->modifiedTime[$context->getHash()] = max( + $filesMtime, $this->getMsgBlobMtime( $context->getLanguage() ) ); wfProfileOut( __METHOD__ ); @@ -396,8 +396,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Collates file paths by option (where provided). - * - * @param $list Array: List of file paths in any combination of index/path + * + * @param $list Array: List of file paths in any combination of index/path * or path/options pairs * @param $option String: option name * @param $default Mixed: default value if the option isn't set @@ -412,7 +412,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $collatedFiles[$default] = array(); } $collatedFiles[$default][] = $value; - } else if ( is_array( $value ) ) { + } elseif ( is_array( $value ) ) { // File name as the key, options array as the value $optionValue = isset( $value[$option] ) ? $value[$option] : $default; if ( !isset( $collatedFiles[$optionValue] ) ) { @@ -426,19 +426,19 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets a list of element that match a key, optionally using a fallback key. - * + * * @param $list Array: List of lists to select from * @param $key String: Key to look for in $map * @param $fallback String: Key to look for in $list if $key doesn't exist - * @return Array: List of elements from $map which matched $key or $fallback, + * @return Array: List of elements from $map which matched $key or $fallback, * or an empty list in case of no match */ protected static function tryForKey( array $list, $key, $fallback = null ) { if ( isset( $list[$key] ) && is_array( $list[$key] ) ) { return $list[$key]; - } else if ( is_string( $fallback ) - && isset( $list[$fallback] ) - && is_array( $list[$fallback] ) ) + } elseif ( is_string( $fallback ) + && isset( $list[$fallback] ) + && is_array( $list[$fallback] ) ) { return $list[$fallback]; } @@ -447,7 +447,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets a list of file paths for all scripts in this module, in order of propper execution. - * + * * @param $context ResourceLoaderContext: Context * @return Array: List of file paths */ @@ -465,7 +465,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets a list of file paths for all styles in this module, in order of propper inclusion. - * + * * @param $context ResourceLoaderContext: Context * @return Array: List of file paths */ @@ -480,7 +480,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets the contents of a list of JavaScript files. - * + * * @param $scripts Array: List of file paths to scripts to read, remap and concetenate * @return String: Concatenated and remapped JavaScript data from $scripts */ @@ -502,13 +502,13 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Gets the contents of a list of CSS files. - * + * * @param $styles Array: List of media type/list of file paths pairs, to read, remap and * concetenate * * @param $flip bool * - * @return Array: List of concatenated and remapped CSS data from $styles, + * @return Array: List of concatenated and remapped CSS data from $styles, * keyed by media type */ protected function readStyleFiles( array $styles, $flip ) { @@ -531,15 +531,15 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { /** * Reads a style file. - * + * * This method can be used as a callback for array_map() - * + * * @param $path String: File path of script file to read * @param $flip bool * * @return String: CSS data in script file */ - protected function readStyleFile( $path, $flip ) { + protected function readStyleFile( $path, $flip ) { $localPath = $this->getLocalPath( $path ); $style = file_get_contents( $localPath ); if ( $style === false ) { @@ -556,8 +556,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $dir = $this->getLocalPath( $dirname ); $remoteDir = $this->getRemotePath( $dirname ); // Get and register local file references - $this->localFileRefs = array_merge( - $this->localFileRefs, + $this->localFileRefs = array_merge( + $this->localFileRefs, CSSMin::getLocalFileReferences( $style, $dir ) ); return CSSMin::remap( $style, $dir, $remoteDir, true diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index 8ce592e01c..870b4ec232 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -21,7 +21,7 @@ */ class ResourceLoaderStartUpModule extends ResourceLoaderModule { - + /* Protected Members */ protected $modifiedTime = array(); @@ -35,7 +35,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { protected function getConfig( $context ) { global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension, $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, - $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion, + $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion, $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest, $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgCookiePrefix, $wgResourceLoaderMaxQueryLength, $wgLegacyJavaScriptGlobals; @@ -118,12 +118,12 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { if ( $wgUseAjax && $wgEnableMWSuggest ) { $vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate(); } - + wfRunHooks( 'ResourceLoaderGetConfigVars', array( &$vars ) ); - + return $vars; } - + /** * Gets registration code for all modules * @@ -133,7 +133,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { public static function getModuleRegistrations( ResourceLoaderContext $context ) { global $wgCacheEpoch; wfProfileIn( __METHOD__ ); - + $out = ''; $registrations = array(); $resourceLoader = $context->getResourceLoader(); @@ -144,7 +144,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { if ( $loader !== false ) { $deps = $module->getDependencies(); $group = $module->getGroup(); - $version = wfTimestamp( TS_ISO_8601_BASIC, + $version = wfTimestamp( TS_ISO_8601_BASIC, $module->getModifiedTime( $context ) ); $out .= ResourceLoader::makeCustomLoaderScript( $name, $version, $deps, $group, $loader ); } @@ -154,18 +154,18 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { // seem to do that, and custom implementations might forget. Coerce it to TS_UNIX $moduleMtime = wfTimestamp( TS_UNIX, $module->getModifiedTime( $context ) ); $mtime = max( $moduleMtime, wfTimestamp( TS_UNIX, $wgCacheEpoch ) ); - // Modules without dependencies or a group pass two arguments (name, timestamp) to + // Modules without dependencies or a group pass two arguments (name, timestamp) to // mw.loader.register() if ( !count( $module->getDependencies() && $module->getGroup() === null ) ) { $registrations[] = array( $name, $mtime ); } - // Modules with dependencies but no group pass three arguments + // Modules with dependencies but no group pass three arguments // (name, timestamp, dependencies) to mw.loader.register() - else if ( $module->getGroup() === null ) { + elseif ( $module->getGroup() === null ) { $registrations[] = array( $name, $mtime, $module->getDependencies() ); } - // Modules with dependencies pass four arguments (name, timestamp, dependencies, group) + // Modules with dependencies pass four arguments (name, timestamp, dependencies, group) // to mw.loader.register() else { $registrations[] = array( @@ -174,7 +174,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { } } $out .= ResourceLoader::makeLoaderRegisterScript( $registrations ); - + wfProfileOut( __METHOD__ ); return $out; } @@ -194,15 +194,15 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { // The core modules: $modules = array( 'jquery', 'mediawiki' ); wfRunHooks( 'ResourceLoaderGetStartupModules', array( &$modules ) ); - + // Get the latest version - $version = 0; + $version = 0; foreach ( $modules as $moduleName ) { $version = max( $version, $context->getResourceLoader()->getModule( $moduleName )->getModifiedTime( $context ) ); } - // Build load query for StartupModules + // Build load query for StartupModules $query = array( 'modules' => ResourceLoader::makePackedModulesString( $modules ), 'only' => 'scripts', @@ -253,7 +253,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { $this->modifiedTime[$hash] = filemtime( "$IP/resources/startup.js" ); // ATTENTION!: Because of the line above, this is not going to cause - // infinite recursion - think carefully before making changes to this + // infinite recursion - think carefully before making changes to this // code! $time = wfTimestamp( TS_UNIX, $wgCacheEpoch ); foreach ( $loader->getModuleNames() as $name ) { diff --git a/includes/revisiondelete/RevisionDelete.php b/includes/revisiondelete/RevisionDelete.php index c187b216fe..00c8ab27dc 100644 --- a/includes/revisiondelete/RevisionDelete.php +++ b/includes/revisiondelete/RevisionDelete.php @@ -48,7 +48,7 @@ class RevDel_RevisionList extends RevDel_List { if ( $archived->numRows() == 0 ) { return $live; - } else if ( $live->numRows() == 0 ) { + } elseif ( $live->numRows() == 0 ) { return $archived; } else { // Combine the two! Whee diff --git a/includes/revisiondelete/RevisionDeleteAbstracts.php b/includes/revisiondelete/RevisionDeleteAbstracts.php index adf63a95e3..72d8652b99 100644 --- a/includes/revisiondelete/RevisionDeleteAbstracts.php +++ b/includes/revisiondelete/RevisionDeleteAbstracts.php @@ -137,7 +137,7 @@ abstract class RevDel_List { $status->successCount++; if( $item->getAuthorId() > 0 ) { $authorIds[] = $item->getAuthorId(); - } else if( IP::isIPAddress( $item->getAuthorName() ) ) { + } elseif( IP::isIPAddress( $item->getAuthorName() ) ) { $authorIPs[] = $item->getAuthorName(); } } else { diff --git a/includes/revisiondelete/RevisionDeleter.php b/includes/revisiondelete/RevisionDeleter.php index ed57705651..2bd886ecaf 100644 --- a/includes/revisiondelete/RevisionDeleter.php +++ b/includes/revisiondelete/RevisionDeleter.php @@ -18,7 +18,7 @@ class RevisionDeleter { * enabled / disabled. * @param $field Integer: the bitmask describing the single option. * @param $diff Integer: the xor of the old and new bitfields. - * @param $new Integer: the new bitfield + * @param $new Integer: the new bitfield * @param $arr Array: the array to update. */ protected static function checkItem( $desc, $field, $diff, $new, &$arr ) { @@ -29,10 +29,10 @@ class RevisionDeleter { /** * Gets an array of message keys describing the changes made to the visibility - * of the revision. If the resulting array is $arr, then $arr[0] will contain an - * array of strings describing the items that were hidden, $arr[2] will contain - * an array of strings describing the items that were unhidden, and $arr[3] will - * contain an array with a single string, which can be one of "applied + * of the revision. If the resulting array is $arr, then $arr[0] will contain an + * array of strings describing the items that were hidden, $arr[2] will contain + * an array of strings describing the items that were unhidden, and $arr[3] will + * contain an array with a single string, which can be one of "applied * restrictions to sysops", "removed restrictions from sysops", or null. * * @param $n Integer: the new bitfield. @@ -72,31 +72,31 @@ class RevisionDeleter { */ public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false, $forContent = false ) { global $wgLang, $wgContLang; - + $lang = $forContent ? $wgContLang : $wgLang; $msgFunc = $forContent ? "wfMsgForContent" : "wfMsg"; - + $changes = self::getChanges( $nbitfield, $obitfield ); array_walk( $changes, array( __CLASS__, 'expandMessageArray' ), $forContent ); - + $changesText = array(); - + if( count( $changes[0] ) ) { $changesText[] = $msgFunc( 'revdelete-hid', $lang->commaList( $changes[0] ) ); } if( count( $changes[1] ) ) { $changesText[] = $msgFunc( 'revdelete-unhid', $lang->commaList( $changes[1] ) ); } - + $s = $lang->semicolonList( $changesText ); if( count( $changes[2] ) ) { $s .= $s ? ' (' . $changes[2][0] . ')' : ' ' . $changes[2][0]; } - + $msg = $isForLog ? 'logdelete-log-message' : 'revdelete-log-message'; return wfMsgExt( $msg, $forContent ? array( 'parsemag', 'content' ) : array( 'parsemag' ), $s, $lang->formatNum($count) ); } - + private static function expandMessageArray(& $msg, $key, $forContent) { if ( is_array ( $msg ) ) { array_walk( $msg, array( __CLASS__, 'expandMessageArray' ), $forContent ); @@ -108,7 +108,7 @@ class RevisionDeleter { } } } - + // Get DB field name for URL param... // Future code for other things may also track // other types of revision-specific changes. @@ -139,16 +139,16 @@ class RevisionDeleter { $dbr = wfGetDB( DB_SLAVE ); $exists = $dbr->selectField( 'revision', '1', array( 'rev_id' => $revid ), __METHOD__ ); - + if ( $exists ) { return true; } - + $timestamp = $dbr->selectField( 'archive', 'ar_timestamp', array( 'ar_namespace' => $title->getNamespace(), 'ar_title' => $title->getDBkey(), 'ar_rev_id' => $revid ), __METHOD__ ); - + return $timestamp; } @@ -163,7 +163,7 @@ class RevisionDeleter { */ public static function getLogLinks( $title, $paramArray, $skin, $messages ) { global $wgLang; - + if( count($paramArray) >= 2 ) { // Different revision types use different URL params... $originalKey = $key = $paramArray[0]; @@ -171,16 +171,16 @@ class RevisionDeleter { $Ids = explode( ',', $paramArray[1] ); $revert = array(); - + // For if undeleted revisions are found amidst deleted ones. $undeletedRevisions = array(); - + // This is not going to work if some revs are deleted and some // aren't. if ($key == 'revision') { // Nothing to do; deleted revisions can still be looked up by ID. } - + // Diff link for single rev deletions if( count($Ids) == 1 && !count($undeletedRevisions) ) { // Live revision diffs... @@ -196,10 +196,10 @@ class RevisionDeleter { array( 'known', 'noclasses' ) ); // Deleted revision diffs... - } else if( in_array( $key, array( 'artimestamp','archive' ) ) ) { + } elseif( in_array( $key, array( 'artimestamp','archive' ) ) ) { $revert[] = $skin->link( SpecialPage::getTitleFor( 'Undelete' ), - $messages['diff'], + $messages['diff'], array(), array( 'target' => $title->getPrefixedDBKey(), @@ -210,7 +210,7 @@ class RevisionDeleter { ); } } - + // View/modify link... if ( count( $undeletedRevisions ) ) { // @todo FIXME: THIS IS A HORRIBLE HORRIBLE HACK AND SHOULD DIE @@ -218,7 +218,7 @@ class RevisionDeleter { // undeleted revisions to SpecialRevisionDelete, so we're // stuck with two links. See bug 23363. $restoreLinks = array(); - + $restoreLinks[] = $skin->link( SpecialPage::getTitleFor( 'Revisiondelete' ), $messages['revdel-restore-visible'], @@ -230,7 +230,7 @@ class RevisionDeleter { ), array( 'known', 'noclasses' ) ); - + $restoreLinks[] = $skin->link( SpecialPage::getTitleFor( 'Revisiondelete' ), $messages['revdel-restore-deleted'], @@ -242,7 +242,7 @@ class RevisionDeleter { ), array( 'known', 'noclasses' ) ); - + $revert[] = $messages['revdel-restore'] . ' [' . $wgLang->pipeList( $restoreLinks ) . ']'; } else { @@ -258,7 +258,7 @@ class RevisionDeleter { array( 'known', 'noclasses' ) ); } - + // Pipe links return wfMsg( 'parentheses', $wgLang->pipeList( $revert ) ); } diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 2941d7d7d4..96d6de714d 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -132,11 +132,11 @@ class SearchEngine { wfRunHooks( 'SearchGetNearMatchComplete', array( $searchterm, &$title ) ); return $title; } - + /** - * Do a near match (see SearchEngine::getNearMatch) and wrap it into a + * Do a near match (see SearchEngine::getNearMatch) and wrap it into a * SearchResultSet. - * + * * @param $searchterm string * @return SearchResultSet */ @@ -300,7 +300,7 @@ class SearchEngine { if ( strncmp( $query, $allkeyword, strlen( $allkeyword ) ) == 0 ) { $this->namespaces = null; $parsed = substr( $query, strlen( $allkeyword ) ); - } else if ( strpos( $query, ':' ) !== false ) { + } elseif ( strpos( $query, ':' ) !== false ) { $prefix = substr( $query, 0, strpos( $query, ':' ) ); $index = $wgContLang->getNsIndex( $prefix ); if ( $index !== false ) { @@ -639,7 +639,7 @@ class SqlSearchResultSet extends SearchResultSet { $row = $this->mResultSet->fetchObject(); if ( $row === false ) return false; - + return SearchResult::newFromRow( $row ); } @@ -685,8 +685,8 @@ class SearchResult { /** * Return a new SearchResult and initializes it with a title. - * - * @param $title Title + * + * @param $title Title * @return SearchResult */ public static function newFromTitle( $title ) { @@ -696,7 +696,7 @@ class SearchResult { } /** * Return a new SearchResult and initializes it with a row. - * + * * @param $row object * @return SearchResult */ @@ -705,28 +705,28 @@ class SearchResult { $result->initFromRow( $row ); return $result; } - + public function __construct( $row = null ) { if ( !is_null( $row ) ) { // Backwards compatibility with pre-1.17 callers $this->initFromRow( $row ); } } - + /** * Initialize from a database row. Makes a Title and passes that to * initFromTitle. - * + * * @param $row object */ protected function initFromRow( $row ) { $this->initFromTitle( Title::makeTitle( $row->page_namespace, $row->page_title ) ); } - + /** * Initialize from a Title and if possible initializes a corresponding * Revision and File. - * + * * @param $title Title */ protected function initFromTitle( $title ) { @@ -843,7 +843,7 @@ class SearchResult { function getTimestamp() { if ( $this->mRevision ) return $this->mRevision->getTimestamp(); - else if ( $this->mImage ) + elseif ( $this->mImage ) return $this->mImage->getTimestamp(); return ''; } diff --git a/includes/search/SearchPostgres.php b/includes/search/SearchPostgres.php index 5fd7415c8b..62bc232316 100644 --- a/includes/search/SearchPostgres.php +++ b/includes/search/SearchPostgres.php @@ -99,10 +99,10 @@ class SearchPostgres extends SearchEngine { if (strtolower($terms[2]) === 'and') { $searchstring .= ' & '; } - else if (strtolower($terms[2]) === 'or' or $terms[2] === '|') { + elseif (strtolower($terms[2]) === 'or' or $terms[2] === '|') { $searchstring .= ' | '; } - else if (strtolower($terms[2]) === 'not') { + elseif (strtolower($terms[2]) === 'not') { $searchstring .= ' & !'; } else { diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index d3f36f8b84..78e9c04fc8 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -279,7 +279,7 @@ class AllmessagesTablePager extends TablePager { } elseif( isset( $xNames[$s->page_title] ) ) { $pageFlags[$s->page_title] = true; } - } else if( $s->page_namespace == NS_MEDIAWIKI_TALK ){ + } elseif( $s->page_namespace == NS_MEDIAWIKI_TALK ){ $talkFlags[$s->page_title] = true; } } diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php index 85a7c7c3d3..a9cbf3ab77 100644 --- a/includes/specials/SpecialAllpages.php +++ b/includes/specials/SpecialAllpages.php @@ -476,7 +476,7 @@ class SpecialAllpages extends IncludableSpecialPage { $t = Title::makeTitleSafe($ns, $text); if ( $t && $t->isLocal() ) { return array( $t->getNamespace(), $t->getDBkey(), $t->getText() ); - } else if ( $t ) { + } elseif ( $t ) { return null; } diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 86e502f134..aba43b4f3a 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -358,7 +358,7 @@ class SpecialContributions extends SpecialPage { } $tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagFilter'] ); - + $fNS = ''; $fShowDiff = ''; if ( !$wgMiserMode ) { @@ -447,12 +447,12 @@ class ContribsPager extends ReverseChronologicalPager { // Paranoia: avoid brute force searches (bug 17342) if( !$wgUser->isAllowed( 'deletedhistory' ) ) { $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::DELETED_USER) . ' = 0'; - } else if( !$wgUser->isAllowed( 'suppressrevision' ) ) { + } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) { $conds[] = $this->mDb->bitAnd('rev_deleted',Revision::SUPPRESSED_USER) . ' != ' . Revision::SUPPRESSED_USER; } $join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' ); - + $fields = array( 'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect', 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment', @@ -484,7 +484,7 @@ class ContribsPager extends ReverseChronologicalPager { wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) ); return $queryInfo; } - + function getUserCond() { $condition = array(); $join_conds = array(); @@ -645,8 +645,8 @@ class ContribsPager extends ReverseChronologicalPager { } $diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')'; - - + + $diffOut = ( $this->showSizeDiff ) ? ' . . '.ChangesList::showCharacterDifference( $row->rc_old_len, $row->rc_new_len ) : ' . . '.Linker::formatRevisionSize( $row->rev_len ); $ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$diffOut}{$userlink} {$comment} {$topmarktext}"; diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 1213452faf..221a0102a8 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -55,7 +55,7 @@ class DeletedContribsPager extends IndexPager { // Paranoia: avoid brute force searches (bug 17792) if( !$wgUser->isAllowed( 'deletedhistory' ) ) { $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::DELETED_USER) . ' = 0'; - } else if( !$wgUser->isAllowed( 'suppressrevision' ) ) { + } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) { $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::SUPPRESSED_USER) . ' != ' . Revision::SUPPRESSED_USER; } diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index a4d94c7084..3ecf40e638 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -74,7 +74,7 @@ class SpecialExport extends SpecialPage { } } } - else if( $wgRequest->getCheck( 'addns' ) && $wgExportFromNamespaces ) { + elseif( $wgRequest->getCheck( 'addns' ) && $wgExportFromNamespaces ) { $page = $wgRequest->getText( 'pages' ); $nsindex = $wgRequest->getText( 'nsindex', '' ); @@ -88,7 +88,7 @@ class SpecialExport extends SpecialPage { } } } - else if( $wgRequest->wasPosted() && $par == '' ) { + elseif( $wgRequest->wasPosted() && $par == '' ) { $page = $wgRequest->getText( 'pages' ); $this->curonly = $wgRequest->getCheck( 'curonly' ); $rawOffset = $wgRequest->getVal( 'offset' ); diff --git a/includes/specials/SpecialListgrouprights.php b/includes/specials/SpecialListgrouprights.php index 7a49b3e953..07e08e77d9 100644 --- a/includes/specials/SpecialListgrouprights.php +++ b/includes/specials/SpecialListgrouprights.php @@ -175,25 +175,25 @@ class SpecialListGroupRights extends SpecialPage { sort( $r ); if( $add === true ){ $r[] = wfMsgExt( 'listgrouprights-addgroup-all', array( 'escape' ) ); - } else if( is_array( $add ) && count( $add ) ) { + } elseif( is_array( $add ) && count( $add ) ) { $add = array_values( array_unique( $add ) ); $r[] = wfMsgExt( 'listgrouprights-addgroup', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $add ) ), count( $add ) ); } if( $remove === true ){ $r[] = wfMsgExt( 'listgrouprights-removegroup-all', array( 'escape' ) ); - } else if( is_array( $remove ) && count( $remove ) ) { + } elseif( is_array( $remove ) && count( $remove ) ) { $remove = array_values( array_unique( $remove ) ); $r[] = wfMsgExt( 'listgrouprights-removegroup', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $remove ) ), count( $remove ) ); } if( $addSelf === true ){ $r[] = wfMsgExt( 'listgrouprights-addgroup-self-all', array( 'escape' ) ); - } else if( is_array( $addSelf ) && count( $addSelf ) ) { + } elseif( is_array( $addSelf ) && count( $addSelf ) ) { $addSelf = array_values( array_unique( $addSelf ) ); $r[] = wfMsgExt( 'listgrouprights-addgroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $addSelf ) ), count( $addSelf ) ); } if( $removeSelf === true ){ $r[] = wfMsgExt( 'listgrouprights-removegroup-self-all', array( 'escape' ) ); - } else if( is_array( $removeSelf ) && count( $removeSelf ) ) { + } elseif( is_array( $removeSelf ) && count( $removeSelf ) ) { $removeSelf = array_values( array_unique( $removeSelf ) ); $r[] = wfMsgExt( 'listgrouprights-removegroup-self', array( 'parseinline' ), $wgLang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $removeSelf ) ), count( $removeSelf ) ); } diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index 48d6a85282..8d44576125 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -41,7 +41,7 @@ class UsersPager extends AlphabeticPager { if ( $parms[0] != '' && ( in_array( $par, User::getAllGroups() ) || in_array( $par, $symsForAll ) ) ) { $this->requestedGroup = $par; $un = $wgRequest->getText( 'username' ); - } else if ( count( $parms ) == 2 ) { + } elseif ( count( $parms ) == 2 ) { $this->requestedGroup = $parms[0]; $un = $parms[1]; } else { diff --git a/includes/specials/SpecialLockdb.php b/includes/specials/SpecialLockdb.php index 4e6adcd11f..07d1e1b7ec 100644 --- a/includes/specials/SpecialLockdb.php +++ b/includes/specials/SpecialLockdb.php @@ -57,7 +57,7 @@ class SpecialLockdb extends SpecialPage { if ( $action == 'success' ) { $this->showSuccess(); - } else if ( $action == 'submit' && $wgRequest->wasPosted() && + } elseif ( $action == 'submit' && $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { $this->doSubmit(); } else { diff --git a/includes/specials/SpecialProtectedpages.php b/includes/specials/SpecialProtectedpages.php index 83959648f8..32b4c8740f 100644 --- a/includes/specials/SpecialProtectedpages.php +++ b/includes/specials/SpecialProtectedpages.php @@ -332,7 +332,7 @@ class ProtectedPagesPager extends AlphabeticPager { if( $this->sizetype=='min' ) { $conds[] = 'page_len>=' . $this->size; - } else if( $this->sizetype=='max' ) { + } elseif( $this->sizetype=='max' ) { $conds[] = 'page_len<=' . $this->size; } diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index 5583c26c63..66eeadb328 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -144,7 +144,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges { // imagelinks and categorylinks tables have no xx_namespace field, and have xx_to instead of xx_title if( $link_table == 'imagelinks' ) $link_ns = NS_FILE; - else if( $link_table == 'categorylinks' ) $link_ns = NS_CATEGORY; + elseif( $link_table == 'categorylinks' ) $link_ns = NS_CATEGORY; else $link_ns = 0; if( $showlinkedto ) { -- 2.20.1