Passed
Push — master ( 23cf45...f63d63 )
by Laurent
02:31
created
programs/controller.class.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
  * @copyright Copyright (c) 2008 by CANTICO ({@link http://www.cantico.fr})
22 22
  */
23 23
 
24
-require_once $GLOBALS['babInstallPath'] . 'utilit/controller.class.php';
25
-require_once $GLOBALS['babInstallPath'] . 'utilit/json.php';
24
+require_once $GLOBALS['babInstallPath'].'utilit/controller.class.php';
25
+require_once $GLOBALS['babInstallPath'].'utilit/json.php';
26 26
 
27
-require_once dirname(__FILE__). '/functions.php';
27
+require_once dirname(__FILE__).'/functions.php';
28 28
 
29 29
 $App = app_App();
30 30
 $App->includeBase();
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 {
35 35
 	public function __construct($action, $code = 0)
36 36
 	{
37
-		$message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"';
37
+		$message = 'Unknown method "'.$action->getController().'::'.$action->getMethod().'"';
38 38
 		parent::__construct($message, $code);
39 39
 	}
40 40
 }
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
         // we try to select one according to the classname prefix.
184 184
         list($prefix) = explode('_', __CLASS__);
185 185
         $functionalityName = ucwords($prefix);
186
-        $App = @bab_functionality::get('App/' . $functionalityName);
186
+        $App = @bab_functionality::get('App/'.$functionalityName);
187 187
 
188 188
         if (!$App)
189 189
         {
190
-            throw new app_Exception('Faild to autodetect functionality App/' . $functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead');
190
+            throw new app_Exception('Faild to autodetect functionality App/'.$functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead');
191 191
         }
192 192
 
193 193
         $controller = $App->ControllerProxy($classname, $proxy);
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
     static function getProxyInstance(Func_App $App, $classname)
207 207
     {
208 208
         $class = new ReflectionClass($classname);
209
-        $proxyClassname = $class->name . self::PROXY_CLASS_SUFFIX;
209
+        $proxyClassname = $class->name.self::PROXY_CLASS_SUFFIX;
210 210
         if (!class_exists($proxyClassname)) {
211
-            $classStr = 'class ' . $proxyClassname . ' extends ' . $class->name . ' {' . "\n";
211
+            $classStr = 'class '.$proxyClassname.' extends '.$class->name.' {'."\n";
212 212
             $methods = $class->getMethods();
213 213
 
214 214
             $classStr .= '	public function __construct(Func_App $App) {
@@ -221,24 +221,24 @@  discard block
 block discarded – undo
221 221
                 }
222 222
 
223 223
 
224
-                $classStr .= '	public function ' . $method->name . '(';
224
+                $classStr .= '	public function '.$method->name.'(';
225 225
                 $parameters = $method->getParameters();
226 226
                 $parametersStr = array();
227 227
                 foreach ($parameters as $parameter) {
228 228
 
229 229
                     if ($parameter->isDefaultValueAvailable()) {
230
-                        $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true);
230
+                        $parametersStr[] = '$'.$parameter->name.' = '.var_export($parameter->getDefaultValue(), true);
231 231
                     } else {
232
-                        $parametersStr[] = '$' . $parameter->name;
232
+                        $parametersStr[] = '$'.$parameter->name;
233 233
                     }
234 234
                 }
235 235
                 $classStr .= implode(', ', $parametersStr);
236
-                $classStr .= ') {' . "\n";
237
-                $classStr .= '		$args = func_get_args();' . "\n";
238
-                $classStr .= '		return $this->getMethodAction(__FUNCTION__, $args);' . "\n";
239
-                $classStr .= '	}' . "\n";
236
+                $classStr .= ') {'."\n";
237
+                $classStr .= '		$args = func_get_args();'."\n";
238
+                $classStr .= '		return $this->getMethodAction(__FUNCTION__, $args);'."\n";
239
+                $classStr .= '	}'."\n";
240 240
             }
241
-            $classStr .= '}' . "\n";
241
+            $classStr .= '}'."\n";
242 242
 
243 243
             // We define the proxy class
244 244
             eval($classStr);
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         $action->setParameters($actionParams);
363 363
 
364 364
 
365
-        list(,,$file) = explode('/', $App->controllerTg);
365
+        list(,, $file) = explode('/', $App->controllerTg);
366 366
 
367 367
         $action->setParameter('addon', $App->getAddonName().'.'.$file);
368 368
         $action->setParameter('idx', $idx);
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
             return false;
387 387
         }
388 388
 
389
-        list($objectName, ) = explode('.', $method);
389
+        list($objectName,) = explode('.', $method);
390 390
 
391 391
         if (!method_exists($this, $objectName)) {
392 392
             header('HTTP/1.0 400 Bad Request');
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         }
395 395
 
396 396
         $objectController = $this->{$objectName}(false);
397
-        if ( ! ($objectController instanceof app_Controller)) {
397
+        if (!($objectController instanceof app_Controller)) {
398 398
             return false;
399 399
         }
400 400
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
             } else {
409 409
                 if ($this->isAjaxRequest()) {
410 410
 
411
-                    header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
411
+                    header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
412 412
 
413 413
                     die(
414 414
                         bab_json_encode(
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
         } catch (app_SaveException $e) {
430 430
 
431 431
             if ($this->isAjaxRequest()) {
432
-                header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
432
+                header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
433 433
                 header('Cache-Control: no-cache, must-revalidate');
434 434
                 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
435 435
                 header('Content-type: application/json');
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
                         if (method_exists($htmlCanvas, 'sendPageTitle')) {
485 485
                             $htmlCanvas->sendPageTitle($pageTitle);
486 486
                         } else {
487
-                            header('X-Cto-PageTitle: ' . $pageTitle);
487
+                            header('X-Cto-PageTitle: '.$pageTitle);
488 488
                         }
489 489
                     }
490 490
                     $html = $returnedValue->display($htmlCanvas);
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
     private function deletedItemPage(Widget_Action $action, app_DeletedRecordException $e)
544 544
     {
545 545
         if ($this->isAjaxRequest()) {
546
-            header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
546
+            header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
547 547
             header('Cache-Control: no-cache, must-revalidate');
548 548
             header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
549 549
             header('Content-type: application/json');
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                 );
561 561
 
562 562
         }
563
-        header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);
563
+        header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
564 564
 
565 565
         $App = $this->App();
566 566
         $W = bab_Widgets();
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     private function notFoundPage(Widget_Action $action, app_NotFoundException $e)
595 595
     {
596 596
         if ($this->isAjaxRequest()) {
597
-            $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle() . ' (' . $e->getId() . ')');
597
+            $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle().' ('.$e->getId().')');
598 598
             $json = array(
599 599
                 'messages' => array(
600 600
                     array(
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
             echo bab_json_encode($json);
607 607
             die;
608 608
         }
609
-        header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);
609
+        header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
610 610
         header('Cache-Control: no-cache, must-revalidate');
611 611
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
612 612
 
@@ -626,14 +626,14 @@  discard block
 block discarded – undo
626 626
 
627 627
     private function errorPage(Exception $e)
628 628
     {
629
-        header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500);
629
+        header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500);
630 630
 
631
-        require_once $GLOBALS['babInstallPath'] . 'utilit/uiutil.php';
631
+        require_once $GLOBALS['babInstallPath'].'utilit/uiutil.php';
632 632
         $popup = new babBodyPopup();
633 633
         $popup->babEcho(
634
-            '<h1>' . $this->App()->translate('There was a problem when trying to perform this operation') . '</h1>'
635
-            . '<h2 class="error">' . $this->App()->translate('Additional debugging information:') . '</h2>'
636
-            . '<p class="error">' . $e->getMessage() . ' ' .  $e->getFile() . ' ' . $e->getLine()  . ' ' . $e->getTraceAsString() . '</p>'
634
+            '<h1>'.$this->App()->translate('There was a problem when trying to perform this operation').'</h1>'
635
+            . '<h2 class="error">'.$this->App()->translate('Additional debugging information:').'</h2>'
636
+            . '<p class="error">'.$e->getMessage().' '.$e->getFile().' '.$e->getLine().' '.$e->getTraceAsString().'</p>'
637 637
             );
638 638
 
639 639
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
      */
679 679
     public function CustomField($proxy = true)
680 680
     {
681
-        require_once APP_CTRL_PATH . 'customfield.ctrl.php';
681
+        require_once APP_CTRL_PATH.'customfield.ctrl.php';
682 682
         return $this->App()->ControllerProxy('app_CtrlCustomField', $proxy);
683 683
     }
684 684
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
      */
690 690
     public function CustomSection($proxy = true)
691 691
     {
692
-        require_once APP_CTRL_PATH . 'customsection.ctrl.php';
692
+        require_once APP_CTRL_PATH.'customsection.ctrl.php';
693 693
         return $this->App()->ControllerProxy('app_CtrlCustomSection', $proxy);
694 694
     }
695 695
 }
Please login to merge, or discard this patch.