Last part
Change-Id: I38f015e2122ef4fd2d2141718bd889794c29f06c
16 files changed:
*
* @param string $contents The raw HTML contents of the element: *not*
* escaped!
*
* @param string $contents The raw HTML contents of the element: *not*
* escaped!
- * @param array $attrs Associative array of attributes, e.g., array(
- * 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+ * @param array $attrs Associative array of attributes, e.g., [
+ * 'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
* further documentation.
* @param string[] $modifiers classes to add to the button
* @see http://tools.wmflabs.org/styleguide/desktop/index.html for guidance on available modifiers
* further documentation.
* @param string[] $modifiers classes to add to the button
* @see http://tools.wmflabs.org/styleguide/desktop/index.html for guidance on available modifiers
*
* @param string $contents The raw HTML contents of the element: *not*
* escaped!
*
* @param string $contents The raw HTML contents of the element: *not*
* escaped!
- * @param array $attrs Associative array of attributes, e.g., array(
- * 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+ * @param array $attrs Associative array of attributes, e.g., [
+ * 'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
* further documentation.
* @param string[] $modifiers classes to add to the button
* @see http://tools.wmflabs.org/styleguide/desktop/index.html for guidance on available modifiers
* further documentation.
* @param string[] $modifiers classes to add to the button
* @see http://tools.wmflabs.org/styleguide/desktop/index.html for guidance on available modifiers
* content model.
*
* @param string $element The element's name, e.g., 'a'
* content model.
*
* @param string $element The element's name, e.g., 'a'
- * @param array $attribs Associative array of attributes, e.g., array(
- * 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+ * @param array $attribs Associative array of attributes, e.g., [
+ * 'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
* further documentation.
* @param string $contents The raw HTML contents of the element: *not*
* escaped!
* further documentation.
* @param string $contents The raw HTML contents of the element: *not*
* escaped!
* to the input array (currently per the HTML 5 draft as of 2009-09-06).
*
* @param string $element Name of the element, e.g., 'a'
* to the input array (currently per the HTML 5 draft as of 2009-09-06).
*
* @param string $element Name of the element, e.g., 'a'
- * @param array $attribs Associative array of attributes, e.g., array(
- * 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
+ * @param array $attribs Associative array of attributes, e.g., [
+ * 'href' => 'http://www.mediawiki.org/' ]. See expandAttributes() for
* further documentation.
* @return array An array of attributes functionally identical to $attribs
*/
* further documentation.
* @return array An array of attributes functionally identical to $attribs
*/
/**
* Given an associative array of element attributes, generate a string
/**
* Given an associative array of element attributes, generate a string
- * to stick after the element name in HTML output. Like array( 'href' =>
- * 'http://www.mediawiki.org/' ) becomes something like
+ * to stick after the element name in HTML output. Like [ 'href' =>
+ * 'http://www.mediawiki.org/' ] becomes something like
* ' href="http://www.mediawiki.org"'. Again, this is like
* Xml::expandAttributes(), but it implements some HTML-specific logic.
*
* ' href="http://www.mediawiki.org"'. Again, this is like
* Xml::expandAttributes(), but it implements some HTML-specific logic.
*
*
* @par Numerical array
* @code
*
* @par Numerical array
* @code
- * Html::element( 'em', array(
- * 'class' => array( 'foo', 'bar' )
- * ) );
+ * Html::element( 'em', [
+ * 'class' => [ 'foo', 'bar' ]
+ * ] );
* // gives '<em class="foo bar"></em>'
* @endcode
*
* @par Associative array
* @code
* // gives '<em class="foo bar"></em>'
* @endcode
*
* @par Associative array
* @code
- * Html::element( 'em', array(
- * 'class' => array( 'foo', 'bar', 'foo' => false, 'quux' => true )
- * ) );
+ * Html::element( 'em', [
+ * 'class' => [ 'foo', 'bar', 'foo' => false, 'quux' => true ]
+ * ] );
* // gives '<em class="bar quux"></em>'
* @endcode
*
* // gives '<em class="bar quux"></em>'
* @endcode
*
- * @param array $attribs Associative array of attributes, e.g., array(
- * 'href' => 'http://www.mediawiki.org/' ). Values will be HTML-escaped.
+ * @param array $attribs Associative array of attributes, e.g., [
+ * 'href' => 'http://www.mediawiki.org/' ]. Values will be HTML-escaped.
* A value of false means to omit the attribute. For boolean attributes,
* A value of false means to omit the attribute. For boolean attributes,
- * you can omit the key, e.g., array( 'checked' ) instead of
- * array( 'checked' => 'checked' ) or such.
+ * you can omit the key, e.g., [ 'checked' ] instead of
+ * [ 'checked' => 'checked' ] or such.
*
* @throws MWException If an attribute that doesn't allow lists is set to an array
* @return string HTML fragment that goes between element name and '>'
*
* @throws MWException If an attribute that doesn't allow lists is set to an array
* @return string HTML fragment that goes between element name and '>'
public static function expandAttributes( array $attribs ) {
$ret = '';
foreach ( $attribs as $key => $value ) {
public static function expandAttributes( array $attribs ) {
$ret = '';
foreach ( $attribs as $key => $value ) {
- // Support intuitive array( 'checked' => true/false ) form
+ // Support intuitive [ 'checked' => true/false ] form
if ( $value === false || is_null( $value ) ) {
continue;
}
if ( $value === false || is_null( $value ) ) {
continue;
}
- // For boolean attributes, support array( 'foo' ) instead of
- // requiring array( 'foo' => 'meaningless' ).
+ // For boolean attributes, support [ 'foo' ] instead of
+ // requiring [ 'foo' => 'meaningless' ].
if ( is_int( $key ) && in_array( strtolower( $value ), self::$boolAttribs ) ) {
$key = $value;
}
if ( is_int( $key ) && in_array( strtolower( $value ), self::$boolAttribs ) ) {
$key = $value;
}
}
} elseif ( $v ) {
// If the value is truthy but not a string this is likely
}
} elseif ( $v ) {
// If the value is truthy but not a string this is likely
- // an array( 'foo' => true ), falsy values don't add strings
+ // an [ 'foo' => true ], falsy values don't add strings
*
* @par Example:
* @code
*
* @par Example:
* @code
* '1x' => 'standard.jpeg',
* '1.5x' => 'large.jpeg',
* '3x' => 'extra-large.jpeg',
* '1x' => 'standard.jpeg',
* '1.5x' => 'large.jpeg',
* '3x' => 'extra-large.jpeg',
* // gives 'standard.jpeg 1x, large.jpeg 1.5x, extra-large.jpeg 2x'
* @endcode
*
* // gives 'standard.jpeg 1x, large.jpeg 1.5x, extra-large.jpeg 2x'
* @endcode
*
* Output a standard error page
*
* showErrorPage( 'titlemsg', 'pagetextmsg' );
* Output a standard error page
*
* showErrorPage( 'titlemsg', 'pagetextmsg' );
- * showErrorPage( 'titlemsg', 'pagetextmsg', array( 'param1', 'param2' ) );
+ * showErrorPage( 'titlemsg', 'pagetextmsg', [ 'param1', 'param2' ] );
* showErrorPage( 'titlemsg', $messageObject );
* showErrorPage( $titleMessageObject, $messageObject );
*
* showErrorPage( 'titlemsg', $messageObject );
* showErrorPage( $titleMessageObject, $messageObject );
*
* @code
* echo $templateParser->processTemplate(
* 'ExampleTemplate',
* @code
* echo $templateParser->processTemplate(
* 'ExampleTemplate',
* 'username' => $user->getName(),
* 'message' => 'Hello!'
* 'username' => $user->getName(),
* 'message' => 'Hello!'
* );
* @endcode
* @param string $templateName The name of the template
* );
* @endcode
* @param string $templateName The name of the template
} else {
$errors = $elements->getErrorsByType( $elementsType );
foreach ( $errors as &$error ) {
} else {
$errors = $elements->getErrorsByType( $elementsType );
foreach ( $errors as &$error ) {
- // Input: array( 'message' => 'foo', 'errors' => array( 'a', 'b', 'c' ) )
- // Output: array( 'foo', 'a', 'b', 'c' )
+ // Input: [ 'message' => 'foo', 'errors' => [ 'a', 'b', 'c' ] ]
+ // Output: [ 'foo', 'a', 'b', 'c' ]
$error = array_merge( [ $error['message'] ], $error['params'] );
}
}
$error = array_merge( [ $error['message'] ], $error['params'] );
}
}
/**
* Get an array structure that looks like this:
*
/**
* Get an array structure that looks like this:
*
- * array(
- * 'visible' => array(
* 'Human-readable name' => 'Human readable value',
* ...
* 'Human-readable name' => 'Human readable value',
* ...
- * ),
- * 'collapsed' => array(
+ * ],
+ * 'collapsed' => [
* 'Human-readable name' => 'Human readable value',
* ...
* 'Human-readable name' => 'Human readable value',
* ...
* The UI will format this into a table where the visible fields are always
* visible, and the collapsed fields are optionally visible.
*
* The UI will format this into a table where the visible fields are always
* visible, and the collapsed fields are optionally visible.
*
/**
* Gets configuration for the file warning message. Return value of
* the following structure:
/**
* Gets configuration for the file warning message. Return value of
* the following structure:
* // Required, module with messages loaded for the client
* 'module' => 'example.filewarning.messages',
* // Required, array of names of messages
* // Required, module with messages loaded for the client
* 'module' => 'example.filewarning.messages',
* // Required, array of names of messages
* // Required, main warning message
* 'main' => 'example-filewarning-main',
* // Optional, header for warning dialog
* // Required, main warning message
* 'main' => 'example-filewarning-main',
* // Optional, header for warning dialog
* 'footer' => 'example-filewarning-footer',
* // Optional, text for more-information link (see below)
* 'info' => 'example-filewarning-info',
* 'footer' => 'example-filewarning-footer',
* // Optional, text for more-information link (see below)
* 'info' => 'example-filewarning-info',
* // Optional, link for more information
* 'link' => 'http://example.com',
* // Optional, link for more information
* 'link' => 'http://example.com',
*
* Returns null if no warning is necessary.
* @param File $file
*
* Returns null if no warning is necessary.
* @param File $file
* Values can be one of client, im, custom, gd, imext, or an array
* of object, method-name to call that specific method.
*
* Values can be one of client, im, custom, gd, imext, or an array
* of object, method-name to call that specific method.
*
- * If specifying a custom scaler command with array( Obj, method ),
+ * If specifying a custom scaler command with [ Obj, method ],
* the method in question should take 2 parameters, a File object,
* and a $scalerParams array with various options (See doTransform
* for what is in $scalerParams). On error it should return a
* the method in question should take 2 parameters, a File object,
* and a $scalerParams array with various options (See doTransform
* for what is in $scalerParams). On error it should return a
/**
* Takes a number of seconds and returns an array with a set of corresponding intervals.
/**
* Takes a number of seconds and returns an array with a set of corresponding intervals.
- * For example 65 will be turned into array( minutes => 1, seconds => 5 ).
+ * For example 65 will be turned into [ minutes => 1, seconds => 5 ].
// -{zh-hans:<span style="font-size:120%;">xxx</span>;zh-hant:\
// <span style="font-size:120%;">yyy</span>;}-
// we should split it as:
// -{zh-hans:<span style="font-size:120%;">xxx</span>;zh-hant:\
// <span style="font-size:120%;">yyy</span>;}-
// we should split it as:
// [0] => 'zh-hans:<span style="font-size:120%;">xxx</span>'
// [1] => 'zh-hant:<span style="font-size:120%;">yyy</span>'
// [2] => ''
// [0] => 'zh-hans:<span style="font-size:120%;">xxx</span>'
// [1] => 'zh-hant:<span style="font-size:120%;">yyy</span>'
// [2] => ''
$pat = '/;\s*(?=';
foreach ( $this->mVariants as $variant ) {
// zh-hans:xxx;zh-hant:yyy
$pat = '/;\s*(?=';
foreach ( $this->mVariants as $variant ) {
// zh-hans:xxx;zh-hant:yyy
*/
function commafy( $_ ) {
/* NO-op for Khmer. Cannot use
*/
function commafy( $_ ) {
/* NO-op for Khmer. Cannot use
- * $separatorTransformTable = array( ',' => '' )
+ * $separatorTransformTable = [ ',' => '' ]
* That would break when parsing and doing strstr '' => 'foo';
*/
return $_;
* That would break when parsing and doing strstr '' => 'foo';
*/
return $_;
*/
function commafy( $_ ) {
/* NO-op. Cannot use
*/
function commafy( $_ ) {
/* NO-op. Cannot use
- * $separatorTransformTable = array( ',' => '' )
+ * $separatorTransformTable = [ ',' => '' ]
* That would break when parsing and doing strstr '' => 'foo';
*/
return $_;
* That would break when parsing and doing strstr '' => 'foo';
*/
return $_;
* Mapping NS_xxx to array of GENDERKEY to alias.
* Example:
* @code
* Mapping NS_xxx to array of GENDERKEY to alias.
* Example:
* @code
- * $namespaceGenderAliases = array(
- * NS_USER => array( 'male' => 'Male_user', 'female' => 'Female_user' ),
- * );
+ * $namespaceGenderAliases = [
+ * NS_USER => [ 'male' => 'Male_user', 'female' => 'Female_user' ],
+ * ];
* @endcode
*/
$namespaceGenderAliases = [];
* @endcode
*/
$namespaceGenderAliases = [];
if ( !strcmp( $runMode, 'php' ) ) {
print "<?php\n";
if ( !strcmp( $runMode, 'php' ) ) {
print "<?php\n";
- print '$dupeMessages = array(' . "\n";
+ print '$dupeMessages = [' . "\n";
}
foreach ( $wgMessages[$langCodeC] as $key => $value ) {
foreach ( $wgMessages[$langCode] as $ckey => $cvalue ) {
}
foreach ( $wgMessages[$langCodeC] as $key => $value ) {
foreach ( $wgMessages[$langCode] as $ckey => $cvalue ) {
}
}
if ( !strcmp( $runMode, 'php' ) ) {
}
}
if ( !strcmp( $runMode, 'php' ) ) {
}
if ( !strcmp( $runMode, 'text' ) ) {
if ( $count == 1 ) {
}
if ( !strcmp( $runMode, 'text' ) ) {
if ( $count == 1 ) {
- $this->output( "OK\n\$digitTransformTable = array(\n" );
+ $this->output( "OK\n\$digitTransformTable = [\n" );
foreach ( $digitTransformTable as $latin => $translation ) {
$htmlent = utf8ToHexSequence( $translation );
$this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
}
foreach ( $digitTransformTable as $latin => $translation ) {
$htmlent = utf8ToHexSequence( $translation );
$this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
}
- $this->output( ");\n" );
+ $this->output( "];\n" );
public $minLength = 0;
public $maxLength = 20;
public $maxTemplates = 5;
public $minLength = 0;
public $maxLength = 20;
public $maxTemplates = 5;
- // public $outputTypes = array( 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' );
+ // public $outputTypes = [ 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' ];
public $entryPoints = [ 'testSrvus', 'testPst', 'testPreprocess' ];
public $verbose = false;
public $entryPoints = [ 'testSrvus', 'testPst', 'testPreprocess' ];
public $verbose = false;
if ( $text === false ) {
$this->error( "\nError, unable to get text in old_id $oldid" );
if ( $text === false ) {
$this->error( "\nError, unable to get text in old_id $oldid" );
- # $dbw->delete( 'old', array( 'old_id' => $oldid ) );
+ # $dbw->delete( 'old', [ 'old_id' => $oldid ] );
}
if ( $extdb == "" && $j == 0 ) {
}
if ( $extdb == "" && $j == 0 ) {
- * Given array( array('x' => 10, 'y' => 20), array( 'x' => 30, y=> 5 ) )
+ * Given [ [ 'x' => 10, 'y' => 20 ], [ 'x' => 30, y=> 5 ] ]
* returns "10,20 30,5"
* Useful for SVG and imagemagick command line arguments
* @param array $shape Array of arrays, each array containing x & y keys mapped to numeric values
* returns "10,20 30,5"
* Useful for SVG and imagemagick command line arguments
* @param array $shape Array of arrays, each array containing x & y keys mapped to numeric values
/**
* Get an array of random pairs of random words, like
/**
* Get an array of random pairs of random words, like
- * array( array( 'foo', 'bar' ), array( 'quux', 'baz' ) );
+ * [ [ 'foo', 'bar' ], [ 'quux', 'baz' ] ];
*
* @param int $number Number of pairs
* @return array Two-element arrays
*
* @param int $number Number of pairs
* @return array Two-element arrays