@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php echo $this->sPrefix ?><?php echo $this->sAlias ?> = function() { |
2 | 2 | return jaxon.request( |
3 | 3 | { jxnfun: '<?php echo $this->sFunction ?>' }, |
4 | - { parameters: arguments<?php foreach($this->aConfig as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> } |
|
4 | + { parameters: arguments<?php foreach ($this->aConfig as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> } |
|
5 | 5 | ); |
6 | 6 | }; |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php echo $this->sPrefix ?><?php echo $this->sClass ?> = {}; |
2 | -<?php foreach($this->aMethods as $aMethod): ?> |
|
2 | +<?php foreach ($this->aMethods as $aMethod): ?> |
|
3 | 3 | <?php echo $this->sPrefix ?><?php echo $this->sClass ?>.<?php echo $aMethod['name'] ?> = function() { |
4 | 4 | return jaxon.request( |
5 | 5 | { jxncls: '<?php echo $this->sClass ?>', jxnmthd: '<?php echo $aMethod['name'] ?>' }, |
6 | - { parameters: arguments<?php foreach($aMethod['config'] as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> } |
|
6 | + { parameters: arguments<?php foreach ($aMethod['config'] as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> } |
|
7 | 7 | ); |
8 | 8 | }; |
9 | 9 | <?php endforeach ?> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php echo $this->sPrefix ?><?php echo $this->sEvent ?> = function() { |
2 | 2 | return jaxon.request( |
3 | 3 | { jxnevt: '<?php echo $this->sEvent ?>' }, |
4 | - { parameters: arguments<?php if(($this->sMode)): ?>, mode: '<?php echo $this->sMode ?>'<?php endif ?><?php if(($this->sMethod)): ?>, method: '<?php echo $this->sMethod ?>'<?php endif ?> } |
|
4 | + { parameters: arguments<?php if (($this->sMode)): ?>, mode: '<?php echo $this->sMode ?>'<?php endif ?><?php if (($this->sMethod)): ?>, method: '<?php echo $this->sMethod ?>'<?php endif ?> } |
|
5 | 5 | ); |
6 | 6 | }; |
@@ -1,3 +1,3 @@ |
||
1 | -<?php foreach($this->aUrls as $sUrl): ?> |
|
1 | +<?php foreach ($this->aUrls as $sUrl): ?> |
|
2 | 2 | <script type="text/javascript" src="<?php echo $sUrl ?>" <?php echo $this->sJsOptions ?> charset="UTF-8"></script> |
3 | 3 | <?php endforeach ?> |
@@ -1,7 +1,7 @@ |
||
1 | 1 | jaxon.dom.ready(function() { |
2 | 2 | jaxon.command.handler.register('cc', jaxon.confirm.commands); |
3 | 3 | |
4 | -<?php if($this->sPluginScript): ?> |
|
4 | +<?php if ($this->sPluginScript): ?> |
|
5 | 5 | <?php echo $this->sPluginScript ?> |
6 | 6 | <?php endif ?> |
7 | 7 | }); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | * |
101 | 101 | * @param array $aArgs An array containing the callable object specification |
102 | 102 | * |
103 | - * @return array |
|
103 | + * @return boolean |
|
104 | 104 | */ |
105 | 105 | public function register($aArgs) |
106 | 106 | { |
@@ -255,8 +255,7 @@ discard block |
||
255 | 255 | { |
256 | 256 | $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory); |
257 | 257 | } |
258 | - } |
|
259 | - elseif(($this->xAutoloader)) |
|
258 | + } elseif(($this->xAutoloader)) |
|
260 | 259 | { |
261 | 260 | // If there is an autoloader, register the dir with classmap autoloading |
262 | 261 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
@@ -435,8 +434,7 @@ discard block |
||
435 | 434 | if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
436 | 435 | { |
437 | 436 | $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1); |
438 | - } |
|
439 | - elseif(!($sNamespace)) |
|
437 | + } elseif(!($sNamespace)) |
|
440 | 438 | { |
441 | 439 | $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath; |
442 | 440 | } |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | $this->sRequestedClass = null; |
92 | 92 | $this->sRequestedMethod = null; |
93 | 93 | |
94 | - if(!empty($_GET['jxncls'])) |
|
94 | + if (!empty($_GET['jxncls'])) |
|
95 | 95 | { |
96 | 96 | $this->sRequestedClass = $_GET['jxncls']; |
97 | 97 | } |
98 | - if(!empty($_GET['jxnmthd'])) |
|
98 | + if (!empty($_GET['jxnmthd'])) |
|
99 | 99 | { |
100 | 100 | $this->sRequestedMethod = $_GET['jxnmthd']; |
101 | 101 | } |
102 | - if(!empty($_POST['jxncls'])) |
|
102 | + if (!empty($_POST['jxncls'])) |
|
103 | 103 | { |
104 | 104 | $this->sRequestedClass = $_POST['jxncls']; |
105 | 105 | } |
106 | - if(!empty($_POST['jxnmthd'])) |
|
106 | + if (!empty($_POST['jxnmthd'])) |
|
107 | 107 | { |
108 | 108 | $this->sRequestedMethod = $_POST['jxnmthd']; |
109 | 109 | } |
@@ -152,19 +152,19 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function register($aArgs) |
154 | 154 | { |
155 | - if(count($aArgs) < 2) |
|
155 | + if (count($aArgs) < 2) |
|
156 | 156 | { |
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | |
160 | 160 | $sType = $aArgs[0]; |
161 | - if($sType != Jaxon::CALLABLE_OBJECT) |
|
161 | + if ($sType != Jaxon::CALLABLE_OBJECT) |
|
162 | 162 | { |
163 | 163 | return false; |
164 | 164 | } |
165 | 165 | |
166 | 166 | $sCallableObject = $aArgs[1]; |
167 | - if(!is_string($sCallableObject) || !class_exists($sCallableObject)) |
|
167 | + if (!is_string($sCallableObject) || !class_exists($sCallableObject)) |
|
168 | 168 | { |
169 | 169 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
170 | 170 | } |
@@ -172,31 +172,31 @@ discard block |
||
172 | 172 | $this->aCallableObjects[] = $sCallableObject; |
173 | 173 | |
174 | 174 | $aOptions = count($aArgs) > 2 ? $aArgs[2] : []; |
175 | - if(is_string($aOptions)) |
|
175 | + if (is_string($aOptions)) |
|
176 | 176 | { |
177 | 177 | $aOptions = ['namespace' => $aOptions]; |
178 | 178 | } |
179 | - if(!is_array($aOptions)) |
|
179 | + if (!is_array($aOptions)) |
|
180 | 180 | { |
181 | 181 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
182 | 182 | } |
183 | 183 | |
184 | 184 | // Save the classpath and the separator in this class |
185 | - if(key_exists('*', $aOptions) && is_array($aOptions['*'])) |
|
185 | + if (key_exists('*', $aOptions) && is_array($aOptions['*'])) |
|
186 | 186 | { |
187 | 187 | $_aOptions = $aOptions['*']; |
188 | 188 | $sSeparator = '.'; |
189 | - if(key_exists('separator', $_aOptions)) |
|
189 | + if (key_exists('separator', $_aOptions)) |
|
190 | 190 | { |
191 | 191 | $sSeparator = trim($_aOptions['separator']); |
192 | 192 | } |
193 | - if(!in_array($sSeparator, ['.', '_'])) |
|
193 | + if (!in_array($sSeparator, ['.', '_'])) |
|
194 | 194 | { |
195 | 195 | $sSeparator = '.'; |
196 | 196 | } |
197 | 197 | $_aOptions['separator'] = $sSeparator; |
198 | 198 | |
199 | - if(array_key_exists('classpath', $_aOptions)) |
|
199 | + if (array_key_exists('classpath', $_aOptions)) |
|
200 | 200 | { |
201 | 201 | $_aOptions['classpath'] = trim($_aOptions['classpath'], ' \\._'); |
202 | 202 | // Save classpath with "\" in the parameters |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | // Register the callable object |
210 | - jaxon()->di()->set($sCallableObject, function () use ($sCallableObject, $aOptions) { |
|
210 | + jaxon()->di()->set($sCallableObject, function() use ($sCallableObject, $aOptions) { |
|
211 | 211 | $xCallableObject = new \Jaxon\Request\Support\CallableObject($sCallableObject); |
212 | 212 | |
213 | - foreach($aOptions as $sMethod => $aValue) |
|
213 | + foreach ($aOptions as $sMethod => $aValue) |
|
214 | 214 | { |
215 | - foreach($aValue as $sName => $sValue) |
|
215 | + foreach ($aValue as $sName => $sValue) |
|
216 | 216 | { |
217 | 217 | $xCallableObject->configure($sMethod, $sName, $sValue); |
218 | 218 | } |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | }); |
223 | 223 | |
224 | 224 | // Register the request factory for this callable object |
225 | - jaxon()->di()->set($sCallableObject . '\Factory\Rq', function ($di) use ($sCallableObject) { |
|
225 | + jaxon()->di()->set($sCallableObject . '\Factory\Rq', function($di) use ($sCallableObject) { |
|
226 | 226 | $xCallableObject = $di->get($sCallableObject); |
227 | 227 | return new \Jaxon\Factory\Request\Portable($xCallableObject); |
228 | 228 | }); |
229 | 229 | |
230 | 230 | // Register the paginator factory for this callable object |
231 | - jaxon()->di()->set($sCallableObject . '\Factory\Pg', function ($di) use ($sCallableObject) { |
|
231 | + jaxon()->di()->set($sCallableObject . '\Factory\Pg', function($di) use ($sCallableObject) { |
|
232 | 232 | $xCallableObject = $di->get($sCallableObject); |
233 | 233 | return new \Jaxon\Factory\Request\Paginator($xCallableObject); |
234 | 234 | }); |
@@ -248,37 +248,37 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function addClassDir($sDirectory, $sNamespace = '', $sSeparator = '.', array $aProtected = []) |
250 | 250 | { |
251 | - if(!is_dir(($sDirectory = trim($sDirectory)))) |
|
251 | + if (!is_dir(($sDirectory = trim($sDirectory)))) |
|
252 | 252 | { |
253 | 253 | return false; |
254 | 254 | } |
255 | 255 | // Only '.' and '_' are allowed to be used as separator. Any other value is ignored and '.' is used instead. |
256 | - if(($sSeparator = trim($sSeparator)) != '_') |
|
256 | + if (($sSeparator = trim($sSeparator)) != '_') |
|
257 | 257 | { |
258 | 258 | $sSeparator = '.'; |
259 | 259 | } |
260 | - if(!($sNamespace = trim($sNamespace, ' \\'))) |
|
260 | + if (!($sNamespace = trim($sNamespace, ' \\'))) |
|
261 | 261 | { |
262 | 262 | $sNamespace = ''; |
263 | 263 | } |
264 | - if(($sNamespace)) |
|
264 | + if (($sNamespace)) |
|
265 | 265 | { |
266 | 266 | // If there is an autoloader, register the dir with PSR4 autoloading |
267 | - if(($this->xAutoloader)) |
|
267 | + if (($this->xAutoloader)) |
|
268 | 268 | { |
269 | 269 | $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory); |
270 | 270 | } |
271 | 271 | } |
272 | - elseif(($this->xAutoloader)) |
|
272 | + elseif (($this->xAutoloader)) |
|
273 | 273 | { |
274 | 274 | // If there is an autoloader, register the dir with classmap autoloading |
275 | 275 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
276 | 276 | $itFile = new RecursiveIteratorIterator($itDir); |
277 | 277 | // Iterate on dir content |
278 | - foreach($itFile as $xFile) |
|
278 | + foreach ($itFile as $xFile) |
|
279 | 279 | { |
280 | 280 | // skip everything except PHP files |
281 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
281 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
282 | 282 | { |
283 | 283 | continue; |
284 | 284 | } |
@@ -314,33 +314,33 @@ discard block |
||
314 | 314 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
315 | 315 | $sClassPath = str_replace($sDS, '\\', trim($sClassPath, $sDS)); |
316 | 316 | $sClassName = $xFile->getBasename('.php'); |
317 | - if(($sNamespace)) |
|
317 | + if (($sNamespace)) |
|
318 | 318 | { |
319 | 319 | $sClassPath = ($sClassPath) ? $sNamespace . '\\' . $sClassPath : $sNamespace; |
320 | 320 | $sClassName = '\\' . $sClassPath . '\\' . $sClassName; |
321 | 321 | } |
322 | 322 | // Require the file only if autoload is enabled but there is no autoloader |
323 | - if(($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
323 | + if (($this->bAutoloadEnabled) && !($this->xAutoloader)) |
|
324 | 324 | { |
325 | 325 | require_once($xFile->getPathname()); |
326 | 326 | } |
327 | 327 | // Create and register an instance of the class |
328 | - if(!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
328 | + if (!array_key_exists('*', $aOptions) || !is_array($aOptions['*'])) |
|
329 | 329 | { |
330 | 330 | $aOptions['*'] = []; |
331 | 331 | } |
332 | 332 | $aOptions['*']['separator'] = $sSeparator; |
333 | - if(($sNamespace)) |
|
333 | + if (($sNamespace)) |
|
334 | 334 | { |
335 | 335 | $aOptions['*']['namespace'] = $sNamespace; |
336 | 336 | } |
337 | - if(($sClassPath)) |
|
337 | + if (($sClassPath)) |
|
338 | 338 | { |
339 | 339 | $aOptions['*']['classpath'] = $sClassPath; |
340 | 340 | } |
341 | 341 | // Filter excluded methods |
342 | - $aProtected = array_filter($aProtected, function ($sName) {return is_string($sName);}); |
|
343 | - if(count($aProtected) > 0) |
|
342 | + $aProtected = array_filter($aProtected, function($sName) {return is_string($sName); }); |
|
343 | + if (count($aProtected) > 0) |
|
344 | 344 | { |
345 | 345 | $aOptions['*']['protected'] = $aProtected; |
346 | 346 | } |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | $sDS = DIRECTORY_SEPARATOR; |
360 | 360 | // Change the keys in $aOptions to have "\" as separator |
361 | 361 | $aNewOptions = []; |
362 | - foreach($aOptions as $key => $aOption) |
|
362 | + foreach ($aOptions as $key => $aOption) |
|
363 | 363 | { |
364 | 364 | $key = trim(str_replace(['.', '_'], ['\\', '\\'], $key), ' \\'); |
365 | 365 | $aNewOptions[$key] = $aOption; |
366 | 366 | } |
367 | 367 | |
368 | - foreach($this->aClassDirs as $aClassDir) |
|
368 | + foreach ($this->aClassDirs as $aClassDir) |
|
369 | 369 | { |
370 | 370 | // Get the directory |
371 | 371 | $sDirectory = $aClassDir['directory']; |
@@ -375,10 +375,10 @@ discard block |
||
375 | 375 | $itDir = new RecursiveDirectoryIterator($sDirectory); |
376 | 376 | $itFile = new RecursiveIteratorIterator($itDir); |
377 | 377 | // Iterate on dir content |
378 | - foreach($itFile as $xFile) |
|
378 | + foreach ($itFile as $xFile) |
|
379 | 379 | { |
380 | 380 | // skip everything except PHP files |
381 | - if(!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
381 | + if (!$xFile->isFile() || $xFile->getExtension() != 'php') |
|
382 | 382 | { |
383 | 383 | continue; |
384 | 384 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | $sClassPath = substr($xFile->getPath(), strlen($sDirectory)); |
388 | 388 | $sClassPath = trim(str_replace($sDS, '\\', $sClassPath), '\\'); |
389 | 389 | $sClassName = $xFile->getBasename('.php'); |
390 | - if(($sClassPath)) |
|
390 | + if (($sClassPath)) |
|
391 | 391 | { |
392 | 392 | $sClassName = $sClassPath . '\\' . $sClassName; |
393 | 393 | } |
394 | - if(($sNamespace)) |
|
394 | + if (($sNamespace)) |
|
395 | 395 | { |
396 | 396 | $sClassName = $sNamespace . '\\' . $sClassName; |
397 | 397 | } |
398 | 398 | // Get the class options |
399 | 399 | $aClassOptions = []; |
400 | - if(array_key_exists($sClassName, $aNewOptions)) |
|
400 | + if (array_key_exists($sClassName, $aNewOptions)) |
|
401 | 401 | { |
402 | 402 | $aClassOptions = $aNewOptions[$sClassName]; |
403 | 403 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function registerClass($sClassName, array $aOptions = []) |
420 | 420 | { |
421 | - if(!($sClassName = trim($sClassName, ' \\._'))) |
|
421 | + if (!($sClassName = trim($sClassName, ' \\._'))) |
|
422 | 422 | { |
423 | 423 | return false; |
424 | 424 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | // Replace "." and "_" with antislashes, and set the class path. |
428 | 428 | $sClassName = str_replace(['.', '_'], ['\\', '\\'], $sClassName); |
429 | 429 | $sClassPath = ''; |
430 | - if(($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
430 | + if (($nLastSlashPosition = strrpos($sClassName, '\\')) !== false) |
|
431 | 431 | { |
432 | 432 | $sClassPath = substr($sClassName, 0, $nLastSlashPosition); |
433 | 433 | $sClassName = substr($sClassName, $nLastSlashPosition + 1); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | $sPartPath = str_replace('\\', $sDS, $sClassPath) . $sDS . $sClassName . '.php'; |
437 | 437 | |
438 | 438 | // Search for the class file in all directories. |
439 | - foreach($this->aClassDirs as $aClassDir) |
|
439 | + foreach ($this->aClassDirs as $aClassDir) |
|
440 | 440 | { |
441 | 441 | // Get the separator |
442 | 442 | $sSeparator = $aClassDir['separator']; |
@@ -445,15 +445,15 @@ discard block |
||
445 | 445 | $nLen = strlen($sNamespace); |
446 | 446 | $sFullPath = ''; |
447 | 447 | // Check if the class belongs to the namespace |
448 | - if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
448 | + if (($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace) |
|
449 | 449 | { |
450 | 450 | $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1); |
451 | 451 | } |
452 | - elseif(!($sNamespace)) |
|
452 | + elseif (!($sNamespace)) |
|
453 | 453 | { |
454 | 454 | $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath; |
455 | 455 | } |
456 | - if(($sFullPath) && is_file($sFullPath)) |
|
456 | + if (($sFullPath) && is_file($sFullPath)) |
|
457 | 457 | { |
458 | 458 | // Found the file in this directory |
459 | 459 | $xFileInfo = new \SplFileInfo($sFullPath); |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | { |
476 | 476 | $di = jaxon()->di(); |
477 | 477 | $sHash = ''; |
478 | - foreach($this->aCallableObjects as $sName) |
|
478 | + foreach ($this->aCallableObjects as $sName) |
|
479 | 479 | { |
480 | 480 | $xCallableObject = $di->get($sName); |
481 | 481 | $sHash .= $sName . implode('|', $xCallableObject->getMethods()); |
@@ -494,15 +494,15 @@ discard block |
||
494 | 494 | // Generate code for javascript objects declaration |
495 | 495 | $code = ''; |
496 | 496 | $classes = []; |
497 | - foreach($this->aClassPaths as $sClassPath) |
|
497 | + foreach ($this->aClassPaths as $sClassPath) |
|
498 | 498 | { |
499 | 499 | $offset = 0; |
500 | 500 | $sClassPath .= '.Null'; // This is a sentinel. The last token is not processed in the while loop. |
501 | - while(($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
501 | + while (($dotPosition = strpos($sClassPath, '.', $offset)) !== false) |
|
502 | 502 | { |
503 | 503 | $class = substr($sClassPath, 0, $dotPosition); |
504 | 504 | // Generate code for this object |
505 | - if(!array_key_exists($class, $classes)) |
|
505 | + if (!array_key_exists($class, $classes)) |
|
506 | 506 | { |
507 | 507 | $code .= "$sJaxonPrefix$class = {};\n"; |
508 | 508 | $classes[$class] = $class; |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | } |
513 | 513 | // Generate code for javascript methods |
514 | 514 | $di = jaxon()->di(); |
515 | - foreach($this->aCallableObjects as $sName) |
|
515 | + foreach ($this->aCallableObjects as $sName) |
|
516 | 516 | { |
517 | 517 | $xCallableObject = $di->get($sName); |
518 | 518 | $code .= $xCallableObject->getScript(); |
@@ -528,13 +528,13 @@ discard block |
||
528 | 528 | public function canProcessRequest() |
529 | 529 | { |
530 | 530 | // Check the validity of the class name |
531 | - if(($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
531 | + if (($this->sRequestedClass) && !$this->validateClass($this->sRequestedClass)) |
|
532 | 532 | { |
533 | 533 | $this->sRequestedClass = null; |
534 | 534 | $this->sRequestedMethod = null; |
535 | 535 | } |
536 | 536 | // Check the validity of the method name |
537 | - if(($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
537 | + if (($this->sRequestedMethod) && !$this->validateMethod($this->sRequestedMethod)) |
|
538 | 538 | { |
539 | 539 | $this->sRequestedClass = null; |
540 | 540 | $this->sRequestedMethod = null; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | */ |
550 | 550 | public function processRequest() |
551 | 551 | { |
552 | - if(!$this->canProcessRequest()) |
|
552 | + if (!$this->canProcessRequest()) |
|
553 | 553 | { |
554 | 554 | return false; |
555 | 555 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | |
559 | 559 | // Find the requested method |
560 | 560 | $xCallableObject = $this->getCallableObject($this->sRequestedClass); |
561 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
561 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
562 | 562 | { |
563 | 563 | // Unable to find the requested object or method |
564 | 564 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | // at the beginning and the end of the class name. |
584 | 584 | $sClassName = trim(str_replace(['.', '_'], ['\\', '\\'], (string)$sClassName), '\\'); |
585 | 585 | // Register an instance of the requested class, if it isn't yet |
586 | - if(!key_exists($sClassName, $this->aCallableObjects)) |
|
586 | + if (!key_exists($sClassName, $this->aCallableObjects)) |
|
587 | 587 | { |
588 | 588 | $this->getPluginManager()->registerClass($sClassName); |
589 | 589 | } |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function append(Response $xResponse) |
73 | 73 | { |
74 | - if(!$this->xResponse) |
|
74 | + if (!$this->xResponse) |
|
75 | 75 | { |
76 | 76 | $this->xResponse = $xResponse; |
77 | 77 | } |
78 | - elseif(get_class($this->xResponse) == get_class($xResponse)) |
|
78 | + elseif (get_class($this->xResponse) == get_class($xResponse)) |
|
79 | 79 | { |
80 | - if($this->xResponse != $xResponse) |
|
80 | + if ($this->xResponse != $xResponse) |
|
81 | 81 | { |
82 | 82 | $this->xResponse->appendResponse($xResponse); |
83 | 83 | } |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function printDebug() |
112 | 112 | { |
113 | - if(($this->xResponse)) |
|
113 | + if (($this->xResponse)) |
|
114 | 114 | { |
115 | - foreach($this->aDebugMessages as $sMessage) |
|
115 | + foreach ($this->aDebugMessages as $sMessage) |
|
116 | 116 | { |
117 | 117 | $this->xResponse->debug($sMessage); |
118 | 118 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function sendHeaders() |
129 | 129 | { |
130 | - if(($this->xResponse)) |
|
130 | + if (($this->xResponse)) |
|
131 | 131 | { |
132 | 132 | $this->xResponse->sendHeaders(); |
133 | 133 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function getOutput() |
142 | 142 | { |
143 | - if(($this->xResponse)) |
|
143 | + if (($this->xResponse)) |
|
144 | 144 | { |
145 | 145 | return $this->xResponse->getOutput(); |
146 | 146 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function sendOutput() |
156 | 156 | { |
157 | - if(($this->xResponse)) |
|
157 | + if (($this->xResponse)) |
|
158 | 158 | { |
159 | 159 | $this->xResponse->sendHeaders(); |
160 | 160 | $this->xResponse->printOutput(); |
@@ -74,15 +74,13 @@ |
||
74 | 74 | if(!$this->xResponse) |
75 | 75 | { |
76 | 76 | $this->xResponse = $xResponse; |
77 | - } |
|
78 | - elseif(get_class($this->xResponse) == get_class($xResponse)) |
|
77 | + } elseif(get_class($this->xResponse) == get_class($xResponse)) |
|
79 | 78 | { |
80 | 79 | if($this->xResponse != $xResponse) |
81 | 80 | { |
82 | 81 | $this->xResponse->appendResponse($xResponse); |
83 | 82 | } |
84 | - } |
|
85 | - else |
|
83 | + } else |
|
86 | 84 | { |
87 | 85 | $this->debug($this->trans('errors.mismatch.types', array('class' => get_class($xResponse)))); |
88 | 86 | } |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | if(!empty($_SERVER['HTTP_SCHEME'])) |
38 | 38 | { |
39 | 39 | $aURL['scheme'] = $_SERVER['HTTP_SCHEME']; |
40 | - } |
|
41 | - else |
|
40 | + } else |
|
42 | 41 | { |
43 | 42 | $aURL['scheme'] = ((!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http'); |
44 | 43 | } |
@@ -51,28 +50,23 @@ discard block |
||
51 | 50 | if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0) |
52 | 51 | { |
53 | 52 | list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']); |
54 | - } |
|
55 | - else |
|
53 | + } else |
|
56 | 54 | { |
57 | 55 | $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST']; |
58 | 56 | } |
59 | - } |
|
60 | - elseif(!empty($_SERVER['HTTP_HOST'])) |
|
57 | + } elseif(!empty($_SERVER['HTTP_HOST'])) |
|
61 | 58 | { |
62 | 59 | if(strpos($_SERVER['HTTP_HOST'], ':') > 0) |
63 | 60 | { |
64 | 61 | list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']); |
65 | - } |
|
66 | - else |
|
62 | + } else |
|
67 | 63 | { |
68 | 64 | $aURL['host'] = $_SERVER['HTTP_HOST']; |
69 | 65 | } |
70 | - } |
|
71 | - elseif(!empty($_SERVER['SERVER_NAME'])) |
|
66 | + } elseif(!empty($_SERVER['SERVER_NAME'])) |
|
72 | 67 | { |
73 | 68 | $aURL['host'] = $_SERVER['SERVER_NAME']; |
74 | - } |
|
75 | - else |
|
69 | + } else |
|
76 | 70 | { |
77 | 71 | throw new \Jaxon\Exception\URI(); |
78 | 72 | } |
@@ -94,8 +88,7 @@ discard block |
||
94 | 88 | if(!empty($_SERVER['PATH_INFO'])) |
95 | 89 | { |
96 | 90 | $sPath = parse_url($_SERVER['PATH_INFO']); |
97 | - } |
|
98 | - else |
|
91 | + } else |
|
99 | 92 | { |
100 | 93 | $sPath = parse_url($_SERVER['PHP_SELF']); |
101 | 94 | } |
@@ -153,8 +146,9 @@ discard block |
||
153 | 146 | |
154 | 147 | foreach($aQueries as $sKey => $sQuery) |
155 | 148 | { |
156 | - if("jxnGenerate" == substr($sQuery, 0, 11)) |
|
157 | - unset($aQueries[$sKey]); |
|
149 | + if("jxnGenerate" == substr($sQuery, 0, 11)) { |
|
150 | + unset($aQueries[$sKey]); |
|
151 | + } |
|
158 | 152 | } |
159 | 153 | |
160 | 154 | $sQueries = implode("&", $aQueries); |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | { |
26 | 26 | $aURL = []; |
27 | 27 | // Try to get the request URL |
28 | - if(!empty($_SERVER['REQUEST_URI'])) |
|
28 | + if (!empty($_SERVER['REQUEST_URI'])) |
|
29 | 29 | { |
30 | - $_SERVER['REQUEST_URI'] = str_replace(array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $_SERVER['REQUEST_URI']); |
|
30 | + $_SERVER['REQUEST_URI'] = str_replace(array('"', "'", '<', '>'), array('%22', '%27', '%3C', '%3E'), $_SERVER['REQUEST_URI']); |
|
31 | 31 | $aURL = parse_url($_SERVER['REQUEST_URI']); |
32 | 32 | } |
33 | 33 | |
34 | 34 | // Fill in the empty values |
35 | - if(empty($aURL['scheme'])) |
|
35 | + if (empty($aURL['scheme'])) |
|
36 | 36 | { |
37 | - if(!empty($_SERVER['HTTP_SCHEME'])) |
|
37 | + if (!empty($_SERVER['HTTP_SCHEME'])) |
|
38 | 38 | { |
39 | 39 | $aURL['scheme'] = $_SERVER['HTTP_SCHEME']; |
40 | 40 | } |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | - if(empty($aURL['host'])) |
|
47 | + if (empty($aURL['host'])) |
|
48 | 48 | { |
49 | - if(!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) |
|
49 | + if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) |
|
50 | 50 | { |
51 | - if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0) |
|
51 | + if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0) |
|
52 | 52 | { |
53 | 53 | list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']); |
54 | 54 | } |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST']; |
58 | 58 | } |
59 | 59 | } |
60 | - elseif(!empty($_SERVER['HTTP_HOST'])) |
|
60 | + elseif (!empty($_SERVER['HTTP_HOST'])) |
|
61 | 61 | { |
62 | - if(strpos($_SERVER['HTTP_HOST'], ':') > 0) |
|
62 | + if (strpos($_SERVER['HTTP_HOST'], ':') > 0) |
|
63 | 63 | { |
64 | 64 | list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']); |
65 | 65 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $aURL['host'] = $_SERVER['HTTP_HOST']; |
69 | 69 | } |
70 | 70 | } |
71 | - elseif(!empty($_SERVER['SERVER_NAME'])) |
|
71 | + elseif (!empty($_SERVER['SERVER_NAME'])) |
|
72 | 72 | { |
73 | 73 | $aURL['host'] = $_SERVER['SERVER_NAME']; |
74 | 74 | } |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - if(empty($aURL['port']) && !empty($_SERVER['SERVER_PORT'])) |
|
81 | + if (empty($aURL['port']) && !empty($_SERVER['SERVER_PORT'])) |
|
82 | 82 | { |
83 | 83 | $aURL['port'] = $_SERVER['SERVER_PORT']; |
84 | 84 | } |
85 | 85 | |
86 | - if(!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0) |
|
86 | + if (!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0) |
|
87 | 87 | { |
88 | 88 | unset($aURL['path']); |
89 | 89 | } |
90 | 90 | |
91 | - if(empty($aURL['path'])) |
|
91 | + if (empty($aURL['path'])) |
|
92 | 92 | { |
93 | 93 | $sPath = []; |
94 | - if(!empty($_SERVER['PATH_INFO'])) |
|
94 | + if (!empty($_SERVER['PATH_INFO'])) |
|
95 | 95 | { |
96 | 96 | $sPath = parse_url($_SERVER['PATH_INFO']); |
97 | 97 | } |
@@ -99,61 +99,61 @@ discard block |
||
99 | 99 | { |
100 | 100 | $sPath = parse_url($_SERVER['PHP_SELF']); |
101 | 101 | } |
102 | - if(isset($sPath['path'])) |
|
102 | + if (isset($sPath['path'])) |
|
103 | 103 | { |
104 | - $aURL['path'] = str_replace(array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $sPath['path']); |
|
104 | + $aURL['path'] = str_replace(array('"', "'", '<', '>'), array('%22', '%27', '%3C', '%3E'), $sPath['path']); |
|
105 | 105 | } |
106 | 106 | unset($sPath); |
107 | 107 | } |
108 | 108 | |
109 | - if(empty($aURL['query']) && !empty($_SERVER['QUERY_STRING'])) |
|
109 | + if (empty($aURL['query']) && !empty($_SERVER['QUERY_STRING'])) |
|
110 | 110 | { |
111 | 111 | $aURL['query'] = $_SERVER['QUERY_STRING']; |
112 | 112 | } |
113 | 113 | |
114 | - if(!empty($aURL['query'])) |
|
114 | + if (!empty($aURL['query'])) |
|
115 | 115 | { |
116 | - $aURL['query'] = '?'.$aURL['query']; |
|
116 | + $aURL['query'] = '?' . $aURL['query']; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // Build the URL: Start with scheme, user and pass |
120 | - $sURL = $aURL['scheme'].'://'; |
|
121 | - if(!empty($aURL['user'])) |
|
120 | + $sURL = $aURL['scheme'] . '://'; |
|
121 | + if (!empty($aURL['user'])) |
|
122 | 122 | { |
123 | - $sURL.= $aURL['user']; |
|
124 | - if(!empty($aURL['pass'])) |
|
123 | + $sURL .= $aURL['user']; |
|
124 | + if (!empty($aURL['pass'])) |
|
125 | 125 | { |
126 | - $sURL.= ':'.$aURL['pass']; |
|
126 | + $sURL .= ':' . $aURL['pass']; |
|
127 | 127 | } |
128 | - $sURL.= '@'; |
|
128 | + $sURL .= '@'; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Add the host |
132 | - $sURL.= $aURL['host']; |
|
132 | + $sURL .= $aURL['host']; |
|
133 | 133 | |
134 | 134 | // Add the port if needed |
135 | - if(!empty($aURL['port']) |
|
135 | + if (!empty($aURL['port']) |
|
136 | 136 | && (($aURL['scheme'] == 'http' && $aURL['port'] != 80) |
137 | 137 | || ($aURL['scheme'] == 'https' && $aURL['port'] != 443))) |
138 | 138 | { |
139 | - $sURL.= ':'.$aURL['port']; |
|
139 | + $sURL .= ':' . $aURL['port']; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // Add the path and the query string |
143 | - $sURL.= $aURL['path'].@$aURL['query']; |
|
143 | + $sURL .= $aURL['path'] . @$aURL['query']; |
|
144 | 144 | |
145 | 145 | // Clean up |
146 | 146 | unset($aURL); |
147 | 147 | |
148 | 148 | $aURL = explode("?", $sURL); |
149 | 149 | |
150 | - if(1 < count($aURL)) |
|
150 | + if (1 < count($aURL)) |
|
151 | 151 | { |
152 | 152 | $aQueries = explode("&", $aURL[1]); |
153 | 153 | |
154 | - foreach($aQueries as $sKey => $sQuery) |
|
154 | + foreach ($aQueries as $sKey => $sQuery) |
|
155 | 155 | { |
156 | - if("jxnGenerate" == substr($sQuery, 0, 11)) |
|
156 | + if ("jxnGenerate" == substr($sQuery, 0, 11)) |
|
157 | 157 | unset($aQueries[$sKey]); |
158 | 158 | } |
159 | 159 |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | public static function read($sConfigFile, $sLibKey = '', $sAppKey = null) |
30 | 30 | { |
31 | 31 | $sConfigFile = realpath($sConfigFile); |
32 | - if(!is_readable($sConfigFile)) |
|
32 | + if (!is_readable($sConfigFile)) |
|
33 | 33 | { |
34 | 34 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
35 | 35 | } |
36 | 36 | $sFileContent = file_get_contents($sConfigFile); |
37 | 37 | $aConfigOptions = json_decode($sFileContent, true); |
38 | - if(!is_array($aConfigOptions)) |
|
38 | + if (!is_array($aConfigOptions)) |
|
39 | 39 | { |
40 | 40 | throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $jaxon = jaxon(); |
45 | 45 | $jaxon->setOptions($aConfigOptions, $sLibKey); |
46 | 46 | $config = null; |
47 | - if(is_string($sAppKey)) |
|
47 | + if (is_string($sAppKey)) |
|
48 | 48 | { |
49 | 49 | $config = new Config(); |
50 | 50 | $config->setOptions($aConfigOptions, $sAppKey); |