/**@{
* Max string length for shell invocations; based on binfmts.h
*/
-define( 'SHELL_MAX_ARG_STRLEN', '100000');
+define( 'SHELL_MAX_ARG_STRLEN', '100000' );
/**@}*/
// accomodating, because very long commands probably include user
// input. See T129506.
if ( strlen( $cmd ) > SHELL_MAX_ARG_STRLEN ) {
- throw new Exception( __METHOD__ . '(): total length of $cmd must not exceed SHELL_MAX_ARG_STRLEN' );
+ throw new Exception( __METHOD__ .
+ '(): total length of $cmd must not exceed SHELL_MAX_ARG_STRLEN' );
}
$desc = [
$newRel = Parser::getExternalLinkRel( $url, $title );
if ( !isset( $attribs['rel'] ) || $attribs['rel'] === '' ) {
$attribs['rel'] = $newRel;
- } elseif( $newRel !== '' ) {
+ } elseif ( $newRel !== '' ) {
// Merge the rel attributes.
$newRels = explode( ' ', $newRel );
$oldRels = explode( ' ', $attribs['rel'] );
*/
if ( ini_get( 'mbstring.func_overload' ) ) {
- die( 'MediaWiki does not support installations where mbstring.func_overload is non-zero.' );
+ die( 'MediaWiki does not support installations where mbstring.func_overload is non-zero.' );
}
# bug 15461: Make IE8 turn off content sniffing. Everybody else should ignore this
}
// Allow extensions to override.
- $this->lacksSameOriginSecurity = !Hooks::run( 'RequestHasSameOriginSecurity', array( $request ) );
+ $this->lacksSameOriginSecurity = !Hooks::run( 'RequestHasSameOriginSecurity', [ $request ] );
return $this->lacksSameOriginSecurity;
}
-
/**
* Get the ApiErrorFormatter object associated with current request
* @return ApiErrorFormatter
if ( !$linkInfo ) {
$this->mMarkPatrolledLink = '';
} else {
- $this->mMarkPatrolledLink = ' <span class="patrollink" data-mw="interface">[' . Linker::linkKnown(
- $this->mNewPage,
- $this->msg( 'markaspatrolleddiff' )->escaped(),
- [],
- [
- 'action' => 'markpatrolled',
- 'rcid' => $linkInfo['rcid'],
- 'token' => $linkInfo['token'],
- ]
- ) . ']</span>';
+ $this->mMarkPatrolledLink = ' <span class="patrollink" data-mw="interface">[' .
+ Linker::linkKnown(
+ $this->mNewPage,
+ $this->msg( 'markaspatrolleddiff' )->escaped(),
+ [],
+ [
+ 'action' => 'markpatrolled',
+ 'rcid' => $linkInfo['rcid'],
+ 'token' => $linkInfo['token'],
+ ]
+ ) . ']</span>';
}
}
return $this->mMarkPatrolledLink;
// We need to let both '"' and '&' through,
// for strip markers and entities respectively.
$content = str_replace(
- array( '>', '<' ),
- array( '>', '<' ),
+ [ '>', '<' ],
+ [ '>', '<' ],
$content
);
return Html::rawElement( 'pre', $attribs, $content );
* @return array
*/
public static function nowiki( $content, $attributes, $parser ) {
- $content = strtr( $content, array(
+ $content = strtr( $content, [
// lang converter
'-{' => '-{',
'}-' => '}-',
'>' => '>'
// Note: Both '"' and '&' are not converted.
// This allows strip markers and entities through.
- ) );
- return array( $content, 'markerType' => 'nowiki' );
+ ] );
+ return [ $content, 'markerType' => 'nowiki' ];
}
/**
*/
public function testLacksSameOriginSecurity() {
// Basic test
- $main = new ApiMain( new FauxRequest( array( 'action' => 'query', 'meta' => 'siteinfo' ) ) );
+ $main = new ApiMain( new FauxRequest( [ 'action' => 'query', 'meta' => 'siteinfo' ] ) );
$this->assertFalse( $main->lacksSameOriginSecurity(), 'Basic test, should have security' );
// JSONp
$main = new ApiMain(
- new FauxRequest( array( 'action' => 'query', 'format' => 'xml', 'callback' => 'foo' ) )
+ new FauxRequest( [ 'action' => 'query', 'format' => 'xml', 'callback' => 'foo' ] )
);
$this->assertTrue( $main->lacksSameOriginSecurity(), 'JSONp, should lack security' );
// Header
- $request = new FauxRequest( array( 'action' => 'query', 'meta' => 'siteinfo' ) );
+ $request = new FauxRequest( [ 'action' => 'query', 'meta' => 'siteinfo' ] );
$request->setHeader( 'TrEaT-As-UnTrUsTeD', '' ); // With falsey value!
$main = new ApiMain( $request );
$this->assertTrue( $main->lacksSameOriginSecurity(), 'Header supplied, should lack security' );
// Hook
- $this->mergeMwGlobalArrayValue( 'wgHooks', array(
- 'RequestHasSameOriginSecurity' => array( function () { return false; } )
- ) );
- $main = new ApiMain( new FauxRequest( array( 'action' => 'query', 'meta' => 'siteinfo' ) ) );
+ $this->mergeMwGlobalArrayValue( 'wgHooks', [
+ 'RequestHasSameOriginSecurity' => [ function () {
+ return false;
+ } ]
+ ] );
+ $main = new ApiMain( new FauxRequest( [ 'action' => 'query', 'meta' => 'siteinfo' ] ) );
$this->assertTrue( $main->lacksSameOriginSecurity(), 'Hook, should lack security' );
}
}