@@ -25,10 +25,6 @@ |
||
| 25 | 25 | |
| 26 | 26 | namespace Jaxon; |
| 27 | 27 | |
| 28 | -use Jaxon\Plugin\Manager as PluginManager; |
|
| 29 | -use Jaxon\Request\Manager as RequestManager; |
|
| 30 | -use Jaxon\Response\Manager as ResponseManager; |
|
| 31 | - |
|
| 32 | 28 | use Jaxon\Utils\URI; |
| 33 | 29 | use Exception; |
| 34 | 30 | use Closure; |
@@ -132,7 +132,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -652,14 +652,14 @@ discard block |
||
| 652 | 652 | $sResponse = '{"code": "error", "msg": "Haha !! Pas vraiment une erreur : ' . $sKey . '"}'; |
| 653 | 653 | $return = true; |
| 654 | 654 | } |
| 655 | - catch(Exception $e) |
|
| 655 | + catch (Exception $e) |
|
| 656 | 656 | { |
| 657 | 657 | $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}'; |
| 658 | 658 | $return = false; |
| 659 | 659 | } |
| 660 | 660 | // Send the response back to the browser |
| 661 | 661 | echo '<script>var res = ', $sResponse, '; </script>'; |
| 662 | - if(($this->getOption('core.process.exit'))) |
|
| 662 | + if (($this->getOption('core.process.exit'))) |
|
| 663 | 663 | { |
| 664 | 664 | exit(); |
| 665 | 665 | } |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | */ |
| 674 | 674 | public function getUploadedFiles() |
| 675 | 675 | { |
| 676 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 676 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 677 | 677 | { |
| 678 | 678 | return []; |
| 679 | 679 | } |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | */ |
| 690 | 690 | public function setUploadFileFilter(Closure $fFileFilter) |
| 691 | 691 | { |
| 692 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 692 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 693 | 693 | { |
| 694 | 694 | return; |
| 695 | 695 | } |
@@ -215,8 +215,9 @@ discard block |
||
| 215 | 215 | { |
| 216 | 216 | $sEvent = $xArgs; |
| 217 | 217 | $xUserFunction = $aArgs[2]; |
| 218 | - if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
| 219 | - $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
|
| 218 | + if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) { |
|
| 219 | + $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
|
| 220 | + } |
|
| 220 | 221 | $this->aProcessingEvents[$sEvent] = $xUserFunction; |
| 221 | 222 | } |
| 222 | 223 | /*else |
@@ -329,8 +330,7 @@ discard block |
||
| 329 | 330 | try |
| 330 | 331 | { |
| 331 | 332 | $mResult = $this->getPluginManager()->processRequest(); |
| 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, |
@@ -347,8 +347,7 @@ discard block |
||
| 347 | 347 | { |
| 348 | 348 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 349 | 349 | $aParams = array($e->getMessage()); |
| 350 | - } |
|
| 351 | - else |
|
| 350 | + } else |
|
| 352 | 351 | { |
| 353 | 352 | $sEvent = self::PROCESSING_EVENT_ERROR; |
| 354 | 353 | $aParams = array($e); |
@@ -358,8 +357,7 @@ discard block |
||
| 358 | 357 | { |
| 359 | 358 | // Call the processing event |
| 360 | 359 | $this->aProcessingEvents[$sEvent]->call($aParams); |
| 361 | - } |
|
| 362 | - else |
|
| 360 | + } else |
|
| 363 | 361 | { |
| 364 | 362 | // The exception is not to be processed here. |
| 365 | 363 | throw $e; |
@@ -641,8 +639,7 @@ discard block |
||
| 641 | 639 | if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
| 642 | 640 | { |
| 643 | 641 | throw new Exception($this->trans('errors.upload.plugin')); |
| 644 | - } |
|
| 645 | - elseif(!$xUploadPlugin->canProcessRequest()) |
|
| 642 | + } elseif(!$xUploadPlugin->canProcessRequest()) |
|
| 646 | 643 | { |
| 647 | 644 | throw new Exception($this->trans('errors.upload.request')); |
| 648 | 645 | } |
@@ -651,8 +648,7 @@ discard block |
||
| 651 | 648 | $sResponse = '{"code": "success", "upl": "' . $sKey . '"}'; |
| 652 | 649 | $sResponse = '{"code": "error", "msg": "Haha !! Pas vraiment une erreur : ' . $sKey . '"}'; |
| 653 | 650 | $return = true; |
| 654 | - } |
|
| 655 | - catch(Exception $e) |
|
| 651 | + } catch(Exception $e) |
|
| 656 | 652 | { |
| 657 | 653 | $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}'; |
| 658 | 654 | $return = false; |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | use Jaxon\Jaxon; |
| 16 | 16 | use Jaxon\Plugin\Request as RequestPlugin; |
| 17 | 17 | use Jaxon\Request\Support\UploadedFile; |
| 18 | - |
|
| 19 | 18 | use Closure; |
| 20 | 19 | |
| 21 | 20 | class FileUpload extends RequestPlugin |