@@ -97,6 +97,9 @@ discard block |
||
97 | 97 | return $this->returnJson($ret); |
98 | 98 | } |
99 | 99 | |
100 | + /** |
|
101 | + * @param Request $request |
|
102 | + */ |
|
100 | 103 | private function constructSearchParameters($request) |
101 | 104 | { |
102 | 105 | $parameters = new ConceptSearchParameters($request, $this->model->getConfig(), true); |
@@ -112,6 +115,10 @@ discard block |
||
112 | 115 | return $parameters; |
113 | 116 | } |
114 | 117 | |
118 | + /** |
|
119 | + * @param Request $request |
|
120 | + * @param ConceptSearchParameters $parameters |
|
121 | + */ |
|
115 | 122 | private function transformSearchResults($request, $results, $parameters) |
116 | 123 | { |
117 | 124 | // before serializing to JSON, get rid of the Vocabulary object that came with each resource |
@@ -407,6 +414,10 @@ discard block |
||
407 | 414 | return $this->returnJson($ret); |
408 | 415 | } |
409 | 416 | |
417 | + /** |
|
418 | + * @param string $label |
|
419 | + * @param string $lang |
|
420 | + */ |
|
410 | 421 | private function findLookupHits($results, $label, $lang) |
411 | 422 | { |
412 | 423 | $hits = array(); |
@@ -468,6 +479,9 @@ discard block |
||
468 | 479 | return $hits; |
469 | 480 | } |
470 | 481 | |
482 | + /** |
|
483 | + * @param string $lang |
|
484 | + */ |
|
471 | 485 | private function transformLookupResults($lang, $hits) |
472 | 486 | { |
473 | 487 | if (sizeof($hits) == 0) { |
@@ -539,6 +553,9 @@ discard block |
||
539 | 553 | return $this->returnJson($ret); |
540 | 554 | } |
541 | 555 | |
556 | + /** |
|
557 | + * @param Request $request |
|
558 | + */ |
|
542 | 559 | private function redirectToVocabData($request) { |
543 | 560 | $urls = $request->getVocab()->getConfig()->getDataURLs(); |
544 | 561 | if (sizeof($urls) == 0) { |
@@ -564,6 +581,10 @@ discard block |
||
564 | 581 | } |
565 | 582 | } |
566 | 583 | |
584 | + /** |
|
585 | + * @param string $results |
|
586 | + * @param string $format |
|
587 | + */ |
|
567 | 588 | private function returnDataResults($results, $format) { |
568 | 589 | if ($format == 'application/ld+json' || $format == 'application/json') { |
569 | 590 | // further compact JSON-LD document using a context |
@@ -700,6 +721,12 @@ discard block |
||
700 | 721 | return $this->returnJson($ret); |
701 | 722 | } |
702 | 723 | |
724 | + /** |
|
725 | + * @param string $uri |
|
726 | + * @param string $lang |
|
727 | + * @param string $propname |
|
728 | + * @param string $propuri |
|
729 | + */ |
|
703 | 730 | private function transformPropertyResults($uri, $lang, $objects, $propname, $propuri) |
704 | 731 | { |
705 | 732 | $results = array(); |
@@ -714,6 +741,14 @@ discard block |
||
714 | 741 | ); |
715 | 742 | } |
716 | 743 | |
744 | + /** |
|
745 | + * @param string $uri |
|
746 | + * @param string $lang |
|
747 | + * @param string $tpropname |
|
748 | + * @param string $tpropuri |
|
749 | + * @param string $dpropname |
|
750 | + * @param string $dpropuri |
|
751 | + */ |
|
717 | 752 | private function transformTransitivePropertyResults($uri, $lang, $objects, $tpropname, $tpropuri, $dpropname, $dpropuri) |
718 | 753 | { |
719 | 754 | $results = array(); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | // specify where to look for templates and cache |
43 | 43 | $loader = new Twig_Loader_Filesystem('view'); |
44 | 44 | // initialize Twig environment |
45 | - $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true)); |
|
45 | + $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true)); |
|
46 | 46 | $this->twig->addExtension(new Twig_Extensions_Extension_I18n()); |
47 | 47 | // used for setting the base href for the relative urls |
48 | 48 | $this->twig->addGlobal("BaseHref", $this->getBaseHref()); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter'))); |
66 | 66 | |
67 | 67 | // register a Twig filter for generating strings from language codes with CLDR |
68 | - $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) { |
|
68 | + $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) { |
|
69 | 69 | return Language::getName($langcode, $lang); |
70 | 70 | }); |
71 | 71 | $this->twig->addFilter($langFilter); |
@@ -364,16 +364,16 @@ discard block |
||
364 | 364 | private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender) |
365 | 365 | { |
366 | 366 | $headers = "MIME-Version: 1.0″ . '\r\n"; |
367 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
367 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
368 | 368 | if (!empty($toMail)) { |
369 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
369 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
370 | 370 | } |
371 | 371 | if (!empty($fromEmail)) { |
372 | 372 | $headers .= "Reply-To: $fromName <$fromEmail>\r\n"; |
373 | 373 | } |
374 | 374 | |
375 | 375 | $service = $this->model->getConfig()->getServiceName(); |
376 | - return $headers . "From: $fromName via $service <$sender>"; |
|
376 | + return $headers."From: $fromName via $service <$sender>"; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | /** |
@@ -387,11 +387,11 @@ discard block |
||
387 | 387 | { |
388 | 388 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
389 | 389 | if ($fromVocab !== null && $fromVocab !== '') { |
390 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
390 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
394 | - $subject = $this->model->getConfig()->getServiceName() . " feedback"; |
|
394 | + $subject = $this->model->getConfig()->getServiceName()." feedback"; |
|
395 | 395 | // determine the sender address of the message |
396 | 396 | $sender = $this->model->getConfig()->getFeedbackSender(); |
397 | 397 | if (empty($sender)) $sender = $envelopeSender; |
@@ -404,10 +404,10 @@ discard block |
||
404 | 404 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
405 | 405 | |
406 | 406 | // adding some information about the user for debugging purposes. |
407 | - $message = $message . "<br /><br /> Debugging information:" |
|
408 | - . "<br />Timestamp: " . date(DATE_RFC2822) |
|
409 | - . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT') |
|
410 | - . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER'); |
|
407 | + $message = $message."<br /><br /> Debugging information:" |
|
408 | + . "<br />Timestamp: ".date(DATE_RFC2822) |
|
409 | + . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT') |
|
410 | + . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER'); |
|
411 | 411 | |
412 | 412 | try { |
413 | 413 | mail($toAddress, $subject, $message, $headers, $params); |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | header("HTTP/1.0 404 Not Found"); |
416 | 416 | $template = $this->twig->loadTemplate('error-page.twig'); |
417 | 417 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
418 | - error_log('Caught exception: ' . $e->getMessage()); |
|
418 | + error_log('Caught exception: '.$e->getMessage()); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | echo $template->render( |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
463 | 463 | $vocabObjects = array(); |
464 | 464 | if ($vocids) { |
465 | - foreach($vocids as $vocid) { |
|
465 | + foreach ($vocids as $vocid) { |
|
466 | 466 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
467 | 467 | } |
468 | 468 | } |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | } catch (Exception $e) { |
474 | 474 | header("HTTP/1.0 404 Not Found"); |
475 | 475 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
476 | - error_log('Caught exception: ' . $e->getMessage()); |
|
476 | + error_log('Caught exception: '.$e->getMessage()); |
|
477 | 477 | } |
478 | 478 | $this->invokeGenericErrorPage($request, $e->getMessage()); |
479 | 479 | return; |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | 'search_count' => $counts, |
490 | 490 | 'languages' => $this->languages, |
491 | 491 | 'search_results' => $searchResults, |
492 | - 'rest' => $parameters->getOffset()>0, |
|
492 | + 'rest' => $parameters->getOffset() > 0, |
|
493 | 493 | 'global_search' => true, |
494 | 494 | 'term' => $request->getQueryParamRaw('q'), |
495 | 495 | 'lang_list' => $langList, |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | } catch (Exception $e) { |
515 | 515 | header("HTTP/1.0 404 Not Found"); |
516 | 516 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
517 | - error_log('Caught exception: ' . $e->getMessage()); |
|
517 | + error_log('Caught exception: '.$e->getMessage()); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | echo $template->render( |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | } catch (Exception $e) { |
536 | 536 | header("HTTP/1.0 404 Not Found"); |
537 | 537 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
538 | - error_log('Caught exception: ' . $e->getMessage()); |
|
538 | + error_log('Caught exception: '.$e->getMessage()); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | echo $template->render( |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | 'vocab' => $vocab, |
553 | 553 | 'search_results' => $searchResults, |
554 | 554 | 'search_count' => $counts, |
555 | - 'rest' => $parameters->getOffset()>0, |
|
555 | + 'rest' => $parameters->getOffset() > 0, |
|
556 | 556 | 'limit_parent' => $parameters->getParentLimit(), |
557 | 557 | 'limit_type' => $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null, |
558 | 558 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
682 | 682 | * @param Request $request |
683 | 683 | */ |
684 | - public function invokeChangeList($request, $prop='dc:created') |
|
684 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
685 | 685 | { |
686 | 686 | // set language parameters for gettext |
687 | 687 | $this->setLanguageProperties($request->getLang()); |
@@ -33,16 +33,16 @@ |
||
33 | 33 | // Encrypt the current time |
34 | 34 | $honey_time_encrypted = $this->getEncryptedTime(); |
35 | 35 | return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" . |
36 | - '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" . |
|
37 | - '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" . |
|
36 | + '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" . |
|
37 | + '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" . |
|
38 | 38 | '</div>'; |
39 | 39 | } |
40 | 40 | /** |
41 | - * Validate honeypot is empty |
|
42 | - * |
|
43 | - * @param mixed $value |
|
44 | - * @return boolean |
|
45 | - */ |
|
41 | + * Validate honeypot is empty |
|
42 | + * |
|
43 | + * @param mixed $value |
|
44 | + * @return boolean |
|
45 | + */ |
|
46 | 46 | public function validateHoneypot($value) |
47 | 47 | { |
48 | 48 | if ($this->disabled) { |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | { |
33 | 33 | // Encrypt the current time |
34 | 34 | $honey_time_encrypted = $this->getEncryptedTime(); |
35 | - return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" . |
|
36 | - '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" . |
|
37 | - '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" . |
|
35 | + return '<div id="'.$honey_name.'_wrap" style="display:none;">'."\r\n". |
|
36 | + '<input name="'.$honey_name.'" type="text" value="" id="'.$honey_name.'"/>'."\r\n". |
|
37 | + '<input name="'.$honey_time.'" type="text" value="'.$honey_time_encrypted.'"/>'."\r\n". |
|
38 | 38 | '</div>'; |
39 | 39 | } |
40 | 40 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // Get the decrypted time |
67 | 67 | $value = $this->decryptTime($value); |
68 | 68 | // The current time should be greater than the time the form was built + the speed option |
69 | - return ( is_numeric($value) && time() > ($value + $parameters[0]) ); |
|
69 | + return (is_numeric($value) && time() > ($value + $parameters[0])); |
|
70 | 70 | } |
71 | 71 | /** |
72 | 72 | * Get encrypted time |