@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @codeCoverageIgnore |
63 | 63 | * @see ApiBase::getDescription |
64 | 64 | * |
65 | - * @return array |
|
65 | + * @return string[] |
|
66 | 66 | */ |
67 | 67 | public function getDescription() { |
68 | 68 | return array( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @codeCoverageIgnore |
75 | 75 | * @see ApiBase::getExamples |
76 | 76 | * |
77 | - * @return array |
|
77 | + * @return string[] |
|
78 | 78 | */ |
79 | 79 | protected function getExamples() { |
80 | 80 | return array( |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | * @see ApiBase::execute |
22 | 22 | */ |
23 | 23 | public function execute() { |
24 | - $parameterFormatter = new ApiRequestParameterFormatter( $this->extractRequestParams() ); |
|
24 | + $parameterFormatter = new ApiRequestParameterFormatter($this->extractRequestParams()); |
|
25 | 25 | $parameters = $parameterFormatter->getAskApiParameters(); |
26 | 26 | |
27 | - list( $queryParams, $otherParams ) = CompoundQueryProcessor::separateParams( $parameters ); |
|
28 | - list( $queryResult ) = CompoundQueryProcessor::queryAndMergeResults( $queryParams, $otherParams ); |
|
27 | + list($queryParams, $otherParams) = CompoundQueryProcessor::separateParams($parameters); |
|
28 | + list($queryResult) = CompoundQueryProcessor::queryAndMergeResults($queryParams, $otherParams); |
|
29 | 29 | |
30 | 30 | $outputFormat = 'json'; |
31 | - if ( $this->getMain()->getPrinter() instanceof \ApiFormatXml ) { |
|
31 | + if ($this->getMain()->getPrinter() instanceof \ApiFormatXml) { |
|
32 | 32 | $outputFormat = 'xml'; |
33 | 33 | } |
34 | 34 | |
35 | - $this->addQueryResult( $queryResult, $outputFormat ); |
|
35 | + $this->addQueryResult($queryResult, $outputFormat); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | */ |
83 | 83 | protected function getExamples() { |
84 | 84 | return array( |
85 | - 'api.php?action=compoundquery&query=' . urlencode( '[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates' ), |
|
86 | - 'api.php?action=compoundquery&query=' . urlencode( '|[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates' ), |
|
85 | + 'api.php?action=compoundquery&query=' . urlencode('[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates'), |
|
86 | + 'api.php?action=compoundquery&query=' . urlencode('|[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates'), |
|
87 | 87 | ); |
88 | 88 | } |
89 | 89 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @param string $param |
134 | 134 | * |
135 | - * @return array |
|
135 | + * @return string[] |
|
136 | 136 | */ |
137 | 137 | protected static function getSubParams( $param ) { |
138 | 138 | $sub_params = array(); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @param $context |
169 | 169 | * @param $showmode |
170 | 170 | * |
171 | - * @return SMWQueryResult |
|
171 | + * @return \SMWQueryResult |
|
172 | 172 | */ |
173 | 173 | protected static function getQueryResultFromFunctionParams( $rawparams, $context = QueryProcessor::INLINE_QUERY, $showmode = false ) { |
174 | 174 | $printouts = array(); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * Combine two arrays of SMWWikiPageValue objects into one |
181 | 181 | * |
182 | 182 | * @param array $result1 |
183 | - * @param array $result2 |
|
183 | + * @param \SMWDIWikiPage[] $result2 |
|
184 | 184 | * |
185 | 185 | * @return array |
186 | 186 | */ |
@@ -204,6 +204,9 @@ discard block |
||
204 | 204 | return $result1; |
205 | 205 | } |
206 | 206 | |
207 | + /** |
|
208 | + * @param \SMW\Query\PrintRequest[] $printRequests2 |
|
209 | + */ |
|
207 | 210 | protected static function mergeSMWPrintRequests( $printRequests1, $printRequests2 ) { |
208 | 211 | $existingPrintoutLabels = array(); |
209 | 212 | foreach ( $printRequests1 as $p1 ) { |
@@ -220,13 +223,13 @@ discard block |
||
220 | 223 | } |
221 | 224 | |
222 | 225 | /** |
223 | - * @param $querystring |
|
226 | + * @param string $querystring |
|
224 | 227 | * @param array $params |
225 | 228 | * @param $extraPrintouts |
226 | 229 | * @param $outputMode |
227 | 230 | * @param $context |
228 | 231 | * |
229 | - * @return SMWQueryResult |
|
232 | + * @return \SMWQueryResult |
|
230 | 233 | */ |
231 | 234 | protected static function getQueryResultFromQueryString( $querystring, array $params, $extraPrintouts, $context = QueryProcessor::INLINE_QUERY ) { |
232 | 235 | |
@@ -262,7 +265,7 @@ discard block |
||
262 | 265 | * |
263 | 266 | * @param CompoundQueryResult $res |
264 | 267 | * @param array $params These need to be the result of a list fed to getProcessedParams as of SMW 1.6.2 |
265 | - * @param $outputmode |
|
268 | + * @param integer $outputmode |
|
266 | 269 | * @param $context |
267 | 270 | * @param string $format |
268 | 271 | * |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Comparison helper function, used in sorting results. |
23 | 23 | */ |
24 | - public static function compareQueryResults( $a, $b ) { |
|
24 | + public static function compareQueryResults($a, $b) { |
|
25 | 25 | |
26 | - if ( $a->getSerialization() == $b->getSerialization() ) { |
|
26 | + if ($a->getSerialization() == $b->getSerialization()) { |
|
27 | 27 | return 0; |
28 | 28 | } |
29 | 29 | |
30 | - return ( $a->getSerialization() < $b->getSerialization() ) ? -1 : 1; |
|
30 | + return ($a->getSerialization() < $b->getSerialization()) ? -1 : 1; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,20 +37,20 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return string |
39 | 39 | */ |
40 | - public static function doCompoundQuery( Parser &$parser ) { |
|
40 | + public static function doCompoundQuery(Parser&$parser) { |
|
41 | 41 | global $smwgQEnabled, $smwgIQRunningNumber; |
42 | 42 | |
43 | - if ( !$smwgQEnabled ) { |
|
44 | - return smwfEncodeMessages( array( wfMessage( 'smw_iq_disabled' )->inContentLanguage()->text() ) ); |
|
43 | + if (!$smwgQEnabled) { |
|
44 | + return smwfEncodeMessages(array(wfMessage('smw_iq_disabled')->inContentLanguage()->text())); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $smwgIQRunningNumber++; |
48 | 48 | |
49 | 49 | $params = func_get_args(); |
50 | - array_shift( $params ); // We already know the $parser. |
|
50 | + array_shift($params); // We already know the $parser. |
|
51 | 51 | |
52 | - list( $queryParams, $otherParams ) = self::separateParams( $params ); |
|
53 | - list( $queryResult, $otherParams ) = self::queryAndMergeResults( $queryParams, $otherParams ); |
|
52 | + list($queryParams, $otherParams) = self::separateParams($params); |
|
53 | + list($queryResult, $otherParams) = self::queryAndMergeResults($queryParams, $otherParams); |
|
54 | 54 | |
55 | 55 | return self::getResultFromQueryResult( |
56 | 56 | $queryResult, |
@@ -65,25 +65,25 @@ discard block |
||
65 | 65 | * @param $params |
66 | 66 | * @return array |
67 | 67 | */ |
68 | - public static function separateParams( $params ) { |
|
68 | + public static function separateParams($params) { |
|
69 | 69 | $queryParams = array(); |
70 | 70 | $otherParams = array(); |
71 | 71 | |
72 | - foreach ( $params as $param ) { |
|
72 | + foreach ($params as $param) { |
|
73 | 73 | // Very primitive heuristic - if the parameter |
74 | 74 | // includes a square bracket, then it's a |
75 | 75 | // sub-query; otherwise it's a regular parameter. |
76 | - if ( strpos( $param, '[' ) !== false ) { |
|
76 | + if (strpos($param, '[') !== false) { |
|
77 | 77 | $queryParams[] = $param; |
78 | 78 | } else { |
79 | - $parts = explode( '=', $param, 2 ); |
|
79 | + $parts = explode('=', $param, 2); |
|
80 | 80 | |
81 | - if ( count( $parts ) >= 2 ) { |
|
82 | - $otherParams[strtolower( trim( $parts[0] ) )] = $parts[1]; // don't trim here, some params care for " " |
|
81 | + if (count($parts) >= 2) { |
|
82 | + $otherParams[strtolower(trim($parts[0]))] = $parts[1]; // don't trim here, some params care for " " |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
86 | - return array( $queryParams, $otherParams ); |
|
86 | + return array($queryParams, $otherParams); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -93,36 +93,36 @@ discard block |
||
93 | 93 | * @param $otherParams |
94 | 94 | * @return array |
95 | 95 | */ |
96 | - public static function queryAndMergeResults( $queryParams, $otherParams ) { |
|
96 | + public static function queryAndMergeResults($queryParams, $otherParams) { |
|
97 | 97 | $results = array(); |
98 | 98 | $printRequests = array(); |
99 | 99 | |
100 | - foreach ( $queryParams as $param ) { |
|
101 | - $subQueryParams = self::getSubParams( $param ); |
|
100 | + foreach ($queryParams as $param) { |
|
101 | + $subQueryParams = self::getSubParams($param); |
|
102 | 102 | |
103 | - if ( array_key_exists( 'format', $otherParams ) && !array_key_exists( 'format', $subQueryParams ) ) { |
|
103 | + if (array_key_exists('format', $otherParams) && !array_key_exists('format', $subQueryParams)) { |
|
104 | 104 | $subQueryParams['format'] = $otherParams['format']; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $nextResult = self::getQueryResultFromFunctionParams($subQueryParams); |
108 | 108 | |
109 | - $results = self::mergeSMWQueryResults( $results, $nextResult->getResults() ); |
|
110 | - $printRequests = self::mergeSMWPrintRequests( $printRequests, $nextResult->getPrintRequests() ); |
|
109 | + $results = self::mergeSMWQueryResults($results, $nextResult->getResults()); |
|
110 | + $printRequests = self::mergeSMWPrintRequests($printRequests, $nextResult->getPrintRequests()); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // Sort results so that they'll show up by page name |
114 | - if( !isset($otherParams['unsorted']) || !strcmp( $otherParams['unsorted'], 'on' ) ) { |
|
115 | - uasort( $results, array( '\SCQ\CompoundQueryProcessor', 'compareQueryResults' ) ); |
|
114 | + if (!isset($otherParams['unsorted']) || !strcmp($otherParams['unsorted'], 'on')) { |
|
115 | + uasort($results, array('\SCQ\CompoundQueryProcessor', 'compareQueryResults')); |
|
116 | 116 | } |
117 | 117 | |
118 | - $queryResult = new CompoundQueryResult( $printRequests, new Query(), $results, smwfGetStore() ); |
|
118 | + $queryResult = new CompoundQueryResult($printRequests, new Query(), $results, smwfGetStore()); |
|
119 | 119 | |
120 | - if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { |
|
121 | - self::addThisPrintout( $printRequests, $otherParams ); |
|
122 | - $otherParams = self::getProcessedParams( $otherParams, $printRequests ); |
|
120 | + if (version_compare(SMW_VERSION, '1.6.1', '>')) { |
|
121 | + self::addThisPrintout($printRequests, $otherParams); |
|
122 | + $otherParams = self::getProcessedParams($otherParams, $printRequests); |
|
123 | 123 | } |
124 | 124 | |
125 | - return array( $queryResult, $otherParams ); |
|
125 | + return array($queryResult, $otherParams); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -134,31 +134,31 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return array |
136 | 136 | */ |
137 | - protected static function getSubParams( $param ) { |
|
137 | + protected static function getSubParams($param) { |
|
138 | 138 | $sub_params = array(); |
139 | 139 | $sub_param = ''; |
140 | 140 | $uncompleted_square_brackets = 0; |
141 | 141 | |
142 | - for ( $i = 0; $i < strlen( $param ); $i++ ) { |
|
142 | + for ($i = 0; $i < strlen($param); $i++) { |
|
143 | 143 | $c = $param[$i]; |
144 | 144 | |
145 | - if ( ( $c == ';' ) && ( $uncompleted_square_brackets <= 0 ) ) { |
|
146 | - $sub_params[] = trim( $sub_param ); |
|
145 | + if (($c == ';') && ($uncompleted_square_brackets <= 0)) { |
|
146 | + $sub_params[] = trim($sub_param); |
|
147 | 147 | $sub_param = ''; |
148 | 148 | } else { |
149 | 149 | $sub_param .= $c; |
150 | 150 | |
151 | - if ( $c == '[' ) { |
|
151 | + if ($c == '[') { |
|
152 | 152 | $uncompleted_square_brackets++; |
153 | 153 | } |
154 | 154 | |
155 | - elseif ( $c == ']' ) { |
|
155 | + elseif ($c == ']') { |
|
156 | 156 | $uncompleted_square_brackets--; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - $sub_params[] = trim( $sub_param ); |
|
161 | + $sub_params[] = trim($sub_param); |
|
162 | 162 | |
163 | 163 | return $sub_params; |
164 | 164 | } |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return SMWQueryResult |
172 | 172 | */ |
173 | - protected static function getQueryResultFromFunctionParams( $rawparams, $context = QueryProcessor::INLINE_QUERY, $showmode = false ) { |
|
173 | + protected static function getQueryResultFromFunctionParams($rawparams, $context = QueryProcessor::INLINE_QUERY, $showmode = false) { |
|
174 | 174 | $printouts = array(); |
175 | - self::processFunctionParams( $rawparams, $querystring, $params, $printouts, $showmode ); |
|
176 | - return self::getQueryResultFromQueryString( $querystring, $params, $printouts, $context ); |
|
175 | + self::processFunctionParams($rawparams, $querystring, $params, $printouts, $showmode); |
|
176 | + return self::getQueryResultFromQueryString($querystring, $params, $printouts, $context); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -184,19 +184,19 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @return array |
186 | 186 | */ |
187 | - protected static function mergeSMWQueryResults( $result1, $result2 ) { |
|
188 | - if ( $result1 == null ) { |
|
187 | + protected static function mergeSMWQueryResults($result1, $result2) { |
|
188 | + if ($result1 == null) { |
|
189 | 189 | return $result2; |
190 | 190 | } |
191 | 191 | |
192 | 192 | $existing_page_names = array(); |
193 | - foreach ( $result1 as $r1 ) { |
|
193 | + foreach ($result1 as $r1) { |
|
194 | 194 | $existing_page_names[] = $r1->getSerialization(); |
195 | 195 | } |
196 | 196 | |
197 | - foreach ( $result2 as $r2 ) { |
|
197 | + foreach ($result2 as $r2) { |
|
198 | 198 | $page_name = $r2->getSerialization(); |
199 | - if ( ! in_array( $page_name, $existing_page_names ) ) { |
|
199 | + if (!in_array($page_name, $existing_page_names)) { |
|
200 | 200 | $result1[] = $r2; |
201 | 201 | } |
202 | 202 | } |
@@ -204,15 +204,15 @@ discard block |
||
204 | 204 | return $result1; |
205 | 205 | } |
206 | 206 | |
207 | - protected static function mergeSMWPrintRequests( $printRequests1, $printRequests2 ) { |
|
207 | + protected static function mergeSMWPrintRequests($printRequests1, $printRequests2) { |
|
208 | 208 | $existingPrintoutLabels = array(); |
209 | - foreach ( $printRequests1 as $p1 ) { |
|
209 | + foreach ($printRequests1 as $p1) { |
|
210 | 210 | $existingPrintoutLabels[] = $p1->getLabel(); |
211 | 211 | } |
212 | 212 | |
213 | - foreach ( $printRequests2 as $p2 ) { |
|
213 | + foreach ($printRequests2 as $p2) { |
|
214 | 214 | $label = $p2->getLabel(); |
215 | - if ( ! in_array( $label, $existingPrintoutLabels ) ) { |
|
215 | + if (!in_array($label, $existingPrintoutLabels)) { |
|
216 | 216 | $printRequests1[] = $p2; |
217 | 217 | } |
218 | 218 | } |
@@ -228,20 +228,20 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @return SMWQueryResult |
230 | 230 | */ |
231 | - protected static function getQueryResultFromQueryString( $querystring, array $params, $extraPrintouts, $context = QueryProcessor::INLINE_QUERY ) { |
|
231 | + protected static function getQueryResultFromQueryString($querystring, array $params, $extraPrintouts, $context = QueryProcessor::INLINE_QUERY) { |
|
232 | 232 | |
233 | - if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { |
|
234 | - QueryProcessor::addThisPrintout( $extraPrintouts, $params ); |
|
235 | - $params = self::getProcessedParams( $params, $extraPrintouts, false ); |
|
233 | + if (version_compare(SMW_VERSION, '1.6.1', '>')) { |
|
234 | + QueryProcessor::addThisPrintout($extraPrintouts, $params); |
|
235 | + $params = self::getProcessedParams($params, $extraPrintouts, false); |
|
236 | 236 | } |
237 | 237 | |
238 | - $query = self::createQuery( $querystring, $params, $context, null, $extraPrintouts ); |
|
239 | - $queryResult = smwfGetStore()->getQueryResult( $query ); |
|
238 | + $query = self::createQuery($querystring, $params, $context, null, $extraPrintouts); |
|
239 | + $queryResult = smwfGetStore()->getQueryResult($query); |
|
240 | 240 | |
241 | 241 | $parameters = array(); |
242 | 242 | |
243 | - if ( version_compare( SMW_VERSION, '1.7.2', '>' ) ) { |
|
244 | - foreach ( $params as $param ) { |
|
243 | + if (version_compare(SMW_VERSION, '1.7.2', '>')) { |
|
244 | + foreach ($params as $param) { |
|
245 | 245 | $parameters[$param->getName()] = $param->getValue(); |
246 | 246 | } |
247 | 247 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $parameters = $params; |
250 | 250 | } |
251 | 251 | |
252 | - foreach ( $queryResult->getResults() as $wikiPage ) { |
|
252 | + foreach ($queryResult->getResults() as $wikiPage) { |
|
253 | 253 | $wikiPage->display_options = $parameters; |
254 | 254 | } |
255 | 255 | |
@@ -268,20 +268,20 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return string |
270 | 270 | */ |
271 | - protected static function getResultFromQueryResult( CompoundQueryResult $res, array $params, $outputmode, $context = QueryProcessor::INLINE_QUERY, $format = '' ) { |
|
271 | + protected static function getResultFromQueryResult(CompoundQueryResult $res, array $params, $outputmode, $context = QueryProcessor::INLINE_QUERY, $format = '') { |
|
272 | 272 | |
273 | - if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { |
|
273 | + if (version_compare(SMW_VERSION, '1.6.1', '>')) { |
|
274 | 274 | $format = $params['format']; |
275 | 275 | |
276 | - if ( version_compare( SMW_VERSION, '1.7.2', '>' ) ) { |
|
276 | + if (version_compare(SMW_VERSION, '1.7.2', '>')) { |
|
277 | 277 | $format = $format->getValue(); |
278 | 278 | } |
279 | 279 | } else { |
280 | - $format = self::getResultFormat( $params ); |
|
280 | + $format = self::getResultFormat($params); |
|
281 | 281 | } |
282 | 282 | |
283 | - $printer = self::getResultPrinter( $format, $context ); |
|
284 | - $result = $printer->getResult( $res, $params, $outputmode ); |
|
283 | + $printer = self::getResultPrinter($format, $context); |
|
284 | + $result = $printer->getResult($res, $params, $outputmode); |
|
285 | 285 | |
286 | 286 | return $result; |
287 | 287 | } |
@@ -144,9 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | if ( $c == '[' ) { |
146 | 146 | $uncompleted_square_brackets++; |
147 | - } |
|
148 | - |
|
149 | - elseif ( $c == ']' ) { |
|
147 | + } elseif ( $c == ']' ) { |
|
150 | 148 | $uncompleted_square_brackets--; |
151 | 149 | } |
152 | 150 | } |
@@ -240,8 +238,7 @@ discard block |
||
240 | 238 | foreach ( $params as $param ) { |
241 | 239 | $parameters[$param->getName()] = $param->getValue(); |
242 | 240 | } |
243 | - } |
|
244 | - else { |
|
241 | + } else { |
|
245 | 242 | $parameters = $params; |
246 | 243 | } |
247 | 244 |
@@ -23,29 +23,29 @@ |
||
23 | 23 | * |
24 | 24 | * @param QueryResult $newResult |
25 | 25 | */ |
26 | - public function addResult( QueryResult $newResult ) { |
|
26 | + public function addResult(QueryResult $newResult) { |
|
27 | 27 | $existingPageNames = array(); |
28 | 28 | |
29 | - while ( $row = $this->getNext() ) { |
|
30 | - if ( $row[0] instanceof ResultArray ) { |
|
29 | + while ($row = $this->getNext()) { |
|
30 | + if ($row[0] instanceof ResultArray) { |
|
31 | 31 | $content = $row[0]->getContent(); |
32 | - $existingPageNames[] = $content[0]->getLongText( SMW_OUTPUT_WIKI ); |
|
32 | + $existingPageNames[] = $content[0]->getLongText(SMW_OUTPUT_WIKI); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | - while ( ( $row = $newResult->getNext() ) !== false ) { |
|
37 | - if ( property_exists( $newResult, 'display_options' ) ) { |
|
36 | + while (($row = $newResult->getNext()) !== false) { |
|
37 | + if (property_exists($newResult, 'display_options')) { |
|
38 | 38 | $row[0]->display_options = $newResult->display_options; |
39 | 39 | } |
40 | 40 | $content = $row[0]->getContent(); |
41 | - $pageName = $content[0]->getLongText( SMW_OUTPUT_WIKI ); |
|
41 | + $pageName = $content[0]->getLongText(SMW_OUTPUT_WIKI); |
|
42 | 42 | |
43 | - if ( !in_array( $pageName, $existingPageNames ) ) { |
|
43 | + if (!in_array($pageName, $existingPageNames)) { |
|
44 | 44 | $this->m_content[] = $row; |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - reset( $this->m_content ); |
|
48 | + reset($this->m_content); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | } |
@@ -7,70 +7,70 @@ |
||
7 | 7 | |
8 | 8 | /** English (English) */ |
9 | 9 | $magicWords['en'] = array( |
10 | - 'compound_query' => array( 0, 'compound_query' ), |
|
10 | + 'compound_query' => array(0, 'compound_query'), |
|
11 | 11 | ); |
12 | 12 | |
13 | 13 | /** Arabic (العربية) */ |
14 | 14 | $magicWords['ar'] = array( |
15 | - 'compound_query' => array( 0, 'استعلام_مركب' ), |
|
15 | + 'compound_query' => array(0, 'استعلام_مركب'), |
|
16 | 16 | ); |
17 | 17 | |
18 | 18 | /** Egyptian Arabic (مصرى) */ |
19 | 19 | $magicWords['arz'] = array( |
20 | - 'compound_query' => array( 0, 'استعلام_مركب' ), |
|
20 | + 'compound_query' => array(0, 'استعلام_مركب'), |
|
21 | 21 | ); |
22 | 22 | |
23 | 23 | /** Chuvash (Чӑвашла) */ |
24 | 24 | $magicWords['cv'] = array( |
25 | - 'compound_query' => array( 0, 'compound_query' ), |
|
25 | + 'compound_query' => array(0, 'compound_query'), |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | /** German (Deutsch) */ |
29 | 29 | $magicWords['de'] = array( |
30 | - 'compound_query' => array( 0, 'abfrage_zusammen', 'frage_zusammen' ), |
|
30 | + 'compound_query' => array(0, 'abfrage_zusammen', 'frage_zusammen'), |
|
31 | 31 | ); |
32 | 32 | |
33 | 33 | /** Japanese (日本語) */ |
34 | 34 | $magicWords['ja'] = array( |
35 | - 'compound_query' => array( 0, '複合クエリ', '複合クエリー' ), |
|
35 | + 'compound_query' => array(0, '複合クエリ', '複合クエリー'), |
|
36 | 36 | ); |
37 | 37 | |
38 | 38 | /** Korean (한국어) */ |
39 | 39 | $magicWords['ko'] = array( |
40 | - 'compound_query' => array( 0, '복합_쿼리' ), |
|
40 | + 'compound_query' => array(0, '복합_쿼리'), |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | /** Macedonian (македонски) */ |
44 | 44 | $magicWords['mk'] = array( |
45 | - 'compound_query' => array( 0, 'мешовито_барање' ), |
|
45 | + 'compound_query' => array(0, 'мешовито_барање'), |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | /** Low Saxon (Netherlands) (Nedersaksies) */ |
49 | 49 | $magicWords['nds-nl'] = array( |
50 | - 'compound_query' => array( 0, 'samenestelden_zeukopdrachte', 'samengestelde_zoekopdracht' ), |
|
50 | + 'compound_query' => array(0, 'samenestelden_zeukopdrachte', 'samengestelde_zoekopdracht'), |
|
51 | 51 | ); |
52 | 52 | |
53 | 53 | /** Dutch (Nederlands) */ |
54 | 54 | $magicWords['nl'] = array( |
55 | - 'compound_query' => array( 0, 'samengestelde_zoekopdracht' ), |
|
55 | + 'compound_query' => array(0, 'samengestelde_zoekopdracht'), |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | /** Brazilian Portuguese (português do Brasil) */ |
59 | 59 | $magicWords['pt-br'] = array( |
60 | - 'compound_query' => array( 0, 'consulta_composta' ), |
|
60 | + 'compound_query' => array(0, 'consulta_composta'), |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | /** Serbian (Latin script) (srpski (latinica)) */ |
64 | 64 | $magicWords['sr-el'] = array( |
65 | - 'compound_query' => array( 0, 'sastavi_upit' ), |
|
65 | + 'compound_query' => array(0, 'sastavi_upit'), |
|
66 | 66 | ); |
67 | 67 | |
68 | 68 | /** Simplified Chinese (中文(简体)) */ |
69 | 69 | $magicWords['zh-hans'] = array( |
70 | - 'compound_query' => array( 0, '组合查询' ), |
|
70 | + 'compound_query' => array(0, '组合查询'), |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | /** Traditional Chinese (中文(繁體)) */ |
74 | 74 | $magicWords['zh-hant'] = array( |
75 | - 'compound_query' => array( 0, '組合搜尋' ), |
|
75 | + 'compound_query' => array(0, '組合搜尋'), |
|
76 | 76 | ); |
77 | 77 | \ No newline at end of file |
@@ -5,11 +5,11 @@ discard block |
||
5 | 5 | * |
6 | 6 | * @defgroup SemanticCompoundQueries SemanticCompoundQueries |
7 | 7 | */ |
8 | -if ( !defined( 'MEDIAWIKI' ) ) { |
|
9 | - die( 'This file is part of the SemanticCompoundQueries extension, it is not a valid entry point.' ); |
|
8 | +if (!defined('MEDIAWIKI')) { |
|
9 | + die('This file is part of the SemanticCompoundQueries extension, it is not a valid entry point.'); |
|
10 | 10 | } |
11 | 11 | |
12 | -if ( defined( 'SCQ_VERSION' ) ) { |
|
12 | +if (defined('SCQ_VERSION')) { |
|
13 | 13 | // Do not initialize more than once. |
14 | 14 | return 1; |
15 | 15 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function load() { |
32 | 32 | |
33 | - if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { |
|
33 | + if (is_readable(__DIR__ . '/vendor/autoload.php')) { |
|
34 | 34 | include_once __DIR__ . '/vendor/autoload.php'; |
35 | 35 | } |
36 | 36 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public static function initExtension() { |
58 | 58 | |
59 | - define( 'SCQ_VERSION', '1.1.0-alpha' ); |
|
59 | + define('SCQ_VERSION', '1.1.0-alpha'); |
|
60 | 60 | |
61 | 61 | // Register the extension |
62 | 62 | $GLOBALS['wgExtensionCredits']['semantic'][] = array( |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function checkRequirements() { |
88 | 88 | |
89 | - if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.13', 'lt' ) ) { |
|
90 | - die( '<b>Error:</b> This version of <a href="https://github.com/SemanticMediaWiki/SemanticCompoundQueries/">Semantic Compound Queries</a> is only compatible with MediaWiki 1.13 or above. You need to upgrade MediaWiki first.' ); |
|
89 | + if (version_compare($GLOBALS['wgVersion'], '1.13', 'lt')) { |
|
90 | + die('<b>Error:</b> This version of <a href="https://github.com/SemanticMediaWiki/SemanticCompoundQueries/">Semantic Compound Queries</a> is only compatible with MediaWiki 1.13 or above. You need to upgrade MediaWiki first.'); |
|
91 | 91 | } |
92 | 92 | |
93 | - if ( !defined( 'SMW_VERSION' ) ) { |
|
94 | - die( '<b>Error:</b> <a href="https://github.com/SemanticMediaWiki/SemanticCompoundQueries/">Semantic Compound Queries</a> requires the <a href="https://github.com/SemanticMediaWiki/SemanticMediaWiki/">Semantic MediaWiki</a> extension, please enable or install the extension first.' ); |
|
93 | + if (!defined('SMW_VERSION')) { |
|
94 | + die('<b>Error:</b> <a href="https://github.com/SemanticMediaWiki/SemanticCompoundQueries/">Semantic Compound Queries</a> requires the <a href="https://github.com/SemanticMediaWiki/SemanticMediaWiki/">Semantic MediaWiki</a> extension, please enable or install the extension first.'); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | // wgAPIModules |
109 | 109 | $GLOBALS['wgAPIModules']['compoundquery'] = 'SCQ\Api\CompoundQuery'; |
110 | 110 | |
111 | - $GLOBALS['wgHooks']['ParserFirstCallInit'][] = function( Parser &$parser ) { |
|
112 | - $parser->setFunctionHook( 'compound_query', array( '\SCQ\CompoundQueryProcessor', 'doCompoundQuery' ) ); |
|
111 | + $GLOBALS['wgHooks']['ParserFirstCallInit'][] = function(Parser&$parser) { |
|
112 | + $parser->setFunctionHook('compound_query', array('\SCQ\CompoundQueryProcessor', 'doCompoundQuery')); |
|
113 | 113 | |
114 | 114 | // always return true, in order not to stop MW's hook processing! |
115 | 115 | return true; |