@@ -381,10 +381,12 @@ |
||
381 | 381 | // register vocabulary ids as RDF namespace prefixes |
382 | 382 | $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters |
383 | 383 | try { |
384 | - if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) // if not already defined |
|
384 | + if ($prefix != '' && EasyRdf_Namespace::get($prefix) === null) { |
|
385 | + // if not already defined |
|
385 | 386 | { |
386 | 387 | EasyRdf_Namespace::set($prefix, $voc->getUriSpace()); |
387 | 388 | } |
389 | + } |
|
388 | 390 | |
389 | 391 | } catch (Exception $e) { |
390 | 392 | // not valid as namespace identifier, ignore |
@@ -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. |
@@ -167,9 +167,11 @@ |
||
167 | 167 | */ |
168 | 168 | public function setVocab($vocabid) |
169 | 169 | { |
170 | - if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string |
|
170 | + if (strpos($vocabid, ' ') !== false) { |
|
171 | + // if there are multiple vocabularies just storing the string |
|
171 | 172 | { |
172 | 173 | $this->setVocabids($vocabid); |
174 | + } |
|
173 | 175 | } else { |
174 | 176 | $this->vocab = $this->model->getVocabulary($vocabid); |
175 | 177 | } |
@@ -461,7 +461,7 @@ |
||
461 | 461 | } |
462 | 462 | } catch (Exception $e) { |
463 | 463 | trigger_error($e->getMessage(), E_USER_WARNING); |
464 | - return gettext('skosmos:modified') . ' ' . (string) $this->resource->get('dc:modified') . ' ' . gettext('skosmos:created') . ' ' . (string) $this->resource->get('dc:created'); |
|
464 | + return gettext('skosmos:modified') . ' ' . (string)$this->resource->get('dc:modified') . ' ' . gettext('skosmos:created') . ' ' . (string)$this->resource->get('dc:created'); |
|
465 | 465 | } |
466 | 466 | return $ret; |
467 | 467 | } |
@@ -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#'); |
@@ -56,12 +56,16 @@ discard block |
||
56 | 56 | $this->model = $model; |
57 | 57 | |
58 | 58 | // set graphClause so that it can be used by all queries |
59 | - if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable) |
|
59 | + if ($this->isDefaultEndpoint()) { |
|
60 | + // default endpoint; query any graph (and catch it in a variable) |
|
60 | 61 | { |
61 | 62 | $this->graphClause = "GRAPH $graph"; |
62 | - } elseif ($graph) // query a specific graph |
|
63 | + } |
|
64 | + } elseif ($graph) { |
|
65 | + // query a specific graph |
|
63 | 66 | { |
64 | 67 | $this->graphClause = "GRAPH <$graph>"; |
68 | + } |
|
65 | 69 | } else // query the default graph |
66 | 70 | { |
67 | 71 | $this->graphClause = ""; |
@@ -616,9 +620,11 @@ discard block |
||
616 | 620 | // extra types to query, if using thesaurus arrays and no additional type restrictions have been applied |
617 | 621 | $extratypes = ($arrayClass && $types === array('skos:Concept')) ? "UNION { ?s a <$arrayClass> }" : ""; |
618 | 622 | |
619 | - if (sizeof($unprefixed_types) === 1) // if only one type limitation set no UNION needed |
|
623 | + if (sizeof($unprefixed_types) === 1) { |
|
624 | + // if only one type limitation set no UNION needed |
|
620 | 625 | { |
621 | 626 | $type = '<' . $unprefixed_types[0] . '>'; |
627 | + } |
|
622 | 628 | } else { // multiple type limitations require setting a UNION for each of those |
623 | 629 | $type = '[]'; |
624 | 630 | foreach ($unprefixed_types as $utype) { |
@@ -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) |
@@ -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#'); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | return Punic\Calendar::formatDate($val, 'short'); |
45 | 45 | } catch (Exception $e) { |
46 | 46 | trigger_error($e->getMessage(), E_USER_WARNING); |
47 | - return (string) $this->literal; |
|
47 | + return (string)$this->literal; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | return $this->literal->getValue(); |
@@ -118,7 +118,7 @@ |
||
118 | 118 | */ |
119 | 119 | public function getEnvLang() |
120 | 120 | { |
121 | - // get language from locale, same as used by gettext, set by Controller |
|
122 | - return substr(getenv("LC_ALL"), 0, 2); |
|
121 | + // get language from locale, same as used by gettext, set by Controller |
|
122 | + return substr(getenv("LC_ALL"), 0, 2); |
|
123 | 123 | } |
124 | 124 | } |
@@ -72,10 +72,12 @@ |
||
72 | 72 | |
73 | 73 | uksort($sortable, array($this, 'mycompare')); |
74 | 74 | foreach ($sortable as $prop => $vals) { |
75 | - if (is_array($prop)) // the ConceptProperty objects have their own sorting methods |
|
75 | + if (is_array($prop)) { |
|
76 | + // the ConceptProperty objects have their own sorting methods |
|
76 | 77 | { |
77 | 78 | ksort($sortable[$prop]); |
78 | 79 | } |
80 | + } |
|
79 | 81 | |
80 | 82 | } |
81 | 83 |
@@ -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. |