@@ -191,15 +191,6 @@ discard block |
||
| 191 | 191 | * - Jaxon::CALLABLE_OBJECT: an object who's methods are to be registered |
| 192 | 192 | * - Jaxon::BROWSER_EVENT: an event which will cause zero or more event handlers to be called |
| 193 | 193 | * - Jaxon::EVENT_HANDLER: register an event handler function. |
| 194 | - * @param mixed $sFunction | $objObject | $sEvent |
|
| 195 | - * When registering a function, this is the name of the function |
|
| 196 | - * When registering a callable object, this is the object being registered |
|
| 197 | - * When registering an event or event handler, this is the name of the event |
|
| 198 | - * @param mixed $sIncludeFile | $aCallOptions | $sEventHandler |
|
| 199 | - * When registering a function, this is the (optional) include file |
|
| 200 | - * When registering a callable object, this is an (optional) array |
|
| 201 | - * of call options for the functions being registered |
|
| 202 | - * When registering an event handler, this is the name of the function |
|
| 203 | 194 | * |
| 204 | 195 | * @return mixed |
| 205 | 196 | */ |
@@ -498,7 +489,7 @@ discard block |
||
| 498 | 489 | * @param string $sLibKey The key of the library options in the file |
| 499 | 490 | * @param string|null $sAppKey The key of the application options in the file |
| 500 | 491 | * |
| 501 | - * @return array |
|
| 492 | + * @return null|Utils\Config\Config |
|
| 502 | 493 | */ |
| 503 | 494 | public function readPhpConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 504 | 495 | { |
@@ -512,7 +503,7 @@ discard block |
||
| 512 | 503 | * @param string $sLibKey The key of the library options in the file |
| 513 | 504 | * @param string|null $sAppKey The key of the application options in the file |
| 514 | 505 | * |
| 515 | - * @return array |
|
| 506 | + * @return null|Utils\Config\Config |
|
| 516 | 507 | */ |
| 517 | 508 | public function readYamlConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 518 | 509 | { |
@@ -526,7 +517,7 @@ discard block |
||
| 526 | 517 | * @param string $sLibKey The key of the library options in the file |
| 527 | 518 | * @param string|null $sAppKey The key of the application options in the file |
| 528 | 519 | * |
| 529 | - * @return array |
|
| 520 | + * @return Utils\Config\Config|null |
|
| 530 | 521 | */ |
| 531 | 522 | public function readJsonConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 532 | 523 | { |
@@ -540,7 +531,7 @@ discard block |
||
| 540 | 531 | * @param string $sLibKey The key of the library options in the file |
| 541 | 532 | * @param string|null $sAppKey The key of the application options in the file |
| 542 | 533 | * |
| 543 | - * @return array |
|
| 534 | + * @return null|Utils\Config\Config |
|
| 544 | 535 | */ |
| 545 | 536 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 546 | 537 | { |
@@ -568,7 +559,7 @@ discard block |
||
| 568 | 559 | * - 1000 thru 8999: User created plugins, typically, these plugins don't care about order |
| 569 | 560 | * - 9000 thru 9999: Plugins that generally need to be last or near the end of the plugin list |
| 570 | 561 | * |
| 571 | - * @param Plugin $xPlugin An instance of a plugin |
|
| 562 | + * @param Plugin\Plugin $xPlugin An instance of a plugin |
|
| 572 | 563 | * @param integer $nPriority The plugin priority, used to order the plugins |
| 573 | 564 | * |
| 574 | 565 | * @return void |
@@ -631,7 +622,7 @@ discard block |
||
| 631 | 622 | /** |
| 632 | 623 | * Check uploaded files validity and move them to the user dir |
| 633 | 624 | * |
| 634 | - * @return boolean |
|
| 625 | + * @return null|boolean |
|
| 635 | 626 | */ |
| 636 | 627 | public function saveUploadedFiles() |
| 637 | 628 | { |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | $this->addViewNamespace('pagination', $sDirectory, '.php'); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | - /** |
|
| 617 | + /** |
|
| 618 | 618 | * Check if uploaded files are available |
| 619 | 619 | * |
| 620 | 620 | * @return boolean |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | return $xUploadPlugin->canProcessRequest(); |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | - /** |
|
| 631 | + /** |
|
| 632 | 632 | * Check uploaded files validity and move them to the user dir |
| 633 | 633 | * |
| 634 | 634 | * @return boolean |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | 'core.prefix.event' => 'jaxon_event_', |
| 132 | 132 | // 'core.request.uri' => '', |
| 133 | 133 | 'core.request.mode' => 'asynchronous', |
| 134 | - 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
| 134 | + 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
| 135 | 135 | 'core.debug.on' => false, |
| 136 | 136 | 'core.debug.verbose' => false, |
| 137 | 137 | 'core.process.exit' => true, |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | $aArgs = func_get_args(); |
| 209 | 209 | $nArgs = func_num_args(); |
| 210 | 210 | |
| 211 | - if(self::PROCESSING_EVENT == $sType) |
|
| 211 | + if (self::PROCESSING_EVENT == $sType) |
|
| 212 | 212 | { |
| 213 | - if($nArgs > 2) |
|
| 213 | + if ($nArgs > 2) |
|
| 214 | 214 | { |
| 215 | 215 | $sEvent = $xArgs; |
| 216 | 216 | $xUserFunction = $aArgs[2]; |
| 217 | - if(!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
| 217 | + if (!is_a($xUserFunction, 'Request\\Support\\UserFunction')) |
|
| 218 | 218 | $xUserFunction = new Request\Support\UserFunction($xUserFunction); |
| 219 | 219 | $this->aProcessingEvents[$sEvent] = $xUserFunction; |
| 220 | 220 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | public function processRequest() |
| 301 | 301 | { |
| 302 | 302 | // Check to see if headers have already been sent out, in which case we can't do our job |
| 303 | - if(headers_sent($filename, $linenumber)) |
|
| 303 | + if (headers_sent($filename, $linenumber)) |
|
| 304 | 304 | { |
| 305 | 305 | echo $this->trans('errors.output.already-sent', array( |
| 306 | 306 | 'location' => $filename . ':' . $linenumber |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | // Check if there is a plugin to process this request |
| 312 | - if(!$this->canProcessRequest()) |
|
| 312 | + if (!$this->canProcessRequest()) |
|
| 313 | 313 | { |
| 314 | 314 | return; |
| 315 | 315 | } |
@@ -318,18 +318,18 @@ discard block |
||
| 318 | 318 | $mResult = true; |
| 319 | 319 | |
| 320 | 320 | // Handle before processing event |
| 321 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 321 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 322 | 322 | { |
| 323 | 323 | $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest)); |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if(!$bEndRequest) |
|
| 326 | + if (!$bEndRequest) |
|
| 327 | 327 | { |
| 328 | 328 | try |
| 329 | 329 | { |
| 330 | 330 | $mResult = $this->getPluginManager()->processRequest(); |
| 331 | 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, |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $xResponseManager->debug($e->getMessage()); |
| 343 | 343 | $mResult = false; |
| 344 | 344 | |
| 345 | - if($e instanceof \Jaxon\Exception\Error) |
|
| 345 | + if ($e instanceof \Jaxon\Exception\Error) |
|
| 346 | 346 | { |
| 347 | 347 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 348 | 348 | $aParams = array($e->getMessage()); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $aParams = array($e); |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if(isset($this->aProcessingEvents[$sEvent])) |
|
| 356 | + if (isset($this->aProcessingEvents[$sEvent])) |
|
| 357 | 357 | { |
| 358 | 358 | // Call the processing event |
| 359 | 359 | $this->aProcessingEvents[$sEvent]->call($aParams); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | // Clean the processing buffer |
| 369 | - if(($this->getOption('core.process.clean'))) |
|
| 369 | + if (($this->getOption('core.process.clean'))) |
|
| 370 | 370 | { |
| 371 | 371 | $er = error_reporting(0); |
| 372 | 372 | while (ob_get_level() > 0) |
@@ -376,10 +376,10 @@ discard block |
||
| 376 | 376 | error_reporting($er); |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if($mResult === true) |
|
| 379 | + if ($mResult === true) |
|
| 380 | 380 | { |
| 381 | 381 | // Handle after processing event |
| 382 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 382 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 383 | 383 | { |
| 384 | 384 | $bEndRequest = false; |
| 385 | 385 | $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest)); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $this->getResponseManager()->printDebug(); |
| 390 | 390 | |
| 391 | - if(($this->getOption('core.process.exit'))) |
|
| 391 | + if (($this->getOption('core.process.exit'))) |
|
| 392 | 392 | { |
| 393 | 393 | $this->getResponseManager()->sendOutput(); |
| 394 | 394 | exit(); |
@@ -438,16 +438,16 @@ discard block |
||
| 438 | 438 | */ |
| 439 | 439 | public function getScript($bIncludeJs = false, $bIncludeCss = false) |
| 440 | 440 | { |
| 441 | - if(!$this->getOption('core.request.uri')) |
|
| 441 | + if (!$this->getOption('core.request.uri')) |
|
| 442 | 442 | { |
| 443 | 443 | $this->setOption('core.request.uri', URI::detect()); |
| 444 | 444 | } |
| 445 | 445 | $sCode = ''; |
| 446 | - if(($bIncludeCss)) |
|
| 446 | + if (($bIncludeCss)) |
|
| 447 | 447 | { |
| 448 | 448 | $sCode .= $this->getPluginManager()->getCss() . "\n"; |
| 449 | 449 | } |
| 450 | - if(($bIncludeJs)) |
|
| 450 | + if (($bIncludeJs)) |
|
| 451 | 451 | { |
| 452 | 452 | $sCode .= $this->getPluginManager()->getJs() . "\n"; |
| 453 | 453 | } |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
| 546 | 546 | { |
| 547 | 547 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
| 548 | - switch($sExt) |
|
| 548 | + switch ($sExt) |
|
| 549 | 549 | { |
| 550 | 550 | case 'php': |
| 551 | 551 | return $this->readPhpConfigFile($sConfigFile, $sLibKey, $sAppKey); |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | */ |
| 622 | 622 | public function hasUploadedFiles() |
| 623 | 623 | { |
| 624 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 624 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 625 | 625 | { |
| 626 | 626 | return false; |
| 627 | 627 | } |
@@ -637,11 +637,11 @@ discard block |
||
| 637 | 637 | { |
| 638 | 638 | try |
| 639 | 639 | { |
| 640 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 640 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 641 | 641 | { |
| 642 | 642 | throw new Exception($this->trans('errors.upload.plugin')); |
| 643 | 643 | } |
| 644 | - else if(!$xUploadPlugin->canProcessRequest()) |
|
| 644 | + else if (!$xUploadPlugin->canProcessRequest()) |
|
| 645 | 645 | { |
| 646 | 646 | throw new Exception($this->trans('errors.upload.request')); |
| 647 | 647 | } |
@@ -650,14 +650,14 @@ discard block |
||
| 650 | 650 | $sResponse = '{"code": "success", "upl": "' . $sKey . '"}'; |
| 651 | 651 | $return = true; |
| 652 | 652 | } |
| 653 | - catch(Exception $e) |
|
| 653 | + catch (Exception $e) |
|
| 654 | 654 | { |
| 655 | 655 | $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}'; |
| 656 | 656 | $return = false; |
| 657 | 657 | } |
| 658 | 658 | // Send the response back to the browser |
| 659 | 659 | echo '<script>var res = ', $sResponse, '; </script>'; |
| 660 | - if(($this->getOption('core.process.exit'))) |
|
| 660 | + if (($this->getOption('core.process.exit'))) |
|
| 661 | 661 | { |
| 662 | 662 | exit(); |
| 663 | 663 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | */ |
| 672 | 672 | public function getUploadedFiles() |
| 673 | 673 | { |
| 674 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 674 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 675 | 675 | { |
| 676 | 676 | return []; |
| 677 | 677 | } |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | */ |
| 688 | 688 | public function setUploadFileFilter($fFileFilter) |
| 689 | 689 | { |
| 690 | - if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 690 | + if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null) |
|
| 691 | 691 | { |
| 692 | 692 | return; |
| 693 | 693 | } |
@@ -214,8 +214,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | - else if(!$xUploadPlugin->canProcessRequest()) |
|
| 641 | + } else if(!$xUploadPlugin->canProcessRequest()) |
|
| 645 | 642 | { |
| 646 | 643 | throw new Exception($this->trans('errors.upload.request')); |
| 647 | 644 | } |
@@ -649,8 +646,7 @@ discard block |
||
| 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; |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | * |
| 281 | 281 | * @param array $aArgs An array containing the event specification |
| 282 | 282 | * |
| 283 | - * @return \Jaxon\Request\Request |
|
| 283 | + * @return boolean |
|
| 284 | 284 | */ |
| 285 | 285 | public function register($aArgs) |
| 286 | 286 | { |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | /** |
| 343 | 343 | * Check uploaded files validity and move them to the user dir |
| 344 | 344 | * |
| 345 | - * @return boolean |
|
| 345 | + * @return string |
|
| 346 | 346 | */ |
| 347 | 347 | public function saveUploadedFiles() |
| 348 | 348 | { |
@@ -217,7 +217,7 @@ |
||
| 217 | 217 | $aFiles[$sVarName] = []; |
| 218 | 218 | foreach($aUserFiles as $aUserFile) |
| 219 | 219 | { |
| 220 | - $aFiles[$sVarName][] = $aUserFile->toTempData(); |
|
| 220 | + $aFiles[$sVarName][] = $aUserFile->toTempData(); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | // Save upload data in a temp file |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $this->aUserFiles = []; |
| 51 | 51 | |
| 52 | - if(array_key_exists('jxnupl', $_POST)) |
|
| 52 | + if (array_key_exists('jxnupl', $_POST)) |
|
| 53 | 53 | { |
| 54 | 54 | $this->sTempFile = $_POST['jxnupl']; |
| 55 | 55 | } |
| 56 | - else if(array_key_exists('jxnupl', $_GET)) |
|
| 56 | + else if (array_key_exists('jxnupl', $_GET)) |
|
| 57 | 57 | { |
| 58 | 58 | $this->sTempFile = $_GET['jxnupl']; |
| 59 | 59 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | protected function filterFilename($sFilename, $sVarName) |
| 83 | 83 | { |
| 84 | - if(($this->fFileFilter)) |
|
| 84 | + if (($this->fFileFilter)) |
|
| 85 | 85 | { |
| 86 | 86 | $fFileFilter = $this->fFileFilter; |
| 87 | 87 | $sFilename = (string)$fFileFilter($sFilename, $sVarName); |
@@ -98,17 +98,17 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | // Check validity of the uploaded files |
| 100 | 100 | $aTempFiles = []; |
| 101 | - foreach($_FILES as $sVarName => $aFile) |
|
| 101 | + foreach ($_FILES as $sVarName => $aFile) |
|
| 102 | 102 | { |
| 103 | - if(is_array($aFile['name'])) |
|
| 103 | + if (is_array($aFile['name'])) |
|
| 104 | 104 | { |
| 105 | - for($i = 0; $i < count($aFile['name']); $i++) |
|
| 105 | + for ($i = 0; $i < count($aFile['name']); $i++) |
|
| 106 | 106 | { |
| 107 | - if(!$aFile['name'][$i]) |
|
| 107 | + if (!$aFile['name'][$i]) |
|
| 108 | 108 | { |
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | - if(!array_key_exists($sVarName, $aTempFiles)) |
|
| 111 | + if (!array_key_exists($sVarName, $aTempFiles)) |
|
| 112 | 112 | { |
| 113 | 113 | $aTempFiles[$sVarName] = []; |
| 114 | 114 | } |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | else |
| 130 | 130 | { |
| 131 | - if(!$aFile['name']) |
|
| 131 | + if (!$aFile['name']) |
|
| 132 | 132 | { |
| 133 | 133 | continue; |
| 134 | 134 | } |
| 135 | - if(!array_key_exists($sVarName, $aTempFiles)) |
|
| 135 | + if (!array_key_exists($sVarName, $aTempFiles)) |
|
| 136 | 136 | { |
| 137 | 137 | $aTempFiles[$sVarName] = []; |
| 138 | 138 | } |
@@ -155,24 +155,24 @@ discard block |
||
| 155 | 155 | $sDefaultUploadDir = $this->getOption('upload.default.dir'); |
| 156 | 156 | |
| 157 | 157 | // Check uploaded files validity |
| 158 | - foreach($aTempFiles as $sVarName => $aFiles) |
|
| 158 | + foreach ($aTempFiles as $sVarName => $aFiles) |
|
| 159 | 159 | { |
| 160 | - foreach($aFiles as $aFile) |
|
| 160 | + foreach ($aFiles as $aFile) |
|
| 161 | 161 | { |
| 162 | 162 | // Verify upload result |
| 163 | - if($aFile['error'] != 0) |
|
| 163 | + if ($aFile['error'] != 0) |
|
| 164 | 164 | { |
| 165 | 165 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.failed', $aFile)); |
| 166 | 166 | } |
| 167 | 167 | // Verify file validity (format, size) |
| 168 | - if(!$this->validateUploadedFile($sVarName, $aFile)) |
|
| 168 | + if (!$this->validateUploadedFile($sVarName, $aFile)) |
|
| 169 | 169 | { |
| 170 | 170 | throw new \Jaxon\Exception\Error($this->getValidatorMessage()); |
| 171 | 171 | } |
| 172 | 172 | // Verify that the upload dir exists and is writable |
| 173 | 173 | $sUploadDir = $this->getOption('upload.files.' . $sVarName . '.dir', $sDefaultUploadDir); |
| 174 | 174 | $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
| 175 | - if(!is_writable($sUploadDir)) |
|
| 175 | + if (!is_writable($sUploadDir)) |
|
| 176 | 176 | { |
| 177 | 177 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
| 178 | 178 | } |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // Copy the uploaded files from the temp dir to the user dir |
| 183 | - foreach($aTempFiles as $sVarName => $aTempFiles) |
|
| 183 | + foreach ($aTempFiles as $sVarName => $aTempFiles) |
|
| 184 | 184 | { |
| 185 | 185 | $this->aUserFiles[$sVarName] = []; |
| 186 | - foreach($aTempFiles as $aFile) |
|
| 186 | + foreach ($aTempFiles as $aFile) |
|
| 187 | 187 | { |
| 188 | 188 | // Set the user file data |
| 189 | 189 | $sUploadDir = $this->getOption('upload.files.' . $sVarName . '.dir', $sDefaultUploadDir); |
@@ -206,16 +206,16 @@ discard block |
||
| 206 | 206 | // Default upload dir |
| 207 | 207 | $sUploadDir = $this->getOption('upload.default.dir'); |
| 208 | 208 | $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
| 209 | - if(!is_writable($sUploadDir)) |
|
| 209 | + if (!is_writable($sUploadDir)) |
|
| 210 | 210 | { |
| 211 | 211 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
| 212 | 212 | } |
| 213 | 213 | // Convert uploaded file to an array |
| 214 | 214 | $aFiles = []; |
| 215 | - foreach($this->aUserFiles as $sVarName => $aUserFiles) |
|
| 215 | + foreach ($this->aUserFiles as $sVarName => $aUserFiles) |
|
| 216 | 216 | { |
| 217 | 217 | $aFiles[$sVarName] = []; |
| 218 | - foreach($aUserFiles as $aUserFile) |
|
| 218 | + foreach ($aUserFiles as $aUserFile) |
|
| 219 | 219 | { |
| 220 | 220 | $aFiles[$sVarName][] = $aUserFile->toTempData(); |
| 221 | 221 | } |
@@ -238,16 +238,16 @@ discard block |
||
| 238 | 238 | $sUploadDir = $this->getOption('upload.default.dir'); |
| 239 | 239 | $sUploadDir = rtrim(trim($sUploadDir), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
| 240 | 240 | $sUploadDir .= 'tmp' . DIRECTORY_SEPARATOR; |
| 241 | - if(!is_readable($sUploadDir . $this->sTempFile . '.json')) |
|
| 241 | + if (!is_readable($sUploadDir . $this->sTempFile . '.json')) |
|
| 242 | 242 | { |
| 243 | 243 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
| 244 | 244 | } |
| 245 | 245 | $aFiles = file_get_contents($sUploadDir . $this->sTempFile . '.json'); |
| 246 | 246 | $aFiles = json_decode($aFiles, true); |
| 247 | - foreach($aFiles as $sVarName => $aUserFiles) |
|
| 247 | + foreach ($aFiles as $sVarName => $aUserFiles) |
|
| 248 | 248 | { |
| 249 | 249 | $this->aUserFiles[$sVarName] = []; |
| 250 | - foreach($aUserFiles as $aUserFile) |
|
| 250 | + foreach ($aUserFiles as $aUserFile) |
|
| 251 | 251 | { |
| 252 | 252 | $this->aUserFiles[$sVarName][] = UploadedFile::fromTempData($aUserFile); |
| 253 | 253 | } |
@@ -324,15 +324,15 @@ discard block |
||
| 324 | 324 | */ |
| 325 | 325 | public function processRequest() |
| 326 | 326 | { |
| 327 | - if(!$this->canProcessRequest()) |
|
| 327 | + if (!$this->canProcessRequest()) |
|
| 328 | 328 | { |
| 329 | 329 | return false; |
| 330 | 330 | } |
| 331 | - if(count($_FILES) > 0) |
|
| 331 | + if (count($_FILES) > 0) |
|
| 332 | 332 | { |
| 333 | 333 | $this->readFromHttpData(); |
| 334 | 334 | } |
| 335 | - else if(($this->sTempFile)) |
|
| 335 | + else if (($this->sTempFile)) |
|
| 336 | 336 | { |
| 337 | 337 | $this->readFromTempFile(); |
| 338 | 338 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | public function saveUploadedFiles() |
| 348 | 348 | { |
| 349 | 349 | // Process uploaded files |
| 350 | - if(!$this->processRequest()) |
|
| 350 | + if (!$this->processRequest()) |
|
| 351 | 351 | { |
| 352 | 352 | return ''; |
| 353 | 353 | } |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | if(array_key_exists('jxnupl', $_POST)) |
| 53 | 53 | { |
| 54 | 54 | $this->sTempFile = $_POST['jxnupl']; |
| 55 | - } |
|
| 56 | - else if(array_key_exists('jxnupl', $_GET)) |
|
| 55 | + } else if(array_key_exists('jxnupl', $_GET)) |
|
| 57 | 56 | { |
| 58 | 57 | $this->sTempFile = $_GET['jxnupl']; |
| 59 | 58 | } |
@@ -125,8 +124,7 @@ discard block |
||
| 125 | 124 | 'extension' => pathinfo($aFile['name'][$i], PATHINFO_EXTENSION), |
| 126 | 125 | ]; |
| 127 | 126 | } |
| 128 | - } |
|
| 129 | - else |
|
| 127 | + } else |
|
| 130 | 128 | { |
| 131 | 129 | if(!$aFile['name']) |
| 132 | 130 | { |
@@ -331,8 +329,7 @@ discard block |
||
| 331 | 329 | if(count($_FILES) > 0) |
| 332 | 330 | { |
| 333 | 331 | $this->readFromHttpData(); |
| 334 | - } |
|
| 335 | - else if(($this->sTempFile)) |
|
| 332 | + } else if(($this->sTempFile)) |
|
| 336 | 333 | { |
| 337 | 334 | $this->readFromTempFile(); |
| 338 | 335 | } |
@@ -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->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 325 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 326 | 326 | { |
| 327 | 327 | return true; |
| 328 | 328 | } |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | public function processRequest() |
| 342 | 342 | { |
| 343 | 343 | $xUploadPlugin = $this->getRequestPlugin(Jaxon::FILE_UPLOAD); |
| 344 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 344 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 345 | 345 | { |
| 346 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 346 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 347 | 347 | { |
| 348 | 348 | // Process uploaded files |
| 349 | - if($xUploadPlugin != null) |
|
| 349 | + if ($xUploadPlugin != null) |
|
| 350 | 350 | { |
| 351 | 351 | $xUploadPlugin->processRequest(); |
| 352 | 352 | } |
@@ -370,10 +370,10 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | public function register($aArgs) |
| 372 | 372 | { |
| 373 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 373 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 374 | 374 | { |
| 375 | 375 | $mResult = $xPlugin->register($aArgs); |
| 376 | - if($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true) |
|
| 376 | + if ($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true) |
|
| 377 | 377 | { |
| 378 | 378 | return $mResult; |
| 379 | 379 | } |
@@ -393,37 +393,37 @@ discard block |
||
| 393 | 393 | */ |
| 394 | 394 | public function addClassDir($sDirectory, $sNamespace = '', $sSeparator = '.', array $aProtected = array()) |
| 395 | 395 | { |
| 396 | - if(!is_dir(($sDirectory = trim($sDirectory)))) |
|
| 396 | + if (!is_dir(($sDirectory = trim($sDirectory)))) |
|
| 397 | 397 | { |
| 398 | 398 | return false; |
| 399 | 399 | } |
| 400 | 400 | // Only '.' and '_' are allowed to be used as separator. Any other value is ignored and '.' is used instead. |
| 401 | - if(($sSeparator = trim($sSeparator)) != '_') |
|
| 401 | + if (($sSeparator = trim($sSeparator)) != '_') |
|
| 402 | 402 | { |
| 403 | 403 | $sSeparator = '.'; |
| 404 | 404 | } |
| 405 | - if(!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 405 | + if (!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 406 | 406 | { |
| 407 | 407 | $sNamespace = ''; |
| 408 | 408 | } |
| 409 | - if(($sNamespace)) |
|
| 409 | + if (($sNamespace)) |
|
| 410 | 410 | { |
| 411 | 411 | // If there is an autoloader, register the dir with PSR4 autoloading |
| 412 | - if(($this->xAutoloader)) |
|
| 412 | + if (($this->xAutoloader)) |
|
| 413 | 413 | { |
| 414 | 414 | $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory); |
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | - elseif(($this->xAutoloader)) |
|
| 417 | + elseif (($this->xAutoloader)) |
|
| 418 | 418 | { |
| 419 | 419 | // If there is an autoloader, register the dir with classmap autoloading |
| 420 | 420 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
| 421 | 421 | $itFile = new RecursiveIteratorIterator($itDir); |
| 422 | 422 | // Iterate on dir content |
| 423 | - foreach($itFile as $xFile) |
|
| 423 | + foreach ($itFile as $xFile) |
|
| 424 | 424 | { |
| 425 | 425 | // skip everything except PHP files |
| 426 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 426 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 427 | 427 | { |
| 428 | 428 | continue; |
| 429 | 429 | } |
@@ -459,33 +459,33 @@ discard block |
||
| 459 | 459 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
| 460 | 460 | $sClassPath = str_replace($sDS, '\\', trim($sClassPath, $sDS)); |
| 461 | 461 | $sClassName = $xFile->getBasename('.php'); |
| 462 | - if(($sNamespace)) |
|
| 462 | + if (($sNamespace)) |
|
| 463 | 463 | { |
| 464 | 464 | $sClassPath = ($sClassPath) ? $sNamespace . '\\' . $sClassPath : $sNamespace; |
| 465 | 465 | $sClassName = '\\' . $sClassPath . '\\' . $sClassName; |
| 466 | 466 | } |
| 467 | 467 | // Require the file only if autoload is enabled but there is no autoloader |
| 468 | - if(($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
| 468 | + if (($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
| 469 | 469 | { |
| 470 | 470 | require_once($xFile->getPathname()); |
| 471 | 471 | } |
| 472 | 472 | // Create and register an instance of the class |
| 473 | - if(!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
| 473 | + if (!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
| 474 | 474 | { |
| 475 | 475 | $aOptions['*'] = array(); |
| 476 | 476 | } |
| 477 | 477 | $aOptions['*']['separator'] = $sSeparator; |
| 478 | - if(($sNamespace)) |
|
| 478 | + if (($sNamespace)) |
|
| 479 | 479 | { |
| 480 | 480 | $aOptions['*']['namespace'] = $sNamespace; |
| 481 | 481 | } |
| 482 | - if(($sClassPath)) |
|
| 482 | + if (($sClassPath)) |
|
| 483 | 483 | { |
| 484 | 484 | $aOptions['*']['classpath'] = $sClassPath; |
| 485 | 485 | } |
| 486 | 486 | // Filter excluded methods |
| 487 | - $aProtected = array_filter($aProtected, function ($sName) {return is_string($sName);}); |
|
| 488 | - if(count($aProtected) > 0) |
|
| 487 | + $aProtected = array_filter($aProtected, function($sName) {return is_string($sName); }); |
|
| 488 | + if (count($aProtected) > 0) |
|
| 489 | 489 | { |
| 490 | 490 | $aOptions['*']['protected'] = $aProtected; |
| 491 | 491 | } |
@@ -504,13 +504,13 @@ discard block |
||
| 504 | 504 | $sDS = DIRECTORY_SEPARATOR; |
| 505 | 505 | // Change the keys in $aOptions to have "\" as separator |
| 506 | 506 | $aNewOptions = array(); |
| 507 | - foreach($aOptions as $key => $aOption) |
|
| 507 | + foreach ($aOptions as $key => $aOption) |
|
| 508 | 508 | { |
| 509 | 509 | $key = trim(str_replace(['.', '_'], ['\\', '\\'], $key), ' \\'); |
| 510 | 510 | $aNewOptions[$key] = $aOption; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - foreach($this->aClassDirs as $aClassDir) |
|
| 513 | + foreach ($this->aClassDirs as $aClassDir) |
|
| 514 | 514 | { |
| 515 | 515 | // Get the directory |
| 516 | 516 | $sDirectory = $aClassDir['directory']; |
@@ -520,10 +520,10 @@ discard block |
||
| 520 | 520 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
| 521 | 521 | $itFile = new RecursiveIteratorIterator($itDir); |
| 522 | 522 | // Iterate on dir content |
| 523 | - foreach($itFile as $xFile) |
|
| 523 | + foreach ($itFile as $xFile) |
|
| 524 | 524 | { |
| 525 | 525 | // skip everything except PHP files |
| 526 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 526 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 527 | 527 | { |
| 528 | 528 | continue; |
| 529 | 529 | } |
@@ -532,13 +532,13 @@ discard block |
||
| 532 | 532 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
| 533 | 533 | $sClassPath = trim(str_replace($sDS, '\\', $sClassPath), '\\'); |
| 534 | 534 | $sClassName = $sClassPath . '\\' . $xFile->getBasename('.php'); |
| 535 | - if(($sNamespace)) |
|
| 535 | + if (($sNamespace)) |
|
| 536 | 536 | { |
| 537 | 537 | $sClassName = $sNamespace . '\\' . $sClassName; |
| 538 | 538 | } |
| 539 | 539 | // Get the class options |
| 540 | 540 | $aClassOptions = []; |
| 541 | - if(array_key_exists($sClassName, $aNewOptions)) |
|
| 541 | + if (array_key_exists($sClassName, $aNewOptions)) |
|
| 542 | 542 | { |
| 543 | 543 | $aClassOptions = $aNewOptions[$sClassName]; |
| 544 | 544 | } |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | */ |
| 560 | 560 | public function registerClass($sClassName, array $aOptions = array()) |
| 561 | 561 | { |
| 562 | - if(!($sClassName = trim($sClassName, ' \\._'))) |
|
| 562 | + if (!($sClassName = trim($sClassName, ' \\._'))) |
|
| 563 | 563 | { |
| 564 | 564 | return false; |
| 565 | 565 | } |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | // Replace "." and "_" with antislashes, and set the class path. |
| 569 | 569 | $sClassName = str_replace(['.', '_'], ['\\', '\\'], $sClassName); |
| 570 | 570 | $sClassPath = ''; |
| 571 | - if(($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
| 571 | + if (($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
| 572 | 572 | { |
| 573 | 573 | $sClassPath = substr($sClassName, 0, $nLastSlashPosition); |
| 574 | 574 | $sClassName = substr($sClassName, $nLastSlashPosition + 1); |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | $sPartPath = str_replace('\\', $sDS, $sClassPath) . $sDS . $sClassName . '.php'; |
| 578 | 578 | |
| 579 | 579 | // Search for the class file in all directories. |
| 580 | - foreach($this->aClassDirs as $aClassDir) |
|
| 580 | + foreach ($this->aClassDirs as $aClassDir) |
|
| 581 | 581 | { |
| 582 | 582 | // Get the separator |
| 583 | 583 | $sSeparator = $aClassDir['separator']; |
@@ -586,15 +586,15 @@ discard block |
||
| 586 | 586 | $nLen = strlen($sNamespace); |
| 587 | 587 | $sFullPath = ''; |
| 588 | 588 | // Check if the class belongs to the namespace |
| 589 | - if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
| 589 | + if (($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
| 590 | 590 | { |
| 591 | 591 | $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1); |
| 592 | 592 | } |
| 593 | - elseif(!($sNamespace)) |
|
| 593 | + elseif (!($sNamespace)) |
|
| 594 | 594 | { |
| 595 | 595 | $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath; |
| 596 | 596 | } |
| 597 | - if(($sFullPath) && is_file($sFullPath)) |
|
| 597 | + if (($sFullPath) && is_file($sFullPath)) |
|
| 598 | 598 | { |
| 599 | 599 | // Found the file in this directory |
| 600 | 600 | $xFileInfo = new \SplFileInfo($sFullPath); |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | { |
| 619 | 619 | $xObject = null; // The user registered object |
| 620 | 620 | $xPlugin = $this->getRequestPlugin('CallableObject'); // The CallableObject plugin |
| 621 | - if(($xPlugin)) |
|
| 621 | + if (($xPlugin)) |
|
| 622 | 622 | { |
| 623 | 623 | $xObject = $xPlugin->getRegisteredObject($sClassName); |
| 624 | 624 | } |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | */ |
| 633 | 633 | private function getJsLibUri() |
| 634 | 634 | { |
| 635 | - if(!$this->hasOption('js.lib.uri')) |
|
| 635 | + if (!$this->hasOption('js.lib.uri')) |
|
| 636 | 636 | { |
| 637 | 637 | return 'https://cdn.jsdelivr.net/jaxon/1.2.0/'; |
| 638 | 638 | } |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | $jsDelivrUri = 'https://cdn.jsdelivr.net'; |
| 653 | 653 | $nLen = strlen($jsDelivrUri); |
| 654 | 654 | // The jsDelivr CDN only hosts minified files |
| 655 | - if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri) |
|
| 655 | + if (($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri) |
|
| 656 | 656 | { |
| 657 | 657 | return '.min.js'; |
| 658 | 658 | } |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | // Check config options |
| 670 | 670 | // - The js.app.extern option must be set to true |
| 671 | 671 | // - The js.app.uri and js.app.dir options must be set to non null values |
| 672 | - if(!$this->getOption('js.app.extern') || |
|
| 672 | + if (!$this->getOption('js.app.extern') || |
|
| 673 | 673 | !$this->getOption('js.app.uri') || |
| 674 | 674 | !$this->getOption('js.app.dir')) |
| 675 | 675 | { |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | // Check dir access |
| 679 | 679 | // - The js.app.dir must be writable |
| 680 | 680 | $sJsAppDir = $this->getOption('js.app.dir'); |
| 681 | - if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 681 | + if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 682 | 682 | { |
| 683 | 683 | return false; |
| 684 | 684 | } |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | */ |
| 693 | 693 | private function setTemplateCacheDir() |
| 694 | 694 | { |
| 695 | - if($this->hasOption('core.template.cache_dir')) |
|
| 695 | + if ($this->hasOption('core.template.cache_dir')) |
|
| 696 | 696 | { |
| 697 | 697 | $this->setCacheDir($this->getOption('core.template.cache_dir')); |
| 698 | 698 | } |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | |
| 715 | 715 | // Add component files to the javascript file array; |
| 716 | 716 | $aJsFiles = array($sJsCoreUrl); |
| 717 | - if($this->getOption('core.debug.on')) |
|
| 717 | + if ($this->getOption('core.debug.on')) |
|
| 718 | 718 | { |
| 719 | 719 | $aJsFiles[] = $sJsDebugUrl; |
| 720 | 720 | $aJsFiles[] = $sJsLanguageUrl; |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | 'sJsOptions' => $this->getOption('js.app.options'), |
| 731 | 731 | 'aUrls' => $aJsFiles, |
| 732 | 732 | )); |
| 733 | - foreach($this->aResponsePlugins as $xPlugin) |
|
| 733 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
| 734 | 734 | { |
| 735 | 735 | $sCode .= rtrim($xPlugin->getJs(), " \n") . "\n"; |
| 736 | 736 | } |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | $this->setTemplateCacheDir(); |
| 749 | 749 | |
| 750 | 750 | $sCode = ''; |
| 751 | - foreach($this->aResponsePlugins as $xPlugin) |
|
| 751 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
| 752 | 752 | { |
| 753 | 753 | $sCode .= rtrim($xPlugin->getCss(), " \n") . "\n"; |
| 754 | 754 | } |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | )); |
| 837 | 837 | |
| 838 | 838 | $sPluginScript = ''; |
| 839 | - foreach($this->aResponsePlugins as $xPlugin) |
|
| 839 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
| 840 | 840 | { |
| 841 | 841 | $sPluginScript .= "\n" . trim($xPlugin->getScript(), " \n"); |
| 842 | 842 | } |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | { |
| 866 | 866 | // Get the config and plugins scripts |
| 867 | 867 | $sScript = $this->getConfigScript() . "\n" . $this->getReadyScript() . "\n"; |
| 868 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 868 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 869 | 869 | { |
| 870 | 870 | $sScript .= "\n" . trim($xPlugin->getScript(), " \n"); |
| 871 | 871 | } |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | // Set the template engine cache dir |
| 888 | 888 | $this->setTemplateCacheDir(); |
| 889 | 889 | |
| 890 | - if($this->canExportJavascript()) |
|
| 890 | + if ($this->canExportJavascript()) |
|
| 891 | 891 | { |
| 892 | 892 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
| 893 | 893 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -896,13 +896,13 @@ discard block |
||
| 896 | 896 | $sHash = $this->generateHash(); |
| 897 | 897 | $sOutFile = $sHash . '.js'; |
| 898 | 898 | $sMinFile = $sHash . '.min.js'; |
| 899 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
| 899 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
| 900 | 900 | { |
| 901 | 901 | file_put_contents($sJsAppDir . $sOutFile, $this->getAllScripts()); |
| 902 | 902 | } |
| 903 | - if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 903 | + if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 904 | 904 | { |
| 905 | - if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 905 | + if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 906 | 906 | { |
| 907 | 907 | $sOutFile = $sMinFile; |
| 908 | 908 | } |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | */ |
| 936 | 936 | public function getResponsePlugin($sName) |
| 937 | 937 | { |
| 938 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
| 938 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
| 939 | 939 | { |
| 940 | 940 | return $this->aResponsePlugins[$sName]; |
| 941 | 941 | } |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | */ |
| 952 | 952 | public function getRequestPlugin($sName) |
| 953 | 953 | { |
| 954 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
| 954 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
| 955 | 955 | { |
| 956 | 956 | return $this->aRequestPlugins[$sName]; |
| 957 | 957 | } |
@@ -14,18 +14,18 @@ |
||
| 14 | 14 | jaxon.config.defaultMode = "<?php echo $this->sDefaultMode ?>"; |
| 15 | 15 | jaxon.config.defaultMethod = "<?php echo $this->sDefaultMethod ?>"; |
| 16 | 16 | jaxon.config.responseType = "<?php echo $this->sResponseType ?>"; |
| 17 | -<?php if($this->nResponseQueueSize > 0): ?> |
|
| 17 | +<?php if ($this->nResponseQueueSize > 0): ?> |
|
| 18 | 18 | jaxon.config.responseQueueSize = <?php echo $this->nResponseQueueSize ?>; |
| 19 | 19 | <?php endif ?> |
| 20 | -<?php if(($this->bDebug)): ?> |
|
| 21 | -<?php if(($this->sDebugOutputID)): ?> |
|
| 20 | +<?php if (($this->bDebug)): ?> |
|
| 21 | +<?php if (($this->sDebugOutputID)): ?> |
|
| 22 | 22 | jaxon.debug.outputID = "<?php echo $this->sDebugOutputID ?>"; |
| 23 | 23 | <?php endif ?> |
| 24 | -<?php if(($this->bVerboseDebug)): ?> |
|
| 24 | +<?php if (($this->bVerboseDebug)): ?> |
|
| 25 | 25 | jaxon.debug.verbose.active = true; |
| 26 | 26 | <?php endif ?> |
| 27 | 27 | <?php endif ?> |
| 28 | -<?php if(($this->sCsrfMetaName)): ?> |
|
| 28 | +<?php if (($this->sCsrfMetaName)): ?> |
|
| 29 | 29 | metaTags = document.getElementsByTagName('meta'); |
| 30 | 30 | for(i = 0; i < metaTags.length; i++) |
| 31 | 31 | { |