Completed
Push — master ( fced39...909472 )
by Thierry
01:44
created
src/Jaxon.php 2 patches
Braces   +8 added lines, -12 removed lines patch added patch discarded remove patch
@@ -214,8 +214,9 @@  discard block
 block discarded – undo
214 214
             {
215 215
                 $sEvent = $xArgs;
216 216
                 $xUserFunction = $aArgs[2];
217
-                if(!is_a($xUserFunction, 'Request\\Support\\UserFunction'))
218
-                    $xUserFunction = new Request\Support\UserFunction($xUserFunction);
217
+                if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) {
218
+                                    $xUserFunction = new Request\Support\UserFunction($xUserFunction);
219
+                }
219 220
                 $this->aProcessingEvents[$sEvent] = $xUserFunction;
220 221
             }
221 222
             /*else
@@ -328,8 +329,7 @@  discard block
 block discarded – undo
328 329
             try
329 330
             {
330 331
                 $mResult = $this->getPluginManager()->processRequest();
331
-            }
332
-            catch(Exception $e)
332
+            } catch(Exception $e)
333 333
             {
334 334
                 // An exception was thrown while processing the request.
335 335
                 // The request missed the corresponding handler function,
@@ -346,8 +346,7 @@  discard block
 block discarded – undo
346 346
                 {
347 347
                     $sEvent = self::PROCESSING_EVENT_INVALID;
348 348
                     $aParams = array($e->getMessage());
349
-                }
350
-                else
349
+                } else
351 350
                 {
352 351
                     $sEvent = self::PROCESSING_EVENT_ERROR;
353 352
                     $aParams = array($e);
@@ -357,8 +356,7 @@  discard block
 block discarded – undo
357 356
                 {
358 357
                     // Call the processing event
359 358
                     $this->aProcessingEvents[$sEvent]->call($aParams);
360
-                }
361
-                else
359
+                } else
362 360
                 {
363 361
                     // The exception is not to be processed here.
364 362
                     throw $e;
@@ -640,8 +638,7 @@  discard block
 block discarded – undo
640 638
             if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
641 639
             {
642 640
                 throw new Exception($this->trans('errors.upload.plugin'));
643
-            }
644
-            elseif(!$xUploadPlugin->canProcessRequest())
641
+            } elseif(!$xUploadPlugin->canProcessRequest())
645 642
             {
646 643
                 throw new Exception($this->trans('errors.upload.request'));
647 644
             }
@@ -649,8 +646,7 @@  discard block
 block discarded – undo
649 646
             $sKey = $xUploadPlugin->saveUploadedFiles();
650 647
             $sResponse = '{"code": "success", "upl": "' . $sKey . '"}';
651 648
             $return = true;
652
-        }
653
-        catch(Exception $e)
649
+        } catch(Exception $e)
654 650
         {
655 651
             $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}';
656 652
             $return = false;
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             'core.prefix.event'                 => 'jaxon_event_',
133 133
             // 'core.request.uri'               => '',
134 134
             'core.request.mode'                 => 'asynchronous',
135
-            'core.request.method'               => 'POST',    // W3C: Method is case sensitive
135
+            'core.request.method'               => 'POST', // W3C: Method is case sensitive
136 136
             'core.debug.on'                     => false,
137 137
             'core.debug.verbose'                => false,
138 138
             'core.process.exit'                 => true,
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
         $aArgs = func_get_args();
210 210
         $nArgs = func_num_args();
211 211
 
212
-        if(self::PROCESSING_EVENT == $sType)
212
+        if (self::PROCESSING_EVENT == $sType)
213 213
         {
214
-            if($nArgs > 2)
214
+            if ($nArgs > 2)
215 215
             {
216 216
                 $sEvent = $xArgs;
217 217
                 $xUserFunction = $aArgs[2];
218
-                if(!is_a($xUserFunction, 'Request\\Support\\UserFunction'))
218
+                if (!is_a($xUserFunction, 'Request\\Support\\UserFunction'))
219 219
                     $xUserFunction = new Request\Support\UserFunction($xUserFunction);
220 220
                 $this->aProcessingEvents[$sEvent] = $xUserFunction;
221 221
             }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     public function processRequest()
302 302
     {
303 303
         // Check to see if headers have already been sent out, in which case we can't do our job
304
-        if(headers_sent($filename, $linenumber))
304
+        if (headers_sent($filename, $linenumber))
305 305
         {
306 306
             echo $this->trans('errors.output.already-sent', array(
307 307
                 'location' => $filename . ':' . $linenumber
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
         }
311 311
 
312 312
         // Check if there is a plugin to process this request
313
-        if(!$this->canProcessRequest())
313
+        if (!$this->canProcessRequest())
314 314
         {
315 315
             return;
316 316
         }
@@ -319,18 +319,18 @@  discard block
 block discarded – undo
319 319
         $mResult = true;
320 320
 
321 321
         // Handle before processing event
322
-        if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
322
+        if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
323 323
         {
324 324
             $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest));
325 325
         }
326 326
 
327
-        if(!$bEndRequest)
327
+        if (!$bEndRequest)
328 328
         {
329 329
             try
330 330
             {
331 331
                 $mResult = $this->getPluginManager()->processRequest();
332 332
             }
333
-            catch(Exception $e)
333
+            catch (Exception $e)
334 334
             {
335 335
                 // An exception was thrown while processing the request.
336 336
                 // The request missed the corresponding handler function,
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
                 $xResponseManager->debug($e->getMessage());
344 344
                 $mResult = false;
345 345
 
346
-                if($e instanceof \Jaxon\Exception\Error)
346
+                if ($e instanceof \Jaxon\Exception\Error)
347 347
                 {
348 348
                     $sEvent = self::PROCESSING_EVENT_INVALID;
349 349
                     $aParams = array($e->getMessage());
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
                     $aParams = array($e);
355 355
                 }
356 356
 
357
-                if(isset($this->aProcessingEvents[$sEvent]))
357
+                if (isset($this->aProcessingEvents[$sEvent]))
358 358
                 {
359 359
                     // Call the processing event
360 360
                     $this->aProcessingEvents[$sEvent]->call($aParams);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             }
368 368
         }
369 369
         // Clean the processing buffer
370
-        if(($this->getOption('core.process.clean')))
370
+        if (($this->getOption('core.process.clean')))
371 371
         {
372 372
             $er = error_reporting(0);
373 373
             while (ob_get_level() > 0)
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
             error_reporting($er);
378 378
         }
379 379
 
380
-        if($mResult === true)
380
+        if ($mResult === true)
381 381
         {
382 382
             // Handle after processing event
383
-            if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
383
+            if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
384 384
             {
385 385
                 $bEndRequest = false;
386 386
                 $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest));
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
         $this->getResponseManager()->printDebug();
391 391
 
392
-        if(($this->getOption('core.process.exit')))
392
+        if (($this->getOption('core.process.exit')))
393 393
         {
394 394
             $this->getResponseManager()->sendOutput();
395 395
             exit();
@@ -439,16 +439,16 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function getScript($bIncludeJs = false, $bIncludeCss = false)
441 441
     {
442
-        if(!$this->getOption('core.request.uri'))
442
+        if (!$this->getOption('core.request.uri'))
443 443
         {
444 444
             $this->setOption('core.request.uri', URI::detect());
445 445
         }
446 446
         $sCode = '';
447
-        if(($bIncludeCss))
447
+        if (($bIncludeCss))
448 448
         {
449 449
             $sCode .= $this->getPluginManager()->getCss() . "\n";
450 450
         }
451
-        if(($bIncludeJs))
451
+        if (($bIncludeJs))
452 452
         {
453 453
             $sCode .= $this->getPluginManager()->getJs() . "\n";
454 454
         }
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
     public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
547 547
     {
548 548
         $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION);
549
-        switch($sExt)
549
+        switch ($sExt)
550 550
         {
551 551
         case 'php':
552 552
             return $this->readPhpConfigFile($sConfigFile, $sLibKey, $sAppKey);
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
      */
623 623
     public function hasUploadedFiles()
624 624
     {
625
-        if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
625
+        if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
626 626
         {
627 627
             return false;
628 628
         }
@@ -638,11 +638,11 @@  discard block
 block discarded – undo
638 638
     {
639 639
         try
640 640
         {
641
-            if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
641
+            if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
642 642
             {
643 643
                 throw new Exception($this->trans('errors.upload.plugin'));
644 644
             }
645
-            elseif(!$xUploadPlugin->canProcessRequest())
645
+            elseif (!$xUploadPlugin->canProcessRequest())
646 646
             {
647 647
                 throw new Exception($this->trans('errors.upload.request'));
648 648
             }
@@ -651,14 +651,14 @@  discard block
 block discarded – undo
651 651
             $sResponse = '{"code": "success", "upl": "' . $sKey . '"}';
652 652
             $return = true;
653 653
         }
654
-        catch(Exception $e)
654
+        catch (Exception $e)
655 655
         {
656 656
             $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}';
657 657
             $return = false;
658 658
         }
659 659
         // Send the response back to the browser
660 660
         echo '<script>var res = ', $sResponse, '; </script>';
661
-        if(($this->getOption('core.process.exit')))
661
+        if (($this->getOption('core.process.exit')))
662 662
         {
663 663
             exit();
664 664
         }
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
      */
673 673
     public function getUploadedFiles()
674 674
     {
675
-        if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
675
+        if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
676 676
         {
677 677
             return [];
678 678
         }
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
      */
689 689
     public function setUploadFileFilter(Closure $fFileFilter)
690 690
     {
691
-        if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
691
+        if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
692 692
         {
693 693
             return;
694 694
         }
Please login to merge, or discard this patch.