@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | // register a Twig filter for generating URLs for vocabulary resources (concepts and groups) |
67 | 67 | $controller = $this; // for use by anonymous function below |
68 | - $urlFilter = new Twig_SimpleFilter('link_url', function ($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) { |
|
68 | + $urlFilter = new Twig_SimpleFilter('link_url', function($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) { |
|
69 | 69 | // $vocab can either be null, a vocabulary id (string) or a Vocabulary object |
70 | 70 | if ($vocab === null) { |
71 | 71 | // target vocabulary is unknown, best bet is to link to the plain URI |
@@ -90,23 +90,23 @@ discard block |
||
90 | 90 | $localname = $vocab->getLocalName($uri); |
91 | 91 | if ($localname !== $uri && $localname === urlencode($localname)) { |
92 | 92 | // check that the prefix stripping worked, and there are no problematic chars in localname |
93 | - $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : ''; |
|
93 | + $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : ''; |
|
94 | 94 | if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) { |
95 | - return "$vocid/$lang/$type/$localname" . $paramstr; |
|
95 | + return "$vocid/$lang/$type/$localname".$paramstr; |
|
96 | 96 | } |
97 | 97 | |
98 | - return "$vocid/$lang/$localname" . $paramstr; |
|
98 | + return "$vocid/$lang/$localname".$paramstr; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // case 2: URI outside vocabulary namespace, or has problematic chars |
102 | 102 | // pass the full URI as parameter instead |
103 | 103 | $params['uri'] = $uri; |
104 | - return "$vocid/$lang/$type/?" . http_build_query($params); |
|
104 | + return "$vocid/$lang/$type/?".http_build_query($params); |
|
105 | 105 | }); |
106 | 106 | $this->twig->addFilter($urlFilter); |
107 | 107 | |
108 | 108 | // register a Twig filter for generating strings from language codes with CLDR |
109 | - $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) { |
|
109 | + $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) { |
|
110 | 110 | return Language::getName($langcode, $lang); |
111 | 111 | }); |
112 | 112 | $this->twig->addFilter($langFilter); |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | private function createFeedbackHeaders($fromName, $fromEmail, $toMail) |
274 | 274 | { |
275 | 275 | $headers = "MIME-Version: 1.0″ . '\r\n"; |
276 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
276 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
277 | 277 | if ($toMail) { |
278 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
278 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
279 | 279 | } |
280 | 280 | |
281 | - $headers .= "From: $fromName <$fromEmail>" . "\r\n" . 'X-Mailer: PHP/' . phpversion(); |
|
281 | + $headers .= "From: $fromName <$fromEmail>"."\r\n".'X-Mailer: PHP/'.phpversion(); |
|
282 | 282 | return $headers; |
283 | 283 | } |
284 | 284 | |
@@ -293,20 +293,20 @@ discard block |
||
293 | 293 | { |
294 | 294 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
295 | 295 | if ($fromVocab !== null && $fromVocab !== '') { |
296 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
296 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
297 | 297 | } |
298 | 298 | |
299 | - $subject = SERVICE_NAME . " feedback"; |
|
299 | + $subject = SERVICE_NAME." feedback"; |
|
300 | 300 | $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail); |
301 | 301 | $envelopeSender = FEEDBACK_ENVELOPE_SENDER; |
302 | 302 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
303 | 303 | |
304 | 304 | // adding some information about the user for debugging purposes. |
305 | - $message = $message . "<br /><br /> Debugging information:" |
|
306 | - . "<br />Timestamp: " . date(DATE_RFC2822) |
|
307 | - . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT') |
|
308 | - . "<br />IP address: " . $request->getServerConstant('REMOTE_ADDR') |
|
309 | - . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER'); |
|
305 | + $message = $message."<br /><br /> Debugging information:" |
|
306 | + . "<br />Timestamp: ".date(DATE_RFC2822) |
|
307 | + . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT') |
|
308 | + . "<br />IP address: ".$request->getServerConstant('REMOTE_ADDR') |
|
309 | + . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER'); |
|
310 | 310 | |
311 | 311 | try { |
312 | 312 | mail($toAddress, $subject, $message, $headers, $params); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | header("HTTP/1.0 404 Not Found"); |
315 | 315 | $template = $this->twig->loadTemplate('error-page.twig'); |
316 | 316 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
317 | - error_log('Caught exception: ' . $e->getMessage()); |
|
317 | + error_log('Caught exception: '.$e->getMessage()); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | echo $template->render( |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
362 | 362 | $vocabObjects = array(); |
363 | 363 | if ($vocids) { |
364 | - foreach($vocids as $vocid) { |
|
364 | + foreach ($vocids as $vocid) { |
|
365 | 365 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
366 | 366 | } |
367 | 367 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } catch (Exception $e) { |
373 | 373 | header("HTTP/1.0 404 Not Found"); |
374 | 374 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
375 | - error_log('Caught exception: ' . $e->getMessage()); |
|
375 | + error_log('Caught exception: '.$e->getMessage()); |
|
376 | 376 | } |
377 | 377 | $this->invokeGenericErrorPage($request, $e->getMessage()); |
378 | 378 | return; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'search_count' => $counts, |
389 | 389 | 'languages' => $this->languages, |
390 | 390 | 'search_results' => $searchResults, |
391 | - 'rest' => $parameters->getOffset()>0, |
|
391 | + 'rest' => $parameters->getOffset() > 0, |
|
392 | 392 | 'global_search' => true, |
393 | 393 | 'term' => $request->getQueryParam('q'), |
394 | 394 | 'lang_list' => $langList, |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } catch (Exception $e) { |
414 | 414 | header("HTTP/1.0 404 Not Found"); |
415 | 415 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
416 | - error_log('Caught exception: ' . $e->getMessage()); |
|
416 | + error_log('Caught exception: '.$e->getMessage()); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | 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( |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | 'vocab' => $vocab, |
452 | 452 | 'search_results' => $searchResults, |
453 | 453 | 'search_count' => $counts, |
454 | - 'rest' => $parameters->getOffset()>0, |
|
454 | + 'rest' => $parameters->getOffset() > 0, |
|
455 | 455 | 'limit_parent' => $parameters->getParentLimit(), |
456 | 456 | 'limit_type' => $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null, |
457 | 457 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
577 | 577 | * @param Request $request |
578 | 578 | */ |
579 | - public function invokeChangeList($request, $prop='dc:created') |
|
579 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
580 | 580 | { |
581 | 581 | // set language parameters for gettext |
582 | 582 | $this->setLanguageProperties($request->getLang()); |