Commit a4ed0d65 authored by Michael Chaudhary's avatar Michael Chaudhary Committed by Robert Nix

Update Arrays for 1.33

parent 80015f0e
*~
*.kate-swp
.*.swp
node_modules/**
vendor/**
composer.lock
[gerrit]
host=gerrit.wikimedia.org
port=29418
project=mediawiki/extensions/Arrays.git
track=1
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamName" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingReturn" />
<exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" />
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
<exclude name="PSR2.Classes.PropertyDeclaration.ScopeMissing" />
<exclude name="Squiz.Scope.MemberVarScope.Missing" />
<exclude name="Squiz.Scope.MethodScope.Missing" />
</rule>
<rule ref="MediaWiki.NamingConventions.ValidGlobalName">
<properties>
<property name="allowedPrefixes" type="array" value="eg,wg" />
</properties>
</rule>
<file>.</file>
<arg name="extensions" value="php,php5,inc"/>
<arg name="encoding" value="UTF-8"/>
</ruleset>
......@@ -6,28 +6,28 @@
* @file
* @ingroup Arrays
*
* @licence MIT License
* @license MIT
*/
$magicWords = array();
$magicWords = [];
$magicWords['en'] = array(
'arraydefine' => array( 0, 'arraydefine' ),
$magicWords['en'] = [
'arraydefine' => [ 0, 'arraydefine' ],
'arrayprint' => array( 0, 'arrayprint' ),
'arraysize' => array( 0, 'arraysize' ),
'arrayindex' => array( 0, 'arrayindex' ),
'arraysearch' => array( 0, 'arraysearch' ),
'arrayprint' => [ 0, 'arrayprint' ],
'arraysize' => [ 0, 'arraysize' ],
'arrayindex' => [ 0, 'arrayindex' ],
'arraysearch' => [ 0, 'arraysearch' ],
'arrayunique' => array( 0, 'arrayunique' ),
'arraysort' => array( 0, 'arraysort' ),
'arrayreset' => array( 0, 'arrayreset' ),
'arrayunique' => [ 0, 'arrayunique' ],
'arraysort' => [ 0, 'arraysort' ],
'arrayreset' => [ 0, 'arrayreset' ],
'arraymerge' => array( 0, 'arraymerge' ),
'arrayslice' => array( 0, 'arrayslice' ),
'arraymerge' => [ 0, 'arraymerge' ],
'arrayslice' => [ 0, 'arrayslice' ],
'arrayunion' => array( 0, 'arrayunion' ),
'arrayintersect' => array( 0, 'arrayintersect' ),
'arraydiff' => array( 0, 'arraydiff' ),
'arraysearcharray' => array( 0, 'arraysearcharray' ),
);
'arrayunion' => [ 0, 'arrayunion' ],
'arrayintersect' => [ 0, 'arrayintersect' ],
'arraydiff' => [ 0, 'arraydiff' ],
'arraysearcharray' => [ 0, 'arraysearcharray' ],
];
<?php
/**
* This is a backwards-compatibility shim, generated by:
* https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
*
* Beginning with MediaWiki 1.23, translation strings are stored in json files,
* and the EXTENSION.i18n.php file only exists to provide compatibility with
* older releases of MediaWiki. For more information about this migration, see:
* https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
*
* This shim maintains compatibility back to MediaWiki 1.17.
*/
$messages = array();
if ( !function_exists( 'wfJsonI18nShim0d00d0d3c8390a97' ) ) {
function wfJsonI18nShim0d00d0d3c8390a97( $cache, $code, &$cachedData ) {
$codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
foreach ( $codeSequence as $csCode ) {
$fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
if ( is_readable( $fileName ) ) {
$data = FormatJson::decode( file_get_contents( $fileName ), true );
foreach ( array_keys( $data ) as $key ) {
if ( $key === '' || $key[0] === '@' ) {
unset( $data[$key] );
}
}
$cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
}
$cachedData['deps'][] = new FileDependency( $fileName );
}
return true;
}
$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShim0d00d0d3c8390a97';
}
<?php
/**
* Initialization file for the 'Arrays' (former 'ArrayExtension') extension.
*
* Documentation: https://www.mediawiki.org/wiki/Extension:Arrays
* Support: https://www.mediawiki.org/wiki/Extension_talk:Arrays
* Source code: https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Arrays
*
* @file
* @ingroup Arrays
*
* @license MIT
* @version: 2.2.0
*
* @author Li Ding < lidingpku@gmail.com >
* @author Jie Bao
* @author Daniel Werner < danweetz@web.de > (since version 1.3)
*/
if ( function_exists( 'wfLoadExtension' ) ) {
wfLoadExtension( 'Arrays' );
// Keep i18n globals so mergeMessageFileList.php doesn't break
$wgMessagesDirs['Arrays'] = __DIR__ . '/i18n';
wfWarn(
'Deprecated PHP entry point used for the Arrays extension. ' .
'Please use wfLoadExtension instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
);
return;
} else {
die( 'This version of the Arrays extension requires MediaWiki 1.30+' );
}
<?php
/**
* File defining the settings for the 'Arrays' extension.
* More info can be found at https://www.mediawiki.org/wiki/Extension:Arrays#Configuration
*
* NOTICE:
* =======
* Changing one of these settings can be done by copying and placing
* it in LocalSettings.php, AFTER the inclusion of 'Arrays'.
*
* @file
* @ingroup Arrays
* @since 2.0
*
* @author Daniel Werner
*/
/**
* Set to false by default since version 2.0.
*
* @since 2.0 (as '$egArrayExtensionCompatbilityMode' in 1.4 alpha)
*
* @var boolean
*/
$egArraysCompatibilityMode = false;
/**
* Contains a key-value pair list of characters that should be replaced by a template or parser function
* call within array values included into an '#arrayprint'. By replacing these special characters before
* including the values into the string which is being expanded afterwards, array values can't distract
* the surrounding MW code. Otherwise the array values themselves would be parsed as well.
*
* This has no effect in case $egArraysCompatibilityMode is set to false! If set to null, Arrays will
* jump to compatibility mode behavior on this, independently from $egArraysCompatibilityMode.
*
* @since 2.0
*
* @var string[]|null
*/
$egArraysExpansionEscapeTemplates = [
'=' => '{{=}}',
'|' => '{{!}}',
'{{' => '{{((}}',
'}}' => '{{))}}'
];
The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct).
......@@ -10,7 +10,8 @@ module.exports = function ( grunt ) {
jsonlint: {
all: [
'**/*.json',
'!node_modules/**'
'!node_modules/**',
'!vendor/**'
]
}
} );
......
......@@ -3,7 +3,7 @@
The 'Arrays' extension (former 'ArrayExtension') Enhances the parser with
functions to handle arrays within wiki markup text.
* Website: http://www.mediawiki.org/wiki/Extension:Arrays
* Website: https://www.mediawiki.org/wiki/Extension:Arrays
* Authors: Li Ding, Jie Bao, Daniel Werner < danweetz@web.de >
* License: MIT license
......@@ -18,7 +18,7 @@ MediaWiki 'extensions' directory. Then add the following code to your
require_once( "$IP/extensions/Arrays/Arrays.php" );
Be aware of breaking behavioral changes introduced after version 1.3.2. There
is a new configuration variable '$wgEGArraysCompatibilityMode' for switching back
is a new configuration variable '$egArraysCompatibilityMode' for switching back
to old behavior though. For further information see the 'RELEASE-NOTES' file.
You will want to install the Loops and Variables extensions to fully take
......@@ -29,4 +29,4 @@ advantage of this extension. Follow their installation procedures.
If you have bug reports or feature requests, please add them to the 'Arrays'
Talk page [0]. You can also send them to Daniel Werner < danweetz@web.de >
[0] http://www.mediawiki.org/w/index.php?title=Extension_talk:Arrays
[0] https://www.mediawiki.org/w/index.php?title=Extension_talk:Arrays
......@@ -20,7 +20,7 @@
* December 4, 2011 -- Version 2.0rc1
This release is built upon 1.4 alpha. See changes of 1.4 alpha as well.
'ArrayExtension' is now simply called 'Arrays'. Therefore you have to adjust your LocalSettings.php.
- Compatibility mode variable '$wgEGArraysCompatibilityMode' ('$egArrayExtensionCompatbilityMode' in
- Compatibility mode variable '$egArraysCompatibilityMode' ('$egArrayExtensionCompatbilityMode' in
Version 1.4 alpha) is set to false by default. See Version 1.4 alpha for further information.
- Additional changes to the compatibility mode behavior in version 2.0 include:
+ '#arrayindex' will return its default also in case of existing index but empty value. This
......@@ -30,7 +30,7 @@
+ Default separator for '#arrayprint' now is the languages default separator instead of ', '.
+ '#arrayprint' will no longer expand the given wiki markup twice. Instead, it will escape special
characters of array values before they will be inserted into the markup. This way it won't be
possible anymore that array values can break the functions output. '$wgEGArraysExpansionEscapeTemplates'
possible anymore that array values can break the functions output. '$egArraysExpansionEscapeTemplates'
defines which special characters should be escaped by which template/parser function.
+ *** See 1.4 alpha for previous changes ***
- '#arrayindex' will only expand options/default when required.
......@@ -43,7 +43,7 @@
- If 'Regex Fun' extension is installed, '#arraysearcharray' can use Regex Funs 'e' flag feature
for transforming the result and at the same time parsing them after each back-reference inclusion.
- 1.4 alpha bug solved, '#arraysearcharray' with empty string as start index was interpreted as 0.
- class 'ArrayExtension' renamed to 'ArraysHooks'.
- class 'ArrayExtension' renamed to 'ExtArrays'.
* November 20, 2001 -- Version 1.4 alpha (r103716)
......
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "1.0.0",
"jakub-onderka/php-console-highlighter": "0.3.2",
"mediawiki/minus-x": "0.3.1",
"mediawiki/mediawiki-codesniffer": "24.0.0"
},
"scripts": {
"test": [
"parallel-lint . --exclude vendor --exclude node_modules",
"minus-x check .",
"phpcs -sp"
],
"fix": [
"minus-x fix .",
"phpcbf"
]
}
}
{
"name": "Arrays",
"version": "3.0",
"version": "2.2.0",
"author": [
"Li Ding",
"Jie Bao",
......@@ -10,6 +10,9 @@
"descriptionmsg": "arrays-desc",
"license-name": "MIT",
"type": "parserhook",
"requires": {
"MediaWiki": ">= 1.31.0"
},
"MessagesDirs": {
"Arrays": [
"i18n"
......@@ -18,25 +21,38 @@
"ExtensionMessagesFiles": {
"ArraysMagic": "Arrays.i18n.magic.php"
},
"AutoloadClasses": {
"ArraysHooks": "Arrays.hooks.php"
},
"Hooks": {
"ParserFirstCallInit": "ArraysHooks::onParserFirstCallInit",
"ParserClearState": "ArraysHooks::onParserClearState"
"ParserFirstCallInit": "ExtArrays::init",
"ParserClearState": "ExtArrays::onParserClearState"
},
"ParserTestFiles": [
"arrayParserTests.txt",
"arrayLoopsInteractionParserTests.txt"
],
"config_prefix": "eg",
"config": {
"EGArraysCompatibilityMode": false,
"EGArraysExpansionEscapeTemplates": {
"=": "{{=}}",
"|": "{{!}}",
"{{": "{{((}}",
"}}": "{{))}}"
"ArraysCompatibilityMode": {
"description": "Set to false by default since version 2.0.",
"value": false
},
"ArraysExpansionEscapeTemplates": {
"description": "Contains a key-value pair list of characters that should be replaced by a template or parser function call within array values included into an '#arrayprint'. By replacing these special characters before including the values into the string which is being expanded afterwards, array values can't distract the surrounding MW code. Otherwise the array values themselves would be parsed as well.\n\nThis has no effect in case $egArraysCompatibilityMode is set to false! If set to null, Arrays will jump to compatibility mode behavior on this, independently from $egArraysCompatibilityMode.",
"value": [
{
"=": "{{=}}"
},
{
"|": "{{!}}"
},
{
"{{": "{{((}}"
},
{
"}}": "{{))}}"
}
]
}
},
"manifest_version": 1
"AutoloadClasses": {
"ExtArrays": "ExtArrays.php"
},
"manifest_version": 2
}
{"headSHA1": "fc96f77abab5cf4d81f1092ea60c2daea3a82d1e\n", "head": "fc96f77abab5cf4d81f1092ea60c2daea3a82d1e\n", "remoteURL": "https://gerrit.wikimedia.org/r/mediawiki/extensions/Arrays", "branch": "fc96f77abab5cf4d81f1092ea60c2daea3a82d1e\n", "headCommitDate": "1478816731"}
\ No newline at end of file
{"head": "f16009178d8d70005965ef9e55e1ec442b9127bc\n", "remoteURL": "https://gerrit.wikimedia.org/r/mediawiki/extensions/Arrays", "headCommitDate": "1550269752", "branch": "f16009178d8d70005965ef9e55e1ec442b9127bc\n", "headSHA1": "f16009178d8d70005965ef9e55e1ec442b9127bc\n"}
\ No newline at end of file
{
"@metadata": {
"authors": [
"ShockD"
]
},
"arrays-desc": "Съхраняване и изчисление на наименувани масиви."
}
{
"@metadata": {
"authors": [
"Mikel Ibaiba"
]
},
"arrays-desc": "Sailkatu eta konpilatu izendatutako matrizeak"
}
{
"@metadata": {
"authors": [
"Pyscowicz"
]
},
"arrays-desc": "Säilöö ja laskee nimetyt ryhmät"
}
{
"@metadata": {
"authors": [
"Innocentbunny"
]
},
"arrays-desc": "नामित ऐरे को सहेजें और कंप्यूट करें"
}
{
"@metadata": {
"authors": [
"Jagwar"
]
},
"arrays-desc": "Hitahiry ary mandika ny tabilao misy anarana"
}
{
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"grunt": "0.4.5",
"grunt-cli": "0.1.13",
"grunt-banana-checker": "0.4.0",
"grunt-jsonlint": "1.0.7"
}
"private": true,
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"grunt": "1.0.3",
"grunt-banana-checker": "0.4.0",
"grunt-jsonlint": "1.0.7"
}
}
......@@ -2,7 +2,7 @@
# Author: Daniel Werner
# Generate required templates.
# These are the defaults set in $wgEGArraysExpansionEscapeTemplates
# These are the defaults set in $egArraysExpansionEscapeTemplates
!!article
Template:((
!!text
......@@ -18,20 +18,12 @@ Template:))
!!article
Template:=
!!text
=
!!endarticle
!!article
Template:!
!!text
|
<nowiki>=</nowiki>
!!endarticle
!! functionhooks
arrayprint
!! endfunctionhooks
!! functionhooks
loop
!! endfunctionhooks
......
......@@ -2,7 +2,7 @@
# Author: Daniel Werner
# Generate required templates.
# These are the defaults set in $wgEGArraysExpansionEscapeTemplates
# These are the defaults set in $egArraysExpansionEscapeTemplates
!!article
Template:((
!!text
......@@ -18,13 +18,7 @@ Template:))
!!article
Template:=
!!text
=
!!endarticle
!!article
Template:!
!!text
|
<nowiki>=</nowiki>
!!endarticle
......@@ -137,7 +131,7 @@ Parser function within 'arrayprint'
!! test
Test whether escaping special chars in 'arrayprint' works (this is related to $wgEGArraysExpansionEscapeTemplates )
Test whether escaping special chars in 'arrayprint' works (this is related to $egArraysExpansionEscapeTemplates )
!! input
{{#arraydefine: a | a{{))}}, {{!}}bb=bb, cc{{))}}c}}
"{{#arrayprint: a | , | @ | @ }}"
......
Arrays: master
2016-11-10T23:00:52
Arrays: REL1_33
2019-06-17T19:00:42
fc96f77
f160091
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment