@@ -135,14 +135,6 @@ |
||
| 135 | 135 | * Options include: |
| 136 | 136 | * - Jaxon::USER_FUNCTION: a function declared at global scope |
| 137 | 137 | * - Jaxon::CALLABLE_OBJECT: an object who's methods are to be registered |
| 138 | - * @param mixed $sFunction | $objObject |
|
| 139 | - * When registering a function, this is the name of the function |
|
| 140 | - * When registering a callable object, this is the object being registered |
|
| 141 | - * @param mixed $sIncludeFile | $aCallOptions |
|
| 142 | - * When registering a function, this is an (optional) array |
|
| 143 | - * of call options, or the (optional) include file |
|
| 144 | - * When registering a callable object, this is an (optional) array |
|
| 145 | - * of call options for the functions being registered |
|
| 146 | 138 | * |
| 147 | 139 | * @return mixed |
| 148 | 140 | */ |
@@ -211,16 +211,16 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function getScript($bIncludeJs = false, $bIncludeCss = false) |
| 213 | 213 | { |
| 214 | - if(!$this->getOption('core.request.uri')) |
|
| 214 | + if (!$this->getOption('core.request.uri')) |
|
| 215 | 215 | { |
| 216 | 216 | $this->setOption('core.request.uri', URI::detect()); |
| 217 | 217 | } |
| 218 | 218 | $sCode = ''; |
| 219 | - if(($bIncludeCss)) |
|
| 219 | + if (($bIncludeCss)) |
|
| 220 | 220 | { |
| 221 | 221 | $sCode .= $this->getPluginManager()->getCss() . "\n"; |
| 222 | 222 | } |
| 223 | - if(($bIncludeJs)) |
|
| 223 | + if (($bIncludeJs)) |
|
| 224 | 224 | { |
| 225 | 225 | $sCode .= $this->getPluginManager()->getJs() . "\n"; |
| 226 | 226 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | public function processRequest() |
| 292 | 292 | { |
| 293 | 293 | // Check to see if headers have already been sent out, in which case we can't do our job |
| 294 | - if(headers_sent($filename, $linenumber)) |
|
| 294 | + if (headers_sent($filename, $linenumber)) |
|
| 295 | 295 | { |
| 296 | 296 | echo $this->trans('errors.output.already-sent', array( |
| 297 | 297 | 'location' => $filename . ':' . $linenumber |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | // Check if there is a plugin to process this request |
| 303 | - if(!$this->canProcessRequest()) |
|
| 303 | + if (!$this->canProcessRequest()) |
|
| 304 | 304 | { |
| 305 | 305 | return; |
| 306 | 306 | } |
@@ -310,18 +310,18 @@ discard block |
||
| 310 | 310 | $xResponseManager = $this->getResponseManager(); |
| 311 | 311 | |
| 312 | 312 | // Handle before processing event |
| 313 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 313 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE])) |
|
| 314 | 314 | { |
| 315 | 315 | $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest)); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if(!$bEndRequest) |
|
| 318 | + if (!$bEndRequest) |
|
| 319 | 319 | { |
| 320 | 320 | try |
| 321 | 321 | { |
| 322 | 322 | $mResult = $this->getPluginManager()->processRequest(); |
| 323 | 323 | } |
| 324 | - catch(Exception $e) |
|
| 324 | + catch (Exception $e) |
|
| 325 | 325 | { |
| 326 | 326 | // An exception was thrown while processing the request. |
| 327 | 327 | // The request missed the corresponding handler function, |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $xResponseManager->debug($e->getMessage()); |
| 334 | 334 | $mResult = false; |
| 335 | 335 | |
| 336 | - if($e instanceof \Jaxon\Exception\Error) |
|
| 336 | + if ($e instanceof \Jaxon\Exception\Error) |
|
| 337 | 337 | { |
| 338 | 338 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 339 | 339 | $aParams = array($e->getMessage()); |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $aParams = array($e); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - if(isset($this->aProcessingEvents[$sEvent])) |
|
| 347 | + if (isset($this->aProcessingEvents[$sEvent])) |
|
| 348 | 348 | { |
| 349 | 349 | // Call the processing event |
| 350 | 350 | $this->aProcessingEvents[$sEvent]->call($aParams); |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | // Clean the processing buffer |
| 360 | - if(($this->getOption('core.process.clean'))) |
|
| 360 | + if (($this->getOption('core.process.clean'))) |
|
| 361 | 361 | { |
| 362 | 362 | $er = error_reporting(0); |
| 363 | 363 | while (ob_get_level() > 0) |
@@ -367,16 +367,16 @@ discard block |
||
| 367 | 367 | error_reporting($er); |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if($mResult === true) |
|
| 370 | + if ($mResult === true) |
|
| 371 | 371 | { |
| 372 | 372 | // Handle after processing event |
| 373 | - if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 373 | + if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER])) |
|
| 374 | 374 | { |
| 375 | 375 | $bEndRequest = false; |
| 376 | 376 | $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest)); |
| 377 | 377 | } |
| 378 | 378 | // If the called function returned no response, give the the global response instead |
| 379 | - if($xResponseManager->hasNoResponse()) |
|
| 379 | + if ($xResponseManager->hasNoResponse()) |
|
| 380 | 380 | { |
| 381 | 381 | $xResponseManager->append($this->getResponse()); |
| 382 | 382 | } |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $xResponseManager->printDebug(); |
| 386 | 386 | |
| 387 | - if(($this->getOption('core.process.exit'))) |
|
| 387 | + if (($this->getOption('core.process.exit'))) |
|
| 388 | 388 | { |
| 389 | 389 | $xResponseManager->sendOutput(); |
| 390 | 390 | exit(); |
@@ -320,8 +320,7 @@ discard block |
||
| 320 | 320 | try |
| 321 | 321 | { |
| 322 | 322 | $mResult = $this->getPluginManager()->processRequest(); |
| 323 | - } |
|
| 324 | - catch(Exception $e) |
|
| 323 | + } catch(Exception $e) |
|
| 325 | 324 | { |
| 326 | 325 | // An exception was thrown while processing the request. |
| 327 | 326 | // The request missed the corresponding handler function, |
@@ -337,8 +336,7 @@ discard block |
||
| 337 | 336 | { |
| 338 | 337 | $sEvent = self::PROCESSING_EVENT_INVALID; |
| 339 | 338 | $aParams = array($e->getMessage()); |
| 340 | - } |
|
| 341 | - else |
|
| 339 | + } else |
|
| 342 | 340 | { |
| 343 | 341 | $sEvent = self::PROCESSING_EVENT_ERROR; |
| 344 | 342 | $aParams = array($e); |
@@ -348,8 +346,7 @@ discard block |
||
| 348 | 346 | { |
| 349 | 347 | // Call the processing event |
| 350 | 348 | $this->aProcessingEvents[$sEvent]->call($aParams); |
| 351 | - } |
|
| 352 | - else |
|
| 349 | + } else |
|
| 353 | 350 | { |
| 354 | 351 | // The exception is not to be processed here. |
| 355 | 352 | throw $e; |
@@ -22,11 +22,8 @@ |
||
| 22 | 22 | namespace Jaxon\Plugin; |
| 23 | 23 | |
| 24 | 24 | use Jaxon\Jaxon; |
| 25 | -use Jaxon\Plugin\Package; |
|
| 26 | 25 | use RecursiveDirectoryIterator; |
| 27 | 26 | use RecursiveIteratorIterator; |
| 28 | -use RegexIterator; |
|
| 29 | -use RecursiveRegexIterator; |
|
| 30 | 27 | use Closure; |
| 31 | 28 | |
| 32 | 29 | class Manager |
@@ -267,32 +267,32 @@ discard block |
||
| 267 | 267 | { |
| 268 | 268 | $bIsAlert = ($xPlugin instanceof \Jaxon\Request\Interfaces\Alert); |
| 269 | 269 | $bIsConfirm = ($xPlugin instanceof \Jaxon\Request\Interfaces\Confirm); |
| 270 | - if($xPlugin instanceof Request) |
|
| 270 | + if ($xPlugin instanceof Request) |
|
| 271 | 271 | { |
| 272 | 272 | // The name of a request plugin is used as key in the plugin table |
| 273 | 273 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 274 | 274 | } |
| 275 | - elseif($xPlugin instanceof Response) |
|
| 275 | + elseif ($xPlugin instanceof Response) |
|
| 276 | 276 | { |
| 277 | 277 | // The name of a response plugin is used as key in the plugin table |
| 278 | 278 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 279 | 279 | } |
| 280 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
| 280 | + elseif (!$bIsConfirm && !$bIsAlert) |
|
| 281 | 281 | { |
| 282 | 282 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin)))); |
| 283 | 283 | } |
| 284 | 284 | // This plugin implements the Alert interface |
| 285 | - if($bIsAlert) |
|
| 285 | + if ($bIsAlert) |
|
| 286 | 286 | { |
| 287 | 287 | $this->setAlert($xPlugin); |
| 288 | 288 | } |
| 289 | 289 | // This plugin implements the Confirm interface |
| 290 | - if($bIsConfirm) |
|
| 290 | + if ($bIsConfirm) |
|
| 291 | 291 | { |
| 292 | 292 | $this->setConfirm($xPlugin); |
| 293 | 293 | } |
| 294 | 294 | // Register the plugin as an event listener |
| 295 | - if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 295 | + if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 296 | 296 | { |
| 297 | 297 | $this->addEventListener($xPlugin); |
| 298 | 298 | } |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | private function generateHash() |
| 323 | 323 | { |
| 324 | 324 | $sHash = $this->getVersion(); |
| 325 | - foreach($this->aPlugins as $xPlugin) |
|
| 325 | + foreach ($this->aPlugins as $xPlugin) |
|
| 326 | 326 | { |
| 327 | 327 | $sHash .= $xPlugin->generateHash(); |
| 328 | 328 | } |
@@ -339,9 +339,9 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | public function canProcessRequest() |
| 341 | 341 | { |
| 342 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 342 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 343 | 343 | { |
| 344 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 344 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 345 | 345 | { |
| 346 | 346 | return true; |
| 347 | 347 | } |
@@ -360,12 +360,12 @@ discard block |
||
| 360 | 360 | public function processRequest() |
| 361 | 361 | { |
| 362 | 362 | $xUploadPlugin = $this->getRequestPlugin(Jaxon::FILE_UPLOAD); |
| 363 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 363 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 364 | 364 | { |
| 365 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 365 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
| 366 | 366 | { |
| 367 | 367 | // Process uploaded files |
| 368 | - if($xUploadPlugin != null) |
|
| 368 | + if ($xUploadPlugin != null) |
|
| 369 | 369 | { |
| 370 | 370 | $xUploadPlugin->processRequest(); |
| 371 | 371 | } |
@@ -389,10 +389,10 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | public function register($aArgs) |
| 391 | 391 | { |
| 392 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 392 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 393 | 393 | { |
| 394 | 394 | $mResult = $xPlugin->register($aArgs); |
| 395 | - if($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true) |
|
| 395 | + if ($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true) |
|
| 396 | 396 | { |
| 397 | 397 | return $mResult; |
| 398 | 398 | } |
@@ -412,37 +412,37 @@ discard block |
||
| 412 | 412 | */ |
| 413 | 413 | public function addClassDir($sDirectory, $sNamespace = '', $sSeparator = '.', array $aProtected = []) |
| 414 | 414 | { |
| 415 | - if(!is_dir(($sDirectory = trim($sDirectory)))) |
|
| 415 | + if (!is_dir(($sDirectory = trim($sDirectory)))) |
|
| 416 | 416 | { |
| 417 | 417 | return false; |
| 418 | 418 | } |
| 419 | 419 | // Only '.' and '_' are allowed to be used as separator. Any other value is ignored and '.' is used instead. |
| 420 | - if(($sSeparator = trim($sSeparator)) != '_') |
|
| 420 | + if (($sSeparator = trim($sSeparator)) != '_') |
|
| 421 | 421 | { |
| 422 | 422 | $sSeparator = '.'; |
| 423 | 423 | } |
| 424 | - if(!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 424 | + if (!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 425 | 425 | { |
| 426 | 426 | $sNamespace = ''; |
| 427 | 427 | } |
| 428 | - if(($sNamespace)) |
|
| 428 | + if (($sNamespace)) |
|
| 429 | 429 | { |
| 430 | 430 | // If there is an autoloader, register the dir with PSR4 autoloading |
| 431 | - if(($this->xAutoloader)) |
|
| 431 | + if (($this->xAutoloader)) |
|
| 432 | 432 | { |
| 433 | 433 | $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory); |
| 434 | 434 | } |
| 435 | 435 | } |
| 436 | - elseif(($this->xAutoloader)) |
|
| 436 | + elseif (($this->xAutoloader)) |
|
| 437 | 437 | { |
| 438 | 438 | // If there is an autoloader, register the dir with classmap autoloading |
| 439 | 439 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
| 440 | 440 | $itFile = new RecursiveIteratorIterator($itDir); |
| 441 | 441 | // Iterate on dir content |
| 442 | - foreach($itFile as $xFile) |
|
| 442 | + foreach ($itFile as $xFile) |
|
| 443 | 443 | { |
| 444 | 444 | // skip everything except PHP files |
| 445 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 445 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 446 | 446 | { |
| 447 | 447 | continue; |
| 448 | 448 | } |
@@ -478,33 +478,33 @@ discard block |
||
| 478 | 478 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
| 479 | 479 | $sClassPath = str_replace($sDS, '\\', trim($sClassPath, $sDS)); |
| 480 | 480 | $sClassName = $xFile->getBasename('.php'); |
| 481 | - if(($sNamespace)) |
|
| 481 | + if (($sNamespace)) |
|
| 482 | 482 | { |
| 483 | 483 | $sClassPath = ($sClassPath) ? $sNamespace . '\\' . $sClassPath : $sNamespace; |
| 484 | 484 | $sClassName = '\\' . $sClassPath . '\\' . $sClassName; |
| 485 | 485 | } |
| 486 | 486 | // Require the file only if autoload is enabled but there is no autoloader |
| 487 | - if(($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
| 487 | + if (($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
| 488 | 488 | { |
| 489 | 489 | require_once($xFile->getPathname()); |
| 490 | 490 | } |
| 491 | 491 | // Create and register an instance of the class |
| 492 | - if(!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
| 492 | + if (!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
| 493 | 493 | { |
| 494 | 494 | $aOptions['*'] = []; |
| 495 | 495 | } |
| 496 | 496 | $aOptions['*']['separator'] = $sSeparator; |
| 497 | - if(($sNamespace)) |
|
| 497 | + if (($sNamespace)) |
|
| 498 | 498 | { |
| 499 | 499 | $aOptions['*']['namespace'] = $sNamespace; |
| 500 | 500 | } |
| 501 | - if(($sClassPath)) |
|
| 501 | + if (($sClassPath)) |
|
| 502 | 502 | { |
| 503 | 503 | $aOptions['*']['classpath'] = $sClassPath; |
| 504 | 504 | } |
| 505 | 505 | // Filter excluded methods |
| 506 | - $aProtected = array_filter($aProtected, function ($sName) {return is_string($sName);}); |
|
| 507 | - if(count($aProtected) > 0) |
|
| 506 | + $aProtected = array_filter($aProtected, function($sName) {return is_string($sName); }); |
|
| 507 | + if (count($aProtected) > 0) |
|
| 508 | 508 | { |
| 509 | 509 | $aOptions['*']['protected'] = $aProtected; |
| 510 | 510 | } |
@@ -523,13 +523,13 @@ discard block |
||
| 523 | 523 | $sDS = DIRECTORY_SEPARATOR; |
| 524 | 524 | // Change the keys in $aOptions to have "\" as separator |
| 525 | 525 | $aNewOptions = []; |
| 526 | - foreach($aOptions as $key => $aOption) |
|
| 526 | + foreach ($aOptions as $key => $aOption) |
|
| 527 | 527 | { |
| 528 | 528 | $key = trim(str_replace(['.', '_'], ['\\', '\\'], $key), ' \\'); |
| 529 | 529 | $aNewOptions[$key] = $aOption; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | - foreach($this->aClassDirs as $aClassDir) |
|
| 532 | + foreach ($this->aClassDirs as $aClassDir) |
|
| 533 | 533 | { |
| 534 | 534 | // Get the directory |
| 535 | 535 | $sDirectory = $aClassDir['directory']; |
@@ -539,10 +539,10 @@ discard block |
||
| 539 | 539 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
| 540 | 540 | $itFile = new RecursiveIteratorIterator($itDir); |
| 541 | 541 | // Iterate on dir content |
| 542 | - foreach($itFile as $xFile) |
|
| 542 | + foreach ($itFile as $xFile) |
|
| 543 | 543 | { |
| 544 | 544 | // skip everything except PHP files |
| 545 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 545 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
| 546 | 546 | { |
| 547 | 547 | continue; |
| 548 | 548 | } |
@@ -551,17 +551,17 @@ discard block |
||
| 551 | 551 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
| 552 | 552 | $sClassPath = trim(str_replace($sDS, '\\', $sClassPath), '\\'); |
| 553 | 553 | $sClassName = $xFile->getBasename('.php'); |
| 554 | - if(($sClassPath)) |
|
| 554 | + if (($sClassPath)) |
|
| 555 | 555 | { |
| 556 | 556 | $sClassName = $sClassPath . '\\' . $sClassName; |
| 557 | 557 | } |
| 558 | - if(($sNamespace)) |
|
| 558 | + if (($sNamespace)) |
|
| 559 | 559 | { |
| 560 | 560 | $sClassName = $sNamespace . '\\' . $sClassName; |
| 561 | 561 | } |
| 562 | 562 | // Get the class options |
| 563 | 563 | $aClassOptions = []; |
| 564 | - if(array_key_exists($sClassName, $aNewOptions)) |
|
| 564 | + if (array_key_exists($sClassName, $aNewOptions)) |
|
| 565 | 565 | { |
| 566 | 566 | $aClassOptions = $aNewOptions[$sClassName]; |
| 567 | 567 | } |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | */ |
| 583 | 583 | public function registerClass($sClassName, array $aOptions = []) |
| 584 | 584 | { |
| 585 | - if(!($sClassName = trim($sClassName, ' \\._'))) |
|
| 585 | + if (!($sClassName = trim($sClassName, ' \\._'))) |
|
| 586 | 586 | { |
| 587 | 587 | return false; |
| 588 | 588 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | // Replace "." and "_" with antislashes, and set the class path. |
| 592 | 592 | $sClassName = str_replace(['.', '_'], ['\\', '\\'], $sClassName); |
| 593 | 593 | $sClassPath = ''; |
| 594 | - if(($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
| 594 | + if (($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
| 595 | 595 | { |
| 596 | 596 | $sClassPath = substr($sClassName, 0, $nLastSlashPosition); |
| 597 | 597 | $sClassName = substr($sClassName, $nLastSlashPosition + 1); |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | $sPartPath = str_replace('\\', $sDS, $sClassPath) . $sDS . $sClassName . '.php'; |
| 601 | 601 | |
| 602 | 602 | // Search for the class file in all directories. |
| 603 | - foreach($this->aClassDirs as $aClassDir) |
|
| 603 | + foreach ($this->aClassDirs as $aClassDir) |
|
| 604 | 604 | { |
| 605 | 605 | // Get the separator |
| 606 | 606 | $sSeparator = $aClassDir['separator']; |
@@ -609,15 +609,15 @@ discard block |
||
| 609 | 609 | $nLen = strlen($sNamespace); |
| 610 | 610 | $sFullPath = ''; |
| 611 | 611 | // Check if the class belongs to the namespace |
| 612 | - if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
| 612 | + if (($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
| 613 | 613 | { |
| 614 | 614 | $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1); |
| 615 | 615 | } |
| 616 | - elseif(!($sNamespace)) |
|
| 616 | + elseif (!($sNamespace)) |
|
| 617 | 617 | { |
| 618 | 618 | $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath; |
| 619 | 619 | } |
| 620 | - if(($sFullPath) && is_file($sFullPath)) |
|
| 620 | + if (($sFullPath) && is_file($sFullPath)) |
|
| 621 | 621 | { |
| 622 | 622 | // Found the file in this directory |
| 623 | 623 | $xFileInfo = new \SplFileInfo($sFullPath); |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | { |
| 642 | 642 | $xObject = null; // The user registered object |
| 643 | 643 | $xPlugin = $this->getRequestPlugin('CallableObject'); // The CallableObject plugin |
| 644 | - if(($xPlugin)) |
|
| 644 | + if (($xPlugin)) |
|
| 645 | 645 | { |
| 646 | 646 | $xObject = $xPlugin->getRegisteredObject($sClassName); |
| 647 | 647 | } |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | */ |
| 656 | 656 | private function getJsLibUri() |
| 657 | 657 | { |
| 658 | - if(!$this->hasOption('js.lib.uri')) |
|
| 658 | + if (!$this->hasOption('js.lib.uri')) |
|
| 659 | 659 | { |
| 660 | 660 | // return 'https://cdn.jsdelivr.net/jaxon/1.2.0/'; |
| 661 | 661 | return 'https://cdn.jsdelivr.net/gh/jaxon-php/[email protected]/dist/'; |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | // The jsDelivr CDN only hosts minified files |
| 679 | 679 | // if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri) |
| 680 | 680 | // Starting from version 2.0.0 of the js lib, the jsDelivr CDN also hosts non minified files. |
| 681 | - if(($this->getOption('js.app.minify'))) |
|
| 681 | + if (($this->getOption('js.app.minify'))) |
|
| 682 | 682 | { |
| 683 | 683 | return '.min.js'; |
| 684 | 684 | } |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | // Check config options |
| 696 | 696 | // - The js.app.extern option must be set to true |
| 697 | 697 | // - The js.app.uri and js.app.dir options must be set to non null values |
| 698 | - if(!$this->getOption('js.app.extern') || |
|
| 698 | + if (!$this->getOption('js.app.extern') || |
|
| 699 | 699 | !$this->getOption('js.app.uri') || |
| 700 | 700 | !$this->getOption('js.app.dir')) |
| 701 | 701 | { |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | // Check dir access |
| 705 | 705 | // - The js.app.dir must be writable |
| 706 | 706 | $sJsAppDir = $this->getOption('js.app.dir'); |
| 707 | - if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 707 | + if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 708 | 708 | { |
| 709 | 709 | return false; |
| 710 | 710 | } |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | */ |
| 719 | 719 | private function setTemplateCacheDir() |
| 720 | 720 | { |
| 721 | - if($this->hasOption('core.template.cache_dir')) |
|
| 721 | + if ($this->hasOption('core.template.cache_dir')) |
|
| 722 | 722 | { |
| 723 | 723 | $this->setCacheDir($this->getOption('core.template.cache_dir')); |
| 724 | 724 | } |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | |
| 741 | 741 | // Add component files to the javascript file array; |
| 742 | 742 | $aJsFiles = array($sJsCoreUrl); |
| 743 | - if($this->getOption('core.debug.on')) |
|
| 743 | + if ($this->getOption('core.debug.on')) |
|
| 744 | 744 | { |
| 745 | 745 | $aJsFiles[] = $sJsDebugUrl; |
| 746 | 746 | $aJsFiles[] = $sJsLanguageUrl; |
@@ -756,17 +756,17 @@ discard block |
||
| 756 | 756 | 'sJsOptions' => $this->getOption('js.app.options'), |
| 757 | 757 | 'aUrls' => $aJsFiles, |
| 758 | 758 | )); |
| 759 | - foreach($this->aResponsePlugins as $xPlugin) |
|
| 759 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
| 760 | 760 | { |
| 761 | - if(($str = trim($xPlugin->getJs()))) |
|
| 761 | + if (($str = trim($xPlugin->getJs()))) |
|
| 762 | 762 | { |
| 763 | 763 | $sCode .= rtrim($str, " \n") . "\n"; |
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | - foreach($this->aPackages as $sClass) |
|
| 766 | + foreach ($this->aPackages as $sClass) |
|
| 767 | 767 | { |
| 768 | 768 | $xPackage = jaxon()->di()->get($sClass); |
| 769 | - if(($str = trim($xPackage->js()))) |
|
| 769 | + if (($str = trim($xPackage->js()))) |
|
| 770 | 770 | { |
| 771 | 771 | $sCode .= rtrim($str, " \n") . "\n"; |
| 772 | 772 | } |
@@ -785,17 +785,17 @@ discard block |
||
| 785 | 785 | $this->setTemplateCacheDir(); |
| 786 | 786 | |
| 787 | 787 | $sCode = ''; |
| 788 | - foreach($this->aResponsePlugins as $xPlugin) |
|
| 788 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
| 789 | 789 | { |
| 790 | - if(($str = trim($xPlugin->getCss()))) |
|
| 790 | + if (($str = trim($xPlugin->getCss()))) |
|
| 791 | 791 | { |
| 792 | 792 | $sCode .= rtrim($str, " \n") . "\n"; |
| 793 | 793 | } |
| 794 | 794 | } |
| 795 | - foreach($this->aPackages as $sClass) |
|
| 795 | + foreach ($this->aPackages as $sClass) |
|
| 796 | 796 | { |
| 797 | 797 | $xPackage = jaxon()->di()->get($sClass); |
| 798 | - if(($str = trim($xPackage->css()))) |
|
| 798 | + if (($str = trim($xPackage->css()))) |
|
| 799 | 799 | { |
| 800 | 800 | $sCode .= rtrim($str, " \n") . "\n"; |
| 801 | 801 | } |
@@ -859,17 +859,17 @@ discard block |
||
| 859 | 859 | private function getReadyScript() |
| 860 | 860 | { |
| 861 | 861 | $sPluginScript = ''; |
| 862 | - foreach($this->aResponsePlugins as $xPlugin) |
|
| 862 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
| 863 | 863 | { |
| 864 | - if(($str = trim($xPlugin->getScript()))) |
|
| 864 | + if (($str = trim($xPlugin->getScript()))) |
|
| 865 | 865 | { |
| 866 | 866 | $sPluginScript .= "\n" . trim($str, " \n"); |
| 867 | 867 | } |
| 868 | 868 | } |
| 869 | - foreach($this->aPackages as $sClass) |
|
| 869 | + foreach ($this->aPackages as $sClass) |
|
| 870 | 870 | { |
| 871 | 871 | $xPackage = jaxon()->di()->get($sClass); |
| 872 | - if(($str = trim($xPackage->ready()))) |
|
| 872 | + if (($str = trim($xPackage->ready()))) |
|
| 873 | 873 | { |
| 874 | 874 | $sPluginScript .= "\n" . trim($str, " \n"); |
| 875 | 875 | } |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | { |
| 893 | 893 | // Get the config and plugins scripts |
| 894 | 894 | $sScript = $this->getConfigScript() . "\n" . $this->getReadyScript() . "\n"; |
| 895 | - foreach($this->aRequestPlugins as $xPlugin) |
|
| 895 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
| 896 | 896 | { |
| 897 | 897 | $sScript .= "\n" . trim($xPlugin->getScript(), " \n"); |
| 898 | 898 | } |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | // Set the template engine cache dir |
| 915 | 915 | $this->setTemplateCacheDir(); |
| 916 | 916 | |
| 917 | - if($this->canExportJavascript()) |
|
| 917 | + if ($this->canExportJavascript()) |
|
| 918 | 918 | { |
| 919 | 919 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
| 920 | 920 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -923,13 +923,13 @@ discard block |
||
| 923 | 923 | $sHash = $this->generateHash(); |
| 924 | 924 | $sOutFile = $sHash . '.js'; |
| 925 | 925 | $sMinFile = $sHash . '.min.js'; |
| 926 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
| 926 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
| 927 | 927 | { |
| 928 | 928 | file_put_contents($sJsAppDir . $sOutFile, $this->getAllScripts()); |
| 929 | 929 | } |
| 930 | - if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 930 | + if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 931 | 931 | { |
| 932 | - if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 932 | + if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 933 | 933 | { |
| 934 | 934 | $sOutFile = $sMinFile; |
| 935 | 935 | } |
@@ -962,7 +962,7 @@ discard block |
||
| 962 | 962 | */ |
| 963 | 963 | public function getResponsePlugin($sName) |
| 964 | 964 | { |
| 965 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
| 965 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
| 966 | 966 | { |
| 967 | 967 | return $this->aResponsePlugins[$sName]; |
| 968 | 968 | } |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | */ |
| 979 | 979 | public function getRequestPlugin($sName) |
| 980 | 980 | { |
| 981 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
| 981 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
| 982 | 982 | { |
| 983 | 983 | return $this->aRequestPlugins[$sName]; |
| 984 | 984 | } |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | * |
| 77 | 77 | * @param array $aArgs An array containing the function specification |
| 78 | 78 | * |
| 79 | - * @return \Jaxon\Request\Request |
|
| 79 | + * @return boolean |
|
| 80 | 80 | */ |
| 81 | 81 | public function register($aArgs) |
| 82 | 82 | { |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $this->sRequestedFunction = null; |
| 53 | 53 | |
| 54 | - if(isset($_GET['jxnfun'])) |
|
| 54 | + if (isset($_GET['jxnfun'])) |
|
| 55 | 55 | { |
| 56 | 56 | $this->sRequestedFunction = $_GET['jxnfun']; |
| 57 | 57 | } |
| 58 | - if(isset($_POST['jxnfun'])) |
|
| 58 | + if (isset($_POST['jxnfun'])) |
|
| 59 | 59 | { |
| 60 | 60 | $this->sRequestedFunction = $_POST['jxnfun']; |
| 61 | 61 | } |
@@ -80,30 +80,30 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function register($aArgs) |
| 82 | 82 | { |
| 83 | - if(count($aArgs) < 2) |
|
| 83 | + if (count($aArgs) < 2) |
|
| 84 | 84 | { |
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $sType = $aArgs[0]; |
| 89 | - if($sType != Jaxon::USER_FUNCTION) |
|
| 89 | + if ($sType != Jaxon::USER_FUNCTION) |
|
| 90 | 90 | { |
| 91 | 91 | return false; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $sUserFunction = $aArgs[1]; |
| 95 | - if(!is_string($sUserFunction)) |
|
| 95 | + if (!is_string($sUserFunction)) |
|
| 96 | 96 | { |
| 97 | 97 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration')); |
| 98 | 98 | } |
| 99 | 99 | $this->aFunctions[] = $sUserFunction; |
| 100 | 100 | |
| 101 | 101 | $aOptions = count($aArgs) > 2 ? $aArgs[2] : []; |
| 102 | - if(is_string($aOptions)) |
|
| 102 | + if (is_string($aOptions)) |
|
| 103 | 103 | { |
| 104 | 104 | $aOptions = ['include' => $aOptions]; |
| 105 | 105 | } |
| 106 | - if(!is_array($aOptions)) |
|
| 106 | + if (!is_array($aOptions)) |
|
| 107 | 107 | { |
| 108 | 108 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration')); |
| 109 | 109 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | jaxon()->di()->set($sUserFunction, function() use($sUserFunction, $aOptions) { |
| 112 | 112 | $xUserFunction = new \Jaxon\Request\Support\UserFunction($sUserFunction); |
| 113 | 113 | |
| 114 | - foreach($aOptions as $sName => $sValue) |
|
| 114 | + foreach ($aOptions as $sName => $sValue) |
|
| 115 | 115 | { |
| 116 | 116 | $xUserFunction->configure($sName, $sValue); |
| 117 | 117 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | $di = jaxon()->di(); |
| 143 | 143 | $code = ''; |
| 144 | - foreach($this->aFunctions as $sName) |
|
| 144 | + foreach ($this->aFunctions as $sName) |
|
| 145 | 145 | { |
| 146 | 146 | $xFunction = $di->get($sName); |
| 147 | 147 | $code .= $xFunction->getScript(); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | public function canProcessRequest() |
| 158 | 158 | { |
| 159 | 159 | // Check the validity of the function name |
| 160 | - if(($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction)) |
|
| 160 | + if (($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction)) |
|
| 161 | 161 | { |
| 162 | 162 | $this->sRequestedFunction = null; |
| 163 | 163 | } |
@@ -171,12 +171,12 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function processRequest() |
| 173 | 173 | { |
| 174 | - if(!$this->canProcessRequest()) |
|
| 174 | + if (!$this->canProcessRequest()) |
|
| 175 | 175 | { |
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if(!key_exists($this->sRequestedFunction, $this->aFunctions)) |
|
| 179 | + if (!key_exists($this->sRequestedFunction, $this->aFunctions)) |
|
| 180 | 180 | { |
| 181 | 181 | // Unable to find the requested function |
| 182 | 182 | throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid', |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function hasPageNumber() |
| 72 | 72 | { |
| 73 | - foreach($this->aParameters as $xParameter) |
|
| 73 | + foreach ($this->aParameters as $xParameter) |
|
| 74 | 74 | { |
| 75 | - if($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 75 | + if ($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 76 | 76 | { |
| 77 | 77 | return true; |
| 78 | 78 | } |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | public function setPageNumber($nPageNumber) |
| 91 | 91 | { |
| 92 | 92 | // Set the value of the Jaxon::PAGE_NUMBER parameter |
| 93 | - foreach($this->aParameters as $xParameter) |
|
| 93 | + foreach ($this->aParameters as $xParameter) |
|
| 94 | 94 | { |
| 95 | - if($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 95 | + if ($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 96 | 96 | { |
| 97 | 97 | $xParameter->setValue(intval($nPageNumber)); |
| 98 | 98 | break; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $this->sCondition = '__confirm__'; |
| 114 | 114 | $this->aMessageArgs = func_get_args(); |
| 115 | - array_walk($this->aMessageArgs, function (&$xParameter) { |
|
| 115 | + array_walk($this->aMessageArgs, function(&$xParameter) { |
|
| 116 | 116 | $xParameter = Parameter::make($xParameter); |
| 117 | 117 | }); |
| 118 | 118 | return $this; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | public function elseShow($sMessage) |
| 246 | 246 | { |
| 247 | 247 | $this->aMessageArgs = func_get_args(); |
| 248 | - array_walk($this->aMessageArgs, function (&$xParameter) { |
|
| 248 | + array_walk($this->aMessageArgs, function(&$xParameter) { |
|
| 249 | 249 | $xParameter = Parameter::make($xParameter); |
| 250 | 250 | }); |
| 251 | 251 | return $this; |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | // This array will avoid declaring multiple variables with the same value. |
| 271 | 271 | // The array key is the variable value, while the array value is the variable name. |
| 272 | 272 | $aVariables = []; // Array of local variables. |
| 273 | - foreach($this->aParameters as &$xParameter) |
|
| 273 | + foreach ($this->aParameters as &$xParameter) |
|
| 274 | 274 | { |
| 275 | 275 | $sParameterStr = $xParameter->getScript(); |
| 276 | - if($xParameter instanceof \Jaxon\JQuery\Dom\Element) |
|
| 276 | + if ($xParameter instanceof \Jaxon\JQuery\Dom\Element) |
|
| 277 | 277 | { |
| 278 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
| 278 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
| 279 | 279 | { |
| 280 | 280 | // The value is not yet defined. A new variable is created. |
| 281 | 281 | $sVarName = "jxnVar$nVarId"; |
@@ -293,19 +293,19 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | $sPhrase = ''; |
| 296 | - if(count($this->aMessageArgs) > 0) |
|
| 296 | + if (count($this->aMessageArgs) > 0) |
|
| 297 | 297 | { |
| 298 | 298 | $sPhrase = array_shift($this->aMessageArgs); // The first array entry is the question. |
| 299 | 299 | // $sPhrase = "'" . addslashes($sPhrase) . "'"; // Wrap the phrase with single quotes |
| 300 | - if(count($this->aMessageArgs) > 0) |
|
| 300 | + if (count($this->aMessageArgs) > 0) |
|
| 301 | 301 | { |
| 302 | 302 | $nParamId = 1; |
| 303 | - foreach($this->aMessageArgs as &$xParameter) |
|
| 303 | + foreach ($this->aMessageArgs as &$xParameter) |
|
| 304 | 304 | { |
| 305 | 305 | $sParameterStr = $xParameter->getScript(); |
| 306 | - if($xParameter instanceof \Jaxon\JQuery\Dom\Element) |
|
| 306 | + if ($xParameter instanceof \Jaxon\JQuery\Dom\Element) |
|
| 307 | 307 | { |
| 308 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
| 308 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
| 309 | 309 | { |
| 310 | 310 | // The value is not yet defined. A new variable is created. |
| 311 | 311 | $sVarName = "jxnVar$nVarId"; |
@@ -328,15 +328,15 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $sScript = $this->getOption('core.prefix.' . $this->sType) . parent::getScript(); |
| 331 | - if($this->sCondition == '__confirm__') |
|
| 331 | + if ($this->sCondition == '__confirm__') |
|
| 332 | 332 | { |
| 333 | 333 | $xConfirm = $this->getPluginManager()->getConfirm(); |
| 334 | 334 | $sScript = $xConfirm->confirm($sPhrase, $sScript, ''); |
| 335 | 335 | } |
| 336 | - elseif($this->sCondition !== null) |
|
| 336 | + elseif ($this->sCondition !== null) |
|
| 337 | 337 | { |
| 338 | 338 | $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}'; |
| 339 | - if(($sPhrase)) |
|
| 339 | + if (($sPhrase)) |
|
| 340 | 340 | { |
| 341 | 341 | $xAlert = $this->getPluginManager()->getAlert(); |
| 342 | 342 | $xAlert->setReturn(true); |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | $this->aArgs = []; |
| 56 | 56 | $this->nMethod = Jaxon::METHOD_UNKNOWN; |
| 57 | 57 | |
| 58 | - if(isset($_POST['jxnargs'])) |
|
| 58 | + if (isset($_POST['jxnargs'])) |
|
| 59 | 59 | { |
| 60 | 60 | $this->nMethod = Jaxon::METHOD_POST; |
| 61 | 61 | $this->aArgs = $_POST['jxnargs']; |
| 62 | 62 | } |
| 63 | - elseif(isset($_GET['jxnargs'])) |
|
| 63 | + elseif (isset($_GET['jxnargs'])) |
|
| 64 | 64 | { |
| 65 | 65 | $this->nMethod = Jaxon::METHOD_GET; |
| 66 | 66 | $this->aArgs = $_GET['jxnargs']; |
| 67 | 67 | } |
| 68 | - if(get_magic_quotes_gpc() == 1) |
|
| 68 | + if (get_magic_quotes_gpc() == 1) |
|
| 69 | 69 | { |
| 70 | 70 | array_walk($this->aArgs, array(&$this, '__argumentStripSlashes')); |
| 71 | 71 | } |
@@ -81,17 +81,17 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | private function __convertStringToBool($sValue) |
| 83 | 83 | { |
| 84 | - if(strcasecmp($sValue, 'true') == 0) |
|
| 84 | + if (strcasecmp($sValue, 'true') == 0) |
|
| 85 | 85 | { |
| 86 | 86 | return true; |
| 87 | 87 | } |
| 88 | - if(strcasecmp($sValue, 'false') == 0) |
|
| 88 | + if (strcasecmp($sValue, 'false') == 0) |
|
| 89 | 89 | { |
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | - if(is_numeric($sValue)) |
|
| 92 | + if (is_numeric($sValue)) |
|
| 93 | 93 | { |
| 94 | - if($sValue == 0) |
|
| 94 | + if ($sValue == 0) |
|
| 95 | 95 | { |
| 96 | 96 | return false; |
| 97 | 97 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | private function __argumentStripSlashes(&$sArg) |
| 111 | 111 | { |
| 112 | - if(!is_string($sArg)) |
|
| 112 | + if (!is_string($sArg)) |
|
| 113 | 113 | { |
| 114 | 114 | return ''; |
| 115 | 115 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | private function __argumentDecode(&$sArg) |
| 159 | 159 | { |
| 160 | - if($sArg == '') |
|
| 160 | + if ($sArg == '') |
|
| 161 | 161 | { |
| 162 | 162 | return ''; |
| 163 | 163 | } |
@@ -166,22 +166,22 @@ discard block |
||
| 166 | 166 | $sType = 'multipart/form-data'; |
| 167 | 167 | $iLen = strlen($sType); |
| 168 | 168 | $sContentType = ''; |
| 169 | - if(key_exists('CONTENT_TYPE', $_SERVER)) |
|
| 169 | + if (key_exists('CONTENT_TYPE', $_SERVER)) |
|
| 170 | 170 | { |
| 171 | 171 | $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen); |
| 172 | 172 | } |
| 173 | - elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 173 | + elseif (key_exists('HTTP_CONTENT_TYPE', $_SERVER)) |
|
| 174 | 174 | { |
| 175 | 175 | $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen); |
| 176 | 176 | } |
| 177 | - if($sContentType == $sType) |
|
| 177 | + if ($sContentType == $sType) |
|
| 178 | 178 | { |
| 179 | 179 | $sArg = urldecode($sArg); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $data = json_decode($sArg, true); |
| 183 | 183 | |
| 184 | - if($data !== null && $sArg != $data) |
|
| 184 | + if ($data !== null && $sArg != $data) |
|
| 185 | 185 | { |
| 186 | 186 | $sArg = $data; |
| 187 | 187 | } |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | private function __argumentDecodeUTF8_iconv(&$mArg) |
| 202 | 202 | { |
| 203 | - if(is_array($mArg)) |
|
| 203 | + if (is_array($mArg)) |
|
| 204 | 204 | { |
| 205 | - foreach($mArg as $sKey => &$xArg) |
|
| 205 | + foreach ($mArg as $sKey => &$xArg) |
|
| 206 | 206 | { |
| 207 | 207 | $sNewKey = $sKey; |
| 208 | 208 | $this->__argumentDecodeUTF8_iconv($sNewKey); |
| 209 | - if($sNewKey != $sKey) |
|
| 209 | + if ($sNewKey != $sKey) |
|
| 210 | 210 | { |
| 211 | 211 | $mArg[$sNewKey] = $xArg; |
| 212 | 212 | unset($mArg[$sKey]); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $this->__argumentDecodeUTF8_iconv($xArg); |
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | - elseif(is_string($mArg)) |
|
| 218 | + elseif (is_string($mArg)) |
|
| 219 | 219 | { |
| 220 | 220 | $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg); |
| 221 | 221 | } |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | private function __argumentDecodeUTF8_mb_convert_encoding(&$mArg) |
| 232 | 232 | { |
| 233 | - if(is_array($mArg)) |
|
| 233 | + if (is_array($mArg)) |
|
| 234 | 234 | { |
| 235 | - foreach($mArg as $sKey => &$xArg) |
|
| 235 | + foreach ($mArg as $sKey => &$xArg) |
|
| 236 | 236 | { |
| 237 | 237 | $sNewKey = $sKey; |
| 238 | 238 | $this->__argumentDecodeUTF8_mb_convert_encoding($sNewKey); |
| 239 | - if($sNewKey != $sKey) |
|
| 239 | + if ($sNewKey != $sKey) |
|
| 240 | 240 | { |
| 241 | 241 | $mArg[$sNewKey] = $xArg; |
| 242 | 242 | unset($mArg[$sKey]); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $this->__argumentDecodeUTF8_mb_convert_encoding($xArg); |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - elseif(is_string($mArg)) |
|
| 248 | + elseif (is_string($mArg)) |
|
| 249 | 249 | { |
| 250 | 250 | $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8"); |
| 251 | 251 | } |
@@ -260,14 +260,14 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | private function __argumentDecodeUTF8_utf8_decode(&$mArg) |
| 262 | 262 | { |
| 263 | - if(is_array($mArg)) |
|
| 263 | + if (is_array($mArg)) |
|
| 264 | 264 | { |
| 265 | - foreach($mArg as $sKey => &$xArg) |
|
| 265 | + foreach ($mArg as $sKey => &$xArg) |
|
| 266 | 266 | { |
| 267 | 267 | $sNewKey = $sKey; |
| 268 | 268 | $this->__argumentDecodeUTF8_utf8_decode($sNewKey); |
| 269 | 269 | |
| 270 | - if($sNewKey != $sKey) |
|
| 270 | + if ($sNewKey != $sKey) |
|
| 271 | 271 | { |
| 272 | 272 | $mArg[$sNewKey] = $xArg; |
| 273 | 273 | unset($mArg[$sKey]); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $this->__argumentDecodeUTF8_utf8_decode($xArg); |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | - elseif(is_string($mArg)) |
|
| 280 | + elseif (is_string($mArg)) |
|
| 281 | 281 | { |
| 282 | 282 | $mArg = utf8_decode($mArg); |
| 283 | 283 | } |
@@ -302,19 +302,19 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function process() |
| 304 | 304 | { |
| 305 | - if(($this->getOption('core.decode_utf8'))) |
|
| 305 | + if (($this->getOption('core.decode_utf8'))) |
|
| 306 | 306 | { |
| 307 | 307 | $sFunction = ''; |
| 308 | 308 | |
| 309 | - if(function_exists('iconv')) |
|
| 309 | + if (function_exists('iconv')) |
|
| 310 | 310 | { |
| 311 | 311 | $sFunction = "iconv"; |
| 312 | 312 | } |
| 313 | - elseif(function_exists('mb_convert_encoding')) |
|
| 313 | + elseif (function_exists('mb_convert_encoding')) |
|
| 314 | 314 | { |
| 315 | 315 | $sFunction = "mb_convert_encoding"; |
| 316 | 316 | } |
| 317 | - elseif($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 317 | + elseif ($this->getOption('core.encoding') == "ISO-8859-1") |
|
| 318 | 318 | { |
| 319 | 319 | $sFunction = "utf8_decode"; |
| 320 | 320 | } |
@@ -67,19 +67,19 @@ discard block |
||
| 67 | 67 | $this->sRequestedClass = null; |
| 68 | 68 | $this->sRequestedMethod = null; |
| 69 | 69 | |
| 70 | - if(!empty($_GET['jxncls'])) |
|
| 70 | + if (!empty($_GET['jxncls'])) |
|
| 71 | 71 | { |
| 72 | 72 | $this->sRequestedClass = $_GET['jxncls']; |
| 73 | 73 | } |
| 74 | - if(!empty($_GET['jxnmthd'])) |
|
| 74 | + if (!empty($_GET['jxnmthd'])) |
|
| 75 | 75 | { |
| 76 | 76 | $this->sRequestedMethod = $_GET['jxnmthd']; |
| 77 | 77 | } |
| 78 | - if(!empty($_POST['jxncls'])) |
|
| 78 | + if (!empty($_POST['jxncls'])) |
|
| 79 | 79 | { |
| 80 | 80 | $this->sRequestedClass = $_POST['jxncls']; |
| 81 | 81 | } |
| 82 | - if(!empty($_POST['jxnmthd'])) |
|
| 82 | + if (!empty($_POST['jxnmthd'])) |
|
| 83 | 83 | { |
| 84 | 84 | $this->sRequestedMethod = $_POST['jxnmthd']; |
| 85 | 85 | } |
@@ -104,19 +104,19 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function register($aArgs) |
| 106 | 106 | { |
| 107 | - if(count($aArgs) < 2) |
|
| 107 | + if (count($aArgs) < 2) |
|
| 108 | 108 | { |
| 109 | 109 | return false; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $sType = $aArgs[0]; |
| 113 | - if($sType != Jaxon::CALLABLE_OBJECT) |
|
| 113 | + if ($sType != Jaxon::CALLABLE_OBJECT) |
|
| 114 | 114 | { |
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | $sCallableObject = $aArgs[1]; |
| 119 | - if(!is_string($sCallableObject) || !class_exists($sCallableObject)) |
|
| 119 | + if (!is_string($sCallableObject) || !class_exists($sCallableObject)) |
|
| 120 | 120 | { |
| 121 | 121 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
| 122 | 122 | } |
@@ -124,31 +124,31 @@ discard block |
||
| 124 | 124 | $this->aCallableObjects[] = $sCallableObject; |
| 125 | 125 | |
| 126 | 126 | $aOptions = count($aArgs) > 2 ? $aArgs[2] : []; |
| 127 | - if(is_string($aOptions)) |
|
| 127 | + if (is_string($aOptions)) |
|
| 128 | 128 | { |
| 129 | 129 | $aOptions = ['namespace' => $aOptions]; |
| 130 | 130 | } |
| 131 | - if(!is_array($aOptions)) |
|
| 131 | + if (!is_array($aOptions)) |
|
| 132 | 132 | { |
| 133 | 133 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // Save the classpath and the separator in this class |
| 137 | - if(key_exists('*', $aOptions) && is_array($aOptions['*'])) |
|
| 137 | + if (key_exists('*', $aOptions) && is_array($aOptions['*'])) |
|
| 138 | 138 | { |
| 139 | 139 | $_aOptions = $aOptions['*']; |
| 140 | 140 | $sSeparator = '.'; |
| 141 | - if(key_exists('separator', $_aOptions)) |
|
| 141 | + if (key_exists('separator', $_aOptions)) |
|
| 142 | 142 | { |
| 143 | 143 | $sSeparator = trim($_aOptions['separator']); |
| 144 | 144 | } |
| 145 | - if(!in_array($sSeparator, ['.', '_'])) |
|
| 145 | + if (!in_array($sSeparator, ['.', '_'])) |
|
| 146 | 146 | { |
| 147 | 147 | $sSeparator = '.'; |
| 148 | 148 | } |
| 149 | 149 | $_aOptions['separator'] = $sSeparator; |
| 150 | 150 | |
| 151 | - if(array_key_exists('classpath', $_aOptions)) |
|
| 151 | + if (array_key_exists('classpath', $_aOptions)) |
|
| 152 | 152 | { |
| 153 | 153 | $_aOptions['classpath'] = trim($_aOptions['classpath'], ' \\._'); |
| 154 | 154 | // Save classpath with "\" in the parameters |
@@ -161,9 +161,9 @@ discard block |
||
| 161 | 161 | jaxon()->di()->set($sUserFunction, function() use($sCallableObject, $aOptions) { |
| 162 | 162 | $xCallableObject = new \Jaxon\Request\Support\CallableObject($sCallableObject); |
| 163 | 163 | |
| 164 | - foreach($aOptions as $sMethod => $aValue) |
|
| 164 | + foreach ($aOptions as $sMethod => $aValue) |
|
| 165 | 165 | { |
| 166 | - foreach($aValue as $sName => $sValue) |
|
| 166 | + foreach ($aValue as $sName => $sValue) |
|
| 167 | 167 | { |
| 168 | 168 | $xCallableObject->configure($sMethod, $sName, $sValue); |
| 169 | 169 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | $di = jaxon()->di(); |
| 186 | 186 | $sHash = ''; |
| 187 | - foreach($this->aCallableObjects as $sName) |
|
| 187 | + foreach ($this->aCallableObjects as $sName) |
|
| 188 | 188 | { |
| 189 | 189 | $xCallableObject = $di->get($sName); |
| 190 | 190 | $sHash .= $sName . implode('|', $xCallableObject->getMethods()); |
@@ -203,15 +203,15 @@ discard block |
||
| 203 | 203 | // Generate code for javascript objects declaration |
| 204 | 204 | $code = ''; |
| 205 | 205 | $classes = []; |
| 206 | - foreach($this->aClassPaths as $sClassPath) |
|
| 206 | + foreach ($this->aClassPaths as $sClassPath) |
|
| 207 | 207 | { |
| 208 | 208 | $offset = 0; |
| 209 | 209 | $sClassPath .= '.Null'; // This is a sentinel. The last token is not processed in the while loop. |
| 210 | - while(($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
| 210 | + while (($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
| 211 | 211 | { |
| 212 | 212 | $class = substr($sClassPath, 0, $dotPosition); |
| 213 | 213 | // Generate code for this object |
| 214 | - if(!array_key_exists($class, $classes)) |
|
| 214 | + if (!array_key_exists($class, $classes)) |
|
| 215 | 215 | { |
| 216 | 216 | $code .= "$sJaxonPrefix$class = {};\n"; |
| 217 | 217 | $classes[$class] = $class; |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | // Generate code for javascript methods |
| 223 | 223 | $di = jaxon()->di(); |
| 224 | - foreach($this->aCallableObjects as $sName) |
|
| 224 | + foreach ($this->aCallableObjects as $sName) |
|
| 225 | 225 | { |
| 226 | 226 | $xCallableObject = $di->get($sName); |
| 227 | 227 | $code .= $xCallableObject->getScript(); |
@@ -237,13 +237,13 @@ discard block |
||
| 237 | 237 | public function canProcessRequest() |
| 238 | 238 | { |
| 239 | 239 | // Check the validity of the class name |
| 240 | - if(($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
| 240 | + if (($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
| 241 | 241 | { |
| 242 | 242 | $this->sRequestedClass = null; |
| 243 | 243 | $this->sRequestedMethod = null; |
| 244 | 244 | } |
| 245 | 245 | // Check the validity of the method name |
| 246 | - if(($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
| 246 | + if (($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
| 247 | 247 | { |
| 248 | 248 | $this->sRequestedClass = null; |
| 249 | 249 | $this->sRequestedMethod = null; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | public function processRequest() |
| 260 | 260 | { |
| 261 | - if(!$this->canProcessRequest()) |
|
| 261 | + if (!$this->canProcessRequest()) |
|
| 262 | 262 | { |
| 263 | 263 | return false; |
| 264 | 264 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | // Find the requested method |
| 269 | 269 | $xCallableObject = $this->getCallableObject($this->sRequestedClass); |
| 270 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 270 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 271 | 271 | { |
| 272 | 272 | // Unable to find the requested object or method |
| 273 | 273 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // at the beginning and the end of the class name. |
| 293 | 293 | $sClassName = trim(str_replace(['.', '_'], ['\\', '\\'], (string)$sClassName), '\\'); |
| 294 | 294 | // Register an instance of the requested class, if it isn't yet |
| 295 | - if(!key_exists($sClassName, $this->aCallableObjects)) |
|
| 295 | + if (!key_exists($sClassName, $this->aCallableObjects)) |
|
| 296 | 296 | { |
| 297 | 297 | $this->getPluginManager()->registerClass($sClassName); |
| 298 | 298 | } |
@@ -110,15 +110,15 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | private function setCallable($xCallable = null) |
| 112 | 112 | { |
| 113 | - if($xCallable == null) |
|
| 113 | + if ($xCallable == null) |
|
| 114 | 114 | { |
| 115 | 115 | $di = jaxon()->di(); |
| 116 | 116 | // Use the Reflection class to get the parameters of the constructor |
| 117 | - if(($constructor = $this->reflectionClass->getConstructor()) != null) |
|
| 117 | + if (($constructor = $this->reflectionClass->getConstructor()) != null) |
|
| 118 | 118 | { |
| 119 | 119 | $parameters = $constructor->getParameters(); |
| 120 | 120 | $parameterInstances = []; |
| 121 | - foreach($parameters as $parameter) |
|
| 121 | + foreach ($parameters as $parameter) |
|
| 122 | 122 | { |
| 123 | 123 | // Get the parameter instance from the DI |
| 124 | 124 | $parameterInstances[] = $di->get($parameter->getClass()->getName()); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | // Save the Jaxon callable object into the user callable object |
| 134 | - if($this->reflectionClass->hasMethod('setJaxonCallable')) |
|
| 134 | + if ($this->reflectionClass->hasMethod('setJaxonCallable')) |
|
| 135 | 135 | { |
| 136 | 136 | $xCallable->setJaxonCallable($this); |
| 137 | 137 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function getRegisteredObject() |
| 147 | 147 | { |
| 148 | - if($this->callableObject == null) |
|
| 148 | + if ($this->callableObject == null) |
|
| 149 | 149 | { |
| 150 | 150 | $this->setCallable(); |
| 151 | 151 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | // The class name without the namespace. |
| 174 | 174 | $name = $this->reflectionClass->getShortName(); |
| 175 | 175 | // Append the classpath to the name |
| 176 | - if(($this->classpath)) |
|
| 176 | + if (($this->classpath)) |
|
| 177 | 177 | { |
| 178 | 178 | $name = $this->classpath . '\\' . $name; |
| 179 | 179 | } |
@@ -220,16 +220,16 @@ discard block |
||
| 220 | 220 | public function getMethods() |
| 221 | 221 | { |
| 222 | 222 | $aReturn = []; |
| 223 | - foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
| 223 | + foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
| 224 | 224 | { |
| 225 | 225 | $sMethodName = $xMethod->getShortName(); |
| 226 | 226 | // Don't take magic __call, __construct, __destruct methods |
| 227 | - if(strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
| 227 | + if (strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
| 228 | 228 | { |
| 229 | 229 | continue; |
| 230 | 230 | } |
| 231 | 231 | // Don't take excluded methods |
| 232 | - if(in_array($sMethodName, $this->aProtectedMethods)) |
|
| 232 | + if (in_array($sMethodName, $this->aProtectedMethods)) |
|
| 233 | 233 | { |
| 234 | 234 | continue; |
| 235 | 235 | } |
@@ -250,37 +250,37 @@ discard block |
||
| 250 | 250 | public function configure($sMethod, $sName, $sValue) |
| 251 | 251 | { |
| 252 | 252 | // Set the namespace |
| 253 | - if($sName == 'namespace') |
|
| 253 | + if ($sName == 'namespace') |
|
| 254 | 254 | { |
| 255 | - if($sValue != '') |
|
| 255 | + if ($sValue != '') |
|
| 256 | 256 | $this->namespace = $sValue; |
| 257 | 257 | return; |
| 258 | 258 | } |
| 259 | 259 | // Set the classpath |
| 260 | - if($sName == 'classpath') |
|
| 260 | + if ($sName == 'classpath') |
|
| 261 | 261 | { |
| 262 | - if($sValue != '') |
|
| 262 | + if ($sValue != '') |
|
| 263 | 263 | $this->classpath = trim($sValue, '\\'); |
| 264 | 264 | return; |
| 265 | 265 | } |
| 266 | 266 | // Set the separator |
| 267 | - if($sName == 'separator') |
|
| 267 | + if ($sName == 'separator') |
|
| 268 | 268 | { |
| 269 | - if($sValue == '_' || $sValue == '.') |
|
| 269 | + if ($sValue == '_' || $sValue == '.') |
|
| 270 | 270 | $this->separator = $sValue; |
| 271 | 271 | return; |
| 272 | 272 | } |
| 273 | 273 | // Set the excluded methods |
| 274 | - if($sName == 'protected') |
|
| 274 | + if ($sName == 'protected') |
|
| 275 | 275 | { |
| 276 | - if(is_array($sValue)) |
|
| 276 | + if (is_array($sValue)) |
|
| 277 | 277 | $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
| 278 | - elseif(is_string($sValue)) |
|
| 278 | + elseif (is_string($sValue)) |
|
| 279 | 279 | $this->aProtectedMethods[] = $sValue; |
| 280 | 280 | return; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - if(!isset($this->aConfiguration[$sMethod])) |
|
| 283 | + if (!isset($this->aConfiguration[$sMethod])) |
|
| 284 | 284 | { |
| 285 | 285 | $this->aConfiguration[$sMethod] = []; |
| 286 | 286 | } |
@@ -301,16 +301,16 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | // Common options to be set on all methods |
| 303 | 303 | $aCommonConfig = array_key_exists('*', $this->aConfiguration) ? $this->aConfiguration['*'] : []; |
| 304 | - foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
| 304 | + foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
| 305 | 305 | { |
| 306 | 306 | $sMethodName = $xMethod->getShortName(); |
| 307 | 307 | // Don't export magic __call, __construct, __destruct methods |
| 308 | - if(strlen($sMethodName) > 0 && substr($sMethodName, 0, 2) == '__') |
|
| 308 | + if (strlen($sMethodName) > 0 && substr($sMethodName, 0, 2) == '__') |
|
| 309 | 309 | { |
| 310 | 310 | continue; |
| 311 | 311 | } |
| 312 | 312 | // Don't export "protected" methods |
| 313 | - if(in_array($sMethodName, $this->aProtectedMethods)) |
|
| 313 | + if (in_array($sMethodName, $this->aProtectedMethods)) |
|
| 314 | 314 | { |
| 315 | 315 | continue; |
| 316 | 316 | } |
@@ -360,14 +360,14 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function call($sMethod, $aArgs) |
| 362 | 362 | { |
| 363 | - if(!$this->hasMethod($sMethod)) |
|
| 363 | + if (!$this->hasMethod($sMethod)) |
|
| 364 | 364 | { |
| 365 | 365 | return; |
| 366 | 366 | } |
| 367 | 367 | $reflectionMethod = $this->reflectionClass->getMethod($sMethod); |
| 368 | 368 | $callableObject = $this->getRegisteredObject(); |
| 369 | 369 | $response = $reflectionMethod->invokeArgs($callableObject, $aArgs); |
| 370 | - if(($response)) |
|
| 370 | + if (($response)) |
|
| 371 | 371 | { |
| 372 | 372 | $this->getResponseManager()->append($response); |
| 373 | 373 | } |
@@ -124,8 +124,7 @@ discard block |
||
| 124 | 124 | $parameterInstances[] = $di->get($parameter->getClass()->getName()); |
| 125 | 125 | } |
| 126 | 126 | $xCallable = $this->reflectionClass->newInstanceArgs($parameterInstances); |
| 127 | - } |
|
| 128 | - else |
|
| 127 | + } else |
|
| 129 | 128 | { |
| 130 | 129 | $xCallable = $this->reflectionClass->newInstance(); |
| 131 | 130 | } |
@@ -252,31 +251,35 @@ discard block |
||
| 252 | 251 | // Set the namespace |
| 253 | 252 | if($sName == 'namespace') |
| 254 | 253 | { |
| 255 | - if($sValue != '') |
|
| 256 | - $this->namespace = $sValue; |
|
| 254 | + if($sValue != '') { |
|
| 255 | + $this->namespace = $sValue; |
|
| 256 | + } |
|
| 257 | 257 | return; |
| 258 | 258 | } |
| 259 | 259 | // Set the classpath |
| 260 | 260 | if($sName == 'classpath') |
| 261 | 261 | { |
| 262 | - if($sValue != '') |
|
| 263 | - $this->classpath = trim($sValue, '\\'); |
|
| 262 | + if($sValue != '') { |
|
| 263 | + $this->classpath = trim($sValue, '\\'); |
|
| 264 | + } |
|
| 264 | 265 | return; |
| 265 | 266 | } |
| 266 | 267 | // Set the separator |
| 267 | 268 | if($sName == 'separator') |
| 268 | 269 | { |
| 269 | - if($sValue == '_' || $sValue == '.') |
|
| 270 | - $this->separator = $sValue; |
|
| 270 | + if($sValue == '_' || $sValue == '.') { |
|
| 271 | + $this->separator = $sValue; |
|
| 272 | + } |
|
| 271 | 273 | return; |
| 272 | 274 | } |
| 273 | 275 | // Set the excluded methods |
| 274 | 276 | if($sName == 'protected') |
| 275 | 277 | { |
| 276 | - if(is_array($sValue)) |
|
| 277 | - $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
|
| 278 | - elseif(is_string($sValue)) |
|
| 279 | - $this->aProtectedMethods[] = $sValue; |
|
| 278 | + if(is_array($sValue)) { |
|
| 279 | + $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
|
| 280 | + } elseif(is_string($sValue)) { |
|
| 281 | + $this->aProtectedMethods[] = $sValue; |
|
| 282 | + } |
|
| 280 | 283 | return; |
| 281 | 284 | } |
| 282 | 285 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function getName() |
| 78 | 78 | { |
| 79 | 79 | // Do not use sAlias here! |
| 80 | - if(is_array($this->sUserFunction)) |
|
| 80 | + if (is_array($this->sUserFunction)) |
|
| 81 | 81 | { |
| 82 | 82 | return $this->sUserFunction[1]; |
| 83 | 83 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function configure($sName, $sValue) |
| 96 | 96 | { |
| 97 | - switch($sName) |
|
| 97 | + switch ($sName) |
|
| 98 | 98 | { |
| 99 | 99 | case 'class': // The user function is a method in the given class |
| 100 | 100 | $this->sUserFunction = [$sValue, $this->sUserFunction]; |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function call($aArgs = []) |
| 153 | 153 | { |
| 154 | - if(($this->sInclude)) |
|
| 154 | + if (($this->sInclude)) |
|
| 155 | 155 | { |
| 156 | 156 | require_once $this->sInclude; |
| 157 | 157 | } |
| 158 | 158 | $response = call_user_func_array($this->sUserFunction, $aArgs); |
| 159 | - if(($response)) |
|
| 159 | + if (($response)) |
|
| 160 | 160 | { |
| 161 | 161 | $this->getResponseManager()->append($response); |
| 162 | 162 | } |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | $this->aCalls = []; |
| 59 | 59 | |
| 60 | 60 | $jQueryNs = jaxon()->getOption('core.jquery.no_conflict', false) ? 'jQuery' : '$'; |
| 61 | - if(!$sSelector) |
|
| 61 | + if (!$sSelector) |
|
| 62 | 62 | { |
| 63 | 63 | $this->sSelector = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead |
| 64 | 64 | } |
| 65 | - elseif(($sContext)) |
|
| 65 | + elseif (($sContext)) |
|
| 66 | 66 | { |
| 67 | 67 | $this->sSelector = "$jQueryNs('" . $sSelector . "', $jQueryNs('" . $sContext . "'))"; |
| 68 | 68 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function getScript() |
| 120 | 120 | { |
| 121 | - if(count($this->aCalls) == 0) |
|
| 121 | + if (count($this->aCalls) == 0) |
|
| 122 | 122 | { |
| 123 | 123 | return $this->sSelector; |
| 124 | 124 | } |