$countKey = 'title_' . $title->getPrefixedText();
$countable = $page->isCountable( $editInfo );
if ( array_key_exists( $countKey, $this->countableCache ) &&
- $countable != $this->countableCache[ $countKey ] ) {
+ $countable != $this->countableCache[$countKey] ) {
DeferredUpdates::addUpdate( SiteStatsUpdate::factory( array(
- 'articles' => ( (int)$countable - (int)$this->countableCache[ $countKey ] )
+ 'articles' => ( (int)$countable - (int)$this->countableCache[$countKey] )
) ) );
}
}
$tag = $this->reader->localName;
if ( $tag == 'namespace' ) {
- $this->foreignNamespaces[ $this->nodeAttribute( 'key' ) ] =
+ $this->foreignNamespaces[$this->nodeAttribute( 'key' )] =
$this->nodeContents();
} elseif ( in_array( $tag, $normalFields ) ) {
$siteInfo[$tag] = $this->nodeContents();
// Default value is 2000 or the suhosin limit if it is between 1 and 2000
if ( $wgResourceLoaderMaxQueryLength === false ) {
- $suhosinMaxValueLength = (int) ini_get( 'suhosin.get.max_value_length' );
+ $suhosinMaxValueLength = (int)ini_get( 'suhosin.get.max_value_length' );
if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
$wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
} else {
'Custom' => function ( &$data, &$metadata ) {
if ( isset( $metadata[ApiResult::META_TYPE] ) ) {
// We want to use non-BC for BCassoc to force outputting of _idx.
- switch( $metadata[ApiResult::META_TYPE] ) {
+ switch ( $metadata[ApiResult::META_TYPE] ) {
case 'BCassoc':
$metadata[ApiResult::META_TYPE] = 'assoc';
break;
? '' : ( $module->getModulePath() . '+' );
$item['submodules'] = array();
foreach ( $item['type'] as $v ) {
- $item['submodules'][$v] = $prefix.$v;
+ $item['submodules'][$v] = $prefix . $v;
}
}
if ( isset( $settings[ApiBase::PARAM_SUBMODULE_PARAM_PREFIX] ) ) {
public function startWrite( $code ) {
$this->currentLang = $code;
- $this->fname = $this->directory. '/' . $code . '.l10n.php';
+ $this->fname = $this->directory . '/' . $code . '.l10n.php';
$this->data[$code] = array();
if ( file_exists( $this->fname ) ) {
$this->data[$code] = require $this->fname;
public function get( $code, $key ) {
if ( !array_key_exists( $code, $this->data ) ) {
- $fname = $this->directory. '/' . $code . '.l10n.php';
+ $fname = $this->directory . '/' . $code . '.l10n.php';
if ( !file_exists( $fname ) ) {
return null;
}
return $result;
}
-
-
/**
* @param string $key
* @param mixed $value
if ( !is_array( $info ) ) {
throw new Exception( "$path is not a valid JSON file." );
}
- if ( !isset( $info['manifest_version' ] ) ) {
+ if ( !isset( $info['manifest_version'] ) ) {
// For backwards-compatability, assume a version of 1
$info['manifest_version'] = 1;
}
$module = array(
$name,
$scripts,
- (object) $styles,
- (object) $messages,
- (object) $templates,
+ (object)$styles,
+ (object)$messages,
+ (object)$templates,
);
self::trimArray( $module );
if ( strpos( $langList, ',' ) !== false ) {
$this->descriptor['lang'] += array_fill_keys(
explode( ',', $langList ),
- $this->descriptor['lang'][ $langList ]
+ $this->descriptor['lang'][$langList]
);
- unset( $this->descriptor['lang'][ $langList ] );
+ unset( $this->descriptor['lang'][$langList] );
}
}
}
$desc = $this->descriptor;
if ( is_string( $desc ) ) {
return $this->basePath . '/' . $desc;
- } elseif ( isset( $desc['lang'][ $context->getLanguage() ] ) ) {
- return $this->basePath . '/' . $desc['lang'][ $context->getLanguage() ];
- } elseif ( isset( $desc[ $context->getDirection() ] ) ) {
- return $this->basePath . '/' . $desc[ $context->getDirection() ];
+ } elseif ( isset( $desc['lang'][$context->getLanguage()] ) ) {
+ return $this->basePath . '/' . $desc['lang'][$context->getLanguage()];
+ } elseif ( isset( $desc[$context->getDirection()] ) ) {
+ return $this->basePath . '/' . $desc[$context->getDirection()];
} else {
return $this->basePath . '/' . $desc['default'];
}
$this->loadFromDefinition();
$this->imageObjects = array();
}
- if ( !isset( $this->imageObjects[ $skin ] ) ) {
- $this->imageObjects[ $skin ] = array();
- if ( !isset( $this->images[ $skin ] ) ) {
- $this->images[ $skin ] = isset( $this->images[ 'default' ] ) ?
- $this->images[ 'default' ] :
+ if ( !isset( $this->imageObjects[$skin] ) ) {
+ $this->imageObjects[$skin] = array();
+ if ( !isset( $this->images[$skin] ) ) {
+ $this->images[$skin] = isset( $this->images['default'] ) ?
+ $this->images['default'] :
array();
}
- foreach ( $this->images[ $skin ] as $name => $options ) {
+ foreach ( $this->images[$skin] as $name => $options ) {
$fileDescriptor = is_string( $options ) ? $options : $options['file'];
$allowedVariants = array_merge(
is_array( $options ) && isset( $options['variants'] ) ? $options['variants'] : array(),
$this->getGlobalVariants( $context )
);
- if ( isset( $this->variants[ $skin ] ) ) {
+ if ( isset( $this->variants[$skin] ) ) {
$variantConfig = array_intersect_key(
- $this->variants[ $skin ],
+ $this->variants[$skin],
array_fill_keys( $allowedVariants, true )
);
} else {
$this->localBasePath,
$variantConfig
);
- $this->imageObjects[ $skin ][ $image->getName() ] = $image;
+ $this->imageObjects[$skin][$image->getName()] = $image;
}
}
- return $this->imageObjects[ $skin ];
+ return $this->imageObjects[$skin];
}
/**
$this->loadFromDefinition();
$this->globalVariants = array();
}
- if ( !isset( $this->globalVariants[ $skin ] ) ) {
- $this->globalVariants[ $skin ] = array();
- if ( !isset( $this->variants[ $skin ] ) ) {
- $this->variants[ $skin ] = isset( $this->variants[ 'default' ] ) ?
- $this->variants[ 'default' ] :
+ if ( !isset( $this->globalVariants[$skin] ) ) {
+ $this->globalVariants[$skin] = array();
+ if ( !isset( $this->variants[$skin] ) ) {
+ $this->variants[$skin] = isset( $this->variants['default'] ) ?
+ $this->variants['default'] :
array();
}
- foreach ( $this->variants[ $skin ] as $name => $config ) {
+ foreach ( $this->variants[$skin] as $name => $config ) {
if ( isset( $config['global'] ) && $config['global'] ) {
- $this->globalVariants[ $skin ][] = $name;
+ $this->globalVariants[$skin][] = $name;
}
}
}
- return $this->globalVariants[ $skin ];
+ return $this->globalVariants[$skin];
}
/**
// Cache this expensive operation. This calls builds the scripts, styles, and messages
// content which typically involves filesystem and/or database access.
if ( !array_key_exists( $contextHash, $this->contents ) ) {
- $this->contents[ $contextHash ] = $this->buildContent( $context );
+ $this->contents[$contextHash] = $this->buildContent( $context );
}
- return $this->contents[ $contextHash ];
+ return $this->contents[$contextHash];
}
/**
$str .= strval( $mhash );
}
- $this->versionHash[ $contextHash ] = ResourceLoader::makeHash( $str );
+ $this->versionHash[$contextHash] = ResourceLoader::makeHash( $str );
}
- return $this->versionHash[ $contextHash ];
+ return $this->versionHash[$contextHash];
}
/**
array_walk( $data['images'], function ( &$value ) use ( $fixPath ) {
if ( is_string( $value['file'] ) ) {
$fixPath( $value['file'] );
- } else if ( is_array( $value['file'] ) ) {
+ } elseif ( is_array( $value['file'] ) ) {
array_walk_recursive( $value['file'], $fixPath );
}
} );
'(min-resolution: 1.5dppx), ' .
'(min-resolution: 144dpi)'
][] = '.mw-wiki-logo { background-image: ' .
- CSSMin::buildUrlValue( $logoHD['1.5x'] ) .';' .
+ CSSMin::buildUrlValue( $logoHD['1.5x'] ) . ';' .
'background-size: 135px auto; }';
}
if ( isset( $logoHD['2x'] ) ) {
$styles[
'(-webkit-min-device-pixel-ratio: 2), ' .
- '(min--moz-device-pixel-ratio: 2),'.
+ '(min--moz-device-pixel-ratio: 2),' .
'(min-resolution: 2dppx), ' .
'(min-resolution: 192dpi)'
][] = '.mw-wiki-logo { background-image: ' .
// Pre-populate versionHash with something because the loop over all modules below includes
// the startup module (this module).
// See ResourceLoaderModule::getVersionHash() for usage of this cache.
- $this->versionHash[ $context->getHash() ] = null;
+ $this->versionHash[$context->getHash()] = null;
return $rl->getCombinedVersion( $context, $rl->getModuleNames() );
}
}
return $this->msg( 'retrievedfrom' )
- ->rawParams( '<a dir="ltr" href="' . $url. '">' . $url . '</a>' )
+ ->rawParams( '<a dir="ltr" href="' . $url . '">' . $url . '</a>' )
->parse();
}
if ( file_exists( "$IP/skins/$skin/skin.json" ) ) {
return "wfLoadSkin( '$skin' );";
} else {
- return "require_once \"\$IP/skins/$skin/$skin.php\";";
+ return "require_once \"\$IP/skins/$skin/$skin.php\";";
}
}
wfDebugLog(
'fileupload',
'Short write ' . $this->nbytes . '/' . strlen( $buffer ) .
- ' bytes, aborting with ' . $this->mFileSize . ' uploaded so far'
+ ' bytes, aborting with ' . $this->mFileSize . ' uploaded so far'
);
fclose( $this->mTmpHandle );
$this->mTmpHandle = false;
*
*/
-$fallback = 'gom-deva';
\ No newline at end of file
+$fallback = 'gom-deva';
NS_HELP_TALK => 'मजत_चर्चा',
NS_CATEGORY => 'श्रेणी',
NS_CATEGORY_TALK => 'श्रेणी_चर्चा',
-);
\ No newline at end of file
+);
$defaultDateFormat = 'pnt';
-
-
$dateFormats = array(
'pnt time' => 'H:i',
'pnt date' => 'j xg Y',
$handle = fopen( $file, 'w' );
- if ( !$handle ) {
+ if ( !$handle ) {
$this->error( "Failed to open $file for writing.\n", 1 );
}
}
$maintClass = 'ExportSites';
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;
}
$maintClass = 'ImportSites';
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;
$module['selectorWithVariant'] = '.oo-ui-image-{variant} .oo-ui-icon-{name}, .oo-ui-image-{variant}.oo-ui-icon-{name}, .mw-ui-icon-{name}-{variant}:before, .mw-ui-hovericon:hover .mw-ui-icon-{name}-{variant}-hover:before, .mw-ui-hovericon.mw-ui-icon-{name}-{variant}-hover:hover:before';
}
- $modules[ "oojs-ui.styles.$name" ] = $module;
+ $modules["oojs-ui.styles.$name"] = $module;
}
return $modules;
$globals = array();
foreach ( self::getSettings() as $key => $value ) {
- $globals[ 'wg' . $key ] = $value;
+ $globals['wg' . $key] = $value;
}
$this->setMwGlobals( $globals );
}
new FauxRequest( array( 'action' => 'query', 'meta' => 'siteinfo' ) )
);
$modules = $api->getModuleManager()->getNamesWithClasses();
- foreach( $modules as $name => $class ) {
+ foreach ( $modules as $name => $class ) {
$this->assertArrayHasKey(
$class,
$classes,
try {
$arr = array();
- ApiResult::setValue( $arr, 'foo', new ApiResultTestSerializableObject(
+ ApiResult::setValue( $arr, 'foo', new ApiResultTestSerializableObject(
new ApiResultTestStringifiableObject()
) );
$this->fail( 'Expected exception not thrown' );
try {
$arr = array();
- ApiResult::setValue( $arr, 'foo', new ApiResultTestSerializableObject( NAN ) );
+ ApiResult::setValue( $arr, 'foo', new ApiResultTestSerializableObject( NAN ) );
$this->fail( 'Expected exception not thrown' );
} catch ( UnexpectedValueException $ex ) {
$this->assertSame(
}
$arr = array();
- ApiResult::setValue( $arr, 'foo', new ApiResultTestSerializableObject(
+ ApiResult::setValue( $arr, 'foo', new ApiResultTestSerializableObject(
array(
'one' => new ApiResultTestStringifiableObject( '1' ),
'two' => new ApiResultTestSerializableObject( 2 ),
);
$queryApi = new ApiQuery( $api, 'query' );
$modules = $queryApi->getModuleManager()->getNamesWithClasses();
- foreach( $modules as $name => $class ) {
+ foreach ( $modules as $name => $class ) {
$this->assertArrayHasKey(
$class,
$classes,
public function testSetOver() {
$key = wfRandomString();
- for ( $i=0; $i<3; ++$i ) {
+ for ( $i = 0; $i < 3; ++$i ) {
$value = wfRandomString();
$this->cache->set( $key, $value, 3 );
public function testGetSites() {
$expectedSites = array();
- foreach( TestSites::getSites() as $testSite ) {
+ foreach ( TestSites::getSites() as $testSite ) {
$siteId = $testSite->getGlobalId();
$expectedSites[$siteId] = $testSite;
}
$exporter->exportSites( array( $foo, $acme ) );
fseek( $tmp, 0 );
- $xml = fread( $tmp, 16*1024 );
+ $xml = fread( $tmp, 16 * 1024 );
$this->assertContains( '<sites ', $xml );
$this->assertContains( '<site>', $xml );
$exporter->exportSites( $sites );
fseek( $tmp, 0 );
- $xml = fread( $tmp, 16*1024 );
+ $xml = fread( $tmp, 16 * 1024 );
$actualSites = new SiteList();
$store = $this->newSiteStore( $actualSites );
public static function provideIsPublic() {
return array(
array( false, 'fc00::3' ), # RFC 4193 (local)
- array( false, 'fc00::ff'), # RFC 4193 (local)
- array( false, '127.1.2.3'), # loopback
- array( false, '::1'), # loopback
- array( false, 'fe80::1'), # link-local
- array( false, '169.254.1.1'), # link-local
- array( false, '10.0.0.1'), # RFC 1918 (private)
- array( false, '172.16.0.1'), # RFC 1918 (private)
- array( false, '192.168.0.1'), # RFC 1918 (private)
- array( true, '2001:5c0:1000:a::133'), # public
- array( true, 'fc::3'), # public
- array( true, '00FC::') # public
+ array( false, 'fc00::ff' ), # RFC 4193 (local)
+ array( false, '127.1.2.3' ), # loopback
+ array( false, '::1' ), # loopback
+ array( false, 'fe80::1' ), # link-local
+ array( false, '169.254.1.1' ), # link-local
+ array( false, '10.0.0.1' ), # RFC 1918 (private)
+ array( false, '172.16.0.1' ), # RFC 1918 (private)
+ array( false, '192.168.0.1' ), # RFC 1918 (private)
+ array( true, '2001:5c0:1000:a::133' ), # public
+ array( true, 'fc::3' ), # public
+ array( true, '00FC::' ) # public
);
}
$rights = User::getAllRights();
- foreach( $wgGroupPermissions as $permissions ) {
+ foreach ( $wgGroupPermissions as $permissions ) {
$rights = array_merge( $rights, array_keys( $permissions ) );
}
- foreach( $wgRevokePermissions as $permissions ) {
+ foreach ( $wgRevokePermissions as $permissions ) {
$rights = array_merge( $rights, array_keys( $permissions ) );
}