@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright (c) 2012-2013 Aalto University and University of Helsinki |
|
| 4 | - * MIT License |
|
| 5 | - * see LICENSE.txt for more information |
|
| 6 | - */ |
|
| 3 | + * Copyright (c) 2012-2013 Aalto University and University of Helsinki |
|
| 4 | + * MIT License |
|
| 5 | + * see LICENSE.txt for more information |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | /* Register text: namespace needed for jena-text queries */ |
| 9 | 9 | EasyRdf_Namespace::set('text', 'http://jena.apache.org/text#'); |
@@ -573,6 +573,7 @@ |
||
| 573 | 573 | |
| 574 | 574 | /** |
| 575 | 575 | * Invokes a very generic errorpage. |
| 576 | + * @param string $message |
|
| 576 | 577 | */ |
| 577 | 578 | public function invokeGenericErrorPage($request, $message = null) |
| 578 | 579 | { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // register a Twig filter for generating URLs for vocabulary resources (concepts and groups) |
| 75 | 75 | $controller = $this; // for use by anonymous function below |
| 76 | - $urlFilter = new Twig_SimpleFilter('link_url', function ($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) { |
|
| 76 | + $urlFilter = new Twig_SimpleFilter('link_url', function($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) { |
|
| 77 | 77 | // $vocab can either be null, a vocabulary id (string) or a Vocabulary object |
| 78 | 78 | if ($vocab === null) { |
| 79 | 79 | // target vocabulary is unknown, best bet is to link to the plain URI |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $this->twig->addFilter($urlFilter); |
| 115 | 115 | |
| 116 | 116 | // register a Twig filter for generating strings from language codes with CLDR |
| 117 | - $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) { |
|
| 117 | + $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) { |
|
| 118 | 118 | return Language::getName($langcode, $lang); |
| 119 | 119 | }); |
| 120 | 120 | $this->twig->addFilter($langFilter); |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | // convert to vocids array to support multi-vocabulary search |
| 358 | 358 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
| 359 | 359 | $vocabObjects = array(); |
| 360 | - foreach($vocids as $vocid) { |
|
| 360 | + foreach ($vocids as $vocid) { |
|
| 361 | 361 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
| 362 | 362 | } |
| 363 | 363 | $parameters->setVocabularies($vocabObjects); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | 'search_count' => $counts, |
| 384 | 384 | 'languages' => $this->languages, |
| 385 | 385 | 'search_results' => $search_results, |
| 386 | - 'rest' => $parameters->getOffset()>0, |
|
| 386 | + 'rest' => $parameters->getOffset() > 0, |
|
| 387 | 387 | 'global_search' => true, |
| 388 | 388 | 'term' => $request->getQueryParam('q'), |
| 389 | 389 | 'lang_list' => $langList, |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | 'vocab' => $vocab, |
| 447 | 447 | 'search_results' => $search_results, |
| 448 | 448 | 'search_count' => $counts, |
| 449 | - 'rest' => $parameters->getOffset()>0, |
|
| 449 | + 'rest' => $parameters->getOffset() > 0, |
|
| 450 | 450 | 'limit_parent' => $parameters->getParentLimit(), |
| 451 | 451 | 'limit_type' => $request->getQueryParam('type'), |
| 452 | 452 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
| 593 | 593 | * @param Request $request |
| 594 | 594 | */ |
| 595 | - public function invokeChangeList($request, $prop='dc:created') |
|
| 595 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
| 596 | 596 | { |
| 597 | 597 | // set language parameters for gettext |
| 598 | 598 | $this->setLanguageProperties($request->getLang()); |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright (c) 2012 Aalto University and University of Helsinki |
|
| 4 | - * MIT License |
|
| 5 | - * see LICENSE.txt for more information |
|
| 6 | - */ |
|
| 3 | + * Copyright (c) 2012 Aalto University and University of Helsinki |
|
| 4 | + * MIT License |
|
| 5 | + * see LICENSE.txt for more information |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Includes the side wide settings. |
@@ -116,11 +116,17 @@ discard block |
||
| 116 | 116 | return $this->request->getQueryParam('parent') !== '' ? $this->request->getQueryParam('parent') : null; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | + /** |
|
| 120 | + * @return integer |
|
| 121 | + */ |
|
| 119 | 122 | public function getOffset() |
| 120 | 123 | { |
| 121 | 124 | return ($this->request->getQueryParam('offset') && is_numeric($this->request->getQueryParam('offset')) && $this->request->getQueryParam('offset') >= 0) ? $this->request->getQueryParam('offset') : 0; |
| 122 | 125 | } |
| 123 | 126 | |
| 127 | + /** |
|
| 128 | + * @return integer|null |
|
| 129 | + */ |
|
| 124 | 130 | public function getSearchLimit() |
| 125 | 131 | { |
| 126 | 132 | return $this->config->getDefaultSearchLimit(); |
@@ -130,6 +136,9 @@ discard block |
||
| 130 | 136 | return $this->unique; |
| 131 | 137 | } |
| 132 | 138 | |
| 139 | + /** |
|
| 140 | + * @param boolean $unique |
|
| 141 | + */ |
|
| 133 | 142 | public function setUnique($unique) { |
| 134 | 143 | $this->unique = $unique; |
| 135 | 144 | } |
@@ -67,8 +67,9 @@ |
||
| 67 | 67 | public function getSearchTerm() |
| 68 | 68 | { |
| 69 | 69 | $term = $this->request->getQueryParam('q') ? $this->request->getQueryParam('q') : $this->request->getQueryParam('query'); |
| 70 | - if (!$term && $this->rest) |
|
| 71 | - $term = $this->request->getQueryParam('label'); |
|
| 70 | + if (!$term && $this->rest) { |
|
| 71 | + $term = $this->request->getQueryParam('label'); |
|
| 72 | + } |
|
| 72 | 73 | $term = trim($term); // surrounding whitespace is not considered significant |
| 73 | 74 | return strpos($term, "*") === false ? $term . "*" : $term; // default to prefix search |
| 74 | 75 | } |
@@ -143,6 +143,7 @@ discard block |
||
| 143 | 143 | /** |
| 144 | 144 | * @param array $langs Languages to query for |
| 145 | 145 | * @param string[] $props property names |
| 146 | + * @return string |
|
| 146 | 147 | */ |
| 147 | 148 | private function generateCountLangConceptsQuery($langs, $classes, $props) { |
| 148 | 149 | $gc = $this->graphClause; |
@@ -584,7 +585,7 @@ discard block |
||
| 584 | 585 | |
| 585 | 586 | /** |
| 586 | 587 | * Generate a VALUES clause for limiting the targeted graphs. |
| 587 | - * @param array $vocabs array of Vocabulary objects to target |
|
| 588 | + * @param Vocabulary[] $vocabs array of Vocabulary objects to target |
|
| 588 | 589 | * @return string VALUES clause, or "" if not necessary to limit |
| 589 | 590 | */ |
| 590 | 591 | protected function formatValuesGraph($vocabs) { |
@@ -789,16 +790,7 @@ discard block |
||
| 789 | 790 | |
| 790 | 791 | /** |
| 791 | 792 | * Query for concepts using a search term. |
| 792 | - * @param string $term search term |
|
| 793 | 793 | * @param array $vocabs array of Vocabulary objects to search; empty for global search |
| 794 | - * @param string $lang language code of the returned labels |
|
| 795 | - * @param string $search_lang language code used for matching labels (null means any language) |
|
| 796 | - * @param int $limit maximum number of hits to retrieve; 0 for unlimited |
|
| 797 | - * @param int $offset offset of results to retrieve; 0 for beginning of list |
|
| 798 | - * @param string $arrayClass the URI for thesaurus array class, or null if not used |
|
| 799 | - * @param array $types limit search to concepts of the given type(s) |
|
| 800 | - * @param string $parent limit search to concepts which have the given concept as parent in the transitive broader hierarchy |
|
| 801 | - * @param string $group limit search to concepts which are in the given group |
|
| 802 | 794 | * @param boolean $hidden include matches on hidden labels (default: true) |
| 803 | 795 | * @param array $fields extra fields to include in the result (array of strings). (default: null = none) |
| 804 | 796 | * @param boolean $unique restrict results to unique concepts (default: false) |
@@ -942,16 +934,7 @@ discard block |
||
| 942 | 934 | |
| 943 | 935 | /** |
| 944 | 936 | * Query for concepts using a search term. |
| 945 | - * @param string $term search term |
|
| 946 | 937 | * @param array $vocabs array of Vocabulary objects to search; empty for global search |
| 947 | - * @param string $lang language code of the returned labels |
|
| 948 | - * @param string $search_lang language code used for matching labels (null means any language) |
|
| 949 | - * @param int $limit maximum number of hits to retrieve; 0 for unlimited |
|
| 950 | - * @param int $offset offset of results to retrieve; 0 for beginning of list |
|
| 951 | - * @param string $arrayClass the URI for thesaurus array class, or null if not used |
|
| 952 | - * @param array $types limit search to concepts of the given type(s) |
|
| 953 | - * @param string $parent limit search to concepts which have the given concept as parent in the transitive broader hierarchy |
|
| 954 | - * @param string $group limit search to concepts which are in the given group |
|
| 955 | 938 | * @param boolean $hidden include matches on hidden labels (default: true) |
| 956 | 939 | * @param array $fields extra fields to include in the result (array of strings). (default: null = none) |
| 957 | 940 | * @param boolean $unique restrict results to unique concepts (default: false) |
@@ -171,7 +171,7 @@ |
||
| 171 | 171 | // convert to vocids array to support multi-vocabulary search |
| 172 | 172 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : array(); |
| 173 | 173 | $vocabObjects = array(); |
| 174 | - foreach($vocids as $vocid) { |
|
| 174 | + foreach ($vocids as $vocid) { |
|
| 175 | 175 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
| 176 | 176 | } |
| 177 | 177 | $parameters->setVocabularies($vocabObjects); |