Index: branches/REL1_15/extensions/Widgets/Widgets.php |
— | — | @@ -7,29 +7,44 @@ |
8 | 8 | * @version $Id: Widgets.php 15 2008-06-25 21:22:40Z sergey.chernyshev $ |
9 | 9 | */ |
10 | 10 | |
| 11 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 12 | + echo "This file is not a valid entry point."; |
| 13 | + exit( 1 ); |
| 14 | +} |
| 15 | + |
11 | 16 | $wgExtensionCredits['parserhook'][] = array( |
12 | 17 | 'name' => 'Widgets', |
13 | 18 | 'description' => 'Allows wiki administrators to add free-form widgets to wiki by just editing pages within Widget namespace. Originally developed for [http://www.ardorado.com Ardorado.com]', |
14 | | - 'version' => '0.8.5', |
| 19 | + 'version' => '0.8.6', |
15 | 20 | 'author' => '[http://www.sergeychernyshev.com Sergey Chernyshev] (for [http://www.semanticcommunities.com Semantic Communities LLC.])', |
16 | 21 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Widgets' |
17 | 22 | ); |
18 | 23 | |
| 24 | +/** |
| 25 | + * Set this to the index of the Widget namespace |
| 26 | + */ |
| 27 | +if ( !defined( 'NS_WIDGET' ) ) { |
| 28 | + define( 'NS_WIDGET', 274 ); |
| 29 | +} |
| 30 | +if ( !defined( 'NS_WIDGET_TALK' ) ) { |
| 31 | + define( 'NS_WIDGET_TALK', NS_WIDGET + 1 ); |
| 32 | +} elseif ( NS_WIDGET_TALK != NS_WIDGET + 1 ) { |
| 33 | + throw new MWException( 'Configuration error. Do not define NS_WIDGET_TALK, it is automatically set based on NS_WIDGET.' ); |
| 34 | +} |
| 35 | + |
19 | 36 | // Initialize Smarty |
| 37 | +require dirname(__FILE__)."/smarty/Smarty.class.php"; |
20 | 38 | |
21 | | -require "$IP/extensions/Widgets/smarty/Smarty.class.php"; |
22 | | - |
23 | 39 | // Parser function registration |
24 | | -$wgExtensionFunctions[] = 'widgetParserFunctions'; |
| 40 | +$wgExtensionFunctions[] = 'widgetNamespacesInit'; |
25 | 41 | $wgHooks['LanguageGetMagic'][] = 'widgetLanguageGetMagic'; |
| 42 | +$wgHooks['ParserFirstCallInit'][] = 'widgetParserFunctions'; |
26 | 43 | |
27 | | -// Init Widget namespaces |
28 | | -widgetNamespacesInit(); |
| 44 | +function widgetParserFunctions( &$parser ) |
| 45 | +{ |
| 46 | + $parser->setFunctionHook('widget', 'renderWidget'); |
29 | 47 | |
30 | | -function widgetParserFunctions() |
31 | | -{ |
32 | | - global $wgParser; |
33 | | - $wgParser->setFunctionHook('widget', 'renderWidget'); |
| 48 | + return true; |
34 | 49 | } |
35 | 50 | |
36 | 51 | function widgetLanguageGetMagic( &$magicWords, $langCode = "en" ) |
— | — | @@ -162,16 +177,9 @@ |
163 | 178 | } |
164 | 179 | |
165 | 180 | function widgetNamespacesInit() { |
166 | | - global $widgetNamespaceIndex, $wgExtraNamespaces, $wgNamespacesWithSubpages, |
| 181 | + global $wgExtraNamespaces, $wgNamespacesWithSubpages, |
167 | 182 | $wgGroupPermissions, $wgNamespaceProtection; |
168 | 183 | |
169 | | - if (!isset($widgetNamespaceIndex)) { |
170 | | - $widgetNamespaceIndex = 274; |
171 | | - } |
172 | | - |
173 | | - define('NS_WIDGET', $widgetNamespaceIndex); |
174 | | - define('NS_WIDGET_TALK', $widgetNamespaceIndex+1); |
175 | | - |
176 | 184 | // Register namespace identifiers |
177 | 185 | if (!is_array($wgExtraNamespaces)) { $wgExtraNamespaces=array(); } |
178 | 186 | $wgExtraNamespaces = $wgExtraNamespaces + array(NS_WIDGET => 'Widget', NS_WIDGET_TALK => 'Widget_talk'); |
Property changes on: branches/REL1_15/extensions/Widgets |
___________________________________________________________________ |
Name: svn:mergeinfo |
179 | 187 | + /trunk/extensions/Widgets:50477,50541,50898,50900 |