@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | protected function alert($message) |
| 27 | 27 | { |
| 28 | - if($this->getReturn()) |
|
| 28 | + if ($this->getReturn()) |
|
| 29 | 29 | { |
| 30 | 30 | return 'alert(' . $message . ')'; |
| 31 | 31 | } |
@@ -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 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | /** |
| 177 | 177 | * Clear all the commands already added to the response |
| 178 | 178 | * |
| 179 | - * @return \Jaxon\Plugin\Response |
|
| 179 | + * @return Response |
|
| 180 | 180 | */ |
| 181 | 181 | public function clearCommands() |
| 182 | 182 | { |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @param \Jaxon\Plugin\Plugin $xPlugin The plugin object |
| 192 | 192 | * @param array $aAttributes The attributes for this response command |
| 193 | - * @param mixed $mData The data to be sent with this command |
|
| 193 | + * @param string $mData The data to be sent with this command |
|
| 194 | 194 | * |
| 195 | - * @return \Jaxon\Plugin\Response |
|
| 195 | + * @return Response |
|
| 196 | 196 | */ |
| 197 | 197 | public function addPluginCommand($xPlugin, $aAttributes, $mData) |
| 198 | 198 | { |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * @param integer $iCmdNumber The number of commands to skip upon cancel |
| 252 | 252 | * @param string $sMessage The message to display to the user |
| 253 | 253 | * |
| 254 | - * @return \Jaxon\Plugin\Response |
|
| 254 | + * @return Response |
|
| 255 | 255 | */ |
| 256 | 256 | public function confirmCommands($iCmdNumber, $sMessage) |
| 257 | 257 | { |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @param string $sAttribute The attribute to be assigned |
| 272 | 272 | * @param string $sData The value to be assigned to the attribute |
| 273 | 273 | * |
| 274 | - * @return \Jaxon\Plugin\Response |
|
| 274 | + * @return Response |
|
| 275 | 275 | */ |
| 276 | 276 | public function assign($sTarget, $sAttribute, $sData) |
| 277 | 277 | { |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | * @param string $sTarget The id of the html element on the browser |
| 294 | 294 | * @param string $sData The value to be assigned to the attribute |
| 295 | 295 | * |
| 296 | - * @return \Jaxon\Plugin\Response |
|
| 296 | + * @return Response |
|
| 297 | 297 | */ |
| 298 | 298 | public function html($sTarget, $sData) |
| 299 | 299 | { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * @param string $sAttribute The name of the attribute to be appended to |
| 308 | 308 | * @param string $sData The data to be appended to the attribute |
| 309 | 309 | * |
| 310 | - * @return \Jaxon\Plugin\Response |
|
| 310 | + * @return Response |
|
| 311 | 311 | */ |
| 312 | 312 | public function append($sTarget, $sAttribute, $sData) |
| 313 | 313 | { |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | * @param string $sAttribute The name of the attribute to be prepended to |
| 329 | 329 | * @param string $sData The value to be prepended to the attribute |
| 330 | 330 | * |
| 331 | - * @return \Jaxon\Plugin\Response |
|
| 331 | + * @return Response |
|
| 332 | 332 | */ |
| 333 | 333 | public function prepend($sTarget, $sAttribute, $sData) |
| 334 | 334 | { |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | * @param string $sSearch The needle to search for |
| 351 | 351 | * @param string $sData The data to use in place of the needle |
| 352 | 352 | * |
| 353 | - * @return \Jaxon\Plugin\Response |
|
| 353 | + * @return Response |
|
| 354 | 354 | */ |
| 355 | 355 | public function replace($sTarget, $sAttribute, $sSearch, $sData) |
| 356 | 356 | { |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | * @param string $sTarget The id of the element to be updated. |
| 374 | 374 | * @param string $sAttribute The attribute to be cleared |
| 375 | 375 | * |
| 376 | - * @return \Jaxon\Plugin\Response |
|
| 376 | + * @return Response |
|
| 377 | 377 | */ |
| 378 | 378 | public function clear($sTarget, $sAttribute) |
| 379 | 379 | { |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | * @param string $sAttribute The attribute to be updated |
| 390 | 390 | * @param string $sData The value to assign |
| 391 | 391 | * |
| 392 | - * @return \Jaxon\Plugin\Response |
|
| 392 | + * @return Response |
|
| 393 | 393 | */ |
| 394 | 394 | public function contextAssign($sAttribute, $sData) |
| 395 | 395 | { |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | * @param string $sAttribute The attribute to be appended to |
| 412 | 412 | * @param string $sData The value to append |
| 413 | 413 | * |
| 414 | - * @return \Jaxon\Plugin\Response |
|
| 414 | + * @return Response |
|
| 415 | 415 | */ |
| 416 | 416 | public function contextAppend($sAttribute, $sData) |
| 417 | 417 | { |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | * @param string $sAttribute The attribute to be updated |
| 434 | 434 | * @param string $sData The value to be prepended |
| 435 | 435 | * |
| 436 | - * @return \Jaxon\Plugin\Response |
|
| 436 | + * @return Response |
|
| 437 | 437 | */ |
| 438 | 438 | public function contextPrepend($sAttribute, $sData) |
| 439 | 439 | { |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * |
| 455 | 455 | * @param string $sAttribute The attribute to be cleared |
| 456 | 456 | * |
| 457 | - * @return \Jaxon\Plugin\Response |
|
| 457 | + * @return Response |
|
| 458 | 458 | */ |
| 459 | 459 | public function contextClear($sAttribute) |
| 460 | 460 | { |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * |
| 467 | 467 | * @param string $sMessage The message to be displayed |
| 468 | 468 | * |
| 469 | - * @return \Jaxon\Plugin\Response |
|
| 469 | + * @return Response |
|
| 470 | 470 | */ |
| 471 | 471 | public function alert($sMessage) |
| 472 | 472 | { |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | * |
| 484 | 484 | * @param string $sMessage The message to be displayed |
| 485 | 485 | * |
| 486 | - * @return \Jaxon\Plugin\Response |
|
| 486 | + * @return Response |
|
| 487 | 487 | */ |
| 488 | 488 | public function debug($sMessage) |
| 489 | 489 | { |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | * @param string $sURL The relative or fully qualified URL |
| 502 | 502 | * @param integer $iDelay Number of seconds to delay before the redirect occurs |
| 503 | 503 | * |
| 504 | - * @return \Jaxon\Plugin\Response |
|
| 504 | + * @return Response |
|
| 505 | 505 | */ |
| 506 | 506 | public function redirect($sURL, $iDelay=0) |
| 507 | 507 | { |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | * |
| 555 | 555 | * @param string $sJS The script to execute |
| 556 | 556 | * |
| 557 | - * @return \Jaxon\Plugin\Response |
|
| 557 | + * @return Response |
|
| 558 | 558 | */ |
| 559 | 559 | public function script($sJS) |
| 560 | 560 | { |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | * |
| 572 | 572 | * @param string $sFunc The name of the function to call |
| 573 | 573 | * |
| 574 | - * @return \Jaxon\Plugin\Response |
|
| 574 | + * @return Response |
|
| 575 | 575 | */ |
| 576 | 576 | public function call($sFunc) |
| 577 | 577 | { |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | * |
| 592 | 592 | * @param string $sTarget The id of the element to be removed |
| 593 | 593 | * |
| 594 | - * @return \Jaxon\Plugin\Response |
|
| 594 | + * @return Response |
|
| 595 | 595 | */ |
| 596 | 596 | public function remove($sTarget) |
| 597 | 597 | { |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | * @param string $sTag The tag name to be used for the new element |
| 612 | 612 | * @param string $sId The id to assign to the new element |
| 613 | 613 | * |
| 614 | - * @return \Jaxon\Plugin\Response |
|
| 614 | + * @return Response |
|
| 615 | 615 | */ |
| 616 | 616 | public function create($sParent, $sTag, $sId) |
| 617 | 617 | { |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | * @param string $sTag The tag name to be used for the new element |
| 633 | 633 | * @param string $sId The id to assign to the new element |
| 634 | 634 | * |
| 635 | - * @return \Jaxon\Plugin\Response |
|
| 635 | + * @return Response |
|
| 636 | 636 | */ |
| 637 | 637 | public function insert($sBefore, $sTag, $sId) |
| 638 | 638 | { |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | * @param string $sTag The tag name to be used for the new element |
| 654 | 654 | * @param string $sId The id to assign to the new element |
| 655 | 655 | * |
| 656 | - * @return \Jaxon\Plugin\Response |
|
| 656 | + * @return Response |
|
| 657 | 657 | */ |
| 658 | 658 | public function insertAfter($sAfter, $sTag, $sId) |
| 659 | 659 | { |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | * @param string $sName The name of the new input element |
| 676 | 676 | * @param string $sId The id of the new element |
| 677 | 677 | * |
| 678 | - * @return \Jaxon\Plugin\Response |
|
| 678 | + * @return Response |
|
| 679 | 679 | */ |
| 680 | 680 | public function createInput($sParent, $sType, $sName, $sId) |
| 681 | 681 | { |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | * @param string $sName The name of the new input element |
| 699 | 699 | * @param string $sId The id of the new element |
| 700 | 700 | * |
| 701 | - * @return \Jaxon\Plugin\Response |
|
| 701 | + * @return Response |
|
| 702 | 702 | */ |
| 703 | 703 | public function insertInput($sBefore, $sType, $sName, $sId) |
| 704 | 704 | { |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | * @param string $sName The name of the new input element |
| 722 | 722 | * @param string $sId The id of the new element |
| 723 | 723 | * |
| 724 | - * @return \Jaxon\Plugin\Response |
|
| 724 | + * @return Response |
|
| 725 | 725 | */ |
| 726 | 726 | public function insertInputAfter($sAfter, $sType, $sName, $sId) |
| 727 | 727 | { |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | * @param string $sEvent The name of the event |
| 744 | 744 | * @param string $sScript The javascript to execute when the event is fired |
| 745 | 745 | * |
| 746 | - * @return \Jaxon\Plugin\Response |
|
| 746 | + * @return Response |
|
| 747 | 747 | */ |
| 748 | 748 | public function setEvent($sTarget, $sEvent, $sScript) |
| 749 | 749 | { |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | * @param string $sTarget The id of the element that contains the event |
| 764 | 764 | * @param string $sScript The javascript to execute when the event is fired |
| 765 | 765 | * |
| 766 | - * @return \Jaxon\Plugin\Response |
|
| 766 | + * @return Response |
|
| 767 | 767 | */ |
| 768 | 768 | public function onClick($sTarget, $sScript) |
| 769 | 769 | { |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | * @param string $sEvent The name of the event |
| 780 | 780 | * @param string $sHandler The name of the javascript function to call when the event is fired |
| 781 | 781 | * |
| 782 | - * @return \Jaxon\Plugin\Response |
|
| 782 | + * @return Response |
|
| 783 | 783 | */ |
| 784 | 784 | public function addHandler($sTarget, $sEvent, $sHandler) |
| 785 | 785 | { |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | * @param string $sEvent The name of the event |
| 801 | 801 | * @param string $sHandler The name of the javascript function called when the event is fired |
| 802 | 802 | * |
| 803 | - * @return \Jaxon\Plugin\Response |
|
| 803 | + * @return Response |
|
| 804 | 804 | */ |
| 805 | 805 | public function removeHandler($sTarget, $sEvent, $sHandler) |
| 806 | 806 | { |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | * @param string $sArgs Comma separated list of parameter names |
| 822 | 822 | * @param string $sScript The javascript code that will become the body of the function |
| 823 | 823 | * |
| 824 | - * @return \Jaxon\Plugin\Response |
|
| 824 | + * @return Response |
|
| 825 | 825 | */ |
| 826 | 826 | public function setFunction($sFunction, $sArgs, $sScript) |
| 827 | 827 | { |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | * @param string $sReturnValueVar The name of the variable that will retain the return value |
| 849 | 849 | * from the call to the original function |
| 850 | 850 | * |
| 851 | - * @return \Jaxon\Plugin\Response |
|
| 851 | + * @return Response |
|
| 852 | 852 | */ |
| 853 | 853 | public function wrapFunction($sFunction, $sArgs, $aScripts, $sReturnValueVar) |
| 854 | 854 | { |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | * @param string $sFileName The relative or fully qualified URI of the javascript file |
| 870 | 870 | * @param string $sType Determines the script type. Defaults to 'text/javascript' |
| 871 | 871 | * |
| 872 | - * @return \Jaxon\Plugin\Response |
|
| 872 | + * @return Response |
|
| 873 | 873 | */ |
| 874 | 874 | public function includeScript($sFileName, $sType = null, $sId = null) |
| 875 | 875 | { |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | * @param string $sFileName The relative or fully qualified URI of the javascript file |
| 891 | 891 | * @param string $sType Determines the script type. Defaults to 'text/javascript' |
| 892 | 892 | * |
| 893 | - * @return \Jaxon\Plugin\Response |
|
| 893 | + * @return Response |
|
| 894 | 894 | */ |
| 895 | 895 | public function includeScriptOnce($sFileName, $sType = null, $sId = null) |
| 896 | 896 | { |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | * @param string $sFileName The relative or fully qualified URI of the javascript file |
| 914 | 914 | * @param string $sUnload Name of a javascript function to call prior to unlaoding the file |
| 915 | 915 | * |
| 916 | - * @return \Jaxon\Plugin\Response |
|
| 916 | + * @return Response |
|
| 917 | 917 | */ |
| 918 | 918 | public function removeScript($sFileName, $sUnload = '') |
| 919 | 919 | { |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | * @param string $sFileName The relative or fully qualified URI of the css file |
| 935 | 935 | * @param string $sMedia The media type of the CSS file. Defaults to 'screen' |
| 936 | 936 | * |
| 937 | - * @return \Jaxon\Plugin\Response |
|
| 937 | + * @return Response |
|
| 938 | 938 | */ |
| 939 | 939 | public function includeCSS($sFileName, $sMedia = null) |
| 940 | 940 | { |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | * |
| 954 | 954 | * @param string $sFileName The relative or fully qualified URI of the css file |
| 955 | 955 | * |
| 956 | - * @return \Jaxon\Plugin\Response |
|
| 956 | + * @return Response |
|
| 957 | 957 | */ |
| 958 | 958 | public function removeCSS($sFileName, $sMedia = null) |
| 959 | 959 | { |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | * @param integer $iTimeout The number of 1/10ths of a second to pause before timing out |
| 979 | 979 | * and continuing with the execution of the response commands |
| 980 | 980 | * |
| 981 | - * @return \Jaxon\Plugin\Response |
|
| 981 | + * @return Response |
|
| 982 | 982 | */ |
| 983 | 983 | public function waitForCSS($iTimeout = 600) |
| 984 | 984 | { |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | * @param integer $tenths The number of 1/10ths of a second to wait before timing out |
| 1004 | 1004 | * and continuing with the execution of the response commands. |
| 1005 | 1005 | * |
| 1006 | - * @return \Jaxon\Plugin\Response |
|
| 1006 | + * @return Response |
|
| 1007 | 1007 | */ |
| 1008 | 1008 | public function waitFor($script, $tenths) |
| 1009 | 1009 | { |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | * |
| 1025 | 1025 | * @param integer $tenths The number of 1/10ths of a second to sleep |
| 1026 | 1026 | * |
| 1027 | - * @return \Jaxon\Plugin\Response |
|
| 1027 | + * @return Response |
|
| 1028 | 1028 | */ |
| 1029 | 1029 | public function sleep($tenths) |
| 1030 | 1030 | { |
@@ -1053,7 +1053,7 @@ discard block |
||
| 1053 | 1053 | * @param string $variable The DOM element name (id or class) |
| 1054 | 1054 | * @param string $tag The HTML tag of the new DOM element |
| 1055 | 1055 | * |
| 1056 | - * @return \Jaxon\Plugin\Response |
|
| 1056 | + * @return Response |
|
| 1057 | 1057 | */ |
| 1058 | 1058 | public function domCreateElement($variable, $tag) |
| 1059 | 1059 | { |
@@ -1073,7 +1073,7 @@ discard block |
||
| 1073 | 1073 | * @param string $key The name of the attribute |
| 1074 | 1074 | * @param string $value The value of the attribute |
| 1075 | 1075 | * |
| 1076 | - * @return \Jaxon\Plugin\Response |
|
| 1076 | + * @return Response |
|
| 1077 | 1077 | */ |
| 1078 | 1078 | public function domSetAttribute($variable, $key, $value) |
| 1079 | 1079 | { |
@@ -1094,7 +1094,7 @@ discard block |
||
| 1094 | 1094 | * @param string $skip The ?? |
| 1095 | 1095 | * @param string $remove The ?? |
| 1096 | 1096 | * |
| 1097 | - * @return \Jaxon\Plugin\Response |
|
| 1097 | + * @return Response |
|
| 1098 | 1098 | */ |
| 1099 | 1099 | public function domRemoveChildren($parent, $skip = null, $remove = null) |
| 1100 | 1100 | { |
@@ -1115,7 +1115,7 @@ discard block |
||
| 1115 | 1115 | * @param string $parent The DOM parent element |
| 1116 | 1116 | * @param string $variable The DOM element name (id or class) |
| 1117 | 1117 | * |
| 1118 | - * @return \Jaxon\Plugin\Response |
|
| 1118 | + * @return Response |
|
| 1119 | 1119 | */ |
| 1120 | 1120 | public function domAppendChild($parent, $variable) |
| 1121 | 1121 | { |
@@ -1134,7 +1134,7 @@ discard block |
||
| 1134 | 1134 | * @param string $target The DOM target element |
| 1135 | 1135 | * @param string $variable The DOM element name (id or class) |
| 1136 | 1136 | * |
| 1137 | - * @return \Jaxon\Plugin\Response |
|
| 1137 | + * @return Response |
|
| 1138 | 1138 | */ |
| 1139 | 1139 | public function domInsertBefore($target, $variable) |
| 1140 | 1140 | { |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | * @param string $target The DOM target element |
| 1154 | 1154 | * @param string $variable The DOM element name (id or class) |
| 1155 | 1155 | * |
| 1156 | - * @return \Jaxon\Plugin\Response |
|
| 1156 | + * @return Response |
|
| 1157 | 1157 | */ |
| 1158 | 1158 | public function domInsertAfter($target, $variable) |
| 1159 | 1159 | { |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | * @param string $parent The DOM parent element |
| 1173 | 1173 | * @param string $text The HTML text to append |
| 1174 | 1174 | * |
| 1175 | - * @return \Jaxon\Plugin\Response |
|
| 1175 | + * @return Response |
|
| 1176 | 1176 | */ |
| 1177 | 1177 | public function domAppendText($parent, $text) |
| 1178 | 1178 | { |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | * |
| 1214 | 1214 | * @param mixed $value Any value |
| 1215 | 1215 | * |
| 1216 | - * @return \Jaxon\Plugin\Response |
|
| 1216 | + * @return Response |
|
| 1217 | 1217 | */ |
| 1218 | 1218 | public function setReturnValue($value) |
| 1219 | 1219 | { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public function plugin($sName) |
| 76 | 76 | { |
| 77 | 77 | $xPlugin = $this->getPluginManager()->getResponsePlugin($sName); |
| 78 | - if(!$xPlugin) |
|
| 78 | + if (!$xPlugin) |
|
| 79 | 79 | { |
| 80 | 80 | return null; |
| 81 | 81 | } |
@@ -138,23 +138,23 @@ discard block |
||
| 138 | 138 | public function addCommand($aAttributes, $mData) |
| 139 | 139 | { |
| 140 | 140 | /* merge commands if possible */ |
| 141 | - if(in_array($aAttributes['cmd'], ['js', 'ap'])) |
|
| 141 | + if (in_array($aAttributes['cmd'], ['js', 'ap'])) |
|
| 142 | 142 | { |
| 143 | - if(($aLastCommand = array_pop($this->aCommands))) |
|
| 143 | + if (($aLastCommand = array_pop($this->aCommands))) |
|
| 144 | 144 | { |
| 145 | - if($aLastCommand['cmd'] == $aAttributes['cmd']) |
|
| 145 | + if ($aLastCommand['cmd'] == $aAttributes['cmd']) |
|
| 146 | 146 | { |
| 147 | - if($this->getOption('core.response.merge.js') && |
|
| 147 | + if ($this->getOption('core.response.merge.js') && |
|
| 148 | 148 | $aLastCommand['cmd'] == 'js') |
| 149 | 149 | { |
| 150 | - $mData = $aLastCommand['data'].'; '.$mData; |
|
| 150 | + $mData = $aLastCommand['data'] . '; ' . $mData; |
|
| 151 | 151 | } |
| 152 | - elseif($this->getOption('core.response.merge.ap') && |
|
| 152 | + elseif ($this->getOption('core.response.merge.ap') && |
|
| 153 | 153 | $aLastCommand['cmd'] == 'ap' && |
| 154 | 154 | $aLastCommand['id'] == $aAttributes['id'] && |
| 155 | 155 | $aLastCommand['prop'] == $aAttributes['prop']) |
| 156 | 156 | { |
| 157 | - $mData = $aLastCommand['data'].' '.$mData; |
|
| 157 | + $mData = $aLastCommand['data'] . ' ' . $mData; |
|
| 158 | 158 | } |
| 159 | 159 | else |
| 160 | 160 | { |
@@ -212,26 +212,26 @@ discard block |
||
| 212 | 212 | public function appendResponse(AbstractResponse $mCommands, $bBefore = false) |
| 213 | 213 | { |
| 214 | 214 | $aCommands = []; |
| 215 | - if($mCommands instanceof Response) |
|
| 215 | + if ($mCommands instanceof Response) |
|
| 216 | 216 | { |
| 217 | 217 | $this->returnValue = $mCommands->returnValue; |
| 218 | 218 | $aCommands = $mCommands->aCommands; |
| 219 | 219 | } |
| 220 | - elseif(is_array($mCommands)) |
|
| 220 | + elseif (is_array($mCommands)) |
|
| 221 | 221 | { |
| 222 | 222 | $aCommands = $mCommands; |
| 223 | 223 | } |
| 224 | 224 | else |
| 225 | 225 | { |
| 226 | - if(!empty($mCommands)) |
|
| 226 | + if (!empty($mCommands)) |
|
| 227 | 227 | { |
| 228 | 228 | throw new \Jaxon\Exception\Error($this->trans('errors.response.data.invalid')); |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - if(count($aCommands) > 0) |
|
| 232 | + if (count($aCommands) > 0) |
|
| 233 | 233 | { |
| 234 | - if($bBefore) |
|
| 234 | + if ($bBefore) |
|
| 235 | 235 | { |
| 236 | 236 | $this->aCommands = array_merge($aCommands, $this->aCommands); |
| 237 | 237 | } |
@@ -503,33 +503,33 @@ discard block |
||
| 503 | 503 | * |
| 504 | 504 | * @return \Jaxon\Plugin\Response |
| 505 | 505 | */ |
| 506 | - public function redirect($sURL, $iDelay=0) |
|
| 506 | + public function redirect($sURL, $iDelay = 0) |
|
| 507 | 507 | { |
| 508 | 508 | // we need to parse the query part so that the values are rawurlencode()'ed |
| 509 | 509 | // can't just use parse_url() cos we could be dealing with a relative URL which |
| 510 | 510 | // parse_url() can't deal with. |
| 511 | 511 | $queryStart = strpos($sURL, '?', strrpos($sURL, '/')); |
| 512 | - if($queryStart !== false) |
|
| 512 | + if ($queryStart !== false) |
|
| 513 | 513 | { |
| 514 | 514 | $queryStart++; |
| 515 | 515 | $queryEnd = strpos($sURL, '#', $queryStart); |
| 516 | - if($queryEnd === false) |
|
| 516 | + if ($queryEnd === false) |
|
| 517 | 517 | $queryEnd = strlen($sURL); |
| 518 | - $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart); |
|
| 518 | + $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart); |
|
| 519 | 519 | parse_str($queryPart, $queryParts); |
| 520 | 520 | $newQueryPart = ""; |
| 521 | - if($queryParts) |
|
| 521 | + if ($queryParts) |
|
| 522 | 522 | { |
| 523 | 523 | $first = true; |
| 524 | - foreach($queryParts as $key => $value) |
|
| 524 | + foreach ($queryParts as $key => $value) |
|
| 525 | 525 | { |
| 526 | - if($first) |
|
| 526 | + if ($first) |
|
| 527 | 527 | $first = false; |
| 528 | 528 | else |
| 529 | 529 | $newQueryPart .= '&'; |
| 530 | - $newQueryPart .= rawurlencode($key).'='.rawurlencode($value); |
|
| 530 | + $newQueryPart .= rawurlencode($key) . '=' . rawurlencode($value); |
|
| 531 | 531 | } |
| 532 | - } elseif($_SERVER['QUERY_STRING']) { |
|
| 532 | + } elseif ($_SERVER['QUERY_STRING']) { |
|
| 533 | 533 | //couldn't break up the query, but there's one there |
| 534 | 534 | //possibly "http://url/page.html?query1234" type of query? |
| 535 | 535 | //just encode it and hope it works |
@@ -537,8 +537,8 @@ discard block |
||
| 537 | 537 | } |
| 538 | 538 | $sURL = str_replace($queryPart, $newQueryPart, $sURL); |
| 539 | 539 | } |
| 540 | - if($iDelay) |
|
| 541 | - $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');'); |
|
| 540 | + if ($iDelay) |
|
| 541 | + $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay * 1000) . ');'); |
|
| 542 | 542 | else |
| 543 | 543 | $this->script('window.location = "' . $sURL . '";'); |
| 544 | 544 | return $this; |
@@ -875,10 +875,10 @@ discard block |
||
| 875 | 875 | { |
| 876 | 876 | $command = ['cmd' => 'in']; |
| 877 | 877 | |
| 878 | - if(($sType)) |
|
| 878 | + if (($sType)) |
|
| 879 | 879 | $command['type'] = trim((string)$sType, " \t"); |
| 880 | 880 | |
| 881 | - if(($sId)) |
|
| 881 | + if (($sId)) |
|
| 882 | 882 | $command['elm_id'] = trim((string)$sId, " \t"); |
| 883 | 883 | |
| 884 | 884 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -896,10 +896,10 @@ discard block |
||
| 896 | 896 | { |
| 897 | 897 | $command = ['cmd' => 'ino']; |
| 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")); |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | { |
| 941 | 941 | $command = ['cmd' => 'css']; |
| 942 | 942 | |
| 943 | - if(($sMedia)) |
|
| 943 | + if (($sMedia)) |
|
| 944 | 944 | $command['media'] = trim((string)$sMedia, " \t"); |
| 945 | 945 | |
| 946 | 946 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | { |
| 960 | 960 | $command = ['cmd' => 'rcss']; |
| 961 | 961 | |
| 962 | - if(($sMedia)) |
|
| 962 | + if (($sMedia)) |
|
| 963 | 963 | $command['media'] = trim((string)$sMedia, " \t"); |
| 964 | 964 | |
| 965 | 965 | return $this->addCommand($command, trim((string)$sFileName, " \t")); |
@@ -1100,10 +1100,10 @@ discard block |
||
| 1100 | 1100 | { |
| 1101 | 1101 | $command = ['cmd' => 'DRC']; |
| 1102 | 1102 | |
| 1103 | - if(($skip)) |
|
| 1103 | + if (($skip)) |
|
| 1104 | 1104 | $command['skip'] = $skip; |
| 1105 | 1105 | |
| 1106 | - if(($remove)) |
|
| 1106 | + if (($remove)) |
|
| 1107 | 1107 | $command['remove'] = $remove; |
| 1108 | 1108 | |
| 1109 | 1109 | return $this->addCommand($command, $parent); |
@@ -1230,13 +1230,13 @@ discard block |
||
| 1230 | 1230 | { |
| 1231 | 1231 | $response = []; |
| 1232 | 1232 | |
| 1233 | - if(($this->returnValue)) |
|
| 1233 | + if (($this->returnValue)) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | $response['jxnrv'] = $this->returnValue; |
| 1236 | 1236 | } |
| 1237 | 1237 | $response['jxnobj'] = []; |
| 1238 | 1238 | |
| 1239 | - foreach($this->aCommands as $xCommand) |
|
| 1239 | + foreach ($this->aCommands as $xCommand) |
|
| 1240 | 1240 | { |
| 1241 | 1241 | $response['jxnobj'][] = $xCommand; |
| 1242 | 1242 | } |
@@ -89,15 +89,13 @@ |
||
| 89 | 89 | if(!$this->xResponse) |
| 90 | 90 | { |
| 91 | 91 | $this->xResponse = $xResponse; |
| 92 | - } |
|
| 93 | - elseif(get_class($this->xResponse) == get_class($xResponse)) |
|
| 92 | + } elseif(get_class($this->xResponse) == get_class($xResponse)) |
|
| 94 | 93 | { |
| 95 | 94 | if($this->xResponse != $xResponse) |
| 96 | 95 | { |
| 97 | 96 | $this->xResponse->appendResponse($xResponse); |
| 98 | 97 | } |
| 99 | - } |
|
| 100 | - else |
|
| 98 | + } else |
|
| 101 | 99 | { |
| 102 | 100 | $this->debug($this->trans('errors.mismatch.types', ['class' => get_class($xResponse)])); |
| 103 | 101 | } |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function append(AbstractResponse $xResponse) |
| 86 | 86 | { |
| 87 | - if(!$this->xResponse) |
|
| 87 | + if (!$this->xResponse) |
|
| 88 | 88 | { |
| 89 | 89 | $this->xResponse = $xResponse; |
| 90 | 90 | } |
| 91 | - elseif(get_class($this->xResponse) == get_class($xResponse)) |
|
| 91 | + elseif (get_class($this->xResponse) == get_class($xResponse)) |
|
| 92 | 92 | { |
| 93 | - if($this->xResponse != $xResponse) |
|
| 93 | + if ($this->xResponse != $xResponse) |
|
| 94 | 94 | { |
| 95 | 95 | $this->xResponse->appendResponse($xResponse); |
| 96 | 96 | } |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function printDebug() |
| 139 | 139 | { |
| 140 | - if(($this->xResponse)) |
|
| 140 | + if (($this->xResponse)) |
|
| 141 | 141 | { |
| 142 | - foreach($this->aDebugMessages as $sMessage) |
|
| 142 | + foreach ($this->aDebugMessages as $sMessage) |
|
| 143 | 143 | { |
| 144 | 144 | $this->xResponse->debug($sMessage); |
| 145 | 145 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function sendHeaders() |
| 156 | 156 | { |
| 157 | - if(($this->xResponse)) |
|
| 157 | + if (($this->xResponse)) |
|
| 158 | 158 | { |
| 159 | 159 | $this->xResponse->sendHeaders(); |
| 160 | 160 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function getOutput() |
| 169 | 169 | { |
| 170 | - if(($this->xResponse)) |
|
| 170 | + if (($this->xResponse)) |
|
| 171 | 171 | { |
| 172 | 172 | return $this->xResponse->getOutput(); |
| 173 | 173 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function sendOutput() |
| 183 | 183 | { |
| 184 | - if(($this->xResponse)) |
|
| 184 | + if (($this->xResponse)) |
|
| 185 | 185 | { |
| 186 | 186 | $this->xResponse->sendHeaders(); |
| 187 | 187 | $this->xResponse->printOutput(); |
@@ -350,8 +350,7 @@ discard block |
||
| 350 | 350 | if(($sFinalFile) && is_file($sJsAppDir . $sFinalFile . $sExtension)) |
| 351 | 351 | { |
| 352 | 352 | $sOutFile = $sFinalFile . $sExtension; |
| 353 | - } |
|
| 354 | - else |
|
| 353 | + } else |
|
| 355 | 354 | { |
| 356 | 355 | // The plugins scripts are written into the javascript app dir |
| 357 | 356 | $sHash = $this->generateHash(); |
@@ -366,8 +365,7 @@ discard block |
||
| 366 | 365 | if(is_file($sJsAppDir . $sMinFile)) |
| 367 | 366 | { |
| 368 | 367 | $sOutFile = $sMinFile; // The file was already minified |
| 369 | - } |
|
| 370 | - elseif(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 368 | + } elseif(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 371 | 369 | { |
| 372 | 370 | $sOutFile = $sMinFile; |
| 373 | 371 | } |
@@ -387,8 +385,7 @@ discard block |
||
| 387 | 385 | 'sJsOptions' => $this->getOption('js.app.options', ''), |
| 388 | 386 | 'sUrl' => $sJsAppURI . $sOutFile, |
| 389 | 387 | ]); |
| 390 | - } |
|
| 391 | - else |
|
| 388 | + } else |
|
| 392 | 389 | { |
| 393 | 390 | // The plugins scripts are wrapped with javascript tags |
| 394 | 391 | $sScript .= $this->xTemplate->render('jaxon::plugins/wrapper.js', [ |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function getJsLibExt() |
| 103 | 103 | { |
| 104 | - if(($this->getOption('js.app.minify'))) |
|
| 104 | + if (($this->getOption('js.app.minify'))) |
|
| 105 | 105 | { |
| 106 | 106 | return '.min.js'; |
| 107 | 107 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | // Check config options |
| 119 | 119 | // - The js.app.export option must be set to true |
| 120 | 120 | // - The js.app.uri and js.app.dir options must be set to non null values |
| 121 | - if(!$this->getOption('js.app.export') || |
|
| 121 | + if (!$this->getOption('js.app.export') || |
|
| 122 | 122 | !$this->getOption('js.app.uri') || |
| 123 | 123 | !$this->getOption('js.app.dir')) |
| 124 | 124 | { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | // Check dir access |
| 128 | 128 | // - The js.app.dir must be writable |
| 129 | 129 | $sJsAppDir = $this->getOption('js.app.dir'); |
| 130 | - if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 130 | + if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 131 | 131 | { |
| 132 | 132 | return false; |
| 133 | 133 | } |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | private function generateHash() |
| 143 | 143 | { |
| 144 | 144 | $sHash = jaxon()->getVersion(); |
| 145 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 145 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 146 | 146 | { |
| 147 | 147 | $sHash .= $xPlugin->generateHash(); |
| 148 | 148 | } |
| 149 | - foreach($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 149 | + foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 150 | 150 | { |
| 151 | 151 | $sHash .= $xPlugin->generateHash(); |
| 152 | 152 | } |
@@ -160,25 +160,25 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | private function makePluginsCode() |
| 162 | 162 | { |
| 163 | - if($this->sCssCode === null || $this->sJsCode === null || $this->sJsScript === null) |
|
| 163 | + if ($this->sCssCode === null || $this->sJsCode === null || $this->sJsScript === null) |
|
| 164 | 164 | { |
| 165 | 165 | $this->sCssCode = ''; |
| 166 | 166 | $this->sJsCode = ''; |
| 167 | 167 | $this->sJsScript = ''; |
| 168 | - foreach($this->xPluginManager->getPlugins() as $xPlugin) |
|
| 168 | + foreach ($this->xPluginManager->getPlugins() as $xPlugin) |
|
| 169 | 169 | { |
| 170 | - if($xPlugin instanceof Response) |
|
| 170 | + if ($xPlugin instanceof Response) |
|
| 171 | 171 | { |
| 172 | - if(($sCssCode = trim($xPlugin->getCss()))) |
|
| 172 | + if (($sCssCode = trim($xPlugin->getCss()))) |
|
| 173 | 173 | { |
| 174 | 174 | $this->sCssCode .= rtrim($sCssCode, " \n") . "\n"; |
| 175 | 175 | } |
| 176 | - if(($sJsCode = trim($xPlugin->getJs()))) |
|
| 176 | + if (($sJsCode = trim($xPlugin->getJs()))) |
|
| 177 | 177 | { |
| 178 | 178 | $this->sJsCode .= rtrim($sJsCode, " \n") . "\n"; |
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | - if(($sJsScript = trim($xPlugin->getScript()))) |
|
| 181 | + if (($sJsScript = trim($xPlugin->getScript()))) |
|
| 182 | 182 | { |
| 183 | 183 | $this->sJsScript .= trim($sJsScript, " \n") . "\n"; |
| 184 | 184 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | // Add component files to the javascript file array; |
| 221 | 221 | $aJsFiles = [$sJsCoreUrl]; |
| 222 | - if($this->getOption('core.debug.on')) |
|
| 222 | + if ($this->getOption('core.debug.on')) |
|
| 223 | 223 | { |
| 224 | 224 | $aJsFiles[] = $sJsDebugUrl; |
| 225 | 225 | $aJsFiles[] = $sJsLanguageUrl; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public function getScript($bIncludeJs = false, $bIncludeCss = false) |
| 319 | 319 | { |
| 320 | - if(!$this->getOption('core.request.uri')) |
|
| 320 | + if (!$this->getOption('core.request.uri')) |
|
| 321 | 321 | { |
| 322 | 322 | $this->setOption('core.request.uri', URI::detect()); |
| 323 | 323 | } |
@@ -326,16 +326,16 @@ discard block |
||
| 326 | 326 | $this->makePluginsCode(); |
| 327 | 327 | |
| 328 | 328 | $sScript = ''; |
| 329 | - if(($bIncludeCss)) |
|
| 329 | + if (($bIncludeCss)) |
|
| 330 | 330 | { |
| 331 | 331 | $sScript .= $this->getCss() . "\n"; |
| 332 | 332 | } |
| 333 | - if(($bIncludeJs)) |
|
| 333 | + if (($bIncludeJs)) |
|
| 334 | 334 | { |
| 335 | 335 | $sScript .= $this->getJs() . "\n"; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if($this->canExportJavascript()) |
|
| 338 | + if ($this->canExportJavascript()) |
|
| 339 | 339 | { |
| 340 | 340 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
| 341 | 341 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $sExtension = $this->getJsLibExt(); |
| 344 | 344 | |
| 345 | 345 | // Check if the final file already exists |
| 346 | - if(($sFinalFile) && is_file($sJsAppDir . $sFinalFile . $sExtension)) |
|
| 346 | + if (($sFinalFile) && is_file($sJsAppDir . $sFinalFile . $sExtension)) |
|
| 347 | 347 | { |
| 348 | 348 | $sOutFile = $sFinalFile . $sExtension; |
| 349 | 349 | } |
@@ -353,25 +353,25 @@ discard block |
||
| 353 | 353 | $sHash = $this->generateHash(); |
| 354 | 354 | $sOutFile = $sHash . '.js'; |
| 355 | 355 | $sMinFile = $sHash . '.min.js'; |
| 356 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
| 356 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
| 357 | 357 | { |
| 358 | 358 | file_put_contents($sJsAppDir . $sOutFile, $this->_getScript()); |
| 359 | 359 | } |
| 360 | - if(($this->getOption('js.app.minify'))) |
|
| 360 | + if (($this->getOption('js.app.minify'))) |
|
| 361 | 361 | { |
| 362 | - if(is_file($sJsAppDir . $sMinFile)) |
|
| 362 | + if (is_file($sJsAppDir . $sMinFile)) |
|
| 363 | 363 | { |
| 364 | 364 | $sOutFile = $sMinFile; // The file was already minified |
| 365 | 365 | } |
| 366 | - elseif(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 366 | + elseif (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 367 | 367 | { |
| 368 | 368 | $sOutFile = $sMinFile; |
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | // Copy the file to its final location |
| 372 | - if(($sFinalFile)) |
|
| 372 | + if (($sFinalFile)) |
|
| 373 | 373 | { |
| 374 | - if(copy($sJsAppDir . $sOutFile, $sJsAppDir . $sFinalFile . $sExtension)) |
|
| 374 | + if (copy($sJsAppDir . $sOutFile, $sJsAppDir . $sFinalFile . $sExtension)) |
|
| 375 | 375 | { |
| 376 | 376 | $sOutFile = $sFinalFile . $sExtension; |
| 377 | 377 | } |
@@ -138,33 +138,33 @@ discard block |
||
| 138 | 138 | $bIsAlert = ($xPlugin instanceof \Jaxon\Contracts\Dialogs\Alert); |
| 139 | 139 | $bIsConfirm = ($xPlugin instanceof \Jaxon\Contracts\Dialogs\Confirm); |
| 140 | 140 | $bIsListener = ($xPlugin instanceof \Jaxon\Contracts\Event\Listener); |
| 141 | - if($xPlugin instanceof Request) |
|
| 141 | + if ($xPlugin instanceof Request) |
|
| 142 | 142 | { |
| 143 | 143 | // The name of a request plugin is used as key in the plugin table |
| 144 | 144 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 145 | 145 | } |
| 146 | - elseif($xPlugin instanceof Response) |
|
| 146 | + elseif ($xPlugin instanceof Response) |
|
| 147 | 147 | { |
| 148 | 148 | // The name of a response plugin is used as key in the plugin table |
| 149 | 149 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 150 | 150 | } |
| 151 | - elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
| 151 | + elseif (!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
| 152 | 152 | { |
| 153 | 153 | $sErrorMessage = $this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]); |
| 154 | 154 | throw new \Jaxon\Exception\Error($sErrorMessage); |
| 155 | 155 | } |
| 156 | 156 | // This plugin implements the Alert interface |
| 157 | - if($bIsAlert) |
|
| 157 | + if ($bIsAlert) |
|
| 158 | 158 | { |
| 159 | 159 | jaxon()->dialog()->setAlert($xPlugin); |
| 160 | 160 | } |
| 161 | 161 | // This plugin implements the Confirm interface |
| 162 | - if($bIsConfirm) |
|
| 162 | + if ($bIsConfirm) |
|
| 163 | 163 | { |
| 164 | 164 | jaxon()->dialog()->setConfirm($xPlugin); |
| 165 | 165 | } |
| 166 | 166 | // Register the plugin as an event listener |
| 167 | - if($bIsListener) |
|
| 167 | + if ($bIsListener) |
|
| 168 | 168 | { |
| 169 | 169 | $this->addEventListener($xPlugin); |
| 170 | 170 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function registerCallable($sType, $sCallable, $aOptions = []) |
| 201 | 201 | { |
| 202 | - if(!key_exists($sType, $this->aRequestPlugins)) |
|
| 202 | + if (!key_exists($sType, $this->aRequestPlugins)) |
|
| 203 | 203 | { |
| 204 | 204 | throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType])); |
| 205 | 205 | } |
@@ -220,14 +220,14 @@ discard block |
||
| 220 | 220 | private function registerCallablesFromConfig($xAppConfig, $sSection, $sCallableType) |
| 221 | 221 | { |
| 222 | 222 | $aConfig = $xAppConfig->getOption($sSection, []); |
| 223 | - foreach($aConfig as $xKey => $xValue) |
|
| 223 | + foreach ($aConfig as $xKey => $xValue) |
|
| 224 | 224 | { |
| 225 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 225 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 226 | 226 | { |
| 227 | 227 | // Register a function without options |
| 228 | 228 | $this->registerCallable($sCallableType, $xValue); |
| 229 | 229 | } |
| 230 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 230 | + elseif (is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 231 | 231 | { |
| 232 | 232 | // Register a function with options |
| 233 | 233 | $this->registerCallable($sCallableType, $xKey, $xValue); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | public function getResponsePlugin($sName) |
| 271 | 271 | { |
| 272 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
| 272 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
| 273 | 273 | { |
| 274 | 274 | return $this->aResponsePlugins[$sName]; |
| 275 | 275 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | public function getRequestPlugin($sName) |
| 287 | 287 | { |
| 288 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
| 288 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
| 289 | 289 | { |
| 290 | 290 | return $this->aRequestPlugins[$sName]; |
| 291 | 291 | } |
@@ -142,13 +142,11 @@ discard block |
||
| 142 | 142 | { |
| 143 | 143 | // The name of a request plugin is used as key in the plugin table |
| 144 | 144 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 145 | - } |
|
| 146 | - elseif($xPlugin instanceof Response) |
|
| 145 | + } elseif($xPlugin instanceof Response) |
|
| 147 | 146 | { |
| 148 | 147 | // The name of a response plugin is used as key in the plugin table |
| 149 | 148 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 150 | - } |
|
| 151 | - elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
| 149 | + } elseif(!$bIsConfirm && !$bIsAlert && !$bIsListener) |
|
| 152 | 150 | { |
| 153 | 151 | $sErrorMessage = $this->trans('errors.register.invalid', ['name' => get_class($xPlugin)]); |
| 154 | 152 | throw new \Jaxon\Exception\Error($sErrorMessage); |
@@ -226,13 +224,11 @@ discard block |
||
| 226 | 224 | { |
| 227 | 225 | // Register a function without options |
| 228 | 226 | $this->registerCallable($sCallableType, $xValue); |
| 229 | - } |
|
| 230 | - elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 227 | + } elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue))) |
|
| 231 | 228 | { |
| 232 | 229 | // Register a function with options |
| 233 | 230 | $this->registerCallable($sCallableType, $xKey, $xValue); |
| 234 | - } |
|
| 235 | - else |
|
| 231 | + } else |
|
| 236 | 232 | { |
| 237 | 233 | continue; |
| 238 | 234 | // Todo: throw an exception |
@@ -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 | } |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | return jaxon()->instance($name); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - /** |
|
| 97 | + /** |
|
| 98 | 98 | * Get the uploaded files |
| 99 | 99 | * |
| 100 | 100 | * @return array |
@@ -81,12 +81,12 @@ |
||
| 81 | 81 | $xCallableObject = jaxon()->di()->getCallableRepository()->getCallableObject(get_class($this)); |
| 82 | 82 | $cFirstChar = substr($name, 0, 1); |
| 83 | 83 | // If the class name starts with a dot, then find the class in the same full namespace as the caller |
| 84 | - if($cFirstChar == ':') |
|
| 84 | + if ($cFirstChar == ':') |
|
| 85 | 85 | { |
| 86 | 86 | $name = $xCallableObject->getRootNamespace() . '\\' . str_replace('.', '\\', substr($name, 1)); |
| 87 | 87 | } |
| 88 | 88 | // If the class name starts with a dot, then find the class in the same base namespace as the caller |
| 89 | - elseif($cFirstChar == '.') |
|
| 89 | + elseif ($cFirstChar == '.') |
|
| 90 | 90 | { |
| 91 | 91 | $name = $xCallableObject->getNamespace() . '\\' . str_replace('.', '\\', substr($name, 1)); |
| 92 | 92 | } |
@@ -105,19 +105,19 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public static function make($xValue) |
| 107 | 107 | { |
| 108 | - if($xValue instanceof Contracts\Parameter) |
|
| 108 | + if ($xValue instanceof Contracts\Parameter) |
|
| 109 | 109 | { |
| 110 | 110 | return $xValue; |
| 111 | 111 | } |
| 112 | - elseif(is_numeric($xValue)) |
|
| 112 | + elseif (is_numeric($xValue)) |
|
| 113 | 113 | { |
| 114 | 114 | return new Parameter(self::NUMERIC_VALUE, $xValue); |
| 115 | 115 | } |
| 116 | - elseif(is_string($xValue)) |
|
| 116 | + elseif (is_string($xValue)) |
|
| 117 | 117 | { |
| 118 | 118 | return new Parameter(self::QUOTED_VALUE, $xValue); |
| 119 | 119 | } |
| 120 | - elseif(is_bool($xValue)) |
|
| 120 | + elseif (is_bool($xValue)) |
|
| 121 | 121 | { |
| 122 | 122 | return new Parameter(self::BOOL_VALUE, $xValue); |
| 123 | 123 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | public function getScript() |
| 162 | 162 | { |
| 163 | 163 | $sJsCode = ''; |
| 164 | - switch($this->sType) |
|
| 164 | + switch ($this->sType) |
|
| 165 | 165 | { |
| 166 | 166 | case self::FORM_VALUES: |
| 167 | 167 | $sJsCode = $this->getJsCall('getFormValues', $this->xValue); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $sJsCode = (string)$this->xValue; |
| 189 | 189 | break; |
| 190 | 190 | case self::JS_VALUE: |
| 191 | - if(is_array($this->xValue) || is_object($this->xValue)) |
|
| 191 | + if (is_array($this->xValue) || is_object($this->xValue)) |
|
| 192 | 192 | { |
| 193 | 193 | // Unable to use double quotes here because they cannot be handled on client side. |
| 194 | 194 | // So we are using simple quotes even if the Json standard recommends double quotes. |
@@ -108,20 +108,16 @@ discard block |
||
| 108 | 108 | if($xValue instanceof Contracts\Parameter) |
| 109 | 109 | { |
| 110 | 110 | return $xValue; |
| 111 | - } |
|
| 112 | - elseif(is_numeric($xValue)) |
|
| 111 | + } elseif(is_numeric($xValue)) |
|
| 113 | 112 | { |
| 114 | 113 | return new Parameter(self::NUMERIC_VALUE, $xValue); |
| 115 | - } |
|
| 116 | - elseif(is_string($xValue)) |
|
| 114 | + } elseif(is_string($xValue)) |
|
| 117 | 115 | { |
| 118 | 116 | return new Parameter(self::QUOTED_VALUE, $xValue); |
| 119 | - } |
|
| 120 | - elseif(is_bool($xValue)) |
|
| 117 | + } elseif(is_bool($xValue)) |
|
| 121 | 118 | { |
| 122 | 119 | return new Parameter(self::BOOL_VALUE, $xValue); |
| 123 | - } |
|
| 124 | - else // if(is_array($xValue) || is_object($xValue)) |
|
| 120 | + } else // if(is_array($xValue) || is_object($xValue)) |
|
| 125 | 121 | { |
| 126 | 122 | return new Parameter(self::JS_VALUE, $xValue); |
| 127 | 123 | } |
@@ -193,8 +189,7 @@ discard block |
||
| 193 | 189 | // Unable to use double quotes here because they cannot be handled on client side. |
| 194 | 190 | // So we are using simple quotes even if the Json standard recommends double quotes. |
| 195 | 191 | $sJsCode = str_replace(['"'], ["'"], json_encode($this->xValue, JSON_HEX_APOS | JSON_HEX_QUOT)); |
| 196 | - } |
|
| 197 | - else |
|
| 192 | + } else |
|
| 198 | 193 | { |
| 199 | 194 | $sJsCode = (string)$this->xValue; |
| 200 | 195 | } |
@@ -154,9 +154,9 @@ |
||
| 154 | 154 | */ |
| 155 | 155 | public function addParameters(array $aParameters) |
| 156 | 156 | { |
| 157 | - foreach($aParameters as $xParameter) |
|
| 157 | + foreach ($aParameters as $xParameter) |
|
| 158 | 158 | { |
| 159 | - if($xParameter instanceof JsCall) |
|
| 159 | + if ($xParameter instanceof JsCall) |
|
| 160 | 160 | { |
| 161 | 161 | $this->addParameter(Parameter::JS_VALUE, 'function(){' . $xParameter->getScript() . ';}'); |
| 162 | 162 | } |
@@ -159,8 +159,7 @@ |
||
| 159 | 159 | if($xParameter instanceof JsCall) |
| 160 | 160 | { |
| 161 | 161 | $this->addParameter(Parameter::JS_VALUE, 'function(){' . $xParameter->getScript() . ';}'); |
| 162 | - } |
|
| 163 | - else |
|
| 162 | + } else |
|
| 164 | 163 | { |
| 165 | 164 | $this->pushParameter(Parameter::make($xParameter)); |
| 166 | 165 | } |