Completed
Branch master (ec991a)
by Osma
05:04 queued 02:03
created
controller/WebController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
         // register a Twig filter for generating URLs for vocabulary resources (concepts and groups)
71 71
         $controller = $this; // for use by anonymous function below
72
-        $urlFilter = new Twig_SimpleFilter('link_url', function ($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) {
72
+        $urlFilter = new Twig_SimpleFilter('link_url', function($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null) use ($controller) {
73 73
             // $vocab can either be null, a vocabulary id (string) or a Vocabulary object
74 74
             if ($vocab === null) {
75 75
                 // target vocabulary is unknown, best bet is to link to the plain URI
@@ -94,23 +94,23 @@  discard block
 block discarded – undo
94 94
             $localname = $vocab->getLocalName($uri);
95 95
             if ($localname !== $uri && $localname === urlencode($localname)) {
96 96
                 // check that the prefix stripping worked, and there are no problematic chars in localname
97
-                $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : '';
97
+                $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : '';
98 98
                 if ($type && $type !== '' && $type !== 'vocab') {
99
-                    return "$vocid/$lang/$type/$localname" . $paramstr;
99
+                    return "$vocid/$lang/$type/$localname".$paramstr;
100 100
                 }
101 101
 
102
-                return "$vocid/$lang/$localname" . $paramstr;
102
+                return "$vocid/$lang/$localname".$paramstr;
103 103
             }
104 104
 
105 105
             // case 2: URI outside vocabulary namespace, or has problematic chars
106 106
             // pass the full URI as parameter instead
107 107
             $params['uri'] = $uri;
108
-            return "$vocid/$lang/$type/?" . http_build_query($params);
108
+            return "$vocid/$lang/$type/?".http_build_query($params);
109 109
         });
110 110
         $this->twig->addFilter($urlFilter);
111 111
 
112 112
         // register a Twig filter for generating strings from language codes with CLDR
113
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
113
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
114 114
             return Language::getName($langcode, $lang);
115 115
         });
116 116
         $this->twig->addFilter($langFilter);
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail)
252 252
     {
253 253
         $headers = "MIME-Version: 1.0″ . '\r\n";
254
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
254
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
255 255
         if ($toMail) {
256
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
256
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
257 257
         }
258 258
 
259
-        $headers .= "From: $fromName <$fromEmail>" . "\r\n" . 'X-Mailer: PHP/' . phpversion();
259
+        $headers .= "From: $fromName <$fromEmail>"."\r\n".'X-Mailer: PHP/'.phpversion();
260 260
         return $headers;
261 261
     }
262 262
 
@@ -271,20 +271,20 @@  discard block
 block discarded – undo
271 271
     {
272 272
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
273 273
         if ($fromVocab !== null) {
274
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
274
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
275 275
         }
276 276
 
277
-        $subject = SERVICE_NAME . " feedback";
277
+        $subject = SERVICE_NAME." feedback";
278 278
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail);
279 279
         $envelopeSender = FEEDBACK_ENVELOPE_SENDER;
280 280
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
281 281
 
282 282
         // adding some information about the user for debugging purposes.
283
-        $message = $message . "<br /><br /> Debugging information:"
284
-            . "<br />Timestamp: " . date(DATE_RFC2822)
285
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
286
-            . "<br />IP address: " . $request->getServerConstant('REMOTE_ADDR')
287
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
283
+        $message = $message."<br /><br /> Debugging information:"
284
+            . "<br />Timestamp: ".date(DATE_RFC2822)
285
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
286
+            . "<br />IP address: ".$request->getServerConstant('REMOTE_ADDR')
287
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
288 288
 
289 289
         try {
290 290
             mail($toAddress, $subject, $message, $headers, $params);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             header("HTTP/1.0 404 Not Found");
293 293
             $template = $this->twig->loadTemplate('error-page.twig');
294 294
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
295
-                error_log('Caught exception: ' . $e->getMessage());
295
+                error_log('Caught exception: '.$e->getMessage());
296 296
             }
297 297
 
298 298
             echo $template->render(
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
340 340
         $vocabObjects = array();
341 341
         if ($vocids) {
342
-            foreach($vocids as $vocid) {
342
+            foreach ($vocids as $vocid) {
343 343
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
344 344
             }
345 345
         }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         } catch (Exception $e) {
351 351
             header("HTTP/1.0 404 Not Found");
352 352
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
353
-                error_log('Caught exception: ' . $e->getMessage());
353
+                error_log('Caught exception: '.$e->getMessage());
354 354
             }
355 355
             $this->invokeGenericErrorPage($request, $e->getMessage());
356 356
             return;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                 'search_count' => $counts,
367 367
                 'languages' => $this->languages,
368 368
                 'search_results' => $search_results,
369
-                'rest' => $parameters->getOffset()>0,
369
+                'rest' => $parameters->getOffset() > 0,
370 370
                 'global_search' => true,
371 371
                 'term' => $request->getQueryParam('q'),
372 372
                 'lang_list' => $langList,
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         } catch (Exception $e) {
392 392
             header("HTTP/1.0 404 Not Found");
393 393
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
394
-                error_log('Caught exception: ' . $e->getMessage());
394
+                error_log('Caught exception: '.$e->getMessage());
395 395
             }
396 396
 
397 397
             echo $template->render(
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         } catch (Exception $e) {
413 413
             header("HTTP/1.0 404 Not Found");
414 414
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
415
-                error_log('Caught exception: ' . $e->getMessage());
415
+                error_log('Caught exception: '.$e->getMessage());
416 416
             }
417 417
 
418 418
             echo $template->render(
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
                 'vocab' => $vocab,
430 430
                 'search_results' => $search_results,
431 431
                 'search_count' => $counts,
432
-                'rest' => $parameters->getOffset()>0,
432
+                'rest' => $parameters->getOffset() > 0,
433 433
                 'limit_parent' => $parameters->getParentLimit(),
434 434
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
435 435
                 'limit_group' => $parameters->getGroupLimit(),
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
      * Loads and renders the view containing a list of recent changes in the vocabulary.
555 555
      * @param Request $request
556 556
      */
557
-    public function invokeChangeList($request, $prop='dc:created')
557
+    public function invokeChangeList($request, $prop = 'dc:created')
558 558
     {
559 559
         // set language parameters for gettext
560 560
         $this->setLanguageProperties($request->getLang());
Please login to merge, or discard this patch.