@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } elseif ($parts[1] == 'data') { |
| 38 | 38 | $controller->data($request); |
| 39 | 39 | } elseif (sizeof($parts) == 2) { |
| 40 | - header("Location: " . $parts[1] . "/"); |
|
| 40 | + header("Location: ".$parts[1]."/"); |
|
| 41 | 41 | } else { |
| 42 | 42 | $vocab = $parts[1]; |
| 43 | 43 | try { |
@@ -93,5 +93,5 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } catch (Exception $e) { |
| 95 | 95 | header("HTTP/1.0 500 Internal Server Error"); |
| 96 | - echo('ERROR: ' . $e->getMessage()); |
|
| 96 | + echo('ERROR: '.$e->getMessage()); |
|
| 97 | 97 | } |
@@ -23,5 +23,5 @@ |
||
| 23 | 23 | |
| 24 | 24 | } catch (Exception $e) { |
| 25 | 25 | header("HTTP/1.0 500 Internal Server Error"); |
| 26 | - echo('ERROR: ' . $e->getMessage()); |
|
| 26 | + echo('ERROR: '.$e->getMessage()); |
|
| 27 | 27 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /** |
| 20 | 20 | * Wraps apc_store() and apcu_store() |
| 21 | 21 | */ |
| 22 | - public function store($key, $value, $ttl=3600) { |
|
| 22 | + public function store($key, $value, $ttl = 3600) { |
|
| 23 | 23 | if (function_exists('apcu_store')) { |
| 24 | 24 | return apcu_store($key, $value, $ttl); |
| 25 | 25 | } |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | foreach (explode(' ', GLOBAL_PLUGINS) as $pluginName) { |
| 85 | 85 | $globalPluginsArray[] = "\"$pluginName\""; |
| 86 | 86 | } |
| 87 | - $globalPlugins = " " . implode(', ', $globalPluginsArray) . " "; |
|
| 87 | + $globalPlugins = " ".implode(', ', $globalPluginsArray)." "; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | # print the prefixes |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $baseurl = $this->getBaseHref(); |
| 17 | 17 | $vocid = $vocab->getId(); |
| 18 | 18 | $query = http_build_query(array('uri'=>$uri, 'format'=>$targetFormat)); |
| 19 | - $url = $baseurl . "rest/v1/$vocid/data?$query"; |
|
| 19 | + $url = $baseurl."rest/v1/$vocid/data?$query"; |
|
| 20 | 20 | $this->redirect303($url); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -27,16 +27,16 @@ discard block |
||
| 27 | 27 | $localname = $vocab->getLocalName($uri); |
| 28 | 28 | |
| 29 | 29 | if (!$localname) { |
| 30 | - $url = $baseurl . "$vocid/"; |
|
| 30 | + $url = $baseurl."$vocid/"; |
|
| 31 | 31 | } else { |
| 32 | 32 | |
| 33 | 33 | if ($localname !== $uri && $localname === urlencode($localname)) { |
| 34 | 34 | // the URI can be shortened |
| 35 | - $url = $baseurl . "$vocid/page/$localname"; |
|
| 35 | + $url = $baseurl."$vocid/page/$localname"; |
|
| 36 | 36 | } else { |
| 37 | 37 | // must use full URI |
| 38 | 38 | $query = http_build_query(array('uri'=>$uri)); |
| 39 | - $url = $baseurl . "$vocid/page/?" . $query; |
|
| 39 | + $url = $baseurl."$vocid/page/?".$query; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | $this->redirect303($url); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | // guess vocabulary based on URI |
| 58 | 58 | $vocab = $this->model->guessVocabularyFromURI($request->getUri()); |
| 59 | 59 | if ($vocab === null) { |
| 60 | - return $this->returnError('404', 'Not Found', 'Unrecognized URI ' . $request->getUri()); |
|
| 60 | + return $this->returnError('404', 'Not Found', 'Unrecognized URI '.$request->getUri()); |
|
| 61 | 61 | } |
| 62 | 62 | $request->setVocab($vocab->getId()); |
| 63 | 63 | } |
@@ -28,17 +28,17 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | private $configModifiedTime = null; |
| 30 | 30 | |
| 31 | - public function __construct($config_name='/../config.ttl') |
|
| 31 | + public function __construct($config_name = '/../config.ttl') |
|
| 32 | 32 | { |
| 33 | 33 | $this->cache = new Cache(); |
| 34 | 34 | try { |
| 35 | - $this->filePath = realpath( dirname(__FILE__) . $config_name ); |
|
| 35 | + $this->filePath = realpath(dirname(__FILE__).$config_name); |
|
| 36 | 36 | if (!file_exists($this->filePath)) { |
| 37 | 37 | throw new Exception('config.ttl file is missing, please provide one.'); |
| 38 | 38 | } |
| 39 | 39 | $this->initializeConfig(); |
| 40 | 40 | } catch (Exception $e) { |
| 41 | - echo "Error: " . $e->getMessage(); |
|
| 41 | + echo "Error: ".$e->getMessage(); |
|
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | // use APC user cache to store parsed config.ttl configuration |
| 73 | 73 | if ($this->cache->isAvailable() && !is_null($this->configModifiedTime)) { |
| 74 | 74 | // @codeCoverageIgnoreStart |
| 75 | - $key = realpath($this->filePath) . ", " . $this->configModifiedTime; |
|
| 76 | - $nskey = "namespaces of " . $key; |
|
| 75 | + $key = realpath($this->filePath).", ".$this->configModifiedTime; |
|
| 76 | + $nskey = "namespaces of ".$key; |
|
| 77 | 77 | $this->graph = $this->cache->fetch($key); |
| 78 | 78 | $this->namespaces = $this->cache->fetch($nskey); |
| 79 | 79 | if ($this->graph === false || $this->namespaces === false) { // was not found in cache |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $this->resource = $configResources[0]; |
| 95 | 95 | $this->initializeNamespaces(); |
| 96 | 96 | } catch (Exception $e) { |
| 97 | - echo "Error: " . $e->getMessage(); |
|
| 97 | + echo "Error: ".$e->getMessage(); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | public function getGlobalPlugins() |
| 325 | 325 | { |
| 326 | 326 | $globalPlugins = array(); |
| 327 | - $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
| 327 | + $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
| 328 | 328 | if ($globalPluginsResource) { |
| 329 | 329 | foreach ($globalPluginsResource as $resource) { |
| 330 | 330 | $globalPlugins[] = $resource->getValue(); |
@@ -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) { |
@@ -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; |