@@ -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 | |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * Comparison helper function, used in sorting results. |
| 24 | 24 | */ |
| 25 | - public static function compareQueryResults( $a, $b ) { |
|
| 25 | + public static function compareQueryResults($a, $b) { |
|
| 26 | 26 | |
| 27 | - if ( $a->getSerialization() == $b->getSerialization() ) { |
|
| 27 | + if ($a->getSerialization() == $b->getSerialization()) { |
|
| 28 | 28 | return 0; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - return ( $a->getSerialization() < $b->getSerialization() ) ? -1 : 1; |
|
| 31 | + return ($a->getSerialization() < $b->getSerialization()) ? -1 : 1; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -38,20 +38,20 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - public static function doCompoundQuery( Parser &$parser ) { |
|
| 41 | + public static function doCompoundQuery(Parser&$parser) { |
|
| 42 | 42 | global $smwgQEnabled, $smwgIQRunningNumber; |
| 43 | 43 | |
| 44 | - if ( !$smwgQEnabled ) { |
|
| 45 | - return smwfEncodeMessages( [ wfMessage( 'smw_iq_disabled' )->inContentLanguage()->text() ] ); |
|
| 44 | + if (!$smwgQEnabled) { |
|
| 45 | + return smwfEncodeMessages([wfMessage('smw_iq_disabled')->inContentLanguage()->text()]); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $smwgIQRunningNumber++; |
| 49 | 49 | |
| 50 | 50 | $params = func_get_args(); |
| 51 | - array_shift( $params ); // We already know the $parser. |
|
| 51 | + array_shift($params); // We already know the $parser. |
|
| 52 | 52 | |
| 53 | - list( $queryParams, $otherParams ) = self::separateParams( $params ); |
|
| 54 | - list( $queryResult, $otherParams ) = self::queryAndMergeResults( $queryParams, $otherParams ); |
|
| 53 | + list($queryParams, $otherParams) = self::separateParams($params); |
|
| 54 | + list($queryResult, $otherParams) = self::queryAndMergeResults($queryParams, $otherParams); |
|
| 55 | 55 | |
| 56 | 56 | return self::getResultFromQueryResult( |
| 57 | 57 | $queryResult, |
@@ -66,25 +66,25 @@ discard block |
||
| 66 | 66 | * @param $params |
| 67 | 67 | * @return array |
| 68 | 68 | */ |
| 69 | - public static function separateParams( $params ) { |
|
| 69 | + public static function separateParams($params) { |
|
| 70 | 70 | $queryParams = []; |
| 71 | 71 | $otherParams = []; |
| 72 | 72 | |
| 73 | - foreach ( $params as $param ) { |
|
| 73 | + foreach ($params as $param) { |
|
| 74 | 74 | // Very primitive heuristic - if the parameter |
| 75 | 75 | // includes a square bracket, then it's a |
| 76 | 76 | // sub-query; otherwise it's a regular parameter. |
| 77 | - if ( strpos( $param, '[' ) !== false ) { |
|
| 77 | + if (strpos($param, '[') !== false) { |
|
| 78 | 78 | $queryParams[] = $param; |
| 79 | 79 | } else { |
| 80 | - $parts = explode( '=', $param, 2 ); |
|
| 80 | + $parts = explode('=', $param, 2); |
|
| 81 | 81 | |
| 82 | - if ( count( $parts ) >= 2 ) { |
|
| 83 | - $otherParams[strtolower( trim( $parts[0] ) )] = $parts[1]; // don't trim here, some params care for " " |
|
| 82 | + if (count($parts) >= 2) { |
|
| 83 | + $otherParams[strtolower(trim($parts[0]))] = $parts[1]; // don't trim here, some params care for " " |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | - return [ $queryParams, $otherParams ]; |
|
| 87 | + return [$queryParams, $otherParams]; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -94,36 +94,36 @@ discard block |
||
| 94 | 94 | * @param $otherParams |
| 95 | 95 | * @return array |
| 96 | 96 | */ |
| 97 | - public static function queryAndMergeResults( $queryParams, $otherParams ) { |
|
| 97 | + public static function queryAndMergeResults($queryParams, $otherParams) { |
|
| 98 | 98 | $results = []; |
| 99 | 99 | $printRequests = []; |
| 100 | 100 | |
| 101 | - foreach ( $queryParams as $param ) { |
|
| 102 | - $subQueryParams = self::getSubParams( $param ); |
|
| 101 | + foreach ($queryParams as $param) { |
|
| 102 | + $subQueryParams = self::getSubParams($param); |
|
| 103 | 103 | |
| 104 | - if ( array_key_exists( 'format', $otherParams ) && !array_key_exists( 'format', $subQueryParams ) ) { |
|
| 104 | + if (array_key_exists('format', $otherParams) && !array_key_exists('format', $subQueryParams)) { |
|
| 105 | 105 | $subQueryParams['format'] = $otherParams['format']; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $nextResult = self::getQueryResultFromFunctionParams($subQueryParams); |
| 109 | 109 | |
| 110 | - $results = self::mergeSMWQueryResults( $results, $nextResult->getResults() ); |
|
| 111 | - $printRequests = self::mergeSMWPrintRequests( $printRequests, $nextResult->getPrintRequests() ); |
|
| 110 | + $results = self::mergeSMWQueryResults($results, $nextResult->getResults()); |
|
| 111 | + $printRequests = self::mergeSMWPrintRequests($printRequests, $nextResult->getPrintRequests()); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // Sort results so that they'll show up by page name |
| 115 | - if( !isset($otherParams['unsorted']) || !strcmp( $otherParams['unsorted'], 'on' ) ) { |
|
| 116 | - uasort( $results, [ '\SCQ\CompoundQueryProcessor', 'compareQueryResults' ] ); |
|
| 115 | + if (!isset($otherParams['unsorted']) || !strcmp($otherParams['unsorted'], 'on')) { |
|
| 116 | + uasort($results, ['\SCQ\CompoundQueryProcessor', 'compareQueryResults']); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $queryResult = new CompoundQueryResult( $printRequests, new Query(), $results, smwfGetStore() ); |
|
| 119 | + $queryResult = new CompoundQueryResult($printRequests, new Query(), $results, smwfGetStore()); |
|
| 120 | 120 | |
| 121 | - if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { |
|
| 122 | - self::addThisPrintout( $printRequests, $otherParams ); |
|
| 123 | - $otherParams = self::getProcessedParams( $otherParams, $printRequests ); |
|
| 121 | + if (version_compare(SMW_VERSION, '1.6.1', '>')) { |
|
| 122 | + self::addThisPrintout($printRequests, $otherParams); |
|
| 123 | + $otherParams = self::getProcessedParams($otherParams, $printRequests); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - return [ $queryResult, $otherParams ]; |
|
| 126 | + return [$queryResult, $otherParams]; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -135,31 +135,31 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @return array |
| 137 | 137 | */ |
| 138 | - protected static function getSubParams( $param ) { |
|
| 138 | + protected static function getSubParams($param) { |
|
| 139 | 139 | $sub_params = []; |
| 140 | 140 | $sub_param = ''; |
| 141 | 141 | $uncompleted_square_brackets = 0; |
| 142 | 142 | |
| 143 | - for ( $i = 0; $i < strlen( $param ); $i++ ) { |
|
| 143 | + for ($i = 0; $i < strlen($param); $i++) { |
|
| 144 | 144 | $c = $param[$i]; |
| 145 | 145 | |
| 146 | - if ( ( $c == ';' ) && ( $uncompleted_square_brackets <= 0 ) ) { |
|
| 147 | - $sub_params[] = trim( $sub_param ); |
|
| 146 | + if (($c == ';') && ($uncompleted_square_brackets <= 0)) { |
|
| 147 | + $sub_params[] = trim($sub_param); |
|
| 148 | 148 | $sub_param = ''; |
| 149 | 149 | } else { |
| 150 | 150 | $sub_param .= $c; |
| 151 | 151 | |
| 152 | - if ( $c == '[' ) { |
|
| 152 | + if ($c == '[') { |
|
| 153 | 153 | $uncompleted_square_brackets++; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - elseif ( $c == ']' ) { |
|
| 156 | + elseif ($c == ']') { |
|
| 157 | 157 | $uncompleted_square_brackets--; |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $sub_params[] = trim( $sub_param ); |
|
| 162 | + $sub_params[] = trim($sub_param); |
|
| 163 | 163 | |
| 164 | 164 | return $sub_params; |
| 165 | 165 | } |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | * |
| 172 | 172 | * @return QueryResult |
| 173 | 173 | */ |
| 174 | - protected static function getQueryResultFromFunctionParams( $rawParams, $context = QueryProcessor::INLINE_QUERY, $showMode = false ) { |
|
| 175 | - list( $querystring, $params, $printouts ) = self::getComponentsFromFunctionParams( $rawParams, $showMode ); |
|
| 174 | + protected static function getQueryResultFromFunctionParams($rawParams, $context = QueryProcessor::INLINE_QUERY, $showMode = false) { |
|
| 175 | + list($querystring, $params, $printouts) = self::getComponentsFromFunctionParams($rawParams, $showMode); |
|
| 176 | 176 | |
| 177 | - return self::getQueryResultFromQueryString( $querystring, $params, $printouts, $context ); |
|
| 177 | + return self::getQueryResultFromQueryString($querystring, $params, $printouts, $context); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -185,19 +185,19 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @return array |
| 187 | 187 | */ |
| 188 | - protected static function mergeSMWQueryResults( $result1, $result2 ) { |
|
| 189 | - if ( $result1 == null ) { |
|
| 188 | + protected static function mergeSMWQueryResults($result1, $result2) { |
|
| 189 | + if ($result1 == null) { |
|
| 190 | 190 | return $result2; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | $existing_page_names = []; |
| 194 | - foreach ( $result1 as $r1 ) { |
|
| 194 | + foreach ($result1 as $r1) { |
|
| 195 | 195 | $existing_page_names[] = $r1->getSerialization(); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - foreach ( $result2 as $r2 ) { |
|
| 198 | + foreach ($result2 as $r2) { |
|
| 199 | 199 | $page_name = $r2->getSerialization(); |
| 200 | - if ( ! in_array( $page_name, $existing_page_names ) ) { |
|
| 200 | + if (!in_array($page_name, $existing_page_names)) { |
|
| 201 | 201 | $result1[] = $r2; |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -205,15 +205,15 @@ discard block |
||
| 205 | 205 | return $result1; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - protected static function mergeSMWPrintRequests( $printRequests1, $printRequests2 ) { |
|
| 208 | + protected static function mergeSMWPrintRequests($printRequests1, $printRequests2) { |
|
| 209 | 209 | $existingPrintoutLabels = []; |
| 210 | - foreach ( $printRequests1 as $p1 ) { |
|
| 210 | + foreach ($printRequests1 as $p1) { |
|
| 211 | 211 | $existingPrintoutLabels[] = $p1->getLabel(); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - foreach ( $printRequests2 as $p2 ) { |
|
| 214 | + foreach ($printRequests2 as $p2) { |
|
| 215 | 215 | $label = $p2->getLabel(); |
| 216 | - if ( ! in_array( $label, $existingPrintoutLabels ) ) { |
|
| 216 | + if (!in_array($label, $existingPrintoutLabels)) { |
|
| 217 | 217 | $printRequests1[] = $p2; |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -229,20 +229,20 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @return QueryResult |
| 231 | 231 | */ |
| 232 | - protected static function getQueryResultFromQueryString( $querystring, array $params, $extraPrintouts, $context = QueryProcessor::INLINE_QUERY ) { |
|
| 232 | + protected static function getQueryResultFromQueryString($querystring, array $params, $extraPrintouts, $context = QueryProcessor::INLINE_QUERY) { |
|
| 233 | 233 | |
| 234 | - if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { |
|
| 235 | - QueryProcessor::addThisPrintout( $extraPrintouts, $params ); |
|
| 236 | - $params = self::getProcessedParams( $params, $extraPrintouts, false ); |
|
| 234 | + if (version_compare(SMW_VERSION, '1.6.1', '>')) { |
|
| 235 | + QueryProcessor::addThisPrintout($extraPrintouts, $params); |
|
| 236 | + $params = self::getProcessedParams($params, $extraPrintouts, false); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - $query = self::createQuery( $querystring, $params, $context, null, $extraPrintouts ); |
|
| 240 | - $queryResult = smwfGetStore()->getQueryResult( $query ); |
|
| 239 | + $query = self::createQuery($querystring, $params, $context, null, $extraPrintouts); |
|
| 240 | + $queryResult = smwfGetStore()->getQueryResult($query); |
|
| 241 | 241 | |
| 242 | 242 | $parameters = []; |
| 243 | 243 | |
| 244 | - if ( version_compare( SMW_VERSION, '1.7.2', '>' ) ) { |
|
| 245 | - foreach ( $params as $param ) { |
|
| 244 | + if (version_compare(SMW_VERSION, '1.7.2', '>')) { |
|
| 245 | + foreach ($params as $param) { |
|
| 246 | 246 | $parameters[$param->getName()] = $param->getValue(); |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $parameters = $params; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - foreach ( $queryResult->getResults() as $wikiPage ) { |
|
| 253 | + foreach ($queryResult->getResults() as $wikiPage) { |
|
| 254 | 254 | $wikiPage->display_options = $parameters; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -269,20 +269,20 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @return string |
| 271 | 271 | */ |
| 272 | - protected static function getResultFromQueryResult( CompoundQueryResult $res, array $params, $outputmode, $context = QueryProcessor::INLINE_QUERY, $format = '' ) { |
|
| 272 | + protected static function getResultFromQueryResult(CompoundQueryResult $res, array $params, $outputmode, $context = QueryProcessor::INLINE_QUERY, $format = '') { |
|
| 273 | 273 | |
| 274 | - if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { |
|
| 274 | + if (version_compare(SMW_VERSION, '1.6.1', '>')) { |
|
| 275 | 275 | $format = $params['format']; |
| 276 | 276 | |
| 277 | - if ( version_compare( SMW_VERSION, '1.7.2', '>' ) ) { |
|
| 277 | + if (version_compare(SMW_VERSION, '1.7.2', '>')) { |
|
| 278 | 278 | $format = $format->getValue(); |
| 279 | 279 | } |
| 280 | 280 | } else { |
| 281 | - $format = self::getResultFormat( $params ); |
|
| 281 | + $format = self::getResultFormat($params); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - $printer = self::getResultPrinter( $format, $context ); |
|
| 285 | - $result = $printer->getResult( $res, $params, $outputmode ); |
|
| 284 | + $printer = self::getResultPrinter($format, $context); |
|
| 285 | + $result = $printer->getResult($res, $params, $outputmode); |
|
| 286 | 286 | |
| 287 | 287 | return $result; |
| 288 | 288 | } |
@@ -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 = []; |
| 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 | } |
@@ -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 [ |
| 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 | |
@@ -7,75 +7,75 @@ |
||
| 7 | 7 | |
| 8 | 8 | /** English (English) */ |
| 9 | 9 | $magicWords['en'] = [ |
| 10 | - 'compound_query' => [ 0, 'compound_query' ], |
|
| 10 | + 'compound_query' => [0, 'compound_query'], |
|
| 11 | 11 | ]; |
| 12 | 12 | |
| 13 | 13 | /** Arabic (العربية) */ |
| 14 | 14 | $magicWords['ar'] = [ |
| 15 | - 'compound_query' => [ 0, 'استعلام_مركب' ], |
|
| 15 | + 'compound_query' => [0, 'استعلام_مركب'], |
|
| 16 | 16 | ]; |
| 17 | 17 | |
| 18 | 18 | /** Egyptian Arabic (مصرى) */ |
| 19 | 19 | $magicWords['arz'] = [ |
| 20 | - 'compound_query' => [ 0, 'استعلام_مركب' ], |
|
| 20 | + 'compound_query' => [0, 'استعلام_مركب'], |
|
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | 23 | /** Chuvash (Чӑвашла) */ |
| 24 | 24 | $magicWords['cv'] = [ |
| 25 | - 'compound_query' => [ 0, 'compound_query' ], |
|
| 25 | + 'compound_query' => [0, 'compound_query'], |
|
| 26 | 26 | ]; |
| 27 | 27 | |
| 28 | 28 | /** German (Deutsch) */ |
| 29 | 29 | $magicWords['de'] = [ |
| 30 | - 'compound_query' => [ 0, 'abfrage_zusammen', 'frage_zusammen' ], |
|
| 30 | + 'compound_query' => [0, 'abfrage_zusammen', 'frage_zusammen'], |
|
| 31 | 31 | ]; |
| 32 | 32 | |
| 33 | 33 | /** Japanese (日本語) */ |
| 34 | 34 | $magicWords['ja'] = [ |
| 35 | - 'compound_query' => [ 0, '複合クエリ', '複合クエリー' ], |
|
| 35 | + 'compound_query' => [0, '複合クエリ', '複合クエリー'], |
|
| 36 | 36 | ]; |
| 37 | 37 | |
| 38 | 38 | /** Korean (한국어) */ |
| 39 | 39 | $magicWords['ko'] = [ |
| 40 | - 'compound_query' => [ 0, '복합_쿼리' ], |
|
| 40 | + 'compound_query' => [0, '복합_쿼리'], |
|
| 41 | 41 | ]; |
| 42 | 42 | |
| 43 | 43 | /** Macedonian (македонски) */ |
| 44 | 44 | $magicWords['mk'] = [ |
| 45 | - 'compound_query' => [ 0, 'мешовито_барање' ], |
|
| 45 | + 'compound_query' => [0, 'мешовито_барање'], |
|
| 46 | 46 | ]; |
| 47 | 47 | |
| 48 | 48 | /** Low Saxon (Netherlands) (Nedersaksies) */ |
| 49 | 49 | $magicWords['nds-nl'] = [ |
| 50 | - 'compound_query' => [ 0, 'samenestelden_zeukopdrachte', 'samengestelde_zoekopdracht' ], |
|
| 50 | + 'compound_query' => [0, 'samenestelden_zeukopdrachte', 'samengestelde_zoekopdracht'], |
|
| 51 | 51 | ]; |
| 52 | 52 | |
| 53 | 53 | /** Dutch (Nederlands) */ |
| 54 | 54 | $magicWords['nl'] = [ |
| 55 | - 'compound_query' => [ 0, 'samengestelde_zoekopdracht' ], |
|
| 55 | + 'compound_query' => [0, 'samengestelde_zoekopdracht'], |
|
| 56 | 56 | ]; |
| 57 | 57 | |
| 58 | 58 | /** Brazilian Portuguese (português do Brasil) */ |
| 59 | 59 | $magicWords['pt-br'] = [ |
| 60 | - 'compound_query' => [ 0, 'consulta_composta' ], |
|
| 60 | + 'compound_query' => [0, 'consulta_composta'], |
|
| 61 | 61 | ]; |
| 62 | 62 | |
| 63 | 63 | /** Serbian (Cyrillic script) (српски (ћирилица)) */ |
| 64 | 64 | $magicWords['sr-ec'] = [ |
| 65 | - 'compound_query' => [ 0, 'састави_упит' ], |
|
| 65 | + 'compound_query' => [0, 'састави_упит'], |
|
| 66 | 66 | ]; |
| 67 | 67 | |
| 68 | 68 | /** Serbian (Latin script) (srpski (latinica)) */ |
| 69 | 69 | $magicWords['sr-el'] = [ |
| 70 | - 'compound_query' => [ 0, 'sastavi_upit' ], |
|
| 70 | + 'compound_query' => [0, 'sastavi_upit'], |
|
| 71 | 71 | ]; |
| 72 | 72 | |
| 73 | 73 | /** Simplified Chinese (中文(简体)) */ |
| 74 | 74 | $magicWords['zh-hans'] = [ |
| 75 | - 'compound_query' => [ 0, '组合查询' ], |
|
| 75 | + 'compound_query' => [0, '组合查询'], |
|
| 76 | 76 | ]; |
| 77 | 77 | |
| 78 | 78 | /** Traditional Chinese (中文(繁體)) */ |
| 79 | 79 | $magicWords['zh-hant'] = [ |
| 80 | - 'compound_query' => [ 0, '組合搜尋' ], |
|
| 80 | + 'compound_query' => [0, '組合搜尋'], |
|
| 81 | 81 | ]; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public static function load() { |
| 26 | 26 | |
| 27 | - if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { |
|
| 27 | + if (is_readable(__DIR__ . '/vendor/autoload.php')) { |
|
| 28 | 28 | include_once __DIR__ . '/vendor/autoload.php'; |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @since 1.1 |
| 34 | 34 | */ |
| 35 | - public static function initExtension( $credits = [] ) { |
|
| 35 | + public static function initExtension($credits = []) { |
|
| 36 | 36 | |
| 37 | 37 | // See https://phabricator.wikimedia.org/T151136 |
| 38 | - define( 'SCQ_VERSION', isset( $credits['version'] ) ? $credits['version'] : 'UNKNOWN' ); |
|
| 38 | + define('SCQ_VERSION', isset($credits['version']) ? $credits['version'] : 'UNKNOWN'); |
|
| 39 | 39 | |
| 40 | 40 | // Register message files |
| 41 | 41 | $GLOBALS['wgMessagesDirs']['SemanticCompoundQueries'] = __DIR__ . '/i18n'; |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public static function onExtensionFunction() { |
| 50 | 50 | |
| 51 | - if ( !defined( 'SMW_VERSION' ) ) { |
|
| 51 | + if (!defined('SMW_VERSION')) { |
|
| 52 | 52 | |
| 53 | - if ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' ) { |
|
| 54 | - die( "\nThe 'Semantic Compound Queries' extension requires 'Semantic MediaWiki' to be installed and enabled.\n" ); |
|
| 53 | + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
|
| 54 | + die("\nThe 'Semantic Compound Queries' extension requires 'Semantic MediaWiki' to be installed and enabled.\n"); |
|
| 55 | 55 | } else { |
| 56 | 56 | die( |
| 57 | 57 | '<b>Error:</b> The <a href="https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Compound_Queries">Semantic Compound Queries</a> ' . |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | // wgHooks |
| 68 | 68 | $hookContainer = MediaWikiServices::getInstance()->getHookContainer(); |
| 69 | - $hookContainer->register( 'ParserFirstCallInit', function( Parser &$parser ) { |
|
| 70 | - $parser->setFunctionHook( 'compound_query', [ '\SCQ\CompoundQueryProcessor', 'doCompoundQuery' ] ); |
|
| 69 | + $hookContainer->register('ParserFirstCallInit', function(Parser&$parser) { |
|
| 70 | + $parser->setFunctionHook('compound_query', ['\SCQ\CompoundQueryProcessor', 'doCompoundQuery']); |
|
| 71 | 71 | |
| 72 | 72 | // always return true, in order not to stop MW's hook processing! |
| 73 | 73 | return true; |