r105131 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105130‎ | r105131 | r105132 >
Date:23:01, 4 December 2011
Author:danwe
Status:deferred
Tags:
Comment:
Tag for 'Arrays' 2.0rc1, r105119
Modified paths:
  • /tags/extensions/Arrays (added) (history)
  • /tags/extensions/Arrays/REL_2_0rc1 (added) (history)
  • /tags/extensions/Arrays/REL_2_0rc1/Arrays.i18n.magic.php (added) (history)
  • /tags/extensions/Arrays/REL_2_0rc1/Arrays.i18n.php (added) (history)
  • /tags/extensions/Arrays/REL_2_0rc1/Arrays.php (added) (history)
  • /tags/extensions/Arrays/REL_2_0rc1/Arrays_Settings.php (added) (history)
  • /tags/extensions/Arrays/REL_2_0rc1/COPYING (added) (history)
  • /tags/extensions/Arrays/REL_2_0rc1/README (added) (history)
  • /tags/extensions/Arrays/REL_2_0rc1/RELEASE-NOTES (added) (history)

Diff [purge]

Index: tags/extensions/Arrays/REL_2_0rc1/Arrays.i18n.magic.php
@@ -0,0 +1,33 @@
 2+<?php
 3+
 4+/**
 5+ * Internationalization file for magic words in the 'Arrays' extension.
 6+ *
 7+ * @file Arrays.i18n.magic.php
 8+ * @ingroup Arrays
 9+ *
 10+ * @licence MIT License
 11+ */
 12+
 13+$magicWords = array();
 14+
 15+$magicWords['en'] = array(
 16+ 'arraydefine' => array( 0, 'arraydefine' ),
 17+
 18+ 'arrayprint' => array( 0, 'arrayprint' ),
 19+ 'arraysize' => array( 0, 'arraysize' ),
 20+ 'arrayindex' => array( 0, 'arrayindex' ),
 21+ 'arraysearch' => array( 0, 'arraysearch' ),
 22+
 23+ 'arrayunique' => array( 0, 'arrayunique' ),
 24+ 'arraysort' => array( 0, 'arraysort' ),
 25+ 'arrayreset' => array( 0, 'arrayreset' ),
 26+
 27+ 'arraymerge' => array( 0, 'arraymerge' ),
 28+ 'arrayslice' => array( 0, 'arrayslice' ),
 29+
 30+ 'arrayunion' => array( 0, 'arrayunion' ),
 31+ 'arrayintersect' => array( 0, 'arrayintersect' ),
 32+ 'arraydiff' => array( 0, 'arraydiff' ),
 33+ 'arraysearcharray' => array( 0, 'arraysearcharray' ),
 34+);
Property changes on: tags/extensions/Arrays/REL_2_0rc1/Arrays.i18n.magic.php
___________________________________________________________________
Added: svn:eol-style
135 + native
Index: tags/extensions/Arrays/REL_2_0rc1/Arrays.i18n.php
@@ -0,0 +1,305 @@
 2+<?php
 3+
 4+/**
 5+ * Internationalization file for the 'Arrays' extension.
 6+ *
 7+ * @since 1.3.4
 8+ *
 9+ * @file Arrays.i18n.php
 10+ * @ingroup Arrays
 11+ *
 12+ * @licence MIT License
 13+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 14+ */
 15+
 16+$messages = array();
 17+
 18+/** English
 19+ * @author Jeroen De Dauw
 20+ */
 21+$messages['en'] = array(
 22+ 'arrays-desc' => 'Store and compute named arrays',
 23+);
 24+
 25+/** Message documentation (Message documentation)
 26+ * @author Purodha
 27+ * @author Raymond
 28+ */
 29+$messages['qqq'] = array(
 30+ 'arrays-desc' => '{{desc}}',
 31+);
 32+
 33+/** Arabic (العربية)
 34+ * @author Ciphers
 35+ */
 36+$messages['ar'] = array(
 37+ 'arrays-desc' => 'تخزين وحساب مصفوفات مسماة',
 38+);
 39+
 40+/** Asturian (Asturianu)
 41+ * @author Xuacu
 42+ */
 43+$messages['ast'] = array(
 44+ 'arrays-desc' => 'Almacenar y calcular matrices con nome',
 45+);
 46+
 47+/** Bashkir (Башҡортса)
 48+ * @author Assele
 49+ */
 50+$messages['ba'] = array(
 51+ 'arrays-desc' => 'Исемләнгән массивтарҙы һаҡлау һәм иҫәпләү',
 52+);
 53+
 54+/** Belarusian (Taraškievica orthography) (‪Беларуская (тарашкевіца)‬)
 55+ * @author EugeneZelenko
 56+ */
 57+$messages['be-tarask'] = array(
 58+ 'arrays-desc' => 'Захаваньне і вылічэньне масіваў з назвамі',
 59+);
 60+
 61+/** Breton (Brezhoneg)
 62+ * @author Fulup
 63+ */
 64+$messages['br'] = array(
 65+ 'arrays-desc' => 'Enrollañ ha plediñ gant an taolennoù anvet',
 66+);
 67+
 68+/** Bosnian (Bosanski)
 69+ * @author CERminator
 70+ */
 71+$messages['bs'] = array(
 72+ 'arrays-desc' => 'Sačuvaj i izračunaj imenovane nizove',
 73+);
 74+
 75+/** Welsh (Cymraeg)
 76+ * @author Pwyll
 77+ */
 78+$messages['cy'] = array(
 79+ 'arrays-desc' => "Storio a chyfrifo trefnau wedi'u henwi",
 80+);
 81+
 82+/** German (Deutsch)
 83+ * @author Kghbln
 84+ */
 85+$messages['de'] = array(
 86+ 'arrays-desc' => 'Ermöglicht das Speichern und Nutzen definierter Datenreihen (Arrays)',
 87+);
 88+
 89+/** Lower Sorbian (Dolnoserbski)
 90+ * @author Michawiki
 91+ */
 92+$messages['dsb'] = array(
 93+ 'arrays-desc' => 'Zmóžnja składowanje a woblicenje pomjenjonych pólowych wariablow',
 94+);
 95+
 96+/** French (Français)
 97+ * @author Wyz
 98+ */
 99+$messages['fr'] = array(
 100+ 'arrays-desc' => 'Enregistrer et traiter les tableaux nommés',
 101+);
 102+
 103+/** Franco-Provençal (Arpetan)
 104+ * @author ChrisPtDe
 105+ */
 106+$messages['frp'] = array(
 107+ 'arrays-desc' => 'Encartar et trètar los tablôs apelâs',
 108+);
 109+
 110+/** Galician (Galego)
 111+ * @author Toliño
 112+ */
 113+$messages['gl'] = array(
 114+ 'arrays-desc' => 'Almacenar e calcular táboas con nomes',
 115+);
 116+
 117+/** Swiss German (Alemannisch)
 118+ * @author Als-Holder
 119+ */
 120+$messages['gsw'] = array(
 121+ 'arrays-desc' => 'Macht s Spychere un Nutze vu definierte Datezylete megli',
 122+);
 123+
 124+/** Hebrew (עברית)
 125+ * @author Amire80
 126+ */
 127+$messages['he'] = array(
 128+ 'arrays-desc' => 'אחסון וחישוב של מערכים בעלי שמות',
 129+);
 130+
 131+/** Upper Sorbian (Hornjoserbsce)
 132+ * @author Michawiki
 133+ */
 134+$messages['hsb'] = array(
 135+ 'arrays-desc' => 'Pomjenowane polowe wariable składować a wobličić',
 136+);
 137+
 138+/** Hungarian (Magyar)
 139+ * @author Dj
 140+ */
 141+$messages['hu'] = array(
 142+ 'arrays-desc' => 'Nevesített tömbök tárolása és számítása',
 143+);
 144+
 145+/** Interlingua (Interlingua)
 146+ * @author McDutchie
 147+ */
 148+$messages['ia'] = array(
 149+ 'arrays-desc' => 'Immagazinar e computar arrays nominate',
 150+);
 151+
 152+/** Indonesian (Bahasa Indonesia)
 153+ * @author IvanLanin
 154+ */
 155+$messages['id'] = array(
 156+ 'arrays-desc' => 'Menyimpan dan menghitung larik bernama',
 157+);
 158+
 159+/** Italian (Italiano)
 160+ * @author Beta16
 161+ */
 162+$messages['it'] = array(
 163+ 'arrays-desc' => 'Memorizza e calcola matrici di nomi',
 164+);
 165+
 166+/** Colognian (Ripoarisch)
 167+ * @author Purodha
 168+ */
 169+$messages['ksh'] = array(
 170+ 'arrays-desc' => 'Felder met Name berääschne un faßhallde.',
 171+);
 172+
 173+/** Luxembourgish (Lëtzebuergesch)
 174+ * @author Robby
 175+ */
 176+$messages['lb'] = array(
 177+ 'arrays-desc' => 'Späicheren a Benotze vun definéierten Tabellen',
 178+);
 179+
 180+/** Lithuanian (Lietuvių)
 181+ * @author Ignas693
 182+ */
 183+$messages['lt'] = array(
 184+ 'arrays-desc' => 'Saugoti ir apskaičiuoti pavadintas masyvai',
 185+);
 186+
 187+/** Macedonian (Македонски)
 188+ * @author Bjankuloski06
 189+ */
 190+$messages['mk'] = array(
 191+ 'arrays-desc' => 'Складирај и пресметај именувани низи',
 192+);
 193+
 194+/** Malay (Bahasa Melayu)
 195+ * @author Anakmalaysia
 196+ */
 197+$messages['ms'] = array(
 198+ 'arrays-desc' => 'Menyimpan dan mengira tatasusunan bernama',
 199+);
 200+
 201+/** Dutch (Nederlands)
 202+ * @author Siebrand
 203+ */
 204+$messages['nl'] = array(
 205+ 'arrays-desc' => 'Benoemde verzamelingen opslaan en berekenen',
 206+);
 207+
 208+/** Norwegian (bokmål)‬ (‪Norsk (bokmål)‬)
 209+ * @author Nghtwlkr
 210+ */
 211+$messages['no'] = array(
 212+ 'arrays-desc' => 'Lagre og beregne navngitte tabeller',
 213+);
 214+
 215+/** Polish (Polski)
 216+ * @author Sp5uhe
 217+ */
 218+$messages['pl'] = array(
 219+ 'arrays-desc' => 'Przechowywanie i przeliczanie nazwanych tabel',
 220+);
 221+
 222+/** Piedmontese (Piemontèis)
 223+ * @author Borichèt
 224+ * @author Dragonòt
 225+ */
 226+$messages['pms'] = array(
 227+ 'arrays-desc' => 'Memorisé e calcolé le tàule nominà',
 228+);
 229+
 230+/** Portuguese (Português)
 231+ * @author Hamilton Abreu
 232+ */
 233+$messages['pt'] = array(
 234+ 'arrays-desc' => 'Armazenar e calcular matrizes designadas',
 235+);
 236+
 237+/** Brazilian Portuguese (Português do Brasil)
 238+ * @author Giro720
 239+ */
 240+$messages['pt-br'] = array(
 241+ 'arrays-desc' => 'Armazenar e calcular matrizes designadas',
 242+);
 243+
 244+/** Tarandíne (Tarandíne)
 245+ * @author Joetaras
 246+ */
 247+$messages['roa-tara'] = array(
 248+ 'arrays-desc' => 'Stipe e calcole le array nomenate',
 249+);
 250+
 251+/** Russian (Русский)
 252+ * @author Александр Сигачёв
 253+ */
 254+$messages['ru'] = array(
 255+ 'arrays-desc' => 'Хранение и вычисление именованных массивов',
 256+);
 257+
 258+/** Slovenian (Slovenščina)
 259+ * @author Dbc334
 260+ */
 261+$messages['sl'] = array(
 262+ 'arrays-desc' => 'Shrani in izračuna imenovana polja',
 263+);
 264+
 265+/** Swedish (Svenska)
 266+ * @author WikiPhoenix
 267+ */
 268+$messages['sv'] = array(
 269+ 'arrays-desc' => 'Lagra och beräkna namngivna arrayer',
 270+);
 271+
 272+/** Tagalog (Tagalog)
 273+ * @author AnakngAraw
 274+ */
 275+$messages['tl'] = array(
 276+ 'arrays-desc' => 'Itabi at tuusin ang pinangalanang mga hanay',
 277+);
 278+
 279+/** Turkish (Türkçe)
 280+ * @author Khutuck
 281+ */
 282+$messages['tr'] = array(
 283+ 'arrays-desc' => 'İsimlendirilmiş dizileri sakla ve hsapla',
 284+);
 285+
 286+/** Ukrainian (Українська)
 287+ * @author Sodmy
 288+ */
 289+$messages['uk'] = array(
 290+ 'arrays-desc' => 'Зберігання та обчислення іменованих масивів',
 291+);
 292+
 293+/** Veps (Vepsan kel')
 294+ * @author Игорь Бродский
 295+ */
 296+$messages['vep'] = array(
 297+ 'arrays-desc' => 'Varata da lugeda nimitadud massivad',
 298+);
 299+
 300+/** Simplified Chinese (‪中文(简体)‬)
 301+ * @author Hydra
 302+ */
 303+$messages['zh-hans'] = array(
 304+ 'arrays-desc' => '存储和计算指定的数组',
 305+);
 306+
Property changes on: tags/extensions/Arrays/REL_2_0rc1/Arrays.i18n.php
___________________________________________________________________
Added: svn:eol-style
1307 + native
Index: tags/extensions/Arrays/REL_2_0rc1/RELEASE-NOTES
@@ -0,0 +1,159 @@
 2+ Changelog:
 3+ ==========
 4+
 5+ * December 4, 2011 -- Version 2.0rc
 6+ This release is built upon 1.4 alpha. See changes of 1.4 alpha as well.
 7+ 'ArrayExtension' is now simply called 'Arrays'. Therefore you have to adjust your LocalSettings.php.
 8+ - Compatibility mode variable '$egArraysCompatibilityMode' ('$egArrayExtensionCompatbilityMode' in
 9+ Version 1.4 alpha) is set to false by default. See Version 1.4 alpha for further information.
 10+ - Additional changes to the compatibility mode behavior in version 2.0 include:
 11+ + '#arrayindex' will return its default also in case of existing index but empty value. This
 12+ makes the function consistent with Variables '#var' and hash tables '#hashvalue'.
 13+ + '#arraymerge', '#arrayunion', '#arraydiff' and '#arrayintersect' with only one array for
 14+ the operation will make a copy of that array instead of creating no array at all.
 15+ + Default separator for '#arrayprint' now is the languages default separator instead of ', '.
 16+ + '#arrayprint' will no longer expand the given wiki markup twice. Instead, it will escape special
 17+ characters of array values before they will be inserted into the markup. This way it won't be
 18+ possible anymore that array values can break the functions output. '$egArraysExpansionEscapeTemplates'
 19+ defines which special characters should be escaped by which template/parser function.
 20+ + *** See 1.4 alpha for previous changes ***
 21+ - '#arrayindex' will only expand options/default when required.
 22+ - '#arraymerge', '#arrayunion', '#arraydiff' and '#arrayintersect' can handle multiple arrays now.
 23+ - '#arraydefine' option 'print' no longer supports 'print=print' and parameters beyond options.
 24+ This functionality never worked reliably anyways. 'print=list' still works.
 25+ - '#arrayprint' now has a new parameter for options. Option 'print=pretty' will print a list where
 26+ the last two strings are chained with an ' and ' or the local languages equivalent. 'print=pretty'
 27+ also can be used as option within '#arraydefine'.
 28+ - If 'Regex Fun' extension is installed, '#arraysearcharray' can use Regex Funs 'e' flag feature
 29+ for transforming the result and at the same time parsing them after each back-reference inclusion.
 30+ - 1.4 alpha bug solved, '#arraysearcharray' with empty string as start index was interpreted as 0.
 31+ - class 'ArrayExtension' renamed to 'ExtArrays'.
 32+
 33+
 34+ * November 20, 2001 -- Version 1.4 alpha (r103716)
 35+ This release introduces some useful bugfixes and optional new behavior for various functionality.
 36+ This version never made it into a final stage because version 2.0 will introduce some rather
 37+ radical changes, so this alpha release allows to profit from bugfixes that might be quite useful
 38+ if you don't want to use Version 2.0 for some reason.
 39+ - Configuration variable '$egArrayExtensionCompatbilityMode' for deactivating the following newly
 40+ introduced breaking changes:
 41+ + '#arrayprint' no longer returns an error text in case the array doesn't exist.
 42+ + '#arrayreset' now uses n parameters instead of ',' as separator for n arrays to reset
 43+ + '#arrayindex' options removed, instead third parameter simply is the default value (without
 44+ any 'default=' in front).
 45+ + '#arraysearch' returns an empty string '' instead of '-1' in case nothing was found.
 46+ + '#arraysearcharray' and '#arrayslice' without all necessary parameters set will always create
 47+ a new empty array.
 48+ Compatibility mode is active by default. In Version 2.0 it will be set to inactive by default.
 49+ - '#arraysearch' will only expand 'yes' or 'no' if given, but never both.
 50+ - negative indexes for '#arrayindex', '#arraysearch' and '#arraysearcharray' are possible now.
 51+ - bugfix in '#arraysearcharray', index and limit working fine now.
 52+ - arrayprint will handle <includeonly>/<noinclude> correct in case it's used in a template.
 53+ - Internationalization for several languages added.
 54+ - moved into mediawiki.org svn repository.
 55+
 56+
 57+ * January 24, 2011 -- Version 1.3.2
 58+ - New public class methods for creating and removing arrays. Good for use by other extensions.
 59+ - VERSION constant added to ArrayExtension class
 60+
 61+ * July 20, 2010 -- Version 1.3.1
 62+ - Removed critical bug. Some kind of "Superglobal" Arrays on page imports and job queue jobs.
 63+ Values were passed from one page to another page.
 64+
 65+ * July 5, 2010 -- Version 1.3
 66+ - update arrayunion and arraydiff, fixed heavy bug (gaps between array indexes doing some serious
 67+ trouble in other arrayfunctions like arraysearch)
 68+ - array function ''#arraysearcharray'' added
 69+ - '#arraysearch' code cleanup, search parameter is optional now, searching for empty elements is
 70+ possible now
 71+ - advanced check for regular expressions in '#arraysearch,' '#arraydefine' and '#arraysearcharray'
 72+ Pivate function isValidRegEx() added
 73+ - '#arraymerge' bug fixed: Php message in case of non existant seccond array
 74+ - now using preg_quote in arraydefine when using a non regular expression delimiter
 75+ - some minor code changes and cleanup
 76+
 77+
 78+ * January 23, 2010 -- Version 1.2.4
 79+ - update arraydefine, add more parameter for combining print with arraydefine
 80+
 81+ * July 16, 2009 -- Version 1.2.3
 82+ - update arrayunique, fixed bug (empty string should be eliminated in array after arrayunique)
 83+
 84+ * July 16, 2009 -- Version 1.2.2
 85+ - update arrayunique, fixed bug (zero mistakenly eliminated in array after arrayunique)
 86+ - rename key=>arrayid, should not affect any existing users
 87+ - rename validate_array_by_name to validate_array_by_arrayid
 88+ - add "asc" as option of arraysort
 89+
 90+ * May 03, 2009 -- Version 1.2.1
 91+ - update arraydefine by adding options: "unique"; sort=( "desc", "asce", "random", "reverse"), and
 92+ print=( "list" ). Options are diliminated by comma, e.g. "unique, sort=desc,print=list".
 93+ - fixed bug in arrayslice (offset can be greater than array size): if offset is no less than array
 94+ size, empty array will be returned, if offset if no greater than negative array size, a new array
 95+ with all elements will be returned
 96+ - update arrayindex by adding print option when (i) the array is not defined; (ii) the index is not
 97+ valid in the specified array: e.g. "default=bad array"
 98+
 99+ * April 24, 2009 -- Version 1.2
 100+ - fixed a bug in arrayslice, (offset=0)
 101+ - clean up code, added two private functions, validate_array_index, validate_array_offset,
 102+ validate_array_by_arrayid; rename some parameters key=> new_key, differentiate offset and index
 103+
 104+ * April 18, 2009 -- Version 1.1.6
 105+ - fixed a bug in arraymerge and arrayslice,
 106+
 107+ * Mar 17, 2009 -- Version 1.1.5
 108+ - update '#arraysort,' add "reverse" option, http://us3.php.net/manual/en/function.array-reverse.php
 109+ - update '#arrayreset,' add option to reset a selection of arrays
 110+
 111+ * Feb 23, 2009 -- Version 1.1.4
 112+ - fixed '#arraysearch,' better recognize perl patterns identified by starting with "/",
 113+ http://www.perl.com/doc/manual/html/pod/perlre.html
 114+
 115+ * Feb 23, 2009 -- Version 1.1.3
 116+ - fixed '#arraysearch,' "Warning: Missing argument 4..."
 117+
 118+ * Feb 9, 2009 -- Version 1.1.2
 119+ - update '#arraysearch,' now support offset and preg regular expression
 120+
 121+ * Feb 8, 2009 -- Version 1.1.1
 122+ - update '#arrayprint,' now wiki links, parser functions and templates properly parsed. This enables
 123+ foreach loop call.
 124+ - update '#arraysearch,' now allows customized output upon found/non-found by specifying additional
 125+ parameters
 126+
 127+ * Feb 5, 2009 -- Version 1.1
 128+ - update '#arraydefine:' replacing 'explode' by 'preg_split',
 129+ and we now allow delimitors to be (i) a string; or (ii) a perl regular expressnion pattern,
 130+ sourrounded by '/', e.g. '/..blah.../'
 131+ - update '#arrayprint,' change parameters from "prefix","suffix" to a "template", and users can
 132+ replace a substring in the template with array value, similar to arraymap in semantic forms
 133+ - update '#arrayunique,' empty elements will be removed
 134+ - update '#arraysort:' adding "random" option to make the array of values in random order
 135+ - add '#arrayreset' to free all defined arrays for memory saving
 136+ - add '#arrayslice' to return an array bounded by start_index and length.
 137+ - add '#arraysearch.' now we can return the index of the first occurence of an element, return -1 if
 138+ not found
 139+ - remove '#arraymember,' obsoleted by '#arraysearch'
 140+ - remove '#arraypush,' obsoleted by '#arraydefine' and '#arraymerge'
 141+ - remove '#arraypop,' obsoleted by '#arrayslice'
 142+ - add safty check code to avoid unset parameters
 143+
 144+ * Feb 1, 2009 -- Version 1.0.3
 145+ - fixed bug on arrayunique, php array_unique only make values unique, but the array index was not
 146+ updated. (arraydefine is also affected)
 147+
 148+ * Jan 28, 2009 -- Version 1.0.2
 149+ - changed arraypop (add one parameter to support multiple pop)
 150+ - added arrayindex (return an array element at index)
 151+
 152+ * Jan 27, 2009 -- Version 1.0.1
 153+ - changed arraydefine (allow defining empty array)
 154+
 155+ -------------------------------------------
 156+ the following fuctions are obsoleted
 157+ '#arraypush' (replaced by arraymerge)
 158+ '#arraypop' (replaced by arrayslice)
 159+ '#arraymember' (replaced by arraysearch)
 160+ -------------------------------------------
\ No newline at end of file
Property changes on: tags/extensions/Arrays/REL_2_0rc1/RELEASE-NOTES
___________________________________________________________________
Added: svn:eol-style
1161 + native
Index: tags/extensions/Arrays/REL_2_0rc1/Arrays.php
@@ -0,0 +1,1296 @@
 2+<?php
 3+
 4+/**
 5+ * Initialization file for the 'Arrays' (former 'ArrayExtension') extension.
 6+ *
 7+ * Documentation: http://www.mediawiki.org/wiki/Extension:Arrays
 8+ * Support: http://www.mediawiki.org/wiki/Extension_talk:Arrays
 9+ * Source code: http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Arrays
 10+ *
 11+ * @file Arrays.php
 12+ * @ingroup Arrays
 13+ *
 14+ * @licence MIT License
 15+ * @version: 2.0rc
 16+ *
 17+ * @author Li Ding < lidingpku@gmail.com >
 18+ * @author Jie Bao
 19+ * @author Daniel Werner < danweetz@web.de > (since version 1.3)
 20+ */
 21+
 22+if ( ! defined( 'MEDIAWIKI' ) ) { die(); }
 23+
 24+$wgExtensionCredits['parserhook'][] = array(
 25+ 'path' => __FILE__,
 26+ 'name' => 'Arrays',
 27+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Arrays',
 28+ 'author' => array ( 'Li Ding', 'Jie Bao', '[http://www.mediawiki.org/wiki/User:Danwe Daniel Werner]' ),
 29+ 'descriptionmsg' => 'arrays-desc',
 30+ 'version' => ExtArrays::VERSION
 31+);
 32+
 33+$wgExtensionMessagesFiles['Arrays' ] = ExtArrays::getDir() . '/Arrays.i18n.php';
 34+$wgExtensionMessagesFiles['ArraysMagic'] = ExtArrays::getDir() . '/Arrays.i18n.magic.php';
 35+
 36+// hooks registration:
 37+$wgHooks['ParserFirstCallInit'][] = 'ExtArrays::init';
 38+$wgHooks['ParserClearState' ][] = 'ExtArrays::onParserClearState';
 39+
 40+// Include the settings file:
 41+require_once ExtArrays::getDir() . '/Arrays_Settings.php';
 42+
 43+
 44+/**
 45+ * Extension class with all the array functionality, also serves as store for arrays per
 46+ * Parser object and offers public accessors for interaction with the 'Arrays' extension.
 47+ *
 48+ * @since 2.0 ('ArrayExtension' before and one global instance, also non-static parser functions)
 49+ */
 50+class ExtArrays {
 51+
 52+ /**
 53+ * Version of the 'Arrays' extension.
 54+ *
 55+ * @since 2.0 (before in 'Arrays' class since 1.3.2)
 56+ */
 57+ const VERSION = '2.0rc';
 58+
 59+ /**
 60+ * Store for arrays.
 61+ *
 62+ * @var array
 63+ * @private
 64+ */
 65+ var $mArrays = array();
 66+
 67+ /**
 68+ * Default separator for '#arrayprint'. Might be ', ' in compatibility-mode or
 69+ * by default since Arrays 2.0 the languages comma separator.
 70+ *
 71+ * @since 2.0
 72+ *
 73+ * @var type
 74+ */
 75+ static $mDefaultSep;
 76+
 77+ /**
 78+ * Sets up parser functions
 79+ *
 80+ * @since 2.0
 81+ */
 82+ public static function init( Parser &$parser ) {
 83+ global $egArraysCompatibilityMode;
 84+ /*
 85+ * store for arrays per Parser object. This will solve several bugs related to
 86+ * 'ParserClearState' hook clearing all variables early in combination with certain
 87+ * other extensions. (since v2.0)
 88+ */
 89+ $parser->mExtArrays = new self();
 90+
 91+ // initialize default separator for '#arrayprint'
 92+ if( $egArraysCompatibilityMode ) {
 93+ // COMPATIBILITY-MODE
 94+ self::$mDefaultSep = ', ';
 95+ }
 96+ else {
 97+ // since 2.0 the default separator for arrayprint is set to the languages default
 98+ global $wgLang;
 99+ $wgLang->getMessageFromDB( 'comma-separator' );
 100+ self::$mDefaultSep = $wgLang->getMessageFromDB( 'comma-separator' );
 101+ }
 102+
 103+ // SFH_OBJECT_ARGS available since MW 1.12
 104+ self::initFunction( $parser, 'arraydefine' );
 105+ self::initFunction( $parser, 'arrayprint', SFH_OBJECT_ARGS );
 106+ self::initFunction( $parser, 'arrayindex', SFH_OBJECT_ARGS );
 107+ self::initFunction( $parser, 'arraysize' );
 108+ self::initFunction( $parser, 'arraysearch', SFH_OBJECT_ARGS );
 109+ self::initFunction( $parser, 'arraysearcharray' );
 110+ self::initFunction( $parser, 'arrayslice' );
 111+ self::initFunction( $parser, 'arrayreset', SFH_OBJECT_ARGS );
 112+ self::initFunction( $parser, 'arrayunique' );
 113+ self::initFunction( $parser, 'arraysort' );
 114+ self::initFunction( $parser, 'arraymerge', SFH_OBJECT_ARGS );
 115+ self::initFunction( $parser, 'arrayunion', SFH_OBJECT_ARGS );
 116+ self::initFunction( $parser, 'arraydiff', SFH_OBJECT_ARGS );
 117+ self::initFunction( $parser, 'arrayintersect', SFH_OBJECT_ARGS );
 118+
 119+ return true;
 120+ }
 121+ private static function initFunction( Parser &$parser, $name, $flags = 0 ) {
 122+ // all parser functions with prefix:
 123+ $prefix = ( $flags & SFH_OBJECT_ARGS ) ? 'pfObj_' : 'pf_';
 124+ $functionCallback = array( __CLASS__, $prefix . $name );
 125+
 126+ $parser->setFunctionHook( $name, $functionCallback, $flags );
 127+ }
 128+
 129+ /**
 130+ * Returns the extensions base installation directory.
 131+ *
 132+ * @since 2.0
 133+ *
 134+ * @return boolean
 135+ */
 136+ public static function getDir() {
 137+ static $dir = null;
 138+ if( $dir === null ) {
 139+ $dir = dirname( __FILE__ );
 140+ }
 141+ return $dir;
 142+ }
 143+
 144+
 145+ ####################
 146+ # Parser Functions #
 147+ ####################
 148+
 149+ ///////////////////////////////////////////////////////////
 150+ // PART 1. Array Construction
 151+ ///////////////////////////////////////////////////////////
 152+
 153+ /**
 154+ * Define an array by a list of 'values' deliminated by 'delimiter',
 155+ * the delimiter should be perl regular expression pattern
 156+ * usage:
 157+ * {{#arraydefine:arrayid|values|delimiter|options}}
 158+ *
 159+ * http://us2.php.net/manual/en/book.pcre.php
 160+ * see also: http://us2.php.net/manual/en/function.preg-split.php
 161+ */
 162+ static function pf_arraydefine(
 163+ Parser &$parser,
 164+ $arrayId,
 165+ $value = null,
 166+ $delimiter = '/\s*,\s*/',
 167+ $options = ''
 168+ ) {
 169+ if ( !isset( $arrayId ) ) {
 170+ return '';
 171+ }
 172+
 173+ $out = '';
 174+ $array = array();
 175+ $trimDone = false; // whether or not we can be sure that all array elements are trimmed
 176+
 177+ // normalize
 178+ $delimiter = trim( $delimiter );
 179+
 180+ if( $value === null ) {
 181+ // no element set, not even an empty one
 182+ $array = array();
 183+ }
 184+ else {
 185+ $value = trim( $value ); // just in case...
 186+
 187+ // fill array with user input:
 188+ if( $delimiter === '' ) {
 189+ // whole input one element, also takes care of special case empty '' value and 'unique' option set
 190+ $array = array( $value );
 191+ $trimDone = true;
 192+ }
 193+ else {
 194+ // if no regex delimiter given, build one:
 195+ if( ! self::isValidRegEx( $delimiter ) ) {
 196+ $delimiter = '/\s*' . preg_quote( $delimiter, '/' ) . '\s*/';
 197+ $trimDone = true; // spaces are part of the delimiter now
 198+ }
 199+ $array = preg_split( $delimiter, $value );
 200+ }
 201+
 202+ // trim all values before unique if still necessary, otherwise unique might not work correctly
 203+ if( ! $trimDone ) {
 204+ $array = self::sanitizeArray( $array );
 205+ }
 206+
 207+ // now parse the options, and do posterior process on the created array
 208+ $arrayOptions = self::parse_options( $options );
 209+
 210+ // make it unique if option is set
 211+ if( array_key_exists( 'unique', $arrayOptions ) ) {
 212+ // unique like the parser function would do it
 213+ $array = self::array_unique( $array );
 214+ }
 215+
 216+ /**
 217+ * @ToDo:
 218+ * The 'empty' option was introduced in r81676 but actually breaks old functionality since it will remove
 219+ * all empty elements by default.
 220+ * 'unique' already allows to remove all empty elements but it will also remove al duplicates, there should
 221+ * be a more intelligent alternative to 'unique' which allows both, to preserve or remove empty elements
 222+ * independent from removing duplicate values.
 223+ */
 224+ /*
 225+ // remove all empty '' elements if option is NOT set
 226+ if( ! array_key_exists( 'empty', $arrayOptions ) ) {
 227+ $values = array(); // temp array so we won't have gaps (don't use unset!)
 228+ foreach ( $array as $key => $value ) {
 229+ if( $value !== '' ) {
 230+ $values[] = $elem;
 231+ }
 232+ }
 233+ $array = $values;
 234+ unset( $values );
 235+ }
 236+ */
 237+
 238+ // sort array if the option is set
 239+ if( array_key_exists( 'sort', $arrayOptions ) ) {
 240+ $array = self::arraySort( $array, self::array_value( $arrayOptions, 'sort' ) );
 241+ }
 242+
 243+ // print the array upon request
 244+ switch( self::array_value( $arrayOptions, 'print' ) ) {
 245+ case 'list':
 246+ // simple list output
 247+ $out = implode( self::$mDefaultSep, $array );
 248+ break;
 249+ case 'pretty':
 250+ global $wgLang;
 251+ $out = $wgLang->listToText( $array );
 252+ break;
 253+ }
 254+ }
 255+
 256+ self::get( $parser )->setArray( $arrayId, $array );
 257+
 258+ return $out;
 259+ }
 260+
 261+
 262+ ///////////////////////////////////////////////////////////
 263+ // PART 2. Extracting Information
 264+ ///////////////////////////////////////////////////////////
 265+
 266+
 267+ /**
 268+ * print an array.
 269+ * foreach element of the array, print 'subject' where all occurrences of 'search' is replaced with the element,
 270+ * and each element print-out is deliminated by 'delimiter'
 271+ * The subject can embed parser functions; wiki links; and templates.
 272+ * usage:
 273+ * {{#arrayprint:arrayid|delimiter|search|subject|options}}
 274+ * examples:
 275+ * {{#arrayprint:b}} -- simple
 276+ * {{#arrayprint:b|<br/>}} -- add change line
 277+ * {{#arrayprint:b|<br/>|@@@|[[@@@]]}} -- embed wiki links
 278+ * {{#arrayprint:b|<br/>|@@@|{{#set:prop=@@@}} }} -- embed parser function
 279+ * {{#arrayprint:b|<br/>|@@@|{{f.tag{{f.print.vbar}}prop{{f.print.vbar}}@@@}} }} -- embed template function
 280+ * {{#arrayprint:b|<br/>|@@@|[[name::@@@]]}} -- make SMW links
 281+ */
 282+ static function pfObj_arrayprint( Parser &$parser, PPFrame $frame, $args ) {
 283+ global $egArraysCompatibilityMode, $egArraysExpansionEscapeTemplates;
 284+
 285+ // Get Parameters
 286+ $arrayId = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
 287+ $delimiter = isset( $args[1] ) ? trim( $frame->expand( $args[1] ) ) : self::$mDefaultSep;
 288+ /*
 289+ * PPFrame::NO_ARGS and PPFrame::NO_TEMPLATES for expansion make a lot of sense here since the patterns getting replaced
 290+ * in $subject before $subject is being parsed. So any template or argument influence in the patterns wouldn't make any
 291+ * sense in any sane scenario.
 292+ */
 293+ $search = isset( $args[2] ) ? trim( $frame->expand( $args[2], PPFrame::NO_ARGS | PPFrame::NO_TEMPLATES ) ) : null;
 294+ $subject = isset( $args[3] ) ? trim( $frame->expand( $args[3], PPFrame::NO_ARGS | PPFrame::NO_TEMPLATES ) ) : null;
 295+ // options array:
 296+ $options = isset( $args[4] )
 297+ ? self::parse_options( $frame->expand( $args[4] ) )
 298+ : array();
 299+
 300+
 301+ // get array, null if non-existant:
 302+ $array = self::get( $parser )->getArray( $arrayId );
 303+
 304+ if( $array === null ) {
 305+ // array we want to print doesn't exist!
 306+ if( ! $egArraysCompatibilityMode ) {
 307+ return '';
 308+ } else {
 309+ // COMPATIBILITY-MODE
 310+ return "undefined array: $arrayId";
 311+ }
 312+ }
 313+
 314+ // if there is no subject, there is no point in expanding. Faster!
 315+ if( !$egArraysCompatibilityMode && $subject === null ) {
 316+ // NO COMPATIBILITY-MODE
 317+ // we can ignore options here, since if subject is null, options won't be set as well!
 318+ return trim( implode( $delimiter, $array ) );
 319+ }
 320+
 321+ $rendered_values = array();
 322+
 323+ foreach( $array as $val ) {
 324+
 325+ if( ! $egArraysCompatibilityMode ) {
 326+ // NO COMPATIBILITY-MODE
 327+ /**
 328+ * escape the array value so it won't destroy the users wiki markup expression.
 329+ */
 330+ $val = self::escapeForExpansion( $val );
 331+ }
 332+ // replace place holder with current value:
 333+ $rawResult = str_replace( $search, $val, $subject );
 334+ /*
 335+ * $subjectd still is un-expanded (this allows to use some parser functions like
 336+ * {{FULLPAGENAME:@@@@}} directly without getting parsed before @@@@ is replaced.
 337+ * Expand it so we replace templates like {{!}} which we need for the final parse.
 338+ */
 339+ $rawResult = $parser->preprocessToDom( $rawResult, $frame->isTemplate() ? Parser::PTD_FOR_INCLUSION : 0 );
 340+ $rawResult = trim( $frame->expand( $rawResult ) );
 341+
 342+ $rendered_values[] = $rawResult;
 343+ }
 344+
 345+ // follow special print options:
 346+ switch( self::array_value( $options, 'print' ) ) {
 347+ case 'pretty':
 348+ // pretty list print with ' and ' connecting the last two items
 349+ if( $delimiter === '' ) {
 350+ // '' as delimiter isn't pretty, so in this case we take the (languages) default
 351+ $output = self::arrayToText( $rendered_values );
 352+ } else {
 353+ $output = self::arrayToText( $rendered_values, $delimiter );
 354+ }
 355+ break;
 356+
 357+ default:
 358+ // normal print with one delimiter, might be the languages default
 359+ $output = implode( $delimiter, $rendered_values );
 360+ break;
 361+ }
 362+
 363+ if( $egArraysCompatibilityMode || $egArraysExpansionEscapeTemplates === null ) {
 364+ // COMPATIBLITY-MODE:
 365+ /*
 366+ * don't leave the final parse to Parser::braceSubstitution() since there are some special cases where it
 367+ * would produce unexpected output (it uses a new child frame and ignores whether the frame is a template!)
 368+ */
 369+ $output = $parser->preprocessToDom( $output, $frame->isTemplate() ? Parser::PTD_FOR_INCLUSION : 0 );
 370+ $output = $frame->expand( $output );
 371+ }
 372+
 373+ return trim( $output );
 374+ }
 375+
 376+ /**
 377+ * print the value of an array (identified by arrayid) by the index, invalid index results in the default value being printed. note the index is 0-based.
 378+ * usage:
 379+ * {{#arrayindex:arrayid|index}}
 380+ */
 381+ static function pfObj_arrayindex( Parser &$parser, PPFrame $frame, $args ) {
 382+ global $egArraysCompatibilityMode;
 383+
 384+ // Get Parameters
 385+ $arrayId = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
 386+ $rawOptions = isset( $args[2] ) ? $args[2] : '';
 387+
 388+ if( ! isset( $args[1] ) ) {
 389+ return '';
 390+ }
 391+ $index = trim( $frame->expand( $args[1] ) );
 392+
 393+ // get value or null if it doesn't exist. Takes care of negative index as well
 394+ $val = self::get( $parser )->getArrayValue( $arrayId, $index );
 395+
 396+ if( $val === null || ( $val === '' && !$egArraysCompatibilityMode ) ) {
 397+ // index doesn't exist, return default (parameter 3)!
 398+ // without compatibility, also return default in case of empty string ''
 399+
 400+ // only expand default when needed
 401+ $defaultOrOptions = trim( $frame->expand( $rawOptions ) );
 402+
 403+ if( $egArraysCompatibilityMode ) {
 404+ // COMPATIBILITY-MODE
 405+ // now parse the options, and do posterior process on the created array
 406+ $options = self::parse_options( $defaultOrOptions );
 407+ $default = self::array_value( $options, 'default' );
 408+ } else {
 409+ $default = $defaultOrOptions;
 410+ }
 411+
 412+ return $default;
 413+ }
 414+
 415+ return $val;
 416+ }
 417+
 418+ /**
 419+ * returns the size of an array.
 420+ * Print the size (number of elements) in the specified array and '' if array doesn't exist
 421+ * usage:
 422+ * {{#arraysize:arrayid}}
 423+ *
 424+ * See: http://www.php.net/manual/en/function.count.php
 425+ */
 426+ static function pf_arraysize( Parser &$parser, $arrayId ) {
 427+ $store = self::get( $parser );
 428+
 429+ if( ! $store->arrayExists( $arrayId ) ) {
 430+ return '';
 431+ }
 432+
 433+ return count( $store->getArray( $arrayId ) );
 434+ }
 435+
 436+
 437+ /**
 438+ * locate the index of the first occurence of an element starting from the 'index'
 439+ * - print "-1" (not found) or index (found) to show the index of the first occurence of 'value' in the array identified by arrayid
 440+ * - if 'yes' and 'no' are set, print value of them when found or not-found
 441+ * - index is 0-based , it must be non-negative and less than lenth
 442+ * usage:
 443+ * {{#arraysearch:arrayid|value|index|yes|no}}
 444+ *
 445+ * See: http://www.php.net/manual/en/function.array-search.php
 446+ * note it is extended to support regular expression match and index
 447+ */
 448+ static function pfObj_arraysearch( Parser &$parser, PPFrame $frame, $args ) {
 449+
 450+ $arrayId = trim( $frame->expand( $args[0] ) );
 451+ $index = isset( $args[2] ) ? trim( $frame->expand( $args[2] ) ) : 0;
 452+
 453+ $store = self::get( $parser );
 454+
 455+ if( $store->arrayExists( $arrayId )
 456+ && $store->validate_array_index( $arrayId, $index, false )
 457+ ) {
 458+ $array = $store->getArray( $arrayId );
 459+
 460+ // validate/build search regex:
 461+ if( isset( $args[1] ) ) {
 462+
 463+ $needle = trim( $frame->expand( $args[1] ) );
 464+
 465+ if ( ! self::isValidRegEx( $needle ) ) {
 466+ $needle = '/^\s*' . preg_quote( trim( $needle ), '/' ) . '\s*$/';
 467+ }
 468+ }
 469+ else {
 470+ $needle = '/^\s*$/';
 471+ }
 472+
 473+ // search for a match inside the array:
 474+ $total = count( $array );
 475+ for ( $i = $index; $i < $total; $i++ ) {
 476+ $value = $array[ $i ];
 477+
 478+ if ( preg_match( $needle, $value ) ) {
 479+ // found!
 480+ if ( isset( $args[3] ) ) {
 481+ // Expand only when needed!
 482+ return trim( $frame->expand( $args[3] ) );
 483+ }
 484+ else {
 485+ // return index of first found item
 486+ return $i;
 487+ }
 488+ }
 489+ }
 490+ }
 491+
 492+ global $egArraysCompatibilityMode;
 493+
 494+ // no match! (Expand only when needed!)
 495+ $no = isset( $args[4] )
 496+ ? trim( $frame->expand( $args[4] ) )
 497+ : $egArraysCompatibilityMode ? '-1' : ''; // COMPATIBILITY-MODE
 498+ return $no;
 499+ }
 500+
 501+ /**
 502+ * search an array and create a new array with all the results. Transforming the new entries before storing them is possible too.
 503+ * usage:
 504+ * {{#arraysearcharray:arrayid_new|arrayid|needle|index|limit|transform}}
 505+ *
 506+ * "needle" can be a regular expression or a string search value. If "needle" is a regular expression, "transform" can contain
 507+ * "$n" where "n" stands for a number to access a variable from the regex result.
 508+ */
 509+ static function pf_arraysearcharray(
 510+ Parser &$parser,
 511+ $arrayId_new,
 512+ $arrayId = null,
 513+ $needle = '/^(\s*)$/',
 514+ $index = 0,
 515+ $limit = '',
 516+ $transform = ''
 517+ ) {
 518+ $store = self::get( $parser );
 519+
 520+ if( $arrayId === null ) {
 521+ global $egArraysCompatibilityMode;
 522+ if( ! $egArraysCompatibilityMode ) { // COMPATIBILITY-MODE
 523+ $store->setArray( $arrayId_new );
 524+ }
 525+ return '';
 526+ }
 527+ // also takes care of negative index by calculating start index:
 528+ $validIndex = $store->validate_array_index( $arrayId, $index, false );
 529+
 530+ // make sure at least empty array exists but don't overwrite data
 531+ // we still need in case new array ID same as target array ID
 532+ $array = $store->getArray( $arrayId );
 533+ $store->setArray( $arrayId_new );
 534+
 535+ if( $array === null || !$validIndex ) {
 536+ return '';
 537+ }
 538+
 539+ // non-numeric limit will be set to 0, except limit was omitted ('')
 540+ $limit = $limit === '' ? -1 : (int)$limit;
 541+ if( $limit === 0 ) {
 542+ return '';
 543+ }
 544+
 545+ $newArr = array();
 546+
 547+ $regexFunSupport = self::hasRegexFunSupport();
 548+ if( ! self::isValidRegEx( $needle, $regexFunSupport ) ) {
 549+ $needle = '/^\s*(' . preg_quote( $needle, '/' ) . ')\s*$/';
 550+ }
 551+
 552+ // search the array for all matches and put them in the new array
 553+ $total = count( $array );
 554+ for( $i = $index; $i < $total; $i++ ) {
 555+
 556+ $value = $array[ $i ];
 557+
 558+ if( preg_match( $needle, $value ) ) {
 559+ // Found something!
 560+ if( $transform !== '' ) {
 561+ // Transform the found string. Can we use 'Regex Fun' ?
 562+ if( $regexFunSupport ) {
 563+ // do the transformation with Regex Fun to support 'e' flag:
 564+ $value = ExtRegexFun::doPregReplace(
 565+ $needle,
 566+ $transform,
 567+ $value,
 568+ -1,
 569+ $parser,
 570+ array( ExtRegexFun::FLAG_REPLACEMENT_PARSE )
 571+ );
 572+ }
 573+ else {
 574+ // regular preg_replace:
 575+ $value = preg_replace( $needle, $transform, $value );
 576+ }
 577+ }
 578+ $newArr[] = trim( $value );
 579+
 580+ // stop if limit is reached, limit -1 means no limit
 581+ if( --$limit === 0 ) {
 582+ break;
 583+ }
 584+ }
 585+ }
 586+
 587+ // set new array:
 588+ $store->setArray( $arrayId_new, $newArr );
 589+ return '';
 590+ }
 591+
 592+ /**
 593+ * extract a slice from an array
 594+ * usage:
 595+ * {{#arrayslice:arrayid_new|arrayid|offset|length}}
 596+ *
 597+ * extract a slice from an array
 598+ * see: http://www.php.net/manual/en/function.array-slice.php
 599+ */
 600+ static function pf_arrayslice( Parser &$parser, $arrayId_new, $arrayId = null , $offset = 0, $length = null ) {
 601+ $store = self::get( $parser );
 602+ if( $arrayId === null ) {
 603+ global $egArraysCompatibilityMode;
 604+ if( ! $egArraysCompatibilityMode ) { // COMPATIBILITY-MODE
 605+ $store->setArray( $arrayId_new );
 606+ }
 607+ return '';
 608+ }
 609+ // get target array before overwriting it in any way
 610+ $array = $store->getArray( $arrayId );
 611+
 612+ // make sure at least an empty array exists if we return early
 613+ $store->setArray( $arrayId_new );
 614+
 615+ if( $array === null
 616+ || ! is_numeric( $offset ) // don't ignore invalid offset
 617+ ) {
 618+ return '';
 619+ }
 620+
 621+ if( ! is_numeric( $length ) ) {
 622+ $length = null; // ignore invalid input, slice till end
 623+ }
 624+
 625+ // array_slice will re-organize keys
 626+ $newArray = array_slice( $array, $offset, $length );
 627+ $store->setArray( $arrayId_new, $newArray );
 628+
 629+ return '';
 630+ }
 631+
 632+
 633+ ///////////////////////////////////////////////////////////
 634+ // PART 3. Array Alteration
 635+ ///////////////////////////////////////////////////////////
 636+
 637+ /**
 638+ * reset some or all defined arrayes
 639+ * usage:
 640+ * {{#arrayreset:}}
 641+ * {{#arrayreset:arrayid1,arrayid2,...arrayidn}}
 642+ */
 643+ static function pfObj_arrayreset( Parser &$parser, PPFrame $frame, $args) {
 644+ global $egArraysCompatibilityMode;
 645+
 646+ if( $egArraysCompatibilityMode && count( $args ) == 1 ) {
 647+ /*
 648+ * COMPATIBILITY-MODE: before arrays were separated by ';' which is an bad idea since
 649+ * the ',' is an allowed character in array names!
 650+ */
 651+ $args = preg_split( '/\s*,\s*/', trim( $frame->expand( $args[0] ) ) );
 652+ }
 653+
 654+ $store = self::get( $parser );
 655+
 656+ // reset all hash tables if no specific tables are given:
 657+ if( ! isset( $args[0] ) || ( $args[0] === '' && count( $args ) == 1 ) ) {
 658+ // reset ALL arrays!
 659+ $store->mArrays = array();
 660+ }
 661+ else {
 662+ // reset specific hash tables:
 663+ foreach( $args as $arg ) {
 664+ $arrayId = trim( $frame->expand( $arg ) );
 665+ $store->unsetArray( $arrayId );
 666+ }
 667+ }
 668+ return '';
 669+ }
 670+
 671+
 672+ /**
 673+ * convert an array to a set
 674+ * convert the array identified by arrayid into a set (all elements are unique)
 675+ * also removes empty '' elements from the array
 676+ * usage:
 677+ * {{#arrayunique:arrayid}}
 678+ *
 679+ * see: http://www.php.net/manual/en/function.array-unique.php
 680+ */
 681+ static function pf_arrayunique( Parser &$parser, $arrayId ) {
 682+ $store = self::get( $parser );
 683+
 684+ if( $store->arrayExists( $arrayId ) ) {
 685+ $array = $store->getArray( $arrayId );
 686+ $array = self::array_unique( $array );
 687+ $store->setArray( $arrayId, $array );
 688+ }
 689+ return '';
 690+ }
 691+
 692+
 693+ /**
 694+ * sort specified array in the following order:
 695+ * - none: No sort (default)
 696+ * - desc: In descending order, large to small
 697+ * - asce: In ascending order, small to large
 698+ * - random: Shuffle the arrry in random order
 699+ * - reverse: Return an array with elements in reverse order
 700+ * usage:
 701+ * {{#arraysort:arrayid|order}}
 702+ *
 703+ * see: http://www.php.net/manual/en/function.sort.php
 704+ * http://www.php.net/manual/en/function.rsort.php
 705+ * http://www.php.net/manual/en/function.shuffle.php
 706+ * http://us3.php.net/manual/en/function.array-reverse.php
 707+ */
 708+ static function pf_arraysort( Parser &$parser, $arrayId , $sort = 'none' ) {
 709+ $store = self::get( $parser );
 710+
 711+ $array = $store->getArray( $arrayId );
 712+
 713+ if( $array === null ) {
 714+ return '';
 715+ }
 716+
 717+ // sort array and store it
 718+ $array = self::arraySort( $array, $sort );
 719+ $store->setArray( $arrayId, $array );
 720+ return '';
 721+ }
 722+
 723+
 724+ ///////////////////////////////////////////////////////////
 725+ // PART 4. Array Interaction
 726+ ///////////////////////////////////////////////////////////
 727+
 728+ /**
 729+ * Merge values two arrayes identified by arrayid1 and arrayid2 into a new array identified by arrayid_new.
 730+ * This merge differs from array_merge of php because it merges values.
 731+ *
 732+ * Usage:
 733+ * {{#arraymerge:arrayid_new |array1 |array2 |... |array n}}
 734+ * See: http://www.php.net/manual/en/function.array-merge.php
 735+ */
 736+ static function pfObj_arraymerge( &$parser, $frame, $args) {
 737+ self::get( $parser )->multiArrayOperation( $frame, $args, __FUNCTION__, false );
 738+ return '';
 739+ }
 740+ private function multi_arraymerge( $array1, $array2 ) {
 741+ // keys will not be re-organized
 742+ return array_merge( $array1, $array2 );
 743+ }
 744+
 745+ /**
 746+ * Usage:
 747+ * {{#arrayunion:arrayid_new|arrayid1|arrayid2}}
 748+ *
 749+ * Set operation, {red, white} = {red, white} union {red}
 750+ * Similar to arraymerge but with unique values. This union works on values.
 751+ */
 752+ static function pfObj_arrayunion( &$parser, $frame, $args) {
 753+ self::get( $parser )->multiArrayOperation( $frame, $args, __FUNCTION__, false );
 754+ return '';
 755+ }
 756+ private function multi_arrayunion( $array1, $array2 ) {
 757+ // keys will not be re-organized
 758+ return array_unique( array_merge( $array1, $array2 ) );
 759+ }
 760+
 761+ /**
 762+ * Usage:
 763+ * {{#arrayintersect:arrayid_new |array1 |array2 |... |array n}}
 764+ *
 765+ * Set operation, {red} = {red, white} intersect {red,black}
 766+ * See: http://www.php.net/manual/en/function.array-intersect.php
 767+ */
 768+ static function pfObj_arrayintersect( &$parser, $frame, $args) {
 769+ self::get( $parser )->multiArrayOperation( $frame, $args, __FUNCTION__, false );
 770+ return '';
 771+ }
 772+ private function multi_arrayintersect( $array1, $array2 ) {
 773+ // keys will be preserved!
 774+ return array_intersect( $array1, $array2 );
 775+ }
 776+
 777+ /**
 778+ *
 779+ * Usage:
 780+ * {{#arraydiff:arrayid_new |array1 |array2 |... |array n}}
 781+ *
 782+ * Set operation, {white} = {red, white} - {red}
 783+ * See: http://www.php.net/manual/en/function.array-diff.php
 784+ */
 785+ static function pfObj_arraydiff( &$parser, $frame, $args) {
 786+ self::get( $parser )->multiArrayOperation( $frame, $args, __FUNCTION__, false );
 787+ return '';
 788+ }
 789+ private function multi_arraydiff( $array1, $array2 ) {
 790+ // keys will be preserved!
 791+ return array_diff( $array1, $array2 );
 792+ }
 793+
 794+
 795+ ##################
 796+ # Private helper #
 797+ ##################
 798+
 799+ /**
 800+ * Base function for operations with multiple arrays given thru n parameters
 801+ * $operationFunc expects a function name prefix (suffix 'multi_') with two parameters
 802+ * $array1 and $array2 which will perform an action between $array1 and $array2 which
 803+ * will result into a new $array1. There can be 1 to n $hash2 in the whole process.
 804+ *
 805+ * Note: This function is similar to that of Extension:HashTables.
 806+ *
 807+ * @since 2.0
 808+ *
 809+ * @param $frame PPFrame
 810+ * @param $args array
 811+ * @param $operationFunc string name of the function calling this. There must be a counterpart
 812+ * function with prefix 'multi_' which should have two parameters. Both parameters
 813+ * will receive an array, the function must return the result array of the processing.
 814+ * @param $runFuncOnSingleArray boolean whether the $operationFunc function should be run in case
 815+ * only one array id is given. If not, the original array will end up in the new array.
 816+ */
 817+ protected function multiArrayOperation( PPFrame $frame, array $args, $operationFunc, $runFuncOnSingleArray = true ) {
 818+ $lastArray = null;
 819+ $operationRan = false;
 820+ $finalArrayId = trim( $frame->expand( $args[0] ) );
 821+ $operationFunc = 'multi_' . preg_replace( '/^pfObj_/', '', $operationFunc );
 822+
 823+ // For all arrays given in parameters 2 to n (ignore 1 because this is the name of the new array)
 824+ for( $i = 1; $i < count( $args ); $i++ ) {
 825+ // just make sure we don't fall into gaps of given arguments:
 826+ if( ! array_key_exists( $i, $args ) ) {
 827+ continue;
 828+ }
 829+ $argArrayId = trim( $frame->expand( $args[ $i ] ) );
 830+
 831+ // ignore all tables which do not exist
 832+ if( $this->arrayExists( $argArrayId ) ) {
 833+ $argArray = $this->getArray( $argArrayId );
 834+ if( $lastArray === null ) {
 835+ // first valid array, process together with second...
 836+ $lastArray = $argArray;
 837+ }
 838+ else {
 839+ // second or later hash table, process with previous:
 840+ $lastArray = $this->{ $operationFunc }( $lastArray, $argArray ); // perform action between last and current array
 841+ $operationRan = true;
 842+ }
 843+ }
 844+ }
 845+
 846+ // in case no array was given at all:
 847+ if( $lastArray === null ) {
 848+ $lastArray = array();
 849+ }
 850+
 851+ global $egArraysCompatibilityMode;
 852+
 853+ if( ! $operationRan && $egArraysCompatibilityMode
 854+ && $operationFunc !== 'multi_arraymerge' // only exception was 'arraymerge'
 855+ ) {
 856+ /*
 857+ * COMPATIBILITY-MODE:
 858+ * Before version 2.0 we didn't create a new array in case only one array was given.
 859+ * The only exception was 'arraymerge' which did duplicate the array.
 860+ */
 861+ return '';
 862+ }
 863+
 864+ // if the operation didn't run because there was only one or no array:
 865+ if( ! $operationRan && $runFuncOnSingleArray ) {
 866+ $lastArray = $this->{ $operationFunc }( $lastArray );
 867+ }
 868+
 869+ // re-organize all keys since some 'multi_' functions will preserve keys!
 870+ $lastArray = array_merge( $lastArray );
 871+
 872+ $this->setArray( $finalArrayId, $lastArray );
 873+ }
 874+
 875+ /**
 876+ * Validates an index for an array and returns true in case the index is a valid index within
 877+ * the array. This also changes the index value, which is given by reference, in case it is
 878+ * set to a negative value. In case $strictIndex is set to false, further transforming of
 879+ * $index might be done - in the same cases normally the function would return false.
 880+ *
 881+ * @param string $arrayId
 882+ * @param mixed &$index
 883+ * @param bool $strictIndex Whether non-numeric indexes and negative indexes which would
 884+ * end up out of range, below 0, should be set to 0 automatically.
 885+ *
 886+ * @return boolean
 887+ */
 888+ protected function validate_array_index( $arrayId, &$index, $strictIndex = false ) {
 889+ if( ! is_numeric( $index ) ) {
 890+ if( $strictIndex ) {
 891+ return false;
 892+ } else {
 893+ $index = 0;
 894+ }
 895+ }
 896+ $index = (int)$index;
 897+
 898+ if( ! array_key_exists( $arrayId, $this->mArrays ) ) {
 899+ return false;
 900+ }
 901+
 902+ $array = $this->mArrays[ $arrayId ];
 903+
 904+ // calculate start index for negative start indexes:
 905+ if( $index < 0 ) {
 906+ $index = count( $array ) + $index;
 907+ if ( $index < 0 && !$strictIndex ) {
 908+ $index = 0;
 909+ }
 910+ }
 911+
 912+ if( ! isset( $array ) ) {
 913+ return false;
 914+ }
 915+ if( ! array_key_exists( $index, $array ) ) {
 916+ return false;
 917+ }
 918+ return true;
 919+ }
 920+
 921+ /**
 922+ * private function for validating array by name
 923+ * @ToDo: get rid of this!
 924+ * @deprecated
 925+ */
 926+ protected function validate_array_by_arrayId( $arrayId ) {
 927+ if( ! isset( $arrayId ) ) {
 928+ return '';
 929+ }
 930+ if( ! isset( $this->mArrays )
 931+ || ! array_key_exists( $arrayId, $this->mArrays )
 932+ || ! is_array( $this->mArrays[ $arrayId ] )
 933+ ) {
 934+ global $egArraysCompatibilityMode;
 935+ if( $egArraysCompatibilityMode ) {
 936+ return "undefined array: $arrayId"; // COMPATIBILITY-MODE
 937+ } else {
 938+ return '';
 939+ }
 940+ }
 941+
 942+ return true;
 943+ }
 944+
 945+ /**
 946+ * Convenience function to get a value from an array. Returns '' in case the
 947+ * value doesn't exist or no array was given
 948+ *
 949+ * @return string
 950+ */
 951+ protected static function array_value( $array, $field ) {
 952+ if ( is_array( $array ) && array_key_exists( $field, $array ) ) {
 953+ return $array[ $field ];
 954+ }
 955+ return '';
 956+ }
 957+
 958+ /**
 959+ * Parses a string of options separated by ','. Options can be just certain key-words or
 960+ * key-value pairs separated by '='. Options are case-insensitive and spacing between
 961+ * separators will be ignored.
 962+ */
 963+ protected static function parse_options( $options ) {
 964+ if( ! isset( $options ) ) {
 965+ return array();
 966+ }
 967+
 968+ // now parse the options, and do posterior process on the created array
 969+ $options = preg_split( '/\s*,\s*/', strtolower( trim( $options ) ) );
 970+
 971+ $ret = array();
 972+ foreach( $options as $option ) {
 973+ $optPair = preg_split( '/\s*\=\s*/', $option, 2 );
 974+ if( sizeof( $optPair ) == 1 ) {
 975+ $ret[ $optPair[0] ] = true;
 976+ } else {
 977+ $ret[ $optPair[0] ] = $optPair[1];
 978+ }
 979+ }
 980+ return $ret;
 981+ }
 982+
 983+ /**
 984+ * same as self::arrayUnique() but without sanitazation, only for internal use.
 985+ */
 986+ protected static function array_unique( array $array ) {
 987+ // delete duplicate values
 988+ $array = array_unique( $array );
 989+
 990+ $values = array();
 991+ foreach( $array as $key => $val ) {
 992+ // don't put emty elements into the array
 993+ if( $val !== '' ) {
 994+ $values[] = $val;
 995+ }
 996+ }
 997+
 998+ return $values;
 999+ }
 1000+
 1001+
 1002+ ##############
 1003+ # Used Hooks #
 1004+ ##############
 1005+
 1006+ static function onParserClearState( Parser &$parser ) {
 1007+ // remove all arrays to avoid conflicts with job queue or Special:Import or SMW semantic updates
 1008+ $parser->mExtArrays = new self();
 1009+ return true;
 1010+ }
 1011+
 1012+
 1013+ ####################################
 1014+ # Public functions for interaction #
 1015+ ####################################
 1016+ #
 1017+ # public non-parser functions, accessible for
 1018+ # other extensions doing interactive stuff
 1019+ # with the Array extension.
 1020+ #
 1021+
 1022+ /**
 1023+ * Convenience function to return the 'Arrays' extensions array store connected
 1024+ * to a certain Parser object. Each parser has its own store which will be reset after
 1025+ * a parsing process [Parser::parse()] has finished.
 1026+ *
 1027+ * @since 2.0
 1028+ *
 1029+ * @param Parser &$parser
 1030+ *
 1031+ * @return ExtArrays by reference so we still have the right object after 'ParserClearState'
 1032+ */
 1033+ public static function &get( Parser &$parser ) {
 1034+ return $parser->mExtArrays;
 1035+ }
 1036+
 1037+ /**
 1038+ * Returns an array identified by $arrayId. If it doesn't exist, null will be returned.
 1039+ *
 1040+ * @since 2.0
 1041+ *
 1042+ * @param string $arrayId
 1043+ *
 1044+ * @return array|null
 1045+ */
 1046+ function getArray( $arrayId ) {
 1047+ $arrayId = trim( $arrayId );
 1048+ if( $this->arrayExists( $arrayId ) ) {
 1049+ return $this->mArrays[ $arrayId ];
 1050+ }
 1051+ return null;
 1052+ }
 1053+
 1054+ /**
 1055+ * This will add a new array or overwrite an existing one. Values should be delliverd as array
 1056+ * values in form of a string. The array will be sanitized internally.
 1057+ *
 1058+ * @param string $arrayId
 1059+ * @param array $array
 1060+ */
 1061+ public function createArray( $arrayId, $array = array() ) {
 1062+ $array = self::sanitizeArray( $array );
 1063+ $this->mArrays[ trim( $arrayId ) ] = $array;
 1064+ }
 1065+
 1066+ /**
 1067+ * Same as the public function createArray() but without sanitizing the array automatically.
 1068+ * This is save and faster for internal usage, just be sure your array doesn't have un-trimmed
 1069+ * values or non-numeric or negative array keys and no gaps between keys.
 1070+ *
 1071+ * @param type $arrayId
 1072+ * @param type $array
 1073+ */
 1074+ protected function setArray( $arrayId, $array = array() ) {
 1075+ $this->mArrays[ trim( $arrayId ) ] = $array;
 1076+ }
 1077+
 1078+ /**
 1079+ * Returns whether a certain array is defined within the page scope.
 1080+ *
 1081+ * @param string $arrayId
 1082+ *
 1083+ * @return boolean
 1084+ */
 1085+ function arrayExists( $arrayId ) {
 1086+ return array_key_exists( trim( $arrayId ), $this->mArrays );
 1087+ }
 1088+
 1089+ /**
 1090+ * Returns a value within an array. If key or array do not exist, this will return null
 1091+ * or another predefined default. $index can also be a negative value, in this case the
 1092+ * value that far from the end of the array will be returned.
 1093+ *
 1094+ * @since 2.0
 1095+ *
 1096+ * @param string $arrayId
 1097+ * @param string $index
 1098+ * @param mixed $default value to return in case the value doesn't exist. null by default.
 1099+ *
 1100+ * @return string|null
 1101+ */
 1102+ function getArrayValue( $arrayId, $index, $default = null ) {
 1103+ $arrayId = trim( $arrayId );
 1104+ if( $this->arrayExists( $arrayId )
 1105+ && $this->validate_array_index( $arrayId, $index, true )
 1106+ && array_key_exists( $index, $this->mArrays[ $arrayId ] )
 1107+ ) {
 1108+ return $this->mArrays[ $arrayId ][ $index ];
 1109+ }
 1110+ else {
 1111+ return $default;
 1112+ }
 1113+ }
 1114+
 1115+
 1116+ /**
 1117+ * Removes an existing array. If array didn't exist this will return false, otherwise true.
 1118+ *
 1119+ * @since 2.0
 1120+ *
 1121+ * @param string $arrayId
 1122+ *
 1123+ * @return boolean whether the array existed and has been removed
 1124+ */
 1125+ public function unsetArray( $arrayId ) {
 1126+ $arrayId = trim( $arrayId );
 1127+ if( $this->arrayExists( $arrayId ) ) {
 1128+ unset( $this->mArrays[ $arrayId ] );
 1129+ return true;
 1130+ }
 1131+ return false;
 1132+ }
 1133+
 1134+ /**
 1135+ * Rebuild the array and reorganize all keys, trim all values.
 1136+ * All gaps between array items will be closed.
 1137+ *
 1138+ * @since 2.0
 1139+ *
 1140+ * @param array $arr array to be reorganized
 1141+ * @return array
 1142+ */
 1143+ public static function sanitizeArray( $array ) {
 1144+ $newArray = array();
 1145+ foreach( $array as $val ) {
 1146+ $newArray[] = trim( $val );
 1147+ }
 1148+ return $newArray;
 1149+ }
 1150+
 1151+ /**
 1152+ * Removes duplicate values and all empty elements from an array just like the
 1153+ * '#arrayunique' parser function would do it. The array will be sanitized internally.
 1154+ *
 1155+ * @since 2.0
 1156+ *
 1157+ * @param array $array
 1158+ *
 1159+ * @return array
 1160+ */
 1161+ public static function arrayUnique( array $array ) {
 1162+ return self::array_unique( self::sanitizeArray( $array ) );
 1163+ }
 1164+
 1165+ /**
 1166+ * Sorts an array just like parser function '#arraysort' would do it and allows the
 1167+ * same sort modes.
 1168+ *
 1169+ * @since 2.0
 1170+ *
 1171+ * @param array $array
 1172+ * @param string $sortMode
 1173+ *
 1174+ * @return array
 1175+ */
 1176+ public static function arraySort( array $array, $sortMode ) {
 1177+ // do the requested sorting of the given array:
 1178+ switch( $sortMode ) {
 1179+ case 'asc':
 1180+ case 'asce':
 1181+ case 'ascending':
 1182+ sort( $array );
 1183+ break;
 1184+
 1185+ case 'desc':
 1186+ case 'descending':
 1187+ rsort( $array );
 1188+ break;
 1189+
 1190+ case 'rand':
 1191+ case 'random':
 1192+ shuffle( $array );
 1193+ break;
 1194+
 1195+ case 'reverse':
 1196+ $array = array_reverse( $array );
 1197+ break;
 1198+ } ;
 1199+ return $array;
 1200+ }
 1201+
 1202+ /**
 1203+ * Pretty much the same as Language::listToText() but allows us to set a custom comma separator.
 1204+ *
 1205+ * @since 2.0
 1206+ *
 1207+ * @param Array $array
 1208+ * @param string $commaSep
 1209+ *
 1210+ * @return string
 1211+ */
 1212+ public static function arrayToText( $array, $commaSep = null ) {
 1213+ global $wgLang;
 1214+ $commaSep = $commaSep === null ? self::$mDefaultSep : $commaSep;
 1215+ $s = '';
 1216+ $m = count( $array ) - 1;
 1217+ if ( $m == 1 ) {
 1218+ return $array[0] . $wgLang->getMessageFromDB( 'and' ) . $wgLang->getMessageFromDB( 'word-separator' ) . $array[1];
 1219+ } else {
 1220+ for ( $i = $m; $i >= 0; $i-- ) {
 1221+ if ( $i == $m ) {
 1222+ $s = $array[$i];
 1223+ } else if ( $i == $m - 1 ) {
 1224+ $s = $array[$i] . $wgLang->getMessageFromDB( 'and' ) . $wgLang->getMessageFromDB( 'word-separator' ) . $s;
 1225+ } else {
 1226+ $s = $array[$i] . $commaSep . $s;
 1227+ }
 1228+ }
 1229+ return $s;
 1230+ }
 1231+ }
 1232+
 1233+ /**
 1234+ * Escapes a string so it can be used within PPFrame::expand() expansion without actually being
 1235+ * changed because of special characters.
 1236+ * Respects the configuration variable '$egArraysEscapeTemplates'.
 1237+ *
 1238+ * @since 2.0
 1239+ *
 1240+ * @param string $string
 1241+ * @return string
 1242+ */
 1243+ public static function escapeForExpansion( $string ) {
 1244+ global $egArraysExpansionEscapeTemplates;
 1245+
 1246+ if( $egArraysExpansionEscapeTemplates === null ) {
 1247+ return $string;
 1248+ }
 1249+
 1250+ $string = strtr(
 1251+ $string,
 1252+ $egArraysExpansionEscapeTemplates
 1253+ );
 1254+
 1255+ return $string;
 1256+ }
 1257+
 1258+ /**
 1259+ * Decides for the given $pattern whether its a valid regular expression acceptable for
 1260+ * Arrays parser functions or not.
 1261+ *
 1262+ * @param string $pattern regular expression including delimiters and optional flags
 1263+ * @param bool $forRegexFun whether the regular expression is inteded to be used with 'Regex Fun'
 1264+ * if supported by the wikis infrastructure. In case 'Regex Fun' is not available,
 1265+ * the default validation will be used.
 1266+ *
 1267+ * @return boolean
 1268+ */
 1269+ static function isValidRegEx( $pattern, $forRegexFun = false ) {
 1270+ if( $forRegexFun && self::hasRegexFunSupport() ) {
 1271+ return ExtRegexFun::validateRegex( $pattern );
 1272+ }
 1273+
 1274+ if( ! preg_match( '/^([\\/\\|%]).*\\1[imsSuUx]*$/', $pattern ) ) {
 1275+ return false;
 1276+ }
 1277+ wfSuppressWarnings(); // instead of using the evil @ operator!
 1278+ $isValid = false !== preg_match( $pattern, ' ' ); // preg_match returns false on error
 1279+ wfRestoreWarnings();
 1280+ return $isValid;
 1281+ }
 1282+
 1283+ /**
 1284+ * Whether 'Regex Fun' extension is available in this wiki to take over preg_replace handling
 1285+ * for '#arraysearcharray' function.
 1286+ */
 1287+ static function hasRegexFunSupport() {
 1288+ static $support = null;
 1289+ if( $support === null ) {
 1290+ $support = (
 1291+ defined( 'ExtRegexFun::VERSION' )
 1292+ && version_compare( ExtRegexFun::VERSION, '1.0.1', '>=' )
 1293+ );
 1294+ }
 1295+ return $support;
 1296+ }
 1297+}
Property changes on: tags/extensions/Arrays/REL_2_0rc1/Arrays.php
___________________________________________________________________
Added: svn:eol-style
11298 + native
Index: tags/extensions/Arrays/REL_2_0rc1/Arrays_Settings.php
@@ -0,0 +1,47 @@
 2+<?php
 3+
 4+/**
 5+ * File defining the settings for the 'Arrays' extension.
 6+ * More info can be found at http://www.mediawiki.org/wiki/Extension:Arrays#Configuration
 7+ *
 8+ * NOTICE:
 9+ * =======
 10+ * Changing one of these settings can be done by copying and placing
 11+ * it in LocalSettings.php, AFTER the inclusion of 'Arrays'.
 12+ *
 13+ * @file Arrays_Settings.php
 14+ * @ingroup Arrays
 15+ * @since 2.0
 16+ *
 17+ * @author Daniel Werner
 18+ */
 19+
 20+/**
 21+ * Full compatbility to versions before 1.4.
 22+ * Set to false by default since version 2.0.
 23+ *
 24+ * @since 2.0 (as '$egArrayExtensionCompatbilityMode' in 1.4 alpha)
 25+ *
 26+ * @var boolean
 27+ */
 28+$egArraysCompatibilityMode = false;
 29+
 30+/**
 31+ * Contains a key-value pair list of characters that should be replaced by a template or parser function
 32+ * call within array values included into an '#arrayprint'. By replacing these special characters before
 33+ * including the values into the string which is being expanded afterwards, array values can't distract
 34+ * the surounding MW code. Otherwise the array values themselves would be parsed as well.
 35+ *
 36+ * This has no effect in case $egArraysCompatibilityMode is set to false! If set to null, Arrays will
 37+ * jump to compatbility mode behavior on this, independently from $egArraysCompatibilityMode.
 38+ *
 39+ * @since 2.0
 40+ *
 41+ * @var array|null
 42+ */
 43+$egArraysExpansionEscapeTemplates = array(
 44+ '=' => '{{=}}',
 45+ '|' => '{{!}}',
 46+ '{{' => '{{((}}',
 47+ '}}' => '{{))}}'
 48+);
\ No newline at end of file
Property changes on: tags/extensions/Arrays/REL_2_0rc1/Arrays_Settings.php
___________________________________________________________________
Added: svn:eol-style
149 + native
Index: tags/extensions/Arrays/REL_2_0rc1/COPYING
@@ -0,0 +1,27 @@
 2+The MIT License
 3+
 4+ Copyright (c) 2008 - 2011
 5+
 6+
 7+ Permission is hereby granted, free of charge, to any person
 8+ obtaining a copy of this software and associated documentation
 9+ files (the "Software"), to deal in the Software without
 10+ restriction, including without limitation the rights to use,
 11+ copy, modify, merge, publish, distribute, sublicense, and/or sell
 12+ copies of the Software, and to permit persons to whom the
 13+ Software is furnished to do so, subject to the following
 14+ conditions:
 15+
 16+
 17+ The above copyright notice and this permission notice shall be
 18+ included in all copies or substantial portions of the Software.
 19+
 20+
 21+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 22+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 23+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 24+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 25+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 26+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 27+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 28+ OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
Property changes on: tags/extensions/Arrays/REL_2_0rc1/COPYING
___________________________________________________________________
Added: svn:eol-style
129 + native
Index: tags/extensions/Arrays/REL_2_0rc1/README
@@ -0,0 +1,30 @@
 2+== About ==
 3+
 4+The 'Arrays' extension (former 'ArrayExtension') Enhances the parser with functions
 5+to handle arrays within wiki markup text.
 6+
 7+* Website: http://www.mediawiki.org/wiki/Extension:Arrays
 8+* Authors: Li Ding, Jie Bao, Daniel Werner < danweetz@web.de >
 9+* License: MIT license
 10+
 11+
 12+== Installation ==
 13+
 14+Once you have downloaded the code, place the 'Array' directory within your
 15+MediaWiki 'extensions' directory. Then add the following code to your
 16+[[Manual:LocalSettings.php|LocalSettings.php]] file:
 17+
 18+ # Arrays
 19+ require_once( "$IP/extensions/Arrays/Arrays.php" );
 20+
 21+Be aware of breaking behavioral changes introduced after version 1.3.2. There is a
 22+new configuration variable '$egArraysCompatibilityMode' for switching back to old
 23+behavior though. For further information see the 'RELEASE-NOTES' file.
 24+
 25+
 26+== Contributing ==
 27+
 28+If you have bug reports or feature requests, please add them to the 'Arrays'
 29+Talk page [0]. You can also send them to Daniel Werner < danweetz@web.de >
 30+
 31+[0] http://www.mediawiki.org/w/index.php?title=Extension_talk:Arrays
Property changes on: tags/extensions/Arrays/REL_2_0rc1/README
___________________________________________________________________
Added: svn:eol-style
132 + native

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105119Release 2.0rcdanwe17:47, 4 December 2011

Status & tagging log