@@ -76,10 +76,12 @@ |
||
| 76 | 76 | */ |
| 77 | 77 | public function getUriSpace() |
| 78 | 78 | { |
| 79 | - if ($this->urispace === null) // initialize cache |
|
| 79 | + if ($this->urispace === null) { |
|
| 80 | + // initialize cache |
|
| 80 | 81 | { |
| 81 | 82 | $this->urispace = $this->resource->getLiteral('void:uriSpace')->getValue(); |
| 82 | 83 | } |
| 84 | + } |
|
| 83 | 85 | |
| 84 | 86 | return $this->urispace; |
| 85 | 87 | } |
@@ -79,10 +79,12 @@ |
||
| 79 | 79 | if ($sortable !== null) { |
| 80 | 80 | uksort($sortable, array($this, 'mycompare')); |
| 81 | 81 | foreach ($sortable as $prop => $vals) { |
| 82 | - if (is_array($prop)) // the ConceptProperty objects have their own sorting methods |
|
| 82 | + if (is_array($prop)) { |
|
| 83 | + // the ConceptProperty objects have their own sorting methods |
|
| 83 | 84 | { |
| 84 | 85 | ksort($sortable[$prop]); |
| 85 | 86 | } |
| 87 | + } |
|
| 86 | 88 | } |
| 87 | 89 | } |
| 88 | 90 | return $sortable; |
@@ -46,12 +46,16 @@ discard block |
||
| 46 | 46 | $this->client = new EasyRdf\Sparql\Client($endpoint); |
| 47 | 47 | |
| 48 | 48 | // set graphClause so that it can be used by all queries |
| 49 | - if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable) |
|
| 49 | + if ($this->isDefaultEndpoint()) { |
|
| 50 | + // default endpoint; query any graph (and catch it in a variable) |
|
| 50 | 51 | { |
| 51 | 52 | $this->graphClause = "GRAPH $graph"; |
| 52 | - } elseif ($graph) // query a specific graph |
|
| 53 | + } |
|
| 54 | + } elseif ($graph) { |
|
| 55 | + // query a specific graph |
|
| 53 | 56 | { |
| 54 | 57 | $this->graphClause = "GRAPH <$graph>"; |
| 58 | + } |
|
| 55 | 59 | } else // query the default graph |
| 56 | 60 | { |
| 57 | 61 | $this->graphClause = ""; |
@@ -100,8 +104,9 @@ discard block |
||
| 100 | 104 | } |
| 101 | 105 | } |
| 102 | 106 | foreach ($graphs as $graph) { |
| 103 | - if($graph !== NULL) |
|
| 104 | - $clause .= "FROM NAMED <$graph> "; |
|
| 107 | + if($graph !== NULL) { |
|
| 108 | + $clause .= "FROM NAMED <$graph> "; |
|
| 109 | + } |
|
| 105 | 110 | } |
| 106 | 111 | return $clause; |
| 107 | 112 | } |
@@ -1847,8 +1852,7 @@ discard block |
||
| 1847 | 1852 | if (sizeof($ret) > 0) { |
| 1848 | 1853 | // existing concept, with children |
| 1849 | 1854 | return $ret; |
| 1850 | - } |
|
| 1851 | - else { |
|
| 1855 | + } else { |
|
| 1852 | 1856 | // nonexistent concept |
| 1853 | 1857 | return null; |
| 1854 | 1858 | } |
@@ -69,8 +69,9 @@ |
||
| 69 | 69 | public function getSearchTerm() |
| 70 | 70 | { |
| 71 | 71 | $term = $this->request->getQueryParamRaw('q') ? $this->request->getQueryParamRaw('q') : $this->request->getQueryParamRaw('query'); |
| 72 | - if (!$term && $this->rest) |
|
| 73 | - $term = $this->request->getQueryParamRaw('label'); |
|
| 72 | + if (!$term && $this->rest) { |
|
| 73 | + $term = $this->request->getQueryParamRaw('label'); |
|
| 74 | + } |
|
| 74 | 75 | $term = trim($term); // surrounding whitespace is not considered significant |
| 75 | 76 | if ($this->rest) { |
| 76 | 77 | return $term; |
@@ -400,7 +400,9 @@ discard block |
||
| 400 | 400 | $hits[] = $res; |
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | - if (sizeof($hits) > 0) return $hits; |
|
| 403 | + if (sizeof($hits) > 0) { |
|
| 404 | + return $hits; |
|
| 405 | + } |
|
| 404 | 406 | |
| 405 | 407 | // case 2: case-insensitive match on preferred label |
| 406 | 408 | foreach ($results as $res) { |
@@ -408,7 +410,9 @@ discard block |
||
| 408 | 410 | $hits[] = $res; |
| 409 | 411 | } |
| 410 | 412 | } |
| 411 | - if (sizeof($hits) > 0) return $hits; |
|
| 413 | + if (sizeof($hits) > 0) { |
|
| 414 | + return $hits; |
|
| 415 | + } |
|
| 412 | 416 | |
| 413 | 417 | if ($lang === null) { |
| 414 | 418 | // case 1A: exact match on preferred label in any language |
@@ -419,7 +423,9 @@ discard block |
||
| 419 | 423 | $hits[] = $res; |
| 420 | 424 | } |
| 421 | 425 | } |
| 422 | - if (sizeof($hits) > 0) return $hits; |
|
| 426 | + if (sizeof($hits) > 0) { |
|
| 427 | + return $hits; |
|
| 428 | + } |
|
| 423 | 429 | |
| 424 | 430 | // case 2A: case-insensitive match on preferred label in any language |
| 425 | 431 | foreach ($results as $res) { |
@@ -429,7 +435,9 @@ discard block |
||
| 429 | 435 | $hits[] = $res; |
| 430 | 436 | } |
| 431 | 437 | } |
| 432 | - if (sizeof($hits) > 0) return $hits; |
|
| 438 | + if (sizeof($hits) > 0) { |
|
| 439 | + return $hits; |
|
| 440 | + } |
|
| 433 | 441 | } |
| 434 | 442 | |
| 435 | 443 | // case 3: exact match on alternate label |
@@ -438,7 +446,9 @@ discard block |
||
| 438 | 446 | $hits[] = $res; |
| 439 | 447 | } |
| 440 | 448 | } |
| 441 | - if (sizeof($hits) > 0) return $hits; |
|
| 449 | + if (sizeof($hits) > 0) { |
|
| 450 | + return $hits; |
|
| 451 | + } |
|
| 442 | 452 | |
| 443 | 453 | |
| 444 | 454 | // case 4: case-insensitive match on alternate label |
@@ -447,7 +457,9 @@ discard block |
||
| 447 | 457 | $hits[] = $res; |
| 448 | 458 | } |
| 449 | 459 | } |
| 450 | - if (sizeof($hits) > 0) return $hits; |
|
| 460 | + if (sizeof($hits) > 0) { |
|
| 461 | + return $hits; |
|
| 462 | + } |
|
| 451 | 463 | |
| 452 | 464 | return $hits; |
| 453 | 465 | } |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | $ret[$name] = array(); |
| 41 | 41 | if ($raw) { |
| 42 | 42 | $ret[$name] = $files[$type]; |
| 43 | - } |
|
| 44 | - else { |
|
| 43 | + } else { |
|
| 45 | 44 | foreach ($files[$type] as $file) { |
| 46 | 45 | array_push($ret[$name], 'plugins/' . $name . '/' . $file); |
| 47 | 46 | } |
@@ -312,8 +312,7 @@ discard block |
||
| 312 | 312 | foreach ($res->propertyUris() as $prop) { |
| 313 | 313 | $this->addPropertyValues($res, $prop, $seen); |
| 314 | 314 | } |
| 315 | - } |
|
| 316 | - else { |
|
| 315 | + } else { |
|
| 317 | 316 | foreach ($props as $prop) { |
| 318 | 317 | if ($res->hasProperty($prop)) { |
| 319 | 318 | $this->addPropertyValues($res, $prop, $seen); |
@@ -850,8 +849,7 @@ discard block |
||
| 850 | 849 | if (!in_array($vocabUriSpace, $context, true)) { |
| 851 | 850 | if (!isset($context[$vocabPrefix])) { |
| 852 | 851 | $context[$vocabPrefix] = $vocabUriSpace; |
| 853 | - } |
|
| 854 | - else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
|
| 852 | + } else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
|
| 855 | 853 | $i = 2; |
| 856 | 854 | while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) { |
| 857 | 855 | $i += 1; |
@@ -74,7 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function getQueryParam($paramName) |
| 76 | 76 | { |
| 77 | - if (!isset($this->queryParams[$paramName])) return null; |
|
| 77 | + if (!isset($this->queryParams[$paramName])) { |
|
| 78 | + return null; |
|
| 79 | + } |
|
| 78 | 80 | $val = filter_var($this->queryParams[$paramName], FILTER_SANITIZE_STRING); |
| 79 | 81 | return ($val !== null ? str_replace('\\', '', $val) : null); |
| 80 | 82 | } |
@@ -91,7 +93,9 @@ discard block |
||
| 91 | 93 | |
| 92 | 94 | public function getQueryParamPOST($paramName) |
| 93 | 95 | { |
| 94 | - if (!isset($this->queryParamsPOST[$paramName])) return null; |
|
| 96 | + if (!isset($this->queryParamsPOST[$paramName])) { |
|
| 97 | + return null; |
|
| 98 | + } |
|
| 95 | 99 | return filter_var($this->queryParamsPOST[$paramName], FILTER_SANITIZE_STRING); |
| 96 | 100 | } |
| 97 | 101 | |
@@ -106,7 +110,9 @@ discard block |
||
| 106 | 110 | |
| 107 | 111 | public function getServerConstant($paramName) |
| 108 | 112 | { |
| 109 | - if (!isset($this->serverConstants[$paramName])) return null; |
|
| 113 | + if (!isset($this->serverConstants[$paramName])) { |
|
| 114 | + return null; |
|
| 115 | + } |
|
| 110 | 116 | return filter_var($this->serverConstants[$paramName], FILTER_SANITIZE_STRING); |
| 111 | 117 | } |
| 112 | 118 | |
@@ -239,9 +245,11 @@ discard block |
||
| 239 | 245 | */ |
| 240 | 246 | public function setVocab($vocabid) |
| 241 | 247 | { |
| 242 | - if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string |
|
| 248 | + if (strpos($vocabid, ' ') !== false) { |
|
| 249 | + // if there are multiple vocabularies just storing the string |
|
| 243 | 250 | { |
| 244 | 251 | $this->setVocabids($vocabid); |
| 252 | + } |
|
| 245 | 253 | } else { |
| 246 | 254 | $this->vocab = $this->model->getVocabulary($vocabid); |
| 247 | 255 | } |
@@ -307,11 +307,17 @@ |
||
| 307 | 307 | $subject = $this->model->getConfig()->getServiceName() . " feedback"; |
| 308 | 308 | // determine the sender address of the message |
| 309 | 309 | $sender = $this->model->getConfig()->getFeedbackSender(); |
| 310 | - if (empty($sender)) $sender = $envelopeSender; |
|
| 311 | - if (empty($sender)) $sender = $this->model->getConfig()->getFeedbackAddress(); |
|
| 310 | + if (empty($sender)) { |
|
| 311 | + $sender = $envelopeSender; |
|
| 312 | + } |
|
| 313 | + if (empty($sender)) { |
|
| 314 | + $sender = $this->model->getConfig()->getFeedbackAddress(); |
|
| 315 | + } |
|
| 312 | 316 | |
| 313 | 317 | // determine sender name - default to "anonymous user" if not given by user |
| 314 | - if (empty($fromName)) $fromName = "anonymous user"; |
|
| 318 | + if (empty($fromName)) { |
|
| 319 | + $fromName = "anonymous user"; |
|
| 320 | + } |
|
| 315 | 321 | |
| 316 | 322 | $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender); |
| 317 | 323 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |