@@ -217,7 +217,7 @@ |
||
217 | 217 | $aFiles[$sVarName] = []; |
218 | 218 | foreach($aUserFiles as $aUserFile) |
219 | 219 | { |
220 | - $aFiles[$sVarName][] = $aUserFile->toTempData(); |
|
220 | + $aFiles[$sVarName][] = $aUserFile->toTempData(); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | // Save upload data in a temp file |
@@ -16,7 +16,6 @@ |
||
16 | 16 | use Jaxon\Plugin\Request as RequestPlugin; |
17 | 17 | use Jaxon\Request\Support\UploadedFile; |
18 | 18 | use Jaxon\Response\UploadResponse; |
19 | - |
|
20 | 19 | use Exception; |
21 | 20 | use Closure; |
22 | 21 |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | { |
69 | 69 | $this->sUploadSubdir = uniqid() . DIRECTORY_SEPARATOR; |
70 | 70 | |
71 | - if(array_key_exists('jxnupl', $_POST)) |
|
71 | + if (array_key_exists('jxnupl', $_POST)) |
|
72 | 72 | { |
73 | 73 | $this->sTempFile = $_POST['jxnupl']; |
74 | 74 | } |
75 | - elseif(array_key_exists('jxnupl', $_GET)) |
|
75 | + elseif (array_key_exists('jxnupl', $_GET)) |
|
76 | 76 | { |
77 | 77 | $this->sTempFile = $_GET['jxnupl']; |
78 | 78 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | protected function filterFilename($sFilename, $sVarName) |
102 | 102 | { |
103 | - if(($this->cFileFilter)) |
|
103 | + if (($this->cFileFilter)) |
|
104 | 104 | { |
105 | 105 | $cFileFilter = $this->cFileFilter; |
106 | 106 | $sFilename = (string)$cFileFilter($sFilename, $sVarName); |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | $sUploadDir = $this->getOption('upload.files.' . $sFieldId . '.dir', $sDefaultUploadDir); |
123 | 123 | $sUploadDir = rtrim(trim($sUploadDir), '/\\') . DIRECTORY_SEPARATOR; |
124 | 124 | // Verify that the upload dir exists and is writable |
125 | - if(!is_writable($sUploadDir)) |
|
125 | + if (!is_writable($sUploadDir)) |
|
126 | 126 | { |
127 | 127 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
128 | 128 | } |
129 | 129 | $sUploadDir .= $this->sUploadSubdir; |
130 | - if(!file_exists($sUploadDir) && !@mkdir($sUploadDir)) |
|
130 | + if (!file_exists($sUploadDir) && !@mkdir($sUploadDir)) |
|
131 | 131 | { |
132 | 132 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
133 | 133 | } |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | $sUploadDir = $this->getOption('upload.default.dir'); |
146 | 146 | $sUploadDir = rtrim(trim($sUploadDir), '/\\') . DIRECTORY_SEPARATOR; |
147 | 147 | // Verify that the upload dir exists and is writable |
148 | - if(!is_writable($sUploadDir)) |
|
148 | + if (!is_writable($sUploadDir)) |
|
149 | 149 | { |
150 | 150 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
151 | 151 | } |
152 | 152 | $sUploadDir .= 'tmp' . DIRECTORY_SEPARATOR; |
153 | - if(!file_exists($sUploadDir) && !@mkdir($sUploadDir)) |
|
153 | + if (!file_exists($sUploadDir) && !@mkdir($sUploadDir)) |
|
154 | 154 | { |
155 | 155 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
156 | 156 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $sUploadDir = rtrim(trim($sUploadDir), '/\\') . DIRECTORY_SEPARATOR; |
169 | 169 | $sUploadDir .= 'tmp' . DIRECTORY_SEPARATOR; |
170 | 170 | $sUploadTempFile = $sUploadDir . $this->sTempFile . '.json'; |
171 | - if(!is_readable($sUploadTempFile)) |
|
171 | + if (!is_readable($sUploadTempFile)) |
|
172 | 172 | { |
173 | 173 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.access')); |
174 | 174 | } |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | { |
185 | 185 | // Check validity of the uploaded files |
186 | 186 | $aTempFiles = []; |
187 | - foreach($_FILES as $sVarName => $aFile) |
|
187 | + foreach ($_FILES as $sVarName => $aFile) |
|
188 | 188 | { |
189 | - if(is_array($aFile['name'])) |
|
189 | + if (is_array($aFile['name'])) |
|
190 | 190 | { |
191 | 191 | $nFileCount = count($aFile['name']); |
192 | - for($i = 0; $i < $nFileCount; $i++) |
|
192 | + for ($i = 0; $i < $nFileCount; $i++) |
|
193 | 193 | { |
194 | - if(!$aFile['name'][$i]) |
|
194 | + if (!$aFile['name'][$i]) |
|
195 | 195 | { |
196 | 196 | continue; |
197 | 197 | } |
198 | - if(!array_key_exists($sVarName, $aTempFiles)) |
|
198 | + if (!array_key_exists($sVarName, $aTempFiles)) |
|
199 | 199 | { |
200 | 200 | $aTempFiles[$sVarName] = []; |
201 | 201 | } |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | } |
216 | 216 | else |
217 | 217 | { |
218 | - if(!$aFile['name']) |
|
218 | + if (!$aFile['name']) |
|
219 | 219 | { |
220 | 220 | continue; |
221 | 221 | } |
222 | - if(!array_key_exists($sVarName, $aTempFiles)) |
|
222 | + if (!array_key_exists($sVarName, $aTempFiles)) |
|
223 | 223 | { |
224 | 224 | $aTempFiles[$sVarName] = []; |
225 | 225 | } |
@@ -239,17 +239,17 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | // Check uploaded files validity |
242 | - foreach($aTempFiles as $sVarName => $aFiles) |
|
242 | + foreach ($aTempFiles as $sVarName => $aFiles) |
|
243 | 243 | { |
244 | - foreach($aFiles as $aFile) |
|
244 | + foreach ($aFiles as $aFile) |
|
245 | 245 | { |
246 | 246 | // Verify upload result |
247 | - if($aFile['error'] != 0) |
|
247 | + if ($aFile['error'] != 0) |
|
248 | 248 | { |
249 | 249 | throw new \Jaxon\Exception\Error($this->trans('errors.upload.failed', $aFile)); |
250 | 250 | } |
251 | 251 | // Verify file validity (format, size) |
252 | - if(!$this->validateUploadedFile($sVarName, $aFile)) |
|
252 | + if (!$this->validateUploadedFile($sVarName, $aFile)) |
|
253 | 253 | { |
254 | 254 | throw new \Jaxon\Exception\Error($this->getValidatorMessage()); |
255 | 255 | } |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | // Copy the uploaded files from the temp dir to the user dir |
262 | - foreach($aTempFiles as $sVarName => $_aTempFiles) |
|
262 | + foreach ($aTempFiles as $sVarName => $_aTempFiles) |
|
263 | 263 | { |
264 | 264 | $this->aUserFiles[$sVarName] = []; |
265 | - foreach($_aTempFiles as $aFile) |
|
265 | + foreach ($_aTempFiles as $aFile) |
|
266 | 266 | { |
267 | 267 | // Get the path to the upload dir |
268 | 268 | $sUploadDir = $this->getUploadDir($sVarName); |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | { |
285 | 285 | // Convert uploaded file to an array |
286 | 286 | $aFiles = []; |
287 | - foreach($this->aUserFiles as $sVarName => $aUserFiles) |
|
287 | + foreach ($this->aUserFiles as $sVarName => $aUserFiles) |
|
288 | 288 | { |
289 | 289 | $aFiles[$sVarName] = []; |
290 | - foreach($aUserFiles as $aUserFile) |
|
290 | + foreach ($aUserFiles as $aUserFile) |
|
291 | 291 | { |
292 | 292 | $aFiles[$sVarName][] = $aUserFile->toTempData(); |
293 | 293 | } |
@@ -308,10 +308,10 @@ discard block |
||
308 | 308 | // Upload temp file |
309 | 309 | $sUploadTempFile = $this->getUploadTempFile(); |
310 | 310 | $aFiles = json_decode(file_get_contents($sUploadTempFile), true); |
311 | - foreach($aFiles as $sVarName => $aUserFiles) |
|
311 | + foreach ($aFiles as $sVarName => $aUserFiles) |
|
312 | 312 | { |
313 | 313 | $this->aUserFiles[$sVarName] = []; |
314 | - foreach($aUserFiles as $aUserFile) |
|
314 | + foreach ($aUserFiles as $aUserFile) |
|
315 | 315 | { |
316 | 316 | $this->aUserFiles[$sVarName][] = UploadedFile::fromTempData($aUserFile); |
317 | 317 | } |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | */ |
379 | 379 | public function noRequestPluginFound() |
380 | 380 | { |
381 | - if(count($_FILES) > 0) |
|
381 | + if (count($_FILES) > 0) |
|
382 | 382 | { |
383 | 383 | $this->bRequestIsHttpUpload = true; |
384 | 384 | } |
@@ -401,17 +401,17 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public function processRequest() |
403 | 403 | { |
404 | - if(!$this->canProcessRequest()) |
|
404 | + if (!$this->canProcessRequest()) |
|
405 | 405 | { |
406 | 406 | return false; |
407 | 407 | } |
408 | 408 | |
409 | - if(count($_FILES) > 0) |
|
409 | + if (count($_FILES) > 0) |
|
410 | 410 | { |
411 | 411 | // Ajax request with upload |
412 | 412 | $this->readFromHttpData(); |
413 | 413 | |
414 | - if($this->bRequestIsHttpUpload) |
|
414 | + if ($this->bRequestIsHttpUpload) |
|
415 | 415 | { |
416 | 416 | // Process an HTTP upload request |
417 | 417 | // This requires to set the response to be returned. |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | $this->saveToTempFile(); |
422 | 422 | $xResponse->setUploadedFile($this->sTempFile); |
423 | 423 | } |
424 | - catch(Exception $e) |
|
424 | + catch (Exception $e) |
|
425 | 425 | { |
426 | 426 | $xResponse->setErrorMessage($e->getMessage()); |
427 | 427 | } |
428 | 428 | jaxon()->di()->getResponseManager()->append($xResponse); |
429 | 429 | } |
430 | 430 | } |
431 | - elseif(($this->sTempFile)) |
|
431 | + elseif (($this->sTempFile)) |
|
432 | 432 | { |
433 | 433 | // Ajax request following and HTTP upload |
434 | 434 | $this->readFromTempFile(); |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | if(array_key_exists('jxnupl', $_POST)) |
72 | 72 | { |
73 | 73 | $this->sTempFile = $_POST['jxnupl']; |
74 | - } |
|
75 | - elseif(array_key_exists('jxnupl', $_GET)) |
|
74 | + } elseif(array_key_exists('jxnupl', $_GET)) |
|
76 | 75 | { |
77 | 76 | $this->sTempFile = $_GET['jxnupl']; |
78 | 77 | } |
@@ -212,8 +211,7 @@ discard block |
||
212 | 211 | 'extension' => pathinfo($aFile['name'][$i], PATHINFO_EXTENSION), |
213 | 212 | ]; |
214 | 213 | } |
215 | - } |
|
216 | - else |
|
214 | + } else |
|
217 | 215 | { |
218 | 216 | if(!$aFile['name']) |
219 | 217 | { |
@@ -420,15 +418,13 @@ discard block |
||
420 | 418 | { |
421 | 419 | $this->saveToTempFile(); |
422 | 420 | $xResponse->setUploadedFile($this->sTempFile); |
423 | - } |
|
424 | - catch(Exception $e) |
|
421 | + } catch(Exception $e) |
|
425 | 422 | { |
426 | 423 | $xResponse->setErrorMessage($e->getMessage()); |
427 | 424 | } |
428 | 425 | jaxon()->di()->getResponseManager()->append($xResponse); |
429 | 426 | } |
430 | - } |
|
431 | - elseif(($this->sTempFile)) |
|
427 | + } elseif(($this->sTempFile)) |
|
432 | 428 | { |
433 | 429 | // Ajax request following and HTTP upload |
434 | 430 | $this->readFromTempFile(); |
@@ -14,18 +14,18 @@ |
||
14 | 14 | jaxon.config.defaultMode = "<?php echo $this->sDefaultMode ?>"; |
15 | 15 | jaxon.config.defaultMethod = "<?php echo $this->sDefaultMethod ?>"; |
16 | 16 | jaxon.config.responseType = "<?php echo $this->sResponseType ?>"; |
17 | -<?php if($this->nResponseQueueSize > 0): ?> |
|
17 | +<?php if ($this->nResponseQueueSize > 0): ?> |
|
18 | 18 | jaxon.config.responseQueueSize = <?php echo $this->nResponseQueueSize ?>; |
19 | 19 | <?php endif ?> |
20 | -<?php if(($this->bDebug)): ?> |
|
21 | -<?php if(($this->sDebugOutputID)): ?> |
|
20 | +<?php if (($this->bDebug)): ?> |
|
21 | +<?php if (($this->sDebugOutputID)): ?> |
|
22 | 22 | jaxon.debug.outputID = "<?php echo $this->sDebugOutputID ?>"; |
23 | 23 | <?php endif ?> |
24 | -<?php if(($this->bVerboseDebug)): ?> |
|
24 | +<?php if (($this->bVerboseDebug)): ?> |
|
25 | 25 | jaxon.debug.verbose.active = true; |
26 | 26 | <?php endif ?> |
27 | 27 | <?php endif ?> |
28 | -<?php if(($this->sCsrfMetaName)): ?> |
|
28 | +<?php if (($this->sCsrfMetaName)): ?> |
|
29 | 29 | metaTags = document.getElementsByTagName('meta'); |
30 | 30 | for(i = 0; i < metaTags.length; i++) |
31 | 31 | { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @param array $aAttributes Associative array of attributes that will describe the command |
160 | 160 | * @param mixed $mData The data to be associated with this command |
161 | 161 | * |
162 | - * @return \Jaxon\Plugin\Response |
|
162 | + * @return Response |
|
163 | 163 | */ |
164 | 164 | public function addCommand($aAttributes, $mData) |
165 | 165 | { |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | /** |
201 | 201 | * Clear all the commands already added to the response |
202 | 202 | * |
203 | - * @return \Jaxon\Plugin\Response |
|
203 | + * @return Response |
|
204 | 204 | */ |
205 | 205 | public function clearCommands() |
206 | 206 | { |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @param \Jaxon\Plugin\Plugin $xPlugin The plugin object |
216 | 216 | * @param array $aAttributes The attributes for this response command |
217 | - * @param mixed $mData The data to be sent with this command |
|
217 | + * @param string $mData The data to be sent with this command |
|
218 | 218 | * |
219 | - * @return \Jaxon\Plugin\Response |
|
219 | + * @return Response |
|
220 | 220 | */ |
221 | 221 | public function addPluginCommand($xPlugin, $aAttributes, $mData) |
222 | 222 | { |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @param integer $iCmdNumber The number of commands to skip upon cancel |
278 | 278 | * @param string $sMessage The message to display to the user |
279 | 279 | * |
280 | - * @return \Jaxon\Plugin\Response |
|
280 | + * @return Response |
|
281 | 281 | */ |
282 | 282 | public function confirmCommands($iCmdNumber, $sMessage) |
283 | 283 | { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param string $sAttribute The attribute to be assigned |
298 | 298 | * @param string $sData The value to be assigned to the attribute |
299 | 299 | * |
300 | - * @return \Jaxon\Plugin\Response |
|
300 | + * @return Response |
|
301 | 301 | */ |
302 | 302 | public function assign($sTarget, $sAttribute, $sData) |
303 | 303 | { |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param string $sTarget The id of the html element on the browser |
320 | 320 | * @param string $sData The value to be assigned to the attribute |
321 | 321 | * |
322 | - * @return \Jaxon\Plugin\Response |
|
322 | + * @return Response |
|
323 | 323 | */ |
324 | 324 | public function html($sTarget, $sData) |
325 | 325 | { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @param string $sAttribute The name of the attribute to be appended to |
334 | 334 | * @param string $sData The data to be appended to the attribute |
335 | 335 | * |
336 | - * @return \Jaxon\Plugin\Response |
|
336 | + * @return Response |
|
337 | 337 | */ |
338 | 338 | public function append($sTarget, $sAttribute, $sData) |
339 | 339 | { |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @param string $sAttribute The name of the attribute to be prepended to |
355 | 355 | * @param string $sData The value to be prepended to the attribute |
356 | 356 | * |
357 | - * @return \Jaxon\Plugin\Response |
|
357 | + * @return Response |
|
358 | 358 | */ |
359 | 359 | public function prepend($sTarget, $sAttribute, $sData) |
360 | 360 | { |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @param string $sSearch The needle to search for |
377 | 377 | * @param string $sData The data to use in place of the needle |
378 | 378 | * |
379 | - * @return \Jaxon\Plugin\Response |
|
379 | + * @return Response |
|
380 | 380 | */ |
381 | 381 | public function replace($sTarget, $sAttribute, $sSearch, $sData) |
382 | 382 | { |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * @param string $sTarget The id of the element to be updated. |
400 | 400 | * @param string $sAttribute The attribute to be cleared |
401 | 401 | * |
402 | - * @return \Jaxon\Plugin\Response |
|
402 | + * @return Response |
|
403 | 403 | */ |
404 | 404 | public function clear($sTarget, $sAttribute) |
405 | 405 | { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @param string $sAttribute The attribute to be updated |
416 | 416 | * @param string $sData The value to assign |
417 | 417 | * |
418 | - * @return \Jaxon\Plugin\Response |
|
418 | + * @return Response |
|
419 | 419 | */ |
420 | 420 | public function contextAssign($sAttribute, $sData) |
421 | 421 | { |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @param string $sAttribute The attribute to be appended to |
438 | 438 | * @param string $sData The value to append |
439 | 439 | * |
440 | - * @return \Jaxon\Plugin\Response |
|
440 | + * @return Response |
|
441 | 441 | */ |
442 | 442 | public function contextAppend($sAttribute, $sData) |
443 | 443 | { |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @param string $sAttribute The attribute to be updated |
460 | 460 | * @param string $sData The value to be prepended |
461 | 461 | * |
462 | - * @return \Jaxon\Plugin\Response |
|
462 | + * @return Response |
|
463 | 463 | */ |
464 | 464 | public function contextPrepend($sAttribute, $sData) |
465 | 465 | { |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @param string $sAttribute The attribute to be cleared |
482 | 482 | * |
483 | - * @return \Jaxon\Plugin\Response |
|
483 | + * @return Response |
|
484 | 484 | */ |
485 | 485 | public function contextClear($sAttribute) |
486 | 486 | { |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @param string $sMessage The message to be displayed |
494 | 494 | * |
495 | - * @return \Jaxon\Plugin\Response |
|
495 | + * @return Response |
|
496 | 496 | */ |
497 | 497 | public function alert($sMessage) |
498 | 498 | { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @param string $sMessage The message to be displayed |
511 | 511 | * |
512 | - * @return \Jaxon\Plugin\Response |
|
512 | + * @return Response |
|
513 | 513 | */ |
514 | 514 | public function debug($sMessage) |
515 | 515 | { |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @param string $sURL The relative or fully qualified URL |
528 | 528 | * @param integer $iDelay Number of seconds to delay before the redirect occurs |
529 | 529 | * |
530 | - * @return \Jaxon\Plugin\Response |
|
530 | + * @return Response |
|
531 | 531 | */ |
532 | 532 | public function redirect($sURL, $iDelay=0) |
533 | 533 | { |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | * |
581 | 581 | * @param string $sJS The script to execute |
582 | 582 | * |
583 | - * @return \Jaxon\Plugin\Response |
|
583 | + * @return Response |
|
584 | 584 | */ |
585 | 585 | public function script($sJS) |
586 | 586 | { |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * |
598 | 598 | * @param string $sFunc The name of the function to call |
599 | 599 | * |
600 | - * @return \Jaxon\Plugin\Response |
|
600 | + * @return Response |
|
601 | 601 | */ |
602 | 602 | public function call($sFunc) |
603 | 603 | { |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | * |
618 | 618 | * @param string $sTarget The id of the element to be removed |
619 | 619 | * |
620 | - * @return \Jaxon\Plugin\Response |
|
620 | + * @return Response |
|
621 | 621 | */ |
622 | 622 | public function remove($sTarget) |
623 | 623 | { |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | * @param string $sTag The tag name to be used for the new element |
638 | 638 | * @param string $sId The id to assign to the new element |
639 | 639 | * |
640 | - * @return \Jaxon\Plugin\Response |
|
640 | + * @return Response |
|
641 | 641 | */ |
642 | 642 | public function create($sParent, $sTag, $sId) |
643 | 643 | { |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * @param string $sTag The tag name to be used for the new element |
659 | 659 | * @param string $sId The id to assign to the new element |
660 | 660 | * |
661 | - * @return \Jaxon\Plugin\Response |
|
661 | + * @return Response |
|
662 | 662 | */ |
663 | 663 | public function insert($sBefore, $sTag, $sId) |
664 | 664 | { |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | * @param string $sTag The tag name to be used for the new element |
680 | 680 | * @param string $sId The id to assign to the new element |
681 | 681 | * |
682 | - * @return \Jaxon\Plugin\Response |
|
682 | + * @return Response |
|
683 | 683 | */ |
684 | 684 | public function insertAfter($sAfter, $sTag, $sId) |
685 | 685 | { |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * @param string $sName The name of the new input element |
702 | 702 | * @param string $sId The id of the new element |
703 | 703 | * |
704 | - * @return \Jaxon\Plugin\Response |
|
704 | + * @return Response |
|
705 | 705 | */ |
706 | 706 | public function createInput($sParent, $sType, $sName, $sId) |
707 | 707 | { |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | * @param string $sName The name of the new input element |
725 | 725 | * @param string $sId The id of the new element |
726 | 726 | * |
727 | - * @return \Jaxon\Plugin\Response |
|
727 | + * @return Response |
|
728 | 728 | */ |
729 | 729 | public function insertInput($sBefore, $sType, $sName, $sId) |
730 | 730 | { |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * @param string $sName The name of the new input element |
748 | 748 | * @param string $sId The id of the new element |
749 | 749 | * |
750 | - * @return \Jaxon\Plugin\Response |
|
750 | + * @return Response |
|
751 | 751 | */ |
752 | 752 | public function insertInputAfter($sAfter, $sType, $sName, $sId) |
753 | 753 | { |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * @param string $sEvent The name of the event |
770 | 770 | * @param string $sScript The javascript to execute when the event is fired |
771 | 771 | * |
772 | - * @return \Jaxon\Plugin\Response |
|
772 | + * @return Response |
|
773 | 773 | */ |
774 | 774 | public function setEvent($sTarget, $sEvent, $sScript) |
775 | 775 | { |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | * @param string $sTarget The id of the element that contains the event |
790 | 790 | * @param string $sScript The javascript to execute when the event is fired |
791 | 791 | * |
792 | - * @return \Jaxon\Plugin\Response |
|
792 | + * @return Response |
|
793 | 793 | */ |
794 | 794 | public function onClick($sTarget, $sScript) |
795 | 795 | { |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | * @param string $sEvent The name of the event |
806 | 806 | * @param string $sHandler The name of the javascript function to call when the event is fired |
807 | 807 | * |
808 | - * @return \Jaxon\Plugin\Response |
|
808 | + * @return Response |
|
809 | 809 | */ |
810 | 810 | public function addHandler($sTarget, $sEvent, $sHandler) |
811 | 811 | { |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | * @param string $sEvent The name of the event |
827 | 827 | * @param string $sHandler The name of the javascript function called when the event is fired |
828 | 828 | * |
829 | - * @return \Jaxon\Plugin\Response |
|
829 | + * @return Response |
|
830 | 830 | */ |
831 | 831 | public function removeHandler($sTarget, $sEvent, $sHandler) |
832 | 832 | { |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | * @param string $sArgs Comma separated list of parameter names |
848 | 848 | * @param string $sScript The javascript code that will become the body of the function |
849 | 849 | * |
850 | - * @return \Jaxon\Plugin\Response |
|
850 | + * @return Response |
|
851 | 851 | */ |
852 | 852 | public function setFunction($sFunction, $sArgs, $sScript) |
853 | 853 | { |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | * @param string $sReturnValueVar The name of the variable that will retain the return value |
875 | 875 | * from the call to the original function |
876 | 876 | * |
877 | - * @return \Jaxon\Plugin\Response |
|
877 | + * @return Response |
|
878 | 878 | */ |
879 | 879 | public function wrapFunction($sFunction, $sArgs, $aScripts, $sReturnValueVar) |
880 | 880 | { |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | * @param string $sFileName The relative or fully qualified URI of the javascript file |
896 | 896 | * @param string $sType Determines the script type. Defaults to 'text/javascript' |
897 | 897 | * |
898 | - * @return \Jaxon\Plugin\Response |
|
898 | + * @return Response |
|
899 | 899 | */ |
900 | 900 | public function includeScript($sFileName, $sType = null, $sId = null) |
901 | 901 | { |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | * @param string $sFileName The relative or fully qualified URI of the javascript file |
917 | 917 | * @param string $sType Determines the script type. Defaults to 'text/javascript' |
918 | 918 | * |
919 | - * @return \Jaxon\Plugin\Response |
|
919 | + * @return Response |
|
920 | 920 | */ |
921 | 921 | public function includeScriptOnce($sFileName, $sType = null, $sId = null) |
922 | 922 | { |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | * @param string $sFileName The relative or fully qualified URI of the javascript file |
940 | 940 | * @param string $sUnload Name of a javascript function to call prior to unlaoding the file |
941 | 941 | * |
942 | - * @return \Jaxon\Plugin\Response |
|
942 | + * @return Response |
|
943 | 943 | */ |
944 | 944 | public function removeScript($sFileName, $sUnload = '') |
945 | 945 | { |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | * @param string $sFileName The relative or fully qualified URI of the css file |
961 | 961 | * @param string $sMedia The media type of the CSS file. Defaults to 'screen' |
962 | 962 | * |
963 | - * @return \Jaxon\Plugin\Response |
|
963 | + * @return Response |
|
964 | 964 | */ |
965 | 965 | public function includeCSS($sFileName, $sMedia = null) |
966 | 966 | { |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | * |
980 | 980 | * @param string $sFileName The relative or fully qualified URI of the css file |
981 | 981 | * |
982 | - * @return \Jaxon\Plugin\Response |
|
982 | + * @return Response |
|
983 | 983 | */ |
984 | 984 | public function removeCSS($sFileName, $sMedia = null) |
985 | 985 | { |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | * @param integer $iTimeout The number of 1/10ths of a second to pause before timing out |
1005 | 1005 | * and continuing with the execution of the response commands |
1006 | 1006 | * |
1007 | - * @return \Jaxon\Plugin\Response |
|
1007 | + * @return Response |
|
1008 | 1008 | */ |
1009 | 1009 | public function waitForCSS($iTimeout = 600) |
1010 | 1010 | { |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | * @param integer $tenths The number of 1/10ths of a second to wait before timing out |
1030 | 1030 | * and continuing with the execution of the response commands. |
1031 | 1031 | * |
1032 | - * @return \Jaxon\Plugin\Response |
|
1032 | + * @return Response |
|
1033 | 1033 | */ |
1034 | 1034 | public function waitFor($script, $tenths) |
1035 | 1035 | { |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | * |
1051 | 1051 | * @param integer $tenths The number of 1/10ths of a second to sleep |
1052 | 1052 | * |
1053 | - * @return \Jaxon\Plugin\Response |
|
1053 | + * @return Response |
|
1054 | 1054 | */ |
1055 | 1055 | public function sleep($tenths) |
1056 | 1056 | { |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | * @param string $variable The DOM element name (id or class) |
1080 | 1080 | * @param string $tag The HTML tag of the new DOM element |
1081 | 1081 | * |
1082 | - * @return \Jaxon\Plugin\Response |
|
1082 | + * @return Response |
|
1083 | 1083 | */ |
1084 | 1084 | public function domCreateElement($variable, $tag) |
1085 | 1085 | { |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | * @param string $key The name of the attribute |
1100 | 1100 | * @param string $value The value of the attribute |
1101 | 1101 | * |
1102 | - * @return \Jaxon\Plugin\Response |
|
1102 | + * @return Response |
|
1103 | 1103 | */ |
1104 | 1104 | public function domSetAttribute($variable, $key, $value) |
1105 | 1105 | { |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | * @param string $skip The ?? |
1121 | 1121 | * @param string $remove The ?? |
1122 | 1122 | * |
1123 | - * @return \Jaxon\Plugin\Response |
|
1123 | + * @return Response |
|
1124 | 1124 | */ |
1125 | 1125 | public function domRemoveChildren($parent, $skip = null, $remove = null) |
1126 | 1126 | { |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | * @param string $parent The DOM parent element |
1142 | 1142 | * @param string $variable The DOM element name (id or class) |
1143 | 1143 | * |
1144 | - * @return \Jaxon\Plugin\Response |
|
1144 | + * @return Response |
|
1145 | 1145 | */ |
1146 | 1146 | public function domAppendChild($parent, $variable) |
1147 | 1147 | { |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | * @param string $target The DOM target element |
1161 | 1161 | * @param string $variable The DOM element name (id or class) |
1162 | 1162 | * |
1163 | - * @return \Jaxon\Plugin\Response |
|
1163 | + * @return Response |
|
1164 | 1164 | */ |
1165 | 1165 | public function domInsertBefore($target, $variable) |
1166 | 1166 | { |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | * @param string $target The DOM target element |
1180 | 1180 | * @param string $variable The DOM element name (id or class) |
1181 | 1181 | * |
1182 | - * @return \Jaxon\Plugin\Response |
|
1182 | + * @return Response |
|
1183 | 1183 | */ |
1184 | 1184 | public function domInsertAfter($target, $variable) |
1185 | 1185 | { |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | * @param string $parent The DOM parent element |
1199 | 1199 | * @param string $text The HTML text to append |
1200 | 1200 | * |
1201 | - * @return \Jaxon\Plugin\Response |
|
1201 | + * @return Response |
|
1202 | 1202 | */ |
1203 | 1203 | public function domAppendText($parent, $text) |
1204 | 1204 | { |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | * |
1240 | 1240 | * @param mixed $value Any value |
1241 | 1241 | * |
1242 | - * @return \Jaxon\Plugin\Response |
|
1242 | + * @return Response |
|
1243 | 1243 | */ |
1244 | 1244 | public function setReturnValue($value) |
1245 | 1245 | { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function plugin($sName) |
97 | 97 | { |
98 | 98 | $xPlugin = $this->getPluginManager()->getResponsePlugin($sName); |
99 | - if(!$xPlugin) |
|
99 | + if (!$xPlugin) |
|
100 | 100 | { |
101 | 101 | return null; |
102 | 102 | } |
@@ -159,23 +159,23 @@ discard block |
||
159 | 159 | public function addCommand($aAttributes, $mData) |
160 | 160 | { |
161 | 161 | /* merge commands if possible */ |
162 | - if(in_array($aAttributes['cmd'], ['js', 'ap'])) |
|
162 | + if (in_array($aAttributes['cmd'], ['js', 'ap'])) |
|
163 | 163 | { |
164 | - if(($aLastCommand = array_pop($this->aCommands))) |
|
164 | + if (($aLastCommand = array_pop($this->aCommands))) |
|
165 | 165 | { |
166 | - if($aLastCommand['cmd'] == $aAttributes['cmd']) |
|
166 | + if ($aLastCommand['cmd'] == $aAttributes['cmd']) |
|
167 | 167 | { |
168 | - if($this->getOption('core.response.merge.js') && |
|
168 | + if ($this->getOption('core.response.merge.js') && |
|
169 | 169 | $aLastCommand['cmd'] == 'js') |
170 | 170 | { |
171 | - $mData = $aLastCommand['data'].'; '.$mData; |
|
171 | + $mData = $aLastCommand['data'] . '; ' . $mData; |
|
172 | 172 | } |
173 | - elseif($this->getOption('core.response.merge.ap') && |
|
173 | + elseif ($this->getOption('core.response.merge.ap') && |
|
174 | 174 | $aLastCommand['cmd'] == 'ap' && |
175 | 175 | $aLastCommand['id'] == $aAttributes['id'] && |
176 | 176 | $aLastCommand['prop'] == $aAttributes['prop']) |
177 | 177 | { |
178 | - $mData = $aLastCommand['data'].' '.$mData; |
|
178 | + $mData = $aLastCommand['data'] . ' ' . $mData; |
|
179 | 179 | } |
180 | 180 | else |
181 | 181 | { |
@@ -233,26 +233,26 @@ discard block |
||
233 | 233 | public function appendResponse($mCommands, $bBefore = false) |
234 | 234 | { |
235 | 235 | $aCommands = []; |
236 | - if($mCommands instanceof Response) |
|
236 | + if ($mCommands instanceof Response) |
|
237 | 237 | { |
238 | 238 | $this->returnValue = $mCommands->returnValue; |
239 | 239 | $aCommands = $mCommands->aCommands; |
240 | 240 | } |
241 | - elseif(is_array($mCommands)) |
|
241 | + elseif (is_array($mCommands)) |
|
242 | 242 | { |
243 | 243 | $aCommands = $mCommands; |
244 | 244 | } |
245 | 245 | else |
246 | 246 | { |
247 | - if(!empty($mCommands)) |
|
247 | + if (!empty($mCommands)) |
|
248 | 248 | { |
249 | 249 | throw new \Jaxon\Exception\Error($this->trans('errors.response.data.invalid')); |
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | - if(count($aCommands) > 0) |
|
253 | + if (count($aCommands) > 0) |
|
254 | 254 | { |
255 | - if($bBefore) |
|
255 | + if ($bBefore) |
|
256 | 256 | { |
257 | 257 | $this->aCommands = array_merge($aCommands, $this->aCommands); |
258 | 258 | } |
@@ -524,33 +524,33 @@ discard block |
||
524 | 524 | * |
525 | 525 | * @return \Jaxon\Plugin\Response |
526 | 526 | */ |
527 | - public function redirect($sURL, $iDelay=0) |
|
527 | + public function redirect($sURL, $iDelay = 0) |
|
528 | 528 | { |
529 | 529 | // we need to parse the query part so that the values are rawurlencode()'ed |
530 | 530 | // can't just use parse_url() cos we could be dealing with a relative URL which |
531 | 531 | // parse_url() can't deal with. |
532 | 532 | $queryStart = strpos($sURL, '?', strrpos($sURL, '/')); |
533 | - if($queryStart !== false) |
|
533 | + if ($queryStart !== false) |
|
534 | 534 | { |
535 | 535 | $queryStart++; |
536 | 536 | $queryEnd = strpos($sURL, '#', $queryStart); |
537 | - if($queryEnd === false) |
|
537 | + if ($queryEnd === false) |
|
538 | 538 | $queryEnd = strlen($sURL); |
539 | - $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart); |
|
539 | + $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart); |
|
540 | 540 | parse_str($queryPart, $queryParts); |
541 | 541 | $newQueryPart = ""; |
542 | - if($queryParts) |
|
542 | + if ($queryParts) |
|
543 | 543 | { |
544 | 544 | $first = true; |
545 | - foreach($queryParts as $key => $value) |
|
545 | + foreach ($queryParts as $key => $value) |
|
546 | 546 | { |
547 | - if($first) |
|
547 | + if ($first) |
|
548 | 548 | $first = false; |
549 | 549 | else |
550 | 550 | $newQueryPart .= '&'; |
551 | - $newQueryPart .= rawurlencode($key).'='.rawurlencode($value); |
|
551 | + $newQueryPart .= rawurlencode($key) . '=' . rawurlencode($value); |
|
552 | 552 | } |
553 | - } elseif($_SERVER['QUERY_STRING']) { |
|
553 | + } elseif ($_SERVER['QUERY_STRING']) { |
|
554 | 554 | //couldn't break up the query, but there's one there |
555 | 555 | //possibly "http://url/page.html?query1234" type of query? |
556 | 556 | //just encode it and hope it works |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | } |
559 | 559 | $sURL = str_replace($queryPart, $newQueryPart, $sURL); |
560 | 560 | } |
561 | - if($iDelay) |
|
562 | - $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
561 | + if ($iDelay) |
|
562 | + $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay * 1000) . ');'); |
|
563 | 563 | else |
564 | 564 | $this->script('window.location = "' . $sURL . '";'); |
565 | 565 | return $this; |
@@ -896,10 +896,10 @@ discard block |
||
896 | 896 | { |
897 | 897 | $command = ['cmd' => 'in']; |
898 | 898 | |
899 | - if(($sType)) |
|
899 | + if (($sType)) |
|
900 | 900 | $command['type'] = trim((string)$sType, " \t"); |
901 | 901 | |
902 | - if(($sId)) |
|
902 | + if (($sId)) |
|
903 | 903 | $command['elm_id'] = trim((string)$sId, " \t"); |
904 | 904 | |
905 | 905 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -917,10 +917,10 @@ discard block |
||
917 | 917 | { |
918 | 918 | $command = ['cmd' => 'ino']; |
919 | 919 | |
920 | - if(($sType)) |
|
920 | + if (($sType)) |
|
921 | 921 | $command['type'] = trim((string)$sType, " \t"); |
922 | 922 | |
923 | - if(($sId)) |
|
923 | + if (($sId)) |
|
924 | 924 | $command['elm_id'] = trim((string)$sId, " \t"); |
925 | 925 | |
926 | 926 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | { |
962 | 962 | $command = ['cmd' => 'css']; |
963 | 963 | |
964 | - if(($sMedia)) |
|
964 | + if (($sMedia)) |
|
965 | 965 | $command['media'] = trim((string)$sMedia, " \t"); |
966 | 966 | |
967 | 967 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | { |
981 | 981 | $command = ['cmd' => 'rcss']; |
982 | 982 | |
983 | - if(($sMedia)) |
|
983 | + if (($sMedia)) |
|
984 | 984 | $command['media'] = trim((string)$sMedia, " \t"); |
985 | 985 | |
986 | 986 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -1121,10 +1121,10 @@ discard block |
||
1121 | 1121 | { |
1122 | 1122 | $command = ['cmd' => 'DRC']; |
1123 | 1123 | |
1124 | - if(($skip)) |
|
1124 | + if (($skip)) |
|
1125 | 1125 | $command['skip'] = $skip; |
1126 | 1126 | |
1127 | - if(($remove)) |
|
1127 | + if (($remove)) |
|
1128 | 1128 | $command['remove'] = $remove; |
1129 | 1129 | |
1130 | 1130 | return $this->addCommand($command, $parent); |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | */ |
1250 | 1250 | public function sendHeaders() |
1251 | 1251 | { |
1252 | - if($this->getRequesthandler()->requestMethodIsGet()) |
|
1252 | + if ($this->getRequesthandler()->requestMethodIsGet()) |
|
1253 | 1253 | { |
1254 | 1254 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
1255 | 1255 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | |
1260 | 1260 | $sCharacterSet = ''; |
1261 | 1261 | $sCharacterEncoding = trim($this->getOption('core.encoding')); |
1262 | - if(($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
1262 | + if (($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
1263 | 1263 | { |
1264 | 1264 | $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"'; |
1265 | 1265 | } |
@@ -1276,13 +1276,13 @@ discard block |
||
1276 | 1276 | { |
1277 | 1277 | $response = []; |
1278 | 1278 | |
1279 | - if(($this->returnValue)) |
|
1279 | + if (($this->returnValue)) |
|
1280 | 1280 | { |
1281 | 1281 | $response['jxnrv'] = $this->returnValue; |
1282 | 1282 | } |
1283 | 1283 | $response['jxnobj'] = []; |
1284 | 1284 | |
1285 | - foreach($this->aCommands as $xCommand) |
|
1285 | + foreach ($this->aCommands as $xCommand) |
|
1286 | 1286 | { |
1287 | 1287 | $response['jxnobj'][] = $xCommand; |
1288 | 1288 | } |
@@ -169,20 +169,17 @@ discard block |
||
169 | 169 | $aLastCommand['cmd'] == 'js') |
170 | 170 | { |
171 | 171 | $mData = $aLastCommand['data'].'; '.$mData; |
172 | - } |
|
173 | - elseif($this->getOption('core.response.merge.ap') && |
|
172 | + } elseif($this->getOption('core.response.merge.ap') && |
|
174 | 173 | $aLastCommand['cmd'] == 'ap' && |
175 | 174 | $aLastCommand['id'] == $aAttributes['id'] && |
176 | 175 | $aLastCommand['prop'] == $aAttributes['prop']) |
177 | 176 | { |
178 | 177 | $mData = $aLastCommand['data'].' '.$mData; |
179 | - } |
|
180 | - else |
|
178 | + } else |
|
181 | 179 | { |
182 | 180 | $this->aCommands[] = $aLastCommand; |
183 | 181 | } |
184 | - } |
|
185 | - else |
|
182 | + } else |
|
186 | 183 | { |
187 | 184 | $this->aCommands[] = $aLastCommand; |
188 | 185 | } |
@@ -237,12 +234,10 @@ discard block |
||
237 | 234 | { |
238 | 235 | $this->returnValue = $mCommands->returnValue; |
239 | 236 | $aCommands = $mCommands->aCommands; |
240 | - } |
|
241 | - elseif(is_array($mCommands)) |
|
237 | + } elseif(is_array($mCommands)) |
|
242 | 238 | { |
243 | 239 | $aCommands = $mCommands; |
244 | - } |
|
245 | - else |
|
240 | + } else |
|
246 | 241 | { |
247 | 242 | if(!empty($mCommands)) |
248 | 243 | { |
@@ -255,8 +250,7 @@ discard block |
||
255 | 250 | if($bBefore) |
256 | 251 | { |
257 | 252 | $this->aCommands = array_merge($aCommands, $this->aCommands); |
258 | - } |
|
259 | - else |
|
253 | + } else |
|
260 | 254 | { |
261 | 255 | $this->aCommands = array_merge($this->aCommands, $aCommands); |
262 | 256 | } |
@@ -534,8 +528,9 @@ discard block |
||
534 | 528 | { |
535 | 529 | $queryStart++; |
536 | 530 | $queryEnd = strpos($sURL, '#', $queryStart); |
537 | - if($queryEnd === false) |
|
538 | - $queryEnd = strlen($sURL); |
|
531 | + if($queryEnd === false) { |
|
532 | + $queryEnd = strlen($sURL); |
|
533 | + } |
|
539 | 534 | $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart); |
540 | 535 | parse_str($queryPart, $queryParts); |
541 | 536 | $newQueryPart = ""; |
@@ -544,10 +539,11 @@ discard block |
||
544 | 539 | $first = true; |
545 | 540 | foreach($queryParts as $key => $value) |
546 | 541 | { |
547 | - if($first) |
|
548 | - $first = false; |
|
549 | - else |
|
550 | - $newQueryPart .= '&'; |
|
542 | + if($first) { |
|
543 | + $first = false; |
|
544 | + } else { |
|
545 | + $newQueryPart .= '&'; |
|
546 | + } |
|
551 | 547 | $newQueryPart .= rawurlencode($key).'='.rawurlencode($value); |
552 | 548 | } |
553 | 549 | } elseif($_SERVER['QUERY_STRING']) { |
@@ -558,10 +554,11 @@ discard block |
||
558 | 554 | } |
559 | 555 | $sURL = str_replace($queryPart, $newQueryPart, $sURL); |
560 | 556 | } |
561 | - if($iDelay) |
|
562 | - $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
563 | - else |
|
564 | - $this->script('window.location = "' . $sURL . '";'); |
|
557 | + if($iDelay) { |
|
558 | + $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
559 | + } else { |
|
560 | + $this->script('window.location = "' . $sURL . '";'); |
|
561 | + } |
|
565 | 562 | return $this; |
566 | 563 | } |
567 | 564 | |
@@ -896,11 +893,13 @@ discard block |
||
896 | 893 | { |
897 | 894 | $command = ['cmd' => 'in']; |
898 | 895 | |
899 | - if(($sType)) |
|
900 | - $command['type'] = trim((string)$sType, " \t"); |
|
896 | + if(($sType)) { |
|
897 | + $command['type'] = trim((string)$sType, " \t"); |
|
898 | + } |
|
901 | 899 | |
902 | - if(($sId)) |
|
903 | - $command['elm_id'] = trim((string)$sId, " \t"); |
|
900 | + if(($sId)) { |
|
901 | + $command['elm_id'] = trim((string)$sId, " \t"); |
|
902 | + } |
|
904 | 903 | |
905 | 904 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
906 | 905 | } |
@@ -917,11 +916,13 @@ discard block |
||
917 | 916 | { |
918 | 917 | $command = ['cmd' => 'ino']; |
919 | 918 | |
920 | - if(($sType)) |
|
921 | - $command['type'] = trim((string)$sType, " \t"); |
|
919 | + if(($sType)) { |
|
920 | + $command['type'] = trim((string)$sType, " \t"); |
|
921 | + } |
|
922 | 922 | |
923 | - if(($sId)) |
|
924 | - $command['elm_id'] = trim((string)$sId, " \t"); |
|
923 | + if(($sId)) { |
|
924 | + $command['elm_id'] = trim((string)$sId, " \t"); |
|
925 | + } |
|
925 | 926 | |
926 | 927 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
927 | 928 | } |
@@ -961,8 +962,9 @@ discard block |
||
961 | 962 | { |
962 | 963 | $command = ['cmd' => 'css']; |
963 | 964 | |
964 | - if(($sMedia)) |
|
965 | - $command['media'] = trim((string)$sMedia, " \t"); |
|
965 | + if(($sMedia)) { |
|
966 | + $command['media'] = trim((string)$sMedia, " \t"); |
|
967 | + } |
|
966 | 968 | |
967 | 969 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
968 | 970 | } |
@@ -980,8 +982,9 @@ discard block |
||
980 | 982 | { |
981 | 983 | $command = ['cmd' => 'rcss']; |
982 | 984 | |
983 | - if(($sMedia)) |
|
984 | - $command['media'] = trim((string)$sMedia, " \t"); |
|
985 | + if(($sMedia)) { |
|
986 | + $command['media'] = trim((string)$sMedia, " \t"); |
|
987 | + } |
|
985 | 988 | |
986 | 989 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
987 | 990 | } |
@@ -1121,11 +1124,13 @@ discard block |
||
1121 | 1124 | { |
1122 | 1125 | $command = ['cmd' => 'DRC']; |
1123 | 1126 | |
1124 | - if(($skip)) |
|
1125 | - $command['skip'] = $skip; |
|
1127 | + if(($skip)) { |
|
1128 | + $command['skip'] = $skip; |
|
1129 | + } |
|
1126 | 1130 | |
1127 | - if(($remove)) |
|
1128 | - $command['remove'] = $remove; |
|
1131 | + if(($remove)) { |
|
1132 | + $command['remove'] = $remove; |
|
1133 | + } |
|
1129 | 1134 | |
1130 | 1135 | return $this->addCommand($command, $parent); |
1131 | 1136 | } |
@@ -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 | } |
@@ -57,12 +57,10 @@ |
||
57 | 57 | if(!$sSelector) |
58 | 58 | { |
59 | 59 | $this->sSelector = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead |
60 | - } |
|
61 | - elseif(($sContext)) |
|
60 | + } elseif(($sContext)) |
|
62 | 61 | { |
63 | 62 | $this->sSelector = "$jQueryNs('" . $sSelector . "', $jQueryNs('" . $sContext . "'))"; |
64 | - } |
|
65 | - else |
|
63 | + } else |
|
66 | 64 | { |
67 | 65 | $this->sSelector = "$jQueryNs('" . $sSelector . "')"; |
68 | 66 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | public function render($sPath, array $aVars = []) |
28 | 28 | { |
29 | 29 | // Make the template vars available as attributes |
30 | - foreach($aVars as $sName => $xValue) |
|
30 | + foreach ($aVars as $sName => $xValue) |
|
31 | 31 | { |
32 | 32 | $sName = (string)$sName; |
33 | 33 | $this->$sName = $xValue; |
@@ -270,8 +270,7 @@ discard block |
||
270 | 270 | $aVariables[$sParameterStr] = $sVarName; |
271 | 271 | $sVars .= "$sVarName=$xParameter;"; |
272 | 272 | $nVarId++; |
273 | - } |
|
274 | - else |
|
273 | + } else |
|
275 | 274 | { |
276 | 275 | // The value is already defined. The corresponding variable is assigned. |
277 | 276 | $sVarName = $aVariables[$sParameterStr]; |
@@ -300,8 +299,7 @@ discard block |
||
300 | 299 | $aVariables[$sParameterStr] = $sVarName; |
301 | 300 | $sVars .= "$sVarName=$xParameter;"; |
302 | 301 | $nVarId++; |
303 | - } |
|
304 | - else |
|
302 | + } else |
|
305 | 303 | { |
306 | 304 | // The value is already defined. The corresponding variable is assigned. |
307 | 305 | $sVarName = $aVariables[$sParameterStr]; |
@@ -320,8 +318,7 @@ discard block |
||
320 | 318 | if($this->sCondition == '__confirm__') |
321 | 319 | { |
322 | 320 | $sScript = $xDialog->confirm($sPhrase, $sScript, ''); |
323 | - } |
|
324 | - elseif($this->sCondition !== null) |
|
321 | + } elseif($this->sCondition !== null) |
|
325 | 322 | { |
326 | 323 | $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}'; |
327 | 324 | if(($sPhrase)) |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * @param integer $nItemsPerPage The number of items per page page |
240 | 240 | * @param integer $nItemsTotal The total number of items |
241 | 241 | * |
242 | - * @return Paginator |
|
242 | + * @return \Jaxon\Utils\Pagination\Paginator |
|
243 | 243 | */ |
244 | 244 | public function pg($nCurrentPage, $nItemsPerPage, $nItemsTotal) |
245 | 245 | { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @param integer $nItemsPerPage The number of items per page page |
255 | 255 | * @param integer $nItemsTotal The total number of items |
256 | 256 | * |
257 | - * @return Paginator |
|
257 | + * @return \Jaxon\Utils\Pagination\Paginator |
|
258 | 258 | */ |
259 | 259 | public function paginate($nCurrentPage, $nItemsPerPage, $nItemsTotal) |
260 | 260 | { |
@@ -20,7 +20,6 @@ |
||
20 | 20 | |
21 | 21 | namespace Jaxon\Request\Factory; |
22 | 22 | |
23 | -use JsonSerializable; |
|
24 | 23 | use Jaxon\Request\Factory\Parameter; |
25 | 24 | use Jaxon\Response\Plugin\JQuery\Dom\Element as DomElement; |
26 | 25 |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function hasPageNumber() |
54 | 54 | { |
55 | - foreach($this->aParameters as $xParameter) |
|
55 | + foreach ($this->aParameters as $xParameter) |
|
56 | 56 | { |
57 | - if($xParameter->getType() == Parameter::PAGE_NUMBER) |
|
57 | + if ($xParameter->getType() == Parameter::PAGE_NUMBER) |
|
58 | 58 | { |
59 | 59 | return true; |
60 | 60 | } |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | public function setPageNumber($nPageNumber) |
73 | 73 | { |
74 | 74 | // Set the value of the Parameter::PAGE_NUMBER parameter |
75 | - foreach($this->aParameters as $xParameter) |
|
75 | + foreach ($this->aParameters as $xParameter) |
|
76 | 76 | { |
77 | - if($xParameter->getType() == Parameter::PAGE_NUMBER) |
|
77 | + if ($xParameter->getType() == Parameter::PAGE_NUMBER) |
|
78 | 78 | { |
79 | 79 | $xParameter->setValue(intval($nPageNumber)); |
80 | 80 | break; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | private function setMessageArgs(array $aArgs) |
94 | 94 | { |
95 | - array_walk($aArgs, function (&$xParameter) { |
|
95 | + array_walk($aArgs, function(&$xParameter) { |
|
96 | 96 | $xParameter = Parameter::make($xParameter); |
97 | 97 | }); |
98 | 98 | $this->aMessageArgs = $aArgs; |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | // This array will avoid declaring multiple variables with the same value. |
148 | 148 | // The array key is the variable value, while the array value is the variable name. |
149 | 149 | $aVariables = []; // Array of local variables. |
150 | - foreach($this->aParameters as &$xParameter) |
|
150 | + foreach ($this->aParameters as &$xParameter) |
|
151 | 151 | { |
152 | 152 | $sParameterStr = $xParameter->getScript(); |
153 | - if($xParameter instanceof DomElement) |
|
153 | + if ($xParameter instanceof DomElement) |
|
154 | 154 | { |
155 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
155 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
156 | 156 | { |
157 | 157 | // The value is not yet defined. A new variable is created. |
158 | 158 | $sVarName = "jxnVar$nVarId"; |
@@ -170,19 +170,19 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | $sPhrase = ''; |
173 | - if(count($this->aMessageArgs) > 0) |
|
173 | + if (count($this->aMessageArgs) > 0) |
|
174 | 174 | { |
175 | 175 | $sPhrase = array_shift($this->aMessageArgs); // The first array entry is the question. |
176 | 176 | // $sPhrase = "'" . addslashes($sPhrase) . "'"; // Wrap the phrase with single quotes |
177 | - if(count($this->aMessageArgs) > 0) |
|
177 | + if (count($this->aMessageArgs) > 0) |
|
178 | 178 | { |
179 | 179 | $nParamId = 1; |
180 | - foreach($this->aMessageArgs as &$xParameter) |
|
180 | + foreach ($this->aMessageArgs as &$xParameter) |
|
181 | 181 | { |
182 | 182 | $sParameterStr = $xParameter->getScript(); |
183 | - if($xParameter instanceof DomElement) |
|
183 | + if ($xParameter instanceof DomElement) |
|
184 | 184 | { |
185 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
185 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
186 | 186 | { |
187 | 187 | // The value is not yet defined. A new variable is created. |
188 | 188 | $sVarName = "jxnVar$nVarId"; |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | |
207 | 207 | $sScript = parent::getScript(); |
208 | 208 | $xDialog = jaxon()->dialog(); |
209 | - if($this->sCondition == '__confirm__') |
|
209 | + if ($this->sCondition == '__confirm__') |
|
210 | 210 | { |
211 | 211 | $sScript = $xDialog->confirm($sPhrase, $sScript, ''); |
212 | 212 | } |
213 | - elseif($this->sCondition !== null) |
|
213 | + elseif ($this->sCondition !== null) |
|
214 | 214 | { |
215 | 215 | $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}'; |
216 | - if(($sPhrase)) |
|
216 | + if (($sPhrase)) |
|
217 | 217 | { |
218 | 218 | $xDialog->getAlert()->setReturn(true); |
219 | 219 | $sScript .= 'else{' . $xDialog->warning($sPhrase) . ';}'; |
@@ -59,7 +59,7 @@ |
||
59 | 59 | /** |
60 | 60 | * Process an incoming Jaxon request, and return the response. |
61 | 61 | * |
62 | - * @return void |
|
62 | + * @return boolean|null |
|
63 | 63 | */ |
64 | 64 | public function processRequest() |
65 | 65 | { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function setup($sConfigFile) |
30 | 30 | { |
31 | - if(!file_exists($sConfigFile)) |
|
31 | + if (!file_exists($sConfigFile)) |
|
32 | 32 | { |
33 | 33 | throw new Exception("Unable to find config file at $sConfigFile"); |
34 | 34 | } |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | $aLibOptions = key_exists('lib', $aOptions) ? $aOptions['lib'] : []; |
39 | 39 | $aAppOptions = key_exists('app', $aOptions) ? $aOptions['app'] : []; |
40 | 40 | |
41 | - if(!is_array($aLibOptions) || !is_array($aAppOptions)) |
|
41 | + if (!is_array($aLibOptions) || !is_array($aAppOptions)) |
|
42 | 42 | { |
43 | 43 | throw new Exception("Unexpected content in config file at $sConfigFile"); |
44 | 44 | } |
45 | 45 | |
46 | 46 | // Set the session manager |
47 | - jaxon()->di()->setSessionManager(function () { |
|
47 | + jaxon()->di()->setSessionManager(function() { |
|
48 | 48 | return new SessionManager(); |
49 | 49 | }); |
50 | 50 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @var array $aLibOptions The library options |
74 | 74 | * |
75 | - * @return Boot |
|
75 | + * @return Bootstrap |
|
76 | 76 | */ |
77 | 77 | public function lib(array $aLibOptions) |
78 | 78 | { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @var array $aAppOptions The application options |
87 | 87 | * |
88 | - * @return Boot |
|
88 | + * @return Bootstrap |
|
89 | 89 | */ |
90 | 90 | public function app(array $aAppOptions) |
91 | 91 | { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @var string $sUri The ajax endpoint URI |
100 | 100 | * |
101 | - * @return Boot |
|
101 | + * @return Bootstrap |
|
102 | 102 | */ |
103 | 103 | public function uri($sUri) |
104 | 104 | { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @var |
113 | 113 | * |
114 | - * @return Boot |
|
114 | + * @return Bootstrap |
|
115 | 115 | */ |
116 | 116 | public function js($bExportJs, $sJsUri = '', $sJsDir = '', $bMinifyJs = false) |
117 | 117 | { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $this->triggerEvent('pre.setup'); |
155 | 155 | |
156 | 156 | // Add the view renderer |
157 | - $view->addRenderer('jaxon', function () { |
|
157 | + $view->addRenderer('jaxon', function() { |
|
158 | 158 | return new View\View(); |
159 | 159 | }); |
160 | 160 | |
@@ -181,24 +181,24 @@ discard block |
||
181 | 181 | // Use the Composer autoloader. It's important to call this before triggers and callbacks. |
182 | 182 | // $jaxon->useComposerAutoloader(); |
183 | 183 | // Jaxon library settings |
184 | - if(!$jaxon->hasOption('js.app.export')) |
|
184 | + if (!$jaxon->hasOption('js.app.export')) |
|
185 | 185 | { |
186 | 186 | $jaxon->setOption('js.app.export', $this->bExportJs); |
187 | 187 | } |
188 | - if(!$jaxon->hasOption('js.app.minify')) |
|
188 | + if (!$jaxon->hasOption('js.app.minify')) |
|
189 | 189 | { |
190 | 190 | $jaxon->setOption('js.app.minify', $this->bMinifyJs); |
191 | 191 | } |
192 | - if(!$jaxon->hasOption('js.app.uri') && $this->sJsUri != '') |
|
192 | + if (!$jaxon->hasOption('js.app.uri') && $this->sJsUri != '') |
|
193 | 193 | { |
194 | 194 | $jaxon->setOption('js.app.uri', $this->sJsUri); |
195 | 195 | } |
196 | - if(!$jaxon->hasOption('js.app.dir') && $this->sJsDir != '') |
|
196 | + if (!$jaxon->hasOption('js.app.dir') && $this->sJsDir != '') |
|
197 | 197 | { |
198 | 198 | $jaxon->setOption('js.app.dir', $this->sJsDir); |
199 | 199 | } |
200 | 200 | // Set the request URI |
201 | - if(!$jaxon->hasOption('core.request.uri') && $this->sUri != '') |
|
201 | + if (!$jaxon->hasOption('core.request.uri') && $this->sUri != '') |
|
202 | 202 | { |
203 | 203 | $jaxon->setOption('core.request.uri', $this->sUri); |
204 | 204 | } |
@@ -7,9 +7,8 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * Set the Jaxon application options. |
9 | 9 | * |
10 | - * @param Config $xAppConfig The config options |
|
11 | 10 | * |
12 | - * @return void |
|
11 | + * @return \Jaxon\App\Bootstrap |
|
13 | 12 | */ |
14 | 13 | protected function bootstrap() |
15 | 14 | { |
@@ -19,7 +18,7 @@ discard block |
||
19 | 18 | /** |
20 | 19 | * Get the Jaxon response. |
21 | 20 | * |
22 | - * @return Response |
|
21 | + * @return \Jaxon\Response\Response |
|
23 | 22 | */ |
24 | 23 | public function ajaxResponse() |
25 | 24 | { |
@@ -29,7 +28,7 @@ discard block |
||
29 | 28 | /** |
30 | 29 | * Get an instance of a registered class |
31 | 30 | * |
32 | - * @param string $sClass The class name |
|
31 | + * @param string $sClassName The class name |
|
33 | 32 | * |
34 | 33 | * @return mixed |
35 | 34 | */ |
@@ -41,7 +40,7 @@ discard block |
||
41 | 40 | /** |
42 | 41 | * Get a request to a registered class |
43 | 42 | * |
44 | - * @param string $sClass The class name |
|
43 | + * @param string $sClassName The class name |
|
45 | 44 | * |
46 | 45 | * @return \Jaxon\Request\Factory\CallableClass\Request |
47 | 46 | */ |
@@ -110,7 +109,7 @@ discard block |
||
110 | 109 | /** |
111 | 110 | * Get the view renderer |
112 | 111 | * |
113 | - * @return Jaxon\Utils\View\Renderer |
|
112 | + * @return \Jaxon\Utils\View\Renderer |
|
114 | 113 | */ |
115 | 114 | public function view() |
116 | 115 | { |
@@ -120,7 +119,7 @@ discard block |
||
120 | 119 | /** |
121 | 120 | * Get the session manager |
122 | 121 | * |
123 | - * @return Jaxon\Contracts\Session |
|
122 | + * @return \Jaxon\Contracts\Session |
|
124 | 123 | */ |
125 | 124 | public function session() |
126 | 125 | { |