Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -34,14 +34,14 @@ |
35 | 35 | * |
36 | 36 | * @return SMWQuery |
37 | 37 | */ |
38 | | - static public function createQuery( $querystring, array $params, $context = SMWQueryProcessor::INLINE_QUERY, $format = '', $extraprintouts = array() ) { |
| 38 | + static public function createQuery( $querystring, array $params, $context = self::INLINE_QUERY, $format = '', $extraprintouts = array() ) { |
39 | 39 | global $smwgQDefaultNamespaces, $smwgQFeatures, $smwgQConceptFeatures; |
40 | 40 | if ( $format == '' ) { |
41 | | - $format = SMWQueryProcessor::getResultFormat( $params ); |
| 41 | + $format = self::getResultFormat( $params ); |
42 | 42 | } |
43 | 43 | |
44 | 44 | // parse query: |
45 | | - $queryfeatures = ( $context == SMWQueryProcessor::CONCEPT_DESC ) ? $smwgQConceptFeatures : $smwgQFeatures; |
| 45 | + $queryfeatures = ( $context == self::CONCEPT_DESC ) ? $smwgQConceptFeatures : $smwgQFeatures; |
46 | 46 | $qp = new SMWQueryParser( $queryfeatures ); |
47 | 47 | $qp->setDefaultNamespaces( $smwgQDefaultNamespaces ); |
48 | 48 | $desc = $qp->getQueryDescription( $querystring ); |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | } elseif ( $format == 'debug' ) { |
53 | 53 | $querymode = SMWQuery::MODE_DEBUG; |
54 | 54 | } else { |
55 | | - $printer = SMWQueryProcessor::getResultPrinter( $format, $context ); |
| 55 | + $printer = self::getResultPrinter( $format, $context ); |
56 | 56 | $querymode = $printer->getQueryMode( $context ); |
57 | 57 | } |
58 | 58 | |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | $desc->prependPrintRequest( new SMWPrintRequest( SMWPrintRequest::PRINT_THIS, $mainlabel ) ); |
64 | 64 | } |
65 | 65 | |
66 | | - $query = new SMWQuery( $desc, ( $context != SMWQueryProcessor::SPECIAL_PAGE ), ( $context == SMWQueryProcessor::CONCEPT_DESC ) ); |
| 66 | + $query = new SMWQuery( $desc, ( $context != self::SPECIAL_PAGE ), ( $context == self::CONCEPT_DESC ) ); |
67 | 67 | $query->setQueryString( $querystring ); |
68 | 68 | $query->setExtraPrintouts( $extraprintouts ); |
69 | 69 | $query->addErrors( $qp->getErrors() ); // keep parsing errors for later output |
— | — | @@ -250,9 +250,9 @@ |
251 | 251 | * obtain actual parameters, printout requests, and the query string for |
252 | 252 | * further processing. |
253 | 253 | */ |
254 | | - static public function getResultFromFunctionParams( array $rawparams, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $showmode = false ) { |
255 | | - SMWQueryProcessor::processFunctionParams( $rawparams, $querystring, $params, $printouts, $showmode ); |
256 | | - return SMWQueryProcessor::getResultFromQueryString( $querystring, $params, $printouts, SMW_OUTPUT_WIKI, $context ); |
| 254 | + static public function getResultFromFunctionParams( array $rawparams, $outputmode, $context = self::INLINE_QUERY, $showmode = false ) { |
| 255 | + self::processFunctionParams( $rawparams, $querystring, $params, $printouts, $showmode ); |
| 256 | + return self::getResultFromQueryString( $querystring, $params, $printouts, SMW_OUTPUT_WIKI, $context ); |
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
— | — | @@ -263,19 +263,19 @@ |
264 | 264 | * certain general settings. Finally, $extraprintouts supplies additional |
265 | 265 | * printout requests for the query results. |
266 | 266 | */ |
267 | | - static public function getResultFromQueryString( $querystring, array $params, $extraprintouts, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY ) { |
| 267 | + static public function getResultFromQueryString( $querystring, array $params, $extraprintouts, $outputmode, $context = self::INLINE_QUERY ) { |
268 | 268 | wfProfileIn( 'SMWQueryProcessor::getResultFromQueryString (SMW)' ); |
269 | 269 | |
270 | | - $format = SMWQueryProcessor::getResultFormat( $params ); |
271 | | - $query = SMWQueryProcessor::createQuery( $querystring, $params, $context, $format, $extraprintouts ); |
272 | | - $result = SMWQueryProcessor::getResultFromQuery( $query, $params, $extraprintouts, $outputmode, $context, $format ); |
| 270 | + $format = self::getResultFormat( $params ); |
| 271 | + $query = self::createQuery( $querystring, $params, $context, $format, $extraprintouts ); |
| 272 | + $result = self::getResultFromQuery( $query, $params, $extraprintouts, $outputmode, $context, $format ); |
273 | 273 | |
274 | 274 | wfProfileOut( 'SMWQueryProcessor::getResultFromQueryString (SMW)' ); |
275 | 275 | |
276 | 276 | return $result; |
277 | 277 | } |
278 | 278 | |
279 | | - static public function getResultFromQuery( SMWQuery $query, array $params, $extraprintouts, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $format = '' ) { |
| 279 | + static public function getResultFromQuery( SMWQuery $query, array $params, $extraprintouts, $outputmode, $context = self::INLINE_QUERY, $format = '' ) { |
280 | 280 | wfProfileIn( 'SMWQueryProcessor::getResultFromQuery (SMW)' ); |
281 | 281 | |
282 | 282 | // Query routing allows extensions to provide alternative stores as data sources |
— | — | @@ -296,10 +296,10 @@ |
297 | 297 | wfProfileIn( 'SMWQueryProcessor::getResultFromQuery-printout (SMW)' ); |
298 | 298 | |
299 | 299 | if ( $format == '' ) { |
300 | | - $format = SMWQueryProcessor::getResultFormat( $params ); |
| 300 | + $format = self::getResultFormat( $params ); |
301 | 301 | } |
302 | 302 | |
303 | | - $printer = SMWQueryProcessor::getResultPrinter( $format, $context, $res ); |
| 303 | + $printer = self::getResultPrinter( $format, $context, $res ); |
304 | 304 | $result = $printer->getResult( $res, $params, $outputmode ); |
305 | 305 | |
306 | 306 | wfProfileOut( 'SMWQueryProcessor::getResultFromQuery-printout (SMW)' ); |
— | — | @@ -379,7 +379,7 @@ |
380 | 380 | * |
381 | 381 | * @return SMWResultPrinter |
382 | 382 | */ |
383 | | - static public function getResultPrinter( $format, $context = SMWQueryProcessor::SPECIAL_PAGE ) { |
| 383 | + static public function getResultPrinter( $format, $context = self::SPECIAL_PAGE ) { |
384 | 384 | global $smwgResultFormats; |
385 | 385 | |
386 | 386 | self::resolveFormatAliases( $format ); |
— | — | @@ -387,7 +387,7 @@ |
388 | 388 | // TODO: this seems to contain the same logic as found in getResultFormat - a single function for this might be better. |
389 | 389 | $formatClass = array_key_exists( $format, $smwgResultFormats ) ? $smwgResultFormats[$format] : 'SMWAutoResultPrinter'; |
390 | 390 | |
391 | | - return new $formatClass( $format, ( $context != SMWQueryProcessor::SPECIAL_PAGE ) ); |
| 391 | + return new $formatClass( $format, ( $context != self::SPECIAL_PAGE ) ); |
392 | 392 | } |
393 | 393 | |
394 | 394 | } |
\ No newline at end of file |