@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | private $plugins; |
| 9 | 9 | private $languageOrderCache = array(); |
| 10 | 10 | |
| 11 | - public function __construct($resource, $globalPlugins=array()) |
|
| 11 | + public function __construct($resource, $globalPlugins = array()) |
|
| 12 | 12 | { |
| 13 | 13 | $this->resource = $resource; |
| 14 | 14 | $plugins = $this->resource->allLiterals('skosmos:usePlugin'); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $langs = $this->getLanguages(); |
| 37 | 37 | $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric |
| 38 | 38 | if (sizeof($langs) > 1) { |
| 39 | - trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
| 39 | + trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | return $deflang; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | // specify where to look for templates and cache |
| 38 | 38 | $loader = new Twig_Loader_Filesystem('view'); |
| 39 | 39 | // initialize Twig environment |
| 40 | - $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true)); |
|
| 40 | + $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true)); |
|
| 41 | 41 | $this->twig->addExtension(new Twig_Extensions_Extension_I18n()); |
| 42 | 42 | // used for setting the base href for the relative urls |
| 43 | 43 | $this->twig->addGlobal("BaseHref", $this->getBaseHref()); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter'))); |
| 61 | 61 | |
| 62 | 62 | // register a Twig filter for generating strings from language codes with CLDR |
| 63 | - $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) { |
|
| 63 | + $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) { |
|
| 64 | 64 | return Language::getName($langcode, $lang); |
| 65 | 65 | }); |
| 66 | 66 | $this->twig->addFilter($langFilter); |
@@ -272,9 +272,9 @@ discard block |
||
| 272 | 272 | private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender) |
| 273 | 273 | { |
| 274 | 274 | $headers = "MIME-Version: 1.0″ . '\r\n"; |
| 275 | - $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; |
|
| 275 | + $headers .= "Content-type: text/html; charset=UTF-8"."\r\n"; |
|
| 276 | 276 | if (!empty($toMail)) { |
| 277 | - $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n"; |
|
| 277 | + $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n"; |
|
| 278 | 278 | } |
| 279 | 279 | if (!empty($fromEmail)) { |
| 280 | 280 | $headers .= "Reply-To: $fromName <$fromEmail>\r\n"; |
@@ -296,11 +296,11 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress(); |
| 298 | 298 | if ($fromVocab !== null && $fromVocab !== '') { |
| 299 | - $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message; |
|
| 299 | + $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message; |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender(); |
| 303 | - $subject = $this->model->getConfig()->getServiceName() . " feedback"; |
|
| 303 | + $subject = $this->model->getConfig()->getServiceName()." feedback"; |
|
| 304 | 304 | // determine the sender address of the message |
| 305 | 305 | $sender = $this->model->getConfig()->getFeedbackSender(); |
| 306 | 306 | if (empty($sender)) $sender = $envelopeSender; |
@@ -313,10 +313,10 @@ discard block |
||
| 313 | 313 | $params = empty($envelopeSender) ? '' : "-f $envelopeSender"; |
| 314 | 314 | |
| 315 | 315 | // adding some information about the user for debugging purposes. |
| 316 | - $message = $message . "<br /><br /> Debugging information:" |
|
| 317 | - . "<br />Timestamp: " . date(DATE_RFC2822) |
|
| 318 | - . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT') |
|
| 319 | - . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER'); |
|
| 316 | + $message = $message."<br /><br /> Debugging information:" |
|
| 317 | + . "<br />Timestamp: ".date(DATE_RFC2822) |
|
| 318 | + . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT') |
|
| 319 | + . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER'); |
|
| 320 | 320 | |
| 321 | 321 | try { |
| 322 | 322 | mail($toAddress, $subject, $message, $headers, $params); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | header("HTTP/1.0 404 Not Found"); |
| 325 | 325 | $template = $this->twig->loadTemplate('error-page.twig'); |
| 326 | 326 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 327 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 327 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | echo $template->render( |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null; |
| 372 | 372 | $vocabObjects = array(); |
| 373 | 373 | if ($vocids) { |
| 374 | - foreach($vocids as $vocid) { |
|
| 374 | + foreach ($vocids as $vocid) { |
|
| 375 | 375 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | } catch (Exception $e) { |
| 383 | 383 | header("HTTP/1.0 404 Not Found"); |
| 384 | 384 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 385 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 385 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 386 | 386 | } |
| 387 | 387 | $this->invokeGenericErrorPage($request, $e->getMessage()); |
| 388 | 388 | return; |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | 'search_count' => $counts, |
| 399 | 399 | 'languages' => $this->languages, |
| 400 | 400 | 'search_results' => $searchResults, |
| 401 | - 'rest' => $parameters->getOffset()>0, |
|
| 401 | + 'rest' => $parameters->getOffset() > 0, |
|
| 402 | 402 | 'global_search' => true, |
| 403 | 403 | 'term' => $request->getQueryParamRaw('q'), |
| 404 | 404 | 'lang_list' => $langList, |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | } catch (Exception $e) { |
| 424 | 424 | header("HTTP/1.0 404 Not Found"); |
| 425 | 425 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 426 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 426 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | echo $template->render( |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | } catch (Exception $e) { |
| 445 | 445 | header("HTTP/1.0 404 Not Found"); |
| 446 | 446 | if ($this->model->getConfig()->getLogCaughtExceptions()) { |
| 447 | - error_log('Caught exception: ' . $e->getMessage()); |
|
| 447 | + error_log('Caught exception: '.$e->getMessage()); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | echo $template->render( |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | 'vocab' => $vocab, |
| 462 | 462 | 'search_results' => $searchResults, |
| 463 | 463 | 'search_count' => $counts, |
| 464 | - 'rest' => $parameters->getOffset()>0, |
|
| 464 | + 'rest' => $parameters->getOffset() > 0, |
|
| 465 | 465 | 'limit_parent' => $parameters->getParentLimit(), |
| 466 | 466 | 'limit_type' => $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null, |
| 467 | 467 | 'limit_group' => $parameters->getGroupLimit(), |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | * Loads and renders the view containing a list of recent changes in the vocabulary. |
| 591 | 591 | * @param Request $request |
| 592 | 592 | */ |
| 593 | - public function invokeChangeList($request, $prop='dc:created') |
|
| 593 | + public function invokeChangeList($request, $prop = 'dc:created') |
|
| 594 | 594 | { |
| 595 | 595 | // set language parameters for gettext |
| 596 | 596 | $this->setLanguageProperties($request->getLang()); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $label = $this->getLabel(); |
| 38 | 38 | $notation = $this->getNotation(); |
| 39 | - return $notation . $label; |
|
| 39 | + return $notation.$label; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function getType() |
@@ -188,42 +188,42 @@ discard block |
||
| 188 | 188 | 'from' => [ |
| 189 | 189 | 'memberSet' => [ |
| 190 | 190 | [ |
| 191 | - 'uri' => (string) $this->source->getUri(), |
|
| 191 | + 'uri' => (string)$this->source->getUri(), |
|
| 192 | 192 | ] |
| 193 | 193 | ] |
| 194 | 194 | ], |
| 195 | 195 | 'to' => [ |
| 196 | 196 | 'memberSet' => [ |
| 197 | 197 | [ |
| 198 | - 'uri' => (string) $this->getUri() |
|
| 198 | + 'uri' => (string)$this->getUri() |
|
| 199 | 199 | ] |
| 200 | 200 | ] |
| 201 | 201 | ], |
| 202 | 202 | // EXTRA |
| 203 | - 'description' => gettext($this->type . "_help"), // pop-up text |
|
| 203 | + 'description' => gettext($this->type."_help"), // pop-up text |
|
| 204 | 204 | 'hrefLink' => $hrefLink, // link to resource as displayed in the UI |
| 205 | 205 | 'lang' => $propertyLang, // TBD: could it be part of the prefLabel? |
| 206 | - 'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI |
|
| 206 | + 'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI |
|
| 207 | 207 | 'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch |
| 208 | 208 | ]; |
| 209 | 209 | |
| 210 | 210 | $fromScheme = $this->vocab->getDefaultConceptScheme(); |
| 211 | 211 | if (isset($fromScheme)) { |
| 212 | 212 | $ret['fromScheme'] = [ |
| 213 | - 'uri' => (string) $fromScheme, |
|
| 213 | + 'uri' => (string)$fromScheme, |
|
| 214 | 214 | ]; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $exvocab = $this->getExvocab(); |
| 218 | 218 | if (isset($exvocab)) { |
| 219 | 219 | $ret['toScheme'] = [ |
| 220 | - 'uri' => (string) $exvocab->getDefaultConceptScheme(), |
|
| 220 | + 'uri' => (string)$exvocab->getDefaultConceptScheme(), |
|
| 221 | 221 | ]; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | $notation = $this->getNotation(); |
| 225 | 225 | if (isset($notation)) { |
| 226 | - $ret['to']['memberSet'][0]['notation'] = (string) $notation; |
|
| 226 | + $ret['to']['memberSet'][0]['notation'] = (string)$notation; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $label = $this->getLabel(null, $queryExVocabs); |
@@ -28,17 +28,17 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | private $configModifiedTime = null; |
| 30 | 30 | |
| 31 | - public function __construct($config_name='/../config.ttl') |
|
| 31 | + public function __construct($config_name = '/../config.ttl') |
|
| 32 | 32 | { |
| 33 | 33 | $this->cache = new Cache(); |
| 34 | 34 | try { |
| 35 | - $this->filePath = realpath( dirname(__FILE__) . $config_name ); |
|
| 35 | + $this->filePath = realpath(dirname(__FILE__).$config_name); |
|
| 36 | 36 | if (!file_exists($this->filePath)) { |
| 37 | 37 | throw new Exception('config.ttl file is missing, please provide one.'); |
| 38 | 38 | } |
| 39 | 39 | $this->initializeConfig(); |
| 40 | 40 | } catch (Exception $e) { |
| 41 | - echo "Error: " . $e->getMessage(); |
|
| 41 | + echo "Error: ".$e->getMessage(); |
|
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | // use APC user cache to store parsed config.ttl configuration |
| 73 | 73 | if ($this->cache->isAvailable() && !is_null($this->configModifiedTime)) { |
| 74 | 74 | // @codeCoverageIgnoreStart |
| 75 | - $key = realpath($this->filePath) . ", " . $this->configModifiedTime; |
|
| 76 | - $nskey = "namespaces of " . $key; |
|
| 75 | + $key = realpath($this->filePath).", ".$this->configModifiedTime; |
|
| 76 | + $nskey = "namespaces of ".$key; |
|
| 77 | 77 | $this->graph = $this->cache->fetch($key); |
| 78 | 78 | $this->namespaces = $this->cache->fetch($nskey); |
| 79 | 79 | if ($this->graph === false || $this->namespaces === false) { // was not found in cache |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $this->resource = $configResources[0]; |
| 95 | 95 | $this->initializeNamespaces(); |
| 96 | 96 | } catch (Exception $e) { |
| 97 | - echo "Error: " . $e->getMessage(); |
|
| 97 | + echo "Error: ".$e->getMessage(); |
|
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | public function getGlobalPlugins() |
| 325 | 325 | { |
| 326 | 326 | $globalPlugins = array(); |
| 327 | - $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
| 327 | + $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins"); |
|
| 328 | 328 | if ($globalPluginsResource) { |
| 329 | 329 | foreach ($globalPluginsResource as $resource) { |
| 330 | 330 | $globalPlugins[] = $resource->getValue(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | // wrap with JSONP callback if requested |
| 26 | 26 | if (filter_input(INPUT_GET, 'callback', FILTER_SANITIZE_STRING)) { |
| 27 | 27 | header("Content-type: application/javascript; charset=utf-8"); |
| 28 | - echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW) . "(" . json_encode($data) . ");"; |
|
| 28 | + echo filter_input(INPUT_GET, 'callback', FILTER_UNSAFE_RAW)."(".json_encode($data).");"; |
|
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | 'vocabularies' => 'onki:hasVocabulary', |
| 89 | 89 | 'id' => 'onki:vocabularyIdentifier', |
| 90 | 90 | 'uri' => '@id', |
| 91 | - '@base' => $this->getBaseHref() . "rest/v1/vocabularies", |
|
| 91 | + '@base' => $this->getBaseHref()."rest/v1/vocabularies", |
|
| 92 | 92 | ), |
| 93 | 93 | 'uri' => '', |
| 94 | 94 | 'vocabularies' => $results, |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | // convert to vocids array to support multi-vocabulary search |
| 106 | 106 | $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : array(); |
| 107 | 107 | $vocabObjects = array(); |
| 108 | - foreach($vocids as $vocid) { |
|
| 108 | + foreach ($vocids as $vocid) { |
|
| 109 | 109 | $vocabObjects[] = $this->model->getVocabulary($vocid); |
| 110 | 110 | } |
| 111 | 111 | $parameters->setVocabularies($vocabObjects); |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | foreach ($parameters->getAdditionalFields() as $field) { |
| 137 | 137 | |
| 138 | 138 | // Quick-and-dirty compactification |
| 139 | - $context[$field] = 'skos:' . $field; |
|
| 139 | + $context[$field] = 'skos:'.$field; |
|
| 140 | 140 | foreach ($results as &$result) { |
| 141 | 141 | foreach ($result as $k => $v) { |
| 142 | - if ($k == 'skos:' . $field) { |
|
| 142 | + if ($k == 'skos:'.$field) { |
|
| 143 | 143 | $result[$field] = $v; |
| 144 | - unset($result['skos:' . $field]); |
|
| 144 | + unset($result['skos:'.$field]); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | if ($request->getQueryParam('labellang')) { |
| 161 | 161 | $ret['@context']['@language'] = $request->getQueryParam('labellang'); |
| 162 | 162 | } elseif ($request->getQueryParam('lang')) { |
| 163 | - $ret['@context']['@language'] = $request->getQueryParam('lang');; |
|
| 163 | + $ret['@context']['@language'] = $request->getQueryParam('lang'); ; |
|
| 164 | 164 | } |
| 165 | 165 | return $ret; |
| 166 | 166 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | 'prefLabel' => 'skos:prefLabel', |
| 227 | 227 | 'title' => 'dct:title', |
| 228 | 228 | '@language' => $request->getLang(), |
| 229 | - '@base' => $this->getBaseHref() . "rest/v1/" . $vocab->getId() . "/", |
|
| 229 | + '@base' => $this->getBaseHref()."rest/v1/".$vocab->getId()."/", |
|
| 230 | 230 | ), |
| 231 | 231 | 'uri' => '', |
| 232 | 232 | 'id' => $vocab->getId(), |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | 'subTypes' => array('@id' => 'void:class', '@type' => '@id'), |
| 278 | 278 | 'count' => 'void:entities', |
| 279 | 279 | '@language' => $request->getLang(), |
| 280 | - '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/", |
|
| 280 | + '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/", |
|
| 281 | 281 | ), |
| 282 | 282 | 'uri' => '', |
| 283 | 283 | 'id' => $request->getVocab()->getId(), |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | 'language' => 'void-ext:language', |
| 352 | 352 | 'properties' => 'void:propertyPartition', |
| 353 | 353 | 'labels' => 'void:triples', |
| 354 | - '@base' => $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/", |
|
| 354 | + '@base' => $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/", |
|
| 355 | 355 | ), |
| 356 | 356 | 'uri' => '', |
| 357 | 357 | 'id' => $request->getVocab()->getId(), |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | $types[] = $type; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - $base = $request->getVocab() ? $this->getBaseHref() . "rest/v1/" . $request->getVocab()->getId() . "/" : $this->getBaseHref() . "rest/v1/"; |
|
| 391 | + $base = $request->getVocab() ? $this->getBaseHref()."rest/v1/".$request->getVocab()->getId()."/" : $this->getBaseHref()."rest/v1/"; |
|
| 392 | 392 | |
| 393 | 393 | $ret = array_merge_recursive($this->context, array( |
| 394 | 394 | '@context' => array( |
@@ -548,19 +548,19 @@ discard block |
||
| 548 | 548 | |
| 549 | 549 | $format = $this->negotiateFormat(array_keys($urls), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format')); |
| 550 | 550 | if (!$format) { |
| 551 | - return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . implode(' ', array_keys($urls))); |
|
| 551 | + return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".implode(' ', array_keys($urls))); |
|
| 552 | 552 | } |
| 553 | 553 | if (is_array($urls[$format])) { |
| 554 | 554 | $arr = $urls[$format]; |
| 555 | 555 | $dataLang = $request->getLang(); |
| 556 | 556 | if (isset($arr[$dataLang])) { |
| 557 | - header("Location: " . $arr[$dataLang]); |
|
| 557 | + header("Location: ".$arr[$dataLang]); |
|
| 558 | 558 | } else { |
| 559 | 559 | $vocid = $request->getVocab()->getId(); |
| 560 | 560 | return $this->returnError('404', 'Not Found', "No download source URL known for vocabulary $vocid in language $dataLang"); |
| 561 | 561 | } |
| 562 | 562 | } else { |
| 563 | - header("Location: " . $urls[$format]); |
|
| 563 | + header("Location: ".$urls[$format]); |
|
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | |
| 621 | 621 | $format = $this->negotiateFormat(explode(' ', self::SUPPORTED_FORMATS), $request->getServerConstant('HTTP_ACCEPT'), $request->getQueryParam('format')); |
| 622 | 622 | if (!$format) { |
| 623 | - return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: " . self::SUPPORTED_FORMATS); |
|
| 623 | + return $this->returnError(406, 'Not Acceptable', "Unsupported format. Supported MIME types are: ".self::SUPPORTED_FORMATS); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | $vocid = $vocab ? $vocab->getId() : null; |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | 816 | // if the main concept scheme was not found, set 'top' to the first 'tops' (sorted alphabetically on the URIs) |
| 817 | - if (! isset($results[$uri]['top'])) { |
|
| 817 | + if (!isset($results[$uri]['top'])) { |
|
| 818 | 818 | $results[$uri]['top'] = $results[$uri]['tops'][0]; |
| 819 | 819 | } |
| 820 | 820 | } else { |
@@ -142,18 +142,18 @@ discard block |
||
| 142 | 142 | $localname = $vocab->getLocalName($uri); |
| 143 | 143 | if ($localname !== $uri && $localname === urlencode($localname)) { |
| 144 | 144 | // check that the prefix stripping worked, and there are no problematic chars in localname |
| 145 | - $paramstr = count($params) > 0 ? '?' . http_build_query($params) : ''; |
|
| 145 | + $paramstr = count($params) > 0 ? '?'.http_build_query($params) : ''; |
|
| 146 | 146 | if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) { |
| 147 | - return "$vocid/$lang/$type/$localname" . $paramstr; |
|
| 147 | + return "$vocid/$lang/$type/$localname".$paramstr; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - return "$vocid/$lang/$localname" . $paramstr; |
|
| 150 | + return "$vocid/$lang/$localname".$paramstr; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // case 2: URI outside vocabulary namespace, or has problematic chars |
| 154 | 154 | // pass the full URI as parameter instead |
| 155 | 155 | $params['uri'] = $uri; |
| 156 | - return "$vocid/$lang/$type/?" . http_build_query($params); |
|
| 156 | + return "$vocid/$lang/$type/?".http_build_query($params); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | { |
| 188 | 188 | if ($modifiedDate) { |
| 189 | 189 | $ifModifiedSince = $this->getIfModifiedSince(); |
| 190 | - $this->sendHeader("Last-Modified: " . $modifiedDate->format('Y-m-d H:i:s')); |
|
| 190 | + $this->sendHeader("Last-Modified: ".$modifiedDate->format('Y-m-d H:i:s')); |
|
| 191 | 191 | if (!is_null($ifModifiedSince) && $ifModifiedSince >= $modifiedDate) { |
| 192 | 192 | $this->sendHeader("HTTP/1.0 304 Not Modified"); |
| 193 | 193 | return true; |
@@ -19,9 +19,9 @@ |
||
| 19 | 19 | |
| 20 | 20 | $graph = new EasyRdf\Graph($this->uri); |
| 21 | 21 | $params1 = http_build_query(array('subject' => $this->uri, 'predicate' => 'rdfs:label')); |
| 22 | - $graph->load($this->ldfEndpoint . '?' . $params1); |
|
| 22 | + $graph->load($this->ldfEndpoint.'?'.$params1); |
|
| 23 | 23 | $params2 = http_build_query(array('object' => $this->uri, 'predicate' => 'schema:about')); |
| 24 | - $graph->load($this->ldfEndpoint . '?' . $params2); |
|
| 24 | + $graph->load($this->ldfEndpoint.'?'.$params2); |
|
| 25 | 25 | return $graph->resource($this->uri); |
| 26 | 26 | } catch (Exception $e) { |
| 27 | 27 | // FIXME proper logging needed |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | $opts = array('http' => array('method'=>'HEAD', |
| 19 | 19 | 'user_agent' => 'Skosmos', |
| 20 | 20 | 'timeout' => $timeout)); |
| 21 | - $context = stream_context_create($opts); |
|
| 21 | + $context = stream_context_create($opts); |
|
| 22 | 22 | $fd = fopen($this->uri, 'rb', false, $context); |
| 23 | 23 | $headers = stream_get_meta_data($fd)['wrapper_data']; |
| 24 | 24 | foreach ($headers as $header) { |
@@ -220,18 +220,18 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | $vocabs = $params->getVocabs(); |
| 223 | - $showDeprecated=false; |
|
| 223 | + $showDeprecated = false; |
|
| 224 | 224 | if (sizeof($vocabs) === 1) { // search within vocabulary |
| 225 | 225 | $voc = $vocabs[0]; |
| 226 | 226 | $sparql = $voc->getSparql(); |
| 227 | - $showDeprecated=$voc->getConfig()->getShowDeprecated(); |
|
| 227 | + $showDeprecated = $voc->getConfig()->getShowDeprecated(); |
|
| 228 | 228 | } else { // multi-vocabulary or global search |
| 229 | 229 | $voc = null; |
| 230 | 230 | $sparql = $this->getDefaultSparql(); |
| 231 | 231 | // @TODO : in a global search showDeprecated will always be false and cannot be set globally |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params,$showDeprecated); |
|
| 234 | + $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params, $showDeprecated); |
|
| 235 | 235 | if ($params->getRest() && $results && $params->getSearchLimit() !== 0) { |
| 236 | 236 | $results = array_slice($results, $params->getOffset(), $params->getSearchLimit()); |
| 237 | 237 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | public function getVocabularyCategories() |
| 387 | 387 | { |
| 388 | 388 | $cats = $this->globalConfig->getGraph()->allOfType('skos:Concept'); |
| 389 | - if(empty($cats)) { |
|
| 389 | + if (empty($cats)) { |
|
| 390 | 390 | return array(new VocabularyCategory($this, null)); |
| 391 | 391 | } |
| 392 | 392 | |
@@ -469,9 +469,9 @@ discard block |
||
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | // if there are multiple vocabularies and one is the preferred vocabulary, return it |
| 472 | - if($preferredVocabId != null) { |
|
| 472 | + if ($preferredVocabId != null) { |
|
| 473 | 473 | foreach ($vocabs as $vocab) { |
| 474 | - if($vocab->getId() == $preferredVocabId) { |
|
| 474 | + if ($vocab->getId() == $preferredVocabId) { |
|
| 475 | 475 | // double check that a label exists in the preferred vocabulary |
| 476 | 476 | if ($vocab->getConceptLabel($uri, null) !== null) { |
| 477 | 477 | return $vocab; |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | // using apc cache for the resource if available |
| 554 | 554 | if ($this->globalConfig->getCache()->isAvailable()) { |
| 555 | 555 | // @codeCoverageIgnoreStart |
| 556 | - $key = 'fetch: ' . $uri; |
|
| 556 | + $key = 'fetch: '.$uri; |
|
| 557 | 557 | $resource = $this->globalConfig->getCache()->fetch($key); |
| 558 | 558 | if ($resource === null || $resource === false) { // was not found in cache, or previous request failed |
| 559 | 559 | $resource = $this->resolver->resolve($uri, $this->getConfig()->getHttpTimeout()); |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | */ |
| 575 | 575 | public function getSparqlImplementation($dialect, $endpoint, $graph) |
| 576 | 576 | { |
| 577 | - $classname = $dialect . "Sparql"; |
|
| 577 | + $classname = $dialect."Sparql"; |
|
| 578 | 578 | |
| 579 | 579 | return new $classname($endpoint, $graph, $this); |
| 580 | 580 | } |