@@ -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(  | 
                                                        
@@ -341,13 +341,13 @@ discard block  | 
                                                    ||
| 341 | 341 |          $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; | 
                                                        
| 342 | 342 | $vocabObjects = array();  | 
                                                        
| 343 | 343 |          if ($vocids) { | 
                                                        
| 344 | -            foreach($vocids as $vocid) { | 
                                                        |
| 344 | +            foreach ($vocids as $vocid) { | 
                                                        |
| 345 | 345 |                  try { | 
                                                        
| 346 | 346 | $vocabObjects[] = $this->model->getVocabulary($vocid);  | 
                                                        
| 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();  | 
                                                        
@@ -381,7 +381,7 @@ discard block  | 
                                                    ||
| 381 | 381 | 'search_count' => $counts,  | 
                                                        
| 382 | 382 | 'languages' => $this->languages,  | 
                                                        
| 383 | 383 | 'search_results' => $searchResults,  | 
                                                        
| 384 | - 'rest' => $parameters->getOffset()>0,  | 
                                                        |
| 384 | + 'rest' => $parameters->getOffset() > 0,  | 
                                                        |
| 385 | 385 | 'global_search' => true,  | 
                                                        
| 386 | 386 | 'search_failed' => $errored,  | 
                                                        
| 387 | 387 |                  'term' => $request->getQueryParamRaw('q'), | 
                                                        
@@ -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(  | 
                                                        
@@ -453,7 +453,7 @@ discard block  | 
                                                    ||
| 453 | 453 | 'vocab' => $vocab,  | 
                                                        
| 454 | 454 | 'search_results' => $searchResults,  | 
                                                        
| 455 | 455 | 'search_count' => $counts,  | 
                                                        
| 456 | - 'rest' => $parameters->getOffset()>0,  | 
                                                        |
| 456 | + 'rest' => $parameters->getOffset() > 0,  | 
                                                        |
| 457 | 457 | 'limit_parent' => $parameters->getParentLimit(),  | 
                                                        
| 458 | 458 |                  'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null, | 
                                                        
| 459 | 459 | 'limit_group' => $parameters->getGroupLimit(),  | 
                                                        
@@ -53,15 +53,15 @@  | 
                                                    ||
| 53 | 53 | |
| 54 | 54 | $localname = $vocab->getLocalName($uri);  | 
                                                        
| 55 | 55 |          if ($localname !== $uri && $localname === urlencode($localname)) { | 
                                                        
| 56 | - $paramstr = count($params) > 0 ? '?' . http_build_query($params) : '';  | 
                                                        |
| 56 | + $paramstr = count($params) > 0 ? '?'.http_build_query($params) : '';  | 
                                                        |
| 57 | 57 |              if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) { | 
                                                        
| 58 | - return "$vocid/$lang/$type/$localname" . $paramstr;  | 
                                                        |
| 58 | + return "$vocid/$lang/$type/$localname".$paramstr;  | 
                                                        |
| 59 | 59 | }  | 
                                                        
| 60 | 60 | |
| 61 | - return "$vocid/$lang/$localname" . $paramstr;  | 
                                                        |
| 61 | + return "$vocid/$lang/$localname".$paramstr;  | 
                                                        |
| 62 | 62 | }  | 
                                                        
| 63 | 63 | |
| 64 | 64 | $params['uri'] = $uri;  | 
                                                        
| 65 | - return "$vocid/$lang/$type/?" . http_build_query($params);  | 
                                                        |
| 65 | + return "$vocid/$lang/$type/?".http_build_query($params);  | 
                                                        |
| 66 | 66 | }  | 
                                                        
| 67 | 67 | }  | 
                                                        
@@ -220,7 +220,7 @@  | 
                                                    ||
| 220 | 220 |      { | 
                                                        
| 221 | 221 |          if ($modifiedDate) { | 
                                                        
| 222 | 222 | $ifModifiedSince = $this->getIfModifiedSince();  | 
                                                        
| 223 | -            $this->sendHeader("Last-Modified: " . $modifiedDate->format('D, d M Y H:i:s \G\M\T')); | 
                                                        |
| 223 | +            $this->sendHeader("Last-Modified: ".$modifiedDate->format('D, d M Y H:i:s \G\M\T')); | 
                                                        |
| 224 | 224 |              if ($ifModifiedSince !== null && $ifModifiedSince >= $modifiedDate) { | 
                                                        
| 225 | 225 |                  $this->sendHeader("HTTP/1.0 304 Not Modified"); | 
                                                        
| 226 | 226 | return true;  |