return $matches[1];
}
-}
\ No newline at end of file
+}
if ( $this->numRows > 0 ) {
$out->addHTML( $this->msg( 'showingresultsinrange' )->numParams(
min( $this->numRows, $this->limit ), # do not show the one extra row, if exist
- $this->offset + 1, (min( $this->numRows, $this->limit ) + $this->offset) )->parseAsBlock() );
+ $this->offset + 1, ( min( $this->numRows, $this->limit ) + $this->offset ) )->parseAsBlock() );
# Disable the "next" link when we reach the end
$paging = $this->getLanguage()->viewPrevNext( $this->getPageTitle( $par ), $this->offset,
$this->limit, $this->linkParameters(), ( $this->numRows <= $this->limit ) );
$fname = 'Setup.php';
wfProfileIn( $fname );
-wfProfileIn( $fname . '-defaults' );
+wfProfileIn( $fname . '-defaults' );
// Check to see if we are at the file scope
if ( !isset( $wgVersion ) ) {
);
}
-wfProfileOut( $fname . '-defaults' );
+wfProfileOut( $fname . '-defaults' );
// Disable MWDebug for command line mode, this prevents MWDebug from eating up
// all the memory from logging SQL queries on maintenance scripts
/**
* @since 1.20
*/
-class TimestampException extends MWException {}
\ No newline at end of file
+class TimestampException extends MWException {}
function valid() {
return $this->current !== false;
}
-}
\ No newline at end of file
+}
// Already pinged?
if ( $count ) {
if ( $count >= $max ) {
- wfDebugLog( 'ratelimit', $this->getName() . " tripped! $key at $count $summary");
+ wfDebugLog( 'ratelimit', $this->getName() . " tripped! $key at $count $summary" );
$triggered = true;
} else {
wfDebug( __METHOD__ . ": ok. $key at $count $summary\n" );
protected static function newFromResult_internal( $res ) {
return new UserArrayFromResult( $res );
}
-}
\ No newline at end of file
+}
return $version;
}
-
-}
\ No newline at end of file
+}
$this->mScrollableCursor = false;
try {
parent::deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname );
- } catch( Exception $e ) {
+ } catch ( Exception $e ) {
$this->mScrollableCursor = true;
throw $e;
}
$this->mScrollableCursor = false;
try {
parent::delete( $table, $conds, $fname );
- } catch( Exception $e ) {
+ } catch ( Exception $e ) {
$this->mScrollableCursor = true;
throw $e;
}
$insertOptions,
$selectOptions
);
- } catch( Exception $e ) {
+ } catch ( Exception $e ) {
$this->mScrollableCursor = true;
throw $e;
}
$first = $offset + 1;
$last = $offset + $limit;
$sub1 = 'sub_' . $this->mSubqueryId;
- $sub2 = 'sub_' . ($this->mSubqueryId + 1);
+ $sub2 = 'sub_' . ( $this->mSubqueryId + 1 );
$this->mSubqueryId += 2;
if ( !$s1 ) {
// wat
$port = $hostAndPort[1];
}
}
-
+
$connFlags = 0;
if ( $this->mFlags & DBO_SSL ) {
$connFlags |= MYSQLI_CLIENT_SSL;
* @return string|null
*/
public function getClosing( $i = null ) {
- if( $i === null ) {
+ if ( $i === null ) {
return $this->closing;
}
- if( array_key_exists( $i, $this->closing ) ) {
+ if ( array_key_exists( $i, $this->closing ) ) {
return $this->closing[$i];
}
return null;
}
$x1 = $xoff + (int)( ( $numer + ( $xlim - $xoff ) * $chunk ) / $nchunks );
- for (; $x < $x1; $x++ ) {
+ for ( ; $x < $x1; $x++ ) {
$line = $flip ? $this->yv[$x] : $this->xv[$x];
if ( empty( $ymatches[$line] ) ) {
continue;
return null;
}
- wfProfileIn( __METHOD__. "-{$this->name}-miss" );
+ wfProfileIn( __METHOD__ . "-{$this->name}-miss" );
list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array(
'method' => 'HEAD',
'url' => $this->storageUrl( $auth, $container ),
// http://technet.microsoft.com/en-us/library/ms178569.aspx
// The following array sets up which permissions imply whatever permissions we specify
$implied = array(
- // schema database server
- 'DELETE' => array( 'DELETE', 'CONTROL SERVER' ),
+ // schema database server
+ 'DELETE' => array( 'DELETE', 'CONTROL SERVER' ),
'EXECUTE' => array( 'EXECUTE', 'CONTROL SERVER' ),
- 'INSERT' => array( 'INSERT', 'CONTROL SERVER' ),
- 'SELECT' => array( 'SELECT', 'CONTROL SERVER' ),
- 'UPDATE' => array( 'UPDATE', 'CONTROL SERVER' ),
+ 'INSERT' => array( 'INSERT', 'CONTROL SERVER' ),
+ 'SELECT' => array( 'SELECT', 'CONTROL SERVER' ),
+ 'UPDATE' => array( 'UPDATE', 'CONTROL SERVER' ),
);
$grantOptions = array_flip( $this->webUserPrivs );
* @access private
*/
function _connect_sock( &$sock, $host ) {
- list( $ip, $port ) = preg_split('/:(?=\d)/' , $host );
+ list( $ip, $port ) = preg_split( '/:(?=\d)/', $host );
$sock = false;
$timeout = $this->_connect_timeout;
$errno = $errstr = null;
$parser->setFunctionHook( $func, array( __CLASS__, $func ), SFH_NO_HASH );
}
- $parser->setFunctionHook( 'namespace', array( __CLASS__, 'mwnamespace' ), SFH_NO_HASH );
- $parser->setFunctionHook( 'int', array( __CLASS__, 'intFunction' ), SFH_NO_HASH );
- $parser->setFunctionHook( 'special', array( __CLASS__, 'special' ) );
- $parser->setFunctionHook( 'speciale', array( __CLASS__, 'speciale' ) );
- $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS );
- $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
+ $parser->setFunctionHook( 'namespace', array( __CLASS__, 'mwnamespace' ), SFH_NO_HASH );
+ $parser->setFunctionHook( 'int', array( __CLASS__, 'intFunction' ), SFH_NO_HASH );
+ $parser->setFunctionHook( 'special', array( __CLASS__, 'special' ) );
+ $parser->setFunctionHook( 'speciale', array( __CLASS__, 'speciale' ) );
+ $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS );
+ $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
if ( $wgAllowDisplayTitle ) {
$parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH );
static function localurle( $parser, $s = '', $arg = null ) {
$temp = self::urlFunction( 'getLocalURL', $s, $arg );
- if( !is_string( $temp ) ) {
+ if ( !is_string( $temp ) ) {
return $temp;
} else {
return htmlspecialchars( $temp );
static function fullurle( $parser, $s = '', $arg = null ) {
$temp = self::urlFunction( 'getFullURL', $s, $arg );
- if( !is_string( $temp ) ) {
+ if ( !is_string( $temp ) ) {
return $temp;
} else {
return htmlspecialchars( $temp );
// Message types
- const TYPE_SINGLE = 1;
+ const TYPE_SINGLE = 1;
const TYPE_RUNNING = 2;
/**
);
// Ensure uniform query order
ksort( $query );
- return wfAppendQuery( wfScript( 'load' ), $query );
+ return wfAppendQuery( wfScript( 'load' ), $query );
}
/**
? 'resetpass-submit-loggedin'
: 'resetpass_submit'
);
- $form->addButton( 'wpCancel', $this->msg( 'resetpass-submit-cancel' )->text() );
+ $form->addButton( 'wpCancel', $this->msg( 'resetpass-submit-cancel' )->text() );
$form->setHeaderText( $this->msg( 'resetpass_text' )->parseAsBlock() );
if ( $this->mPreTextMessage instanceof Message ) {
$form->addPreText( $this->mPreTextMessage->parseAsBlock() );
$targetUser->clearInstanceCache(); // bug 38989
}
-
if ( $request->getVal( 'conflictcheck-originalgroups' ) !== implode( ',', $targetUser->getGroups() ) ) {
$out->addWikiMsg( 'userrights-conflict' );
} else {
$fhooks = $wgParser->getFunctionHooks();
if ( count( $fhooks ) ) {
- $out = Html::rawElement( 'h2', array( 'class' => 'mw-headline' ) , Linker::makeExternalLink(
+ $out = Html::rawElement( 'h2', array( 'class' => 'mw-headline' ), Linker::makeExternalLink(
'//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Parser_functions',
$this->msg( 'version-parser-function-hooks' )->parse(),
false /* msg()->parse() already escapes */
);
} else {
$vcsVerString = Html::element( 'span',
- array( 'class' => 'mw-version-ext-vcs-version'),
+ array( 'class' => 'mw-version-ext-vcs-version' ),
"({$vcsVersion})"
);
}
if ( $vcsDate ) {
$vcsTimeString = Html::element( 'span',
- array( 'class' => 'mw-version-ext-vcs-timestamp'),
+ array( 'class' => 'mw-version-ext-vcs-timestamp' ),
$this->getLanguage()->timeanddate( $vcsDate )
);
$versionString .= " {$vcsTimeString}";
), LIST_OR );
}
-
ChangeTags::modifyDisplayQuery(
$tables,
$fields,
*/
public static function checkSvgPICallback( $target, $data ) {
// Don't allow external stylesheets (bug 57550)
- if ( preg_match( '/xml-stylesheet/i', $target) ) {
+ if ( preg_match( '/xml-stylesheet/i', $target ) ) {
return true;
}
return false;
return true;
}
-
foreach ( $attribs as $attrib => $value ) {
$stripped = $this->stripXmlNamespace( $attrib );
$value = strtolower( $value );
}
function translate( $text, $toVariant ) {
- if( $toVariant == 'uz-cyrl' ) {
+ if ( $toVariant == 'uz-cyrl' ) {
$text = str_replace( 'ye', 'е', $text );
$text = str_replace( 'Ye', 'Е', $text );
$text = str_replace( 'YE', 'Е', $text );
public static function evaluateCompiled( $number, array $rules ) {
// Calculate the values of the operand symbols
$number = strval( $number );
- if ( !preg_match( '/^ -? ( ([0-9]+) (?: \. ([0-9]+) )? )$/x', $number, $m ) ) {
- wfDebug( __METHOD__.': invalid number input, returning "other"' );
+ if ( !preg_match( '/^ -? ( ([0-9]+) (?: \. ([0-9]+) )? )$/x', $number, $m ) ) {
+ wfDebug( __METHOD__ . ': invalid number input, returning "other"' );
return count( $rules );
}
if ( !isset( $m[3] ) ) {
PHP;
- $jsondir = str_replace('\\', '/', $jsondir );
+ $jsondir = str_replace( '\\', '/', $jsondir );
$shim = str_replace( '{{OUT}}', $jsondir, $shim );
return $shim;
}
return $html;
}
- /**
+ /**
* @param string $name
*/
protected function renderAfterPortlet( $name ) {
$this->renderPortal( 'tb', $this->getToolbox(), 'toolbox', 'SkinTemplateToolboxEnd' );
break;
case 'LANGUAGES':
- if ( $this->data['language_urls'] !== false ) {
+ if ( $this->data['language_urls'] !== false ) {
$this->renderPortal( 'lang', $this->data['language_urls'], 'otherlanguages' );
}
break;
)
)
)';
- $regex = '/'.$defs.'\b
+ $regex = '/' . $defs . '\b
(?<k>[\w-]+) # Key
\b
(?:\s*
)
)?
/x';
- $valueregex = '/'.$defs.'(?&value)/x';
+ $valueregex = '/' . $defs . '(?&value)/x';
if ( preg_match_all( $regex, $instring, $matches, PREG_SET_ORDER ) ) {
foreach ( $matches as $bits ) {
}
// NOTE; some things such as Closures are not serializable
// in this case just set the value!
- catch( Exception $e ) {
+ catch ( Exception $e ) {
$this->mwGlobals[$globalKey] = $GLOBALS[$globalKey];
}
}
public function provideValidTimestampDifferences() {
return array(
- array( '1406833268','1406833269', '00 00 00 01' ),
- array( '1406833268','1406833329', '00 00 01 01' ),
- array( '1406833268','1406836929', '00 01 01 01' ),
- array( '1406833268','1406923329', '01 01 01 01' ),
+ array( '1406833268', '1406833269', '00 00 00 01' ),
+ array( '1406833268', '1406833329', '00 00 01 01' ),
+ array( '1406833268', '1406836929', '00 01 01 01' ),
+ array( '1406833268', '1406923329', '01 01 01 01' ),
);
}
$this->assertInternalType( 'string', $versionFetcher->fetchVersion() );
}
-}
\ No newline at end of file
+}
public function testParams( $expected ) {
$msg = new Message( 'imasomething' );
- $returned = call_user_func_array( array( $msg, 'params' ), array_slice( func_get_args(), 1 ) );
+ $returned = call_user_func_array( array( $msg, 'params' ), array_slice( func_get_args(), 1 ) );
$this->assertSame( $msg, $returned );
$this->assertEquals( $expected, $msg->getParams() );
*/
public function testGetStatusArrayWithNonObjectMessages( $nonObjMsg ) {
$status = new Status();
- if( !array_key_exists( 1, $nonObjMsg ) ) {
+ if ( !array_key_exists( 1, $nonObjMsg ) ) {
$status->warning( $nonObjMsg[0] );
} else {
$status->warning( $nonObjMsg[0], $nonObjMsg[1] );
//@todo unit test for key()
//@todo unit test for next()
//@todo unit test for rewind()
-
-}
\ No newline at end of file
+}
//@todo unit test for key()
//@todo unit test for next()
//@todo unit test for rewind()
-
-}
\ No newline at end of file
+}
array( 'alpha42' ),
);
}
-
-}
\ No newline at end of file
+}
$diffOp->expects( $this->any() )
->method( 'getOrig' )
->will( $this->returnValue( $orig ) );
- if( $type === 'change' ) {
+ if ( $type === 'change' ) {
$diffOp->expects( $this->any() )
->method( 'getClosing' )
->with( $this->isType( 'integer' ) )
);
$testCases = array();
- foreach( $emptyArrayTestCases as $testCase ) {
+ foreach ( $emptyArrayTestCases as $testCase ) {
$testCases[] = array( $testCase, array() );
}
- foreach( $otherTestCases as $testCase ) {
+ foreach ( $otherTestCases as $testCase ) {
$testCases[] = array( $testCase[0], $testCase[1] );
}
return $testCases;
<?php
//Load our FakeDiffOp
-require_once( __DIR__ . DIRECTORY_SEPARATOR . 'FakeDiffOp.php' );
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'FakeDiffOp.php';
/**
* @licence GNU GPL v2+
public function testGetClosingWithParameter() {
$obj = new FakeDiffOp();
$obj->closing = array( 'foo', 'bar', 'baz' );
- $this->assertEquals( 'foo' , $obj->getClosing( 0 ) );
- $this->assertEquals( 'bar' , $obj->getClosing( 1 ) );
- $this->assertEquals( 'baz' , $obj->getClosing( 2 ) );
- $this->assertEquals( null , $obj->getClosing( 3 ) );
+ $this->assertEquals( 'foo', $obj->getClosing( 0 ) );
+ $this->assertEquals( 'bar', $obj->getClosing( 1 ) );
+ $this->assertEquals( 'baz', $obj->getClosing( 2 ) );
+ $this->assertEquals( null, $obj->getClosing( 3 ) );
}
/**
public function testExceptionSetsStatusCode() {
global $wgOut;
$wgOut = $this->getMockWgOut();
- try{
+ try {
throw new BadTitleError();
- }
- catch( BadTitleError $e ) {
+ } catch ( BadTitleError $e ) {
$e->report();
$this->assertTrue( true );
}
$mockMessage->expects( $this->once() )
->method( 'inLanguage' )
->will( $this->returnValue( $mockMessage ) );
- $mockMessage->expects( $this->once() )
+ $mockMessage->expects( $this->once() )
->method( 'useDatabase' )
->will( $this->returnValue( $mockMessage ) );
return $mockMessage;
*/
public static function mockHook() {
$args = func_get_args();
- if( !$args[0] instanceof MWException ) {
+ if ( !$args[0] instanceof MWException ) {
return '$caller not instance of MWException';
}
unset( $args[0] );
- if( array_key_exists( 1, $args ) && $args[1] === null ) {
+ if ( array_key_exists( 1, $args ) && $args[1] === null ) {
return null;
}
return 'YAY.' . json_encode( $args );
$e = new ReadOnlyError();
$this->assertEquals( 'readonly', $e->title );
$this->assertEquals( 'readonlytext', $e->msg );
- $this->assertEquals( wfReadOnlyReason()?: array(), $e->params );
+ $this->assertEquals( wfReadOnlyReason() ?: array(), $e->params );
}
}
public function testExceptionSetsStatusCode() {
global $wgOut;
$wgOut = $this->getMockWgOut();
- try{
+ try {
throw new ThrottledError();
- }
- catch( ThrottledError $e ) {
+ } catch ( ThrottledError $e ) {
$e->report();
$this->assertTrue( true );
}
foreach ( $list as $site ) {
$this->assertTrue( $copy->hasInternalId( $site->getInternalId() ) );
- foreach( $site->getNavigationIds() as $navId ) {
+ foreach ( $site->getNavigationIds() as $navId ) {
$this->assertTrue(
$copy->hasNavigationId( $navId ),
'unserialized data expects nav id ' . $navId . ' for site ' . $site->getGlobalId()
* @covers Language::convertPlural
*/
public function testExplicitPlural() {
- $forms = array( 'one','many', 'other', '12=dozen' );
+ $forms = array( 'one', 'many', 'other', '12=dozen' );
$this->assertEquals( 'dozen', $this->getLang()->convertPlural( 12, $forms ) );
$forms = array( 'one', 'many', '100=hundred', 'other', '12=dozen' );
$this->assertEquals( 'hundred', $this->getLang()->convertPlural( 100, $forms ) );
* @dataProvider validSpecialPageAliasesProvider
*/
public function testValidSpecialPageAliases( $code, $specialPageAliases ) {
- foreach( $specialPageAliases as $specialPage => $aliases ) {
- foreach( $aliases as $alias ) {
+ foreach ( $specialPageAliases as $specialPage => $aliases ) {
+ foreach ( $aliases as $alias ) {
$msg = "$specialPage alias '$alias' in $code is valid with no slashes";
$this->assertRegExp( '/^[^\/]*$/', $msg );
}
$data = array();
- foreach( $codes as $code ) {
+ foreach ( $codes as $code ) {
$specialPageAliases = $this->getSpecialPageAliases( $code );
if ( $specialPageAliases !== array() ) {
}
if ( $input == false || $result == false ||
- ( ( preg_match( '/\\bdisabled\\b/i', $this->sectionData['options'] ) && !$this->parserTest->runDisabled )
+ ( ( preg_match( '/\\bdisabled\\b/i', $this->sectionData['options'] ) && !$this->parserTest->runDisabled )
|| ( preg_match( '/\\bparsoid\\b/i', $this->sectionData['options'] ) && $result != 'html/php' && !$this->parserTest->runParsoid )
|| !preg_match( "/" . $this->parserTest->regex . "/i", $this->sectionData['test'] ) )
) {