@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function extract($directory, MessageCatalogue $catalogue): void |
| 23 | 23 | { |
| 24 | 24 | if (!is_dir($this->directory)) { |
| 25 | - echo "Invalid directory: $this->directory" . PHP_EOL; |
|
| 25 | + echo "Invalid directory: $this->directory".PHP_EOL; |
|
| 26 | 26 | return; |
| 27 | 27 | } |
| 28 | 28 | $iterator = new \RecursiveIteratorIterator( |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $content = file_get_contents($file->getPathname()); |
| 36 | 36 | preg_match_all('/\$t\([\'"]([^\'"]+)[\'"]\)/', $content, $matches); |
| 37 | 37 | foreach ($matches[1] as $key) { |
| 38 | - $catalogue->set($this->prefix . $key, $key); |
|
| 38 | + $catalogue->set($this->prefix.$key, $key); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -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 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | protected function flatten($array) |
| 164 | 164 | { |
| 165 | 165 | $return = array(); |
| 166 | - array_walk_recursive($array, function ($a) use (&$return) { $return[] = $a; }); |
|
| 166 | + array_walk_recursive($array, function($a) use (&$return) { $return[] = $a; }); |
|
| 167 | 167 | return $return; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -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 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $result = $sparql->queryConceptScheme($defaultcs); |
| 167 | 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 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | foreach ($conceptscheme->allLiterals($prop, null) as $val) { |
| 200 | 200 | $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop; |
| 201 | 201 | if ($val->getValue() instanceof DateTime) { |
| 202 | - $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
| 202 | + $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang); |
|
| 203 | 203 | } |
| 204 | 204 | $ret[$prop][] = $val; |
| 205 | 205 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang); |
| 257 | 257 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 258 | 258 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 259 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 259 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | return $conceptSchemes; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | // don't know how to parse |
| 329 | 329 | $rev = $parts[2]; |
| 330 | - $datestr = $parts[3] . ' ' . $parts[4]; |
|
| 330 | + $datestr = $parts[3].' '.$parts[4]; |
|
| 331 | 331 | |
| 332 | 332 | return "$datestr (r$rev)"; |
| 333 | 333 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | $conceptInfo = $sparql->queryConceptInfo([$uri], $this->config->getArrayClassURI(), array($this), $clang); |
| 458 | 458 | } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) { |
| 459 | 459 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 460 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 460 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | 463 | if (!$conceptInfo) { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function getDescription() |
| 81 | 81 | { |
| 82 | - $helpprop = $this->prop . "_help"; |
|
| 82 | + $helpprop = $this->prop."_help"; |
|
| 83 | 83 | |
| 84 | 84 | // see if we have a translation with the help text |
| 85 | 85 | $help = $this->model->getText($helpprop); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function addValue($value) |
| 112 | 112 | { |
| 113 | - $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel(allowExternal: false) . rtrim(' ' . $value->getUri())] = $value; |
|
| 113 | + $this->values[ltrim($value->getNotation().' ').$value->getLabel(allowExternal: false).rtrim(' '.$value->getUri())] = $value; |
|
| 114 | 114 | $this->is_sorted = false; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | # Note that getLabel() returns URIs in case of no label and may return a prefixed value which affects sorting |
| 121 | 121 | if (!empty($this->values)) { |
| 122 | 122 | if ($this->sort_by_notation) { |
| 123 | - uasort($this->values, function ($a, $b) { |
|
| 123 | + uasort($this->values, function($a, $b) { |
|
| 124 | 124 | $anot = $a->getNotation(); |
| 125 | 125 | $bnot = $b->getNotation(); |
| 126 | 126 | if ($anot == null) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | }); |
| 143 | 143 | } else { |
| 144 | - uasort($this->values, function ($a, $b) { |
|
| 144 | + uasort($this->values, function($a, $b) { |
|
| 145 | 145 | // assume that sort keys are unique |
| 146 | 146 | return strcoll($a->getSortKey(), $b->getSortKey()); |
| 147 | 147 | }); |
@@ -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() |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function getLabel($lang = '', $allowExternal = true) |
| 48 | 48 | { |
| 49 | - $key = $lang . "/" . ($allowExternal ? "true" : "false"); |
|
| 49 | + $key = $lang."/".($allowExternal ? "true" : "false"); |
|
| 50 | 50 | if (isset($this->labelcache[$key])) { |
| 51 | 51 | return $this->labelcache[$key]; |
| 52 | 52 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function getSortKey() |
| 60 | 60 | { |
| 61 | - return strtolower($this->getVocabName() . ": " . $this->getLabel()); |
|
| 61 | + return strtolower($this->getVocabName().": ".$this->getLabel()); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | private function queryLabel($lang = '', $allowExternal = true) |
@@ -187,25 +187,25 @@ discard block |
||
| 187 | 187 | 'from' => [ |
| 188 | 188 | 'memberSet' => [ |
| 189 | 189 | [ |
| 190 | - 'uri' => (string) $this->source->getUri(), |
|
| 190 | + 'uri' => (string)$this->source->getUri(), |
|
| 191 | 191 | ] |
| 192 | 192 | ] |
| 193 | 193 | ], |
| 194 | 194 | 'to' => [ |
| 195 | 195 | 'memberSet' => [ |
| 196 | 196 | [ |
| 197 | - 'uri' => (string) $this->getUri() |
|
| 197 | + 'uri' => (string)$this->getUri() |
|
| 198 | 198 | ] |
| 199 | 199 | ] |
| 200 | 200 | ], |
| 201 | 201 | // EXTRA |
| 202 | 202 | 'hrefLink' => $hrefLink, // link to resource as displayed in the UI |
| 203 | 203 | 'lang' => $propertyLang, // TBD: could it be part of the prefLabel? |
| 204 | - 'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI |
|
| 204 | + 'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI |
|
| 205 | 205 | 'typeLabel' => $this->model->getText($this->type), // a text used in the UI instead of, for example, skos:closeMatch |
| 206 | 206 | ]; |
| 207 | 207 | |
| 208 | - $helpprop = $this->type . "_help"; |
|
| 208 | + $helpprop = $this->type."_help"; |
|
| 209 | 209 | // see if we have a translation for the property help text |
| 210 | 210 | $help = $this->model->getText($helpprop); |
| 211 | 211 | if ($help != $helpprop) { |
@@ -215,20 +215,20 @@ discard block |
||
| 215 | 215 | $fromScheme = $this->vocab->getDefaultConceptScheme(); |
| 216 | 216 | if (isset($fromScheme)) { |
| 217 | 217 | $ret['fromScheme'] = [ |
| 218 | - 'uri' => (string) $fromScheme, |
|
| 218 | + 'uri' => (string)$fromScheme, |
|
| 219 | 219 | ]; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | $exvocab = $this->getExvocab(); |
| 223 | 223 | if (isset($exvocab)) { |
| 224 | 224 | $ret['toScheme'] = [ |
| 225 | - 'uri' => (string) $exvocab->getDefaultConceptScheme(), |
|
| 225 | + 'uri' => (string)$exvocab->getDefaultConceptScheme(), |
|
| 226 | 226 | ]; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $notation = $this->getNotation(); |
| 230 | 230 | if (isset($notation)) { |
| 231 | - $ret['to']['memberSet'][0]['notation'] = (string) $notation; |
|
| 231 | + $ret['to']['memberSet'][0]['notation'] = (string)$notation; |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $label = $this->getLabel($lang, $allowExternal); |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | // Build base URL |
| 29 | 29 | if ($vocabid && $vocabid !== '') { |
| 30 | - $url = $vocabid . '/'; |
|
| 30 | + $url = $vocabid.'/'; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $url .= $lang; |
| 34 | 34 | |
| 35 | 35 | // Add page suffix for non-home pages |
| 36 | 36 | if ($page !== 'home') { |
| 37 | - $url .= '/' . $page; |
|
| 37 | + $url .= '/'.$page; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // Build query parameters |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | // Append parameters if any |
| 54 | 54 | if (!empty($params)) { |
| 55 | - $url .= '?' . http_build_query($params); |
|
| 55 | + $url .= '?'.http_build_query($params); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return $url; |
@@ -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', __DIR__ . '/../../slots']); |
|
| 40 | + $loader = new \Twig\Loader\FilesystemLoader([__DIR__.'/../view', __DIR__.'/../../slots']); |
|
| 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 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $this->twig->addExtension(new LinkUrlExtension($model)); |
| 57 | 57 | |
| 58 | 58 | // register a Twig filter for generating strings from language codes with CLDR |
| 59 | - $langFilter = new \Twig\TwigFilter('lang_name', function ($langcode, $lang) { |
|
| 59 | + $langFilter = new \Twig\TwigFilter('lang_name', function($langcode, $lang) { |
|
| 60 | 60 | return Language::getName($langcode, $lang); |
| 61 | 61 | }); |
| 62 | 62 | $this->twig->addFilter($langFilter); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | foreach ($slotSubDirs as $slotDir) { |
| 79 | 79 | $slotName = basename($slotDir); |
| 80 | - $files = glob($slotDir . '/*.twig'); |
|
| 80 | + $files = glob($slotDir.'/*.twig'); |
|
| 81 | 81 | // Strip the "../slots" prefix, it's not needed. |
| 82 | 82 | // The "slots" directory is registered to the Twig FilesystemLoader. |
| 83 | 83 | $slots[$slotName] = preg_filter('|../slots/|', '', $files); |
@@ -255,16 +255,16 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender) |
| 257 | 257 | { |
| 258 | - $headers = "MIME-Version: 1.0" . "\r\n"; |
|
| 259 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
| 258 | + $headers = "MIME-Version: 1.0"."\r\n"; |
|
| 259 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
| 260 | 260 | if (!empty($toMail)) { |
| 261 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
| 261 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
| 262 | 262 | } |
| 263 | 263 | if (!empty($fromEmail)) { |
| 264 | 264 | $headers .= "Reply-To: $fromName <$fromEmail>\r\n"; |
| 265 | 265 | } |
| 266 | 266 | $service = $this->model->getConfig()->getServiceName(); |
| 267 | - return $headers . "From: $fromName via $service <$sender>"; |
|
| 267 | + return $headers."From: $fromName via $service <$sender>"; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -278,9 +278,9 @@ discard block |
||
| 278 | 278 | public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null) |
| 279 | 279 | { |
| 280 | 280 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
| 281 | - $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject; |
|
| 281 | + $messageSubject = "[".$this->model->getConfig()->getServiceName()."] ".$messageSubject; |
|
| 282 | 282 | if ($fromVocab !== null && $fromVocab !== '') { |
| 283 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
| 283 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
| 284 | 284 | } |
| 285 | 285 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
| 286 | 286 | // determine the sender address of the message |
@@ -299,10 +299,10 @@ discard block |
||
| 299 | 299 | $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender); |
| 300 | 300 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
| 301 | 301 | // adding some information about the user for debugging purposes. |
| 302 | - $message = $message . "<br /><br /> Debugging information:" |
|
| 303 | - . "<br />Timestamp: " . date(DATE_RFC2822) |
|
| 304 | - . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT') |
|
| 305 | - . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER'); |
|
| 302 | + $message = $message."<br /><br /> Debugging information:" |
|
| 303 | + . "<br />Timestamp: ".date(DATE_RFC2822) |
|
| 304 | + . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT') |
|
| 305 | + . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER'); |
|
| 306 | 306 | |
| 307 | 307 | try { |
| 308 | 308 | mail($toAddress, $messageSubject, $message, $headers, $params); |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | header("HTTP/1.0 404 Not Found"); |
| 311 | 311 | $template = $this->twig->load('error.twig'); |
| 312 | 312 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 313 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 313 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | echo $template->render( |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | } catch (ValueError $e) { |
| 364 | 364 | // fail fast with an error page if the vocabulary cannot be found |
| 365 | 365 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 366 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 366 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 367 | 367 | } |
| 368 | 368 | header("HTTP/1.0 400 Bad Request"); |
| 369 | 369 | $this->invokeGenericErrorPage($request, $e->getMessage()); |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | $errored = true; |
| 386 | 386 | header("HTTP/1.0 500 Internal Server Error"); |
| 387 | 387 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 388 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 388 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | $vocabList = $this->model->getVocabularyList(); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | } catch (Exception $e) { |
| 426 | 426 | header("HTTP/1.0 500 Internal Server Error"); |
| 427 | 427 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 428 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 428 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | echo $template->render( |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | } catch (Exception $e) { |
| 451 | 451 | header("HTTP/1.0 404 Not Found"); |
| 452 | 452 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 453 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 453 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | echo $template->render( |