Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -21,27 +21,6 @@ |
22 | 22 | const CONCEPT_DESC = 2; // query for concept definition |
23 | 23 | |
24 | 24 | /** |
25 | | - * Array of enabled formats for formatting queries. Can be redefined in the settings to disallow certain |
26 | | - * formats. The formats 'table' and 'list' are defaults that cannot be disabled. The format 'broadtable' |
27 | | - * should not be disabled either in order not to break Special:ask. |
28 | | - */ |
29 | | - static $formats = array('table' => 'SMWTableResultPrinter', |
30 | | - 'list' => 'SMWListResultPrinter', |
31 | | - 'ol' => 'SMWListResultPrinter', |
32 | | - 'ul' => 'SMWListResultPrinter', |
33 | | - 'broadtable' => 'SMWTableResultPrinter', |
34 | | - 'embedded' => 'SMWEmbeddedResultPrinter', |
35 | | - 'timeline' => 'SMWTimelineResultPrinter', |
36 | | - 'eventline' => 'SMWTimelineResultPrinter', |
37 | | - 'template' => 'SMWTemplateResultPrinter', |
38 | | - 'count' => 'SMWListResultPrinter', |
39 | | - 'debug' => 'SMWListResultPrinter', |
40 | | - 'rss' => 'SMWRSSResultPrinter', |
41 | | - 'icalendar' => 'SMWiCalendarResultPrinter', |
42 | | - 'vcard' => 'SMWvCardResultPrinter', |
43 | | - 'csv' => 'SMWCsvResultPrinter'); |
44 | | - |
45 | | - /** |
46 | 25 | * Parse a query string given in SMW's query language to create |
47 | 26 | * an SMWQuery. Parameters are given as key-value-pairs in the |
48 | 27 | * given array. The parameter $context defines in what context the |
— | — | @@ -312,7 +291,8 @@ |
313 | 292 | $format = 'auto'; |
314 | 293 | if (array_key_exists('format', $params)) { |
315 | 294 | $format = strtolower(trim($params['format'])); |
316 | | - if ( !array_key_exists($format, SMWQueryProcessor::$formats) ) { |
| 295 | + global $smwgResultFormats; |
| 296 | + if ( !array_key_exists($format, $smwgResultFormats) ) { |
317 | 297 | $format = 'auto'; // If it is an unknown format, defaults to list/table again |
318 | 298 | } |
319 | 299 | } |
— | — | @@ -328,8 +308,9 @@ |
329 | 309 | $format = 'table'; |
330 | 310 | else $format = 'list'; |
331 | 311 | } |
332 | | - if (array_key_exists($format, SMWQueryProcessor::$formats)) |
333 | | - $formatclass = SMWQueryProcessor::$formats[$format]; |
| 312 | + global $smwgResultFormats; |
| 313 | + if (array_key_exists($format, $smwgResultFormats)) |
| 314 | + $formatclass = $smwgResultFormats[$format]; |
334 | 315 | else |
335 | 316 | $formatclass = "SMWListResultPrinter"; |
336 | 317 | return new $formatclass($format, ($context != SMWQueryProcessor::SPECIAL_PAGE)); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php |
— | — | @@ -740,3 +740,26 @@ |
741 | 741 | return $smwgMasterStore; |
742 | 742 | } |
743 | 743 | |
| 744 | +/** |
| 745 | + * Array of enabled formats for formatting queries. Can be redefined in the |
| 746 | + * settings to disallow certain formats. The formats 'table' and 'list' are |
| 747 | + * defaults that cannot be disabled. The format 'broadtable' should not be |
| 748 | + * disabled either in order not to break Special:ask. |
| 749 | + */ |
| 750 | +global $smwgResultFormats; |
| 751 | +$smwgResultFormats = |
| 752 | + array( 'table' => 'SMWTableResultPrinter', |
| 753 | + 'list' => 'SMWListResultPrinter', |
| 754 | + 'ol' => 'SMWListResultPrinter', |
| 755 | + 'ul' => 'SMWListResultPrinter', |
| 756 | + 'broadtable' => 'SMWTableResultPrinter', |
| 757 | + 'embedded' => 'SMWEmbeddedResultPrinter', |
| 758 | + 'timeline' => 'SMWTimelineResultPrinter', |
| 759 | + 'eventline' => 'SMWTimelineResultPrinter', |
| 760 | + 'template' => 'SMWTemplateResultPrinter', |
| 761 | + 'count' => 'SMWListResultPrinter', |
| 762 | + 'debug' => 'SMWListResultPrinter', |
| 763 | + 'rss' => 'SMWRSSResultPrinter', |
| 764 | + 'icalendar' => 'SMWiCalendarResultPrinter', |
| 765 | + 'vcard' => 'SMWvCardResultPrinter', |
| 766 | + 'csv' => 'SMWCsvResultPrinter'); |