Index: trunk/extensions/Loops/Loops.php |
— | — | @@ -84,9 +84,9 @@ |
85 | 85 | * If Variables extension not defined, we can't use certain functions. |
86 | 86 | * Make sure they are disabled: |
87 | 87 | */ |
88 | | - global $egLoopsDisabledFunctions; |
| 88 | + global $egLoopsEnabledFunctions; |
89 | 89 | $disabledFunctions = array( 'loop', 'forargs', 'fornumargs' ); |
90 | | - $egLoopsDisabledFunctions = array_merge( $egLoopsDisabledFunctions, $disabledFunctions ); |
| 90 | + $egLoopsEnabledFunctions = array_diff( $egLoopsEnabledFunctions, $disabledFunctions ); |
91 | 91 | } |
92 | 92 | |
93 | 93 | /* |
— | — | @@ -105,10 +105,10 @@ |
106 | 106 | return true; |
107 | 107 | } |
108 | 108 | private static function initFunction( Parser &$parser, $name ) { |
109 | | - global $egLoopsDisabledFunctions; |
| 109 | + global $egLoopsEnabledFunctions; |
110 | 110 | |
111 | 111 | // don't register parser function if disabled by configuration: |
112 | | - if( in_array( $name, $egLoopsDisabledFunctions ) ) { |
| 112 | + if( ! in_array( $name, $egLoopsEnabledFunctions ) ) { |
113 | 113 | return; |
114 | 114 | } |
115 | 115 | |
— | — | @@ -384,4 +384,5 @@ |
385 | 385 | |
386 | 386 | return true; |
387 | 387 | } |
| 388 | + |
388 | 389 | } |
Index: trunk/extensions/Loops/Loops_Settings.php |
— | — | @@ -17,13 +17,15 @@ |
18 | 18 | */ |
19 | 19 | |
20 | 20 | /** |
21 | | - * Allows to define which functionalities provided by 'Loops' should be disabled for the wiki. |
| 21 | + * Allows to define which functionalities provided by 'Loops' should be enabled for the wiki. |
| 22 | + * If extension 'Variables' is not installed, '#loop', '#forargs' and '#fornumargs' will be |
| 23 | + * disabled automatically. |
22 | 24 | * |
23 | 25 | * @example |
24 | | - * # disable 'fornumargs' and 'forargs' parser functions: |
25 | | - * $egLoopsDisabledFunctions = array( 'fornumargs', 'forargs' ); |
| 26 | + * # enable '#while' and '#dowhile' parser functions only: |
| 27 | + * egLoopsEnabledFunctions = array( 'while', 'dowhile' ); |
26 | 28 | * |
27 | 29 | * @since 0.4 |
28 | 30 | * @var array |
29 | 31 | */ |
30 | | -$egLoopsDisabledFunctions = array(); |
| 32 | +$egLoopsEnabledFunctions = array( 'while', 'dowhile', 'loop', 'forargs', 'fornumargs' ); |
Index: trunk/extensions/Loops/RELEASE-NOTES |
— | — | @@ -3,17 +3,18 @@ |
4 | 4 | |
5 | 5 | * (trunk) -- Version 0.4 alpha by Daniel Werner |
6 | 6 | - The loops count now counts per parser instance. Before there were several hacks to reset the |
7 | | - counter, for example including an special page in wikitext. This has been solved now. |
| 7 | + counter, for example a special-page inclusion. This has been solved now. |
| 8 | + - 'Loops' is working with MW 1.18+ now. Should be compatible down to MW 1.12. |
8 | 9 | - Compatbility to Variables Version 2.0. |
9 | | - - Configuration variable '$egLoopsDisabledFunctions' to disable certain Loops parser functions. |
| 10 | + - Configuration variable '$egLoopsEnabledFunctions' to enable certain Loops parser functions only. |
10 | 11 | - If 'Variables' extension is not active, '#loop', '#forargs' and '#fornumargs' will be disabled. |
11 | 12 | - If loop limit exceeded, the error message will be part of the output wrapped inside a 'div' |
12 | 13 | with error class so it can be caught by '#iferror'. |
13 | | - - Language file clean-up. |
14 | | - - Internal structure changed, ExtLoops now works as a static class. |
15 | 14 | - '#fornumargs' parameter 1 can be empty to make it more consistent with other Loop parser |
16 | 15 | functions. E.g. '{{#fornumargs: | keyVarName | valVarName | code }}' istead of |
17 | 16 | '{{#fornumargs: keyVarName | valVarName | code }}' (which still works as well). |
| 17 | + - Language file clean-up. |
| 18 | + - Internal structure changed, ExtLoops now works as a static class. |
18 | 19 | |
19 | 20 | * November 15, 2011 -- Version 0.3.2 by Daniel Werner |
20 | 21 | - Bug solved where '#loop' didn't create variables with name or starting index '0'. |