Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php |
— | — | @@ -8,9 +8,21 @@ |
9 | 9 | |
10 | 10 | if (!defined('MEDIAWIKI')) die(); |
11 | 11 | |
12 | | -class SMW_AskPage { |
| 12 | +global $IP; |
| 13 | +include_once($IP . '/includes/SpecialPage.php'); |
13 | 14 | |
14 | | - static function execute() { |
| 15 | +class SMWAskPage extends SpecialPage { |
| 16 | + |
| 17 | + /** |
| 18 | + * Constructor |
| 19 | + */ |
| 20 | + public function __construct() { |
| 21 | + smwfInitUserMessages(); |
| 22 | + parent::__construct('Ask'); |
| 23 | + } |
| 24 | + |
| 25 | + function execute() { |
| 26 | + wfProfileIn('doSpecialAsk (SMW)'); |
15 | 27 | global $wgRequest, $wgOut, $smwgQEnabled, $smwgQMaxLimit, $wgUser, $smwgQSortingSupport, $smwgIP; |
16 | 28 | |
17 | 29 | $skin = $wgUser->getSkin(); |
— | — | @@ -88,6 +100,7 @@ |
89 | 101 | $html .= '<br />' . wfMsgForContent('smw_iq_disabled'); |
90 | 102 | } |
91 | 103 | $wgOut->addHTML($html); |
| 104 | + wfProfileOut('doSpecialAsk (SMW)'); |
92 | 105 | } |
93 | 106 | |
94 | 107 | } |
Index: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php |
— | — | @@ -9,81 +9,98 @@ |
10 | 10 | |
11 | 11 | if (!defined('MEDIAWIKI')) die(); |
12 | 12 | |
13 | | -function smwfSMWAdmin($par = null) { |
14 | | - global $IP; |
15 | | - require_once($IP . '/includes/SpecialPage.php' ); |
16 | | - require_once($IP . '/includes/Title.php' ); |
| 13 | +global $IP; |
| 14 | +include_once($IP . '/includes/SpecialPage.php'); |
17 | 15 | |
18 | | - global $wgOut, $wgRequest; |
19 | | - global $wgServer; // "http://www.yourserver.org" |
20 | | - // (should be equal to 'http://'.$_SERVER['SERVER_NAME']) |
21 | | - global $wgScript; // "/subdirectory/of/wiki/index.php" |
22 | | - global $wgUser; |
| 16 | +class SMWAdmin extends SpecialPage { |
23 | 17 | |
24 | | - if ( ! $wgUser->isAllowed('delete') ) { |
25 | | - $wgOut->sysopRequired(); |
26 | | - return; |
| 18 | + /** |
| 19 | + * Constructor |
| 20 | + */ |
| 21 | + public function __construct() { |
| 22 | + smwfInitUserMessages(); |
| 23 | + global $wgMessageCache; ///TODO: should these be messages? |
| 24 | + $wgMessageCache->addMessages(array('smwadmin' => 'Admin functions for Semantic MediaWiki')); |
| 25 | + parent::__construct('SMWAdmin', 'delete'); |
27 | 26 | } |
28 | 27 | |
29 | | - $wgOut->setPageTitle(wfMsg('smwadmin')); |
30 | | - |
31 | | - /**** Execute actions if any ****/ |
32 | | - |
33 | | - $action = $wgRequest->getText( 'action' ); |
34 | | - if ( $action=='updatetables' ) { |
35 | | - $sure = $wgRequest->getText( 'udsure' ); |
36 | | - if ($sure == 'yes') { |
37 | | - $wgOut->disable(); // raw output |
38 | | - ob_start(); |
39 | | - print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"ltr\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Setting up Storage for Semantic MediaWiki</title></head><body><p><pre>"; |
40 | | - header( "Content-type: text/html; charset=UTF-8" ); |
41 | | - $result = smwfGetStore()->setup(); |
42 | | - print '</pre></p>'; |
43 | | - if ($result === true) { |
44 | | - print '<p><b>The storage engine was set up successfully.</b></p>'; |
45 | | - } |
46 | | - print '<p> Return to <a href="' . $wgServer . $wgScript . '/Special:SMWAdmin">Special:SMWAdmin</a></p>'; |
47 | | - print '</body></html>'; |
48 | | - ob_flush(); |
49 | | - flush(); |
| 28 | + public function execute($par = null) { |
| 29 | + global $IP; |
| 30 | + require_once($IP . '/includes/SpecialPage.php' ); |
| 31 | + require_once($IP . '/includes/Title.php' ); |
| 32 | + |
| 33 | + global $wgOut, $wgRequest; |
| 34 | + global $wgServer; // "http://www.yourserver.org" |
| 35 | + // (should be equal to 'http://'.$_SERVER['SERVER_NAME']) |
| 36 | + global $wgScript; // "/subdirectory/of/wiki/index.php" |
| 37 | + global $wgUser; |
| 38 | + |
| 39 | + if ( ! $wgUser->isAllowed('delete') ) { |
| 40 | + $wgOut->sysopRequired(); |
50 | 41 | return; |
51 | 42 | } |
| 43 | + |
| 44 | + $wgOut->setPageTitle(wfMsg('smwadmin')); |
| 45 | + |
| 46 | + /**** Execute actions if any ****/ |
| 47 | + |
| 48 | + $action = $wgRequest->getText( 'action' ); |
| 49 | + if ( $action=='updatetables' ) { |
| 50 | + $sure = $wgRequest->getText( 'udsure' ); |
| 51 | + if ($sure == 'yes') { |
| 52 | + $wgOut->disable(); // raw output |
| 53 | + ob_start(); |
| 54 | + print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"ltr\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Setting up Storage for Semantic MediaWiki</title></head><body><p><pre>"; |
| 55 | + header( "Content-type: text/html; charset=UTF-8" ); |
| 56 | + $result = smwfGetStore()->setup(); |
| 57 | + print '</pre></p>'; |
| 58 | + if ($result === true) { |
| 59 | + print '<p><b>The storage engine was set up successfully.</b></p>'; |
| 60 | + } |
| 61 | + print '<p> Return to <a href="' . $wgServer . $wgScript . '/Special:SMWAdmin">Special:SMWAdmin</a></p>'; |
| 62 | + print '</body></html>'; |
| 63 | + ob_flush(); |
| 64 | + flush(); |
| 65 | + return; |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + /**** Normal output ****/ |
| 70 | + |
| 71 | + $html = '<p>This special page helps you during installation and upgrade of |
| 72 | + Semantic MediaWiki. Remember to backup valuable data before |
| 73 | + executing administrative functions.</p>' . "\n"; |
| 74 | + // creating tables and converting contents from older versions |
| 75 | + $html .= '<form name="buildtables" action="" method="POST">' . "\n" . |
| 76 | + '<input type="hidden" name="action" value="updatetables" />' . "\n"; |
| 77 | + $html .= '<h2>Preparing database for Semantic MediaWiki</h2>' . "\n" . |
| 78 | + '<p>Semantic MediaWiki requires some minor extensions to the MediaWiki database in |
| 79 | + order to store the semantic data. The below function ensures that your database is |
| 80 | + set up properly. The changes made in this step do not affect the rest of the |
| 81 | + MediaWiki database, and can easily be undone if desired. This setup function |
| 82 | + can be executed multiple times without doing any harm, but it is needed only once on |
| 83 | + installation or upgrade.<p/>' . "\n"; |
| 84 | + $html .= '<p>If the operation fails with obscure SQL errors, the database user employed |
| 85 | + by your wiki (check your LocalSettings.php) probably does not have sufficient |
| 86 | + permissions. Either grant this user additional persmissions to create and delete |
| 87 | + tables, or temporarily enter the login of your database root in LocalSettings.php.<p/>' . |
| 88 | + "\n" . '<input type="hidden" name="udsure" value="yes"/>' . |
| 89 | + '<input type="submit" value="Initialise or upgrade tables"/>' . "\n"; |
| 90 | + |
| 91 | + $html .= '<h2>Getting support</h2>' . "\n" . |
| 92 | + '<p>Various resources might help you in case of problems:</p> |
| 93 | + <ul> |
| 94 | + <li> If you experience problems with your installation, start by checking the guidelines in the <a href="http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SemanticMediaWiki/INSTALL">INSTALL file</a>.</li> |
| 95 | + <li>The complete user documentation to Semantic MediaWiki is at <a href="http://ontoworld.org/wiki/Help:Semantics">ontoworld.org</a>.</li> |
| 96 | + <li>Bugs can be reported to <a href="http://bugzilla.wikimedia.org/">MediaZilla</a>.</li> |
| 97 | + <li>If you have further questions or suggestions, join the discussion on <a href="mailto:semediawiki-user@lists.sourceforge.net">semediawiki-user@lists.sourceforge.net</a>.</li> |
| 98 | + <ul/>' . "\n"; |
| 99 | + $html .= '</form>'; |
| 100 | + |
| 101 | + $wgOut->addHTML($html); |
| 102 | + return true; |
52 | 103 | } |
53 | 104 | |
54 | | - /**** Normal output ****/ |
55 | | - |
56 | | - $html = '<p>This special page helps you during installation and upgrade of |
57 | | - Semantic MediaWiki. Remember to backup valuable data before |
58 | | - executing administrative functions.</p>' . "\n"; |
59 | | - // creating tables and converting contents from older versions |
60 | | - $html .= '<form name="buildtables" action="" method="POST">' . "\n" . |
61 | | - '<input type="hidden" name="action" value="updatetables" />' . "\n"; |
62 | | - $html .= '<h2>Preparing database for Semantic MediaWiki</h2>' . "\n" . |
63 | | - '<p>Semantic MediaWiki requires some minor extensions to the MediaWiki database in |
64 | | - order to store the semantic data. The below function ensures that your database is |
65 | | - set up properly. The changes made in this step do not affect the rest of the |
66 | | - MediaWiki database, and can easily be undone if desired. This setup function |
67 | | - can be executed multiple times without doing any harm, but it is needed only once on |
68 | | - installation or upgrade.<p/>' . "\n"; |
69 | | - $html .= '<p>If the operation fails with obscure SQL errors, the database user employed |
70 | | - by your wiki (check your LocalSettings.php) probably does not have sufficient |
71 | | - permissions. Either grant this user additional persmissions to create and delete |
72 | | - tables, or temporarily enter the login of your database root in LocalSettings.php.<p/>' . |
73 | | - "\n" . '<input type="hidden" name="udsure" value="yes"/>' . |
74 | | - '<input type="submit" value="Initialise or upgrade tables"/>' . "\n"; |
75 | | - |
76 | | - $html .= '<h2>Getting support</h2>' . "\n" . |
77 | | - '<p>Various resources might help you in case of problems:</p> |
78 | | - <ul> |
79 | | - <li> If you experience problems with your installation, start by checking the guidelines in the <a href="http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SemanticMediaWiki/INSTALL">INSTALL file</a>.</li> |
80 | | - <li>The complete user documentation to Semantic MediaWiki is at <a href="http://ontoworld.org/wiki/Help:Semantics">ontoworld.org</a>.</li> |
81 | | - <li>Bugs can be reported to <a href="http://bugzilla.wikimedia.org/">MediaZilla</a>.</li> |
82 | | - <li>If you have further questions or suggestions, join the discussion on <a href="mailto:semediawiki-user@lists.sourceforge.net">semediawiki-user@lists.sourceforge.net</a>.</li> |
83 | | - <ul/>' . "\n"; |
84 | | - $html .= '</form>'; |
85 | | - |
86 | | - $wgOut->addHTML($html); |
87 | | - return true; |
88 | 105 | } |
89 | 106 | |
90 | 107 | // // Special function for fixing development testing DBs after messing around ... |
Index: trunk/extensions/SemanticMediaWiki/specials/URIResolver/SMW_SpecialURIResolver.php |
— | — | @@ -9,10 +9,22 @@ |
10 | 10 | |
11 | 11 | if (!defined('MEDIAWIKI')) die(); |
12 | 12 | |
13 | | -class SMW_URIResolver { |
| 13 | +global $IP; |
| 14 | +include_once($IP . '/includes/SpecialPage.php'); |
14 | 15 | |
15 | | - static function execute($query = '') { |
| 16 | +class SMWURIResolver extends SpecialPage { |
| 17 | + |
| 18 | + /** |
| 19 | + * Constructor |
| 20 | + */ |
| 21 | + public function __construct() { |
| 22 | + smwfInitUserMessages(); |
| 23 | + parent::__construct('URIResolver', '', false); |
| 24 | + } |
| 25 | + |
| 26 | + function execute($query = '') { |
16 | 27 | global $wgOut, $smwgIP; |
| 28 | + wfProfileIn('SpecialURIResolver::execute (SMW)'); |
17 | 29 | require_once( $smwgIP . '/specials/ExportRDF/SMW_SpecialExportRDF.php' ); |
18 | 30 | if ('' == $query) { |
19 | 31 | $wgOut->addHTML(wfMsg('smw_uri_doc')); |
— | — | @@ -34,5 +46,6 @@ |
35 | 47 | else |
36 | 48 | header('Location: ' . $t); |
37 | 49 | } |
| 50 | + wfProfileOut('SpecialURIResolver::execute (SMW)'); |
38 | 51 | } |
39 | 52 | } |
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialTypes.php |
— | — | @@ -13,12 +13,20 @@ |
14 | 14 | |
15 | 15 | if (!defined('MEDIAWIKI')) die(); |
16 | 16 | |
17 | | -global $IP, $smwgIP; |
18 | | -include_once($IP . '/includes/SpecialPage.php'); |
19 | | -include_once($IP . '/includes/Title.php'); |
| 17 | +global $IP; |
20 | 18 | include_once($IP . '/includes/QueryPage.php'); |
21 | | -include_once($smwgIP . '/includes/SMW_DataValueFactory.php'); |
22 | 19 | |
| 20 | +function smwfDoSpecialTypes() { |
| 21 | + wfProfileIn('smwfDoSpecialTypes (SMW)'); |
| 22 | + global $smwgIP; |
| 23 | + include_once($smwgIP . '/includes/SMW_DataValueFactory.php'); |
| 24 | + list( $limit, $offset ) = wfCheckLimits(); |
| 25 | + $rep = new TypesPage(); |
| 26 | + $result = $rep->doQuery( $offset, $limit ); |
| 27 | + wfProfileOut('smwfDoSpecialTypes (SMW)'); |
| 28 | + return $result; |
| 29 | +} |
| 30 | + |
23 | 31 | class TypesPage extends QueryPage { |
24 | 32 | |
25 | 33 | function getName() { |
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php |
— | — | @@ -10,8 +10,17 @@ |
11 | 11 | global $smwgIP; |
12 | 12 | include_once( "$smwgIP/specials/QueryPages/SMW_QueryPage.php" ); |
13 | 13 | |
14 | | -class PropertiesPage extends SMWQueryPage { |
| 14 | +function smwfDoSpecialProperties() { |
| 15 | + wfProfileIn('smwfDoSpecialProperties (SMW)'); |
| 16 | + list( $limit, $offset ) = wfCheckLimits(); |
| 17 | + $rep = new SMWPropertiesPage(); |
| 18 | + $result = $rep->doQuery( $offset, $limit ); |
| 19 | + wfProfileOut('smwfDoSpecialProperties (SMW)'); |
| 20 | + return $result; |
| 21 | +} |
15 | 22 | |
| 23 | +class SMWPropertiesPage extends SMWQueryPage { |
| 24 | + |
16 | 25 | function getName() { |
17 | 26 | /// TODO: should probably use SMW prefix |
18 | 27 | return "Properties"; |
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialWantedProperties.php |
— | — | @@ -10,8 +10,17 @@ |
11 | 11 | global $smwgIP; |
12 | 12 | include_once( "$smwgIP/specials/QueryPages/SMW_QueryPage.php" ); |
13 | 13 | |
14 | | -class WantedPropertiesPage extends SMWQueryPage { |
| 14 | +function smwfDoSpecialWantedProperties() { |
| 15 | + wfProfileIn('smwfDoSpecialWantedProperties (SMW)'); |
| 16 | + list( $limit, $offset ) = wfCheckLimits(); |
| 17 | + $rep = new SMWWantedPropertiesPage(); |
| 18 | + $result = $rep->doQuery( $offset, $limit ); |
| 19 | + wfProfileOut('smwfDoSpecialWantedProperties (SMW)'); |
| 20 | + return $result; |
| 21 | +} |
15 | 22 | |
| 23 | +class SMWWantedPropertiesPage extends SMWQueryPage { |
| 24 | + |
16 | 25 | function getName() { |
17 | 26 | /// TODO: should probably use SMW prefix |
18 | 27 | return "WantedProperties"; |
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialUnusedProperties.php |
— | — | @@ -10,8 +10,17 @@ |
11 | 11 | global $smwgIP; |
12 | 12 | include_once( "$smwgIP/specials/QueryPages/SMW_QueryPage.php" ); |
13 | 13 | |
14 | | -class UnusedPropertiesPage extends SMWQueryPage { |
| 14 | +function smwfDoSpecialUnusedProperties() { |
| 15 | + wfProfileIn('smwfDoSpecialUnusedProperties (SMW)'); |
| 16 | + list( $limit, $offset ) = wfCheckLimits(); |
| 17 | + $rep = new SMWUnusedPropertiesPage(); |
| 18 | + $result = $rep->doQuery( $offset, $limit ); |
| 19 | + wfProfileOut('smwfDoSpecialUnusedProperties (SMW)'); |
| 20 | + return $result; |
| 21 | +} |
15 | 22 | |
| 23 | +class SMWUnusedPropertiesPage extends SMWQueryPage { |
| 24 | + |
16 | 25 | function getName() { |
17 | 26 | /// TODO: should probably use SMW prefix |
18 | 27 | return "UnusedProperties"; |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php |
— | — | @@ -10,13 +10,22 @@ |
11 | 11 | |
12 | 12 | if (!defined('MEDIAWIKI')) die(); |
13 | 13 | |
14 | | -global $smwgIP; |
15 | | -require_once( "$smwgIP/includes/storage/SMW_Store.php" ); |
| 14 | +global $IP; |
| 15 | +include_once($IP . '/includes/SpecialPage.php'); |
16 | 16 | |
17 | | -class SMW_SearchByProperty { |
| 17 | +class SMWSearchByProperty extends SpecialPage { |
18 | 18 | |
19 | | - static function execute($query = '') { |
20 | | - global $wgRequest, $wgOut, $wgUser, $smwgQMaxInlineLimit; |
| 19 | + /** |
| 20 | + * Constructor |
| 21 | + */ |
| 22 | + public function __construct() { |
| 23 | + smwfInitUserMessages(); |
| 24 | + parent::__construct('SearchByProperty'); |
| 25 | + } |
| 26 | + |
| 27 | + public function execute($query = '') { |
| 28 | + global $wgRequest, $wgOut, $wgUser, $smwgQMaxInlineLimit, $smwgIP; |
| 29 | + require_once( "$smwgIP/includes/storage/SMW_Store.php" ); |
21 | 30 | $skin = $wgUser->getSkin(); |
22 | 31 | |
23 | 32 | // get the GET parameters |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -9,19 +9,29 @@ |
10 | 10 | |
11 | 11 | if (!defined('MEDIAWIKI')) die(); |
12 | 12 | |
13 | | -global $smwgIP; |
14 | | -include_once($smwgIP . '/includes/storage/SMW_Store.php'); |
15 | | -include_once($smwgIP . '/includes/SMW_DataValueFactory.php'); |
16 | | -include_once($smwgIP . '/includes/SMW_Infolink.php'); |
| 13 | +global $IP; |
| 14 | +include_once($IP . '/includes/SpecialPage.php'); |
17 | 15 | |
18 | 16 | /** |
19 | 17 | * A class to encapsulate the special page that allows browsing through |
20 | 18 | * the knowledge structure of a Semantic MediaWiki. |
21 | 19 | */ |
22 | | -class SMW_SpecialBrowse { |
| 20 | +class SMWSpecialBrowse extends SpecialPage { |
23 | 21 | |
24 | | - static function execute($query = '') { |
25 | | - global $wgRequest, $wgOut, $wgUser,$wgContLang; |
| 22 | + /** |
| 23 | + * Constructor |
| 24 | + */ |
| 25 | + public function __construct() { |
| 26 | + smwfInitUserMessages(); |
| 27 | + parent::__construct('Browse'); |
| 28 | + } |
| 29 | + |
| 30 | + public function execute($query = '') { |
| 31 | + global $wgRequest, $wgOut, $wgUser,$wgContLang, $smwgIP; |
| 32 | + include_once($smwgIP . '/includes/storage/SMW_Store.php'); |
| 33 | + include_once($smwgIP . '/includes/SMW_DataValueFactory.php'); |
| 34 | + include_once($smwgIP . '/includes/SMW_Infolink.php'); |
| 35 | + |
26 | 36 | $skin = $wgUser->getSkin(); |
27 | 37 | |
28 | 38 | // get the GET parameters |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php |
— | — | @@ -13,15 +13,24 @@ |
14 | 14 | |
15 | 15 | if (!defined('MEDIAWIKI')) die(); |
16 | 16 | |
17 | | -global $IP, $smwgIP; |
| 17 | +global $IP; |
18 | 18 | include_once( "$IP/includes/SpecialPage.php" ); |
19 | | -include_once( "$smwgIP/includes/storage/SMW_Store.php" ); |
20 | | -include_once($smwgIP . '/includes/SMW_Infolink.php'); |
21 | 19 | |
22 | | -class SMW_PageProperty { |
| 20 | +class SMWPageProperty extends SpecialPage { |
23 | 21 | |
24 | | - static function execute($query = '') { |
25 | | - global $wgRequest, $wgOut, $wgUser; |
| 22 | + /** |
| 23 | + * Constructor |
| 24 | + */ |
| 25 | + public function __construct() { |
| 26 | + smwfInitUserMessages(); |
| 27 | + parent::__construct('PageProperty', '', false); |
| 28 | + } |
| 29 | + |
| 30 | + public function execute($query = '') { |
| 31 | + global $wgRequest, $wgOut, $wgUser, $smwgIP; |
| 32 | + include_once($smwgIP . '/includes/storage/SMW_Store.php'); |
| 33 | + include_once($smwgIP . '/includes/SMW_Infolink.php'); |
| 34 | + |
26 | 35 | $skin = $wgUser->getSkin(); |
27 | 36 | |
28 | 37 | // get the GET parameters |
Index: trunk/extensions/SemanticMediaWiki/specials/ExportRDF/SMW_SpecialExportRDF.php |
— | — | @@ -10,13 +10,8 @@ |
11 | 11 | |
12 | 12 | if (!defined('MEDIAWIKI')) die(); |
13 | 13 | |
14 | | -// global $IP; |
15 | | -// require_once( "$IP/includes/SpecialPage.php" ); |
16 | 14 | |
17 | | -//SpecialPage::addPage( new SpecialPage('ExportRDF','',true,'doSpecialExportRDF',false) ); |
18 | | - |
19 | | - |
20 | | -function smwfExportRDF($page = '') { |
| 15 | +function smwfDoSpecialExportRDF($page = '') { |
21 | 16 | global $wgOut, $wgRequest, $wgUser, $smwgAllowRecursiveExport, $smwgExportBacklinks; |
22 | 17 | |
23 | 18 | $recursive = 0; //default, no recursion |
— | — | @@ -314,8 +309,7 @@ |
315 | 310 | */ |
316 | 311 | var $owlfull; |
317 | 312 | |
318 | | - public function ExportRDF() |
319 | | - { |
| 313 | + public function ExportRDF() { |
320 | 314 | global $smwgNamespace; // complete namespace for URIs (with protocol, usually http:/) |
321 | 315 | // if not completed yet, it wll be prefixed with a dot. Check for that and complete |
322 | 316 | global $wgServer; // actual server address (with http://) |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SpecialPages.php |
— | — | @@ -1,185 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * Methods for registering special pages without pulling in their code before it is |
6 | | - * actually needed. |
7 | | - * |
8 | | - * @author Markus Krötzsch |
9 | | - */ |
10 | | - |
11 | | -global $IP; |
12 | | -include_once( "$IP/includes/SpecialPage.php" ); |
13 | | - |
14 | | -// Ask special |
15 | | - |
16 | | -SpecialPage::addPage( new SpecialPage('Ask','',true,'doSpecialAsk',false) ); |
17 | | - |
18 | | -function doSpecialAsk() { |
19 | | - smwfInitUserMessages(); |
20 | | - wfProfileIn('doSpecialAsk (SMW)'); |
21 | | - global $smwgIP; |
22 | | - include_once($smwgIP . '/specials/AskSpecial/SMW_SpecialAsk.php'); |
23 | | - SMW_AskPage::execute(); |
24 | | - wfProfileOut('doSpecialAsk (SMW)'); |
25 | | -} |
26 | | - |
27 | | -// Browse special |
28 | | - |
29 | | -SpecialPage::addPage( new SpecialPage('Browse','',true,'doSpecialBrowse','default',true) ); |
30 | | - |
31 | | -function doSpecialBrowse($query = '') { |
32 | | - smwfInitUserMessages(); |
33 | | - wfProfileIn('doSpecialBrowse (SMW)'); |
34 | | - global $smwgIP; |
35 | | - include_once($smwgIP . '/specials/SearchTriple/SMW_SpecialBrowse.php'); |
36 | | - SMW_SpecialBrowse::execute($query); |
37 | | - wfProfileOut('doSpecialBrowse (SMW)'); |
38 | | -} |
39 | | - |
40 | | -// Property value special |
41 | | - |
42 | | -SpecialPage::addPage( new SpecialPage('PageProperty','',FALSE,'doSpecialPageProperty',false) ); |
43 | | - |
44 | | -function doSpecialPageProperty($query = '') { |
45 | | - smwfInitUserMessages(); |
46 | | - wfProfileIn('doSpecialPageProperty (SMW)'); |
47 | | - global $smwgIP; |
48 | | - include_once($smwgIP . '/specials/SearchTriple/SMW_SpecialPageProperty.php'); |
49 | | - SMW_PageProperty::execute($query); |
50 | | - wfProfileOut('doSpecialPageProperty (SMW)'); |
51 | | -} |
52 | | - |
53 | | -// Property search special |
54 | | - |
55 | | -SpecialPage::addPage( new SpecialPage('SearchByProperty','',true,'doSpecialSearchByProperty',false) ); |
56 | | - |
57 | | -function doSpecialSearchByProperty($query = '') { |
58 | | - smwfInitUserMessages(); |
59 | | - wfProfileIn('doSpecialSearchByProperty (SMW)'); |
60 | | - global $smwgIP; |
61 | | - include_once($smwgIP . '/specials/SearchTriple/SMW_SpecialSearchByProperty.php'); |
62 | | - SMW_SearchByProperty::execute($query); |
63 | | - wfProfileOut('doSpecialSearchByProperty (SMW)'); |
64 | | -} |
65 | | - |
66 | | -// URI resolver special |
67 | | - |
68 | | -SpecialPage::addPage( new SpecialPage('URIResolver','',false,'doSpecialURIResolver',false) ); |
69 | | - |
70 | | -function doSpecialURIResolver($name = '') { |
71 | | - smwfInitUserMessages(); |
72 | | - wfProfileIn('doSpecialURIResolver (SMW)'); |
73 | | - global $smwgIP; |
74 | | - include_once($smwgIP . '/specials/URIResolver/SMW_SpecialURIResolver.php'); |
75 | | - SMW_URIResolver::execute($name); |
76 | | - wfProfileOut('doSpecialURIResolver (SMW)'); |
77 | | -} |
78 | | - |
79 | | -// RDF Export special |
80 | | - |
81 | | -SpecialPage::addPage( new SpecialPage('ExportRDF','',true,'doSpecialExportRDF',false) ); |
82 | | - |
83 | | -function doSpecialExportRDF($page = '') { |
84 | | - smwfInitUserMessages(); |
85 | | - wfProfileIn('doSpecialExportRDF (SMW)'); |
86 | | - global $smwgIP; |
87 | | - include_once($smwgIP . '/specials/ExportRDF/SMW_SpecialExportRDF.php'); |
88 | | - smwfExportRDF($page); |
89 | | - wfProfileOut('doSpecialExportRDF (SMW)'); |
90 | | -} |
91 | | - |
92 | | -// Semantic Statsitics Special |
93 | | - |
94 | | -SpecialPage::addPage( new SpecialPage('SemanticStatistics','',true,'doSpecialSemanticStatistics',false) ); |
95 | | - |
96 | | -function doSpecialSemanticStatistics() { |
97 | | - smwfInitUserMessages(); |
98 | | - wfProfileIn('doSpecialSemanticStatistics (SMW)'); |
99 | | - global $smwgIP; |
100 | | - include_once($smwgIP . '/specials/Statistics/SMW_SpecialStatistics.php'); |
101 | | - smwfExecuteSemanticStatistics(); |
102 | | - wfProfileOut('doSpecialSemanticStatistics (SMW)'); |
103 | | -} |
104 | | - |
105 | | -// Properties special |
106 | | - |
107 | | -SpecialPage::addPage( new SpecialPage('Properties','',true,'doSpecialProperties',false) ); |
108 | | - |
109 | | -function doSpecialProperties($par = null) { |
110 | | - smwfInitUserMessages(); |
111 | | - wfProfileIn('doSpecialProperties (SMW)'); |
112 | | - global $smwgIP; |
113 | | - include_once($smwgIP . '/specials/QueryPages/SMW_SpecialProperties.php'); |
114 | | - list( $limit, $offset ) = wfCheckLimits(); |
115 | | - $rep = new PropertiesPage(); |
116 | | - $result = $rep->doQuery( $offset, $limit ); |
117 | | - wfProfileOut('doSpecialProperties (SMW)'); |
118 | | - return $result; |
119 | | -} |
120 | | - |
121 | | -// Unused Properties special |
122 | | - |
123 | | -SpecialPage::addPage( new SpecialPage('UnusedProperties','',true,'doSpecialUnusedProperties',false) ); |
124 | | - |
125 | | -function doSpecialUnusedProperties($par = null) { |
126 | | - smwfInitUserMessages(); |
127 | | - wfProfileIn('doSpecialUnusedProperties (SMW)'); |
128 | | - global $smwgIP; |
129 | | - include_once($smwgIP . '/specials/QueryPages/SMW_SpecialUnusedProperties.php'); |
130 | | - list( $limit, $offset ) = wfCheckLimits(); |
131 | | - $rep = new UnusedPropertiesPage(); |
132 | | - $result = $rep->doQuery( $offset, $limit ); |
133 | | - wfProfileOut('doSpecialUnusedProperties (SMW)'); |
134 | | - return $result; |
135 | | -} |
136 | | - |
137 | | -// Wanted Properties special |
138 | | - |
139 | | -SpecialPage::addPage( new SpecialPage('WantedProperties','',true,'doSpecialWantedProperties',false) ); |
140 | | - |
141 | | -function doSpecialWantedProperties($par = null) { |
142 | | - smwfInitUserMessages(); |
143 | | - wfProfileIn('doSpecialWantedProperties (SMW)'); |
144 | | - global $smwgIP; |
145 | | - include_once($smwgIP . '/specials/QueryPages/SMW_SpecialWantedProperties.php'); |
146 | | - list( $limit, $offset ) = wfCheckLimits(); |
147 | | - $rep = new WantedPropertiesPage(); |
148 | | - $result = $rep->doQuery( $offset, $limit ); |
149 | | - wfProfileOut('doSpecialWantedProperties (SMW)'); |
150 | | - return $result; |
151 | | -} |
152 | | - |
153 | | -// Types special |
154 | | - |
155 | | -SpecialPage::addPage( new SpecialPage('Types','',true,'doSpecialTypes',false) ); |
156 | | - |
157 | | -function doSpecialTypes($par = null) { |
158 | | - smwfInitUserMessages(); |
159 | | - wfProfileIn('doSpecialTypes (SMW)'); |
160 | | - global $smwgIP; |
161 | | - include_once($smwgIP . '/specials/QueryPages/SMW_SpecialTypes.php'); |
162 | | - list( $limit, $offset ) = wfCheckLimits(); |
163 | | - $rep = new TypesPage(); |
164 | | - $result = $rep->doQuery( $offset, $limit ); |
165 | | - wfProfileOut('doSpecialTypes (SMW)'); |
166 | | - return $result; |
167 | | -} |
168 | | - |
169 | | - |
170 | | - |
171 | | -// Admin special |
172 | | - |
173 | | -///TODO: should these be messages? |
174 | | -global $wgMessageCache; |
175 | | -$wgMessageCache->addMessages(array('smwadmin' => 'Admin functions for Semantic MediaWiki')); |
176 | | - |
177 | | -SpecialPage::addPage( new SpecialPage('SMWAdmin','delete',true,'doSpecialSMWAdmin',false) ); |
178 | | - |
179 | | -function doSpecialSMWAdmin($par = null) { |
180 | | - smwfInitUserMessages(); |
181 | | - wfProfileIn('doSpecialSMWAdmin (SMW)'); |
182 | | - global $smwgIP; |
183 | | - include_once($smwgIP . '/specials/SMWAdmin/SMW_SpecialSMWAdmin.php'); |
184 | | - smwfSMWAdmin($par); |
185 | | - wfProfileOut('doSpecialSMWAdmin (SMW)'); |
186 | | -} |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SpecialPage.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +if (!defined('MEDIAWIKI')) die(); |
| 5 | + |
| 6 | +global $IP; |
| 7 | +include_once($IP . '/includes/SpecialPage.php'); |
| 8 | + |
| 9 | +/** |
| 10 | + * A simple extension of SpecialPage that ensures that all relevant SMW-user |
| 11 | + * messages are loaded when the special page is initialised. This is especially |
| 12 | + * relevant as an adaptor for query pages. |
| 13 | + */ |
| 14 | +class SMWSpecialPage extends SpecialPage { |
| 15 | + |
| 16 | + /** |
| 17 | + * Constructor |
| 18 | + */ |
| 19 | + public function __construct($name, $function, $file = 'default', $listed=true, $restriction='') { |
| 20 | + smwfInitUserMessages(); |
| 21 | + parent::__construct($name, $restriction, $listed, $function, $file); |
| 22 | + } |
| 23 | + |
| 24 | +} |
Property changes on: trunk/extensions/SemanticMediaWiki/includes/SMW_SpecialPage.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * Global functions and constants for Semantic MediaWiki. |
5 | 5 | */ |
6 | 6 | |
7 | | -define('SMW_VERSION','1.0prealpha-2'); |
| 7 | +define('SMW_VERSION','1.0prealpha-3'); |
8 | 8 | |
9 | 9 | // constants for special properties, used for datatype assignment and storage |
10 | 10 | define('SMW_SP_HAS_TYPE',1); |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | * does not adhere to the naming conventions. |
39 | 39 | */ |
40 | 40 | function enableSemantics($namespace = "", $complete = false) { |
41 | | - global $smwgNamespace, $wgExtensionFunctions; |
| 41 | + global $smwgNamespace, $wgExtensionFunctions, $wgHooks; |
42 | 42 | $smwgNamespace = $namespace; |
43 | 43 | |
44 | 44 | // The dot tells that the domain is not complete. It will be completed |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | */ |
56 | 56 | function smwfSetupExtension() { |
57 | 57 | wfProfileIn('smwfSetupExtension (SMW)'); |
58 | | - global $smwgVersion, $smwgNamespace, $smwgIP, $smwgStoreActive, $wgHooks, $wgExtensionCredits, $smwgEnableTemplateSupport, $smwgMasterStore, $wgArticlePath, $wgScriptPath, $wgServer; |
| 58 | + global $smwgIP, $smwgStoreActive, $wgHooks, $wgExtensionCredits, $smwgEnableTemplateSupport, $smwgMasterStore, $wgSpecialPages, $wgAutoloadClasses; |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Setting this to false prevents any new data from being stored in |
— | — | @@ -71,11 +71,30 @@ |
72 | 72 | $smwgStoreActive = true; |
73 | 73 | |
74 | 74 | $smwgMasterStore = NULL; |
75 | | - smwfInitUserMessages(); /// TODO: try to eliminate this. Problem are pages like Special:Specialpages that access our messages directly. |
76 | 75 | smwfInitContentMessages(); |
77 | 76 | |
78 | 77 | ///// register specials ///// |
79 | | - include_once($smwgIP . '/includes/SMW_SpecialPages.php'); |
| 78 | + $wgAutoloadClasses['SMWAskPage'] = $smwgIP . '/specials/AskSpecial/SMW_SpecialAsk.php'; |
| 79 | + $wgSpecialPages['Ask'] = array('SMWAskPage'); |
| 80 | + $wgAutoloadClasses['SMWSpecialBrowse'] = $smwgIP . '/specials/SearchTriple/SMW_SpecialBrowse.php'; |
| 81 | + $wgSpecialPages['Browse'] = array('SMWSpecialBrowse'); |
| 82 | + $wgAutoloadClasses['SMWPageProperty'] = $smwgIP . '/specials/SearchTriple/SMW_SpecialPageProperty.php'; |
| 83 | + $wgSpecialPages['PageProperty'] = array('SMWPageProperty'); |
| 84 | + $wgAutoloadClasses['SMWSearchByProperty'] = $smwgIP . '/specials/SearchTriple/SMW_SpecialSearchByProperty.php'; |
| 85 | + $wgSpecialPages['SearchByProperty'] = array('SMWSearchByProperty'); |
| 86 | + $wgAutoloadClasses['SMWURIResolver'] = $smwgIP . '/specials/URIResolver/SMW_SpecialURIResolver.php'; |
| 87 | + $wgSpecialPages['URIResolver'] = array('SMWURIResolver'); |
| 88 | + $wgAutoloadClasses['SMWAdmin'] = $smwgIP . '/specials/SMWAdmin/SMW_SpecialSMWAdmin.php'; |
| 89 | + $wgSpecialPages['SMWAdmin'] = array('SMWAdmin'); |
| 90 | + |
| 91 | + $wgAutoloadClasses['SMWSpecialPage'] = $smwgIP . '/includes/SMW_SpecialPage.php'; |
| 92 | + $wgSpecialPages['Properties'] = array('SMWSpecialPage','Properties', 'smwfDoSpecialProperties', $smwgIP . '/specials/QueryPages/SMW_SpecialProperties.php'); |
| 93 | + $wgSpecialPages['UnusedProperties'] = array('SMWSpecialPage','UnusedProperties', 'smwfDoSpecialUnusedProperties', $smwgIP . '/specials/QueryPages/SMW_SpecialUnusedProperties.php'); |
| 94 | + $wgSpecialPages['WantedProperties'] = array('SMWSpecialPage','WantedProperties', 'smwfDoSpecialWantedProperties', $smwgIP . '/specials/QueryPages/SMW_SpecialWantedProperties.php'); |
| 95 | + $wgSpecialPages['ExportRDF'] = array('SMWSpecialPage','ExportRDF', 'smwfDoSpecialExportRDF', $smwgIP . '/specials/ExportRDF/SMW_SpecialExportRDF.php'); |
| 96 | + $wgSpecialPages['SemanticStatistics'] = array('SMWSpecialPage','SemanticStatistics', 'smwfExecuteSemanticStatistics', $smwgIP . '/specials/Statistics/SMW_SpecialStatistics.php'); |
| 97 | + $wgSpecialPages['Types'] = array('SMWSpecialPage','Types', 'smwfDoSpecialTypes', $smwgIP . '/specials/QueryPages/SMW_SpecialTypes.php'); |
| 98 | + |
80 | 99 | //require_once($smwgIP . '/specials/OntologyImport/SMW_SpecialOntologyImport.php'); // broken, TODO: fix or delete |
81 | 100 | |
82 | 101 | ///// register hooks ///// |
— | — | @@ -94,6 +113,7 @@ |
95 | 114 | $wgHooks['BeforePageDisplay'][]='smwfAddHTMLHeader'; |
96 | 115 | $wgHooks['ParserBeforeStrip'][] = 'smwfRegisterInlineQueries'; // a hook for registering the <ask> parser hook |
97 | 116 | $wgHooks['ArticleFromTitle'][] = 'smwfShowListPage'; |
| 117 | + $wgHooks['LoadAllMessages'][] = 'smwfLoadAllMessages'; // enable a complete display of all messages when requested by MW |
98 | 118 | |
99 | 119 | ///// credits (see "Special:Version") ///// |
100 | 120 | $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.]'); |
— | — | @@ -322,7 +342,16 @@ |
323 | 343 | wfProfileOut('smwfInitUserMessages (SMW)'); |
324 | 344 | } |
325 | 345 | |
| 346 | + /** |
| 347 | + * Set up all messages if requested explicitly by MediaWiki. |
| 348 | + */ |
| 349 | + function smwfLoadAllMessages($pagelist) { |
| 350 | + smwfInitContentMessages(); |
| 351 | + smwfInitUserMessages(); |
| 352 | + return true; |
| 353 | + } |
326 | 354 | |
| 355 | + |
327 | 356 | /**********************************************/ |
328 | 357 | /***** other global helpers *****/ |
329 | 358 | /**********************************************/ |