@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | private $configModifiedTime = null; |
| 32 | 32 | |
| 33 | - public function __construct($config_name='../../config.ttl') |
|
| 33 | + public function __construct($config_name = '../../config.ttl') |
|
| 34 | 34 | { |
| 35 | 35 | $this->cache = new Cache(); |
| 36 | 36 | try { |
| 37 | - $this->filePath = realpath(dirname(__FILE__) . "/" . $config_name); |
|
| 37 | + $this->filePath = realpath(dirname(__FILE__)."/".$config_name); |
|
| 38 | 38 | if (!file_exists($this->filePath)) { |
| 39 | 39 | throw new Exception('config.ttl file is missing, please provide one.'); |
| 40 | 40 | } |
| 41 | 41 | $this->initializeConfig(); |
| 42 | 42 | } catch (Exception $e) { |
| 43 | - echo "Error: " . $e->getMessage(); |
|
| 43 | + echo "Error: ".$e->getMessage(); |
|
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | // use APC user cache to store parsed config.ttl configuration |
| 75 | 75 | if ($this->cache->isAvailable() && !is_null($this->configModifiedTime)) { |
| 76 | 76 | // @codeCoverageIgnoreStart |
| 77 | - $key = realpath($this->filePath) . ", " . $this->configModifiedTime; |
|
| 78 | - $nskey = "namespaces of " . $key; |
|
| 77 | + $key = realpath($this->filePath).", ".$this->configModifiedTime; |
|
| 78 | + $nskey = "namespaces of ".$key; |
|
| 79 | 79 | $this->graph = $this->cache->fetch($key); |
| 80 | 80 | $this->namespaces = $this->cache->fetch($nskey); |
| 81 | 81 | if ($this->graph === false || $this->namespaces === false) { // was not found in cache |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->resource = $configResources[0]; |
| 97 | 97 | $this->initializeNamespaces(); |
| 98 | 98 | } catch (Exception $e) { |
| 99 | - echo "Error: " . $e->getMessage(); |
|
| 99 | + echo "Error: ".$e->getMessage(); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | public function getGlobalPlugins() |
| 329 | 329 | { |
| 330 | 330 | $globalPlugins = array(); |
| 331 | - $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
| 331 | + $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
| 332 | 332 | if ($globalPluginsResource) { |
| 333 | 333 | foreach ($globalPluginsResource as $resource) { |
| 334 | 334 | $globalPlugins[] = $resource->getValue(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | return Punic\Calendar::formatDate($val, 'short'); |
| 70 | 70 | } catch (Exception $e) { |
| 71 | 71 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 72 | - return (string) $this->literal; |
|
| 72 | + return (string)$this->literal; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | return $this->literal->getValue(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | $graph = $this->resource->getGraph(); |
| 98 | 98 | $labelResources = $graph->resourcesMatching('skosxl:literalForm', $this->literal); |
| 99 | - foreach($labelResources as $labres) { |
|
| 99 | + foreach ($labelResources as $labres) { |
|
| 100 | 100 | return new LabelSkosXL($this->model, $labres); |
| 101 | 101 | } |
| 102 | 102 | return null; |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | if ($this->rest) { |
| 76 | 76 | return $term; |
| 77 | 77 | } |
| 78 | - return strpos($term, "*") === false ? $term . "*" : $term; // default to prefix search |
|
| 78 | + return strpos($term, "*") === false ? $term."*" : $term; // default to prefix search |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function getContentLang() |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string $super URI of superproperty |
| 31 | 31 | * @param boolean $sort_by_notation whether to sort the property values by their notation code |
| 32 | 32 | */ |
| 33 | - public function __construct($model, $prop, $label, $tooltip=null, $super=null, $sort_by_notation=false) |
|
| 33 | + public function __construct($model, $prop, $label, $tooltip = null, $super = null, $sort_by_notation = false) |
|
| 34 | 34 | { |
| 35 | 35 | $this->model = $model; |
| 36 | 36 | $this->prop = $prop; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function getDescription() |
| 81 | 81 | { |
| 82 | - $helpprop = $this->prop . "_help"; |
|
| 82 | + $helpprop = $this->prop."_help"; |
|
| 83 | 83 | |
| 84 | 84 | // see if we have a translation with the help text |
| 85 | 85 | $help = $this->model->getText($helpprop); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function addValue($value) |
| 112 | 112 | { |
| 113 | - $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel() . rtrim(' ' . $value->getUri())] = $value; |
|
| 113 | + $this->values[ltrim($value->getNotation().' ').$value->getLabel().rtrim(' '.$value->getUri())] = $value; |
|
| 114 | 114 | $this->is_sorted = false; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | # Note that getLabel() returns URIs in case of no label and may return a prefixed value which affects sorting |
| 121 | 121 | if (!empty($this->values)) { |
| 122 | 122 | if ($this->sort_by_notation) { |
| 123 | - uasort($this->values, function ($a, $b) { |
|
| 123 | + uasort($this->values, function($a, $b) { |
|
| 124 | 124 | $anot = $a->getNotation(); |
| 125 | 125 | $bnot = $b->getNotation(); |
| 126 | 126 | if ($anot == null) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | }); |
| 143 | 143 | } else { |
| 144 | - uasort($this->values, function ($a, $b) { |
|
| 144 | + uasort($this->values, function($a, $b) { |
|
| 145 | 145 | // assume that labels are unique |
| 146 | 146 | return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel())); |
| 147 | 147 | }); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | $label = null; |
| 13 | 13 | $labels = $this->resource->allResources('skosxl:prefLabel'); |
| 14 | - foreach($labels as $labres) { |
|
| 14 | + foreach ($labels as $labres) { |
|
| 15 | 15 | $label = $labres->getLiteral('skosxl:literalForm'); |
| 16 | 16 | if ($label->getLang() == $this->clang) { |
| 17 | 17 | return $label; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $ret = array(); |
| 26 | 26 | $props = $this->resource->properties(); |
| 27 | - foreach($props as $prop) { |
|
| 27 | + foreach ($props as $prop) { |
|
| 28 | 28 | if ($prop !== 'rdf:type' && $prop !== 'skosxl:literalForm') { |
| 29 | 29 | // make sure to use the correct gettext keys for DC namespace |
| 30 | 30 | $propkey = str_starts_with($prop, 'dc11:') ? |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | public function getRequestUri() |
| 171 | 171 | { |
| 172 | - return $this->getServerConstant('HTTP_HOST') . $this->getServerConstant('REQUEST_URI'); |
|
| 172 | + return $this->getServerConstant('HTTP_HOST').$this->getServerConstant('REQUEST_URI'); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param string $newlang new UI language to set |
| 178 | 178 | * @return string the relative url of the page |
| 179 | 179 | */ |
| 180 | - public function getLangUrl($newlang=null) |
|
| 180 | + public function getLangUrl($newlang = null) |
|
| 181 | 181 | { |
| 182 | 182 | $script_name = str_replace('/index.php', '', $this->getServerConstant('SCRIPT_NAME')); |
| 183 | 183 | $langurl = substr(str_replace($script_name, '', strval($this->getServerConstant('REQUEST_URI'))), 1); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $opts = array('http' => array('method'=>'HEAD', |
| 14 | 14 | 'user_agent' => 'Skosmos', |
| 15 | 15 | 'timeout' => $timeout)); |
| 16 | - $context = stream_context_create($opts); |
|
| 16 | + $context = stream_context_create($opts); |
|
| 17 | 17 | $fd = fopen($this->uri, 'rb', false, $context); |
| 18 | 18 | $headers = stream_get_meta_data($fd)['wrapper_data']; |
| 19 | 19 | foreach ($headers as $header) { |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | private $requestedPlugins; |
| 6 | 6 | private $pluginOrder; |
| 7 | 7 | |
| 8 | - public function __construct($requestedPlugins=array()) |
|
| 8 | + public function __construct($requestedPlugins = array()) |
|
| 9 | 9 | { |
| 10 | 10 | $this->requestedPlugins = $requestedPlugins; |
| 11 | 11 | $this->pluginOrder = array(); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param boolean $raw interpret $type values as raw text instead of files |
| 50 | 50 | * @return array |
| 51 | 51 | */ |
| 52 | - private function filterPlugins($type, $raw=false) |
|
| 52 | + private function filterPlugins($type, $raw = false) |
|
| 53 | 53 | { |
| 54 | 54 | $plugins = $this->getPlugins(); |
| 55 | 55 | $plugins = $this->sortPlugins($plugins); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $ret[$name] = $files[$type]; |
| 63 | 63 | } else { |
| 64 | 64 | foreach ($files[$type] as $file) { |
| 65 | - array_push($ret[$name], 'plugins/' . $name . '/' . $file); |
|
| 65 | + array_push($ret[$name], 'plugins/'.$name.'/'.$file); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -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 getPluginsJS($names=null) |
|
| 97 | + public function getPluginsJS($names = null) |
|
| 98 | 98 | { |
| 99 | 99 | if ($names) { |
| 100 | 100 | $names = array_merge($this->requestedPlugins, $names); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param array $names the plugin name strings (foldernames) in an array |
| 109 | 109 | * @return array |
| 110 | 110 | */ |
| 111 | - public function getPluginsCSS($names=null) |
|
| 111 | + public function getPluginsCSS($names = null) |
|
| 112 | 112 | { |
| 113 | 113 | if ($names) { |
| 114 | 114 | $names = array_merge($this->requestedPlugins, $names); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param array $names the plugin name strings (foldernames) in an array |
| 123 | 123 | * @return array |
| 124 | 124 | */ |
| 125 | - public function getPluginsTemplates($names=null) |
|
| 125 | + public function getPluginsTemplates($names = null) |
|
| 126 | 126 | { |
| 127 | 127 | if ($names) { |
| 128 | 128 | $names = array_merge($this->requestedPlugins, $names); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @param array $names the plugin name strings (foldernames) in an array |
| 137 | 137 | * @return array |
| 138 | 138 | */ |
| 139 | - public function getTemplates($names=null) |
|
| 139 | + public function getTemplates($names = null) |
|
| 140 | 140 | { |
| 141 | 141 | $templateStrings = array(); |
| 142 | 142 | $plugins = $this->getPluginsTemplates($names); |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | foreach ($templates as $path) { |
| 145 | 145 | if (file_exists($path)) { |
| 146 | 146 | $filename = explode('/', $path); |
| 147 | - $filename = $filename[sizeof($filename)-1]; |
|
| 148 | - $id = $folder . '-' . substr($filename, 0, (strrpos($filename, "."))); |
|
| 147 | + $filename = $filename[sizeof($filename) - 1]; |
|
| 148 | + $id = $folder.'-'.substr($filename, 0, (strrpos($filename, "."))); |
|
| 149 | 149 | $templateStrings[$id] = file_get_contents($path); |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param array $names the plugin name strings (foldernames) in an array |
| 159 | 159 | * @return array |
| 160 | 160 | */ |
| 161 | - public function getPluginCallbacks($names=null) |
|
| 161 | + public function getPluginCallbacks($names = null) |
|
| 162 | 162 | { |
| 163 | 163 | if ($names) { |
| 164 | 164 | $names = array_merge($this->requestedPlugins, $names); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | protected function flatten($array) |
| 200 | 200 | { |
| 201 | 201 | $return = array(); |
| 202 | - array_walk_recursive($array, function ($a) use (&$return) { $return[] = $a; }); |
|
| 202 | + array_walk_recursive($array, function($a) use (&$return) { $return[] = $a; }); |
|
| 203 | 203 | return $return; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $label = $this->getLabel(); |
| 38 | 38 | $notation = $this->getNotation(); |
| 39 | - return ltrim($notation . ' ') . $label; |
|
| 39 | + return ltrim($notation.' ').$label; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function getType() |
@@ -181,25 +181,25 @@ discard block |
||
| 181 | 181 | 'from' => [ |
| 182 | 182 | 'memberSet' => [ |
| 183 | 183 | [ |
| 184 | - 'uri' => (string) $this->source->getUri(), |
|
| 184 | + 'uri' => (string)$this->source->getUri(), |
|
| 185 | 185 | ] |
| 186 | 186 | ] |
| 187 | 187 | ], |
| 188 | 188 | 'to' => [ |
| 189 | 189 | 'memberSet' => [ |
| 190 | 190 | [ |
| 191 | - 'uri' => (string) $this->getUri() |
|
| 191 | + 'uri' => (string)$this->getUri() |
|
| 192 | 192 | ] |
| 193 | 193 | ] |
| 194 | 194 | ], |
| 195 | 195 | // EXTRA |
| 196 | 196 | 'hrefLink' => $hrefLink, // link to resource as displayed in the UI |
| 197 | 197 | 'lang' => $propertyLang, // TBD: could it be part of the prefLabel? |
| 198 | - 'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI |
|
| 198 | + 'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI |
|
| 199 | 199 | 'typeLabel' => $this->model->getText($this->type), // a text used in the UI instead of, for example, skos:closeMatch |
| 200 | 200 | ]; |
| 201 | 201 | |
| 202 | - $helpprop = $this->type . "_help"; |
|
| 202 | + $helpprop = $this->type."_help"; |
|
| 203 | 203 | // see if we have a translation for the property help text |
| 204 | 204 | $help = $this->model->getText($helpprop); |
| 205 | 205 | if ($help != $helpprop) { |
@@ -209,20 +209,20 @@ discard block |
||
| 209 | 209 | $fromScheme = $this->vocab->getDefaultConceptScheme(); |
| 210 | 210 | if (isset($fromScheme)) { |
| 211 | 211 | $ret['fromScheme'] = [ |
| 212 | - 'uri' => (string) $fromScheme, |
|
| 212 | + 'uri' => (string)$fromScheme, |
|
| 213 | 213 | ]; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $exvocab = $this->getExvocab(); |
| 217 | 217 | if (isset($exvocab)) { |
| 218 | 218 | $ret['toScheme'] = [ |
| 219 | - 'uri' => (string) $exvocab->getDefaultConceptScheme(), |
|
| 219 | + 'uri' => (string)$exvocab->getDefaultConceptScheme(), |
|
| 220 | 220 | ]; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | $notation = $this->getNotation(); |
| 224 | 224 | if (isset($notation)) { |
| 225 | - $ret['to']['memberSet'][0]['notation'] = (string) $notation; |
|
| 225 | + $ret['to']['memberSet'][0]['notation'] = (string)$notation; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $label = $this->getLabel($lang, $queryExVocabs); |