Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php |
— | — | @@ -8,22 +8,10 @@ |
9 | 9 | |
10 | 10 | if (!defined('MEDIAWIKI')) die(); |
11 | 11 | |
12 | | -global $IP; |
13 | | -require_once( "$IP/includes/SpecialPage.php" ); |
14 | | -global $smwgIP; |
15 | | -require_once( "$smwgIP/includes/SMW_QueryProcessor.php" ); |
16 | | - |
17 | | -function doSpecialAsk() { |
18 | | - SMW_AskPage::execute(); |
19 | | -} |
20 | | - |
21 | | -SpecialPage::addPage( new SpecialPage('Ask','',true,'doSpecialAsk',false) ); |
22 | | - |
23 | | - |
24 | 12 | class SMW_AskPage { |
25 | 13 | |
26 | 14 | static function execute() { |
27 | | - global $wgRequest, $wgOut, $smwgQEnabled, $smwgQMaxLimit, $wgUser, $smwgQSortingSupport; |
| 15 | + global $wgRequest, $wgOut, $smwgQEnabled, $smwgQMaxLimit, $wgUser, $smwgQSortingSupport, $smwgIP; |
28 | 16 | |
29 | 17 | $skin = $wgUser->getSkin(); |
30 | 18 | |
— | — | @@ -56,6 +44,7 @@ |
57 | 45 | |
58 | 46 | // print results if any |
59 | 47 | if ($smwgQEnabled && ('' != $query) ) { |
| 48 | + include_once( "$smwgIP/includes/SMW_QueryProcessor.php" ); |
60 | 49 | $params = array('offset' => $offset, 'limit' => $limit, 'format' => 'broadtable', 'mainlabel' => ' ', 'link' => 'all', 'default' => wfMsg('smw_result_noresults'), 'sort' => $sort, 'order' => $order); |
61 | 50 | $queryobj = SMWQueryProcessor::createQuery($query, $params, false); |
62 | 51 | $res = smwfGetStore()->getQueryResult($queryobj); |
Index: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php |
— | — | @@ -9,14 +9,7 @@ |
10 | 10 | |
11 | 11 | if (!defined('MEDIAWIKI')) die(); |
12 | 12 | |
13 | | -// TODO: should these be messages? |
14 | | -global $wgMessageCache; |
15 | | -$wgMessageCache->addMessages(array('smwadmin' => 'Admin functions for Semantic MediaWiki')); |
16 | | - |
17 | | -SpecialPage::addPage( new SpecialPage('SMWAdmin','delete',true,'doSpecialSMWAdmin',false) ); |
18 | | - |
19 | | - |
20 | | -function doSpecialSMWAdmin($par = null) { |
| 13 | +function smwfSMWAdmin($par = null) { |
21 | 14 | global $IP; |
22 | 15 | require_once($IP . '/includes/SpecialPage.php' ); |
23 | 16 | require_once($IP . '/includes/Title.php' ); |
Index: trunk/extensions/SemanticMediaWiki/specials/URIResolver/SMW_SpecialURIResolver.php |
— | — | @@ -9,17 +9,6 @@ |
10 | 10 | |
11 | 11 | if (!defined('MEDIAWIKI')) die(); |
12 | 12 | |
13 | | -global $IP; |
14 | | -require_once( "$IP/includes/SpecialPage.php" ); |
15 | | - |
16 | | - |
17 | | -function doSpecialURIResolver($name = '') { |
18 | | - SMW_URIResolver::execute($name); |
19 | | -} |
20 | | - |
21 | | -SpecialPage::addPage( new SpecialPage('URIResolver','',false,'doSpecialURIResolver',false) ); |
22 | | - |
23 | | - |
24 | 13 | class SMW_URIResolver { |
25 | 14 | |
26 | 15 | static function execute($query = '') { |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php |
— | — | @@ -10,17 +10,9 @@ |
11 | 11 | |
12 | 12 | if (!defined('MEDIAWIKI')) die(); |
13 | 13 | |
14 | | -global $IP, $smwgIP; |
15 | | - |
16 | | -require_once( "$IP/includes/SpecialPage.php" ); |
| 14 | +global $smwgIP; |
17 | 15 | require_once( "$smwgIP/includes/storage/SMW_Store.php" ); |
18 | 16 | |
19 | | -function doSpecialSearchByProperty($query = '') { |
20 | | - SMW_SearchByProperty::execute($query); |
21 | | -} |
22 | | - |
23 | | -SpecialPage::addPage( new SpecialPage('SearchByProperty','',true,'doSpecialSearchByProperty',false) ); |
24 | | - |
25 | 17 | class SMW_SearchByProperty { |
26 | 18 | |
27 | 19 | static function execute($query = '') { |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -9,16 +9,9 @@ |
10 | 10 | |
11 | 11 | if (!defined('MEDIAWIKI')) die(); |
12 | 12 | |
13 | | -global $IP, $smwgIP; |
14 | | -require_once( "$IP/includes/SpecialPage.php" ); |
| 13 | +global $smwgIP; |
15 | 14 | require_once( "$smwgIP/includes/storage/SMW_Store.php" ); |
16 | 15 | |
17 | | -function doSpecialBrowse($query = '') { |
18 | | - SMW_SpecialBrowse::execute($query); |
19 | | -} |
20 | | - |
21 | | -SpecialPage::addPage( new SpecialPage('Browse','',true,'doSpecialBrowse','default',true) ); |
22 | | - |
23 | 16 | /*** |
24 | 17 | * A class to encapsulate the special page that allows browsing through |
25 | 18 | * the knowledge structure of a Semantic MediaWiki. |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php |
— | — | @@ -14,15 +14,6 @@ |
15 | 15 | require_once( "$IP/includes/SpecialPage.php" ); |
16 | 16 | require_once( "$smwgIP/includes/storage/SMW_Store.php" ); |
17 | 17 | |
18 | | - |
19 | | -function doSpecialPageProperty($query = '') { |
20 | | - SMW_PageProperty::execute($query); |
21 | | -} |
22 | | - |
23 | | -SpecialPage::addPage( new SpecialPage('PageProperty','',FALSE,'doSpecialPageProperty',false) ); |
24 | | - |
25 | | - |
26 | | - |
27 | 18 | class SMW_PageProperty { |
28 | 19 | |
29 | 20 | static function execute($query = '') { |
Index: trunk/extensions/SemanticMediaWiki/specials/ExportRDF/SMW_SpecialExportRDF.php |
— | — | @@ -10,13 +10,13 @@ |
11 | 11 | |
12 | 12 | if (!defined('MEDIAWIKI')) die(); |
13 | 13 | |
14 | | -global $IP; |
15 | | -require_once( "$IP/includes/SpecialPage.php" ); |
| 14 | +// global $IP; |
| 15 | +// require_once( "$IP/includes/SpecialPage.php" ); |
16 | 16 | |
17 | | -SpecialPage::addPage( new SpecialPage('ExportRDF','',true,'doSpecialExportRDF',false) ); |
| 17 | +//SpecialPage::addPage( new SpecialPage('ExportRDF','',true,'doSpecialExportRDF',false) ); |
18 | 18 | |
19 | 19 | |
20 | | -function doSpecialExportRDF($page = '') { |
| 20 | +function smwfExportRDF($page = '') { |
21 | 21 | global $wgOut, $wgRequest, $wgUser, $smwgAllowRecursiveExport, $smwgExportBacklinks; |
22 | 22 | |
23 | 23 | $recursive = 0; //default, no recursion |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -12,29 +12,6 @@ |
13 | 13 | |
14 | 14 | |
15 | 15 | /** |
16 | | - * This hook registers a parser-hook to the current parser. |
17 | | - * Note that parser hooks are something different than MW hooks |
18 | | - * in general, which explains the two-level registration. |
19 | | - */ |
20 | | -function smwfRegisterInlineQueries( $semantic, $mediawiki, $rules ) { |
21 | | - global $wgParser; |
22 | | - $wgParser->setHook( 'ask', 'smwfProcessInlineQuery' ); |
23 | | - return true; // always return true, in order not to stop MW's hook processing! |
24 | | -} |
25 | | - |
26 | | -/** |
27 | | - * The <ask> parser hook processing part. |
28 | | - */ |
29 | | -function smwfProcessInlineQuery($text, $param) { |
30 | | - global $smwgQEnabled; |
31 | | - if ($smwgQEnabled) { |
32 | | - return SMWQueryProcessor::getResultHTML($text,$param); |
33 | | - } else { |
34 | | - return smwfEncodeMessages(array(wfMsgForContent('smw_iq_disabled'))); |
35 | | - } |
36 | | -} |
37 | | - |
38 | | -/** |
39 | 16 | * Static class for accessing functions to generate and execute semantic queries |
40 | 17 | * and to serialise their results. |
41 | 18 | */ |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | // in the Export since we do not want to create a title object here when |
46 | 46 | // it is not needed in many cases. |
47 | 47 | if (!$complete && !($smwgNamespace === '')) $smwgNamespace = ".$smwgNamespace"; |
48 | | - $wgExtensionFunctions[] = 'smwgSetupExtension'; |
| 48 | + $wgExtensionFunctions[] = 'smwfSetupExtension'; |
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | |
— | — | @@ -52,7 +52,8 @@ |
53 | 53 | * Do the actual intialisation of the extension. This is just a delayed init that makes sure |
54 | 54 | * MediaWiki is set up properly before we add our stuff. |
55 | 55 | */ |
56 | | -function smwgSetupExtension() { |
| 56 | +function smwfSetupExtension() { |
| 57 | + wfProfileIn('smwfSetupExtension'); |
57 | 58 | global $smwgVersion, $smwgNamespace, $smwgIP, $smwgStoreActive, $wgHooks, $wgExtensionCredits, $smwgEnableTemplateSupport, $smwgMasterStore, $wgArticlePath, $wgScriptPath, $wgServer; |
58 | 59 | |
59 | 60 | /** |
— | — | @@ -73,17 +74,9 @@ |
74 | 75 | smwfInitMessages(); |
75 | 76 | |
76 | 77 | ///// register specials ///// |
| 78 | + include_once($smwgIP . '/includes/SMW_SpecialPages.php'); |
77 | 79 | |
78 | | - //require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialSearchTriple.php'); // no longer supported |
79 | | - require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialSearchByProperty.php'); |
80 | | - require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialPageProperty.php'); |
81 | | - require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialBrowse.php'); |
82 | | - |
83 | | - require_once($smwgIP . '/specials/URIResolver/SMW_SpecialURIResolver.php'); |
84 | | - require_once($smwgIP . '/specials/ExportRDF/SMW_SpecialExportRDF.php'); |
85 | | - require_once($smwgIP . '/specials/SMWAdmin/SMW_SpecialSMWAdmin.php'); |
86 | 80 | //require_once($smwgIP . '/specials/OntologyImport/SMW_SpecialOntologyImport.php'); // broken, TODO: fix or delete |
87 | | - require_once($smwgIP . '/specials/AskSpecial/SMW_SpecialAsk.php'); |
88 | 81 | require_once($smwgIP . '/specials/ExtendedStatistics/SMW_SpecialExtendedStatistics.php'); |
89 | 82 | |
90 | 83 | require_once($smwgIP . '/specials/Relations/SMW_SpecialRelations.php'); |
— | — | @@ -94,10 +87,8 @@ |
95 | 88 | require_once($smwgIP . '/specials/Relations/SMW_SpecialTypes.php'); |
96 | 89 | |
97 | 90 | ///// register hooks ///// |
98 | | - |
99 | 91 | require_once($smwgIP . '/includes/SMW_Hooks.php'); |
100 | 92 | require_once($smwgIP . '/includes/SMW_RefreshTab.php'); |
101 | | - require_once($smwgIP . '/includes/SMW_QueryProcessor.php'); |
102 | 93 | |
103 | 94 | if ($smwgEnableTemplateSupport===true) { |
104 | 95 | $wgHooks['InternalParseBeforeLinks'][] = 'smwfParserHook'; //patch required; |
— | — | @@ -115,9 +106,34 @@ |
116 | 107 | ///// credits (see "Special:Version") ///// |
117 | 108 | $wgExtensionCredits['parserhook'][]= array('name'=>'Semantic MediaWiki', 'version'=>SMW_VERSION, 'author'=>"Klaus Lassleben, Markus Krötzsch, Denny Vrandecic, S Page, and others. Maintained by [http://www.aifb.uni-karlsruhe.de/Forschungsgruppen/WBS/english AIFB Karlsruhe].", 'url'=>'http://ontoworld.org/wiki/Semantic_MediaWiki', 'description' => 'Making your wiki more accessible – for machines \'\'and\'\' humans. [http://ontoworld.org/wiki/Help:Semantics View online documentation.]'); |
118 | 109 | |
| 110 | + wfProfileOut('smwfSetupExtension'); |
119 | 111 | return true; |
120 | 112 | } |
121 | 113 | |
| 114 | +/** |
| 115 | + * This hook registers a parser-hook to the current parser. |
| 116 | + * Note that parser hooks are something different than MW hooks |
| 117 | + * in general, which explains the two-level registration. |
| 118 | + */ |
| 119 | +function smwfRegisterInlineQueries( $semantic, $mediawiki, $rules ) { |
| 120 | + global $wgParser; |
| 121 | + $wgParser->setHook( 'ask', 'smwfProcessInlineQuery' ); |
| 122 | + return true; // always return true, in order not to stop MW's hook processing! |
| 123 | +} |
| 124 | + |
| 125 | +/** |
| 126 | + * The <ask> parser hook processing part. |
| 127 | + */ |
| 128 | +function smwfProcessInlineQuery($text, $param) { |
| 129 | + global $smwgQEnabled, $smwgIP; |
| 130 | + if ($smwgQEnabled) { |
| 131 | + require_once($smwgIP . '/includes/SMW_QueryProcessor.php'); |
| 132 | + return SMWQueryProcessor::getResultHTML($text,$param); |
| 133 | + } else { |
| 134 | + return smwfEncodeMessages(array(wfMsgForContent('smw_iq_disabled'))); |
| 135 | + } |
| 136 | +} |
| 137 | + |
122 | 138 | /**********************************************/ |
123 | 139 | /***** Header modifications *****/ |
124 | 140 | /**********************************************/ |