@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | foreach ($vocabularyPlugins as $plugin) { |
| 53 | 53 | if ($plugin instanceof EasyRdf\Literal) { |
| 54 | 54 | $pluginArray[] = $plugin->getValue(); |
| 55 | - } |
|
| 56 | - else { |
|
| 55 | + } else { |
|
| 57 | 56 | $pluginArray[] = $plugin->getLiteral('skosmos:usePlugin')->getValue(); |
| 58 | 57 | } |
| 59 | 58 | } |
@@ -202,8 +201,9 @@ discard block |
||
| 202 | 201 | public function getShortName() |
| 203 | 202 | { |
| 204 | 203 | $shortname = $this->getLiteral('skosmos:shortName'); |
| 205 | - if ($shortname) |
|
| 206 | - return $shortname; |
|
| 204 | + if ($shortname) { |
|
| 205 | + return $shortname; |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | 208 | // if no shortname exists fall back to the id |
| 209 | 209 | return $this->getId(); |
@@ -353,10 +353,12 @@ discard block |
||
| 353 | 353 | $ret = array(); |
| 354 | 354 | foreach ($resources as $res) { |
| 355 | 355 | $prop = $res->getURI(); |
| 356 | - if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible |
|
| 356 | + if (EasyRdf\RdfNamespace::shorten($prop) !== null) { |
|
| 357 | + // shortening property labels if possible |
|
| 357 | 358 | { |
| 358 | 359 | $prop = EasyRdf\RdfNamespace::shorten($prop); |
| 359 | 360 | } |
| 361 | + } |
|
| 360 | 362 | |
| 361 | 363 | $ret[] = $prop; |
| 362 | 364 | } |
@@ -373,10 +375,12 @@ discard block |
||
| 373 | 375 | $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty"); |
| 374 | 376 | foreach ($resources as $res) { |
| 375 | 377 | $prop = $res->getURI(); |
| 376 | - if (EasyRdf\RdfNamespace::shorten($prop) !== null) // shortening property labels if possible |
|
| 378 | + if (EasyRdf\RdfNamespace::shorten($prop) !== null) { |
|
| 379 | + // shortening property labels if possible |
|
| 377 | 380 | { |
| 378 | 381 | $prop = EasyRdf\RdfNamespace::shorten($prop); |
| 379 | 382 | } |
| 383 | + } |
|
| 380 | 384 | |
| 381 | 385 | if ($prop === $property) { |
| 382 | 386 | return true; |
@@ -514,11 +518,12 @@ discard block |
||
| 514 | 518 | public function getId() |
| 515 | 519 | { |
| 516 | 520 | $uriparts = explode("#", $this->resource->getURI()); |
| 517 | - if (count($uriparts) != 1) |
|
| 518 | - // hash namespace |
|
| 521 | + if (count($uriparts) != 1) { |
|
| 522 | + // hash namespace |
|
| 519 | 523 | { |
| 520 | 524 | return $uriparts[1]; |
| 521 | 525 | } |
| 526 | + } |
|
| 522 | 527 | |
| 523 | 528 | // slash namespace |
| 524 | 529 | $uriparts = explode("/", $this->resource->getURI()); |
@@ -546,10 +551,12 @@ discard block |
||
| 546 | 551 | $ret = array(); |
| 547 | 552 | foreach ($resources as $res) { |
| 548 | 553 | $prop = $res->getURI(); |
| 549 | - if (EasyRdf\RdfNamespace::shorten($prop) !== null) // prefixing if possible |
|
| 554 | + if (EasyRdf\RdfNamespace::shorten($prop) !== null) { |
|
| 555 | + // prefixing if possible |
|
| 550 | 556 | { |
| 551 | 557 | $prop = EasyRdf\RdfNamespace::shorten($prop); |
| 552 | 558 | } |
| 559 | + } |
|
| 553 | 560 | |
| 554 | 561 | $ret[] = $prop; |
| 555 | 562 | } |
@@ -68,8 +68,9 @@ |
||
| 68 | 68 | public function getSearchTerm() : string |
| 69 | 69 | { |
| 70 | 70 | $term = $this->request->getQueryParamRaw('q') !== null ? $this->request->getQueryParamRaw('q') : $this->request->getQueryParamRaw('query'); |
| 71 | - if ((!isset($term) || strlen(trim($term)) === 0) && $this->rest) |
|
| 72 | - $term = $this->request->getQueryParamRaw('label'); |
|
| 71 | + if ((!isset($term) || strlen(trim($term)) === 0) && $this->rest) { |
|
| 72 | + $term = $this->request->getQueryParamRaw('label'); |
|
| 73 | + } |
|
| 73 | 74 | $term = trim(strval($term)); // surrounding whitespace is not considered significant |
| 74 | 75 | $term = Normalizer::normalize( $term, Normalizer::FORM_C ); //Normalize decomposed unicode characters #1184 |
| 75 | 76 | if ($this->rest) { |
@@ -69,9 +69,11 @@ |
||
| 69 | 69 | */ |
| 70 | 70 | public function getUriSpace() |
| 71 | 71 | { |
| 72 | - if ($this->urispace === null) // initialize cache |
|
| 72 | + if ($this->urispace === null) { |
|
| 73 | + // initialize cache |
|
| 73 | 74 | { |
| 74 | 75 | $urispace = $this->resource->getLiteral('void:uriSpace'); |
| 76 | + } |
|
| 75 | 77 | if ($urispace) { |
| 76 | 78 | $this->urispace = $urispace->getValue(); |
| 77 | 79 | } |
@@ -92,7 +92,9 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function getQueryParam($paramName) |
| 94 | 94 | { |
| 95 | - if (!isset($this->queryParams[$paramName])) return null; |
|
| 95 | + if (!isset($this->queryParams[$paramName])) { |
|
| 96 | + return null; |
|
| 97 | + } |
|
| 96 | 98 | $val = filter_var($this->queryParams[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 97 | 99 | return ($val !== null ? str_replace('\\', '', $val) : null); |
| 98 | 100 | } |
@@ -109,7 +111,9 @@ discard block |
||
| 109 | 111 | |
| 110 | 112 | public function getQueryParamPOST($paramName) |
| 111 | 113 | { |
| 112 | - if (!isset($this->queryParamsPOST[$paramName])) return null; |
|
| 114 | + if (!isset($this->queryParamsPOST[$paramName])) { |
|
| 115 | + return null; |
|
| 116 | + } |
|
| 113 | 117 | return filter_var($this->queryParamsPOST[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 114 | 118 | } |
| 115 | 119 | |
@@ -124,13 +128,17 @@ discard block |
||
| 124 | 128 | |
| 125 | 129 | public function getServerConstant($paramName) |
| 126 | 130 | { |
| 127 | - if (!isset($this->serverConstants[$paramName])) return null; |
|
| 131 | + if (!isset($this->serverConstants[$paramName])) { |
|
| 132 | + return null; |
|
| 133 | + } |
|
| 128 | 134 | return filter_var($this->serverConstants[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 129 | 135 | } |
| 130 | 136 | |
| 131 | 137 | public function getCookie($paramName) |
| 132 | 138 | { |
| 133 | - if (!isset($this->cookies[$paramName])) return null; |
|
| 139 | + if (!isset($this->cookies[$paramName])) { |
|
| 140 | + return null; |
|
| 141 | + } |
|
| 134 | 142 | return filter_var($this->cookies[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 135 | 143 | } |
| 136 | 144 | |
@@ -271,9 +279,11 @@ discard block |
||
| 271 | 279 | */ |
| 272 | 280 | public function setVocab($vocabid) |
| 273 | 281 | { |
| 274 | - if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string |
|
| 282 | + if (strpos($vocabid, ' ') !== false) { |
|
| 283 | + // if there are multiple vocabularies just storing the string |
|
| 275 | 284 | { |
| 276 | 285 | $this->setVocabids($vocabid); |
| 286 | + } |
|
| 277 | 287 | } else { |
| 278 | 288 | $this->vocab = $this->model->getVocabulary($vocabid); |
| 279 | 289 | } |