Index: trunk/extensions/Widgets/Widgets.php |
— | — | @@ -24,11 +24,16 @@ |
25 | 25 | /** |
26 | 26 | * Set this to the index of the Widget namespace |
27 | 27 | */ |
28 | | -$widgetNamespaceIndex = 274; |
| 28 | +if ( !defined( 'NS_WIDGET' ) ) { |
| 29 | + define( 'NS_WIDGET', 274 ); |
| 30 | +} |
| 31 | +if ( !defined( 'NS_WIDGET_TALK' ) ) { |
| 32 | + define( 'NS_WIDGET_TALK', NS_WIDGET + 1 ); |
| 33 | +} elseif ( NS_WIDGET_TALK != NS_WIDGET + 1 ) { |
| 34 | + throw new MWException( 'Configuration error. Do not define NS_WIDGET_TALK, it is automatically set based on NS_WIDGET.' ); |
| 35 | +} |
29 | 36 | |
30 | | - |
31 | 37 | // Initialize Smarty |
32 | | - |
33 | 38 | require dirname(__FILE__)."/smarty/Smarty.class.php"; |
34 | 39 | |
35 | 40 | // Parser function registration |
— | — | @@ -173,12 +178,9 @@ |
174 | 179 | } |
175 | 180 | |
176 | 181 | function widgetNamespacesInit() { |
177 | | - global $widgetNamespaceIndex, $wgExtraNamespaces, $wgNamespacesWithSubpages, |
| 182 | + global $wgExtraNamespaces, $wgNamespacesWithSubpages, |
178 | 183 | $wgGroupPermissions, $wgNamespaceProtection; |
179 | 184 | |
180 | | - define('NS_WIDGET', $widgetNamespaceIndex); |
181 | | - define('NS_WIDGET_TALK', $widgetNamespaceIndex+1); |
182 | | - |
183 | 185 | // Register namespace identifiers |
184 | 186 | if (!is_array($wgExtraNamespaces)) { $wgExtraNamespaces=array(); } |
185 | 187 | $wgExtraNamespaces = $wgExtraNamespaces + array(NS_WIDGET => 'Widget', NS_WIDGET_TALK => 'Widget_talk'); |