@@ -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 | } |
@@ -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#'); |
@@ -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(); |
@@ -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#'); |
@@ -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()); |
@@ -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#'); |
@@ -459,11 +459,11 @@ |
||
| 459 | 459 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 460 | 460 | $ret = ''; |
| 461 | 461 | if ($this->resource->get('dc:modified')) { |
| 462 | - $modified = (string) $this->resource->get('dc:modified'); |
|
| 462 | + $modified = (string)$this->resource->get('dc:modified'); |
|
| 463 | 463 | $ret = gettext('skosmos:modified') . ' ' . $modified; |
| 464 | 464 | } |
| 465 | 465 | if ($this->resource->get('dc:created')) { |
| 466 | - $created .= (string) $this->resource->get('dc:created'); |
|
| 466 | + $created .= (string)$this->resource->get('dc:created'); |
|
| 467 | 467 | $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
| 468 | 468 | } |
| 469 | 469 | } |
@@ -76,10 +76,12 @@ |
||
| 76 | 76 | */ |
| 77 | 77 | public function getUriSpace() |
| 78 | 78 | { |
| 79 | - if ($this->urispace === null) // initialize cache |
|
| 79 | + if ($this->urispace === null) { |
|
| 80 | + // initialize cache |
|
| 80 | 81 | { |
| 81 | 82 | $this->urispace = $this->resource->getLiteral('void:uriSpace')->getValue(); |
| 82 | 83 | } |
| 84 | + } |
|
| 83 | 85 | |
| 84 | 86 | return $this->urispace; |
| 85 | 87 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * Counts the statistics of the vocabulary. |
| 279 | 279 | * @return array of the concept/group counts |
| 280 | 280 | */ |
| 281 | - public function getStatistics($lang = '', $array=null, $group=null) |
|
| 281 | + public function getStatistics($lang = '', $array = null, $group = null) |
|
| 282 | 282 | { |
| 283 | 283 | $sparql = $this->getSparql(); |
| 284 | 284 | // find the number of concepts |
@@ -594,14 +594,14 @@ discard block |
||
| 594 | 594 | { |
| 595 | 595 | $changelist = $this->getSparql()->queryChangeList($clang, $offset, $prop); |
| 596 | 596 | $bydate = array(); |
| 597 | - foreach($changelist as $concept) { |
|
| 597 | + foreach ($changelist as $concept) { |
|
| 598 | 598 | $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang); |
| 599 | - $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept; |
|
| 599 | + $bydate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept; |
|
| 600 | 600 | } |
| 601 | 601 | return $bydate; |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - public function getTitle($lang=null) { |
|
| 604 | + public function getTitle($lang = null) { |
|
| 605 | 605 | return $this->config->getTitle($lang); |
| 606 | 606 | } |
| 607 | 607 | |
@@ -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#'); |
@@ -43,8 +43,9 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // not found with selected language, try any language |
| 45 | 45 | $literal = $this->resource->getLiteral($property); |
| 46 | - if ($literal) |
|
| 47 | - return $literal->getValue(); |
|
| 46 | + if ($literal) { |
|
| 47 | + return $literal->getValue(); |
|
| 48 | + } |
|
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | /** |
@@ -85,8 +86,9 @@ discard block |
||
| 85 | 86 | public function getShortName() |
| 86 | 87 | { |
| 87 | 88 | $shortname = $this->getLiteral('skosmos:shortName'); |
| 88 | - if ($shortname) |
|
| 89 | - return $shortname; |
|
| 89 | + if ($shortname) { |
|
| 90 | + return $shortname; |
|
| 91 | + } |
|
| 90 | 92 | |
| 91 | 93 | // if no shortname exists fall back to the id |
| 92 | 94 | return $this->getId(); |
@@ -205,10 +207,12 @@ discard block |
||
| 205 | 207 | $ret = array(); |
| 206 | 208 | foreach ($resources as $res) { |
| 207 | 209 | $prop = $res->getURI(); |
| 208 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible |
|
| 210 | + if (EasyRdf_Namespace::shorten($prop) !== null) { |
|
| 211 | + // shortening property labels if possible |
|
| 209 | 212 | { |
| 210 | 213 | $prop = EasyRdf_Namespace::shorten($prop); |
| 211 | 214 | } |
| 215 | + } |
|
| 212 | 216 | |
| 213 | 217 | $ret[] = $prop; |
| 214 | 218 | } |
@@ -225,10 +229,12 @@ discard block |
||
| 225 | 229 | $resources = $this->resource->allResources("skosmos:hasMultiLingualProperty"); |
| 226 | 230 | foreach ($resources as $res) { |
| 227 | 231 | $prop = $res->getURI(); |
| 228 | - if (EasyRdf_Namespace::shorten($prop) !== null) // shortening property labels if possible |
|
| 232 | + if (EasyRdf_Namespace::shorten($prop) !== null) { |
|
| 233 | + // shortening property labels if possible |
|
| 229 | 234 | { |
| 230 | 235 | $prop = EasyRdf_Namespace::shorten($prop); |
| 231 | 236 | } |
| 237 | + } |
|
| 232 | 238 | |
| 233 | 239 | if ($prop === $property) { |
| 234 | 240 | return true; |
@@ -329,11 +335,12 @@ discard block |
||
| 329 | 335 | public function getId() |
| 330 | 336 | { |
| 331 | 337 | $uriparts = explode("#", $this->resource->getURI()); |
| 332 | - if (count($uriparts) != 1) |
|
| 333 | - // hash namespace |
|
| 338 | + if (count($uriparts) != 1) { |
|
| 339 | + // hash namespace |
|
| 334 | 340 | { |
| 335 | 341 | return $uriparts[1]; |
| 336 | 342 | } |
| 343 | + } |
|
| 337 | 344 | |
| 338 | 345 | // slash namespace |
| 339 | 346 | $uriparts = explode("/", $this->resource->getURI()); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | { |
| 8 | 8 | private $plugins; |
| 9 | 9 | |
| 10 | - public function __construct($resource, $globalPlugins=array()) |
|
| 10 | + public function __construct($resource, $globalPlugins = array()) |
|
| 11 | 11 | { |
| 12 | 12 | $this->resource = $resource; |
| 13 | 13 | $plugins = $this->resource->allLiterals('skosmos:usePlugin'); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param string $property the property to query |
| 41 | 41 | * @param string $lang preferred language for the literal, |
| 42 | 42 | */ |
| 43 | - private function getLiteral($property, $lang=null) |
|
| 43 | + private function getLiteral($property, $lang = null) |
|
| 44 | 44 | { |
| 45 | 45 | if (!isset($lang)) {; |
| 46 | 46 | $lang = $this->getEnvLang(); |
@@ -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#'); |
@@ -585,7 +585,7 @@ |
||
| 585 | 585 | |
| 586 | 586 | /** |
| 587 | 587 | * Generate a VALUES clause for limiting the targeted graphs. |
| 588 | - * @param array $vocabs array of Vocabulary objects to target |
|
| 588 | + * @param Vocabulary[] $vocabs array of Vocabulary objects to target |
|
| 589 | 589 | * @return string VALUES clause, or "" if not necessary to limit |
| 590 | 590 | */ |
| 591 | 591 | protected function formatValuesGraph($vocabs) { |
@@ -56,12 +56,16 @@ |
||
| 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 = ""; |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - return implode(' UNION ', $type_patterns);; |
|
| 652 | + return implode(' UNION ', $type_patterns); ; |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | /** |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | $schemecond = ''; |
| 793 | 793 | if (!empty($schemes)) { |
| 794 | - foreach($schemes as $scheme) { |
|
| 794 | + foreach ($schemes as $scheme) { |
|
| 795 | 795 | $schemecond .= "?s skos:inScheme <$scheme> . "; |
| 796 | 796 | } |
| 797 | 797 | } |