@@ -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#'); |
@@ -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#'); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | { |
81 | 81 | if (!empty($this->values)) { |
82 | 82 | uksort($this->values, function($a, $b) { |
83 | - return strnatcasecmp($a,$b); |
|
83 | + return strnatcasecmp($a, $b); |
|
84 | 84 | }); |
85 | 85 | } |
86 | 86 | $this->is_sorted = true; |
@@ -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#'); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | class GlobalConfig { |
7 | 7 | private $languages; |
8 | 8 | |
9 | - public function __construct($config_name=null) |
|
9 | + public function __construct($config_name = null) |
|
10 | 10 | { |
11 | 11 | try { |
12 | 12 | $file_path = dirname(__FILE__); |
@@ -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); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
359 | 359 | $vocabObjects = array(); |
360 | 360 | if ($vocids) { |
361 | - foreach($vocids as $vocid) { |
|
361 | + foreach ($vocids as $vocid) { |
|
362 | 362 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
363 | 363 | } |
364 | 364 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | 'search_count' => $counts, |
386 | 386 | 'languages' => $this->languages, |
387 | 387 | 'search_results' => $search_results, |
388 | - 'rest' => $parameters->getOffset()>0, |
|
388 | + 'rest' => $parameters->getOffset() > 0, |
|
389 | 389 | 'global_search' => true, |
390 | 390 | 'term' => $request->getQueryParam('q'), |
391 | 391 | 'lang_list' => $langList, |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | 'vocab' => $vocab, |
449 | 449 | 'search_results' => $search_results, |
450 | 450 | 'search_count' => $counts, |
451 | - 'rest' => $parameters->getOffset()>0, |
|
451 | + 'rest' => $parameters->getOffset() > 0, |
|
452 | 452 | 'limit_parent' => $parameters->getParentLimit(), |
453 | 453 | 'limit_type' => $request->getQueryParam('type'), |
454 | 454 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
595 | 595 | * @param Request $request |
596 | 596 | */ |
597 | - public function invokeChangeList($request, $prop='dc:created') |
|
597 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
598 | 598 | { |
599 | 599 | // set language parameters for gettext |
600 | 600 | $this->setLanguageProperties($request->getLang()); |
@@ -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); |
@@ -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 | } |
@@ -22,6 +22,9 @@ discard block |
||
22 | 22 | $this->unique = $request->getQueryParamBoolean('unique', false); |
23 | 23 | } |
24 | 24 | |
25 | + /** |
|
26 | + * @return string |
|
27 | + */ |
|
25 | 28 | public function getLang() |
26 | 29 | { |
27 | 30 | if ($this->rest && $this->request->getQueryParam('labellang')) { |
@@ -56,6 +59,9 @@ discard block |
||
56 | 59 | $this->vocabs = $vocabs; |
57 | 60 | } |
58 | 61 | |
62 | + /** |
|
63 | + * @return string |
|
64 | + */ |
|
59 | 65 | public function getArrayClass() |
60 | 66 | { |
61 | 67 | if (sizeof($this->getVocabIds()) == 1) { // search within vocabulary |
@@ -83,6 +89,9 @@ discard block |
||
83 | 89 | return $this->vocab->listConceptGroups($content_lang); |
84 | 90 | } |
85 | 91 | |
92 | + /** |
|
93 | + * @return string |
|
94 | + */ |
|
86 | 95 | public function getSearchLang() |
87 | 96 | { |
88 | 97 | if ($this->rest) { |
@@ -116,11 +125,17 @@ discard block |
||
116 | 125 | return $this->request->getQueryParam('parent') !== '' ? $this->request->getQueryParam('parent') : null; |
117 | 126 | } |
118 | 127 | |
128 | + /** |
|
129 | + * @return integer |
|
130 | + */ |
|
119 | 131 | public function getOffset() |
120 | 132 | { |
121 | 133 | return ($this->request->getQueryParam('offset') && is_numeric($this->request->getQueryParam('offset')) && $this->request->getQueryParam('offset') >= 0) ? $this->request->getQueryParam('offset') : 0; |
122 | 134 | } |
123 | 135 | |
136 | + /** |
|
137 | + * @return integer|null |
|
138 | + */ |
|
124 | 139 | public function getSearchLimit() |
125 | 140 | { |
126 | 141 | return $this->config->getDefaultSearchLimit(); |
@@ -130,6 +145,9 @@ discard block |
||
130 | 145 | return $this->unique; |
131 | 146 | } |
132 | 147 | |
148 | + /** |
|
149 | + * @param boolean $unique |
|
150 | + */ |
|
133 | 151 | public function setUnique($unique) { |
134 | 152 | $this->unique = $unique; |
135 | 153 | } |