Index: trunk/extensions/Arrays/RELEASE-NOTES |
— | — | @@ -6,9 +6,9 @@ |
7 | 7 | 'ArrayExtension' is now simply called 'Arrays'. Therefore you have to adjust your LocalSettings.php. |
8 | 8 | - '#arrayindex' will only expand options/default when required. |
9 | 9 | - '#arraymerge', '#arrayunion', '#arraydiff' and '#arrayintersect' can handle multiple arrays now. |
10 | | - - Compatibility mode variable '$egArrayExtensionCompatbilityMode' is set to false by default. See |
11 | | - Version 1.4 alpha for further information. Further changes to the compatibility mode behavior |
12 | | - in version 2.0: |
| 10 | + - Compatibility mode variable '$egArraysCompatibilityMode' ('$egArrayExtensionCompatbilityMode' in |
| 11 | + Version 1.4 alpha) is set to false by default. See Version 1.4 alpha for further information. |
| 12 | + - Additional changes to the compatibility mode behavior in version 2.0 include: |
13 | 13 | + '#arrayindex' will return its default also in case of existing index but empty value. This |
14 | 14 | makes the function consistent with Variables '#var' and hash tables '#hashvalue'. |
15 | 15 | + '#arraymerge', '#arrayunion', '#arraydiff' and '#arrayintersect' with only one array for |
Index: trunk/extensions/Arrays/Arrays.php |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | * @since 2.0 |
80 | 80 | */ |
81 | 81 | public static function init( Parser &$parser ) { |
82 | | - global $egArrayExtensionCompatbilityMode; |
| 82 | + global $egArraysCompatibilityMode; |
83 | 83 | /* |
84 | 84 | * store for arrays per Parser object. This will solve several bugs related to |
85 | 85 | * 'ParserClearState' hook clearing all variables early in combination with certain |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | $parser->mExtArrays = new self(); |
89 | 89 | |
90 | 90 | // initialize default separator for '#arrayprint' |
91 | | - if( $egArrayExtensionCompatbilityMode ) { |
| 91 | + if( $egArraysCompatibilityMode ) { |
92 | 92 | // COMPATIBILITY-MODE |
93 | 93 | self::$mDefaultSep = ', '; |
94 | 94 | } |
— | — | @@ -278,7 +278,7 @@ |
279 | 279 | * {{#arrayprint:b|<br/>|@@@|[[name::@@@]]}} -- make SMW links |
280 | 280 | */ |
281 | 281 | static function pfObj_arrayprint( Parser &$parser, PPFrame $frame, $args ) { |
282 | | - global $egArrayExtensionCompatbilityMode, $egArraysExpansionEscapeTemplates; |
| 282 | + global $egArraysCompatibilityMode, $egArraysExpansionEscapeTemplates; |
283 | 283 | |
284 | 284 | // Get Parameters |
285 | 285 | $arrayId = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : ''; |
— | — | @@ -301,7 +301,7 @@ |
302 | 302 | |
303 | 303 | if( $array === null ) { |
304 | 304 | // array we want to print doesn't exist! |
305 | | - if( ! $egArrayExtensionCompatbilityMode ) { |
| 305 | + if( ! $egArraysCompatibilityMode ) { |
306 | 306 | return ''; |
307 | 307 | } else { |
308 | 308 | // COMPATIBILITY-MODE |
— | — | @@ -313,7 +313,7 @@ |
314 | 314 | |
315 | 315 | foreach( $array as $val ) { |
316 | 316 | |
317 | | - if( ! $egArrayExtensionCompatbilityMode ) { |
| 317 | + if( ! $egArraysCompatibilityMode ) { |
318 | 318 | // NO COMPATIBILITY-MODE |
319 | 319 | /** |
320 | 320 | * escape the array value so it won't destroy the users wiki markup expression. |
— | — | @@ -351,7 +351,7 @@ |
352 | 352 | break; |
353 | 353 | } |
354 | 354 | |
355 | | - if( $egArrayExtensionCompatbilityMode || $egArraysExpansionEscapeTemplates === null ) { |
| 355 | + if( $egArraysCompatibilityMode || $egArraysExpansionEscapeTemplates === null ) { |
356 | 356 | // COMPATIBLITY-MODE: |
357 | 357 | /* |
358 | 358 | * don't leave the final parse to Parser::braceSubstitution() since there are some special cases where it |
— | — | @@ -370,7 +370,7 @@ |
371 | 371 | * {{#arrayindex:arrayid|index}} |
372 | 372 | */ |
373 | 373 | static function pfObj_arrayindex( Parser &$parser, PPFrame $frame, $args ) { |
374 | | - global $egArrayExtensionCompatbilityMode; |
| 374 | + global $egArraysCompatibilityMode; |
375 | 375 | |
376 | 376 | // Get Parameters |
377 | 377 | $arrayId = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : ''; |
— | — | @@ -384,14 +384,14 @@ |
385 | 385 | // get value or null if it doesn't exist. Takes care of negative index as well |
386 | 386 | $val = self::get( $parser )->getArrayValue( $arrayId, $index ); |
387 | 387 | |
388 | | - if( $val === null || ( $val === '' && !$egArrayExtensionCompatbilityMode ) ) { |
| 388 | + if( $val === null || ( $val === '' && !$egArraysCompatibilityMode ) ) { |
389 | 389 | // index doesn't exist, return default (parameter 3)! |
390 | 390 | // without compatibility, also return default in case of empty string '' |
391 | 391 | |
392 | 392 | // only expand default when needed |
393 | 393 | $defaultOrOptions = trim( $frame->expand( $rawOptions ) ); |
394 | 394 | |
395 | | - if( $egArrayExtensionCompatbilityMode ) { |
| 395 | + if( $egArraysCompatibilityMode ) { |
396 | 396 | // COMPATIBILITY-MODE |
397 | 397 | // now parse the options, and do posterior process on the created array |
398 | 398 | $options = self::parse_options( $defaultOrOptions ); |
— | — | @@ -480,12 +480,12 @@ |
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
484 | | - global $egArrayExtensionCompatbilityMode; |
| 484 | + global $egArraysCompatibilityMode; |
485 | 485 | |
486 | 486 | // no match! (Expand only when needed!) |
487 | 487 | $no = isset( $args[4] ) |
488 | 488 | ? trim( $frame->expand( $args[4] ) ) |
489 | | - : $egArrayExtensionCompatbilityMode ? '-1' : ''; // COMPATIBILITY-MODE |
| 489 | + : $egArraysCompatibilityMode ? '-1' : ''; // COMPATIBILITY-MODE |
490 | 490 | return $no; |
491 | 491 | } |
492 | 492 | |
— | — | @@ -509,8 +509,8 @@ |
510 | 510 | $store = self::get( $parser ); |
511 | 511 | |
512 | 512 | if( $arrayId === null ) { |
513 | | - global $egArrayExtensionCompatbilityMode; |
514 | | - if( ! $egArrayExtensionCompatbilityMode ) { // COMPATIBILITY-MODE |
| 513 | + global $egArraysCompatibilityMode; |
| 514 | + if( ! $egArraysCompatibilityMode ) { // COMPATIBILITY-MODE |
515 | 515 | $store->setArray( $arrayId_new ); |
516 | 516 | } |
517 | 517 | return ''; |
— | — | @@ -591,8 +591,8 @@ |
592 | 592 | static function pf_arrayslice( Parser &$parser, $arrayId_new, $arrayId = null , $offset = 0, $length = null ) { |
593 | 593 | $store = self::get( $parser ); |
594 | 594 | if( $arrayId === null ) { |
595 | | - global $egArrayExtensionCompatbilityMode; |
596 | | - if( ! $egArrayExtensionCompatbilityMode ) { // COMPATIBILITY-MODE |
| 595 | + global $egArraysCompatibilityMode; |
| 596 | + if( ! $egArraysCompatibilityMode ) { // COMPATIBILITY-MODE |
597 | 597 | $store->setArray( $arrayId_new ); |
598 | 598 | } |
599 | 599 | return ''; |
— | — | @@ -632,9 +632,9 @@ |
633 | 633 | * {{#arrayreset:arrayid1,arrayid2,...arrayidn}} |
634 | 634 | */ |
635 | 635 | static function pfObj_arrayreset( Parser &$parser, PPFrame $frame, $args) { |
636 | | - global $egArrayExtensionCompatbilityMode; |
| 636 | + global $egArraysCompatibilityMode; |
637 | 637 | |
638 | | - if( $egArrayExtensionCompatbilityMode && count( $args ) == 1 ) { |
| 638 | + if( $egArraysCompatibilityMode && count( $args ) == 1 ) { |
639 | 639 | /* |
640 | 640 | * COMPATIBILITY-MODE: before arrays were separated by ';' which is an bad idea since |
641 | 641 | * the ',' is an allowed character in array names! |
— | — | @@ -839,9 +839,9 @@ |
840 | 840 | $lastArray = array(); |
841 | 841 | } |
842 | 842 | |
843 | | - global $egArrayExtensionCompatbilityMode; |
| 843 | + global $egArraysCompatibilityMode; |
844 | 844 | |
845 | | - if( ! $operationRan && $egArrayExtensionCompatbilityMode |
| 845 | + if( ! $operationRan && $egArraysCompatibilityMode |
846 | 846 | && $operationFunc !== 'multi_arraymerge' // only exception was 'arraymerge' |
847 | 847 | ) { |
848 | 848 | /* |
— | — | @@ -922,8 +922,8 @@ |
923 | 923 | || ! array_key_exists( $arrayId, $this->mArrays ) |
924 | 924 | || ! is_array( $this->mArrays[ $arrayId ] ) |
925 | 925 | ) { |
926 | | - global $egArrayExtensionCompatbilityMode; |
927 | | - if( $egArrayExtensionCompatbilityMode ) { |
| 926 | + global $egArraysCompatibilityMode; |
| 927 | + if( $egArraysCompatibilityMode ) { |
928 | 928 | return "undefined array: $arrayId"; // COMPATIBILITY-MODE |
929 | 929 | } else { |
930 | 930 | return ''; |
Index: trunk/extensions/Arrays/Arrays_Settings.php |
— | — | @@ -18,14 +18,13 @@ |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Full compatbility to versions before 1.4. |
22 | | - * Set to true by default since version 2.0. |
23 | | - * Regretable, this one has a speclling error... |
| 22 | + * Set to false by default since version 2.0. |
24 | 23 | * |
25 | | - * @since 1.4 alpha |
| 24 | + * @since 2.0 (as '$egArrayExtensionCompatbilityMode' in 1.4 alpha) |
26 | 25 | * |
27 | 26 | * @var boolean |
28 | 27 | */ |
29 | | -$egArrayExtensionCompatbilityMode = false; |
| 28 | +$egArraysCompatibilityMode = false; |
30 | 29 | |
31 | 30 | /** |
32 | 31 | * Contains a key-value pair list of characters that should be replaced by a template or parser function |
— | — | @@ -33,8 +32,8 @@ |
34 | 33 | * including the values into the string which is being expanded afterwards, array values can't distract |
35 | 34 | * the surounding MW code. Otherwise the array values themselves would be parsed as well. |
36 | 35 | * |
37 | | - * This has no effect in case $egArrayExtensionCompatbilityMode is set to false! If set to null, Arrays |
38 | | - * will jump to compatbility mode behavior on this, independently from $egArrayExtensionCompatbilityMode. |
| 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. |
39 | 38 | * |
40 | 39 | * @since 2.0 |
41 | 40 | * |
— | — | @@ -45,5 +44,4 @@ |
46 | 45 | '|' => '{{!}}', |
47 | 46 | '{{' => '{{((}}', |
48 | 47 | '}}' => '{{))}}' |
49 | | -); |
50 | | -$egArraysExpansionEscapeTemplates = null; |
\ No newline at end of file |
| 48 | +); |
\ No newline at end of file |