| @@ -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( | 
| @@ -17,18 +17,18 @@ discard block | ||
| 17 | 17 | * @see ApiBase::execute | 
| 18 | 18 | */ | 
| 19 | 19 |  	public function execute() { | 
| 20 | - $parameterFormatter = new ApiRequestParameterFormatter( $this->extractRequestParams() ); | |
| 20 | + $parameterFormatter = new ApiRequestParameterFormatter($this->extractRequestParams()); | |
| 21 | 21 | $parameters = $parameterFormatter->getAskApiParameters(); | 
| 22 | 22 | |
| 23 | - list( $queryParams, $otherParams ) = SCQQueryProcessor::separateParams( $parameters ); | |
| 24 | - list( $queryResult, $otherParams ) = SCQQueryProcessor::queryAndMergeResults( $queryParams, $otherParams ); | |
| 23 | + list($queryParams, $otherParams) = SCQQueryProcessor::separateParams($parameters); | |
| 24 | + list($queryResult, $otherParams) = SCQQueryProcessor::queryAndMergeResults($queryParams, $otherParams); | |
| 25 | 25 | |
| 26 | 26 | $outputFormat = 'json'; | 
| 27 | -		if ( $this->getMain()->getPrinter() instanceof \ApiFormatXml ) { | |
| 27 | +		if ($this->getMain()->getPrinter() instanceof \ApiFormatXml) { | |
| 28 | 28 | $outputFormat = 'xml'; | 
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | - $this->addQueryResult( $queryResult, $outputFormat ); | |
| 31 | + $this->addQueryResult($queryResult, $outputFormat); | |
| 32 | 32 | } | 
| 33 | 33 | |
| 34 | 34 | /** | 
| @@ -78,8 +78,8 @@ discard block | ||
| 78 | 78 | */ | 
| 79 | 79 |  	protected function getExamples() { | 
| 80 | 80 | return array( | 
| 81 | - 'api.php?action=compoundquery&query=' . urlencode( '[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates' ), | |
| 82 | - 'api.php?action=compoundquery&query=' . urlencode( '|[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates' ), | |
| 81 | +			'api.php?action=compoundquery&query=' . urlencode('[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates'), | |
| 82 | +			'api.php?action=compoundquery&query=' . urlencode('|[[Has city::Vienna]]; ?Has coordinates|[[Has city::Graz]]; ?Has coordinates'), | |
| 83 | 83 | ); | 
| 84 | 84 | } | 
| 85 | 85 | |
| @@ -126,7 +126,7 @@ discard block | ||
| 126 | 126 | * | 
| 127 | 127 | * @param string $param | 
| 128 | 128 | * | 
| 129 | - * @return array | |
| 129 | + * @return string[] | |
| 130 | 130 | */ | 
| 131 | 131 |  	protected static function getSubParams( $param ) { | 
| 132 | 132 | $sub_params = array(); | 
| @@ -159,7 +159,7 @@ discard block | ||
| 159 | 159 | |
| 160 | 160 | /** | 
| 161 | 161 | * @param $rawparams | 
| 162 | - * @param $outputmode | |
| 162 | + * @param integer $outputmode | |
| 163 | 163 | * @param $context | 
| 164 | 164 | * @param $showmode | 
| 165 | 165 | * | 
| @@ -175,7 +175,7 @@ discard block | ||
| 175 | 175 | * Combine two arrays of SMWWikiPageValue objects into one | 
| 176 | 176 | * | 
| 177 | 177 | * @param array $result1 | 
| 178 | - * @param array $result2 | |
| 178 | + * @param SMWDIWikiPage[] $result2 | |
| 179 | 179 | * | 
| 180 | 180 | * @return array | 
| 181 | 181 | */ | 
| @@ -199,6 +199,9 @@ discard block | ||
| 199 | 199 | return $result1; | 
| 200 | 200 | } | 
| 201 | 201 | |
| 202 | + /** | |
| 203 | + * @param SMW\Query\PrintRequest[] $printRequests2 | |
| 204 | + */ | |
| 202 | 205 |  	protected static function mergeSMWPrintRequests( $printRequests1, $printRequests2 ) { | 
| 203 | 206 | $existingPrintoutLabels = array(); | 
| 204 | 207 |  		foreach ( $printRequests1 as $p1 ) { | 
| @@ -215,10 +218,10 @@ discard block | ||
| 215 | 218 | } | 
| 216 | 219 | |
| 217 | 220 | /** | 
| 218 | - * @param $querystring | |
| 221 | + * @param string $querystring | |
| 219 | 222 | * @param array $params | 
| 220 | 223 | * @param $extraPrintouts | 
| 221 | - * @param $outputMode | |
| 224 | + * @param integer $outputMode | |
| 222 | 225 | * @param $context | 
| 223 | 226 | * | 
| 224 | 227 | * @return SMWQueryResult | 
| @@ -260,7 +263,7 @@ discard block | ||
| 260 | 263 | * | 
| 261 | 264 | * @param SCQQueryResult $res | 
| 262 | 265 | * @param array $params These need to be the result of a list fed to getProcessedParams as of SMW 1.6.2 | 
| 263 | - * @param $outputmode | |
| 266 | + * @param integer $outputmode | |
| 264 | 267 | * @param $context | 
| 265 | 268 | * @param string $format | 
| 266 | 269 | * | 
| @@ -14,11 +14,11 @@ discard block | ||
| 14 | 14 | /** | 
| 15 | 15 | * Comparison helper function, used in sorting results. | 
| 16 | 16 | */ | 
| 17 | -	public static function compareQueryResults( $a, $b ) { | |
| 18 | -		if ( $a->getSerialization() == $b->getSerialization() ) { | |
| 17 | +	public static function compareQueryResults($a, $b) { | |
| 18 | +		if ($a->getSerialization() == $b->getSerialization()) { | |
| 19 | 19 | return 0; | 
| 20 | 20 | } | 
| 21 | - return ( $a->getSerialization() < $b->getSerialization() ) ? -1 : 1; | |
| 21 | + return ($a->getSerialization() < $b->getSerialization()) ? -1 : 1; | |
| 22 | 22 | } | 
| 23 | 23 | |
| 24 | 24 | /** | 
| @@ -28,20 +28,20 @@ discard block | ||
| 28 | 28 | * | 
| 29 | 29 | * @return string | 
| 30 | 30 | */ | 
| 31 | -	public static function doCompoundQuery( Parser &$parser ) { | |
| 31 | +	public static function doCompoundQuery(Parser&$parser) { | |
| 32 | 32 | global $smwgQEnabled, $smwgIQRunningNumber; | 
| 33 | 33 | |
| 34 | -		if ( !$smwgQEnabled ) { | |
| 35 | - return smwfEncodeMessages( array( wfMessage( 'smw_iq_disabled' )->inContentLanguage()->text() ) ); | |
| 34 | +		if (!$smwgQEnabled) { | |
| 35 | +			return smwfEncodeMessages(array(wfMessage('smw_iq_disabled')->inContentLanguage()->text())); | |
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 | $smwgIQRunningNumber++; | 
| 39 | 39 | |
| 40 | 40 | $params = func_get_args(); | 
| 41 | - array_shift( $params ); // We already know the $parser. | |
| 41 | + array_shift($params); // We already know the $parser. | |
| 42 | 42 | |
| 43 | - list( $queryParams, $otherParams ) = self::separateParams( $params ); | |
| 44 | - list( $queryResult, $otherParams ) = self::queryAndMergeResults( $queryParams, $otherParams ); | |
| 43 | + list($queryParams, $otherParams) = self::separateParams($params); | |
| 44 | + list($queryResult, $otherParams) = self::queryAndMergeResults($queryParams, $otherParams); | |
| 45 | 45 | |
| 46 | 46 | return self::getResultFromQueryResult( | 
| 47 | 47 | $queryResult, | 
| @@ -56,25 +56,25 @@ discard block | ||
| 56 | 56 | * @param $params | 
| 57 | 57 | * @return array | 
| 58 | 58 | */ | 
| 59 | -	public static function separateParams( $params ) { | |
| 59 | +	public static function separateParams($params) { | |
| 60 | 60 | $queryParams = array(); | 
| 61 | 61 | $otherParams = array(); | 
| 62 | 62 | |
| 63 | -		foreach ( $params as $param ) { | |
| 63 | +		foreach ($params as $param) { | |
| 64 | 64 | // Very primitive heuristic - if the parameter | 
| 65 | 65 | // includes a square bracket, then it's a | 
| 66 | 66 | // sub-query; otherwise it's a regular parameter. | 
| 67 | -			if ( strpos( $param, '[' ) !== false ) { | |
| 67 | +			if (strpos($param, '[') !== false) { | |
| 68 | 68 | $queryParams[] = $param; | 
| 69 | 69 |  			} else { | 
| 70 | - $parts = explode( '=', $param, 2 ); | |
| 70 | +				$parts = explode('=', $param, 2); | |
| 71 | 71 | |
| 72 | -				if ( count( $parts ) >= 2 ) { | |
| 73 | - $otherParams[strtolower( trim( $parts[0] ) )] = $parts[1]; // don't trim here, some params care for " " | |
| 72 | +				if (count($parts) >= 2) { | |
| 73 | + $otherParams[strtolower(trim($parts[0]))] = $parts[1]; // don't trim here, some params care for " " | |
| 74 | 74 | } | 
| 75 | 75 | } | 
| 76 | 76 | } | 
| 77 | - return array( $queryParams, $otherParams ); | |
| 77 | + return array($queryParams, $otherParams); | |
| 78 | 78 | } | 
| 79 | 79 | |
| 80 | 80 | /** | 
| @@ -84,14 +84,14 @@ discard block | ||
| 84 | 84 | * @param $otherParams | 
| 85 | 85 | * @return array | 
| 86 | 86 | */ | 
| 87 | -	public static function queryAndMergeResults( $queryParams, $otherParams ) { | |
| 87 | +	public static function queryAndMergeResults($queryParams, $otherParams) { | |
| 88 | 88 | $results = array(); | 
| 89 | 89 | $printRequests = array(); | 
| 90 | 90 | |
| 91 | -		foreach ( $queryParams as $param ) { | |
| 92 | - $subQueryParams = self::getSubParams( $param ); | |
| 91 | +		foreach ($queryParams as $param) { | |
| 92 | + $subQueryParams = self::getSubParams($param); | |
| 93 | 93 | |
| 94 | -			if ( array_key_exists( 'format', $otherParams ) && !array_key_exists( 'format', $subQueryParams ) ) { | |
| 94 | +			if (array_key_exists('format', $otherParams) && !array_key_exists('format', $subQueryParams)) { | |
| 95 | 95 | $subQueryParams['format'] = $otherParams['format']; | 
| 96 | 96 | } | 
| 97 | 97 | |
| @@ -100,23 +100,23 @@ discard block | ||
| 100 | 100 | SMW_OUTPUT_WIKI | 
| 101 | 101 | ); | 
| 102 | 102 | |
| 103 | - $results = self::mergeSMWQueryResults( $results, $nextResult->getResults() ); | |
| 104 | - $printRequests = self::mergeSMWPrintRequests( $printRequests, $nextResult->getPrintRequests() ); | |
| 103 | + $results = self::mergeSMWQueryResults($results, $nextResult->getResults()); | |
| 104 | + $printRequests = self::mergeSMWPrintRequests($printRequests, $nextResult->getPrintRequests()); | |
| 105 | 105 | } | 
| 106 | 106 | |
| 107 | 107 | // Sort results so that they'll show up by page name | 
| 108 | -		if( !isset($otherParams['unsorted']) || !strcmp( $otherParams['unsorted'], 'on' ) ) { | |
| 109 | - uasort( $results, array( 'SCQQueryProcessor', 'compareQueryResults' ) ); | |
| 108 | +		if (!isset($otherParams['unsorted']) || !strcmp($otherParams['unsorted'], 'on')) { | |
| 109 | +			uasort($results, array('SCQQueryProcessor', 'compareQueryResults')); | |
| 110 | 110 | } | 
| 111 | 111 | |
| 112 | - $queryResult = new SCQQueryResult( $printRequests, new SMWQuery(), $results, smwfGetStore() ); | |
| 112 | + $queryResult = new SCQQueryResult($printRequests, new SMWQuery(), $results, smwfGetStore()); | |
| 113 | 113 | |
| 114 | -		if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { | |
| 115 | - SMWQueryProcessor::addThisPrintout( $printRequests, $otherParams ); | |
| 116 | - $otherParams = parent::getProcessedParams( $otherParams, $printRequests ); | |
| 114 | +		if (version_compare(SMW_VERSION, '1.6.1', '>')) { | |
| 115 | + SMWQueryProcessor::addThisPrintout($printRequests, $otherParams); | |
| 116 | + $otherParams = parent::getProcessedParams($otherParams, $printRequests); | |
| 117 | 117 | } | 
| 118 | 118 | |
| 119 | - return array( $queryResult, $otherParams ); | |
| 119 | + return array($queryResult, $otherParams); | |
| 120 | 120 | } | 
| 121 | 121 | |
| 122 | 122 | /** | 
| @@ -128,31 +128,31 @@ discard block | ||
| 128 | 128 | * | 
| 129 | 129 | * @return array | 
| 130 | 130 | */ | 
| 131 | -	protected static function getSubParams( $param ) { | |
| 131 | +	protected static function getSubParams($param) { | |
| 132 | 132 | $sub_params = array(); | 
| 133 | 133 | $sub_param = ''; | 
| 134 | 134 | $uncompleted_square_brackets = 0; | 
| 135 | 135 | |
| 136 | -		for ( $i = 0; $i < strlen( $param ); $i++ ) { | |
| 136 | +		for ($i = 0; $i < strlen($param); $i++) { | |
| 137 | 137 | $c = $param[$i]; | 
| 138 | 138 | |
| 139 | -			if ( ( $c == ';' ) && ( $uncompleted_square_brackets <= 0 ) ) { | |
| 140 | - $sub_params[] = trim( $sub_param ); | |
| 139 | +			if (($c == ';') && ($uncompleted_square_brackets <= 0)) { | |
| 140 | + $sub_params[] = trim($sub_param); | |
| 141 | 141 | $sub_param = ''; | 
| 142 | 142 |  			} else { | 
| 143 | 143 | $sub_param .= $c; | 
| 144 | 144 | |
| 145 | -				if ( $c == '[' ) { | |
| 145 | +				if ($c == '[') { | |
| 146 | 146 | $uncompleted_square_brackets++; | 
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | -				elseif ( $c == ']' ) { | |
| 149 | +				elseif ($c == ']') { | |
| 150 | 150 | $uncompleted_square_brackets--; | 
| 151 | 151 | } | 
| 152 | 152 | } | 
| 153 | 153 | } | 
| 154 | 154 | |
| 155 | - $sub_params[] = trim( $sub_param ); | |
| 155 | + $sub_params[] = trim($sub_param); | |
| 156 | 156 | |
| 157 | 157 | return $sub_params; | 
| 158 | 158 | } | 
| @@ -165,10 +165,10 @@ discard block | ||
| 165 | 165 | * | 
| 166 | 166 | * @return SMWQueryResult | 
| 167 | 167 | */ | 
| 168 | -	protected static function getQueryResultFromFunctionParams( $rawparams, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $showmode = false ) { | |
| 168 | +	protected static function getQueryResultFromFunctionParams($rawparams, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $showmode = false) { | |
| 169 | 169 | $printouts = null; | 
| 170 | - self::processFunctionParams( $rawparams, $querystring, $params, $printouts, $showmode ); | |
| 171 | - return self::getQueryResultFromQueryString( $querystring, $params, $printouts, SMW_OUTPUT_WIKI, $context ); | |
| 170 | + self::processFunctionParams($rawparams, $querystring, $params, $printouts, $showmode); | |
| 171 | + return self::getQueryResultFromQueryString($querystring, $params, $printouts, SMW_OUTPUT_WIKI, $context); | |
| 172 | 172 | } | 
| 173 | 173 | |
| 174 | 174 | /** | 
| @@ -179,19 +179,19 @@ discard block | ||
| 179 | 179 | * | 
| 180 | 180 | * @return array | 
| 181 | 181 | */ | 
| 182 | -	protected static function mergeSMWQueryResults( $result1, $result2 ) { | |
| 183 | -		if ( $result1 == null ) { | |
| 182 | +	protected static function mergeSMWQueryResults($result1, $result2) { | |
| 183 | +		if ($result1 == null) { | |
| 184 | 184 | return $result2; | 
| 185 | 185 | } | 
| 186 | 186 | |
| 187 | 187 | $existing_page_names = array(); | 
| 188 | -		foreach ( $result1 as $r1 ) { | |
| 188 | +		foreach ($result1 as $r1) { | |
| 189 | 189 | $existing_page_names[] = $r1->getSerialization(); | 
| 190 | 190 | } | 
| 191 | 191 | |
| 192 | -		foreach ( $result2 as $r2 ) { | |
| 192 | +		foreach ($result2 as $r2) { | |
| 193 | 193 | $page_name = $r2->getSerialization(); | 
| 194 | -			if ( ! in_array( $page_name, $existing_page_names ) ) { | |
| 194 | +			if (!in_array($page_name, $existing_page_names)) { | |
| 195 | 195 | $result1[] = $r2; | 
| 196 | 196 | } | 
| 197 | 197 | } | 
| @@ -199,15 +199,15 @@ discard block | ||
| 199 | 199 | return $result1; | 
| 200 | 200 | } | 
| 201 | 201 | |
| 202 | -	protected static function mergeSMWPrintRequests( $printRequests1, $printRequests2 ) { | |
| 202 | +	protected static function mergeSMWPrintRequests($printRequests1, $printRequests2) { | |
| 203 | 203 | $existingPrintoutLabels = array(); | 
| 204 | -		foreach ( $printRequests1 as $p1 ) { | |
| 204 | +		foreach ($printRequests1 as $p1) { | |
| 205 | 205 | $existingPrintoutLabels[] = $p1->getLabel(); | 
| 206 | 206 | } | 
| 207 | 207 | |
| 208 | -		foreach ( $printRequests2 as $p2 ) { | |
| 208 | +		foreach ($printRequests2 as $p2) { | |
| 209 | 209 | $label = $p2->getLabel(); | 
| 210 | -			if ( ! in_array( $label, $existingPrintoutLabels ) ) { | |
| 210 | +			if (!in_array($label, $existingPrintoutLabels)) { | |
| 211 | 211 | $printRequests1[] = $p2; | 
| 212 | 212 | } | 
| 213 | 213 | } | 
| @@ -223,21 +223,21 @@ discard block | ||
| 223 | 223 | * | 
| 224 | 224 | * @return SMWQueryResult | 
| 225 | 225 | */ | 
| 226 | -	protected static function getQueryResultFromQueryString( $querystring, array $params, $extraPrintouts, $outputMode, $context = SMWQueryProcessor::INLINE_QUERY ) { | |
| 227 | - wfProfileIn( 'SCQQueryProcessor::getQueryResultFromQueryString' ); | |
| 226 | +	protected static function getQueryResultFromQueryString($querystring, array $params, $extraPrintouts, $outputMode, $context = SMWQueryProcessor::INLINE_QUERY) { | |
| 227 | +		wfProfileIn('SCQQueryProcessor::getQueryResultFromQueryString'); | |
| 228 | 228 | |
| 229 | -		if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { | |
| 230 | - SMWQueryProcessor::addThisPrintout( $extraPrintouts, $params ); | |
| 231 | - $params = self::getProcessedParams( $params, $extraPrintouts, false ); | |
| 229 | +		if (version_compare(SMW_VERSION, '1.6.1', '>')) { | |
| 230 | + SMWQueryProcessor::addThisPrintout($extraPrintouts, $params); | |
| 231 | + $params = self::getProcessedParams($params, $extraPrintouts, false); | |
| 232 | 232 | } | 
| 233 | 233 | |
| 234 | - $query = self::createQuery( $querystring, $params, $context, null, $extraPrintouts ); | |
| 235 | - $queryResult = smwfGetStore()->getQueryResult( $query ); | |
| 234 | + $query = self::createQuery($querystring, $params, $context, null, $extraPrintouts); | |
| 235 | + $queryResult = smwfGetStore()->getQueryResult($query); | |
| 236 | 236 | |
| 237 | 237 | $parameters = array(); | 
| 238 | 238 | |
| 239 | -		if ( version_compare( SMW_VERSION, '1.7.2', '>' ) ) { | |
| 240 | -			foreach ( $params as $param ) { | |
| 239 | +		if (version_compare(SMW_VERSION, '1.7.2', '>')) { | |
| 240 | +			foreach ($params as $param) { | |
| 241 | 241 | $parameters[$param->getName()] = $param->getValue(); | 
| 242 | 242 | } | 
| 243 | 243 | } | 
| @@ -245,11 +245,11 @@ discard block | ||
| 245 | 245 | $parameters = $params; | 
| 246 | 246 | } | 
| 247 | 247 | |
| 248 | -		foreach ( $queryResult->getResults() as $wikiPage ) { | |
| 248 | +		foreach ($queryResult->getResults() as $wikiPage) { | |
| 249 | 249 | $wikiPage->display_options = $parameters; | 
| 250 | 250 | } | 
| 251 | 251 | |
| 252 | - wfProfileOut( 'SCQQueryProcessor::getQueryResultFromQueryString' ); | |
| 252 | +		wfProfileOut('SCQQueryProcessor::getQueryResultFromQueryString'); | |
| 253 | 253 | |
| 254 | 254 | return $queryResult; | 
| 255 | 255 | } | 
| @@ -266,23 +266,23 @@ discard block | ||
| 266 | 266 | * | 
| 267 | 267 | * @return string | 
| 268 | 268 | */ | 
| 269 | -	protected static function getResultFromQueryResult( SCQQueryResult $res, array $params, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $format = '' ) { | |
| 270 | - wfProfileIn( 'SCQQueryProcessor::getResultFromQueryResult' ); | |
| 269 | +	protected static function getResultFromQueryResult(SCQQueryResult $res, array $params, $outputmode, $context = SMWQueryProcessor::INLINE_QUERY, $format = '') { | |
| 270 | +		wfProfileIn('SCQQueryProcessor::getResultFromQueryResult'); | |
| 271 | 271 | |
| 272 | -		if ( version_compare( SMW_VERSION, '1.6.1', '>' ) ) { | |
| 272 | +		if (version_compare(SMW_VERSION, '1.6.1', '>')) { | |
| 273 | 273 | $format = $params['format']; | 
| 274 | 274 | |
| 275 | -			if ( version_compare( SMW_VERSION, '1.7.2', '>' ) ) { | |
| 275 | +			if (version_compare(SMW_VERSION, '1.7.2', '>')) { | |
| 276 | 276 | $format = $format->getValue(); | 
| 277 | 277 | } | 
| 278 | 278 |  		} else { | 
| 279 | - $format = self::getResultFormat( $params ); | |
| 279 | + $format = self::getResultFormat($params); | |
| 280 | 280 | } | 
| 281 | 281 | |
| 282 | - $printer = self::getResultPrinter( $format, $context, $res ); | |
| 283 | - $result = $printer->getResult( $res, $params, $outputmode ); | |
| 282 | + $printer = self::getResultPrinter($format, $context, $res); | |
| 283 | + $result = $printer->getResult($res, $params, $outputmode); | |
| 284 | 284 | |
| 285 | - wfProfileOut( 'SCQQueryProcessor::getResultFromQueryResult' ); | |
| 285 | +		wfProfileOut('SCQQueryProcessor::getResultFromQueryResult'); | |
| 286 | 286 | |
| 287 | 287 | return $result; | 
| 288 | 288 | } | 
| @@ -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 | |
| @@ -17,29 +17,29 @@ | ||
| 17 | 17 | * | 
| 18 | 18 | * @param SMWQueryResult $newResult | 
| 19 | 19 | */ | 
| 20 | -	public function addResult( SMWQueryResult $newResult ) { | |
| 20 | +	public function addResult(SMWQueryResult $newResult) { | |
| 21 | 21 | $existingPageNames = array(); | 
| 22 | 22 | |
| 23 | -		while ( $row = $this->getNext() ) { | |
| 24 | -			if ( $row[0] instanceof SMWResultArray ) { | |
| 23 | +		while ($row = $this->getNext()) { | |
| 24 | +			if ($row[0] instanceof SMWResultArray) { | |
| 25 | 25 | $content = $row[0]->getContent(); | 
| 26 | - $existingPageNames[] = $content[0]->getLongText( SMW_OUTPUT_WIKI ); | |
| 26 | + $existingPageNames[] = $content[0]->getLongText(SMW_OUTPUT_WIKI); | |
| 27 | 27 | } | 
| 28 | 28 | } | 
| 29 | 29 | |
| 30 | -		while ( ( $row = $newResult->getNext() ) !== false ) { | |
| 31 | -			if ( property_exists( $newResult, 'display_options' ) ) { | |
| 30 | +		while (($row = $newResult->getNext()) !== false) { | |
| 31 | +			if (property_exists($newResult, 'display_options')) { | |
| 32 | 32 | $row[0]->display_options = $newResult->display_options; | 
| 33 | 33 | } | 
| 34 | 34 | $content = $row[0]->getContent(); | 
| 35 | - $pageName = $content[0]->getLongText( SMW_OUTPUT_WIKI ); | |
| 35 | + $pageName = $content[0]->getLongText(SMW_OUTPUT_WIKI); | |
| 36 | 36 | |
| 37 | -			if ( !in_array( $pageName, $existingPageNames ) ) { | |
| 37 | +			if (!in_array($pageName, $existingPageNames)) { | |
| 38 | 38 | $this->m_content[] = $row; | 
| 39 | 39 | } | 
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | - reset( $this->m_content ); | |
| 42 | + reset($this->m_content); | |
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | 45 | } | 
| @@ -15,15 +15,15 @@ discard block | ||
| 15 | 15 | * @defgroup SemanticCompoundQueries SemanticCompoundQueries | 
| 16 | 16 | */ | 
| 17 | 17 | |
| 18 | -if ( !defined( 'MEDIAWIKI' ) ) die(); | |
| 18 | +if (!defined('MEDIAWIKI')) die(); | |
| 19 | 19 | |
| 20 | -define( 'SCQ_VERSION', '0.4.1' ); | |
| 20 | +define('SCQ_VERSION', '0.4.1'); | |
| 21 | 21 | |
| 22 | 22 | $wgExtensionCredits['semantic'][] = array( | 
| 23 | 23 | 'path' => __FILE__, | 
| 24 | 24 | 'name' => 'Semantic Compound Queries', | 
| 25 | 25 | 'version' => SCQ_VERSION, | 
| 26 | - 'author' => array( 'Yaron Koren' ), | |
| 26 | +	'author' => array('Yaron Koren'), | |
| 27 | 27 | 'url' => 'https://www.mediawiki.org/wiki/Extension:Semantic_Compound_Queries', | 
| 28 | 28 | 'descriptionmsg' => 'semanticcompoundqueries-desc', | 
| 29 | 29 | 'license-name' => 'GPL-2.0+' | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | |
| 41 | 41 | $wgAPIModules['compoundquery'] = '\SCQCompoundQueryApi'; | 
| 42 | 42 | |
| 43 | -function scqgRegisterParser( Parser &$parser ) { | |
| 44 | - $parser->setFunctionHook( 'compound_query', array( 'SCQQueryProcessor', 'doCompoundQuery' ) ); | |
| 43 | +function scqgRegisterParser(Parser&$parser) { | |
| 44 | +	$parser->setFunctionHook('compound_query', array('SCQQueryProcessor', 'doCompoundQuery')); | |
| 45 | 45 | return true; // always return true, in order not to stop MW's hook processing! | 
| 46 | 46 | } | 
| @@ -15,7 +15,9 @@ | ||
| 15 | 15 | * @defgroup SemanticCompoundQueries SemanticCompoundQueries | 
| 16 | 16 | */ | 
| 17 | 17 | |
| 18 | -if ( !defined( 'MEDIAWIKI' ) ) die(); | |
| 18 | +if ( !defined( 'MEDIAWIKI' ) ) { | |
| 19 | + die(); | |
| 20 | +} | |
| 19 | 21 | |
| 20 | 22 | define( 'SCQ_VERSION', '0.4.1' ); | 
| 21 | 23 | |
| @@ -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 |