@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | $sparql = $this->getSparql(); |
| 164 | 164 | $result = $sparql->queryConceptScheme($defaultcs); |
| 165 | 165 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 166 | - if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
| 167 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 168 | - } |
|
| 169 | - return null; |
|
| 166 | + if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
| 167 | + error_log('Caught exception: ' . $e->getMessage()); |
|
| 168 | + } |
|
| 169 | + return null; |
|
| 170 | 170 | } |
| 171 | 171 | $conceptscheme = $result->resource($defaultcs); |
| 172 | 172 | $this->order = array( |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | try { |
| 254 | 254 | $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang); |
| 255 | 255 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 256 | - if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
| 257 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 258 | - } |
|
| 256 | + if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
| 257 | + error_log('Caught exception: ' . $e->getMessage()); |
|
| 258 | + } |
|
| 259 | 259 | } |
| 260 | 260 | return $conceptSchemes; |
| 261 | 261 | } |
@@ -453,9 +453,9 @@ discard block |
||
| 453 | 453 | try { |
| 454 | 454 | $conceptInfo = $sparql->queryConceptInfo($uri, $this->config->getArrayClassURI(), array($this), $clang); |
| 455 | 455 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 456 | - if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
| 457 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 458 | - } |
|
| 456 | + if ($this->model->getConfig()->getLogCaughtExceptions()) { |
|
| 457 | + error_log('Caught exception: ' . $e->getMessage()); |
|
| 458 | + } |
|
| 459 | 459 | } |
| 460 | 460 | return $conceptInfo; |
| 461 | 461 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | return $lname; |
| 103 | 103 | } |
| 104 | 104 | // already a full URI |
| 105 | - return $this->getUriSpace() . $lname; |
|
| 105 | + return $this->getUriSpace().$lname; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $result = $sparql->queryConceptScheme($defaultcs); |
| 165 | 165 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 166 | 166 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 167 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 167 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 168 | 168 | } |
| 169 | 169 | return null; |
| 170 | 170 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | foreach ($conceptscheme->allLiterals($prop, null) as $val) { |
| 198 | 198 | $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop; |
| 199 | 199 | if ($val->getValue() instanceof DateTime) { |
| 200 | - $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
| 200 | + $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
| 201 | 201 | } |
| 202 | 202 | $ret[$prop][] = $val; |
| 203 | 203 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang); |
| 255 | 255 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 256 | 256 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 257 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 257 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | return $conceptSchemes; |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | // don't know how to parse |
| 327 | 327 | $rev = $parts[2]; |
| 328 | - $datestr = $parts[3] . ' ' . $parts[4]; |
|
| 328 | + $datestr = $parts[3].' '.$parts[4]; |
|
| 329 | 329 | |
| 330 | 330 | return "$datestr (r$rev)"; |
| 331 | 331 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * @param string $array the uri of the concept array class, eg. isothes:ThesaurusArray |
| 337 | 337 | * @param string $group the uri of the concept group class, eg. isothes:ConceptGroup |
| 338 | 338 | */ |
| 339 | - public function getStatistics($lang = '', $array=null, $group=null) |
|
| 339 | + public function getStatistics($lang = '', $array = null, $group = null) |
|
| 340 | 340 | { |
| 341 | 341 | $sparql = $this->getSparql(); |
| 342 | 342 | // find the number of concepts |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $conceptInfo = $sparql->queryConceptInfo($uri, $this->config->getArrayClassURI(), array($this), $clang); |
| 455 | 455 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 456 | 456 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 457 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 457 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 458 | 458 | } |
| 459 | 459 | } |
| 460 | 460 | return $conceptInfo; |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit, $showDeprecated); |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - public function getTitle($lang=null) { |
|
| 668 | + public function getTitle($lang = null) { |
|
| 669 | 669 | return $this->config->getTitle($lang); |
| 670 | 670 | } |
| 671 | 671 | |
@@ -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 | } |
@@ -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 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | "skos:related", "skos:historyNote", "skosmos:memberOf", |
| 30 | 30 | "skosmos:memberOfArray"); |
| 31 | 31 | |
| 32 | - public function __construct($resource, $globalPlugins=array()) |
|
| 32 | + public function __construct($resource, $globalPlugins = array()) |
|
| 33 | 33 | { |
| 34 | 34 | $this->resource = $resource; |
| 35 | 35 | $this->globalPlugins = $globalPlugins; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $paramValue = $paramLiteral->getValue(); |
| 119 | 119 | $paramLang = $paramLiteral->getLang(); |
| 120 | 120 | if ($paramLang) { |
| 121 | - $paramName .= '_' . $paramLang; |
|
| 121 | + $paramName .= '_'.$paramLang; |
|
| 122 | 122 | } |
| 123 | 123 | $this->pluginParameters[$pluginName][$paramName] = $paramValue; |
| 124 | 124 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $labelProperty = $override->getResource('skosmos:property'); |
| 151 | 151 | $labelPropUri = $labelProperty->shorten(); |
| 152 | 152 | if (empty($this->labelOverrides[$labelPropUri])) { |
| 153 | - $this->labelOverrides[$labelPropUri] = array(); |
|
| 153 | + $this->labelOverrides[$labelPropUri] = array(); |
|
| 154 | 154 | } |
| 155 | 155 | $newOverrides = array(); |
| 156 | 156 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $langs = $this->getLanguages(); |
| 225 | 225 | $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric |
| 226 | 226 | if (sizeof($langs) > 1) { |
| 227 | - trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
| 227 | + trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | return $deflang; |
@@ -159,7 +159,7 @@ |
||
| 159 | 159 | } |
| 160 | 160 | $descriptions = $override->allLiterals('rdfs:comment'); //optionally override property label tooltips |
| 161 | 161 | foreach ($descriptions as $description) { |
| 162 | - $newOverrides['description'][$description->getLang()] = $description->getValue(); |
|
| 162 | + $newOverrides['description'][$description->getLang()] = $description->getValue(); |
|
| 163 | 163 | } |
| 164 | 164 | $this->labelOverrides[$labelPropUri] = array_merge($newOverrides, $this->labelOverrides[$labelPropUri]); |
| 165 | 165 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | public function getPrefLabel() { |
| 12 | 12 | $label = null; |
| 13 | 13 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
| 14 | - foreach($labels as $labres) { |
|
| 14 | + foreach ($labels as $labres) { |
|
| 15 | 15 | $label = $labres->getLiteral('skosxl:literalForm'); |
| 16 | 16 | if ($label->getLang() == $this->clang) { |
| 17 | 17 | return $label; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function getProperties() { |
| 24 | 24 | $ret = array(); |
| 25 | 25 | $props = $this->resource->properties(); |
| 26 | - foreach($props as $prop) { |
|
| 26 | + foreach ($props as $prop) { |
|
| 27 | 27 | if ($prop !== 'rdf:type' && $prop !== 'skosxl:literalForm') { |
| 28 | 28 | // make sure to use the correct gettext keys for DC namespace |
| 29 | 29 | $propkey = str_starts_with($prop, 'dc11:') ? |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | // We need to check all the labels in case one of them matches a subtag of the current language |
| 55 | 55 | if ($this->resource->allLiterals('skos:prefLabel')) { |
| 56 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
| 56 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
| 57 | 57 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
| 58 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
| 58 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
| 59 | 59 | return EasyRdf\Literal::create($label, $fallback); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function getReifiedPropertyValues() { |
| 157 | 157 | $ret = array(); |
| 158 | 158 | $props = $this->resource->propertyUris(); |
| 159 | - foreach($props as $prop) { |
|
| 159 | + foreach ($props as $prop) { |
|
| 160 | 160 | $prop = (EasyRdf\RdfNamespace::shorten($prop) !== null) ? EasyRdf\RdfNamespace::shorten($prop) : $prop; |
| 161 | 161 | $propkey = str_starts_with($prop, 'dc11:') ? |
| 162 | 162 | str_replace('dc11:', 'dc:', $prop) : $prop; |
@@ -71,11 +71,11 @@ |
||
| 71 | 71 | if ((!isset($term) || strlen(trim($term)) === 0) && $this->rest) |
| 72 | 72 | $term = $this->request->getQueryParamRaw('label'); |
| 73 | 73 | $term = trim(strval($term)); // surrounding whitespace is not considered significant |
| 74 | - $term = Normalizer::normalize( $term, Normalizer::FORM_C ); //Normalize decomposed unicode characters #1184 |
|
| 74 | + $term = Normalizer::normalize($term, Normalizer::FORM_C); //Normalize decomposed unicode characters #1184 |
|
| 75 | 75 | if ($this->rest) { |
| 76 | 76 | return $term; |
| 77 | 77 | } |
| 78 | - return strpos($term, "*") === false ? $term . "*" : $term; // default to prefix search |
|
| 78 | + return strpos($term, "*") === false ? $term."*" : $term; // default to prefix search |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function getContentLang() |
@@ -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,7 +69,7 @@ discard block |
||
| 69 | 69 | return Punic\Calendar::formatDate($val, 'short'); |
| 70 | 70 | } catch (Exception $e) { |
| 71 | 71 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 72 | - return (string) $this->literal; |
|
| 72 | + return (string)$this->literal; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | return $this->literal->getValue(); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $graph = $this->resource->getGraph(); |
| 97 | 97 | $labelResources = $graph->resourcesMatching('skosxl:literalForm', $this->literal); |
| 98 | - foreach($labelResources as $labres) { |
|
| 98 | + foreach ($labelResources as $labres) { |
|
| 99 | 99 | $xlLabel = new LabelSkosXL($this->model, $labres); |
| 100 | 100 | if ($xlLabel->getLang() == $this->getLang()) { |
| 101 | 101 | return $xlLabel; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | } |
| 10 | 10 | require_once 'vendor/autoload.php'; |
| 11 | 11 | } catch (Exception $e) { |
| 12 | - echo "Error: " . $e->getMessage(); |
|
| 12 | + echo "Error: ".$e->getMessage(); |
|
| 13 | 13 | return; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | // if language code missing, redirect to guessed language |
| 28 | 28 | // in any case, redirect to <lang>/ |
| 29 | 29 | $lang = sizeof($parts) == 2 && $parts[1] !== '' ? $parts[1] : $controller->guessLanguage($request); |
| 30 | - header("Location: " . $lang . "/"); |
|
| 30 | + header("Location: ".$lang."/"); |
|
| 31 | 31 | } else { |
| 32 | 32 | if (array_key_exists($parts[1], $config->getLanguages())) { // global pages |
| 33 | 33 | $request->setLang($parts[1]); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | if (sizeof($parts) == 3) { // language code missing |
| 58 | 58 | $lang = $controller->guessLanguage($request); |
| 59 | - $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/"; |
|
| 60 | - header("Location: " . $newurl); |
|
| 59 | + $newurl = $controller->getBaseHref().$vocab."/".$lang."/"; |
|
| 60 | + header("Location: ".$newurl); |
|
| 61 | 61 | } else { |
| 62 | 62 | if (array_key_exists($parts[2], $config->getLanguages())) { |
| 63 | 63 | $lang = $parts[2]; |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | } else { // language code missing, redirect to some language version |
| 100 | 100 | $lang = $controller->guessLanguage($request, $vocab); |
| 101 | - $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/" . implode('/', array_slice($parts, 2)); |
|
| 101 | + $newurl = $controller->getBaseHref().$vocab."/".$lang."/".implode('/', array_slice($parts, 2)); |
|
| 102 | 102 | $qs = $request->getServerConstant('QUERY_STRING'); |
| 103 | 103 | if ($qs) { |
| 104 | - $newurl .= "?" . $qs; |
|
| 104 | + $newurl .= "?".$qs; |
|
| 105 | 105 | } |
| 106 | 106 | header("Location: $newurl"); |
| 107 | 107 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | * @param int $maxlength maximum length of parameter, or null if unlimited |
| 124 | 124 | * @return string parameter content, or null if no parameter found |
| 125 | 125 | */ |
| 126 | - public function getQueryParamPOST($paramName, $maxlength=null) |
|
| 126 | + public function getQueryParamPOST($paramName, $maxlength = null) |
|
| 127 | 127 | { |
| 128 | 128 | if (!isset($this->queryParamsPOST[$paramName])) return null; |
| 129 | 129 | $val = filter_var($this->queryParamsPOST[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | public function getRequestUri() |
| 216 | 216 | { |
| 217 | - return $this->getServerConstant('HTTP_HOST') . $this->getServerConstant('REQUEST_URI'); |
|
| 217 | + return $this->getServerConstant('HTTP_HOST').$this->getServerConstant('REQUEST_URI'); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @param string $newlang new UI language to set |
| 223 | 223 | * @return string the relative url of the page |
| 224 | 224 | */ |
| 225 | - public function getLangUrl($newlang=null) |
|
| 225 | + public function getLangUrl($newlang = null) |
|
| 226 | 226 | { |
| 227 | 227 | $script_name = str_replace('/index.php', '', $this->getServerConstant('SCRIPT_NAME')); |
| 228 | 228 | $langurl = substr(str_replace($script_name, '', strval($this->getServerConstant('REQUEST_URI'))), 1); |
@@ -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 | } |