Index: trunk/extensions/Loops/Loops.php |
— | — | @@ -77,7 +77,17 @@ |
78 | 78 | * @since 0.4 |
79 | 79 | */ |
80 | 80 | public static function init( Parser &$parser ) { |
81 | | - |
| 81 | + |
| 82 | + if( ! class_exists( 'ExtVariables' ) ) { |
| 83 | + /* |
| 84 | + * If Variables extension not defined, we can't use certain functions. |
| 85 | + * Make sure they are disabled: |
| 86 | + */ |
| 87 | + global $egLoopsDisabledFunctions; |
| 88 | + $disabledFunctions = array( 'loop', 'forargs', 'fornumargs' ); |
| 89 | + $egLoopsDisabledFunctions = array_merge( $egLoopsDisabledFunctions, $disabledFunctions ); |
| 90 | + } |
| 91 | + |
82 | 92 | /* |
83 | 93 | * store for loops count per parser object. This will solve several bugs related to |
84 | 94 | * 'ParserClearState' hook resetting the count early in combination with certain |
— | — | @@ -97,7 +107,7 @@ |
98 | 108 | global $egLoopsDisabledFunctions; |
99 | 109 | |
100 | 110 | // don't register parser function if disabled by configuration: |
101 | | - if( ! in_array( $name, $egLoopsDisabledFunctions ) ) { |
| 111 | + if( in_array( $name, $egLoopsDisabledFunctions ) ) { |
102 | 112 | return; |
103 | 113 | } |
104 | 114 | |
— | — | @@ -242,8 +252,8 @@ |
243 | 253 | */ |
244 | 254 | protected static function perform_forargs( Parser &$parser, PPFrame $frame, array $funcArgs, array $templateArgs, $prefix = '' ) { |
245 | 255 | // if not called within template instance: |
246 | | - if( !( $frame instanceof PPTemplateFrame_DOM ) ) { |
247 | | - return array( 'found' => false ); |
| 256 | + if( !( $frame->isTemplate() ) ) { |
| 257 | + return ''; |
248 | 258 | } |
249 | 259 | |
250 | 260 | // name of the variable to store the argument name: |
Index: trunk/extensions/Loops/RELEASE-NOTES |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | counter, for example including an special page in wikitext. This has been solved now. |
8 | 8 | - Compatbility to Variables Version 2.0. |
9 | 9 | - Configuration variable '$egLoopsDisabledFunctions' to disable certain Loops parser functions. |
| 10 | + - If 'Variables' extension is not active, '#loop', '#forargs' and '#fornumargs' will be disabled. |
10 | 11 | - Language file clean-up. |
11 | 12 | - Internal structure changed, ExtLoops now works as a static class. |
12 | 13 | - '#fornumargs' parameter 1 can be empty to make it more consistent with other Loop parser |