@@ -14,7 +14,7 @@ |
||
14 | 14 | $opts = array('http' => array('method' => 'HEAD', |
15 | 15 | 'user_agent' => 'Skosmos', |
16 | 16 | 'timeout' => $timeout)); |
17 | - $context = stream_context_create($opts); |
|
17 | + $context = stream_context_create($opts); |
|
18 | 18 | $fd = fopen($this->uri, 'rb', false, $context); |
19 | 19 | $headers = stream_get_meta_data($fd)['wrapper_data']; |
20 | 20 | foreach ($headers as $header) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $ret[$name] = $files[$type]; |
63 | 63 | } else { |
64 | 64 | foreach ($files[$type] as $file) { |
65 | - array_push($ret[$name], 'plugins/' . $name . '/' . $file); |
|
65 | + array_push($ret[$name], 'plugins/'.$name.'/'.$file); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if (file_exists($path)) { |
146 | 146 | $filename = explode('/', $path); |
147 | 147 | $filename = $filename[sizeof($filename) - 1]; |
148 | - $id = $folder . '-' . substr($filename, 0, (strrpos($filename, "."))); |
|
148 | + $id = $folder.'-'.substr($filename, 0, (strrpos($filename, "."))); |
|
149 | 149 | $templateStrings[$id] = file_get_contents($path); |
150 | 150 | } |
151 | 151 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | protected function flatten($array) |
200 | 200 | { |
201 | 201 | $return = array(); |
202 | - array_walk_recursive($array, function ($a) use (&$return) { $return[] = $a; }); |
|
202 | + array_walk_recursive($array, function($a) use (&$return) { $return[] = $a; }); |
|
203 | 203 | return $return; |
204 | 204 | } |
205 | 205 |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | // specify where to look for templates and cache |
40 | - $loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../view'); |
|
40 | + $loader = new \Twig\Loader\FilesystemLoader(__DIR__.'/../view'); |
|
41 | 41 | // initialize Twig environment |
42 | - $this->twig = new \Twig\Environment($loader, array('cache' => $tmpDir,'auto_reload' => true)); |
|
42 | + $this->twig = new \Twig\Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true)); |
|
43 | 43 | // used for setting the base href for the relative urls |
44 | 44 | $this->twig->addGlobal("BaseHref", $this->getBaseHref()); |
45 | 45 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $this->twig->addExtension(new LinkUrlExtension($model)); |
54 | 54 | |
55 | 55 | // register a Twig filter for generating strings from language codes with CLDR |
56 | - $langFilter = new \Twig\TwigFilter('lang_name', function ($langcode, $lang) { |
|
56 | + $langFilter = new \Twig\TwigFilter('lang_name', function($langcode, $lang) { |
|
57 | 57 | return Language::getName($langcode, $lang); |
58 | 58 | }); |
59 | 59 | $this->twig->addFilter($langFilter); |
@@ -239,16 +239,16 @@ discard block |
||
239 | 239 | |
240 | 240 | private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender) |
241 | 241 | { |
242 | - $headers = "MIME-Version: 1.0" . "\r\n"; |
|
243 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
242 | + $headers = "MIME-Version: 1.0"."\r\n"; |
|
243 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
244 | 244 | if (!empty($toMail)) { |
245 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
245 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
246 | 246 | } |
247 | 247 | if (!empty($fromEmail)) { |
248 | 248 | $headers .= "Reply-To: $fromName <$fromEmail>\r\n"; |
249 | 249 | } |
250 | 250 | $service = $this->model->getConfig()->getServiceName(); |
251 | - return $headers . "From: $fromName via $service <$sender>"; |
|
251 | + return $headers."From: $fromName via $service <$sender>"; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null) |
263 | 263 | { |
264 | 264 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
265 | - $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject; |
|
265 | + $messageSubject = "[".$this->model->getConfig()->getServiceName()."] ".$messageSubject; |
|
266 | 266 | if ($fromVocab !== null && $fromVocab !== '') { |
267 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
267 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
268 | 268 | } |
269 | 269 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
270 | 270 | // determine the sender address of the message |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender); |
284 | 284 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
285 | 285 | // adding some information about the user for debugging purposes. |
286 | - $message = $message . "<br /><br /> Debugging information:" |
|
287 | - . "<br />Timestamp: " . date(DATE_RFC2822) |
|
288 | - . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT') |
|
289 | - . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER'); |
|
286 | + $message = $message."<br /><br /> Debugging information:" |
|
287 | + . "<br />Timestamp: ".date(DATE_RFC2822) |
|
288 | + . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT') |
|
289 | + . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER'); |
|
290 | 290 | |
291 | 291 | try { |
292 | 292 | mail($toAddress, $messageSubject, $message, $headers, $params); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | header("HTTP/1.0 404 Not Found"); |
295 | 295 | $template = $this->twig->load('error.twig'); |
296 | 296 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
297 | - error_log('Caught exception: ' . $e->getMessage()); |
|
297 | + error_log('Caught exception: '.$e->getMessage()); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | echo $template->render( |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | } catch (ValueError $e) { |
348 | 348 | // fail fast with an error page if the vocabulary cannot be found |
349 | 349 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
350 | - error_log('Caught exception: ' . $e->getMessage()); |
|
350 | + error_log('Caught exception: '.$e->getMessage()); |
|
351 | 351 | } |
352 | 352 | header("HTTP/1.0 400 Bad Request"); |
353 | 353 | $this->invokeGenericErrorPage($request, $e->getMessage()); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $errored = true; |
370 | 370 | header("HTTP/1.0 500 Internal Server Error"); |
371 | 371 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
372 | - error_log('Caught exception: ' . $e->getMessage()); |
|
372 | + error_log('Caught exception: '.$e->getMessage()); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | $vocabList = $this->model->getVocabularyList(); |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | } catch (Exception $e) { |
410 | 410 | header("HTTP/1.0 500 Internal Server Error"); |
411 | 411 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
412 | - error_log('Caught exception: ' . $e->getMessage()); |
|
412 | + error_log('Caught exception: '.$e->getMessage()); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | echo $template->render( |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } catch (Exception $e) { |
435 | 435 | header("HTTP/1.0 404 Not Found"); |
436 | 436 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
437 | - error_log('Caught exception: ' . $e->getMessage()); |
|
437 | + error_log('Caught exception: '.$e->getMessage()); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | echo $template->render( |
@@ -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); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // guess vocabulary based on URI |
59 | 59 | $vocab = $this->model->guessVocabularyFromURI($request->getUri()); |
60 | 60 | if ($vocab === null) { |
61 | - return $this->returnError('404', 'Not Found', 'Unrecognized URI ' . $request->getUri()); |
|
61 | + return $this->returnError('404', 'Not Found', 'Unrecognized URI '.$request->getUri()); |
|
62 | 62 | } |
63 | 63 | $request->setVocab($vocab->getId()); |
64 | 64 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // wrap with JSONP callback if requested |
26 | 26 | if (filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_FULL_SPECIAL_CHARS)) { |
27 | 27 | header("Content-type: application/javascript; charset=utf-8"); |
28 | - echo filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "(" . json_encode($data) . ");"; |
|
28 | + echo filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_FULL_SPECIAL_CHARS)."(".json_encode($data).");"; |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | 'vocabularies' => 'onki:hasVocabulary', |
89 | 89 | 'id' => 'onki:vocabularyIdentifier', |
90 | 90 | 'uri' => '@id', |
91 | - '@base' => $this->getBaseHref() . "rest/v1/vocabularies", |
|
91 | + '@base' => $this->getBaseHref()."rest/v1/vocabularies", |
|
92 | 92 | ), |
93 | 93 | 'uri' => '', |
94 | 94 | 'vocabularies' => $results, |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | foreach ($parameters->getAdditionalFields() as $field) { |
137 | 137 | |
138 | 138 | // Quick-and-dirty compactification |
139 | - $context[$field] = 'skos:' . $field; |
|
139 | + $context[$field] = 'skos:'.$field; |
|
140 | 140 | foreach ($results as &$result) { |
141 | 141 | foreach ($result as $k => $v) { |
142 | - if ($k == 'skos:' . $field) { |
|
142 | + if ($k == 'skos:'.$field) { |
|
143 | 143 | $result[$field] = $v; |
144 | - unset($result['skos:' . $field]); |
|
144 | + unset($result['skos:'.$field]); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | 'prefLabel' => 'skos:prefLabel', |
233 | 233 | 'title' => 'dct:title', |
234 | 234 | '@language' => $request->getLang(), |
235 | - '@base' => $this->getBaseHref() . "rest/v1/" . $vocab->getId() . "/", |
|
235 | + '@base' => $this->getBaseHref()."rest/v1/".$vocab->getId()."/", |
|
236 | 236 | ), |
237 | 237 | 'uri' => '', |
238 | 238 | 'id' => $vocab->getId(), |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | 'subTypes' => array('@id' => 'void:class', '@type' => '@id'), |
288 | 288 | 'count' => 'void:entities', |
289 | 289 | '@language' => $request->getLang(), |
290 | - '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/", |
|
290 | + '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/", |
|
291 | 291 | ), |
292 | 292 | 'uri' => '', |
293 | 293 | 'id' => $request->getVocab()->getId(), |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | 'language' => 'void-ext:language', |
370 | 370 | 'properties' => 'void:propertyPartition', |
371 | 371 | 'labels' => 'void:triples', |
372 | - '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/", |
|
372 | + '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/", |
|
373 | 373 | ), |
374 | 374 | 'uri' => '', |
375 | 375 | 'id' => $request->getVocab()->getId(), |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $types[] = $type; |
411 | 411 | } |
412 | 412 | |
413 | - $base = $request->getVocab() ? $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/" : $this->getBaseHref() . "rest/v1/"; |
|
413 | + $base = $request->getVocab() ? $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/" : $this->getBaseHref()."rest/v1/"; |
|
414 | 414 | |
415 | 415 | $ret = array_merge_recursive( |
416 | 416 | $this->context, |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | if ($lang === null) { |
458 | 458 | // case 1A: exact match on preferred label in any language |
459 | 459 | foreach ($results as $res) { |
460 | - if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel'] == $label) { |
|
460 | + if (isset($res['matchedPrefLabel']) && $res['matchedPrefLabel'] == $label) { |
|
461 | 461 | $res['prefLabel'] = $res['matchedPrefLabel']; |
462 | 462 | unset($res['matchedPrefLabel']); |
463 | 463 | $hits[] = $res; |
@@ -592,19 +592,19 @@ discard block |
||
592 | 592 | |
593 | 593 | $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format')); |
594 | 594 | if (!$format) { |
595 | - return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls))); |
|
595 | + return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls))); |
|
596 | 596 | } |
597 | 597 | if (is_array($urls[$format])) { |
598 | 598 | $arr = $urls[$format]; |
599 | 599 | $dataLang = $request->getLang(); |
600 | 600 | if (isset($arr[$dataLang])) { |
601 | - header("Location: " . $arr[$dataLang]); |
|
601 | + header("Location: ".$arr[$dataLang]); |
|
602 | 602 | } else { |
603 | 603 | $vocid = $request->getVocab()->getId(); |
604 | 604 | return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang"); |
605 | 605 | } |
606 | 606 | } else { |
607 | - header("Location: " . $urls[$format]); |
|
607 | + header("Location: ".$urls[$format]); |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | |
669 | 669 | $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format')); |
670 | 670 | if (!$format) { |
671 | - return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS); |
|
671 | + return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | $vocid = $vocab ? $vocab->getId() : null; |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | } |
963 | 963 | } |
964 | 964 | // if the main concept scheme was not found, set 'top' to the first 'tops' (sorted alphabetically on the URIs) |
965 | - if (! isset($results[$uri]['top'])) { |
|
965 | + if (!isset($results[$uri]['top'])) { |
|
966 | 966 | $results[$uri]['top'] = $results[$uri]['tops'][0]; |
967 | 967 | } |
968 | 968 | } else { |
@@ -1165,10 +1165,10 @@ discard block |
||
1165 | 1165 | } |
1166 | 1166 | return $this->returnJson(array_merge_recursive( |
1167 | 1167 | $this->context, |
1168 | - array('@context' => array( '@language' => $request->getLang(), |
|
1168 | + array('@context' => array('@language' => $request->getLang(), |
|
1169 | 1169 | 'prefLabel' => 'skos:prefLabel', |
1170 | 1170 | 'xsd' => 'http://www.w3.org/2001/XMLSchema#', |
1171 | - 'date' => array( '@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime') ) |
|
1171 | + 'date' => array('@id' => 'http://purl.org/dc/terms/date', '@type' => 'http://www.w3.org/2001/XMLSchema#dateTime')) |
|
1172 | 1172 | ), |
1173 | 1173 | array('changeList' => $simpleChangeList) |
1174 | 1174 | )); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $this->translator = new Translator($langcode); |
41 | 41 | } |
42 | 42 | $this->translator->addLoader('json', new JsonFileLoader()); |
43 | - $this->translator->addResource('json', __DIR__.'/../../resource/translations/messages.' . $langcode . '.json', $langcode); |
|
43 | + $this->translator->addResource('json', __DIR__.'/../../resource/translations/messages.'.$langcode.'.json', $langcode); |
|
44 | 44 | } |
45 | 45 | $this->initializeLogging(); |
46 | 46 | } |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
535 | 535 | if ($this->getConfig()->getLogCaughtExceptions()) { |
536 | - error_log('Caught exception: ' . $e->getMessage()); |
|
536 | + error_log('Caught exception: '.$e->getMessage()); |
|
537 | 537 | } |
538 | 538 | break; |
539 | 539 | } |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
551 | 551 | if ($this->getConfig()->getLogCaughtExceptions()) { |
552 | - error_log('Caught exception: ' . $e->getMessage()); |
|
552 | + error_log('Caught exception: '.$e->getMessage()); |
|
553 | 553 | } |
554 | 554 | break; |
555 | 555 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | // using apc cache for the resource if available |
623 | 623 | if ($this->globalConfig->getCache()->isAvailable()) { |
624 | 624 | // @codeCoverageIgnoreStart |
625 | - $key = 'fetch: ' . $uri; |
|
625 | + $key = 'fetch: '.$uri; |
|
626 | 626 | $resource = $this->globalConfig->getCache()->fetch($key); |
627 | 627 | if ($resource === null || $resource === false) { // was not found in cache, or previous request failed |
628 | 628 | $resource = $this->resolver->resolve($uri, $this->getConfig()->getHttpTimeout()); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | */ |
644 | 644 | public function getSparqlImplementation($dialect, $endpoint, $graph) |
645 | 645 | { |
646 | - $classname = $dialect . "Sparql"; |
|
646 | + $classname = $dialect."Sparql"; |
|
647 | 647 | |
648 | 648 | return new $classname($endpoint, $graph, $this); |
649 | 649 | } |