@@ -262,32 +262,32 @@ discard block |
||
| 262 | 262 | { |
| 263 | 263 | $bIsAlert = ($xPlugin instanceof \Jaxon\Request\Interfaces\Alert); |
| 264 | 264 | $bIsConfirm = ($xPlugin instanceof \Jaxon\Request\Interfaces\Confirm); |
| 265 | - if($xPlugin instanceof Request) |
|
| 265 | + if ($xPlugin instanceof Request) |
|
| 266 | 266 | { |
| 267 | 267 | // The name of a request plugin is used as key in the plugin table |
| 268 | 268 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 269 | 269 | } |
| 270 | - elseif($xPlugin instanceof Response) |
|
| 270 | + elseif ($xPlugin instanceof Response) |
|
| 271 | 271 | { |
| 272 | 272 | // The name of a response plugin is used as key in the plugin table |
| 273 | 273 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 274 | 274 | } |
| 275 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
| 275 | + elseif (!$bIsConfirm && !$bIsAlert) |
|
| 276 | 276 | { |
| 277 | 277 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin)))); |
| 278 | 278 | } |
| 279 | 279 | // This plugin implements the Alert interface |
| 280 | - if($bIsAlert) |
|
| 280 | + if ($bIsAlert) |
|
| 281 | 281 | { |
| 282 | 282 | $this->setAlert($xPlugin); |
| 283 | 283 | } |
| 284 | 284 | // This plugin implements the Confirm interface |
| 285 | - if($bIsConfirm) |
|
| 285 | + if ($bIsConfirm) |
|
| 286 | 286 | { |
| 287 | 287 | $this->setConfirm($xPlugin); |
| 288 | 288 | } |
| 289 | 289 | // Register the plugin as an event listener |
| 290 | - if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 290 | + if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 291 | 291 | { |
| 292 | 292 | $this->addEventListener($xPlugin); |
| 293 | 293 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | private function generateHash() |
| 304 | 304 | { |
| 305 | 305 | $sHash = $this->getVersion(); |
| 306 | - foreach($this->aPlugins as $xPlugin) |
|
| 306 | + foreach ($this->aPlugins as $xPlugin) |
|
| 307 | 307 | { |
| 308 | 308 | $sHash .= $xPlugin->generateHash(); |
| 309 | 309 | } |
@@ -320,9 +320,9 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | public function canProcessRequest() |
| 322 | 322 | { |
| 323 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 323 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 324 | 324 | { |
| 325 | - if($xPlugin->canProcessRequest()) |
|
| 325 | + if ($xPlugin->canProcessRequest()) |
|
| 326 | 326 | { |
| 327 | 327 | return true; |
| 328 | 328 | } |
@@ -340,9 +340,9 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | public function processRequest() |
| 342 | 342 | { |
| 343 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 343 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 344 | 344 | { |
| 345 | - if($xPlugin->canProcessRequest()) |
|
| 345 | + if ($xPlugin->canProcessRequest()) |
|
| 346 | 346 | { |
| 347 | 347 | return $xPlugin->processRequest(); |
| 348 | 348 | } |
@@ -363,10 +363,10 @@ discard block |
||
| 363 | 363 | */ |
| 364 | 364 | public function register($aArgs) |
| 365 | 365 | { |
| 366 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 366 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 367 | 367 | { |
| 368 | 368 | $mResult = $xPlugin->register($aArgs); |
| 369 | - if($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true) |
|
| 369 | + if ($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true) |
|
| 370 | 370 | { |
| 371 | 371 | return $mResult; |
| 372 | 372 | } |
@@ -386,37 +386,37 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | public function addClassDir($sDirectory, $sNamespace = '', $sSeparator = '.', array $aProtected = array()) |
| 388 | 388 | { |
| 389 | - if(!is_dir(($sDirectory = trim($sDirectory)))) |
|
| 389 | + if (!is_dir(($sDirectory = trim($sDirectory)))) |
|
| 390 | 390 | { |
| 391 | 391 | return false; |
| 392 | 392 | } |
| 393 | 393 | // Only '.' and '_' are allowed to be used as separator. Any other value is ignored and '.' is used instead. |
| 394 | - if(($sSeparator = trim($sSeparator)) != '_') |
|
| 394 | + if (($sSeparator = trim($sSeparator)) != '_') |
|
| 395 | 395 | { |
| 396 | 396 | $sSeparator = '.'; |
| 397 | 397 | } |
| 398 | - if(!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 398 | + if (!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 399 | 399 | { |
| 400 | 400 | $sNamespace = ''; |
| 401 | 401 | } |
| 402 | - if(($sNamespace)) |
|
| 402 | + if (($sNamespace)) |
|
| 403 | 403 | { |
| 404 | 404 | // If there is an autoloader, register the dir with PSR4 autoloading |
| 405 | - if(($this->xAutoloader)) |
|
| 405 | + if (($this->xAutoloader)) |
|
| 406 | 406 | { |
| 407 | 407 | $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory); |
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | - elseif(($this->xAutoloader)) |
|
| 410 | + elseif (($this->xAutoloader)) |
|
| 411 | 411 | { |
| 412 | 412 | // If there is an autoloader, register the dir with classmap autoloading |
| 413 | 413 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
| 414 | 414 | $itFile = new RecursiveIteratorIterator($itDir); |
| 415 | 415 | // Iterate on dir content |
| 416 | - foreach($itFile as $xFile) |
|
| 416 | + foreach ($itFile as $xFile) |
|
| 417 | 417 | { |
| 418 | 418 | // skip everything except PHP files |
| 419 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 419 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 420 | 420 | { |
| 421 | 421 | continue; |
| 422 | 422 | } |
@@ -451,33 +451,33 @@ discard block |
||
| 451 | 451 | // Get the corresponding class path and name |
| 452 | 452 | $sClassPath = trim(substr($xFile->getPath(), strlen($sDirectory)), $sDS); |
| 453 | 453 | $sClassName = $xFile->getBasename('.php'); |
| 454 | - if(($sNamespace)) |
|
| 454 | + if (($sNamespace)) |
|
| 455 | 455 | { |
| 456 | 456 | $sClassPath = $sNamespace . '\\' . $sClassPath; |
| 457 | 457 | $sClassName = '\\' . $sClassPath . '\\' . $sClassName; |
| 458 | 458 | } |
| 459 | 459 | // Require the file only if autoload is enabled but there is no autoloader |
| 460 | - if(($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
| 460 | + if (($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
| 461 | 461 | { |
| 462 | 462 | require_once($xFile->getPathname()); |
| 463 | 463 | } |
| 464 | 464 | // Create and register an instance of the class |
| 465 | - if(!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
| 465 | + if (!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
| 466 | 466 | { |
| 467 | 467 | $aOptions['*'] = array(); |
| 468 | 468 | } |
| 469 | 469 | $aOptions['*']['separator'] = $sSeparator; |
| 470 | - if(($sNamespace)) |
|
| 470 | + if (($sNamespace)) |
|
| 471 | 471 | { |
| 472 | 472 | $aOptions['*']['namespace'] = $sNamespace; |
| 473 | 473 | } |
| 474 | - if(($sClassPath)) |
|
| 474 | + if (($sClassPath)) |
|
| 475 | 475 | { |
| 476 | 476 | $aOptions['*']['classpath'] = $sClassPath; |
| 477 | 477 | } |
| 478 | 478 | // Filter excluded methods |
| 479 | - $aProtected = array_filter($aProtected, function ($sName) {return is_string($sName);}); |
|
| 480 | - if(count($aProtected) > 0) |
|
| 479 | + $aProtected = array_filter($aProtected, function($sName) {return is_string($sName); }); |
|
| 480 | + if (count($aProtected) > 0) |
|
| 481 | 481 | { |
| 482 | 482 | $aOptions['*']['protected'] = $aProtected; |
| 483 | 483 | } |
@@ -496,13 +496,13 @@ discard block |
||
| 496 | 496 | $sDS = DIRECTORY_SEPARATOR; |
| 497 | 497 | // Change the keys in $aOptions to have "\" as separator |
| 498 | 498 | $aNewOptions = array(); |
| 499 | - foreach($aOptions as $key => $aOption) |
|
| 499 | + foreach ($aOptions as $key => $aOption) |
|
| 500 | 500 | { |
| 501 | 501 | $key = trim(str_replace(['.', '_'], ['\\', '\\'], $key), ' \\'); |
| 502 | 502 | $aNewOptions[$key] = $aOption; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - foreach($this->aClassDirs as $aClassDir) |
|
| 505 | + foreach ($this->aClassDirs as $aClassDir) |
|
| 506 | 506 | { |
| 507 | 507 | // Get the directory |
| 508 | 508 | $sDirectory = $aClassDir['directory']; |
@@ -512,10 +512,10 @@ discard block |
||
| 512 | 512 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
| 513 | 513 | $itFile = new RecursiveIteratorIterator($itDir); |
| 514 | 514 | // Iterate on dir content |
| 515 | - foreach($itFile as $xFile) |
|
| 515 | + foreach ($itFile as $xFile) |
|
| 516 | 516 | { |
| 517 | 517 | // skip everything except PHP files |
| 518 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 518 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 519 | 519 | { |
| 520 | 520 | continue; |
| 521 | 521 | } |
@@ -524,13 +524,13 @@ discard block |
||
| 524 | 524 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
| 525 | 525 | $sClassPath = trim(str_replace($sDS, '\\', $sClassPath), '\\'); |
| 526 | 526 | $sClassName = $sClassPath . '\\' . $xFile->getBasename('.php'); |
| 527 | - if(($sNamespace)) |
|
| 527 | + if (($sNamespace)) |
|
| 528 | 528 | { |
| 529 | 529 | $sClassName = $sNamespace . '\\' . $sClassName; |
| 530 | 530 | } |
| 531 | 531 | // Get the class options |
| 532 | 532 | $aClassOptions = []; |
| 533 | - if(array_key_exists($sClassName, $aNewOptions)) |
|
| 533 | + if (array_key_exists($sClassName, $aNewOptions)) |
|
| 534 | 534 | { |
| 535 | 535 | $aClassOptions = $aNewOptions[$sClassName]; |
| 536 | 536 | } |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | */ |
| 552 | 552 | public function registerClass($sClassName, array $aOptions = array()) |
| 553 | 553 | { |
| 554 | - if(!($sClassName = trim($sClassName, ' \\._'))) |
|
| 554 | + if (!($sClassName = trim($sClassName, ' \\._'))) |
|
| 555 | 555 | { |
| 556 | 556 | return false; |
| 557 | 557 | } |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | // Replace "." and "_" with antislashes, and set the class path. |
| 561 | 561 | $sClassName = str_replace(['.', '_'], ['\\', '\\'], $sClassName); |
| 562 | 562 | $sClassPath = ''; |
| 563 | - if(($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
| 563 | + if (($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
| 564 | 564 | { |
| 565 | 565 | $sClassPath = substr($sClassName, 0, $nLastSlashPosition); |
| 566 | 566 | $sClassName = substr($sClassName, $nLastSlashPosition + 1); |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | $sPartPath = str_replace('\\', $sDS, $sClassPath) . $sDS . $sClassName . '.php'; |
| 570 | 570 | |
| 571 | 571 | // Search for the class file in all directories. |
| 572 | - foreach($this->aClassDirs as $aClassDir) |
|
| 572 | + foreach ($this->aClassDirs as $aClassDir) |
|
| 573 | 573 | { |
| 574 | 574 | // Get the separator |
| 575 | 575 | $sSeparator = $aClassDir['separator']; |
@@ -578,15 +578,15 @@ discard block |
||
| 578 | 578 | $nLen = strlen($sNamespace); |
| 579 | 579 | $sFullPath = ''; |
| 580 | 580 | // Check if the class belongs to the namespace |
| 581 | - if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
| 581 | + if (($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
| 582 | 582 | { |
| 583 | 583 | $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1); |
| 584 | 584 | } |
| 585 | - elseif(!($sNamespace)) |
|
| 585 | + elseif (!($sNamespace)) |
|
| 586 | 586 | { |
| 587 | 587 | $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath; |
| 588 | 588 | } |
| 589 | - if(($sFullPath) && is_file($sFullPath)) |
|
| 589 | + if (($sFullPath) && is_file($sFullPath)) |
|
| 590 | 590 | { |
| 591 | 591 | // Found the file in this directory |
| 592 | 592 | $xFileInfo = new \SplFileInfo($sFullPath); |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | { |
| 611 | 611 | $xObject = null; // The user registered object |
| 612 | 612 | $xPlugin = $this->getRequestPlugin('CallableObject'); // The CallableObject plugin |
| 613 | - if(($xPlugin)) |
|
| 613 | + if (($xPlugin)) |
|
| 614 | 614 | { |
| 615 | 615 | $xObject = $xPlugin->getRegisteredObject($sClassName); |
| 616 | 616 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | */ |
| 625 | 625 | private function getJsLibUri() |
| 626 | 626 | { |
| 627 | - if(!$this->hasOption('js.lib.uri')) |
|
| 627 | + if (!$this->hasOption('js.lib.uri')) |
|
| 628 | 628 | { |
| 629 | 629 | return 'https://cdn.jsdelivr.net/jaxon/1.2.0/'; |
| 630 | 630 | } |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | $jsDelivrUri = 'https://cdn.jsdelivr.net'; |
| 645 | 645 | $nLen = strlen($jsDelivrUri); |
| 646 | 646 | // The jsDelivr CDN only hosts minified files |
| 647 | - if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri) |
|
| 647 | + if (($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri) |
|
| 648 | 648 | { |
| 649 | 649 | return '.min.js'; |
| 650 | 650 | } |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | // Check config options |
| 662 | 662 | // - The js.app.extern option must be set to true |
| 663 | 663 | // - The js.app.uri and js.app.dir options must be set to non null values |
| 664 | - if(!$this->getOption('js.app.extern') || |
|
| 664 | + if (!$this->getOption('js.app.extern') || |
|
| 665 | 665 | !$this->getOption('js.app.uri') || |
| 666 | 666 | !$this->getOption('js.app.dir')) |
| 667 | 667 | { |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | // Check dir access |
| 671 | 671 | // - The js.app.dir must be writable |
| 672 | 672 | $sJsAppDir = $this->getOption('js.app.dir'); |
| 673 | - if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 673 | + if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 674 | 674 | { |
| 675 | 675 | return false; |
| 676 | 676 | } |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | */ |
| 685 | 685 | private function setTemplateCacheDir() |
| 686 | 686 | { |
| 687 | - if($this->hasOption('core.template.cache_dir')) |
|
| 687 | + if ($this->hasOption('core.template.cache_dir')) |
|
| 688 | 688 | { |
| 689 | 689 | $this->setCacheDir($this->getOption('core.template.cache_dir')); |
| 690 | 690 | } |
@@ -706,11 +706,11 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | // Add component files to the javascript file array; |
| 708 | 708 | $aJsFiles = array($sJsCoreUrl); |
| 709 | - if($this->getOption('core.debug.on')) |
|
| 709 | + if ($this->getOption('core.debug.on')) |
|
| 710 | 710 | { |
| 711 | 711 | $aJsFiles[] = $sJsDebugUrl; |
| 712 | 712 | $aJsFiles[] = $sJsLanguageUrl; |
| 713 | - if($this->getOption('core.debug.verbose')) |
|
| 713 | + if ($this->getOption('core.debug.verbose')) |
|
| 714 | 714 | { |
| 715 | 715 | $aJsFiles[] = $sJsVerboseUrl; |
| 716 | 716 | } |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | 'sJsOptions' => $this->getOption('js.app.options'), |
| 723 | 723 | 'aUrls' => $aJsFiles, |
| 724 | 724 | )); |
| 725 | - foreach($this->aResponsePlugins as $xPlugin) |
|
| 725 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
| 726 | 726 | { |
| 727 | 727 | $sCode .= rtrim($xPlugin->getJs(), " \n") . "\n"; |
| 728 | 728 | } |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | $this->setTemplateCacheDir(); |
| 741 | 741 | |
| 742 | 742 | $sCode = ''; |
| 743 | - foreach($this->aResponsePlugins as $xPlugin) |
|
| 743 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
| 744 | 744 | { |
| 745 | 745 | $sCode .= rtrim($xPlugin->getCss(), " \n") . "\n"; |
| 746 | 746 | } |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | )); |
| 829 | 829 | |
| 830 | 830 | $sPluginScript = ''; |
| 831 | - foreach($this->aResponsePlugins as $xPlugin) |
|
| 831 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
| 832 | 832 | { |
| 833 | 833 | $sPluginScript .= "\n" . trim($xPlugin->getScript(), " \n"); |
| 834 | 834 | } |
@@ -860,11 +860,11 @@ discard block |
||
| 860 | 860 | |
| 861 | 861 | // Get the config and plugins scripts |
| 862 | 862 | $sScript = $this->getConfigScript() . "\n" . $this->getReadyScript() . "\n"; |
| 863 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 863 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 864 | 864 | { |
| 865 | 865 | $sScript .= "\n" . trim($xPlugin->getScript(), " \n"); |
| 866 | 866 | } |
| 867 | - if($this->canExportJavascript()) |
|
| 867 | + if ($this->canExportJavascript()) |
|
| 868 | 868 | { |
| 869 | 869 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
| 870 | 870 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -873,13 +873,13 @@ discard block |
||
| 873 | 873 | $sHash = $this->generateHash(); |
| 874 | 874 | $sOutFile = $sHash . '.js'; |
| 875 | 875 | $sMinFile = $sHash . '.min.js'; |
| 876 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
| 876 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
| 877 | 877 | { |
| 878 | 878 | file_put_contents($sJsAppDir . $sOutFile, $sScript); |
| 879 | 879 | } |
| 880 | - if(($this->getOption('js.app.minify'))) |
|
| 880 | + if (($this->getOption('js.app.minify'))) |
|
| 881 | 881 | { |
| 882 | - if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 882 | + if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 883 | 883 | { |
| 884 | 884 | $sOutFile = $sMinFile; |
| 885 | 885 | } |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | */ |
| 913 | 913 | public function getResponsePlugin($sName) |
| 914 | 914 | { |
| 915 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
| 915 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
| 916 | 916 | { |
| 917 | 917 | return $this->aResponsePlugins[$sName]; |
| 918 | 918 | } |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | */ |
| 929 | 929 | public function getRequestPlugin($sName) |
| 930 | 930 | { |
| 931 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
| 931 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
| 932 | 932 | { |
| 933 | 933 | return $this->aRequestPlugins[$sName]; |
| 934 | 934 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | 'core.prefix.event' => 'jaxon_event_', |
| 130 | 130 | // 'core.request.uri' => '', |
| 131 | 131 | 'core.request.mode' => 'asynchronous', |
| 132 | - 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
| 132 | + 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
| 133 | 133 | 'core.debug.on' => false, |
| 134 | 134 | 'core.debug.verbose' => false, |
| 135 | 135 | 'core.process.exit' => true, |
@@ -206,13 +206,13 @@ discard block |
||
| 206 | 206 | $aArgs = func_get_args(); |
| 207 | 207 | $nArgs = func_num_args(); |
| 208 | 208 | |
| 209 | - if(self::PROCESSING_EVENT == $sType) |
|
| 209 | + if (self::PROCESSING_EVENT == $sType) |
|
| 210 | 210 | { |
| 211 | - if($nArgs > 2) |
|
| 211 | + if ($nArgs > 2) |
|
| 212 | 212 | { |
| 213 | 213 | $sEvent = $xArgs; |
| 214 | 214 | $xUserFunction = $aArgs[2]; |
| 215 | - if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
| 215 | + if (!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
| 216 | 216 | $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
| 217 | 217 | $this->aProcessingEvents[$sEvent] = $xUserFunction; |
| 218 | 218 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | public function processRequest() |
| 299 | 299 | { |
| 300 | 300 | // Check to see if headers have already been sent out, in which case we can't do our job |
| 301 | - if(headers_sent($filename, $linenumber)) |
|
| 301 | + if (headers_sent($filename, $linenumber)) |
|
| 302 | 302 | { |
| 303 | 303 | echo $this->trans('errors.output.already-sent', array( |
| 304 | 304 | 'location' => $filename . ':' . $linenumber |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | // Check if there is a plugin to process this request |
| 310 | - if(!$this->canProcessRequest()) |
|
| 310 | + if (!$this->canProcessRequest()) |
|
| 311 | 311 | { |
| 312 | 312 | return; |
| 313 | 313 | } |
@@ -316,18 +316,18 @@ discard block |
||
| 316 | 316 | $mResult = true; |
| 317 | 317 | |
| 318 | 318 | // Handle before processing event |
| 319 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 319 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 320 | 320 | { |
| 321 | 321 | $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest)); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if(!$bEndRequest) |
|
| 324 | + if (!$bEndRequest) |
|
| 325 | 325 | { |
| 326 | 326 | try |
| 327 | 327 | { |
| 328 | 328 | $mResult = $this->getPluginManager()->processRequest(); |
| 329 | 329 | } |
| 330 | - catch(Exception $e) |
|
| 330 | + catch (Exception $e) |
|
| 331 | 331 | { |
| 332 | 332 | // An exception was thrown while processing the request. |
| 333 | 333 | // The request missed the corresponding handler function, |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | $xResponseManager->debug($e->getMessage()); |
| 341 | 341 | $mResult = false; |
| 342 | 342 | |
| 343 | - if($e instanceof \Jaxon\Exception\Error) |
|
| 343 | + if ($e instanceof \Jaxon\Exception\Error) |
|
| 344 | 344 | { |
| 345 | 345 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 346 | 346 | $aParams = array($e->getMessage()); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $aParams = array($e); |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - if(isset($this->aProcessingEvents[$sEvent])) |
|
| 354 | + if (isset($this->aProcessingEvents[$sEvent])) |
|
| 355 | 355 | { |
| 356 | 356 | // Call the processing event |
| 357 | 357 | $this->aProcessingEvents[$sEvent]->call($aParams); |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | // Clean the processing buffer |
| 367 | - if(($this->getOption('core.process.clean'))) |
|
| 367 | + if (($this->getOption('core.process.clean'))) |
|
| 368 | 368 | { |
| 369 | 369 | $er = error_reporting(0); |
| 370 | 370 | while (ob_get_level() > 0) |
@@ -374,10 +374,10 @@ discard block |
||
| 374 | 374 | error_reporting($er); |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - if($mResult === true) |
|
| 377 | + if ($mResult === true) |
|
| 378 | 378 | { |
| 379 | 379 | // Handle after processing event |
| 380 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 380 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 381 | 381 | { |
| 382 | 382 | $bEndRequest = false; |
| 383 | 383 | $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest)); |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | $this->getResponseManager()->printDebug(); |
| 388 | 388 | |
| 389 | - if(($this->getOption('core.process.exit'))) |
|
| 389 | + if (($this->getOption('core.process.exit'))) |
|
| 390 | 390 | { |
| 391 | 391 | $this->getResponseManager()->sendOutput(); |
| 392 | 392 | exit(); |
@@ -436,16 +436,16 @@ discard block |
||
| 436 | 436 | */ |
| 437 | 437 | public function getScript($bIncludeJs = false, $bIncludeCss = false) |
| 438 | 438 | { |
| 439 | - if(!$this->getOption('core.request.uri')) |
|
| 439 | + if (!$this->getOption('core.request.uri')) |
|
| 440 | 440 | { |
| 441 | 441 | $this->setOption('core.request.uri', URI::detect()); |
| 442 | 442 | } |
| 443 | 443 | $sCode = ''; |
| 444 | - if(($bIncludeCss)) |
|
| 444 | + if (($bIncludeCss)) |
|
| 445 | 445 | { |
| 446 | 446 | $sCode .= $this->getPluginManager()->getCss() . "\n"; |
| 447 | 447 | } |
| 448 | - if(($bIncludeJs)) |
|
| 448 | + if (($bIncludeJs)) |
|
| 449 | 449 | { |
| 450 | 450 | $sCode .= $this->getPluginManager()->getJs() . "\n"; |
| 451 | 451 | } |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 544 | 544 | { |
| 545 | 545 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
| 546 | - switch($sExt) |
|
| 546 | + switch ($sExt) |
|
| 547 | 547 | { |
| 548 | 548 | case 'php': |
| 549 | 549 | return $this->readPhpConfigFile($sConfigFile, $sLibKey, $sAppKey); |
@@ -212,8 +212,9 @@ discard block |
||
| 212 | 212 | { |
| 213 | 213 | $sEvent = $xArgs; |
| 214 | 214 | $xUserFunction = $aArgs[2]; |
| 215 | - if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
| 216 | - $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
|
| 215 | + if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) { |
|
| 216 | + $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
|
| 217 | + } |
|
| 217 | 218 | $this->aProcessingEvents[$sEvent] = $xUserFunction; |
| 218 | 219 | } |
| 219 | 220 | /*else |
@@ -326,8 +327,7 @@ discard block |
||
| 326 | 327 | try |
| 327 | 328 | { |
| 328 | 329 | $mResult = $this->getPluginManager()->processRequest(); |
| 329 | - } |
|
| 330 | - catch(Exception $e) |
|
| 330 | + } catch(Exception $e) |
|
| 331 | 331 | { |
| 332 | 332 | // An exception was thrown while processing the request. |
| 333 | 333 | // The request missed the corresponding handler function, |
@@ -344,8 +344,7 @@ discard block |
||
| 344 | 344 | { |
| 345 | 345 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 346 | 346 | $aParams = array($e->getMessage()); |
| 347 | - } |
|
| 348 | - else |
|
| 347 | + } else |
|
| 349 | 348 | { |
| 350 | 349 | $sEvent = self::PROCESSING_EVENT_ERROR; |
| 351 | 350 | $aParams = array($e); |
@@ -355,8 +354,7 @@ discard block |
||
| 355 | 354 | { |
| 356 | 355 | // Call the processing event |
| 357 | 356 | $this->aProcessingEvents[$sEvent]->call($aParams); |
| 358 | - } |
|
| 359 | - else |
|
| 357 | + } else |
|
| 360 | 358 | { |
| 361 | 359 | // The exception is not to be processed here. |
| 362 | 360 | throw $e; |