Index: trunk/extensions/ExternalData/ED_Settings.php |
— | — | @@ -1,66 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Initialization file for the External Data extension |
5 | | - * |
6 | | - * @file |
7 | | - * @ingroup ExternalData |
8 | | - * @author Yaron Koren |
9 | | - */ |
10 | | - |
11 | | -if (!defined('MEDIAWIKI')) die(); |
12 | | - |
13 | | -$wgExtensionCredits['parserhook'][]= array( |
14 | | - 'path' => __FILE__, |
15 | | - 'name' => 'External Data', |
16 | | - 'version' => '0.6', |
17 | | - 'author' => array( 'Yaron Koren', 'Michael Dale' ), |
18 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:External_Data', |
19 | | - 'description' => 'Allows for retrieving data in CSV, JSON and XML formats from both external URLs and local wiki pages', |
20 | | - 'descriptionmsg' => 'externaldata-desc', |
21 | | -); |
22 | | -$edgIP = $IP . '/extensions/ExternalData'; |
23 | | - |
24 | | -$wgExtensionFunctions[] = 'edgParserFunctions'; |
25 | | -$wgExtensionMessagesFiles['ExternalData'] = $edgIP . '/ExternalData.i18n.php'; |
26 | | -$wgHooks['LanguageGetMagic'][] = 'edgLanguageGetMagic'; |
27 | | - |
28 | | -// register all special pages and other classes |
29 | | -$wgAutoloadClasses['EDUtils'] = $edgIP . '/ED_Utils.php'; |
30 | | -$wgAutoloadClasses['EDParserFunctions'] = $edgIP . '/ED_ParserFunctions.php'; |
31 | | -$wgSpecialPages['GetData'] = 'EDGetData'; |
32 | | -$wgAutoloadClasses['EDGetData'] = $edgIP . '/ED_GetData.php'; |
33 | | -$wgSpecialPageGroups['GetData'] = 'pagetools'; |
34 | | - |
35 | | -$edgValues = array(); |
36 | | -$edgStringReplacements = array(); |
37 | | -$edgCacheTable = null; |
38 | | - |
39 | | -function edgParserFunctions() { |
40 | | - global $wgHooks, $wgParser; |
41 | | - if( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { |
42 | | - $wgHooks['ParserFirstCallInit'][] = 'edgRegisterParser'; |
43 | | - } else { |
44 | | - if ( class_exists( 'StubObject' ) && !StubObject::isRealObject( $wgParser ) ) { |
45 | | - $wgParser->_unstub(); |
46 | | - } |
47 | | - edgRegisterParser( $wgParser ); |
48 | | - } |
49 | | -} |
50 | | - |
51 | | -function edgRegisterParser(&$parser) { |
52 | | - $parser->setFunctionHook( 'get_external_data', array('EDParserFunctions','doGetExternalData') ); |
53 | | - $parser->setFunctionHook( 'external_value', array('EDParserFunctions','doExternalValue') ); |
54 | | - $parser->setFunctionHook( 'for_external_table', array('EDParserFunctions','doForExternalTable') ); |
55 | | - |
56 | | - return true; // always return true, in order not to stop MW's hook processing! |
57 | | -} |
58 | | - |
59 | | -function edgLanguageGetMagic( &$magicWords, $langCode = "en" ) { |
60 | | - switch ( $langCode ) { |
61 | | - default: |
62 | | - $magicWords['get_external_data'] = array ( 0, 'get_external_data' ); |
63 | | - $magicWords['external_value'] = array ( 0, 'external_value' ); |
64 | | - $magicWords['for_external_table'] = array ( 0, 'for_external_table' ); |
65 | | - } |
66 | | - return true; |
67 | | -} |
Index: trunk/extensions/ExternalData/ExternalData.php |
— | — | @@ -0,0 +1,66 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Initialization file for the External Data extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup ExternalData |
| 8 | + * @author Yaron Koren |
| 9 | + */ |
| 10 | + |
| 11 | +if (!defined('MEDIAWIKI')) die(); |
| 12 | + |
| 13 | +$wgExtensionCredits['parserhook'][]= array( |
| 14 | + 'path' => __FILE__, |
| 15 | + 'name' => 'External Data', |
| 16 | + 'version' => '0.6', |
| 17 | + 'author' => array( 'Yaron Koren', 'Michael Dale' ), |
| 18 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:External_Data', |
| 19 | + 'description' => 'Allows for retrieving data in CSV, JSON and XML formats from both external URLs and local wiki pages', |
| 20 | + 'descriptionmsg' => 'externaldata-desc', |
| 21 | +); |
| 22 | +$edgIP = $IP . '/extensions/ExternalData'; |
| 23 | + |
| 24 | +$wgExtensionFunctions[] = 'edgParserFunctions'; |
| 25 | +$wgExtensionMessagesFiles['ExternalData'] = $edgIP . '/ExternalData.i18n.php'; |
| 26 | +$wgHooks['LanguageGetMagic'][] = 'edgLanguageGetMagic'; |
| 27 | + |
| 28 | +// register all special pages and other classes |
| 29 | +$wgAutoloadClasses['EDUtils'] = $edgIP . '/ED_Utils.php'; |
| 30 | +$wgAutoloadClasses['EDParserFunctions'] = $edgIP . '/ED_ParserFunctions.php'; |
| 31 | +$wgSpecialPages['GetData'] = 'EDGetData'; |
| 32 | +$wgAutoloadClasses['EDGetData'] = $edgIP . '/ED_GetData.php'; |
| 33 | +$wgSpecialPageGroups['GetData'] = 'pagetools'; |
| 34 | + |
| 35 | +$edgValues = array(); |
| 36 | +$edgStringReplacements = array(); |
| 37 | +$edgCacheTable = null; |
| 38 | + |
| 39 | +function edgParserFunctions() { |
| 40 | + global $wgHooks, $wgParser; |
| 41 | + if( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { |
| 42 | + $wgHooks['ParserFirstCallInit'][] = 'edgRegisterParser'; |
| 43 | + } else { |
| 44 | + if ( class_exists( 'StubObject' ) && !StubObject::isRealObject( $wgParser ) ) { |
| 45 | + $wgParser->_unstub(); |
| 46 | + } |
| 47 | + edgRegisterParser( $wgParser ); |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +function edgRegisterParser(&$parser) { |
| 52 | + $parser->setFunctionHook( 'get_external_data', array('EDParserFunctions','doGetExternalData') ); |
| 53 | + $parser->setFunctionHook( 'external_value', array('EDParserFunctions','doExternalValue') ); |
| 54 | + $parser->setFunctionHook( 'for_external_table', array('EDParserFunctions','doForExternalTable') ); |
| 55 | + |
| 56 | + return true; // always return true, in order not to stop MW's hook processing! |
| 57 | +} |
| 58 | + |
| 59 | +function edgLanguageGetMagic( &$magicWords, $langCode = "en" ) { |
| 60 | + switch ( $langCode ) { |
| 61 | + default: |
| 62 | + $magicWords['get_external_data'] = array ( 0, 'get_external_data' ); |
| 63 | + $magicWords['external_value'] = array ( 0, 'external_value' ); |
| 64 | + $magicWords['for_external_table'] = array ( 0, 'for_external_table' ); |
| 65 | + } |
| 66 | + return true; |
| 67 | +} |
Property changes on: trunk/extensions/ExternalData/ExternalData.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 68 | + native |
Index: trunk/extensions/ExternalData/README |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | within your MediaWiki 'extensions' directory, then add the following |
43 | 43 | line to your 'LocalSettings.php' file: |
44 | 44 | |
45 | | - require_once( "$IP/extensions/ExternalData/ED_Settings.php" ); |
| 45 | + require_once( "$IP/extensions/ExternalData/ExternalData.php" ); |
46 | 46 | |
47 | 47 | To cache the data from the URLs being accessed, you can call the contents |
48 | 48 | of ExternalData.sql in your database, then add the following to |