Index: trunk/extensions/SemanticCompoundQueries/SCQ_QueryProcessor.php |
— | — | @@ -20,40 +20,38 @@ |
21 | 21 | public static function doCompoundQuery( Parser &$parser ) { |
22 | 22 | global $smwgQEnabled, $smwgIQRunningNumber; |
23 | 23 | |
24 | | - if ( $smwgQEnabled ) { |
25 | | - $smwgIQRunningNumber++; |
26 | | - |
27 | | - $params = func_get_args(); |
28 | | - array_shift( $params ); // We already know the $parser. |
29 | | - |
30 | | - $other_params = array(); |
31 | | - $results = array(); |
32 | | - |
33 | | - foreach ( $params as $param ) { |
34 | | - // very primitive heuristic - if the parameter |
35 | | - // includes a square bracket, then it's a |
36 | | - // sub-query; otherwise it's a regular parameter |
37 | | - if ( strpos( $param, '[' ) !== false ) { |
38 | | - $sub_params = self::getSubParams( $param ); |
39 | | - $next_result = self::getQueryResultFromFunctionParams( $sub_params, SMW_OUTPUT_WIKI ); |
40 | | - |
41 | | - $results = self::mergeSMWQueryResults( $results, $next_result->getResults() ); |
42 | | - } else { |
43 | | - $parts = explode( '=', $param, 2 ); |
44 | | - |
45 | | - if ( count( $parts ) >= 2 ) { |
46 | | - $other_params[strtolower( trim( $parts[0] ) )] = $parts[1]; // don't trim here, some params care for " " |
47 | | - } |
| 24 | + if ( !$smwgQEnabled ) { |
| 25 | + return smwfEncodeMessages( array( wfMsgForContent( 'smw_iq_disabled' ) ) ); |
| 26 | + } |
| 27 | + |
| 28 | + $smwgIQRunningNumber++; |
| 29 | + |
| 30 | + $params = func_get_args(); |
| 31 | + array_shift( $params ); // We already know the $parser. |
| 32 | + |
| 33 | + $other_params = array(); |
| 34 | + $results = array(); |
| 35 | + |
| 36 | + foreach ( $params as $param ) { |
| 37 | + // Very primitive heuristic - if the parameter |
| 38 | + // includes a square bracket, then it's a |
| 39 | + // sub-query; otherwise it's a regular parameter. |
| 40 | + if ( strpos( $param, '[' ) !== false ) { |
| 41 | + $sub_params = self::getSubParams( $param ); |
| 42 | + $next_result = self::getQueryResultFromFunctionParams( $sub_params, SMW_OUTPUT_WIKI ); |
| 43 | + |
| 44 | + $results = self::mergeSMWQueryResults( $results, $next_result->getResults() ); |
| 45 | + } else { |
| 46 | + $parts = explode( '=', $param, 2 ); |
| 47 | + |
| 48 | + if ( count( $parts ) >= 2 ) { |
| 49 | + $other_params[strtolower( trim( $parts[0] ) )] = $parts[1]; // don't trim here, some params care for " " |
48 | 50 | } |
49 | 51 | } |
50 | | - |
51 | | - $query_result = new SCQQueryResult( $next_result->getPrintRequests(), new SMWQuery(), $results, smwfGetStore() ); |
52 | | - $result = self::getResultFromQueryResult( $query_result, $other_params, SMW_OUTPUT_WIKI ); |
53 | | - } else { |
54 | | - $result = smwfEncodeMessages( array( wfMsgForContent( 'smw_iq_disabled' ) ) ); |
55 | 52 | } |
56 | | - |
57 | | - return $result; |
| 53 | + |
| 54 | + $query_result = new SCQQueryResult( $next_result->getPrintRequests(), new SMWQuery(), $results, smwfGetStore() ); |
| 55 | + return self::getResultFromQueryResult( $query_result, $other_params, SMW_OUTPUT_WIKI ); |
58 | 56 | } |
59 | 57 | |
60 | 58 | /** |