@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $opts = array('http' => array('method'=>'HEAD', |
| 14 | 14 | 'user_agent' => 'Skosmos', |
| 15 | 15 | 'timeout' => $timeout)); |
| 16 | - $context = stream_context_create($opts); |
|
| 16 | + $context = stream_context_create($opts); |
|
| 17 | 17 | $fd = fopen($this->uri, 'rb', false, $context); |
| 18 | 18 | $headers = stream_get_meta_data($fd)['wrapper_data']; |
| 19 | 19 | foreach ($headers as $header) { |
@@ -99,17 +99,14 @@ |
||
| 99 | 99 | return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel())); |
| 100 | 100 | } |
| 101 | 101 | return 1; |
| 102 | - } |
|
| 103 | - else if ($bnot == null) { |
|
| 102 | + } else if ($bnot == null) { |
|
| 104 | 103 | return -1; |
| 105 | - } |
|
| 106 | - else { |
|
| 104 | + } else { |
|
| 107 | 105 | // assume that notations are unique |
| 108 | 106 | return strnatcasecmp($anot, $bnot); |
| 109 | 107 | } |
| 110 | 108 | }); |
| 111 | - } |
|
| 112 | - else { |
|
| 109 | + } else { |
|
| 113 | 110 | uasort($this->values, function($a, $b) { |
| 114 | 111 | // assume that labels are unique |
| 115 | 112 | return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel())); |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | return $help; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - // if not, see if there was a comment/definition for the property in the graph |
|
| 75 | + // if not, see if there was a comment/definition for the property in the graph |
|
| 76 | 76 | if ($this->tooltip !== null) { |
| 77 | 77 | return $this->tooltip; |
| 78 | 78 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @param string $super URI of superproperty |
| 28 | 28 | * @param boolean $sort_by_notation whether to sort the property values by their notation code |
| 29 | 29 | */ |
| 30 | - public function __construct($prop, $label, $tooltip=null, $super=null, $sort_by_notation=false) |
|
| 30 | + public function __construct($prop, $label, $tooltip = null, $super = null, $sort_by_notation = false) |
|
| 31 | 31 | { |
| 32 | 32 | $this->prop = $prop; |
| 33 | 33 | $this->label = $label; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function getDescription() |
| 69 | 69 | { |
| 70 | - $helpprop = $this->prop . "_help"; |
|
| 70 | + $helpprop = $this->prop."_help"; |
|
| 71 | 71 | |
| 72 | 72 | // see if we have a translation with the help text |
| 73 | 73 | $help = gettext($helpprop); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | public function addValue($value) |
| 100 | 100 | { |
| 101 | - $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel() . rtrim(' ' . $value->getUri())] = $value; |
|
| 101 | + $this->values[ltrim($value->getNotation().' ').$value->getLabel().rtrim(' '.$value->getUri())] = $value; |
|
| 102 | 102 | $this->is_sorted = false; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -47,12 +47,16 @@ discard block |
||
| 47 | 47 | $this->client = new EasyRdf\Sparql\Client($endpoint); |
| 48 | 48 | |
| 49 | 49 | // set graphClause so that it can be used by all queries |
| 50 | - if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable) |
|
| 50 | + if ($this->isDefaultEndpoint()) { |
|
| 51 | + // default endpoint; query any graph (and catch it in a variable) |
|
| 51 | 52 | { |
| 52 | 53 | $this->graphClause = "GRAPH $graph"; |
| 53 | - } elseif ($graph !== null) // query a specific graph |
|
| 54 | + } |
|
| 55 | + } elseif ($graph !== null) { |
|
| 56 | + // query a specific graph |
|
| 54 | 57 | { |
| 55 | 58 | $this->graphClause = "GRAPH <$graph>"; |
| 59 | + } |
|
| 56 | 60 | } else // query the default graph |
| 57 | 61 | { |
| 58 | 62 | $this->graphClause = ""; |
@@ -1274,8 +1278,7 @@ discard block |
||
| 1274 | 1278 | if (isset($row->qualifier)) { |
| 1275 | 1279 | if ($row->qualifier instanceof EasyRdf\Literal) { |
| 1276 | 1280 | $hit['qualifier'] = $row->qualifier->getValue(); |
| 1277 | - } |
|
| 1278 | - else { |
|
| 1281 | + } else { |
|
| 1279 | 1282 | $hit['qualifier'] = $row->qualifier->localName(); |
| 1280 | 1283 | } |
| 1281 | 1284 | } |
@@ -1955,8 +1958,7 @@ discard block |
||
| 1955 | 1958 | if (sizeof($ret) > 0) { |
| 1956 | 1959 | // existing concept, with children |
| 1957 | 1960 | return $ret; |
| 1958 | - } |
|
| 1959 | - else { |
|
| 1961 | + } else { |
|
| 1960 | 1962 | // nonexistent concept |
| 1961 | 1963 | return null; |
| 1962 | 1964 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @param string $query |
| 67 | 67 | * @return string |
| 68 | - */ |
|
| 68 | + */ |
|
| 69 | 69 | protected function generateQueryPrefixes($query) |
| 70 | 70 | { |
| 71 | 71 | // Check for undefined prefixes |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | $gcl = $this->graphClause; |
| 234 | 234 | $classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept'); |
| 235 | 235 | |
| 236 | - $quote_string = function($val) { return "'$val'"; }; |
|
| 237 | - $quoted_values = array_map($quote_string, $langs); |
|
| 238 | - $langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))"; |
|
| 236 | + $quote_string = function($val) { return "'$val'"; }; |
|
| 237 | + $quoted_values = array_map($quote_string, $langs); |
|
| 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); |
@@ -962,7 +962,7 @@ discard block |
||
| 962 | 962 | return $query; |
| 963 | 963 | } |
| 964 | 964 | /** |
| 965 | - * This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses |
|
| 965 | + * This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses |
|
| 966 | 966 | * @param string $lang |
| 967 | 967 | * @return string formatted language clause |
| 968 | 968 | */ |
@@ -1911,7 +1911,7 @@ discard block |
||
| 1911 | 1911 | |
| 1912 | 1912 | /** |
| 1913 | 1913 | * Generates a sparql query for finding the hierarchy for a concept. |
| 1914 | - * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal. |
|
| 1914 | + * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal. |
|
| 1915 | 1915 | * @param string $uri concept uri. |
| 1916 | 1916 | * @param string $lang |
| 1917 | 1917 | * @param string $fallback language to use if label is not available in the preferred language |
@@ -1988,10 +1988,10 @@ discard block |
||
| 1988 | 1988 | $ret[$uri]['exact'] = $row->exact->getUri(); |
| 1989 | 1989 | } |
| 1990 | 1990 | if (isset($row->tops)) { |
| 1991 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
| 1992 | - // sort to guarantee an alphabetical ordering of the URI |
|
| 1993 | - sort($topConceptsList); |
|
| 1994 | - $ret[$uri]['tops'] = $topConceptsList; |
|
| 1991 | + $topConceptsList=explode(" ", $row->tops->getValue()); |
|
| 1992 | + // sort to guarantee an alphabetical ordering of the URI |
|
| 1993 | + sort($topConceptsList); |
|
| 1994 | + $ret[$uri]['tops'] = $topConceptsList; |
|
| 1995 | 1995 | } |
| 1996 | 1996 | if (isset($row->children)) { |
| 1997 | 1997 | if (!isset($ret[$uri]['narrower'])) { |
@@ -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); |
@@ -672,9 +672,9 @@ discard block |
||
| 672 | 672 | $conceptscheme['title'] = $row->title->getValue(); |
| 673 | 673 | } |
| 674 | 674 | // add dct:subject and their labels in the result |
| 675 | - if(isset($row->domain) && isset($row->domainLabel)){ |
|
| 676 | - $conceptscheme['subject']['uri']=$row->domain->getURI(); |
|
| 677 | - $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue(); |
|
| 675 | + if (isset($row->domain) && isset($row->domainLabel)) { |
|
| 676 | + $conceptscheme['subject']['uri'] = $row->domain->getURI(); |
|
| 677 | + $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue(); |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | $ret[$row->cs->getURI()] = $conceptscheme; |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | $values[] = "<$graph>"; |
| 742 | 742 | } |
| 743 | 743 | if (count($values)) { |
| 744 | - return "FILTER (?graph IN (" . implode(',', $values) . "))"; |
|
| 744 | + return "FILTER (?graph IN (".implode(',', $values)."))"; |
|
| 745 | 745 | } |
| 746 | 746 | } |
| 747 | 747 | |
@@ -752,16 +752,16 @@ discard block |
||
| 752 | 752 | * @return string sparql query clauses |
| 753 | 753 | */ |
| 754 | 754 | protected function formatLimitAndOffset($limit, $offset) { |
| 755 | - $limit = ($limit) ? 'LIMIT ' . $limit : ''; |
|
| 756 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
| 755 | + $limit = ($limit) ? 'LIMIT '.$limit : ''; |
|
| 756 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
| 757 | 757 | // eliminating whitespace and line changes when the conditions aren't needed. |
| 758 | 758 | $limitandoffset = ''; |
| 759 | 759 | if ($limit && $offset) { |
| 760 | - $limitandoffset = "\n" . $limit . "\n" . $offset; |
|
| 760 | + $limitandoffset = "\n".$limit."\n".$offset; |
|
| 761 | 761 | } elseif ($limit) { |
| 762 | - $limitandoffset = "\n" . $limit; |
|
| 762 | + $limitandoffset = "\n".$limit; |
|
| 763 | 763 | } elseif ($offset) { |
| 764 | - $limitandoffset = "\n" . $offset; |
|
| 764 | + $limitandoffset = "\n".$offset; |
|
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | return $limitandoffset; |
@@ -913,14 +913,14 @@ discard block |
||
| 913 | 913 | // if search language and UI/display language differ, must also consider case where there is no prefLabel in |
| 914 | 914 | // the display language; in that case, should use the label with the same language as the matched label |
| 915 | 915 | $labelcondFallback = ($searchLang != $lang) ? |
| 916 | - "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" . |
|
| 916 | + "OPTIONAL { # in case previous OPTIONAL block gives no labels\n". |
|
| 917 | 917 | "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : ""; |
| 918 | 918 | |
| 919 | 919 | // Including the labels if there is no query term given. |
| 920 | 920 | if ($rawterm === '') { |
| 921 | 921 | $labelClause = "?s skos:prefLabel ?label ."; |
| 922 | - $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . ""; |
|
| 923 | - return $labelClause . " BIND(?label AS ?match)"; |
|
| 922 | + $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause.""; |
|
| 923 | + return $labelClause." BIND(?label AS ?match)"; |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | /* |
@@ -992,20 +992,20 @@ discard block |
||
| 992 | 992 | $schemecond = ''; |
| 993 | 993 | if (!empty($schemes)) { |
| 994 | 994 | $conditions = array(); |
| 995 | - foreach($schemes as $scheme) { |
|
| 995 | + foreach ($schemes as $scheme) { |
|
| 996 | 996 | $conditions[] = "{?s skos:inScheme <$scheme>}"; |
| 997 | 997 | } |
| 998 | - $schemecond = '{'.implode(" UNION ",$conditions).'}'; |
|
| 998 | + $schemecond = '{'.implode(" UNION ", $conditions).'}'; |
|
| 999 | 999 | } |
| 1000 | - $filterDeprecated=""; |
|
| 1000 | + $filterDeprecated = ""; |
|
| 1001 | 1001 | //show or hide deprecated concepts |
| 1002 | - if(!$showDeprecated){ |
|
| 1003 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
| 1002 | + if (!$showDeprecated) { |
|
| 1003 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
| 1004 | 1004 | } |
| 1005 | 1005 | // extra conditions for parent and group, if specified |
| 1006 | - $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : ""; |
|
| 1007 | - $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : ""; |
|
| 1008 | - $pgcond = $parentcond . $groupcond; |
|
| 1006 | + $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : ""; |
|
| 1007 | + $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : ""; |
|
| 1008 | + $pgcond = $parentcond.$groupcond; |
|
| 1009 | 1009 | |
| 1010 | 1010 | $orderextra = $this->isDefaultEndpoint() ? $this->graph : ''; |
| 1011 | 1011 | |
@@ -1091,9 +1091,9 @@ discard block |
||
| 1091 | 1091 | $hit['type'][] = $this->shortenUri($typeuri); |
| 1092 | 1092 | } |
| 1093 | 1093 | |
| 1094 | - if(!empty($fields)) { |
|
| 1094 | + if (!empty($fields)) { |
|
| 1095 | 1095 | foreach ($fields as $prop) { |
| 1096 | - $propname = $prop . 's'; |
|
| 1096 | + $propname = $prop.'s'; |
|
| 1097 | 1097 | if (isset($row->$propname)) { |
| 1098 | 1098 | foreach (explode("\n", $row->$propname->getValue()) as $line) { |
| 1099 | 1099 | $rdata = str_getcsv($line, ',', '"', '"'); |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | $propvals = $rdata[2]; |
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | - $hit['skos:' . $prop][] = $propvals; |
|
| 1111 | + $hit['skos:'.$prop][] = $propvals; |
|
| 1112 | 1112 | } |
| 1113 | 1113 | } |
| 1114 | 1114 | } |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | * @return array query result object |
| 1185 | 1185 | */ |
| 1186 | 1186 | public function queryConcepts($vocabs, $fields = null, $unique = false, $params, $showDeprecated = false) { |
| 1187 | - $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated); |
|
| 1187 | + $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated); |
|
| 1188 | 1188 | $results = $this->query($query); |
| 1189 | 1189 | return $this->transformConceptSearchResults($results, $vocabs, $fields); |
| 1190 | 1190 | } |
@@ -1239,10 +1239,10 @@ discard block |
||
| 1239 | 1239 | $conditions = $this->formatFilterConditions($letter, $lang); |
| 1240 | 1240 | $filtercondLabel = $conditions['filterpref']; |
| 1241 | 1241 | $filtercondALabel = $conditions['filteralt']; |
| 1242 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
| 1243 | - $filterDeprecated=""; |
|
| 1244 | - if(!$showDeprecated){ |
|
| 1245 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
| 1242 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
| 1243 | + $filterDeprecated = ""; |
|
| 1244 | + if (!$showDeprecated) { |
|
| 1245 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
| 1246 | 1246 | } |
| 1247 | 1247 | $query = <<<EOQ |
| 1248 | 1248 | SELECT DISTINCT ?s ?label ?alabel ?qualifier |
@@ -1719,7 +1719,7 @@ discard block |
||
| 1719 | 1719 | if (!isset($row->label) || $row->label->getLang() === $lang) { |
| 1720 | 1720 | $ret[$row->object->getUri()] = $val; |
| 1721 | 1721 | } elseif ($row->label->getLang() === $fallbacklang) { |
| 1722 | - $val['label'] .= ' (' . $row->label->getLang() . ')'; |
|
| 1722 | + $val['label'] .= ' ('.$row->label->getLang().')'; |
|
| 1723 | 1723 | $ret[$row->object->getUri()] = $val; |
| 1724 | 1724 | } |
| 1725 | 1725 | } |
@@ -1815,10 +1815,10 @@ discard block |
||
| 1815 | 1815 | |
| 1816 | 1816 | $label = null; |
| 1817 | 1817 | if (isset($row->label)) { |
| 1818 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
| 1818 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
| 1819 | 1819 | $label = $row->label->getValue(); |
| 1820 | 1820 | } else { |
| 1821 | - $label = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
| 1821 | + $label = $row->label->getValue()." (".$row->label->getLang().")"; |
|
| 1822 | 1822 | } |
| 1823 | 1823 | |
| 1824 | 1824 | } |
@@ -1894,8 +1894,8 @@ discard block |
||
| 1894 | 1894 | foreach ($result as $row) { |
| 1895 | 1895 | if (isset($row->top) && isset($row->label)) { |
| 1896 | 1896 | $label = $row->label->getValue(); |
| 1897 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
| 1898 | - $label .= ' (' . $row->label->getLang() . ')'; |
|
| 1897 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
| 1898 | + $label .= ' ('.$row->label->getLang().')'; |
|
| 1899 | 1899 | } |
| 1900 | 1900 | $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN)); |
| 1901 | 1901 | if (isset($row->notation)) { |
@@ -1988,7 +1988,7 @@ discard block |
||
| 1988 | 1988 | $ret[$uri]['exact'] = $row->exact->getUri(); |
| 1989 | 1989 | } |
| 1990 | 1990 | if (isset($row->tops)) { |
| 1991 | - $topConceptsList=explode(" ", $row->tops->getValue()); |
|
| 1991 | + $topConceptsList = explode(" ", $row->tops->getValue()); |
|
| 1992 | 1992 | // sort to guarantee an alphabetical ordering of the URI |
| 1993 | 1993 | sort($topConceptsList); |
| 1994 | 1994 | $ret[$uri]['tops'] = $topConceptsList; |
@@ -2001,8 +2001,8 @@ discard block |
||
| 2001 | 2001 | $label = null; |
| 2002 | 2002 | if (isset($row->childlabel)) { |
| 2003 | 2003 | $label = $row->childlabel->getValue(); |
| 2004 | - if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) { |
|
| 2005 | - $label .= " (" . $row->childlabel->getLang() . ")"; |
|
| 2004 | + if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) { |
|
| 2005 | + $label .= " (".$row->childlabel->getLang().")"; |
|
| 2006 | 2006 | } |
| 2007 | 2007 | |
| 2008 | 2008 | } |
@@ -2023,8 +2023,8 @@ discard block |
||
| 2023 | 2023 | } |
| 2024 | 2024 | if (isset($row->label)) { |
| 2025 | 2025 | $preflabel = $row->label->getValue(); |
| 2026 | - if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) { |
|
| 2027 | - $preflabel .= ' (' . $row->label->getLang() . ')'; |
|
| 2026 | + if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) { |
|
| 2027 | + $preflabel .= ' ('.$row->label->getLang().')'; |
|
| 2028 | 2028 | } |
| 2029 | 2029 | |
| 2030 | 2030 | $ret[$uri]['prefLabel'] = $preflabel; |
@@ -2145,9 +2145,9 @@ discard block |
||
| 2145 | 2145 | */ |
| 2146 | 2146 | private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) { |
| 2147 | 2147 | $fcl = $this->generateFromClause(); |
| 2148 | - $filterDeprecated=""; |
|
| 2149 | - if(!$showDeprecated){ |
|
| 2150 | - $filterDeprecated=" FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
| 2148 | + $filterDeprecated = ""; |
|
| 2149 | + if (!$showDeprecated) { |
|
| 2150 | + $filterDeprecated = " FILTER NOT EXISTS { ?conc owl:deprecated true }"; |
|
| 2151 | 2151 | } |
| 2152 | 2152 | $query = <<<EOQ |
| 2153 | 2153 | SELECT ?conc ?super ?label ?members ?type ?notation $fcl |
@@ -2186,10 +2186,10 @@ discard block |
||
| 2186 | 2186 | 'type' => array($row->type->shorten()), |
| 2187 | 2187 | ); |
| 2188 | 2188 | if (isset($row->label)) { |
| 2189 | - if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) { |
|
| 2189 | + if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) { |
|
| 2190 | 2190 | $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue(); |
| 2191 | 2191 | } else { |
| 2192 | - $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")"; |
|
| 2192 | + $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")"; |
|
| 2193 | 2193 | } |
| 2194 | 2194 | |
| 2195 | 2195 | } |
@@ -2217,8 +2217,8 @@ discard block |
||
| 2217 | 2217 | * @param boolean $showDeprecated whether to include deprecated concepts in search results |
| 2218 | 2218 | * @return array Result array with concept URI as key and concept label as value |
| 2219 | 2219 | */ |
| 2220 | - public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) { |
|
| 2221 | - $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated); |
|
| 2220 | + public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) { |
|
| 2221 | + $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated); |
|
| 2222 | 2222 | $result = $this->query($query); |
| 2223 | 2223 | return $this->transformConceptGroupContentsResults($result, $lang); |
| 2224 | 2224 | } |
@@ -2231,9 +2231,9 @@ discard block |
||
| 2231 | 2231 | * @param int $limit maximum number of results to return |
| 2232 | 2232 | * @return string sparql query |
| 2233 | 2233 | */ |
| 2234 | - private function generateChangeListQuery($prop, $lang, $offset, $limit=200) { |
|
| 2234 | + private function generateChangeListQuery($prop, $lang, $offset, $limit = 200) { |
|
| 2235 | 2235 | $fcl = $this->generateFromClause(); |
| 2236 | - $offset = ($offset) ? 'OFFSET ' . $offset : ''; |
|
| 2236 | + $offset = ($offset) ? 'OFFSET '.$offset : ''; |
|
| 2237 | 2237 | |
| 2238 | 2238 | $query = <<<EOQ |
| 2239 | 2239 | SELECT DISTINCT ?concept ?date ?label $fcl |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | // 1. Ensure characters with special meaning in Lucene are escaped |
| 42 | 42 | $lucenemap = array(); |
| 43 | 43 | foreach (str_split(self::LUCENE_ESCAPE_CHARS) as $char) { |
| 44 | - $lucenemap[$char] = '\\' . $char; // escape with a backslash |
|
| 44 | + $lucenemap[$char] = '\\'.$char; // escape with a backslash |
|
| 45 | 45 | } |
| 46 | 46 | $term = strtr($term, $lucenemap); |
| 47 | 47 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @return string sparql order by clause |
| 93 | 93 | */ |
| 94 | 94 | private function formatOrderBy($expression, $lang) { |
| 95 | - if(!$this->model->getConfig()->getCollationEnabled()) { |
|
| 95 | + if (!$this->model->getConfig()->getCollationEnabled()) { |
|
| 96 | 96 | return $expression; |
| 97 | 97 | } |
| 98 | 98 | $orderby = sprintf('arq:collation(\'%2$s\', %1$s)', $expression, $lang); |
@@ -126,15 +126,15 @@ discard block |
||
| 126 | 126 | # make text query clause |
| 127 | 127 | $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe |
| 128 | 128 | $langClause = $this->generateLangClause($lang); |
| 129 | - $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $langClause); |
|
| 130 | - $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $langClause); |
|
| 131 | - $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang) . " STR(?s) LCASE(STR(?qualifier))"; |
|
| 129 | + $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $langClause); |
|
| 130 | + $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $langClause); |
|
| 131 | + $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang)." STR(?s) LCASE(STR(?qualifier))"; |
|
| 132 | 132 | |
| 133 | - $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : ""; |
|
| 133 | + $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : ""; |
|
| 134 | 134 | |
| 135 | - $filterDeprecated=""; |
|
| 136 | - if(!$showDeprecated){ |
|
| 137 | - $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
| 135 | + $filterDeprecated = ""; |
|
| 136 | + if (!$showDeprecated) { |
|
| 137 | + $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }"; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $query = <<<EOQ |
@@ -156,18 +156,18 @@ discard block |
||
| 156 | 156 | $localname = $vocab->getLocalName($uri); |
| 157 | 157 | if ($localname !== $uri && $localname === urlencode($localname)) { |
| 158 | 158 | // check that the prefix stripping worked, and there are no problematic chars in localname |
| 159 | - $paramstr = count($params) > 0 ? '?' . http_build_query($params) : ''; |
|
| 159 | + $paramstr = count($params) > 0 ? '?'.http_build_query($params) : ''; |
|
| 160 | 160 | if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) { |
| 161 | - return "$vocid/$lang/$type/$localname" . $paramstr; |
|
| 161 | + return "$vocid/$lang/$type/$localname".$paramstr; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - return "$vocid/$lang/$localname" . $paramstr; |
|
| 164 | + return "$vocid/$lang/$localname".$paramstr; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // case 2: URI outside vocabulary namespace, or has problematic chars |
| 168 | 168 | // pass the full URI as parameter instead |
| 169 | 169 | $params['uri'] = $uri; |
| 170 | - return "$vocid/$lang/$type/?" . http_build_query($params); |
|
| 170 | + return "$vocid/$lang/$type/?".http_build_query($params); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | { |
| 294 | 294 | if ($modifiedDate) { |
| 295 | 295 | $ifModifiedSince = $this->getIfModifiedSince(); |
| 296 | - $this->sendHeader("Last-Modified: " . $modifiedDate->format('D, d M Y H:i:s \G\M\T')); |
|
| 296 | + $this->sendHeader("Last-Modified: ".$modifiedDate->format('D, d M Y H:i:s \G\M\T')); |
|
| 297 | 297 | if ($ifModifiedSince !== null && $ifModifiedSince >= $modifiedDate) { |
| 298 | 298 | $this->sendHeader("HTTP/1.0 304 Not Modified"); |
| 299 | 299 | return true; |
@@ -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); |
@@ -266,11 +266,17 @@ |
||
| 266 | 266 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
| 267 | 267 | // determine the sender address of the message |
| 268 | 268 | $sender = $this->model->getConfig()->getFeedbackSender(); |
| 269 | - if (empty($sender)) $sender = $envelopeSender; |
|
| 270 | - if (empty($sender)) $sender = $this->model->getConfig()->getFeedbackAddress(); |
|
| 269 | + if (empty($sender)) { |
|
| 270 | + $sender = $envelopeSender; |
|
| 271 | + } |
|
| 272 | + if (empty($sender)) { |
|
| 273 | + $sender = $this->model->getConfig()->getFeedbackAddress(); |
|
| 274 | + } |
|
| 271 | 275 | |
| 272 | 276 | // determine sender name - default to "anonymous user" if not given by user |
| 273 | - if (empty($fromName)) $fromName = "anonymous user"; |
|
| 277 | + if (empty($fromName)) { |
|
| 278 | + $fromName = "anonymous user"; |
|
| 279 | + } |
|
| 274 | 280 | $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender); |
| 275 | 281 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
| 276 | 282 | // adding some information about the user for debugging purposes. |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | // specify where to look for templates and cache |
| 38 | 38 | $loader = new Twig_Loader_Filesystem('view'); |
| 39 | 39 | // initialize Twig environment |
| 40 | - $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true)); |
|
| 40 | + $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true)); |
|
| 41 | 41 | $this->twig->addExtension(new Twig_Extensions_Extension_I18n()); |
| 42 | 42 | // used for setting the base href for the relative urls |
| 43 | 43 | $this->twig->addGlobal("BaseHref", $this->getBaseHref()); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter'))); |
| 61 | 61 | |
| 62 | 62 | // register a Twig filter for generating strings from language codes with CLDR |
| 63 | - $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) { |
|
| 63 | + $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) { |
|
| 64 | 64 | return Language::getName($langcode, $lang); |
| 65 | 65 | }); |
| 66 | 66 | $this->twig->addFilter($langFilter); |
@@ -235,16 +235,16 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender) |
| 237 | 237 | { |
| 238 | - $headers = "MIME-Version: 1.0" . "\r\n"; |
|
| 239 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
| 238 | + $headers = "MIME-Version: 1.0"."\r\n"; |
|
| 239 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
| 240 | 240 | if (!empty($toMail)) { |
| 241 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
| 241 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
| 242 | 242 | } |
| 243 | 243 | if (!empty($fromEmail)) { |
| 244 | 244 | $headers .= "Reply-To: $fromName <$fromEmail>\r\n"; |
| 245 | 245 | } |
| 246 | 246 | $service = $this->model->getConfig()->getServiceName(); |
| 247 | - return $headers . "From: $fromName via $service <$sender>"; |
|
| 247 | + return $headers."From: $fromName via $service <$sender>"; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null) |
| 259 | 259 | { |
| 260 | 260 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
| 261 | - $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject; |
|
| 261 | + $messageSubject = "[".$this->model->getConfig()->getServiceName()."] ".$messageSubject; |
|
| 262 | 262 | if ($fromVocab !== null && $fromVocab !== '') { |
| 263 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
| 263 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
| 264 | 264 | } |
| 265 | 265 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
| 266 | 266 | // determine the sender address of the message |
@@ -273,10 +273,10 @@ discard block |
||
| 273 | 273 | $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender); |
| 274 | 274 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
| 275 | 275 | // adding some information about the user for debugging purposes. |
| 276 | - $message = $message . "<br /><br /> Debugging information:" |
|
| 277 | - . "<br />Timestamp: " . date(DATE_RFC2822) |
|
| 278 | - . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT') |
|
| 279 | - . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER'); |
|
| 276 | + $message = $message."<br /><br /> Debugging information:" |
|
| 277 | + . "<br />Timestamp: ".date(DATE_RFC2822) |
|
| 278 | + . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT') |
|
| 279 | + . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER'); |
|
| 280 | 280 | |
| 281 | 281 | try { |
| 282 | 282 | mail($toAddress, $messageSubject, $message, $headers, $params); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | header("HTTP/1.0 404 Not Found"); |
| 285 | 285 | $template = $this->twig->loadTemplate('error-page.twig'); |
| 286 | 286 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 287 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 287 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | echo $template->render( |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
| 332 | 332 | $vocabObjects = array(); |
| 333 | 333 | if ($vocids) { |
| 334 | - foreach($vocids as $vocid) { |
|
| 334 | + foreach ($vocids as $vocid) { |
|
| 335 | 335 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
| 336 | 336 | } |
| 337 | 337 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | } catch (Exception $e) { |
| 343 | 343 | header("HTTP/1.0 404 Not Found"); |
| 344 | 344 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 345 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 345 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 346 | 346 | } |
| 347 | 347 | $this->invokeGenericErrorPage($request, $e->getMessage()); |
| 348 | 348 | return; |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | 'search_count' => $counts, |
| 359 | 359 | 'languages' => $this->languages, |
| 360 | 360 | 'search_results' => $searchResults, |
| 361 | - 'rest' => $parameters->getOffset()>0, |
|
| 361 | + 'rest' => $parameters->getOffset() > 0, |
|
| 362 | 362 | 'global_search' => true, |
| 363 | 363 | 'term' => $request->getQueryParamRaw('q'), |
| 364 | 364 | 'lang_list' => $langList, |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } catch (Exception $e) { |
| 384 | 384 | header("HTTP/1.0 404 Not Found"); |
| 385 | 385 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 386 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 386 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | echo $template->render( |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | } catch (Exception $e) { |
| 405 | 405 | header("HTTP/1.0 404 Not Found"); |
| 406 | 406 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 407 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 407 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | echo $template->render( |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | 'vocab' => $vocab, |
| 422 | 422 | 'search_results' => $searchResults, |
| 423 | 423 | 'search_count' => $counts, |
| 424 | - 'rest' => $parameters->getOffset()>0, |
|
| 424 | + 'rest' => $parameters->getOffset() > 0, |
|
| 425 | 425 | 'limit_parent' => $parameters->getParentLimit(), |
| 426 | 426 | 'limit_type' => $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null, |
| 427 | 427 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
| 553 | 553 | * @param Request $request |
| 554 | 554 | */ |
| 555 | - public function invokeChangeList($request, $prop='dc:created') |
|
| 555 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
| 556 | 556 | { |
| 557 | 557 | $offset = ($request->getQueryParam('offset') && is_numeric($request->getQueryParam('offset')) && $request->getQueryParam('offset') >= 0) ? $request->getQueryParam('offset') : 0; |
| 558 | 558 | $limit = ($request->getQueryParam('limit') && is_numeric($request->getQueryParam('limit')) && $request->getQueryParam('limit') >= 0) ? $request->getQueryParam('limit') : 200; |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * @param int $limit maximum number of concepts to return |
| 581 | 581 | * @return Array list of concepts |
| 582 | 582 | */ |
| 583 | - public function getChangeList($request, $prop, $offset=0, $limit=200) |
|
| 583 | + public function getChangeList($request, $prop, $offset = 0, $limit = 200) |
|
| 584 | 584 | { |
| 585 | 585 | // set language parameters for gettext |
| 586 | 586 | $this->setLanguageProperties($request->getLang()); |
@@ -596,9 +596,9 @@ discard block |
||
| 596 | 596 | public function formatChangeList($changeList, $lang) |
| 597 | 597 | { |
| 598 | 598 | $formatByDate = array(); |
| 599 | - foreach($changeList as $concept) { |
|
| 599 | + foreach ($changeList as $concept) { |
|
| 600 | 600 | $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang); |
| 601 | - $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept; |
|
| 601 | + $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept; |
|
| 602 | 602 | } |
| 603 | 603 | return $formatByDate; |
| 604 | 604 | } |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | // Encrypt the current time |
| 34 | 34 | $honey_time_encrypted = $this->getEncryptedTime(); |
| 35 | - return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" . |
|
| 36 | - '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" . |
|
| 37 | - '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" . |
|
| 35 | + return '<div id="'.$honey_name.'_wrap" style="display:none;">'."\r\n". |
|
| 36 | + '<input name="'.$honey_name.'" type="text" value="" id="'.$honey_name.'"/>'."\r\n". |
|
| 37 | + '<input name="'.$honey_time.'" type="text" value="'.$honey_time_encrypted.'"/>'."\r\n". |
|
| 38 | 38 | '</div>'; |
| 39 | 39 | } |
| 40 | 40 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // Get the decrypted time |
| 67 | 67 | $value = $this->decryptTime($value); |
| 68 | 68 | // The current time should be greater than the time the form was built + minimum |
| 69 | - return ( is_numeric($value) && time() > ($value + $minDelta) ); |
|
| 69 | + return (is_numeric($value) && time() > ($value + $minDelta)); |
|
| 70 | 70 | } |
| 71 | 71 | /** |
| 72 | 72 | * Get encrypted time |
@@ -33,16 +33,16 @@ |
||
| 33 | 33 | // Encrypt the current time |
| 34 | 34 | $honey_time_encrypted = $this->getEncryptedTime(); |
| 35 | 35 | return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" . |
| 36 | - '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" . |
|
| 37 | - '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" . |
|
| 36 | + '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" . |
|
| 37 | + '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" . |
|
| 38 | 38 | '</div>'; |
| 39 | 39 | } |
| 40 | 40 | /** |
| 41 | - * Validate honeypot is empty |
|
| 42 | - * |
|
| 43 | - * @param mixed $value |
|
| 44 | - * @return boolean |
|
| 45 | - */ |
|
| 41 | + * Validate honeypot is empty |
|
| 42 | + * |
|
| 43 | + * @param mixed $value |
|
| 44 | + * @return boolean |
|
| 45 | + */ |
|
| 46 | 46 | public function validateHoneypot($value) : bool |
| 47 | 47 | { |
| 48 | 48 | if ($this->disabled) { |