@@ -44,7 +44,7 @@ |
||
| 44 | 44 | * @param string $lang preferred language for the literal |
| 45 | 45 | * @return string string value for the given property, or the default value if not found |
| 46 | 46 | */ |
| 47 | - protected function getLiteral($property, $default=null, $lang=null) |
|
| 47 | + protected function getLiteral($property, $default = null, $lang = null) |
|
| 48 | 48 | { |
| 49 | 49 | if (!isset($lang)) { |
| 50 | 50 | $lang = $this->getEnvLang(); |
@@ -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 | } |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | return $this->resource->label($fallback); |
| 137 | 137 | } |
| 138 | 138 | // We need to check all the labels in case one of them matches a subtag of the current language |
| 139 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
| 139 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
| 140 | 140 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
| 141 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
| 141 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
| 142 | 142 | return EasyRdf\Literal::create($label, $fallback); |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | public function hasXlLabel($prop = 'prefLabel') |
| 161 | 161 | { |
| 162 | - if ($this->resource->hasProperty('skosxl:' . $prop)) { |
|
| 162 | + if ($this->resource->hasProperty('skosxl:'.$prop)) { |
|
| 163 | 163 | return true; |
| 164 | 164 | } |
| 165 | 165 | return false; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | public function getXlLabel() |
| 169 | 169 | { |
| 170 | 170 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
| 171 | - foreach($labels as $labres) { |
|
| 171 | + foreach ($labels as $labres) { |
|
| 172 | 172 | $label = $labres->getLiteral('skosxl:literalForm'); |
| 173 | 173 | if ($label !== null && $label->getLang() == $this->clang) { |
| 174 | 174 | return new LabelSkosXL($this->model, $labres); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | // catch external subjects that have $res as object |
| 276 | 276 | $extSubjects = $exGraph->resourcesMatching("schema:about", $res); |
| 277 | 277 | |
| 278 | - $propList = array_unique(array_merge( |
|
| 278 | + $propList = array_unique(array_merge( |
|
| 279 | 279 | $this->DEFAULT_EXT_PROPERTIES, |
| 280 | 280 | $this->getVocab()->getConfig()->getExtProperties(), |
| 281 | 281 | $this->getVocab()->getConfig()->getPluginRegister()->getExtProperties() |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param string[] $seen Processed resources so far |
| 301 | 301 | * @param string[] $props (optional) limit to these property URIs |
| 302 | 302 | */ |
| 303 | - private function addExternalTriplesToGraph($res, &$seen, $props=null) |
|
| 303 | + private function addExternalTriplesToGraph($res, &$seen, $props = null) |
|
| 304 | 304 | { |
| 305 | 305 | if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) { |
| 306 | 306 | return; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | private function addPropertyValues($res, $prop, &$seen) |
| 332 | 332 | { |
| 333 | - $resList = $res->allResources('<' . $prop . '>'); |
|
| 333 | + $resList = $res->allResources('<'.$prop.'>'); |
|
| 334 | 334 | |
| 335 | 335 | foreach ($resList as $res2) { |
| 336 | 336 | if ($res2->isBNode()) { |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | $this->addResourceReifications($res, $prop, $res2, $seen); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $litList = $res->allLiterals('<' . $prop . '>'); |
|
| 343 | + $litList = $res->allLiterals('<'.$prop.'>'); |
|
| 344 | 344 | |
| 345 | 345 | foreach ($litList as $lit) { |
| 346 | 346 | $this->graph->addLiteral($res, $prop, $lit); |
@@ -528,15 +528,15 @@ discard block |
||
| 528 | 528 | // if not found in current vocabulary, look up in the default graph to be able |
| 529 | 529 | // to read an ontology loaded in a separate graph |
| 530 | 530 | // note that this imply that the property has an rdf:type declared for the query to work |
| 531 | - if(!$is_well_known && !$proplabel) { |
|
| 531 | + if (!$is_well_known && !$proplabel) { |
|
| 532 | 532 | $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang()); |
| 533 | 533 | |
| 534 | 534 | $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, ''); |
| 535 | 535 | |
| 536 | - if($envLangLabels) { |
|
| 536 | + if ($envLangLabels) { |
|
| 537 | 537 | $proplabel = $envLangLabels[$this->getEnvLang()]; |
| 538 | 538 | } else { |
| 539 | - if($defaultPropLabel) { |
|
| 539 | + if ($defaultPropLabel) { |
|
| 540 | 540 | $proplabel = $defaultPropLabel['']; |
| 541 | 541 | } |
| 542 | 542 | } |
@@ -549,12 +549,12 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | // also look up superprops in the default graph if not found in current vocabulary |
| 552 | - if(!$is_well_known && (!$superprops || empty($superprops))) { |
|
| 552 | + if (!$is_well_known && (!$superprops || empty($superprops))) { |
|
| 553 | 553 | $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri); |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | // we're reading only one super property, even if there are multiple ones |
| 557 | - $superprop = ($superprops)?$superprops[0]:null; |
|
| 557 | + $superprop = ($superprops) ? $superprops[0] : null; |
|
| 558 | 558 | if ($superprop) { |
| 559 | 559 | $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop; |
| 560 | 560 | } |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | // searching for subproperties of literals too |
| 570 | - if($superprops) { |
|
| 570 | + if ($superprops) { |
|
| 571 | 571 | foreach ($superprops as $subi) { |
| 572 | 572 | $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi; |
| 573 | 573 | $duplicates[$suburi] = $prop; |
@@ -729,14 +729,14 @@ discard block |
||
| 729 | 729 | |
| 730 | 730 | // making a human readable string from the timestamps |
| 731 | 731 | if ($created != '') { |
| 732 | - $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short', $this->getEnvLang())); |
|
| 732 | + $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short', $this->getEnvLang())); |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | if ($modified != '') { |
| 736 | 736 | if ($created != '') { |
| 737 | - $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
| 737 | + $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
| 738 | 738 | } else { |
| 739 | - $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
| 739 | + $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang())); |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | } |
@@ -744,12 +744,12 @@ discard block |
||
| 744 | 744 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 745 | 745 | $ret = ''; |
| 746 | 746 | if ($this->resource->get('dc:modified')) { |
| 747 | - $modified = (string) $this->resource->get('dc:modified'); |
|
| 748 | - $ret = gettext('skosmos:modified') . ' ' . $modified; |
|
| 747 | + $modified = (string)$this->resource->get('dc:modified'); |
|
| 748 | + $ret = gettext('skosmos:modified').' '.$modified; |
|
| 749 | 749 | } |
| 750 | 750 | if ($this->resource->get('dc:created')) { |
| 751 | - $created .= (string) $this->resource->get('dc:created'); |
|
| 752 | - $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
|
| 751 | + $created .= (string)$this->resource->get('dc:created'); |
|
| 752 | + $ret .= ' '.gettext('skosmos:created').' '.$created; |
|
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | return $ret; |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | $groups[$collLabel] = array($group); |
| 822 | 822 | |
| 823 | 823 | $res = $collection; |
| 824 | - while($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
| 824 | + while ($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
| 825 | 825 | foreach ($super as $res) { |
| 826 | 826 | $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang); |
| 827 | 827 | array_unshift($groups[$collLabel], $superprop); |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | |
| 867 | 867 | foreach ($labels as $lit) { |
| 868 | 868 | // filtering away subsets of the current language eg. en vs en-GB |
| 869 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
| 869 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
| 870 | 870 | $langCode = $lit->getLang() ? $lit->getLang() : ''; |
| 871 | 871 | $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop); |
| 872 | 872 | } |
@@ -958,10 +958,10 @@ discard block |
||
| 958 | 958 | } |
| 959 | 959 | else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
| 960 | 960 | $i = 2; |
| 961 | - while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) { |
|
| 961 | + while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) { |
|
| 962 | 962 | $i += 1; |
| 963 | 963 | } |
| 964 | - $context[$vocabPrefix . $i] = $vocabUriSpace; |
|
| 964 | + $context[$vocabPrefix.$i] = $vocabUriSpace; |
|
| 965 | 965 | } |
| 966 | 966 | } |
| 967 | 967 | $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context)); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | "skos:related", "skos:historyNote", "skosmos:memberOf", |
| 29 | 29 | "skosmos:memberOfArray"); |
| 30 | 30 | |
| 31 | - public function __construct($resource, $globalPlugins=array()) |
|
| 31 | + public function __construct($resource, $globalPlugins = array()) |
|
| 32 | 32 | { |
| 33 | 33 | $this->resource = $resource; |
| 34 | 34 | $this->globalPlugins = $globalPlugins; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $paramValue = $paramLiteral->getValue(); |
| 118 | 118 | $paramLang = $paramLiteral->getLang(); |
| 119 | 119 | if ($paramLang) { |
| 120 | - $paramName .= '_' . $paramLang; |
|
| 120 | + $paramName .= '_'.$paramLang; |
|
| 121 | 121 | } |
| 122 | 122 | $this->pluginParameters[$pluginName][$paramName] = $paramValue; |
| 123 | 123 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $langs = $this->getLanguages(); |
| 184 | 184 | $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric |
| 185 | 185 | if (sizeof($langs) > 1) { |
| 186 | - trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
| 186 | + trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | return $deflang; |
@@ -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 |
@@ -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 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | return isset($results[$lang]) ? $results[$lang] : null; |
| 53 | 53 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 54 | 54 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 55 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 55 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | return isset($results) ? $results : null; |
| 75 | 75 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 76 | 76 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 77 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 77 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -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; |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit); |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | - public function getTitle($lang=null) { |
|
| 667 | + public function getTitle($lang = null) { |
|
| 668 | 668 | return $this->config->getTitle($lang); |
| 669 | 669 | } |
| 670 | 670 | |