@@ -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 | } |
@@ -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 | } |