@@ -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 | } |
@@ -102,7 +102,9 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function getQueryParam($paramName) |
| 104 | 104 | { |
| 105 | - if (!isset($this->queryParams[$paramName])) return null; |
|
| 105 | + if (!isset($this->queryParams[$paramName])) { |
|
| 106 | + return null; |
|
| 107 | + } |
|
| 106 | 108 | $val = filter_var($this->queryParams[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 107 | 109 | return ($val !== null ? str_replace('\\', '', $val) : null); |
| 108 | 110 | } |
@@ -125,7 +127,9 @@ discard block |
||
| 125 | 127 | */ |
| 126 | 128 | public function getQueryParamPOST($paramName, $maxlength=null) |
| 127 | 129 | { |
| 128 | - if (!isset($this->queryParamsPOST[$paramName])) return null; |
|
| 130 | + if (!isset($this->queryParamsPOST[$paramName])) { |
|
| 131 | + return null; |
|
| 132 | + } |
|
| 129 | 133 | $val = filter_var($this->queryParamsPOST[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 130 | 134 | if ($maxlength !== null) { |
| 131 | 135 | return substr($val, 0, $maxlength); |
@@ -145,13 +149,17 @@ discard block |
||
| 145 | 149 | |
| 146 | 150 | public function getServerConstant($paramName) |
| 147 | 151 | { |
| 148 | - if (!isset($this->serverConstants[$paramName])) return null; |
|
| 152 | + if (!isset($this->serverConstants[$paramName])) { |
|
| 153 | + return null; |
|
| 154 | + } |
|
| 149 | 155 | return filter_var($this->serverConstants[$paramName], FILTER_SANITIZE_ADD_SLASHES); |
| 150 | 156 | } |
| 151 | 157 | |
| 152 | 158 | public function getCookie($paramName) |
| 153 | 159 | { |
| 154 | - if (!isset($this->cookies[$paramName])) return null; |
|
| 160 | + if (!isset($this->cookies[$paramName])) { |
|
| 161 | + return null; |
|
| 162 | + } |
|
| 155 | 163 | return filter_var($this->cookies[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 156 | 164 | } |
| 157 | 165 | |
@@ -292,9 +300,11 @@ discard block |
||
| 292 | 300 | */ |
| 293 | 301 | public function setVocab($vocabid) |
| 294 | 302 | { |
| 295 | - if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string |
|
| 303 | + if (strpos($vocabid, ' ') !== false) { |
|
| 304 | + // if there are multiple vocabularies just storing the string |
|
| 296 | 305 | { |
| 297 | 306 | $this->setVocabids($vocabid); |
| 307 | + } |
|
| 298 | 308 | } else { |
| 299 | 309 | $this->vocab = $this->model->getVocabulary($vocabid); |
| 300 | 310 | } |