@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | return $this->resource->label($fallback); |
138 | 138 | } |
139 | 139 | // We need to check all the labels in case one of them matches a subtag of the current language |
140 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
140 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
141 | 141 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
142 | - if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) { |
|
142 | + if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) { |
|
143 | 143 | return EasyRdf\Literal::create($label, $fallback); |
144 | 144 | } |
145 | 145 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | public function hasXlLabel($prop = 'prefLabel') |
162 | 162 | { |
163 | - if ($this->resource->hasProperty('skosxl:' . $prop)) { |
|
163 | + if ($this->resource->hasProperty('skosxl:'.$prop)) { |
|
164 | 164 | return true; |
165 | 165 | } |
166 | 166 | return false; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | public function getXlLabel() |
170 | 170 | { |
171 | 171 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
172 | - foreach($labels as $labres) { |
|
172 | + foreach ($labels as $labres) { |
|
173 | 173 | $label = $labres->getLiteral('skosxl:literalForm'); |
174 | 174 | if ($label !== null && $label->getLang() == $this->clang) { |
175 | 175 | return new LabelSkosXL($this->model, $labres); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | // catch external subjects that have $res as object |
277 | 277 | $extSubjects = $exGraph->resourcesMatching("schema:about", $res); |
278 | 278 | |
279 | - $propList = array_unique(array_merge( |
|
279 | + $propList = array_unique(array_merge( |
|
280 | 280 | $this->DEFAULT_EXT_PROPERTIES, |
281 | 281 | $this->getVocab()->getConfig()->getExtProperties(), |
282 | 282 | $this->getVocab()->getConfig()->getPlugins()->getExtProperties() |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @param string[] $seen Processed resources so far |
302 | 302 | * @param string[] $props (optional) limit to these property URIs |
303 | 303 | */ |
304 | - private function addExternalTriplesToGraph($res, &$seen, $props=null) |
|
304 | + private function addExternalTriplesToGraph($res, &$seen, $props = null) |
|
305 | 305 | { |
306 | 306 | if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) { |
307 | 307 | return; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | */ |
332 | 332 | private function addPropertyValues($res, $prop, &$seen) |
333 | 333 | { |
334 | - $resList = $res->allResources('<' . $prop . '>'); |
|
334 | + $resList = $res->allResources('<'.$prop.'>'); |
|
335 | 335 | |
336 | 336 | foreach ($resList as $res2) { |
337 | 337 | if ($res2->isBNode()) { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $this->addResourceReifications($res, $prop, $res2, $seen); |
342 | 342 | } |
343 | 343 | |
344 | - $litList = $res->allLiterals('<' . $prop . '>'); |
|
344 | + $litList = $res->allLiterals('<'.$prop.'>'); |
|
345 | 345 | |
346 | 346 | foreach ($litList as $lit) { |
347 | 347 | $this->graph->addLiteral($res, $prop, $lit); |
@@ -523,15 +523,15 @@ discard block |
||
523 | 523 | // if not found in current vocabulary, look up in the default graph to be able |
524 | 524 | // to read an ontology loaded in a separate graph |
525 | 525 | // note that this imply that the property has an rdf:type declared for the query to work |
526 | - if(!$is_well_known && !$proplabel) { |
|
526 | + if (!$is_well_known && !$proplabel) { |
|
527 | 527 | $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang()); |
528 | 528 | |
529 | 529 | $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, ''); |
530 | 530 | |
531 | - if($envLangLabels) { |
|
531 | + if ($envLangLabels) { |
|
532 | 532 | $proplabel = $envLangLabels[$this->getEnvLang()]; |
533 | 533 | } else { |
534 | - if($defaultPropLabel) { |
|
534 | + if ($defaultPropLabel) { |
|
535 | 535 | $proplabel = $defaultPropLabel['']; |
536 | 536 | } |
537 | 537 | } |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | // also look up superprops in the default graph if not found in current vocabulary |
547 | - if(!$is_well_known && (!$superprops || empty($superprops))) { |
|
547 | + if (!$is_well_known && (!$superprops || empty($superprops))) { |
|
548 | 548 | $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri); |
549 | 549 | } |
550 | 550 | |
551 | 551 | // we're reading only one super property, even if there are multiple ones |
552 | - $superprop = ($superprops)?$superprops[0]:null; |
|
552 | + $superprop = ($superprops) ? $superprops[0] : null; |
|
553 | 553 | if ($superprop) { |
554 | 554 | $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop; |
555 | 555 | } |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | } |
563 | 563 | |
564 | 564 | // searching for subproperties of literals too |
565 | - if($superprops) { |
|
565 | + if ($superprops) { |
|
566 | 566 | foreach ($superprops as $subi) { |
567 | 567 | $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi; |
568 | 568 | $duplicates[$suburi] = $prop; |
@@ -708,14 +708,14 @@ discard block |
||
708 | 708 | |
709 | 709 | // making a human readable string from the timestamps |
710 | 710 | if ($created != '') { |
711 | - $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short')); |
|
711 | + $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short')); |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | if ($modified != '') { |
715 | 715 | if ($created != '') { |
716 | - $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
716 | + $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
717 | 717 | } else { |
718 | - $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
718 | + $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | } |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | trigger_error($e->getMessage(), E_USER_WARNING); |
724 | 724 | $ret = ''; |
725 | 725 | if ($this->resource->get('dc:modified')) { |
726 | - $modified = (string) $this->resource->get('dc:modified'); |
|
727 | - $ret = gettext('skosmos:modified') . ' ' . $modified; |
|
726 | + $modified = (string)$this->resource->get('dc:modified'); |
|
727 | + $ret = gettext('skosmos:modified').' '.$modified; |
|
728 | 728 | } |
729 | 729 | if ($this->resource->get('dc:created')) { |
730 | - $created .= (string) $this->resource->get('dc:created'); |
|
731 | - $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
|
730 | + $created .= (string)$this->resource->get('dc:created'); |
|
731 | + $ret .= ' '.gettext('skosmos:created').' '.$created; |
|
732 | 732 | } |
733 | 733 | } |
734 | 734 | return $ret; |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $groups[$collLabel] = array($group); |
801 | 801 | |
802 | 802 | $res = $collection; |
803 | - while($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
803 | + while ($super = $this->graph->resourcesMatching('skos:member', $res)) { |
|
804 | 804 | foreach ($super as $res) { |
805 | 805 | $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang); |
806 | 806 | array_unshift($groups[$collLabel], $superprop); |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | |
846 | 846 | foreach ($labels as $lit) { |
847 | 847 | // filtering away subsets of the current language eg. en vs en-GB |
848 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
848 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
849 | 849 | $langCode = $lit->getLang() ? $lit->getLang() : ''; |
850 | 850 | $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop); |
851 | 851 | } |
@@ -936,10 +936,10 @@ discard block |
||
936 | 936 | } |
937 | 937 | else if ($context[$vocabPrefix] !== $vocabUriSpace) { |
938 | 938 | $i = 2; |
939 | - while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) { |
|
939 | + while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) { |
|
940 | 940 | $i += 1; |
941 | 941 | } |
942 | - $context[$vocabPrefix . $i] = $vocabUriSpace; |
|
942 | + $context[$vocabPrefix.$i] = $vocabUriSpace; |
|
943 | 943 | } |
944 | 944 | } |
945 | 945 | $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 | $plugins = $this->resource->allLiterals('skosmos:usePlugin'); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $paramValue = $paramLiteral->getValue(); |
57 | 57 | $paramLang = $paramLiteral->getLang(); |
58 | 58 | if ($paramLang) { |
59 | - $paramName .= '_' . $paramLang; |
|
59 | + $paramName .= '_'.$paramLang; |
|
60 | 60 | } |
61 | 61 | $this->pluginParameters[$pluginName][$paramName] = $paramValue; |
62 | 62 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $langs = $this->getLanguages(); |
84 | 84 | $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric |
85 | 85 | if (sizeof($langs) > 1) { |
86 | - trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
86 | + trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return $deflang; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | protected function query($query) { |
89 | 89 | $queryId = sprintf("%05d", rand(0, 99999)); |
90 | 90 | $logger = $this->model->getLogger(); |
91 | - $logger->info("[qid $queryId] SPARQL query:\n" . $this->generateQueryPrefixes($query) . "\n$query\n"); |
|
91 | + $logger->info("[qid $queryId] SPARQL query:\n".$this->generateQueryPrefixes($query)."\n$query\n"); |
|
92 | 92 | $starttime = microtime(true); |
93 | 93 | $result = $this->client->query($query); |
94 | 94 | $elapsed = intval(round((microtime(true) - $starttime) * 1000)); |
95 | - if(method_exists($result, 'numRows')) { |
|
95 | + if (method_exists($result, 'numRows')) { |
|
96 | 96 | $numRows = $result->numRows(); |
97 | 97 | $logger->info("[qid $queryId] result: $numRows rows returned in $elapsed ms"); |
98 | 98 | } else { // graph result |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param Vocabulary[]|null $vocabs |
109 | 109 | * @return string |
110 | 110 | */ |
111 | - protected function generateFromClause($vocabs=null) { |
|
111 | + protected function generateFromClause($vocabs = null) { |
|
112 | 112 | $clause = ''; |
113 | 113 | if (!$vocabs) { |
114 | 114 | return $this->graph !== '?graph' && $this->graph !== NULL ? "FROM <$this->graph>" : ''; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $quote_string = function($val) { return "'$val'"; }; |
237 | 237 | $quoted_values = array_map($quote_string, $langs); |
238 | - $langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))"; |
|
238 | + $langFilter = "FILTER(?lang IN (".implode(',', $quoted_values)."))"; |
|
239 | 239 | |
240 | 240 | $values = $this->formatValues('?type', $classes, 'uri'); |
241 | 241 | $valuesProp = $this->formatValues('?prop', $props, null); |
@@ -661,9 +661,9 @@ discard block |
||
661 | 661 | $conceptscheme['title'] = $row->title->getValue(); |
662 | 662 | } |
663 | 663 | // add dct:subject and their labels in the result |
664 | - if(isset($row->domain) && isset($row->domainLabel)){ |
|
665 | - $conceptscheme['subject']['uri']=$row->domain->getURI(); |
|
666 | - $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue(); |
|
664 | + if (isset($row->domain) && isset($row->domainLabel)) { |
|
665 | + $conceptscheme['subject']['uri'] = $row->domain->getURI(); |
|
666 | + $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue(); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | $ret[$row->cs->getURI()] = $conceptscheme; |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | $values[] = "<$graph>"; |
731 | 731 | } |
732 | 732 | if (count($values)) { |
733 | - return "FILTER (?graph IN (" . implode(',', $values) . "))"; |
|
733 | + return "FILTER (?graph IN (".implode(',', $values)."))"; |
|
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
@@ -741,16 +741,16 @@ discard block |
||
741 | 741 | * @return string sparql query clauses |
742 | 742 | */ |
743 | 743 | protected function formatLimitAndOffset($limit, $offset) { |
744 | - $limit = ($limit) ? 'LIMIT ' . $limit : ''; |
|
745 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
744 | + $limit = ($limit) ? 'LIMIT '.$limit : ''; |
|
745 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
746 | 746 | // eliminating whitespace and line changes when the conditions aren't needed. |
747 | 747 | $limitandoffset = ''; |
748 | 748 | if ($limit && $offset) { |
749 | - $limitandoffset = "\n" . $limit . "\n" . $offset; |
|
749 | + $limitandoffset = "\n".$limit."\n".$offset; |
|
750 | 750 | } elseif ($limit) { |
751 | - $limitandoffset = "\n" . $limit; |
|
751 | + $limitandoffset = "\n".$limit; |
|
752 | 752 | } elseif ($offset) { |
753 | - $limitandoffset = "\n" . $offset; |
|
753 | + $limitandoffset = "\n".$offset; |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | return $limitandoffset; |
@@ -902,14 +902,14 @@ discard block |
||
902 | 902 | // if search language and UI/display language differ, must also consider case where there is no prefLabel in |
903 | 903 | // the display language; in that case, should use the label with the same language as the matched label |
904 | 904 | $labelcondFallback = ($searchLang != $lang) ? |
905 | - "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" . |
|
905 | + "OPTIONAL { # in case previous OPTIONAL block gives no labels\n". |
|
906 | 906 | "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : ""; |
907 | 907 | |
908 | 908 | // Including the labels if there is no query term given. |
909 | 909 | if ($rawterm === '') { |
910 | 910 | $labelClause = "?s skos:prefLabel ?label ."; |
911 | - $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . ""; |
|
912 | - return $labelClause . " BIND(?label AS ?match)"; |
|
911 | + $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause.""; |
|
912 | + return $labelClause." BIND(?label AS ?match)"; |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | /* |
@@ -981,20 +981,20 @@ discard block |
||
981 | 981 | $schemecond = ''; |
982 | 982 | if (!empty($schemes)) { |
983 | 983 | $conditions = array(); |
984 | - foreach($schemes as $scheme) { |
|
984 | + foreach ($schemes as $scheme) { |
|
985 | 985 | $conditions[] = "{?s skos:inScheme <$scheme>}"; |
986 | 986 | } |
987 | - $schemecond = '{'.implode(" UNION ",$conditions).'}'; |
|
987 | + $schemecond = '{'.implode(" UNION ", $conditions).'}'; |
|
988 | 988 | } |
989 | - $filterDeprecated=""; |
|
989 | + $filterDeprecated = ""; |
|
990 | 990 | //show or hide deprecated concepts |
991 | - if(!$showDeprecated){ |
|
992 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
991 | + if (!$showDeprecated) { |
|
992 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
993 | 993 | } |
994 | 994 | // extra conditions for parent and group, if specified |
995 | - $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : ""; |
|
996 | - $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : ""; |
|
997 | - $pgcond = $parentcond . $groupcond; |
|
995 | + $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : ""; |
|
996 | + $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : ""; |
|
997 | + $pgcond = $parentcond.$groupcond; |
|
998 | 998 | |
999 | 999 | $orderextra = $this->isDefaultEndpoint() ? $this->graph : ''; |
1000 | 1000 | |
@@ -1080,9 +1080,9 @@ discard block |
||
1080 | 1080 | $hit['type'][] = $this->shortenUri($typeuri); |
1081 | 1081 | } |
1082 | 1082 | |
1083 | - if(!empty($fields)) { |
|
1083 | + if (!empty($fields)) { |
|
1084 | 1084 | foreach ($fields as $prop) { |
1085 | - $propname = $prop . 's'; |
|
1085 | + $propname = $prop.'s'; |
|
1086 | 1086 | if (isset($row->$propname)) { |
1087 | 1087 | foreach (explode("\n", $row->$propname->getValue()) as $line) { |
1088 | 1088 | $rdata = str_getcsv($line, ',', '"', '"'); |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | $propvals = $rdata[2]; |
1098 | 1098 | } |
1099 | 1099 | |
1100 | - $hit['skos:' . $prop][] = $propvals; |
|
1100 | + $hit['skos:'.$prop][] = $propvals; |
|
1101 | 1101 | } |
1102 | 1102 | } |
1103 | 1103 | } |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | * @return array query result object |
1174 | 1174 | */ |
1175 | 1175 | public function queryConcepts($vocabs, $fields = null, $unique = false, $params, $showDeprecated = false) { |
1176 | - $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated); |
|
1176 | + $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated); |
|
1177 | 1177 | $results = $this->query($query); |
1178 | 1178 | return $this->transformConceptSearchResults($results, $vocabs, $fields); |
1179 | 1179 | } |
@@ -1228,10 +1228,10 @@ discard block |
||
1228 | 1228 | $conditions = $this->formatFilterConditions($letter, $lang); |
1229 | 1229 | $filtercondLabel = $conditions['filterpref']; |
1230 | 1230 | $filtercondALabel = $conditions['filteralt']; |
1231 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
1232 | - $filterDeprecated=""; |
|
1233 | - if(!$showDeprecated){ |
|
1234 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1231 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
1232 | + $filterDeprecated = ""; |
|
1233 | + if (!$showDeprecated) { |
|
1234 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
1235 | 1235 | } |
1236 | 1236 | $query = <<<EOQ |
1237 | 1237 | SELECT DISTINCT ?s ?label ?alabel ?qualifier $fcl |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | if (!isset($row->label) || $row->label->getLang() === $lang) { |
1702 | 1702 | $ret[$row->object->getUri()] = $val; |
1703 | 1703 | } elseif ($row->label->getLang() === $fallbacklang) { |
1704 | - $val['label'] .= ' (' . $row->label->getLang() . ')'; |
|
1704 | + $val['label'] .= ' ('.$row->label->getLang().')'; |
|
1705 | 1705 | $ret[$row->object->getUri()] = $val; |
1706 | 1706 | } |
1707 | 1707 | } |
@@ -1797,10 +1797,10 @@ discard block |
||
1797 | 1797 | |
1798 | 1798 | $label = null; |
1799 | 1799 | if (isset($row->label)) { |
1800 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
1800 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
1801 | 1801 | $label = $row->label->getValue(); |
1802 | 1802 | } else { |
1803 | - $label = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
1803 | + $label = $row->label->getValue()." (".$row->label->getLang().")"; |
|
1804 | 1804 | } |
1805 | 1805 | |
1806 | 1806 | } |
@@ -1876,8 +1876,8 @@ discard block |
||
1876 | 1876 | foreach ($result as $row) { |
1877 | 1877 | if (isset($row->top) && isset($row->label)) { |
1878 | 1878 | $label = $row->label->getValue(); |
1879 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
1880 | - $label .= ' (' . $row->label->getLang() . ')'; |
|
1879 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
1880 | + $label .= ' ('.$row->label->getLang().')'; |
|
1881 | 1881 | } |
1882 | 1882 | $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN)); |
1883 | 1883 | if (isset($row->notation)) { |
@@ -1970,7 +1970,7 @@ discard block |
||
1970 | 1970 | $ret[$uri]['exact'] = $row->exact->getUri(); |
1971 | 1971 | } |
1972 | 1972 | if (isset($row->tops)) { |
1973 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
1973 | + $topConceptsList = explode(" ", $row->tops->getValue()); |
|
1974 | 1974 | // sort to garantee an alphabetical ordering of the URI |
1975 | 1975 | sort($topConceptsList); |
1976 | 1976 | $ret[$uri]['tops'] = $topConceptsList; |
@@ -1983,8 +1983,8 @@ discard block |
||
1983 | 1983 | $label = null; |
1984 | 1984 | if (isset($row->childlabel)) { |
1985 | 1985 | $label = $row->childlabel->getValue(); |
1986 | - if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) { |
|
1987 | - $label .= " (" . $row->childlabel->getLang() . ")"; |
|
1986 | + if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) { |
|
1987 | + $label .= " (".$row->childlabel->getLang().")"; |
|
1988 | 1988 | } |
1989 | 1989 | |
1990 | 1990 | } |
@@ -2005,8 +2005,8 @@ discard block |
||
2005 | 2005 | } |
2006 | 2006 | if (isset($row->label)) { |
2007 | 2007 | $preflabel = $row->label->getValue(); |
2008 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
2009 | - $preflabel .= ' (' . $row->label->getLang() . ')'; |
|
2008 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
2009 | + $preflabel .= ' ('.$row->label->getLang().')'; |
|
2010 | 2010 | } |
2011 | 2011 | |
2012 | 2012 | $ret[$uri]['prefLabel'] = $preflabel; |
@@ -2127,9 +2127,9 @@ discard block |
||
2127 | 2127 | */ |
2128 | 2128 | private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) { |
2129 | 2129 | $fcl = $this->generateFromClause(); |
2130 | - $filterDeprecated=""; |
|
2131 | - if(!$showDeprecated){ |
|
2132 | - $filterDeprecated=" FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2130 | + $filterDeprecated = ""; |
|
2131 | + if (!$showDeprecated) { |
|
2132 | + $filterDeprecated = " FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
2133 | 2133 | } |
2134 | 2134 | $query = <<<EOQ |
2135 | 2135 | SELECT ?conc ?super ?label ?members ?type ?notation $fcl |
@@ -2168,10 +2168,10 @@ discard block |
||
2168 | 2168 | 'type' => array($row->type->shorten()), |
2169 | 2169 | ); |
2170 | 2170 | if (isset($row->label)) { |
2171 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
2171 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
2172 | 2172 | $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue(); |
2173 | 2173 | } else { |
2174 | - $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
2174 | + $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")"; |
|
2175 | 2175 | } |
2176 | 2176 | |
2177 | 2177 | } |
@@ -2199,8 +2199,8 @@ discard block |
||
2199 | 2199 | * @param boolean $showDeprecated whether to include deprecated concepts in search results |
2200 | 2200 | * @return array Result array with concept URI as key and concept label as value |
2201 | 2201 | */ |
2202 | - public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) { |
|
2203 | - $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated); |
|
2202 | + public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) { |
|
2203 | + $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated); |
|
2204 | 2204 | $result = $this->query($query); |
2205 | 2205 | return $this->transformConceptGroupContentsResults($result, $lang); |
2206 | 2206 | } |
@@ -2213,9 +2213,9 @@ discard block |
||
2213 | 2213 | * @param int $limit maximum number of results to return |
2214 | 2214 | * @return string sparql query |
2215 | 2215 | */ |
2216 | - private function generateChangeListQuery($prop, $lang, $offset, $limit=200) { |
|
2216 | + private function generateChangeListQuery($prop, $lang, $offset, $limit = 200) { |
|
2217 | 2217 | $fcl = $this->generateFromClause(); |
2218 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
2218 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
2219 | 2219 | |
2220 | 2220 | $query = <<<EOQ |
2221 | 2221 | SELECT DISTINCT ?concept ?date ?label $fcl |
@@ -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 |
@@ -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); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | return $lname; |
105 | 105 | } |
106 | 106 | // already a full URI |
107 | - return $this->getUriSpace() . $lname; |
|
107 | + return $this->getUriSpace().$lname; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | // query everything the endpoint knows about the ConceptScheme |
165 | 165 | $sparql = $this->getSparql(); |
166 | 166 | $result = $sparql->queryConceptScheme($defaultcs); |
167 | - } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
167 | + } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
168 | 168 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
169 | - error_log('Caught exception: ' . $e->getMessage()); |
|
169 | + error_log('Caught exception: '.$e->getMessage()); |
|
170 | 170 | } |
171 | 171 | return null; |
172 | 172 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | foreach ($conceptscheme->allLiterals($prop, null) as $val) { |
183 | 183 | $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop; |
184 | 184 | if ($val->getValue() instanceof DateTime) { |
185 | - $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
185 | + $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
186 | 186 | } |
187 | 187 | $ret[$prop][] = $val; |
188 | 188 | } |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | $conceptSchemes = null; |
238 | 238 | try { |
239 | 239 | $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang); |
240 | - } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
240 | + } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
241 | 241 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
242 | - error_log('Caught exception: ' . $e->getMessage()); |
|
242 | + error_log('Caught exception: '.$e->getMessage()); |
|
243 | 243 | } |
244 | 244 | } |
245 | 245 | return $conceptSchemes; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | // don't know how to parse |
312 | 312 | $rev = $parts[2]; |
313 | - $datestr = $parts[3] . ' ' . $parts[4]; |
|
313 | + $datestr = $parts[3].' '.$parts[4]; |
|
314 | 314 | |
315 | 315 | return "$datestr (r$rev)"; |
316 | 316 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * Counts the statistics of the vocabulary. |
320 | 320 | * @return array of the concept/group counts |
321 | 321 | */ |
322 | - public function getStatistics($lang = '', $array=null, $group=null) |
|
322 | + public function getStatistics($lang = '', $array = null, $group = null) |
|
323 | 323 | { |
324 | 324 | $sparql = $this->getSparql(); |
325 | 325 | // find the number of concepts |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | $conceptInfo = null; |
436 | 436 | try { |
437 | 437 | $conceptInfo = $sparql->queryConceptInfo($uri, $this->config->getArrayClassURI(), array($this), $clang); |
438 | - } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
438 | + } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
439 | 439 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
440 | - error_log('Caught exception: ' . $e->getMessage()); |
|
440 | + error_log('Caught exception: '.$e->getMessage()); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | return $conceptInfo; |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit); |
648 | 648 | } |
649 | 649 | |
650 | - public function getTitle($lang=null) { |
|
650 | + public function getTitle($lang = null) { |
|
651 | 651 | return $this->config->getTitle($lang); |
652 | 652 | } |
653 | 653 |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $exsparql = $exvoc->getSparql(); |
51 | 51 | $results = $exsparql->queryLabel($exuri, $lang); |
52 | 52 | return isset($results[$lang]) ? $results[$lang] : null; |
53 | - } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
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 | } |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | $exsparql = $exvoc->getSparql(); |
73 | 73 | $results = $exsparql->queryNotation($exuri); |
74 | 74 | return isset($results) ? $results : null; |
75 | - } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
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 | } |
@@ -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) { |
@@ -478,9 +478,9 @@ discard block |
||
478 | 478 | // not found in preferred vocabulary, fall back to next method |
479 | 479 | break; |
480 | 480 | } |
481 | - } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
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 | } |
@@ -494,9 +494,9 @@ discard block |
||
494 | 494 | if ($vocab->getConceptLabel($uri, null) !== null) { |
495 | 495 | return $vocab; |
496 | 496 | } |
497 | - } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
|
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 | } |
@@ -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); |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | |
238 | 238 | private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender) |
239 | 239 | { |
240 | - $headers = "MIME-Version: 1.0" . "\r\n"; |
|
241 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
240 | + $headers = "MIME-Version: 1.0"."\r\n"; |
|
241 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
242 | 242 | if (!empty($toMail)) { |
243 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
243 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
244 | 244 | } |
245 | 245 | if (!empty($fromEmail)) { |
246 | 246 | $headers .= "Reply-To: $fromName <$fromEmail>\r\n"; |
247 | 247 | } |
248 | 248 | |
249 | 249 | $service = $this->model->getConfig()->getServiceName(); |
250 | - return $headers . "From: $fromName via $service <$sender>"; |
|
250 | + return $headers."From: $fromName via $service <$sender>"; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | { |
262 | 262 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
263 | 263 | if ($fromVocab !== null && $fromVocab !== '') { |
264 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
264 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
268 | - $subject = $this->model->getConfig()->getServiceName() . " feedback"; |
|
268 | + $subject = $this->model->getConfig()->getServiceName()." feedback"; |
|
269 | 269 | // determine the sender address of the message |
270 | 270 | $sender = $this->model->getConfig()->getFeedbackSender(); |
271 | 271 | if (empty($sender)) $sender = $envelopeSender; |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
279 | 279 | |
280 | 280 | // adding some information about the user for debugging purposes. |
281 | - $message = $message . "<br /><br /> Debugging information:" |
|
282 | - . "<br />Timestamp: " . date(DATE_RFC2822) |
|
283 | - . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT') |
|
284 | - . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER'); |
|
281 | + $message = $message."<br /><br /> Debugging information:" |
|
282 | + . "<br />Timestamp: ".date(DATE_RFC2822) |
|
283 | + . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT') |
|
284 | + . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER'); |
|
285 | 285 | |
286 | 286 | try { |
287 | 287 | mail($toAddress, $subject, $message, $headers, $params); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | header("HTTP/1.0 404 Not Found"); |
290 | 290 | $template = $this->twig->loadTemplate('error-page.twig'); |
291 | 291 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
292 | - error_log('Caught exception: ' . $e->getMessage()); |
|
292 | + error_log('Caught exception: '.$e->getMessage()); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | echo $template->render( |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
337 | 337 | $vocabObjects = array(); |
338 | 338 | if ($vocids) { |
339 | - foreach($vocids as $vocid) { |
|
339 | + foreach ($vocids as $vocid) { |
|
340 | 340 | try { |
341 | 341 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
342 | 342 | } catch (Exception $e) { |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $vocabObjects = $this->model->getVocabularies(); |
357 | 357 | } |
358 | 358 | $defaultEndpoint = $this->model->getConfig()->getDefaultEndpoint(); |
359 | - foreach($vocabObjects as $voc) { |
|
359 | + foreach ($vocabObjects as $voc) { |
|
360 | 360 | if ($voc->getEndpoint() !== $defaultEndpoint) { |
361 | 361 | $nondefaultEndpointVocs[] = $voc; |
362 | 362 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $errored = true; |
376 | 376 | header("HTTP/1.0 500 Internal Server Error"); |
377 | 377 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
378 | - error_log('Caught exception: ' . $e->getMessage()); |
|
378 | + error_log('Caught exception: '.$e->getMessage()); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | $vocabList = $this->model->getVocabularyList(); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | 'search_count' => $counts, |
388 | 388 | 'languages' => $this->languages, |
389 | 389 | 'search_results' => $searchResults, |
390 | - 'rest' => $parameters->getOffset()>0, |
|
390 | + 'rest' => $parameters->getOffset() > 0, |
|
391 | 391 | 'global_search' => true, |
392 | 392 | 'search_failed' => $errored, |
393 | 393 | 'skipped_vocabs' => $nondefaultEndpointVocs, |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | } catch (Exception $e) { |
416 | 416 | header("HTTP/1.0 500 Internal Server Error"); |
417 | 417 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
418 | - error_log('Caught exception: ' . $e->getMessage()); |
|
418 | + error_log('Caught exception: '.$e->getMessage()); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | echo $template->render( |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } catch (Exception $e) { |
440 | 440 | header("HTTP/1.0 404 Not Found"); |
441 | 441 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
442 | - error_log('Caught exception: ' . $e->getMessage()); |
|
442 | + error_log('Caught exception: '.$e->getMessage()); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | echo $template->render( |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | 'vocab' => $vocab, |
458 | 458 | 'search_results' => $searchResults, |
459 | 459 | 'search_count' => $counts, |
460 | - 'rest' => $parameters->getOffset()>0, |
|
460 | + 'rest' => $parameters->getOffset() > 0, |
|
461 | 461 | 'limit_parent' => $parameters->getParentLimit(), |
462 | 462 | 'limit_type' => $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null, |
463 | 463 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
590 | 590 | * @param Request $request |
591 | 591 | */ |
592 | - public function invokeChangeList($request, $prop='dc:created') |
|
592 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
593 | 593 | { |
594 | 594 | $offset = ($request->getQueryParam('offset') && is_numeric($request->getQueryParam('offset')) && $request->getQueryParam('offset') >= 0) ? $request->getQueryParam('offset') : 0; |
595 | 595 | $limit = ($request->getQueryParam('limit') && is_numeric($request->getQueryParam('limit')) && $request->getQueryParam('limit') >= 0) ? $request->getQueryParam('limit') : 200; |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | * @param int $limit maximum number of concepts to return |
618 | 618 | * @return Array list of concepts |
619 | 619 | */ |
620 | - public function getChangeList($request, $prop, $offset=0, $limit=200) |
|
620 | + public function getChangeList($request, $prop, $offset = 0, $limit = 200) |
|
621 | 621 | { |
622 | 622 | // set language parameters for gettext |
623 | 623 | $this->setLanguageProperties($request->getLang()); |
@@ -633,9 +633,9 @@ discard block |
||
633 | 633 | public function formatChangeList($changeList, $lang) |
634 | 634 | { |
635 | 635 | $formatByDate = array(); |
636 | - foreach($changeList as $concept) { |
|
636 | + foreach ($changeList as $concept) { |
|
637 | 637 | $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang); |
638 | - $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept; |
|
638 | + $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept; |
|
639 | 639 | } |
640 | 640 | return $formatByDate; |
641 | 641 | } |