Index: trunk/extensions/Loops/Loops.php |
— | — | @@ -35,7 +35,10 @@ |
36 | 36 | $wgHooks['ParserFirstCallInit'][] = 'ExtLoops::init'; |
37 | 37 | $wgHooks['ParserClearState' ][] = 'ExtLoops::onParserClearState'; |
38 | 38 | |
| 39 | +// Include the settings file: |
| 40 | +require_once ExtLoops::getDir() . '/Loops_Settings.php'; |
39 | 41 | |
| 42 | + |
40 | 43 | /** |
41 | 44 | * Class representing extension 'Loops', containing all parser functions and other |
42 | 45 | * extension logic stuff. |
— | — | @@ -90,9 +93,16 @@ |
91 | 94 | |
92 | 95 | return true; |
93 | 96 | } |
94 | | - private static function initFunction( Parser &$parser, $name ) { |
| 97 | + private static function initFunction( Parser &$parser, $name ) { |
| 98 | + global $egLoopsDisabledFunctions; |
| 99 | + |
| 100 | + // don't register parser function if disabled by configuration: |
| 101 | + if( ! in_array( $name, $egLoopsDisabledFunctions ) ) { |
| 102 | + return; |
| 103 | + } |
| 104 | + |
95 | 105 | $functionCallback = array( __CLASS__, 'pfObj_' . $name ); |
96 | | - $parser->setFunctionHook( $name, $functionCallback, SFH_OBJECT_ARGS ); |
| 106 | + $parser->setFunctionHook( $name, $functionCallback, SFH_OBJECT_ARGS ); |
97 | 107 | } |
98 | 108 | |
99 | 109 | |
Index: trunk/extensions/Loops/Loops_Settings.php |
— | — | @@ -0,0 +1,29 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * File defining the settings for the 'Loops' extension. |
| 6 | + * More info can be found at http://www.mediawiki.org/wiki/Extension:Loops#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 'Loops'. |
| 12 | + * |
| 13 | + * @file Loops_Settings.php |
| 14 | + * @ingroup Loops |
| 15 | + * @since 0.4 |
| 16 | + * |
| 17 | + * @author Daniel Werner |
| 18 | + */ |
| 19 | + |
| 20 | +/** |
| 21 | + * Allows to define which functionalities provided by 'Loops' should be disabled for the wiki. |
| 22 | + * |
| 23 | + * @example |
| 24 | + * # disable 'fornumargs' and 'forargs' parser functions: |
| 25 | + * $egLoopsDisabledFunctions = array( 'fornumargs', 'forargs' ); |
| 26 | + * |
| 27 | + * @since 0.4 |
| 28 | + * @var array |
| 29 | + */ |
| 30 | +$egLoopsDisabledFunctions = array(); |
Property changes on: trunk/extensions/Loops/Loops_Settings.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 31 | + native |
Index: trunk/extensions/Loops/RELEASE-NOTES |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | - The loops count now counts per parser instance. Before there were several hacks to reset the |
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 | + - Configuration variable '$egLoopsDisabledFunctions' to disable certain Loops parser functions. |
9 | 10 | - Language file clean-up. |
10 | 11 | - Internal structure changed, ExtLoops now works as a static class. |
11 | 12 | - '#fornumargs' parameter 1 can be empty to make it more consistent with other Loop parser |