@@ -72,7 +72,7 @@ |
||
| 72 | 72 | return $help; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - // if not, see if there was a comment/definition for the property in the graph |
|
| 75 | + // if not, see if there was a comment/definition for the property in the graph |
|
| 76 | 76 | if ($this->tooltip !== null) { |
| 77 | 77 | return $this->tooltip; |
| 78 | 78 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @param string $super URI of superproperty |
| 28 | 28 | * @param boolean $sort_by_notation whether to sort the property values by their notation code |
| 29 | 29 | */ |
| 30 | - public function __construct($prop, $label, $tooltip=null, $super=null, $sort_by_notation=false) |
|
| 30 | + public function __construct($prop, $label, $tooltip = null, $super = null, $sort_by_notation = false) |
|
| 31 | 31 | { |
| 32 | 32 | $this->prop = $prop; |
| 33 | 33 | $this->label = $label; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function getDescription() |
| 69 | 69 | { |
| 70 | - $helpprop = $this->prop . "_help"; |
|
| 70 | + $helpprop = $this->prop."_help"; |
|
| 71 | 71 | |
| 72 | 72 | // see if we have a translation with the help text |
| 73 | 73 | $help = gettext($helpprop); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | public function addValue($value) |
| 100 | 100 | { |
| 101 | - $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel() . rtrim(' ' . $value->getUri())] = $value; |
|
| 101 | + $this->values[ltrim($value->getNotation().' ').$value->getLabel().rtrim(' '.$value->getUri())] = $value; |
|
| 102 | 102 | $this->is_sorted = false; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -125,11 +125,9 @@ discard block |
||
| 125 | 125 | return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel())); |
| 126 | 126 | } |
| 127 | 127 | return 1; |
| 128 | - } |
|
| 129 | - else if ($bnot == null) { |
|
| 128 | + } else if ($bnot == null) { |
|
| 130 | 129 | return -1; |
| 131 | - } |
|
| 132 | - else { |
|
| 130 | + } else { |
|
| 133 | 131 | // assume that notations are unique, choose strategy |
| 134 | 132 | if ($this->sort_by_notation == "lexical") { |
| 135 | 133 | return strcoll($anot, $bnot); |
@@ -138,8 +136,7 @@ discard block |
||
| 138 | 136 | } |
| 139 | 137 | } |
| 140 | 138 | }); |
| 141 | - } |
|
| 142 | - else { |
|
| 139 | + } else { |
|
| 143 | 140 | uasort($this->values, function($a, $b) { |
| 144 | 141 | // assume that labels are unique |
| 145 | 142 | return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel())); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $label = $this->getLabel(); |
| 38 | 38 | $notation = $this->getNotation(); |
| 39 | - return ltrim($notation . ' ') . $label; |
|
| 39 | + return ltrim($notation.' ').$label; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function getType() |
@@ -180,25 +180,25 @@ discard block |
||
| 180 | 180 | 'from' => [ |
| 181 | 181 | 'memberSet' => [ |
| 182 | 182 | [ |
| 183 | - 'uri' => (string) $this->source->getUri(), |
|
| 183 | + 'uri' => (string)$this->source->getUri(), |
|
| 184 | 184 | ] |
| 185 | 185 | ] |
| 186 | 186 | ], |
| 187 | 187 | 'to' => [ |
| 188 | 188 | 'memberSet' => [ |
| 189 | 189 | [ |
| 190 | - 'uri' => (string) $this->getUri() |
|
| 190 | + 'uri' => (string)$this->getUri() |
|
| 191 | 191 | ] |
| 192 | 192 | ] |
| 193 | 193 | ], |
| 194 | 194 | // EXTRA |
| 195 | 195 | 'hrefLink' => $hrefLink, // link to resource as displayed in the UI |
| 196 | 196 | 'lang' => $propertyLang, // TBD: could it be part of the prefLabel? |
| 197 | - 'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI |
|
| 197 | + 'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI |
|
| 198 | 198 | 'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch |
| 199 | 199 | ]; |
| 200 | 200 | |
| 201 | - $helpprop = $this->type . "_help"; |
|
| 201 | + $helpprop = $this->type."_help"; |
|
| 202 | 202 | // see if we have a translation for the property help text |
| 203 | 203 | $help = gettext($helpprop); |
| 204 | 204 | if ($help != $helpprop) { |
@@ -208,20 +208,20 @@ discard block |
||
| 208 | 208 | $fromScheme = $this->vocab->getDefaultConceptScheme(); |
| 209 | 209 | if (isset($fromScheme)) { |
| 210 | 210 | $ret['fromScheme'] = [ |
| 211 | - 'uri' => (string) $fromScheme, |
|
| 211 | + 'uri' => (string)$fromScheme, |
|
| 212 | 212 | ]; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $exvocab = $this->getExvocab(); |
| 216 | 216 | if (isset($exvocab)) { |
| 217 | 217 | $ret['toScheme'] = [ |
| 218 | - 'uri' => (string) $exvocab->getDefaultConceptScheme(), |
|
| 218 | + 'uri' => (string)$exvocab->getDefaultConceptScheme(), |
|
| 219 | 219 | ]; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | $notation = $this->getNotation(); |
| 223 | 223 | if (isset($notation)) { |
| 224 | - $ret['to']['memberSet'][0]['notation'] = (string) $notation; |
|
| 224 | + $ret['to']['memberSet'][0]['notation'] = (string)$notation; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $label = $this->getLabel($lang, $queryExVocabs); |
@@ -354,10 +354,12 @@ |
||
| 354 | 354 | // register vocabulary ids as RDF namespace prefixes |
| 355 | 355 | $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters |
| 356 | 356 | try { |
| 357 | - if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) // if not already defined |
|
| 357 | + if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) { |
|
| 358 | + // if not already defined |
|
| 358 | 359 | { |
| 359 | 360 | EasyRdf\RdfNamespace::set($prefix, $voc->getUriSpace()); |
| 360 | 361 | } |
| 362 | + } |
|
| 361 | 363 | |
| 362 | 364 | } catch (Exception $e) { |
| 363 | 365 | // not valid as namespace identifier, ignore |
@@ -220,18 +220,18 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | $vocabs = $params->getVocabs(); |
| 223 | - $showDeprecated=false; |
|
| 223 | + $showDeprecated = false; |
|
| 224 | 224 | if (sizeof($vocabs) === 1) { // search within vocabulary |
| 225 | 225 | $voc = $vocabs[0]; |
| 226 | 226 | $sparql = $voc->getSparql(); |
| 227 | - $showDeprecated=$voc->getConfig()->getShowDeprecated(); |
|
| 227 | + $showDeprecated = $voc->getConfig()->getShowDeprecated(); |
|
| 228 | 228 | } else { // multi-vocabulary or global search |
| 229 | 229 | $voc = null; |
| 230 | 230 | $sparql = $this->getDefaultSparql(); |
| 231 | 231 | // @TODO : in a global search showDeprecated will always be false and cannot be set globally |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params,$showDeprecated); |
|
| 234 | + $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params, $showDeprecated); |
|
| 235 | 235 | if ($params->getRest() && $results && $params->getSearchLimit() !== 0) { |
| 236 | 236 | $results = array_slice($results, $params->getOffset(), $params->getSearchLimit()); |
| 237 | 237 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | public function getVocabularyCategories() |
| 387 | 387 | { |
| 388 | 388 | $cats = $this->globalConfig->getGraph()->allOfType('skos:Concept'); |
| 389 | - if(empty($cats)) { |
|
| 389 | + if (empty($cats)) { |
|
| 390 | 390 | return array(new VocabularyCategory($this, null)); |
| 391 | 391 | } |
| 392 | 392 | |
@@ -467,9 +467,9 @@ discard block |
||
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | // if there are multiple vocabularies and one is the preferred vocabulary, return it |
| 470 | - if($preferredVocabId != null) { |
|
| 470 | + if ($preferredVocabId != null) { |
|
| 471 | 471 | foreach ($vocabs as $vocab) { |
| 472 | - if($vocab->getId() == $preferredVocabId) { |
|
| 472 | + if ($vocab->getId() == $preferredVocabId) { |
|
| 473 | 473 | try { |
| 474 | 474 | // double check that a label exists in the preferred vocabulary |
| 475 | 475 | if ($vocab->getConceptLabel($uri, null) !== null) { |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | } |
| 481 | 481 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 482 | 482 | if ($this->getConfig()->getLogCaughtExceptions()) { |
| 483 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 483 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 484 | 484 | } |
| 485 | 485 | break; |
| 486 | 486 | } |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | } |
| 497 | 497 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 498 | 498 | if ($this->getConfig()->getLogCaughtExceptions()) { |
| 499 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 499 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 500 | 500 | } |
| 501 | 501 | break; |
| 502 | 502 | } |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | // using apc cache for the resource if available |
| 567 | 567 | if ($this->globalConfig->getCache()->isAvailable()) { |
| 568 | 568 | // @codeCoverageIgnoreStart |
| 569 | - $key = 'fetch: ' . $uri; |
|
| 569 | + $key = 'fetch: '.$uri; |
|
| 570 | 570 | $resource = $this->globalConfig->getCache()->fetch($key); |
| 571 | 571 | if ($resource === null || $resource === false) { // was not found in cache, or previous request failed |
| 572 | 572 | $resource = $this->resolver->resolve($uri, $this->getConfig()->getHttpTimeout()); |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | */ |
| 588 | 588 | public function getSparqlImplementation($dialect, $endpoint, $graph) |
| 589 | 589 | { |
| 590 | - $classname = $dialect . "Sparql"; |
|
| 590 | + $classname = $dialect."Sparql"; |
|
| 591 | 591 | |
| 592 | 592 | return new $classname($endpoint, $graph, $this); |
| 593 | 593 | } |
@@ -266,11 +266,17 @@ |
||
| 266 | 266 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
| 267 | 267 | // determine the sender address of the message |
| 268 | 268 | $sender = $this->model->getConfig()->getFeedbackSender(); |
| 269 | - if (empty($sender)) $sender = $envelopeSender; |
|
| 270 | - if (empty($sender)) $sender = $this->model->getConfig()->getFeedbackAddress(); |
|
| 269 | + if (empty($sender)) { |
|
| 270 | + $sender = $envelopeSender; |
|
| 271 | + } |
|
| 272 | + if (empty($sender)) { |
|
| 273 | + $sender = $this->model->getConfig()->getFeedbackAddress(); |
|
| 274 | + } |
|
| 271 | 275 | |
| 272 | 276 | // determine sender name - default to "anonymous user" if not given by user |
| 273 | - if (empty($fromName)) $fromName = "anonymous user"; |
|
| 277 | + if (empty($fromName)) { |
|
| 278 | + $fromName = "anonymous user"; |
|
| 279 | + } |
|
| 274 | 280 | $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender); |
| 275 | 281 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
| 276 | 282 | // adding some information about the user for debugging purposes. |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | // specify where to look for templates and cache |
| 38 | 38 | $loader = new Twig_Loader_Filesystem('view'); |
| 39 | 39 | // initialize Twig environment |
| 40 | - $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true)); |
|
| 40 | + $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true)); |
|
| 41 | 41 | $this->twig->addExtension(new Twig_Extensions_Extension_I18n()); |
| 42 | 42 | // used for setting the base href for the relative urls |
| 43 | 43 | $this->twig->addGlobal("BaseHref", $this->getBaseHref()); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter'))); |
| 61 | 61 | |
| 62 | 62 | // register a Twig filter for generating strings from language codes with CLDR |
| 63 | - $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) { |
|
| 63 | + $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) { |
|
| 64 | 64 | return Language::getName($langcode, $lang); |
| 65 | 65 | }); |
| 66 | 66 | $this->twig->addFilter($langFilter); |
@@ -234,16 +234,16 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender) |
| 236 | 236 | { |
| 237 | - $headers = "MIME-Version: 1.0" . "\r\n"; |
|
| 238 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
| 237 | + $headers = "MIME-Version: 1.0"."\r\n"; |
|
| 238 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
| 239 | 239 | if (!empty($toMail)) { |
| 240 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
| 240 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
| 241 | 241 | } |
| 242 | 242 | if (!empty($fromEmail)) { |
| 243 | 243 | $headers .= "Reply-To: $fromName <$fromEmail>\r\n"; |
| 244 | 244 | } |
| 245 | 245 | $service = $this->model->getConfig()->getServiceName(); |
| 246 | - return $headers . "From: $fromName via $service <$sender>"; |
|
| 246 | + return $headers."From: $fromName via $service <$sender>"; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null) |
| 258 | 258 | { |
| 259 | 259 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
| 260 | - $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject; |
|
| 260 | + $messageSubject = "[".$this->model->getConfig()->getServiceName()."] ".$messageSubject; |
|
| 261 | 261 | if ($fromVocab !== null && $fromVocab !== '') { |
| 262 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
| 262 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
| 263 | 263 | } |
| 264 | 264 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
| 265 | 265 | // determine the sender address of the message |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender); |
| 273 | 273 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
| 274 | 274 | // adding some information about the user for debugging purposes. |
| 275 | - $message = $message . "<br /><br /> Debugging information:" |
|
| 276 | - . "<br />Timestamp: " . date(DATE_RFC2822) |
|
| 277 | - . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT') |
|
| 278 | - . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER'); |
|
| 275 | + $message = $message."<br /><br /> Debugging information:" |
|
| 276 | + . "<br />Timestamp: ".date(DATE_RFC2822) |
|
| 277 | + . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT') |
|
| 278 | + . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER'); |
|
| 279 | 279 | |
| 280 | 280 | try { |
| 281 | 281 | mail($toAddress, $messageSubject, $message, $headers, $params); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | header("HTTP/1.0 404 Not Found"); |
| 284 | 284 | $template = $this->twig->loadTemplate('error-page.twig'); |
| 285 | 285 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 286 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 286 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | echo $template->render( |
@@ -328,13 +328,13 @@ discard block |
||
| 328 | 328 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
| 329 | 329 | $vocabObjects = array(); |
| 330 | 330 | if ($vocids) { |
| 331 | - foreach($vocids as $vocid) { |
|
| 331 | + foreach ($vocids as $vocid) { |
|
| 332 | 332 | try { |
| 333 | 333 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
| 334 | 334 | } catch (ValueError $e) { |
| 335 | 335 | // fail fast with an error page if the vocabulary cannot be found |
| 336 | 336 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 337 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 337 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 338 | 338 | } |
| 339 | 339 | header("HTTP/1.0 400 Bad Request"); |
| 340 | 340 | $this->invokeGenericErrorPage($request, $e->getMessage()); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $errored = true; |
| 357 | 357 | header("HTTP/1.0 500 Internal Server Error"); |
| 358 | 358 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 359 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 359 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | $vocabList = $this->model->getVocabularyList(); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | 'search_count' => $counts, |
| 369 | 369 | 'languages' => $this->languages, |
| 370 | 370 | 'search_results' => $searchResults, |
| 371 | - 'rest' => $parameters->getOffset()>0, |
|
| 371 | + 'rest' => $parameters->getOffset() > 0, |
|
| 372 | 372 | 'global_search' => true, |
| 373 | 373 | 'search_failed' => $errored, |
| 374 | 374 | 'term' => $request->getQueryParamRaw('q'), |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | } catch (Exception $e) { |
| 396 | 396 | header("HTTP/1.0 500 Internal Server Error"); |
| 397 | 397 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 398 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 398 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | echo $template->render( |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | } catch (Exception $e) { |
| 420 | 420 | header("HTTP/1.0 404 Not Found"); |
| 421 | 421 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 422 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 422 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | echo $template->render( |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | 'vocab' => $vocab, |
| 438 | 438 | 'search_results' => $searchResults, |
| 439 | 439 | 'search_count' => $counts, |
| 440 | - 'rest' => $parameters->getOffset()>0, |
|
| 440 | + 'rest' => $parameters->getOffset() > 0, |
|
| 441 | 441 | 'limit_parent' => $parameters->getParentLimit(), |
| 442 | 442 | 'limit_type' => $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null, |
| 443 | 443 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
| 570 | 570 | * @param Request $request |
| 571 | 571 | */ |
| 572 | - public function invokeChangeList($request, $prop='dc:created') |
|
| 572 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
| 573 | 573 | { |
| 574 | 574 | $offset = ($request->getQueryParam('offset') && is_numeric($request->getQueryParam('offset')) && $request->getQueryParam('offset') >= 0) ? $request->getQueryParam('offset') : 0; |
| 575 | 575 | $limit = ($request->getQueryParam('limit') && is_numeric($request->getQueryParam('limit')) && $request->getQueryParam('limit') >= 0) ? $request->getQueryParam('limit') : 200; |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | * @param int $limit maximum number of concepts to return |
| 598 | 598 | * @return Array list of concepts |
| 599 | 599 | */ |
| 600 | - public function getChangeList($request, $prop, $offset=0, $limit=200) |
|
| 600 | + public function getChangeList($request, $prop, $offset = 0, $limit = 200) |
|
| 601 | 601 | { |
| 602 | 602 | // set language parameters for gettext |
| 603 | 603 | $this->setLanguageProperties($request->getLang()); |
@@ -614,9 +614,9 @@ discard block |
||
| 614 | 614 | public function formatChangeList($changeList, $lang) |
| 615 | 615 | { |
| 616 | 616 | $formatByDate = array(); |
| 617 | - foreach($changeList as $concept) { |
|
| 617 | + foreach ($changeList as $concept) { |
|
| 618 | 618 | $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang); |
| 619 | - $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept; |
|
| 619 | + $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept; |
|
| 620 | 620 | } |
| 621 | 621 | return $formatByDate; |
| 622 | 622 | } |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | // Encrypt the current time |
| 34 | 34 | $honey_time_encrypted = $this->getEncryptedTime(); |
| 35 | - return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" . |
|
| 36 | - '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" . |
|
| 37 | - '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" . |
|
| 35 | + return '<div id="'.$honey_name.'_wrap" style="display:none;">'."\r\n". |
|
| 36 | + '<input name="'.$honey_name.'" type="text" value="" id="'.$honey_name.'"/>'."\r\n". |
|
| 37 | + '<input name="'.$honey_time.'" type="text" value="'.$honey_time_encrypted.'"/>'."\r\n". |
|
| 38 | 38 | '</div>'; |
| 39 | 39 | } |
| 40 | 40 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // Get the decrypted time |
| 67 | 67 | $value = $this->decryptTime($value); |
| 68 | 68 | // The current time should be greater than the time the form was built + minimum |
| 69 | - return ( is_numeric($value) && time() > ($value + $minDelta) ); |
|
| 69 | + return (is_numeric($value) && time() > ($value + $minDelta)); |
|
| 70 | 70 | } |
| 71 | 71 | /** |
| 72 | 72 | * Get encrypted time |
@@ -33,16 +33,16 @@ |
||
| 33 | 33 | // Encrypt the current time |
| 34 | 34 | $honey_time_encrypted = $this->getEncryptedTime(); |
| 35 | 35 | return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" . |
| 36 | - '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" . |
|
| 37 | - '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" . |
|
| 36 | + '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" . |
|
| 37 | + '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" . |
|
| 38 | 38 | '</div>'; |
| 39 | 39 | } |
| 40 | 40 | /** |
| 41 | - * Validate honeypot is empty |
|
| 42 | - * |
|
| 43 | - * @param mixed $value |
|
| 44 | - * @return boolean |
|
| 45 | - */ |
|
| 41 | + * Validate honeypot is empty |
|
| 42 | + * |
|
| 43 | + * @param mixed $value |
|
| 44 | + * @return boolean |
|
| 45 | + */ |
|
| 46 | 46 | public function validateHoneypot($value) : bool |
| 47 | 47 | { |
| 48 | 48 | if ($this->disabled) { |
@@ -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 | foreach ($this->resource->allLiterals($prop) as $val) { |
| 162 | 162 | if ($prop !== 'rdf:value') { // shown elsewhere |
@@ -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 | } |
@@ -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($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($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) { |