@@ -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(); |
@@ -10,6 +10,9 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class VocabularyCategory extends DataObject |
| 12 | 12 | { |
| 13 | + /** |
|
| 14 | + * @param Model $model |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct($model, $resource) |
| 14 | 17 | { |
| 15 | 18 | if (!($model instanceof Model)) { |
@@ -23,6 +23,9 @@ |
||
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | + /** |
|
| 27 | + * @param string $name |
|
| 28 | + */ |
|
| 26 | 29 | private function getConstant($name, $default) |
| 27 | 30 | { |
| 28 | 31 | if (defined($name) && constant($name)) { |
@@ -6,10 +6,10 @@ discard block |
||
| 6 | 6 | class GlobalConfig { |
| 7 | 7 | private $languages; |
| 8 | 8 | |
| 9 | - public function __construct($config_name='/../config.inc') |
|
| 9 | + public function __construct($config_name = '/../config.inc') |
|
| 10 | 10 | { |
| 11 | 11 | try { |
| 12 | - $file_path = dirname(__FILE__) . $config_name; |
|
| 12 | + $file_path = dirname(__FILE__).$config_name; |
|
| 13 | 13 | if (!file_exists($file_path)) { |
| 14 | 14 | throw new Exception('config.inc file is missing, please provide one.'); |
| 15 | 15 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $this->languages = $LANGUAGES; |
| 19 | 19 | } |
| 20 | 20 | } catch (Exception $e) { |
| 21 | - echo "Error: " . $e->getMessage(); |
|
| 21 | + echo "Error: ".$e->getMessage(); |
|
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -55,6 +55,7 @@ discard block |
||
| 55 | 55 | * @param Vocabulary $vocab |
| 56 | 56 | * @param EasyRdf_Resource $resource |
| 57 | 57 | * @param EasyRdf_Graph $graph |
| 58 | + * @param string|null $clang |
|
| 58 | 59 | */ |
| 59 | 60 | public function __construct($model, $vocab, $resource, $graph, $clang) |
| 60 | 61 | { |
@@ -512,6 +513,7 @@ discard block |
||
| 512 | 513 | |
| 513 | 514 | /** |
| 514 | 515 | * Gets the groups/arrays the concept belongs to. |
| 516 | + * @param boolean $includeArrays |
|
| 515 | 517 | */ |
| 516 | 518 | public function getReverseResources($includeArrays) { |
| 517 | 519 | $groups = array(); |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | // 3. label in a subtag of the current language |
| 123 | 123 | // We need to check all the labels in case one of them matches a subtag of the current language |
| 124 | - foreach($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
| 124 | + foreach ($this->resource->allLiterals('skos:prefLabel') as $label) { |
|
| 125 | 125 | // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language |
| 126 | - if ($label !== null && strpos($label->getLang(), $lang . '-') === 0) { |
|
| 126 | + if ($label !== null && strpos($label->getLang(), $lang.'-') === 0) { |
|
| 127 | 127 | return EasyRdf_Literal::create($label, $lang); |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | // 4. label in any language, including literal with empty language tag |
| 132 | 132 | $label = $this->resource->label(); |
| 133 | 133 | if ($label !== null) { |
| 134 | - return $label->getLang() ? $label->getValue() . " (" . $label->getLang() . ")" : $label->getValue(); |
|
| 134 | + return $label->getLang() ? $label->getValue()." (".$label->getLang().")" : $label->getValue(); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // empty |
@@ -462,14 +462,14 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | // making a human readable string from the timestamps |
| 464 | 464 | if ($created != '') { |
| 465 | - $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short')); |
|
| 465 | + $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short')); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | if ($modified != '') { |
| 469 | 469 | if ($created != '') { |
| 470 | - $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
| 470 | + $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
| 471 | 471 | } else { |
| 472 | - $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short')); |
|
| 472 | + $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short')); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | } |
@@ -477,12 +477,12 @@ discard block |
||
| 477 | 477 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 478 | 478 | $ret = ''; |
| 479 | 479 | if ($this->resource->get('dc:modified')) { |
| 480 | - $modified = (string) $this->resource->get('dc:modified'); |
|
| 481 | - $ret = gettext('skosmos:modified') . ' ' . $modified; |
|
| 480 | + $modified = (string)$this->resource->get('dc:modified'); |
|
| 481 | + $ret = gettext('skosmos:modified').' '.$modified; |
|
| 482 | 482 | } |
| 483 | 483 | if ($this->resource->get('dc:created')) { |
| 484 | - $created .= (string) $this->resource->get('dc:created'); |
|
| 485 | - $ret .= ' ' . gettext('skosmos:created') . ' ' . $created; |
|
| 484 | + $created .= (string)$this->resource->get('dc:created'); |
|
| 485 | + $ret .= ' '.gettext('skosmos:created').' '.$created; |
|
| 486 | 486 | } |
| 487 | 487 | } |
| 488 | 488 | return $ret; |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | $ret = array(); |
| 593 | 593 | foreach ($labels as $lit) { |
| 594 | 594 | // filtering away subsets of the current language eg. en vs en-GB |
| 595 | - if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) { |
|
| 595 | + if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) { |
|
| 596 | 596 | $prop = in_array($lit, $prefLabels) ? 'skos:prefLabel' : 'skos:altLabel'; |
| 597 | 597 | $ret[$this->literalLanguageToString($lit)][] = new ConceptPropertyValueLiteral($lit, $prop); |
| 598 | 598 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } elseif ($parts[1] == 'data') { |
| 38 | 38 | $controller->data($request); |
| 39 | 39 | } elseif (sizeof($parts) == 2) { |
| 40 | - header("Location: " . $parts[1] . "/"); |
|
| 40 | + header("Location: ".$parts[1]."/"); |
|
| 41 | 41 | } else { |
| 42 | 42 | $vocab = $parts[1]; |
| 43 | 43 | try { |
@@ -93,5 +93,5 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } catch (Exception $e) { |
| 95 | 95 | header("HTTP/1.0 500 Internal Server Error"); |
| 96 | - echo('ERROR: ' . $e->getMessage()); |
|
| 96 | + echo('ERROR: '.$e->getMessage()); |
|
| 97 | 97 | } |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | |
| 107 | 107 | public function getRequestUri() |
| 108 | 108 | { |
| 109 | - return $this->getServerConstant('HTTP_HOST') . $this->getServerConstant('REQUEST_URI'); |
|
| 109 | + return $this->getServerConstant('HTTP_HOST').$this->getServerConstant('REQUEST_URI'); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -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(); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $langs = $this->getLanguages(); |
| 73 | 73 | $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric |
| 74 | 74 | if (sizeof($langs) > 1) { |
| 75 | - trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
| 75 | + trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return $deflang; |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | class PluginRegister { |
| 4 | 4 | private $requestedPlugins; |
| 5 | 5 | |
| 6 | - public function __construct($requestedPlugins=array()) { |
|
| 6 | + public function __construct($requestedPlugins = array()) { |
|
| 7 | 7 | $this->requestedPlugins = $requestedPlugins; |
| 8 | 8 | } |
| 9 | 9 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | if (isset($files[$type])) { |
| 39 | 39 | $ret[$name] = array(); |
| 40 | 40 | foreach ($files[$type] as $file) { |
| 41 | - array_push($ret[$name], 'plugins/' . $name . '/' . $file); |
|
| 41 | + array_push($ret[$name], 'plugins/'.$name.'/'.$file); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param array $names the plugin name strings (foldernames) in an array |
| 69 | 69 | * @return array |
| 70 | 70 | */ |
| 71 | - public function getPluginsJS($names=null) { |
|
| 71 | + public function getPluginsJS($names = null) { |
|
| 72 | 72 | if ($names) { |
| 73 | 73 | $names = array_merge($this->requestedPlugins, $names); |
| 74 | 74 | return $this->filterPluginsByName('js', $names); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param array $names the plugin name strings (foldernames) in an array |
| 82 | 82 | * @return array |
| 83 | 83 | */ |
| 84 | - public function getPluginsCSS($names=null) { |
|
| 84 | + public function getPluginsCSS($names = null) { |
|
| 85 | 85 | if ($names) { |
| 86 | 86 | $names = array_merge($this->requestedPlugins, $names); |
| 87 | 87 | return $this->filterPluginsByName('css', $names); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @param array $names the plugin name strings (foldernames) in an array |
| 95 | 95 | * @return array |
| 96 | 96 | */ |
| 97 | - public function getPluginsTemplates($names=null) { |
|
| 97 | + public function getPluginsTemplates($names = null) { |
|
| 98 | 98 | if ($names) { |
| 99 | 99 | $names = array_merge($this->requestedPlugins, $names); |
| 100 | 100 | return $this->filterPluginsByName('templates', $names); |
@@ -107,15 +107,15 @@ discard block |
||
| 107 | 107 | * @param array $names the plugin name strings (foldernames) in an array |
| 108 | 108 | * @return array |
| 109 | 109 | */ |
| 110 | - public function getTemplates($names=null) { |
|
| 110 | + public function getTemplates($names = null) { |
|
| 111 | 111 | $templateStrings = array(); |
| 112 | 112 | $plugins = $this->getPluginsTemplates($names); |
| 113 | 113 | foreach ($plugins as $folder => $templates) { |
| 114 | 114 | foreach ($templates as $path) { |
| 115 | 115 | if (file_exists($path)) { |
| 116 | 116 | $filename = explode('/', $path); |
| 117 | - $filename = $filename[sizeof($filename)-1]; |
|
| 118 | - $id = $folder . '-' . substr($filename, 0 , (strrpos($filename, "."))); |
|
| 117 | + $filename = $filename[sizeof($filename) - 1]; |
|
| 118 | + $id = $folder.'-'.substr($filename, 0, (strrpos($filename, "."))); |
|
| 119 | 119 | $templateStrings[$id] = file_get_contents($path); |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $label = $this->getLabel(); |
| 24 | 24 | $notation = $this->getNotation(); |
| 25 | - return $notation . $label; |
|
| 25 | + return $notation.$label; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function getType() |