@@ -169,6 +169,8 @@ |
||
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Return the mapping as a JSKOS-compatible array. |
172 | + * @param string $lang |
|
173 | + * @param string $hrefLink |
|
172 | 174 | * @return array |
173 | 175 | */ |
174 | 176 | public function asJskos($queryExVocabs = true, $lang = null, $hrefLink = null) |
@@ -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); |
@@ -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()); |
@@ -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; |