$imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos );
$showSignature = true;
if ( $title ) {
- $showSignature = MWNamespace::wantSignatures( $title->getNamespace() );
+ $showSignature = MWNamespace::wantSignatures( $title->getNamespace() );
}
/**
} elseif ( is_int( $nsId ) ) {
$nsName = $wgContLang->convertNamespace( $nsId );
}
- $optionsOut[ $nsId ] = $nsName;
+ $optionsOut[$nsId] = $nsName;
}
return $optionsOut;
$themes = ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' );
// Make keys (skin names) lowercase for case-insensitive matching.
$themes = array_change_key_case( $themes, CASE_LOWER );
- $theme = isset( $themes[ $skinName ] ) ? $themes[ $skinName ] : 'MediaWiki';
+ $theme = isset( $themes[$skinName] ) ? $themes[$skinName] : 'MediaWiki';
// For example, 'OOUI\MediaWikiTheme'.
$themeClass = "OOUI\\{$theme}Theme";
OOUI\Theme::setSingleton( new $themeClass() );
$indexInfo = $this->query( 'PRAGMA INDEX_INFO(' . $this->addQuotes( $index->name ) . ')' );
$fields = array();
foreach ( $indexInfo as $indexInfoRow ) {
- $fields[ $indexInfoRow->seqno ] = $indexInfoRow->name;
+ $fields[$indexInfoRow->seqno] = $indexInfoRow->name;
}
$sql .= '(' . implode( ',', $fields ) . ')';
# (a) Check the local APC cache
$value = $this->srvCache->get( $key );
if ( $value && $value['timestamp'] > ( microtime( true ) - $ttl ) ) {
- wfDebugLog( 'replication', __FUNCTION__ . ": got lag times ($key) from local cache" );
+ wfDebugLog( 'replication', __FUNCTION__ . ": got lag times ($key) from local cache" );
return $value['lagTimes']; // cache hit
}
$staleValue = $value ?: false;
$value = $this->mainCache->get( $key );
if ( $value && $value['timestamp'] > ( microtime( true ) - $ttl ) ) {
$this->srvCache->set( $key, $value, $staleTTL );
- wfDebugLog( 'replication', __FUNCTION__ . ": got lag times ($key) from main cache" );
+ wfDebugLog( 'replication', __FUNCTION__ . ": got lag times ($key) from main cache" );
return $value['lagTimes']; // cache hit
}
$value = array( 'lagTimes' => $lagTimes, 'timestamp' => microtime( true ) );
$this->mainCache->set( $key, $value, $staleTTL );
$this->srvCache->set( $key, $value, $staleTTL );
- wfDebugLog( 'replication', __FUNCTION__ . ": re-calculated lag times ($key)" );
+ wfDebugLog( 'replication', __FUNCTION__ . ": re-calculated lag times ($key)" );
return $value['lagTimes'];
}
}
if ( is_scalar( $item ) ) {
- return (string) $item;
+ return (string)$item;
}
if ( is_array( $item ) ) {
if ( is_object( $item ) ) {
if ( method_exists( $item, '__toString' ) ) {
- return (string) $item;
+ return (string)$item;
}
return '[Object ' . get_class( $item ) . ']';
) {
$prefix = 'mw-ui-';
// add mw-ui-button separately, so the descriptor doesn't need to set it
- $flags .= ' ' . $prefix.'button';
+ $flags .= ' ' . $prefix . 'button';
}
foreach ( $this->mFlags as $flag ) {
$flags .= ' ' . $prefix . $flag;
if ( $info['fourCC'] != 'WEBP' ) {
wfDebugLog( 'WebP', __METHOD__ . ': FourCC was not WEBP: ' .
- bin2hex( $info['fourCC'] ) . " \n" );
+ bin2hex( $info['fourCC'] ) . " \n" );
return false;
}
// Bytes 4-7 are chunk stream size
// Byte 8 is 0x2F called the signature
if ( $header{8} != "\x2F" ) {
- wfDebugLog( 'WebP', __METHOD__ . ': Invalid signature: ' .
+ wfDebugLog( 'WebP', __METHOD__ . ': Invalid signature: ' .
bin2hex( $header{8} ) . "\n" );
return array();
}
public static function tidy( $text ) {
$driver = self::singleton();
if ( !$driver ) {
- throw new MWException( __METHOD__.
+ throw new MWException( __METHOD__ .
': tidy is disabled, caller should have checked MWTidy::isEnabled()' );
}
return $driver->tidy( $text );
public static function checkErrors( $text, &$errorStr = null ) {
$driver = self::singleton();
if ( !$driver ) {
- throw new MWException( __METHOD__.
+ throw new MWException( __METHOD__ .
': tidy is disabled, caller should have checked MWTidy::isEnabled()' );
}
if ( $driver->supportsValidate() ) {
) {
// Doesn't match, mark it as incompatible.
$incompatible[] = "{$info['name']} is not compatible with the current "
- . "MediaWiki core (version {$wgVersion}), it requires: ". $requires[self::MEDIAWIKI_CORE]
+ . "MediaWiki core (version {$wgVersion}), it requires: " . $requires[self::MEDIAWIKI_CORE]
. '.';
continue;
}
if ( $context->getImageObj() && $this->errors ) {
// We can't show both the error messages and the response when it's an image.
- $response = implode( "\n\n", $this->errors );
+ $response = implode( "\n\n", $this->errors );
} elseif ( $this->errors ) {
$errorText = implode( "\n\n", $this->errors );
$errorResponse = self::makeComment( $errorText );
throw new RuntimeException( "Form submission was not POSTed" );
}
- $this->title = Title::newFromText( $data['pagetitle' ] );
+ $this->title = Title::newFromText( $data['pagetitle'] );
$user = $this->getUser();
// Check permissions and make sure the user has permission to edit the specific page
$errors = $this->title->getUserPermissionsErrors( 'editcontentmodel', $user );
}
$this->db = $db;
$this->table = $table;
- $this->primaryKey = (array) $primaryKey;
+ $this->primaryKey = (array)$primaryKey;
$this->fetchColumns = $this->primaryKey;
$this->orderBy = implode( ' ASC,', $this->primaryKey ) . ' ASC';
$this->batchSize = $batchSize;
* @return boolean True when the iterator is in a valid state
*/
public function valid() {
- return (bool) $this->current;
+ return (bool)$this->current;
}
/**
$instance = self::singleton();
if ( !is_array( $filePaths ) ) {
- $filePaths = (array) $filePaths;
+ $filePaths = (array)$filePaths;
}
if ( count( $filePaths ) === 1 ) {
$setcookieInvocations = $setcookieSpy->getInvocations();
$setcookieInvocation = end( $setcookieInvocations );
- $actualExpiry = $setcookieInvocation->parameters[ 2 ];
+ $actualExpiry = $setcookieInvocation->parameters[2];
// TODO: ± 300 seconds compensates for
// slow-running tests. However, the dependency on the time
array(
'content-length' => 345,
'content-type' => 'image+bitmap/jpeg',
- 'content-disposition' => 'filename='. str_repeat( 'o', 1024 ) . ';inline',
+ 'content-disposition' => 'filename=' . str_repeat( 'o', 1024 ) . ';inline',
'content-duration' => 35.6363,
'content-custom' => 'hello',
'x-content-custom' => 'hello'
}
}
- rmdir( $directory );
+ rmdir( $directory );
}
protected function tearDown() {