r36666 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36665‎ | r36666 | r36667 >
Date:08:56, 26 June 2008
Author:mkroetzsch
Status:old
Tags:
Comment:
Replaced includes by autoloads throughout the code, moved some global constants into related classes to prevent
includes being required for defining constants
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Types.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Factbox.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Hooks.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Timeline.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_SpecialPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_TypePage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Query.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_RAPStore.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_TestStore.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/OntologyImport/SMW_SpecialOntologyImport.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_QueryPage.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialTypes.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialUnusedProperties.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialWantedProperties.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/Relations/SMW_SpecialFlawedAttributes.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/Statistics/SMW_SpecialStatistics.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/URIResolver/SMW_SpecialURIResolver.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php
@@ -34,9 +34,8 @@
3535 require_once("{$mwPath}counter.php");
3636 require_once("{$mwPath}commandLine.inc");
3737
38 -global $smwgIP, $smwgEnableUpdateJobs, $wgServer;
 38+global $smwgEnableUpdateJobs, $wgServer;
3939 $smwgEnableUpdateJobs = false; // do not fork additional update jobs while running this script
40 -require_once($smwgIP . '/includes/SMW_Factbox.php');
4140
4241 if ( isset( $options['server'] ) ) {
4342 $wgServer = $options['server'];
@@ -115,7 +114,12 @@
116115
117116 global $wgParser;
118117
119 -print "Refreshing all semantic data in the database!\n";
 118+print "Refreshing all semantic data in the database!\n---\n" .
 119+" Some versions of PHP suffer from memory leaks in long-running scripts.\n" .
 120+" If your machine gets very slow after many pages (typically more than\n" .
 121+" 1000) were refreshed, please abort with CTRL-C and resume this script\n" .
 122+" at the last processed page id using the parameter -s (use -v to display\n" .
 123+" page ids during refresh). Continue this until all pages were refreshed.\n---\n";
120124 print "Processing pages from ID $start to ID $end ...\n";
121125
122126 $num_files = 0;
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
@@ -1,10 +1,5 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die();
5 -
6 -global $IP;
7 -include_once($IP . '/includes/SpecialPage.php');
8 -
94 /**
105 * @author Markus Krötzsch
116 *
@@ -32,7 +27,7 @@
3328 }
3429
3530 function execute($p = '') {
36 - global $wgOut, $wgRequest, $smwgIP, $smwgQEnabled, $smwgRSSEnabled;
 31+ global $wgOut, $wgRequest, $smwgQEnabled, $smwgRSSEnabled;
3732 wfProfileIn('doSpecialAsk (SMW)');
3833 if ( ($wgRequest->getVal( 'query' ) != '') ) { // old processing
3934 $this->executeSimpleAsk();
@@ -52,7 +47,7 @@
5348 // This code rather hacky since there are many ways to call that special page, the most involved of
5449 // which is the way that this page calls itself when data is submitted via the form (since the shape
5550 // of the parameters then is governed by the UI structure, as opposed to being governed by reason).
56 - global $wgRequest, $smwgIP;
 51+ global $wgRequest;
5752
5853 // First make all inputs into a simple parameter list that can again be parsed into components later.
5954
@@ -80,7 +75,6 @@
8176 }
8277
8378 // Now parse parameters and rebuilt the param strings for URLs
84 - include_once( "$smwgIP/includes/SMW_QueryProcessor.php" );
8579 SMWQueryProcessor::processFunctionParams($rawparams,$this->m_querystring,$this->m_params,$this->m_printouts);
8680 // Try to complete undefined parameter values from dedicated URL params
8781 if ( !array_key_exists('format',$this->m_params) ) {
@@ -290,7 +284,7 @@
291285 * certain parameters.
292286 */
293287 protected function executeSimpleAsk() {
294 - global $wgRequest, $wgOut, $smwgQEnabled, $smwgQMaxLimit, $wgUser, $smwgQSortingSupport, $smwgIP;
 288+ global $wgRequest, $wgOut, $smwgQEnabled, $smwgQMaxLimit, $wgUser, $smwgQSortingSupport;
295289
296290 $skin = $wgUser->getSkin();
297291
@@ -321,7 +315,6 @@
322316
323317 // print results if any
324318 if ($smwgQEnabled && ('' != $query) ) {
325 - include_once( "$smwgIP/includes/SMW_QueryProcessor.php" );
326319 $params = array('offset' => $offset, 'limit' => $limit, 'format' => 'broadtable', 'mainlabel' => ' ', 'link' => 'all', 'default' => wfMsg('smw_result_noresults'), 'sort' => $sort, 'order' => $order);
327320 $queryobj = SMWQueryProcessor::createQuery($query, $params, false);
328321 $res = smwfGetStore()->getQueryResult($queryobj);
Index: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php
@@ -1,10 +1,5 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die();
5 -
6 -global $IP;
7 -include_once($IP . '/includes/SpecialPage.php');
8 -
94 /**
105 * @author Markus Krötzsch
116 *
@@ -26,10 +21,6 @@
2722 }
2823
2924 public function execute($par = null) {
30 - global $IP;
31 - require_once($IP . '/includes/SpecialPage.php' );
32 - require_once($IP . '/includes/Title.php' );
33 -
3425 global $wgOut, $wgRequest;
3526 global $wgServer; // "http://www.yourserver.org"
3627 // (should be equal to 'http://'.$_SERVER['SERVER_NAME'])
Index: trunk/extensions/SemanticMediaWiki/specials/Relations/SMW_SpecialFlawedAttributes.php
@@ -11,14 +11,6 @@
1212 *
1313 */
1414
15 -if (!defined('MEDIAWIKI')) die();
16 -
17 -global $IP, $smwgIP;
18 -
19 -require_once( "$IP/includes/SpecialPage.php" );
20 -require_once( "$IP/includes/Title.php" );
21 -require_once("$IP/includes/QueryPage.php");
22 -
2315 function doSpecialFlawedAttributes($par = null) {
2416 list( $limit, $offset ) = wfCheckLimits();
2517 $rep = new FlawedAttributes();
@@ -85,5 +77,3 @@
8678 return "$link ($result->count)";
8779 }
8880 }
89 -
90 -
Index: trunk/extensions/SemanticMediaWiki/specials/URIResolver/SMW_SpecialURIResolver.php
@@ -1,10 +1,5 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die();
5 -
6 -global $IP;
7 -include_once($IP . '/includes/SpecialPage.php');
8 -
94 /**
105 * @author Denny Vrandecic
116 *
Index: trunk/extensions/SemanticMediaWiki/specials/OntologyImport/SMW_SpecialOntologyImport.php
@@ -9,18 +9,11 @@
1010 * TODO: The code below is still very very messy and undocumented. Cleanup needed!
1111 */
1212
13 -if (!defined('MEDIAWIKI')) die();
14 -
15 -global $IP;
16 -require_once( "$IP/includes/SpecialPage.php" );
17 -
1813 SpecialPage::addPage( new SpecialPage('OntologyImport','delete',true,'doSpecialImportOntology',false) );
1914
20 -
2115 function doSpecialImportOntology($par = NULL) {
22 - global $IP, $smwgIP;
 16+ global $smwgIP;
2317 require_once($smwgIP . '/includes/SMW_Storage.php');
24 - require_once($IP . '/includes/Title.php' );
2518
2619 global $wgOut, $wgRequest, $wgUser;
2720 global $wgServer; // "http://www.yourserver.org"
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialTypes.php
@@ -10,16 +10,8 @@
1111 * This only reports on the Type: Wiki pages.
1212 */
1313
14 -
15 -if (!defined('MEDIAWIKI')) die();
16 -
17 -global $IP;
18 -include_once($IP . '/includes/QueryPage.php');
19 -
2014 function smwfDoSpecialTypes() {
2115 wfProfileIn('smwfDoSpecialTypes (SMW)');
22 - global $smwgIP;
23 - include_once($smwgIP . '/includes/SMW_DataValueFactory.php');
2416 list( $limit, $offset ) = wfCheckLimits();
2517 $rep = new TypesPage();
2618 $result = $rep->doQuery( $offset, $limit );
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php
@@ -2,14 +2,9 @@
33 /**
44 * @author Markus Krötzsch
55 *
6 - * This page shows all used attributes.
 6+ * This page shows all used properties.
77 */
88
9 -if (!defined('MEDIAWIKI')) die();
10 -
11 -global $smwgIP;
12 -include_once( "$smwgIP/specials/QueryPages/SMW_QueryPage.php" );
13 -
149 function smwfDoSpecialProperties() {
1510 wfProfileIn('smwfDoSpecialProperties (SMW)');
1611 list( $limit, $offset ) = wfCheckLimits();
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialWantedProperties.php
@@ -2,14 +2,9 @@
33 /**
44 * @author Markus Krötzsch
55 *
6 - * This page shows all used attributes.
 6+ * This page shows all wanted properties (used but not having a page).
77 */
88
9 -if (!defined('MEDIAWIKI')) die();
10 -
11 -global $smwgIP;
12 -include_once( "$smwgIP/specials/QueryPages/SMW_QueryPage.php" );
13 -
149 function smwfDoSpecialWantedProperties() {
1510 wfProfileIn('smwfDoSpecialWantedProperties (SMW)');
1611 list( $limit, $offset ) = wfCheckLimits();
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialUnusedProperties.php
@@ -2,14 +2,10 @@
33 /**
44 * @author Markus Krötzsch
55 *
6 - * This page shows all used attributes.
 6+ * This page shows all unused properties.
77 */
88
9 -if (!defined('MEDIAWIKI')) die();
109
11 -global $smwgIP;
12 -include_once( "$smwgIP/specials/QueryPages/SMW_QueryPage.php" );
13 -
1410 function smwfDoSpecialUnusedProperties() {
1511 wfProfileIn('smwfDoSpecialUnusedProperties (SMW)');
1612 list( $limit, $offset ) = wfCheckLimits();
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_QueryPage.php
@@ -6,18 +6,11 @@
77 * data retrieval instead of the SQL-based access used by MW.
88 */
99
10 -if (!defined('MEDIAWIKI')) die();
11 -
12 -global $IP, $smwgIP;
13 -include_once($IP . '/includes/SpecialPage.php');
14 -include_once($IP . '/includes/Title.php');
15 -include_once($IP . '/includes/QueryPage.php');
16 -include_once($smwgIP . '/includes/storage/SMW_Store.php');
17 -
1810 /**
1911 * Abstract base class for SMW's variant of the MW QueryPage.
2012 * Subclasses must implement getResults() and formatResult(), as
2113 * well as some other standard functions of QueryPage.
 14+ * @note AUTOLOADED
2215 */
2316 abstract class SMWQueryPage extends QueryPage {
2417
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php
@@ -7,11 +7,6 @@
88 * properties.
99 */
1010
11 -if (!defined('MEDIAWIKI')) die();
12 -
13 -global $IP;
14 -include_once($IP . '/includes/SpecialPage.php');
15 -
1611 /**
1712 * A class to encapsulate the special page that allows browsing through
1813 * the knowledge structure of a Semantic MediaWiki.
@@ -32,9 +27,7 @@
3328 }
3429
3530 public function execute($query = '') {
36 - global $wgRequest, $wgOut, $wgUser,$wgContLang, $smwgIP;
37 - include_once($smwgIP . '/includes/storage/SMW_Store.php');
38 - include_once($smwgIP . '/includes/SMW_DataValueFactory.php');
 31+ global $wgRequest, $wgOut, $wgUser, $wgContLang;
3932
4033 $skin = $wgUser->getSkin();
4134
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php
@@ -9,11 +9,6 @@
1010 * dynamic output pages.
1111 */
1212
13 -if (!defined('MEDIAWIKI')) die();
14 -
15 -global $IP;
16 -include_once( "$IP/includes/SpecialPage.php" );
17 -
1813 /**
1914 * @note AUTOLOAD
2015 */
@@ -31,9 +26,7 @@
3227 }
3328
3429 public function execute($query = '') {
35 - global $wgRequest, $wgOut, $wgUser, $smwgIP;
36 - include_once($smwgIP . '/includes/storage/SMW_Store.php');
37 - include_once($smwgIP . '/includes/SMW_Infolink.php');
 30+ global $wgRequest, $wgOut, $wgUser;
3831
3932 $skin = $wgUser->getSkin();
4033
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
@@ -1,10 +1,5 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die();
5 -
6 -global $IP;
7 -include_once($IP . '/includes/SpecialPage.php');
8 -
94 /**
105 * @author Denny Vrandecic
116 *
@@ -13,7 +8,7 @@
149 * For example, it shows me all persons born in Croatia,
1510 * or all winners of the Academy Award for best actress.
1611 *
17 - * @note AUTOLOAD
 12+ * @note AUTOLOADED
1813 */
1914 class SMWSearchByProperty extends SpecialPage {
2015
@@ -29,8 +24,7 @@
3025 }
3126
3227 public function execute($query = '') {
33 - global $wgRequest, $wgOut, $wgUser, $smwgQMaxInlineLimit, $smwgIP;
34 - require_once( "$smwgIP/includes/storage/SMW_Store.php" );
 28+ global $wgRequest, $wgOut, $wgUser, $smwgQMaxInlineLimit;
3529 $skin = $wgUser->getSkin();
3630
3731 // get the GET parameters
@@ -55,8 +49,6 @@
5650 if ('' == $attributestring) { // empty page. If no attribute given the value does not matter
5751 $html .= wfMsg('smw_sbv_docu') . "\n";
5852 } else {
59 - global $smwgIP;
60 - include_once($smwgIP . '/includes/SMW_DataValueFactory.php');
6153 // Now that we have an attribute, let's figure out the datavalue
6254 $value = SMWDataValueFactory::newPropertyObjectValue( $attribute, $valuestring );
6355 if ( $value->isValid() == FALSE ) { // no value understood
Index: trunk/extensions/SemanticMediaWiki/specials/Statistics/SMW_SpecialStatistics.php
@@ -5,12 +5,7 @@
66 * This special page of the Semantic MediaWiki extension displays some
77 * statistics about properties.
88 */
9 -if (!defined('MEDIAWIKI')) die();
109
11 -global $IP;
12 -require_once( "$IP/includes/SpecialPage.php" );
13 -require_once( "$IP/includes/Title.php" );
14 -
1510 function smwfExecuteSemanticStatistics() {
1611 global $wgOut, $wgLang;
1712 $dbr =& wfGetDB( DB_SLAVE );
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php
@@ -88,8 +88,6 @@
8989 SMWDataValueFactory::$m_typebyproperty[$propertyname] = $type;
9090 return SMWDataValueFactory::newTypeIDValue($smwgPDefaultType,$value,$caption,$propertyname);
9191 } else {
92 - global $smwgIP;
93 - include_once($smwgIP . '/includes/SMW_DV_Error.php');
9492 return new SMWErrorValue(wfMsgForContent('smw_manytypes'), $value, $caption);
9593 }
9694 }
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
@@ -7,17 +7,9 @@
88 */
99
1010 /**
11 - * Protect against register_globals vulnerabilities.
12 - * This line must be present before any global variable is referenced.
13 - */
14 -if (!defined('MEDIAWIKI')) die();
15 -
16 -global $smwgIP;
17 -require_once($smwgIP . '/includes/storage/SMW_Store.php');
18 -
19 -/**
2011 * Static class for accessing functions to generate and execute semantic queries
2112 * and to serialise their results.
 13+ * @note AUTOLOADED
2214 */
2315 class SMWQueryProcessor {
2416
@@ -88,7 +80,7 @@
8981 ) && ($mainlabel != '-')
9082 )
9183 ) {
92 - $desc->prependPrintRequest(new SMWPrintRequest(SMW_PRINT_THIS, $mainlabel));
 84+ $desc->prependPrintRequest(new SMWPrintRequest(SMWPrintRequest::PRINT_THIS, $mainlabel));
9385 }
9486
9587 $query = new SMWQuery($desc, $inline);
@@ -175,14 +167,14 @@
176168 $parts = explode('=',$param,2);
177169 $propparts = explode('#',$parts[0],2);
178170 if (trim($propparts[0]) == '') { // print "this"
179 - $printmode = SMW_PRINT_THIS;
 171+ $printmode = SMWPrintRequest::PRINT_THIS;
180172 if (count($parts) == 1) { // no label found, use empty label
181173 $parts[] = '';
182174 }
183175 $title = NULL;
184176 } elseif ($wgContLang->getNsText(NS_CATEGORY) == ucfirst(trim($propparts[0]))) { // print category
185177 $title = NULL;
186 - $printmode = SMW_PRINT_CATS;
 178+ $printmode = SMWPrintRequest::PRINT_CATS;
187179 if (count($parts) == 1) { // no label found, use category label
188180 $parts[] = $wgContLang->getNSText(NS_CATEGORY);
189181 }
@@ -192,9 +184,9 @@
193185 continue;
194186 }
195187 if ($title->getNamespace() == SMW_NS_PROPERTY) {
196 - $printmode = SMW_PRINT_PROP;
 188+ $printmode = SMWPrintRequest::PRINT_PROP;
197189 } elseif ($title->getNamespace() == NS_CATEGORY) {
198 - $printmode = SMW_PRINT_CCAT;
 190+ $printmode = SMWPrintRequest::PRINT_CCAT;
199191 } //else?
200192 if (count($parts) == 1) { // no label found, use property/category name
201193 $parts[] = $title->getText();
@@ -591,7 +583,7 @@
592584 $printlabel = $wgContLang->getNSText(NS_CATEGORY);
593585 }
594586 if ($chunk == ']]') {
595 - return new SMWPrintRequest(SMW_PRINT_CATS, $printlabel);
 587+ return new SMWPrintRequest(SMWPrintRequest::PRINT_CATS, $printlabel);
596588 } else {
597589 $this->m_errors[] = wfMsgForContent('smw_badprintout');
598590 return NULL;
@@ -620,8 +612,6 @@
621613 * string.
622614 */
623615 protected function getPropertyDescription($propertyname, &$setNS, &$label) {
624 - global $smwgIP;
625 - include_once($smwgIP . '/includes/SMW_DataValueFactory.php');
626616 $this->readChunk(); // consume separator ":=" or "::"
627617 // first process property chain syntax (e.g. "property1.property2::value"):
628618 if ($propertyname{0} == ' ') { // escape
@@ -720,7 +710,7 @@
721711 $printlabel = $property->getText();
722712 }
723713 if ($chunk == ']]') {
724 - return new SMWPrintRequest(SMW_PRINT_PROP, $printlabel, $property, $pm);
 714+ return new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, $printlabel, $property, $pm);
725715 } else {
726716 $this->m_errors[] = wfMsgForContent('smw_badprintout');
727717 return NULL;
@@ -743,7 +733,7 @@
744734 $printlabel = $property->getText();
745735 }
746736 if ($chunk == ']]') {
747 - return new SMWPrintRequest(SMW_PRINT_PROP, $printlabel, $property, $printmodifier);
 737+ return new SMWPrintRequest(SMWPrintRequest::PRINT_PROP, $printlabel, $property, $printmodifier);
748738 } else {
749739 $this->m_errors[] = wfMsgForContent('smw_badprintout');
750740 return NULL;
@@ -831,8 +821,6 @@
832822 * passed as a parameter.
833823 */
834824 protected function getArticleDescription($firstchunk, &$setNS, &$label) {
835 - global $smwgIP;
836 - include_once($smwgIP . '/includes/SMW_DataValueFactory.php');
837825 $chunk = $firstchunk;
838826 $result = NULL;
839827 $continue = true;
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php
@@ -338,8 +338,6 @@
339339 * text, but no more. Result might have no entries but is always an array.
340340 */
341341 public function getInfolinks() {
342 - global $smwgIP;
343 - include_once($smwgIP . '/includes/SMW_Infolink.php');
344342 if ($this->isValid() && $this->m_property) {
345343 if (!$this->m_hasssearchlink) { // add default search link
346344 $this->m_hasssearchlink = true;
Index: trunk/extensions/SemanticMediaWiki/includes/jobs/SMW_UpdateJob.php
@@ -8,13 +8,6 @@
99 * @author Daniel M. Herzig
1010 */
1111
12 -if ( !defined( 'MEDIAWIKI' ) ) {
13 - die( "This file is part of the Semantic MediaWiki extension. It is not a valid entry point.\n" );
14 -}
15 -
16 -global $IP;
17 -require_once( $IP . "/includes/JobQueue.php" );
18 -
1912 class SMWUpdateJob extends Job {
2013
2114 function __construct($title) {
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Hooks.php
@@ -13,8 +13,7 @@
1414 * at the end of the article.
1515 */
1616 function smwfParserHook(&$parser, &$text) {
17 - global $smwgIP, $smwgStoreAnnotations, $smwgTempStoreAnnotations, $smwgStoreActive;
18 - include_once($smwgIP . '/includes/SMW_Factbox.php');
 17+ global $smwgStoreAnnotations, $smwgTempStoreAnnotations, $smwgStoreActive;
1918 // Init global storage for semantic data of this article.
2019 SMWFactbox::initStorage($parser->getTitle());
2120
@@ -112,8 +111,6 @@
113112 * Called before the article is saved. Allows us to check and remember whether an article is new.
114113 */
115114 function smwfPreSaveHook(&$article, &$user, &$text, &$summary, $minor, $watch, $sectionanchor, &$flags) {
116 - global $smwgIP;
117 - include_once($smwgIP . '/includes/SMW_Factbox.php'); // Normally this must have happened, but you never know ...
118115 if ($flags & EDIT_NEW) {
119116 SMWFactbox::setNewArticle();
120117 }
@@ -272,10 +269,8 @@
273270 function smwfShowListPage (&$title, &$article){
274271 global $smwgIP;
275272 if ($title->getNamespace() == SMW_NS_TYPE){
276 - include_once($smwgIP . '/includes/articlepages/SMW_TypePage.php');
277273 $article = new SMWTypePage($title);
278274 } elseif ( $title->getNamespace() == SMW_NS_PROPERTY ) {
279 - include_once($smwgIP . '/includes/articlepages/SMW_PropertyPage.php');
280275 $article = new SMWPropertyPage($title);
281276 }
282277 return true;
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Factbox.php
@@ -7,19 +7,11 @@
88 */
99
1010 /**
11 - * Protect against register_globals vulnerabilities.
12 - * This line must be present before any global variable is referenced.
13 - */
14 -if (!defined('MEDIAWIKI')) die();
15 -
16 -global $smwgIP;
17 -include_once($smwgIP . '/includes/SMW_SemanticData.php');
18 -
19 -/**
2011 * Static class for representing semantic data, which accepts user
2112 * inputs and provides methods for printing and storing its contents.
2213 * Its main purpose is to provide a persistent storage to keep semantic
2314 * data between hooks for parsing and storing.
 15+ * @note AUTOLOADED
2416 */
2517 class SMWFactbox {
2618
@@ -78,8 +70,7 @@
7971 */
8072 static function addProperty($propertyname, $value, $caption, $storeannotation = true) {
8173 wfProfileIn("SMWFactbox::addProperty (SMW)");
82 - global $smwgContLang, $smwgIP;
83 - include_once($smwgIP . '/includes/SMW_DataValueFactory.php');
 74+ global $smwgContLang;
8475 // See if this property is a special one, such as e.g. "has type"
8576 $propertyname = smwfNormalTitleText($propertyname); //slightly normalize label
8677 $special = $smwgContLang->findSpecialPropertyID($propertyname);
@@ -247,7 +238,6 @@
248239 }
249240
250241 smwfRequireHeadItem(SMW_HEADER_STYLE);
251 - include_once($smwgIP . '/includes/SMW_Infolink.php');
252242 $rdflink = SMWInfolink::newInternalLink(wfMsgForContent('smw_viewasrdf'), $wgContLang->getNsText(NS_SPECIAL) . ':ExportRDF/' . SMWFactbox::$semdata->getSubject()->getPrefixedText(), 'rdflink');
253243
254244 $browselink = SMWInfolink::newBrowsingLink(SMWFactbox::$semdata->getSubject()->getText(), SMWFactbox::$semdata->getSubject()->getPrefixedText(), 'swmfactboxheadbrowse');
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php
@@ -217,16 +217,16 @@
218218 $row = array();
219219 foreach ($prs as $pr) {
220220 switch ($pr->getMode()) {
221 - case SMW_PRINT_THIS:
 221+ case SMWPrintRequest::PRINT_THIS:
222222 $row[] = new SMWResultArray(array($qt), $pr);
223223 break;
224 - case SMW_PRINT_CATS:
 224+ case SMWPrintRequest::PRINT_CATS:
225225 $row[] = new SMWResultArray($this->m_store->getSpecialValues($qt->getTitle(),SMW_SP_INSTANCE_OF), $pr);
226226 break;
227 - case SMW_PRINT_PROP:
 227+ case SMWPrintRequest::PRINT_PROP:
228228 $row[] = new SMWResultArray($this->m_store->getPropertyValues($qt->getTitle(),$pr->getTitle(), NULL, $pr->getOutputFormat()), $pr);
229229 break;
230 - case SMW_PRINT_CCAT:
 230+ case SMWPrintRequest::PRINT_CCAT:
231231 $cats = $this->m_store->getSpecialValues($qt->getTitle(),SMW_SP_INSTANCE_OF);
232232 $found = '0';
233233 foreach ($cats as $cat) {
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore.php
@@ -6,16 +6,6 @@
77 */
88
99 /**
10 - * Protect against register_globals vulnerabilities.
11 - * This line must be present before any global variable is referenced.
12 - */
13 -if (!defined('MEDIAWIKI')) die();
14 -
15 -global $smwgIP;
16 -require_once( "$smwgIP/includes/storage/SMW_Store.php" );
17 -require_once( "$smwgIP/includes/SMW_DataValueFactory.php" );
18 -
19 -/**
2010 * Storage access class for using the standard MediaWiki SQL database
2111 * for keeping semantic data.
2212 */
@@ -1143,16 +1133,16 @@
11441134 $row = array();
11451135 foreach ($prs as $pr) {
11461136 switch ($pr->getMode()) {
1147 - case SMW_PRINT_THIS:
 1137+ case SMWPrintRequest::PRINT_THIS:
11481138 $row[] = new SMWResultArray(array($qt), $pr);
11491139 break;
1150 - case SMW_PRINT_CATS:
 1140+ case SMWPrintRequest::PRINT_CATS:
11511141 $row[] = new SMWResultArray($this->getSpecialValues($qt->getTitle(),SMW_SP_INSTANCE_OF), $pr);
11521142 break;
1153 - case SMW_PRINT_PROP:
 1143+ case SMWPrintRequest::PRINT_PROP:
11541144 $row[] = new SMWResultArray($this->getPropertyValues($qt->getTitle(),$pr->getTitle(), NULL, $pr->getOutputFormat()), $pr);
11551145 break;
1156 - case SMW_PRINT_CCAT:
 1146+ case SMWPrintRequest::PRINT_CCAT:
11571147 $cats = $this->getSpecialValues($qt->getTitle(),SMW_SP_INSTANCE_OF);
11581148 $found = '0';
11591149 foreach ($cats as $cat) {
@@ -1494,13 +1484,13 @@
14951485 $string = str_replace(array('_', ' '), array('\_', '\_'), $strcond->string);
14961486 }
14971487 switch ($strcond->condition) {
1498 - case SMW_STRCOND_PRE:
 1488+ case SMWStringCondition::STRCOND_PRE:
14991489 $string .= '%';
15001490 break;
1501 - case SMW_STRCOND_POST:
 1491+ case SMWStringCondition::STRCOND_POST:
15021492 $string = '%' . $string;
15031493 break;
1504 - case SMW_STRCOND_MID:
 1494+ case SMWStringCondition::STRCOND_MID:
15051495 $string = '%' . $string . '%';
15061496 break;
15071497 }
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php
@@ -6,33 +6,22 @@
77 */
88
99 /**
10 - * Protect against register_globals vulnerabilities.
11 - * This line must be present before any global variable is referenced.
12 - */
13 -if (!defined('MEDIAWIKI')) die();
14 -
15 -global $smwgIP;
16 -require_once($smwgIP . '/includes/SMW_SemanticData.php');
17 -require_once($smwgIP . '/includes/storage/SMW_Query.php');
18 -require_once($smwgIP . '/includes/storage/SMW_QueryResult.php');
19 -
20 -define('SMW_STRCOND_PRE',0);
21 -define('SMW_STRCOND_POST',1);
22 -define('SMW_STRCOND_MID',2);
23 -
24 -/**
2510 * Small data container class for describing filtering conditions on the string
2611 * label of some entity. States that a given string should either be prefix, postfix,
2712 * or some arbitrary part of labels.
 13+ * @note AUTOLOADED
2814 */
2915 class SMWStringCondition {
 16+ const STRCOND_PRE = 0;
 17+ const STRCOND_POST = 1;
 18+ const STRCOND_MID = 2;
3019 /**
3120 * String to match.
3221 */
3322 public $string;
3423 /**
35 - * Condition. One of SMW_STRCOND_PRE (string matches prefix),
36 - * SMW_STRCOND_POST (string matches postfix), SMW_STRCOND_MID
 24+ * Condition. One of STRCOND_PRE (string matches prefix),
 25+ * STRCOND_POST (string matches postfix), STRCOND_MID
3726 * (string matches to some inner part).
3827 */
3928 public $condition;
@@ -50,6 +39,7 @@
5140 * to their more complex structure.
5241 * Options that should not be used or where default values should be used
5342 * can be left as initialised.
 43+ * @note AUTOLOADED
5444 */
5545 class SMWRequestOptions {
5646 /**
@@ -95,7 +85,7 @@
9686 /**
9787 * Set a new string condition applied to labels of results (if available).
9888 * @param $string the string to match
99 - * @param $condition type of condition, one of SMW_STRCOND_PRE, SMW_STRCOND_POST, SMW_STRCOND_MID
 89+ * @param $condition type of condition, one of STRCOND_PRE, STRCOND_POST, STRCOND_MID
10090 */
10191 public function addStringCondition($string, $condition) {
10292 $this->stringcond[] = new SMWStringCondition($string, $condition);
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_TestStore.php
@@ -7,15 +7,6 @@
88 */
99
1010 /**
11 - * Protect against register_globals vulnerabilities.
12 - * This line must be present before any global variable is referenced.
13 - */
14 -if (!defined('MEDIAWIKI')) die();
15 -
16 -global $smwgIP;
17 -require_once( "$smwgIP/includes/storage/SMW_Store.php" );
18 -
19 -/**
2011 * Storage access class for testing purposes. No persitent storage is implemented, but
2112 * all methods return non-empty result sets that can be used for testing purposes.
2213 *
@@ -160,16 +151,13 @@
161152 $row = array();
162153 foreach ($prs as $pr) {
163154 switch ($pr->getMode()) {
164 - case SMW_PRINT_THIS:
 155+ case SMWPrintRequest::PRINT_THIS:
165156 $row[] = new SMWResultArray(array($qt), $pr);
166157 break;
167 - case SMW_PRINT_RELS:
168 - $row[] = new SMWResultArray($this->getRelationObjects($qt,$pr->getTitle()), $pr);
169 - break;
170 - case SMW_PRINT_CATS:
 158+ case SMWPrintRequest::PRINT_CATS:
171159 $row[] = new SMWResultArray($this->getSpecialValues($qt,SMW_SP_INSTANCE_OF), $pr);
172160 break;
173 - case SMW_PRINT_ATTS:
 161+ case SMWPrintRequest::PRINT_PROP:
174162 ///TODO: respect given datavalue (desired unit), needs extension of getAttributeValues()
175163 $row[] = new SMWResultArray($this->getAttributeValues($qt,$pr->getTitle()), $pr);
176164 break;
@@ -302,13 +290,13 @@
303291 // foreach ($requestoptions->getStringConditions() as $strcond) {
304292 // $string = str_replace(array('_', ' '), array('\_', '\_'), $strcond->string);
305293 // switch ($strcond->condition) {
306 -// case SMW_STRCOND_PRE:
 294+// case SMWStringCondition::STRCOND_PRE:
307295 // $string .= '%';
308296 // break;
309 -// case SMW_STRCOND_POST:
 297+// case SMWStringCondition::STRCOND_POST:
310298 // $string = '%' . $string;
311299 // break;
312 -// case SMW_STRCOND_MID:
 300+// case SMWStringCondition::STRCOND_MID:
313301 // $string = '%' . $string . '%';
314302 // break;
315303 // }
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
@@ -5,16 +5,6 @@
66 * @author Markus Krötzsch
77 */
88
9 -/**
10 - * Protect against register_globals vulnerabilities.
11 - * This line must be present before any global variable is referenced.
12 - */
13 -if (!defined('MEDIAWIKI')) die();
14 -
15 -global $smwgIP;
16 -require_once( "$smwgIP/includes/storage/SMW_Store.php" );
17 -require_once( "$smwgIP/includes/SMW_DataValueFactory.php" );
18 -
199 define('SMW_SQL2_SMWIW',':smw'); // virtual "interwiki prefix" for special SMW objects
2010
2111 // Constant flags for identifying tables/retrieval types
@@ -1015,9 +1005,9 @@
10161006 foreach ($requestoptions->getStringConditions() as $strcond) {
10171007 $string = str_replace('_', '\_', $strcond->string);
10181008 switch ($strcond->condition) {
1019 - case SMW_STRCOND_PRE: $string .= '%'; break;
1020 - case SMW_STRCOND_POST: $string = '%' . $string; break;
1021 - case SMW_STRCOND_MID: $string = '%' . $string . '%'; break;
 1009+ case SMWStringCondition::STRCOND_PRE: $string .= '%'; break;
 1010+ case SMWStringCondition::STRCOND_POST: $string = '%' . $string; break;
 1011+ case SMWStringCondition::STRCOND_MID: $string = '%' . $string . '%'; break;
10221012 }
10231013 $sql_conds .= ' AND ' . $labelcol . ' LIKE ' . $db->addQuotes($string);
10241014 }
@@ -1074,13 +1064,13 @@
10751065 }
10761066 foreach ($requestoptions->getStringConditions() as $strcond) { // apply string conditions
10771067 switch ($strcond->condition) {
1078 - case SMW_STRCOND_PRE:
 1068+ case SMWStringCondition::STRCOND_PRE:
10791069 $ok = $ok && (strpos($label,$strcond->string)===0);
10801070 break;
1081 - case SMW_STRCOND_POST:
 1071+ case SMWStringCondition::STRCOND_POST:
10821072 $ok = $ok && (strpos(strrev($label),strrev($strcond->string))===0);
10831073 break;
1084 - case SMW_STRCOND_MID:
 1074+ case SMWStringCondition::STRCOND_MID:
10851075 $ok = $ok && (strpos($label,$strcond->string)!==false);
10861076 break;
10871077 }
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_RAPStore.php
@@ -13,10 +13,7 @@
1414 die( 'Not an entry point.' );
1515 }
1616
17 -global $smwgIP,$smwgRAPPath;
18 -require_once( "$smwgIP/includes/storage/SMW_Store.php" );
19 -require_once( "$smwgIP/includes/storage/SMW_SQLStore.php" );
20 -require_once( "$smwgIP/includes/SMW_DataValueFactory.php" );
 17+global $smwgRAPPath;
2118
2219 define('RDFAPI_INCLUDE_DIR',$smwgRAPPath);
2320 require_once( "$smwgRAPPath/RdfAPI.php");
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php
@@ -6,25 +6,17 @@
77 * @author Markus Krötzsch
88 */
99
10 -// comparators for datavalues:
11 -define('SMW_CMP_EQ',1); // matches only datavalues that are equal to the given value
12 -define('SMW_CMP_LEQ',2); // matches only datavalues that are less or equal than the given value
13 -define('SMW_CMP_GEQ',3); // matches only datavalues that are greater or equal to the given value
14 -define('SMW_CMP_NEQ',4); // matches only datavalues that are unequal to the given value
15 -define('SMW_CMP_LIKE',5); // matches only datavalues that are LIKE the given value
16 -
17 -// print request
18 -define('SMW_PRINT_CATS', 0); // print all direct cateories of the current element
19 -define('SMW_PRINT_PROP', 1); // print all property values of a certain attribute of the current element
20 -define('SMW_PRINT_THIS', 2); // print the current element
21 -define('SMW_PRINT_CCAT', 3); // check whether current element is in given category
22 -
23 -
2410 /**
2511 * Container class for request for printout, as used in queries to
2612 * obtain additional information for the retrieved results.
 13+ * @note: AUTOLOADED
2714 */
2815 class SMWPrintRequest {
 16+ const PRINT_CATS = 0; // print all direct cateories of the current element
 17+ const PRINT_PROP = 1; // print all property values of a certain attribute of the current element
 18+ const PRINT_THIS = 2; // print the current element
 19+ const PRINT_CCAT = 3; // check whether current element is in given category
 20+
2921 protected $m_mode; // type of print request
3022 protected $m_label; // string for labelling results, contains no markup
3123 protected $m_title; // title object to which print request refers (if any)
@@ -43,7 +35,7 @@
4436 $this->m_label = $label;
4537 $this->m_title = $title;
4638 $this->m_outputformat = $outputformat;
47 - if ( ($mode == SMW_PRINT_CCAT) && ($outputformat === '') ) {
 39+ if ( ($mode == SMWPrintRequest::PRINT_CCAT) && ($outputformat === '') ) {
4840 $this->m_outputformat = 'x'; // changed default for Boolean case
4941 }
5042 }
@@ -66,10 +58,10 @@
6759 return htmlspecialchars($this->m_label);
6860 }
6961 switch ($this->m_mode) {
70 - case SMW_PRINT_CATS: return htmlspecialchars($this->m_label); // TODO: link to Special:Categories
71 - case SMW_PRINT_PROP: case SMW_PRINT_CCAT:
 62+ case SMWPrintRequest::PRINT_CATS: return htmlspecialchars($this->m_label); // TODO: link to Special:Categories
 63+ case SMWPrintRequest::PRINT_PROP: case SMWPrintRequest::PRINT_CCAT:
7264 return $linker->makeLinkObj($this->m_title, htmlspecialchars($this->m_label));
73 - case SMW_PRINT_THIS: default: return htmlspecialchars($this->m_label);
 65+ case SMWPrintRequest::PRINT_THIS: default: return htmlspecialchars($this->m_label);
7466 }
7567
7668 }
@@ -82,10 +74,10 @@
8375 return $this->m_label;
8476 } else {
8577 switch ($this->m_mode) {
86 - case SMW_PRINT_CATS: return $this->m_label; // TODO: link to Special:Categories
87 - case SMW_PRINT_PROP: case SMW_PRINT_CCAT:
 78+ case SMWPrintRequest::PRINT_CATS: return $this->m_label; // TODO: link to Special:Categories
 79+ case SMWPrintRequest::PRINT_PROP: case SMWPrintRequest::PRINT_CCAT:
8880 return '[[:' . $this->m_title->getPrefixedText() . '|' . $this->m_label . ']]';
89 - case SMW_PRINT_THIS: default: return $this->m_label;
 81+ case SMWPrintRequest::PRINT_THIS: default: return $this->m_label;
9082 }
9183 }
9284 }
@@ -107,7 +99,7 @@
108100
109101 public function getTypeID() {
110102 if ($this->m_typeid === false) {
111 - if ($this->m_mode == SMW_PRINT_PROP) {
 103+ if ($this->m_mode == SMWPrintRequest::PRINT_PROP) {
112104 $this->m_typeid = SMWDataValueFactory::getPropertyObjectTypeID($this->m_title);
113105 } else {
114106 $this->m_typeid = '_wpg'; // return objects might be titles, but anyway
@@ -135,7 +127,7 @@
136128 public function getSerialisation() {
137129 /// TODO: do not use "= label" if label is the default anyway
138130 switch ($this->m_mode) {
139 - case SMW_PRINT_CATS:
 131+ case SMWPrintRequest::PRINT_CATS:
140132 global $wgContLang;
141133 $catlabel = $wgContLang->getNSText(NS_CATEGORY);
142134 $result = '?' . $catlabel;
@@ -143,8 +135,8 @@
144136 $result .= '=' . $this->m_label;
145137 }
146138 return $result;
147 - case SMW_PRINT_PROP: case SMW_PRINT_CCAT:
148 - if ($this->m_mode == SMW_PRINT_CCAT) {
 139+ case SMWPrintRequest::PRINT_PROP: case SMWPrintRequest::PRINT_CCAT:
 140+ if ($this->m_mode == SMWPrintRequest::PRINT_CCAT) {
149141 $result = '?' . $this->m_title->getPrefixedText();
150142 if ( $this->m_outputformat != 'x' ) {
151143 $result .= '#' . $this->m_outputformat;
@@ -159,7 +151,7 @@
160152 $result .= '=' . $this->m_label;
161153 }
162154 return $result;
163 - case SMW_PRINT_THIS: default: return ''; // no current serialisation
 155+ case SMWPrintRequest::PRINT_THIS: default: return ''; // no current serialisation
164156 }
165157 }
166158 }
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php
@@ -13,9 +13,10 @@
1414 * Objects of this class encapsulate the result of a query in SMW. They
1515 * provide access to the query result and printed data, and to some
1616 * relevant query parameters that were used.
17 - *
 17+ *
1818 * While the API does not require this, it is ensured that every result row
1919 * returned by this object has the same number of elements (columns).
 20+ * @note: AUTOLOADED
2021 */
2122 class SMWQueryResult {
2223 protected $m_content; // array (table) of arrays (rows) of arrays (fields, SMWResultArray)
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Query.php
@@ -7,15 +7,6 @@
88 */
99
1010 /**
11 - * Protect against register_globals vulnerabilities.
12 - * This line must be present before any global variable is referenced.
13 - */
14 -if (!defined('MEDIAWIKI')) die();
15 -
16 -global $smwgIP;
17 -require_once($smwgIP . '/includes/storage/SMW_Description.php');
18 -
19 -/**
2011 * Representation of queries in SMW, each consisting of a query
2112 * description and various parameters. Some settings might also lead to
2213 * changes in the query description.
@@ -23,6 +14,7 @@
2415 * Most additional query parameters (limit, sort, ascending, ...) are
2516 * interpreted as in SMWRequestOptions (though the latter contains some
2617 * additional settings).
 18+ * @note: AUTOLOADED
2719 */
2820 class SMWQuery {
2921
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Types.php
@@ -12,7 +12,6 @@
1313 * @author Markus Krötzsch
1414 * @note AUTOLOADED
1515 */
16 -require_once ('SMW_DataValue.php');
1716 class SMWTypesValue extends SMWDataValue {
1817
1918 private $m_typelabels = false;
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Settings.php
@@ -1,5 +1,9 @@
22 <?php
33
 4+if ( !defined( 'MEDIAWIKI' ) ) {
 5+ die( "This file is part of the Semantic MediaWiki extension. It is not a valid entry point.\n" );
 6+}
 7+
48 ###
59 # This is the path to your installation of Semantic MediaWiki as
610 # seen from the web. Change it if required ($wgScriptPath is the
@@ -27,11 +31,7 @@
2832 # that is not in use yet. However, it must not be smaller
2933 # than 100.
3034 ##
31 -if (!isset($smwgNamespaceIndex)) {
32 - smwfInitNamespaces(100);
33 -} else {
34 - smwfInitNamespaces();
35 -}
 35+smwfInitNamespaces();
3636
3737 ###
3838 # This setting allows you to select in which cases you want to have a factbox
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Timeline.php
@@ -55,7 +55,7 @@
5656
5757 if ( !$eventline && ($this->m_tlstart == '') ) { // seek defaults
5858 foreach ($res->getPrintRequests() as $pr) {
59 - if ( ($pr->getMode() == SMW_PRINT_PROP) && ($pr->getTypeID() == '_dat') ) {
 59+ if ( ($pr->getMode() == SMWPrintRequest::PRINT_PROP) && ($pr->getTypeID() == '_dat') ) {
6060 if ( ($this->m_tlend == '') && ($this->m_tlstart != '') &&
6161 ($this->m_tlstart != $pr->getTitle()->getDBkey()) ) {
6262 $this->m_tlend = $pr->getTitle()->getDBkey();
@@ -109,7 +109,7 @@
110110 $header = $pr->getText($outputmode,$this->mLinker) . ' ';
111111 }
112112 // is this a start date?
113 - if ( ($pr->getMode() == SMW_PRINT_PROP) &&
 113+ if ( ($pr->getMode() == SMWPrintRequest::PRINT_PROP) &&
114114 ($pr->getTitle()->getDBkey() == $this->m_tlstart) ) {
115115 //FIXME: Timeline scripts should support XSD format explicitly. They
116116 //currently seem to implement iso8601 which deviates from XSD in cases.
@@ -119,7 +119,7 @@
120120 $hastime = true;
121121 }
122122 // is this the end date?
123 - if ( ($pr->getMode() == SMW_PRINT_PROP) &&
 123+ if ( ($pr->getMode() == SMWPrintRequest::PRINT_PROP) &&
124124 ($pr->getTitle()->getDBkey() == $this->m_tlend) ) {
125125 //NOTE: We can assume $object to be an SMWDataValue in this case.
126126 $curmeta .= '<span class="smwtlend">' . $object->getXSDValue() . '</span>';
@@ -131,7 +131,7 @@
132132 } else {
133133 $curmeta .= '<span class="smwtltitle">' . $objectlabel . '</span>';
134134 }
135 - if ( ($pr->getMode() == SMW_PRINT_THIS) ) {
 135+ if ( ($pr->getMode() == SMWPrintRequest::PRINT_THIS) ) {
136136 // NOTE: type Title of $object implied
137137 $curarticle = $object->getLongWikiText();
138138 }
@@ -142,7 +142,7 @@
143143 $curdata .= $header . $objectlabel;
144144 $output = true;
145145 }
146 - if ($eventline && ($pr->getMode() == SMW_PRINT_PROP) && ($pr->getTypeID() == '_dat') && ('' != $pr->getLabel()) && ($pr->getTitle()->getText() != $this->m_tlstart) && ($pr->getTitle()->getText() != $this->m_tlend) ) {
 146+ if ($eventline && ($pr->getMode() == SMWPrintRequest::PRINT_PROP) && ($pr->getTypeID() == '_dat') && ('' != $pr->getLabel()) && ($pr->getTitle()->getText() != $this->m_tlstart) && ($pr->getTitle()->getText() != $this->m_tlend) ) {
147147 $events[] = array($object->getXSDValue(), $pr->getLabel(), $object->getNumericValue());
148148 }
149149 $first_value = false;
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SpecialPage.php
@@ -1,10 +1,5 @@
22 <?php
33
4 -if (!defined('MEDIAWIKI')) die();
5 -
6 -global $IP;
7 -include_once($IP . '/includes/SpecialPage.php');
8 -
94 /**
105 * A simple extension of SpecialPage that ensures that all relevant SMW-user
116 * messages are loaded when the special page is initialised. This is especially
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php
@@ -6,14 +6,9 @@
77 * Some code adapted from CategoryPage.php
88 *
99 * @author Nikolas Iwan
10 - * @author Markus Krötzsch
 10+ * @author Markus Krötzsch
1111 */
1212
13 -if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
14 -
15 -global $IP;
16 -require_once( "$IP/includes/Article.php" );
17 -
1813 /**
1914 * Abstract subclass of MediaWiki's Article that handles the common tasks of
2015 * article pages for Types and Properties. Mostly, it implements general processing
@@ -21,6 +16,7 @@
2217 * parameters.
2318 *
2419 * Some code adapted from CategoryPage.php
 20+ * @note AUTOLOADED
2521 */
2622 abstract class SMWOrderedListPage extends Article {
2723
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_TypePage.php
@@ -7,15 +7,10 @@
88 * @author: Markus Krötzsch
99 */
1010
11 -if( !defined( 'MEDIAWIKI' ) ) die( 1 );
12 -
13 -global $smwgIP;
14 -include_once($smwgIP . '/includes/articlepages/SMW_OrderedListPage.php');
15 -include_once($smwgIP . '/includes/SMW_DataValueFactory.php');
16 -
1711 /**
1812 * Implementation of MediaWiki's Article that shows additional information on
1913 * Type: pages. Very simliar to CategoryPage.
 14+ * @note AUTOLOADED
2015 */
2116 class SMWTypePage extends SMWOrderedListPage {
2217
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php
@@ -6,15 +6,11 @@
77 * @author: Markus Krötzsch
88 */
99
10 -if( !defined( 'MEDIAWIKI' ) ) die( 1 );
11 -
12 -global $smwgIP;
13 -require_once( "$smwgIP/includes/articlepages/SMW_OrderedListPage.php");
14 -
1510 /**
1611 * Implementation of MediaWiki's Article that shows additional information on
1712 * property pages. Very simliar to CategoryPage, but with different printout
1813 * that also displays values for each subject with the given property.
 14+ * @note AUTOLOADED
1915 */
2016 class SMWPropertyPage extends SMWOrderedListPage {
2117
@@ -113,8 +109,6 @@
114110 $r = '<table style="width: 100%; ">';
115111 $prevchar = 'None';
116112 for ($index = $start; $index < $ac; $index++ ) {
117 - global $smwgIP;
118 - include_once($smwgIP . '/includes/SMW_Infolink.php');
119113 // Header for index letters
120114 if ($this->articles_start_char[$index] != $prevchar) {
121115 $r .= '<tr><th class="smwpropname"><h3>' . htmlspecialchars( $this->articles_start_char[$index] ) . "</h3></th><th></th></tr>\n";
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php
@@ -3,7 +3,7 @@
44 * Global functions and constants for Semantic MediaWiki.
55 */
66
7 -define('SMW_VERSION','1.2f-SVN');
 7+define('SMW_VERSION','1.2g-SVN');
88
99 // constants for special properties, used for datatype assignment and storage
1010 define('SMW_SP_HAS_TYPE',1);
@@ -23,7 +23,7 @@
2424 define('SMW_SP_SUBCLASS_OF',18);
2525
2626 // old names, will be removed *two* releases after given version
27 -// SMW 1.1.1
 27+// SMW 1.1.2
2828 define('SMW_SP_HAS_CATEGORY',4); // name specific for categories, use "instance of" to distinguish from future explicit "subclass of"
2929
3030 // constants for displaying the factbox
@@ -51,6 +51,13 @@
5252 define('SMW_OUTPUT_WIKI', 2);
5353 define('SMW_OUTPUT_FILE', 3);
5454
 55+// comparators for datavalues:
 56+define('SMW_CMP_EQ',1); // matches only datavalues that are equal to the given value
 57+define('SMW_CMP_LEQ',2); // matches only datavalues that are less or equal than the given value
 58+define('SMW_CMP_GEQ',3); // matches only datavalues that are greater or equal to the given value
 59+define('SMW_CMP_NEQ',4); // matches only datavalues that are unequal to the given value
 60+define('SMW_CMP_LIKE',5); // matches only datavalues that are LIKE the given value
 61+
5562 // HTML items to load in current page, use smwfRequireHeadItem to extend
5663 $smwgHeadItems = array();
5764
@@ -79,6 +86,11 @@
8087 ///// All classes registered for autoloading here should be tagged with this information:
8188 ///// Add "@note AUTOLOADED" to their class documentation. This avoids useless includes.
8289 $wgAutoloadClasses['SMWInfolink'] = $smwgIP . '/includes/SMW_Infolink.php';
 90+ $wgAutoloadClasses['SMWFactbox'] = $smwgIP . '/includes/SMW_Factbox.php';
 91+ $wgAutoloadClasses['SMWSemanticData'] = $smwgIP . '/includes/SMW_SemanticData.php';
 92+ $wgAutoloadClasses['SMWOrderedListPage'] = $smwgIP . '/includes/articlepages/SMW_OrderedListPage.php';
 93+ $wgAutoloadClasses['SMWTypePage'] = $smwgIP . '/includes/articlepages/SMW_TypePage.php';
 94+ $wgAutoloadClasses['SMWPropertyPage'] = $smwgIP . '/includes/articlepages/SMW_PropertyPage.php';
8395 //// printers
8496 $wgAutoloadClasses['SMWResultPrinter'] = $smwgIP . '/includes/SMW_QueryPrinter.php';
8597 $wgAutoloadClasses['SMWTableResultPrinter'] = $smwgIP . '/includes/SMW_QP_Table.php';
@@ -91,6 +103,9 @@
92104 $wgAutoloadClasses['SMWvCardResultPrinter'] = $smwgIP . '/includes/SMW_QP_vCard.php';
93105 //// datavalues
94106 $wgAutoloadClasses['SMWDataValue'] = $smwgIP . '/includes/SMW_DataValue.php';
 107+ $wgAutoloadClasses['SMWErrorvalue'] = $smwgIP . '/includes/SMW_DV_Error.php';
 108+ ///NOTE: other DataValues are registered for autoloading later on by the factory, use the hook
 109+ /// smwInitDatatypes to modify paths for datatype implementations and for registering new types.
95110 $wgAutoloadClasses['SMWDataValueFactory'] = $smwgIP . '/includes/SMW_DataValueFactory.php';
96111 // the builtin types are registered by SMWDataValueFactory if needed, will be reliably available
97112 // to other DV-implementations that register to the factory.
@@ -100,15 +115,31 @@
101116 $wgAutoloadClasses['SMWExpElement'] = $smwgIP . '/includes/export/SMW_Exp_Element.php';
102117 $wgAutoloadClasses['SMWExpLiteral'] = $smwgIP . '/includes/export/SMW_Exp_Element.php';
103118 $wgAutoloadClasses['SMWExpResource'] = $smwgIP . '/includes/export/SMW_Exp_Element.php';
104 - //// stores
 119+ //// stores & queries
 120+ $wgAutoloadClasses['SMWQueryProcessor'] = $smwgIP . '/includes/SMW_QueryProcessor.php';
 121+ $wgAutoloadClasses['SMWQuery'] = $smwgIP . '/includes/storage/SMW_Query.php';
 122+ $wgAutoloadClasses['SMWQueryResult'] = $smwgIP . '/includes/storage/SMW_QueryResult.php';
 123+ $wgAutoloadClasses['SMWStore'] = $smwgIP . '/includes/storage/SMW_Store.php';
 124+ $wgAutoloadClasses['SMWStringCondition'] = $smwgIP . '/includes/storage/SMW_Store.php';
 125+ $wgAutoloadClasses['SMWRequestOptions'] = $smwgIP . '/includes/storage/SMW_Store.php';
 126+ $wgAutoloadClasses['SMWPrintRequest'] = $smwgIP . '/includes/storage/SMW_Description.php';
 127+ $wgAutoloadClasses['SMWThingDescription'] = $smwgIP . '/includes/storage/SMW_Description.php';
 128+ $wgAutoloadClasses['SMWClassDescription'] = $smwgIP . '/includes/storage/SMW_Description.php';
 129+ $wgAutoloadClasses['SMWNamespaceDescription'] = $smwgIP . '/includes/storage/SMW_Description.php';
 130+ $wgAutoloadClasses['SMWValueDescription'] = $smwgIP . '/includes/storage/SMW_Description.php';
 131+ $wgAutoloadClasses['SMWValueList'] = $smwgIP . '/includes/storage/SMW_Description.php';
 132+ $wgAutoloadClasses['SMWConjunction'] = $smwgIP . '/includes/storage/SMW_Description.php';
 133+ $wgAutoloadClasses['SMWDisjunction'] = $smwgIP . '/includes/storage/SMW_Description.php';
 134+ $wgAutoloadClasses['SMWSomeProperty'] = $smwgIP . '/includes/storage/SMW_Description.php';
105135 $wgAutoloadClasses['SMWSQLStore'] = $smwgIP . '/includes/storage/SMW_SQLStore.php';
106 - $wgAutoloadClasses['SMWSQLStore2'] = $smwgIP . '/includes/storage/SMW_SQLStore2.php';
 136+ $wgAutoloadClasses['SMWSQLStore2'] = $smwgIP . '/includes/storage/SMW_SQLStore2.php';
107137 // Do not autoload RAPStore, since some special pages load all autoloaded classes, which causes
108138 // troubles with RAP store if RAP is not installed (require_once fails).
109139 //$wgAutoloadClasses['SMWRAPStore'] = $smwgIP . '/includes/storage/SMW_RAPStore.php';
110140 $wgAutoloadClasses['SMWTestStore'] = $smwgIP . '/includes/storage/SMW_TestStore.php';
111141
112142 ///// Register specials, do that early on in case some other extension calls "addPage" /////
 143+ $wgAutoloadClasses['SMWQueryPage'] = $smwgIP . '/specials/QueryPages/SMW_QueryPage.php';
113144 $wgAutoloadClasses['SMWAskPage'] = $smwgIP . '/specials/AskSpecial/SMW_SpecialAsk.php';
114145 $wgSpecialPages['Ask'] = array('SMWAskPage');
115146 $wgAutoloadClasses['SMWSpecialBrowse'] = $smwgIP . '/specials/SearchTriple/SMW_SpecialBrowse.php';
@@ -142,7 +173,6 @@
143174 $wgAutoloadClasses['SMWUpdateJob'] = $smwgIP . '/includes/jobs/SMW_UpdateJob.php';
144175 $wgJobClasses['SMWUpdateJob'] = 'SMWUpdateJob';
145176
146 -
147177 return true;
148178 }
149179
@@ -214,10 +244,9 @@
215245 * The <ask> parser hook processing part.
216246 */
217247 function smwfProcessInlineQuery($querytext, $params, &$parser) {
218 - global $smwgQEnabled, $smwgIP, $smwgIQRunningNumber;
 248+ global $smwgQEnabled, $smwgIQRunningNumber;
219249 if ($smwgQEnabled) {
220250 $smwgIQRunningNumber++;
221 - require_once($smwgIP . '/includes/SMW_QueryProcessor.php');
222251 return SMWQueryProcessor::getResultFromHookParams($querytext,$params,SMW_OUTPUT_HTML);
223252 } else {
224253 return smwfEncodeMessages(array(wfMsgForContent('smw_iq_disabled')));
@@ -228,10 +257,9 @@
229258 * The {{#ask }} parser function processing part.
230259 */
231260 function smwfProcessInlineQueryParserFunction(&$parser) {
232 - global $smwgQEnabled, $smwgIP, $smwgIQRunningNumber;
 261+ global $smwgQEnabled, $smwgIQRunningNumber;
233262 if ($smwgQEnabled) {
234263 $smwgIQRunningNumber++;
235 - require_once($smwgIP . '/includes/SMW_QueryProcessor.php');
236264 $params = func_get_args();
237265 array_shift( $params ); // we already know the $parser ...
238266 return SMWQueryProcessor::getResultFromFunctionParams($params,SMW_OUTPUT_WIKI);
@@ -482,8 +510,6 @@
483511 * content (e.g. as a string value for some property).
484512 */
485513 function smwfXMLContentEncode($text) {
486 - global $IP;
487 - include_once($IP . '/includes/Sanitizer.php');
488514 return str_replace(array('&','<','>'), array('&amp;','&lt;','&gt;'), Sanitizer::decodeCharReferences($text));
489515 }
490516
@@ -492,8 +518,6 @@
493519 * content (e.g. as a string value for some property).
494520 */
495521 function smwfHTMLtoUTF8($text) {
496 - global $IP;
497 - include_once($IP . '/includes/Sanitizer.php');
498522 return Sanitizer::decodeCharReferences($text);
499523 }
500524
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php
@@ -11,6 +11,7 @@
1212 * Class for representing chunks of semantic data for one given
1313 * article (subject), similar what is typically displayed in the factbox.
1414 * This is a light-weight data container.
 15+ * @note: AUTOLOADED
1516 */
1617 class SMWSemanticData {
1718 protected $attribvals = array(); // text keys and arrays of datavalue objects

Status & tagging log