@@ -407,7 +407,9 @@ discard block |
||
407 | 407 | $hits[] = $res; |
408 | 408 | } |
409 | 409 | } |
410 | - if (sizeof($hits) > 0) return $hits; |
|
410 | + if (sizeof($hits) > 0) { |
|
411 | + return $hits; |
|
412 | + } |
|
411 | 413 | |
412 | 414 | // case 2: case-insensitive match on preferred label |
413 | 415 | foreach ($results as $res) { |
@@ -415,7 +417,9 @@ discard block |
||
415 | 417 | $hits[] = $res; |
416 | 418 | } |
417 | 419 | } |
418 | - if (sizeof($hits) > 0) return $hits; |
|
420 | + if (sizeof($hits) > 0) { |
|
421 | + return $hits; |
|
422 | + } |
|
419 | 423 | |
420 | 424 | // case 3: exact match on alternate label |
421 | 425 | foreach ($results as $res) { |
@@ -423,7 +427,9 @@ discard block |
||
423 | 427 | $hits[] = $res; |
424 | 428 | } |
425 | 429 | } |
426 | - if (sizeof($hits) > 0) return $hits; |
|
430 | + if (sizeof($hits) > 0) { |
|
431 | + return $hits; |
|
432 | + } |
|
427 | 433 | |
428 | 434 | |
429 | 435 | // case 4: case-insensitive match on alternate label |
@@ -114,6 +114,9 @@ discard block |
||
114 | 114 | return $this->returnJson($ret); |
115 | 115 | } |
116 | 116 | |
117 | + /** |
|
118 | + * @param Request $request |
|
119 | + */ |
|
117 | 120 | private function constructSearchParameters($request) |
118 | 121 | { |
119 | 122 | $parameters = new ConceptSearchParameters($request, $this->model->getConfig(), true); |
@@ -129,6 +132,9 @@ discard block |
||
129 | 132 | return $parameters; |
130 | 133 | } |
131 | 134 | |
135 | + /** |
|
136 | + * @param Request $request |
|
137 | + */ |
|
132 | 138 | private function transformSearchResults($request, $results) |
133 | 139 | { |
134 | 140 | // before serializing to JSON, get rid of the Vocabulary object that came with each resource |
@@ -504,6 +510,9 @@ discard block |
||
504 | 510 | return $this->returnJson($ret); |
505 | 511 | } |
506 | 512 | |
513 | + /** |
|
514 | + * @param Request $request |
|
515 | + */ |
|
507 | 516 | private function redirectToVocabData($request) { |
508 | 517 | $urls = $request->getVocab()->getConfig()->getDataURLs(); |
509 | 518 | if (sizeof($urls) == 0) { |
@@ -519,6 +528,9 @@ discard block |
||
519 | 528 | header("Location: " . $urls[$format]); |
520 | 529 | } |
521 | 530 | |
531 | + /** |
|
532 | + * @param string $format |
|
533 | + */ |
|
522 | 534 | private function returnDataResults($results, $format) { |
523 | 535 | if ($format == 'application/ld+json' || $format == 'application/json') { |
524 | 536 | // further compact JSON-LD document using a context |
@@ -606,6 +618,12 @@ discard block |
||
606 | 618 | return $this->returnJson($ret); |
607 | 619 | } |
608 | 620 | |
621 | + /** |
|
622 | + * @param string $uri |
|
623 | + * @param string $lang |
|
624 | + * @param string $propname |
|
625 | + * @param string $propuri |
|
626 | + */ |
|
609 | 627 | private function transformPropertyResults($uri, $lang, $objects, $propname, $propuri) |
610 | 628 | { |
611 | 629 | foreach ($objects as $objuri => $vals) { |
@@ -620,6 +638,14 @@ discard block |
||
620 | 638 | return $ret; |
621 | 639 | } |
622 | 640 | |
641 | + /** |
|
642 | + * @param string $uri |
|
643 | + * @param string $lang |
|
644 | + * @param string $tpropname |
|
645 | + * @param string $tpropuri |
|
646 | + * @param string $dpropname |
|
647 | + * @param string $dpropuri |
|
648 | + */ |
|
623 | 649 | private function transformTransitivePropertyResults($uri, $lang, $objects, $tpropname, $tpropuri, $dpropname, $dpropuri) |
624 | 650 | { |
625 | 651 | $results = array(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // wrap with JSONP callback if requested |
44 | 44 | if (filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_STRING)) { |
45 | 45 | header("Content-type: application/javascript; charset=utf-8"); |
46 | - echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW) . "(" . json_encode($data) . ");"; |
|
46 | + echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW)."(".json_encode($data).");"; |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | // convert to vocids array to support multi-vocabulary search |
123 | 123 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : array(); |
124 | 124 | $vocabObjects = array(); |
125 | - foreach($vocids as $vocid) { |
|
125 | + foreach ($vocids as $vocid) { |
|
126 | 126 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
127 | 127 | } |
128 | 128 | $parameters->setVocabularies($vocabObjects); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | if ($request->getQueryParam('labellang')) { |
169 | 169 | $ret['@context']['@language'] = $request->getQueryParam('labellang'); |
170 | 170 | } elseif ($request->getQueryParam('lang')) { |
171 | - $ret['@context']['@language'] = $request->getQueryParam('lang');; |
|
171 | + $ret['@context']['@language'] = $request->getQueryParam('lang'); ; |
|
172 | 172 | } |
173 | 173 | return $ret; |
174 | 174 | } |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | |
514 | 514 | $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format')); |
515 | 515 | if (!$format) { |
516 | - return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls))); |
|
516 | + return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls))); |
|
517 | 517 | } |
518 | 518 | |
519 | - header("Location: " . $urls[$format]); |
|
519 | + header("Location: ".$urls[$format]); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | private function returnDataResults($results, $format) { |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | |
571 | 571 | $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format')); |
572 | 572 | if (!$format) { |
573 | - return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS); |
|
573 | + return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | $vocid = $vocab ? $vocab->getId() : null; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | // register a Twig filter for generating URLs for vocabulary resources (concepts and groups) |
71 | 71 | $controller = $this; // for use by anonymous function below |
72 | - $urlFilter = new Twig_SimpleFilter('link_url', function ($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) { |
|
72 | + $urlFilter = new Twig_SimpleFilter('link_url', function($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) { |
|
73 | 73 | // $vocab can either be null, a vocabulary id (string) or a Vocabulary object |
74 | 74 | if ($vocab === null) { |
75 | 75 | // target vocabulary is unknown, best bet is to link to the plain URI |
@@ -94,23 +94,23 @@ discard block |
||
94 | 94 | $localname = $vocab->getLocalName($uri); |
95 | 95 | if ($localname !== $uri && $localname === urlencode($localname)) { |
96 | 96 | // check that the prefix stripping worked, and there are no problematic chars in localname |
97 | - $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : ''; |
|
97 | + $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : ''; |
|
98 | 98 | if ($type && $type !== '' && $type !== 'vocab') { |
99 | - return "$vocid/$lang/$type/$localname" . $paramstr; |
|
99 | + return "$vocid/$lang/$type/$localname".$paramstr; |
|
100 | 100 | } |
101 | 101 | |
102 | - return "$vocid/$lang/$localname" . $paramstr; |
|
102 | + return "$vocid/$lang/$localname".$paramstr; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // case 2: URI outside vocabulary namespace, or has problematic chars |
106 | 106 | // pass the full URI as parameter instead |
107 | 107 | $params['uri'] = $uri; |
108 | - return "$vocid/$lang/$type/?" . http_build_query($params); |
|
108 | + return "$vocid/$lang/$type/?".http_build_query($params); |
|
109 | 109 | }); |
110 | 110 | $this->twig->addFilter($urlFilter); |
111 | 111 | |
112 | 112 | // register a Twig filter for generating strings from language codes with CLDR |
113 | - $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) { |
|
113 | + $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) { |
|
114 | 114 | return Language::getName($langcode, $lang); |
115 | 115 | }); |
116 | 116 | $this->twig->addFilter($langFilter); |
@@ -259,17 +259,17 @@ discard block |
||
259 | 259 | { |
260 | 260 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
261 | 261 | if ($fromVocab !== null) { |
262 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
262 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
263 | 263 | } |
264 | 264 | |
265 | - $subject = SERVICE_NAME . " feedback"; |
|
265 | + $subject = SERVICE_NAME." feedback"; |
|
266 | 266 | $headers = "MIME-Version: 1.0″ . '\r\n"; |
267 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
267 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
268 | 268 | if ($toMail) { |
269 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
269 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
270 | 270 | } |
271 | 271 | |
272 | - $headers .= "From: $fromName <$fromEmail>" . "\r\n" . 'X-Mailer: PHP/' . phpversion(); |
|
272 | + $headers .= "From: $fromName <$fromEmail>"."\r\n".'X-Mailer: PHP/'.phpversion(); |
|
273 | 273 | $envelopeSender = FEEDBACK_ENVELOPE_SENDER; |
274 | 274 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
275 | 275 | |
@@ -279,11 +279,11 @@ discard block |
||
279 | 279 | $ipAddress = (filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_SANITIZE_STRING)) ? filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_SANITIZE_STRING) : ''; |
280 | 280 | $timestamp = date(DATE_RFC2822); |
281 | 281 | |
282 | - $message = $message . "<br /><br /> Debugging information:" |
|
283 | - . "<br />Timestamp: " . $timestamp |
|
284 | - . "<br />User agent: " . $agent |
|
285 | - . "<br />IP address: " . $ipAddress |
|
286 | - . "<br />Referer: " . $referer; |
|
282 | + $message = $message."<br /><br /> Debugging information:" |
|
283 | + . "<br />Timestamp: ".$timestamp |
|
284 | + . "<br />User agent: ".$agent |
|
285 | + . "<br />IP address: ".$ipAddress |
|
286 | + . "<br />Referer: ".$referer; |
|
287 | 287 | |
288 | 288 | try { |
289 | 289 | mail($toAddress, $subject, $message, $headers, $params); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | header("HTTP/1.0 404 Not Found"); |
292 | 292 | $template = $this->twig->loadTemplate('error-page.twig'); |
293 | 293 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
294 | - error_log('Caught exception: ' . $e->getMessage()); |
|
294 | + error_log('Caught exception: '.$e->getMessage()); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | echo $template->render( |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
339 | 339 | $vocabObjects = array(); |
340 | 340 | if ($vocids) { |
341 | - foreach($vocids as $vocid) { |
|
341 | + foreach ($vocids as $vocid) { |
|
342 | 342 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
343 | 343 | } |
344 | 344 | } |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | } catch (Exception $e) { |
350 | 350 | header("HTTP/1.0 404 Not Found"); |
351 | 351 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
352 | - error_log('Caught exception: ' . $e->getMessage()); |
|
352 | + error_log('Caught exception: '.$e->getMessage()); |
|
353 | 353 | } |
354 | 354 | $this->invokeGenericErrorPage($request, $e->getMessage()); |
355 | 355 | return; |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | 'search_count' => $counts, |
366 | 366 | 'languages' => $this->languages, |
367 | 367 | 'search_results' => $search_results, |
368 | - 'rest' => $parameters->getOffset()>0, |
|
368 | + 'rest' => $parameters->getOffset() > 0, |
|
369 | 369 | 'global_search' => true, |
370 | 370 | 'term' => $request->getQueryParam('q'), |
371 | 371 | 'lang_list' => $langList, |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | } catch (Exception $e) { |
391 | 391 | header("HTTP/1.0 404 Not Found"); |
392 | 392 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
393 | - error_log('Caught exception: ' . $e->getMessage()); |
|
393 | + error_log('Caught exception: '.$e->getMessage()); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | echo $template->render( |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | } catch (Exception $e) { |
412 | 412 | header("HTTP/1.0 404 Not Found"); |
413 | 413 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
414 | - error_log('Caught exception: ' . $e->getMessage()); |
|
414 | + error_log('Caught exception: '.$e->getMessage()); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | echo $template->render( |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | 'vocab' => $vocab, |
429 | 429 | 'search_results' => $search_results, |
430 | 430 | 'search_count' => $counts, |
431 | - 'rest' => $parameters->getOffset()>0, |
|
431 | + 'rest' => $parameters->getOffset() > 0, |
|
432 | 432 | 'limit_parent' => $parameters->getParentLimit(), |
433 | 433 | 'limit_type' => $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null, |
434 | 434 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
554 | 554 | * @param Request $request |
555 | 555 | */ |
556 | - public function invokeChangeList($request, $prop='dc:created') |
|
556 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
557 | 557 | { |
558 | 558 | // set language parameters for gettext |
559 | 559 | $this->setLanguageProperties($request->getLang()); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $baseurl = $this->getBaseHref(); |
22 | 22 | $vocid = $vocab->getId(); |
23 | 23 | $query = http_build_query(array('uri'=>$uri, 'format'=>$targetFormat)); |
24 | - $url = $baseurl . "rest/v1/$vocid/data?$query"; |
|
24 | + $url = $baseurl."rest/v1/$vocid/data?$query"; |
|
25 | 25 | $this->redirect303($url); |
26 | 26 | } |
27 | 27 | |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | $localname = $vocab->getLocalName($uri); |
33 | 33 | if ($localname !== $uri && $localname === urlencode($localname)) { |
34 | 34 | // the URI can be shortened |
35 | - $url = $baseurl . "$vocid/page/$localname"; |
|
35 | + $url = $baseurl."$vocid/page/$localname"; |
|
36 | 36 | } else { |
37 | 37 | // must use full URI |
38 | 38 | $query = http_build_query(array('uri'=>$uri)); |
39 | - $url = $baseurl . "$vocid/page/?" . $query; |
|
39 | + $url = $baseurl."$vocid/page/?".$query; |
|
40 | 40 | } |
41 | 41 | $this->redirect303($url); |
42 | 42 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | } |
15 | 15 | require_once 'vendor/autoload.php'; |
16 | 16 | } catch (Exception $e) { |
17 | - echo "Error: " . $e->getMessage(); |
|
17 | + echo "Error: ".$e->getMessage(); |
|
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // if language code missing, redirect to guessed language |
33 | 33 | // in any case, redirect to <lang>/ |
34 | 34 | $lang = sizeof($parts) == 2 && $parts[1] !== '' ? $parts[1] : $controller->guessLanguage(); |
35 | - header("Location: " . $lang . "/"); |
|
35 | + header("Location: ".$lang."/"); |
|
36 | 36 | } else { |
37 | 37 | if (array_key_exists($parts[1], $config->getLanguages())) { // global pages |
38 | 38 | $request->setLang($parts[1]); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | if (sizeof($parts) == 3) { // language code missing |
63 | 63 | $lang = $controller->guessLanguage(); |
64 | - header("Location: " . $lang . "/"); |
|
64 | + header("Location: ".$lang."/"); |
|
65 | 65 | } else { |
66 | 66 | if (array_key_exists($parts[2], $config->getLanguages())) { |
67 | 67 | $lang = $parts[2]; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | } else { // language code missing, redirect to some language version |
104 | 104 | $lang = $controller->guessLanguage($vocab); |
105 | - $pattern = '|' . preg_quote("/$vocab/") . '|'; |
|
105 | + $pattern = '|'.preg_quote("/$vocab/").'|'; |
|
106 | 106 | $location = preg_replace($pattern, "/$vocab/$lang/", $request->getServerConstant('REQUEST_URI'), 1); |
107 | 107 | header("Location: $location"); |
108 | 108 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } elseif ($parts[1] == 'data') { |
38 | 38 | $controller->data($request); |
39 | 39 | } elseif (sizeof($parts) == 2) { |
40 | - header("Location: " . $parts[1] . "/"); |
|
40 | + header("Location: ".$parts[1]."/"); |
|
41 | 41 | } else { |
42 | 42 | $vocab = $parts[1]; |
43 | 43 | try { |
@@ -93,5 +93,5 @@ discard block |
||
93 | 93 | } |
94 | 94 | } catch (Exception $e) { |
95 | 95 | header("HTTP/1.0 500 Internal Server Error"); |
96 | - echo('ERROR: ' . $e->getMessage()); |
|
96 | + echo('ERROR: '.$e->getMessage()); |
|
97 | 97 | } |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | // 3. label in any language |
119 | 119 | $label = $this->resource->label(); |
120 | 120 | // if the label lang code is a subset of the ui lang eg. en-GB |
121 | - if ($label !== null && strpos($label->getLang(), $this->getEnvLang() . '-') === 0) { |
|
121 | + if ($label !== null && strpos($label->getLang(), $this->getEnvLang().'-') === 0) { |
|
122 | 122 | return $label->getValue(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | if ($label !== null) { |
126 | - return $label->getValue() . " (" . $label->getLang() . ")"; |
|
126 | + return $label->getValue()." (".$label->getLang().")"; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // empty |
@@ -448,14 +448,14 @@ discard block |
||
448 | 448 | |
449 | 449 | // making a human readable string from the timestamps |
450 | 450 | if ($created != '') { |
451 | - $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short')); |
|
451 | + $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short')); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | if ($modified != '') { |
455 | 455 | if ($created != '') { |
456 | - $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
456 | + $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
457 | 457 | } else { |
458 | - $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
458 | + $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | } |
@@ -463,12 +463,12 @@ discard block |
||
463 | 463 | trigger_error($e->getMessage(), E_USER_WARNING); |
464 | 464 | $ret = ''; |
465 | 465 | if ($this->resource->get('dc:modified')) { |
466 | - $modified = (string) $this->resource->get('dc:modified'); |
|
467 | - $ret = gettext('skosmos:modified') . ' ' . $modified; |
|
466 | + $modified = (string)$this->resource->get('dc:modified'); |
|
467 | + $ret = gettext('skosmos:modified').' '.$modified; |
|
468 | 468 | } |
469 | 469 | if ($this->resource->get('dc:created')) { |
470 | - $created .= (string) $this->resource->get('dc:created'); |
|
471 | - $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
|
470 | + $created .= (string)$this->resource->get('dc:created'); |
|
471 | + $ret .= ' '.gettext('skosmos:created').' '.$created; |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | return $ret; |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | $labels = array(); |
556 | 556 | foreach ($this->resource->allLiterals('skos:prefLabel') as $lit) { |
557 | 557 | // filtering away subsets of the current language eg. en vs en-GB |
558 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
558 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
559 | 559 | $langName = Punic\Language::getName($lit->getLang(), $this->getEnvLang()) !== $lit->getLang() ? Punic\Language::getName($lit->getLang(), $this->getEnvLang()) : gettext($lit->getLang()); |
560 | 560 | $labels[$langName][] = new ConceptPropertyValueLiteral($lit, 'skos:prefLabel'); |
561 | 561 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | } |
564 | 564 | foreach ($this->resource->allLiterals('skos:altLabel') as $lit) { |
565 | 565 | // filtering away subsets of the current language eg. en vs en-GB |
566 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
566 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
567 | 567 | $langName = Punic\Language::getName($lit->getLang(), $this->getEnvLang()) ? Punic\Language::getName($lit->getLang(), $this->getEnvLang()) : gettext($lit->getLang()); |
568 | 568 | $labels[$langName][] = new ConceptPropertyValueLiteral($lit, 'skos:altLabel'); |
569 | 569 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // 1. Ensure characters with special meaning in Lucene are escaped |
45 | 45 | $lucenemap = array(); |
46 | 46 | foreach (str_split($this->LUCENE_ESCAPE_CHARS) as $char) { |
47 | - $lucenemap[$char] = '\\' . $char; // escape with a backslash |
|
47 | + $lucenemap[$char] = '\\'.$char; // escape with a backslash |
|
48 | 48 | } |
49 | 49 | $term = strtr($term, $lucenemap); |
50 | 50 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | |
103 | 103 | # make text query clause |
104 | 104 | $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe |
105 | - $textcond_pref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $lang); |
|
106 | - $textcond_alt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $lang); |
|
105 | + $textcond_pref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $lang); |
|
106 | + $textcond_alt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $lang); |
|
107 | 107 | |
108 | 108 | $query = <<<EOQ |
109 | 109 | SELECT DISTINCT ?s ?label ?alabel |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param string $prop property type eg. 'rdf:type'. |
22 | 22 | * @param string $label |
23 | 23 | */ |
24 | - public function __construct($prop, $label, $super=null) |
|
24 | + public function __construct($prop, $label, $super = null) |
|
25 | 25 | { |
26 | 26 | $this->prop = $prop; |
27 | 27 | $this->label = $label; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getDescription() |
61 | 61 | { |
62 | - $helpprop = $this->prop . "_help"; |
|
62 | + $helpprop = $this->prop."_help"; |
|
63 | 63 | |
64 | 64 | return gettext($helpprop); // can't use string constant, it'd be picked up by xgettext |
65 | 65 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | public function addValue($value) |
80 | 80 | { |
81 | - $this->values[$value->getLabel() . $value->getUri()] = $value; |
|
81 | + $this->values[$value->getLabel().$value->getUri()] = $value; |
|
82 | 82 | $this->is_sorted = false; |
83 | 83 | } |
84 | 84 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | if (!empty($this->values)) { |
88 | 88 | uksort($this->values, function($a, $b) { |
89 | - return strnatcasecmp($a,$b); |
|
89 | + return strnatcasecmp($a, $b); |
|
90 | 90 | }); |
91 | 91 | } |
92 | 92 | $this->is_sorted = true; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | { |
25 | 25 | $label = is_string($this->getLabel()) ? $this->getLabel() : $this->getLabel()->getValue(); |
26 | 26 | if ($this->vocab->getConfig()->sortByNotation()) { |
27 | - $label = $this->getNotation() . $label; |
|
27 | + $label = $this->getNotation().$label; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | return $label; |