Completed
Pull Request — master (#881)
by
unknown
01:45
created
controller/WebController.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         // specify where to look for templates and cache
45 45
         $loader = new Twig_Loader_Filesystem('view');
46 46
         // initialize Twig environment
47
-        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true));
47
+        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true));
48 48
         $this->twig->addExtension(new Twig_Extensions_Extension_I18n());
49 49
         // used for setting the base href for the relative urls
50 50
         $this->twig->addGlobal("BaseHref", $this->getBaseHref());
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter')));
68 68
 
69 69
         // register a Twig filter for generating strings from language codes with CLDR
70
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
70
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
71 71
             return Language::getName($langcode, $lang);
72 72
         });
73 73
         $this->twig->addFilter($langFilter);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         }
80 80
         $this->twig->addGlobal('honeypot', $this->honeypot);
81 81
         
82
-        $direction_test = new Twig_Function('direction_test', function($locale=''){
82
+        $direction_test = new Twig_Function('direction_test', function($locale = '') {
83 83
             $data = Data::get('layout', $locale);
84 84
             return $data['characterOrder'];
85 85
         });
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
         $localname = $vocab->getLocalName($uri);
122 122
         if ($localname !== $uri && $localname === urlencode($localname)) {
123 123
             // check that the prefix stripping worked, and there are no problematic chars in localname
124
-            $paramstr = sizeof($params) > 0 ? '?' . http_build_query($params) : '';
124
+            $paramstr = sizeof($params) > 0 ? '?'.http_build_query($params) : '';
125 125
             if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
126
-                return "$vocid/$lang/$type/$localname" . $paramstr;
126
+                return "$vocid/$lang/$type/$localname".$paramstr;
127 127
             }
128 128
 
129
-            return "$vocid/$lang/$localname" . $paramstr;
129
+            return "$vocid/$lang/$localname".$paramstr;
130 130
         }
131 131
 
132 132
         // case 2: URI outside vocabulary namespace, or has problematic chars
133 133
         // pass the full URI as parameter instead
134 134
         $params['uri'] = $uri;
135
-        return "$vocid/$lang/$type/?" . http_build_query($params);
135
+        return "$vocid/$lang/$type/?".http_build_query($params);
136 136
     }
137 137
 
138 138
     /**
@@ -421,9 +421,9 @@  discard block
 block discarded – undo
421 421
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
422 422
     {
423 423
         $headers = "MIME-Version: 1.0″ . '\r\n";
424
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
424
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
425 425
         if (!empty($toMail)) {
426
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
426
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
427 427
         }
428 428
         if (!empty($fromEmail)) {
429 429
             $headers .= "Reply-To: $fromName <$fromEmail>\r\n";
@@ -445,11 +445,11 @@  discard block
 block discarded – undo
445 445
     {
446 446
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
447 447
         if ($fromVocab !== null && $fromVocab !== '') {
448
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
448
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
449 449
         }
450 450
 
451 451
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
452
-        $subject = $this->model->getConfig()->getServiceName() . " feedback";
452
+        $subject = $this->model->getConfig()->getServiceName()." feedback";
453 453
         // determine the sender address of the message
454 454
         $sender = $this->model->getConfig()->getFeedbackSender();
455 455
         if (empty($sender)) $sender = $envelopeSender;
@@ -462,10 +462,10 @@  discard block
 block discarded – undo
462 462
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
463 463
 
464 464
         // adding some information about the user for debugging purposes.
465
-        $message = $message . "<br /><br /> Debugging information:"
466
-            . "<br />Timestamp: " . date(DATE_RFC2822)
467
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
468
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
465
+        $message = $message."<br /><br /> Debugging information:"
466
+            . "<br />Timestamp: ".date(DATE_RFC2822)
467
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
468
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
469 469
 
470 470
         try {
471 471
             mail($toAddress, $subject, $message, $headers, $params);
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             header("HTTP/1.0 404 Not Found");
474 474
             $template = $this->twig->loadTemplate('error-page.twig');
475 475
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
476
-                error_log('Caught exception: ' . $e->getMessage());
476
+                error_log('Caught exception: '.$e->getMessage());
477 477
             }
478 478
 
479 479
             echo $template->render(
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
521 521
         $vocabObjects = array();
522 522
         if ($vocids) {
523
-            foreach($vocids as $vocid) {
523
+            foreach ($vocids as $vocid) {
524 524
                 $vocabObjects[] = $this->model->getVocabulary($vocid);
525 525
             }
526 526
         }
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
         } catch (Exception $e) {
532 532
             header("HTTP/1.0 404 Not Found");
533 533
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
534
-                error_log('Caught exception: ' . $e->getMessage());
534
+                error_log('Caught exception: '.$e->getMessage());
535 535
             }
536 536
             $this->invokeGenericErrorPage($request, $e->getMessage());
537 537
             return;
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
                 'search_count' => $counts,
548 548
                 'languages' => $this->languages,
549 549
                 'search_results' => $searchResults,
550
-                'rest' => $parameters->getOffset()>0,
550
+                'rest' => $parameters->getOffset() > 0,
551 551
                 'global_search' => true,
552 552
                 'term' => $request->getQueryParamRaw('q'),
553 553
                 'lang_list' => $langList,
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
         } catch (Exception $e) {
573 573
             header("HTTP/1.0 404 Not Found");
574 574
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
575
-                error_log('Caught exception: ' . $e->getMessage());
575
+                error_log('Caught exception: '.$e->getMessage());
576 576
             }
577 577
 
578 578
             echo $template->render(
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
         } catch (Exception $e) {
594 594
             header("HTTP/1.0 404 Not Found");
595 595
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
596
-                error_log('Caught exception: ' . $e->getMessage());
596
+                error_log('Caught exception: '.$e->getMessage());
597 597
             }
598 598
 
599 599
             echo $template->render(
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
                 'vocab' => $vocab,
611 611
                 'search_results' => $searchResults,
612 612
                 'search_count' => $counts,
613
-                'rest' => $parameters->getOffset()>0,
613
+                'rest' => $parameters->getOffset() > 0,
614 614
                 'limit_parent' => $parameters->getParentLimit(),
615 615
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
616 616
                 'limit_group' => $parameters->getGroupLimit(),
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
      * Loads and renders the view containing a list of recent changes in the vocabulary.
740 740
      * @param Request $request
741 741
      */
742
-    public function invokeChangeList($request, $prop='dc:created')
742
+    public function invokeChangeList($request, $prop = 'dc:created')
743 743
     {
744 744
         // set language parameters for gettext
745 745
         $this->setLanguageProperties($request->getLang());
Please login to merge, or discard this patch.