@@ -78,6 +78,10 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | exit(1); |
| 80 | 80 | } |
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @param TApplication $application |
|
| 84 | + */ |
|
| 81 | 85 | public static function setApplication($application) |
| 82 | 86 | { |
| 83 | 87 | if(self::$_application!==null && !defined('PRADO_TEST_RUN')) |
@@ -371,14 +375,26 @@ discard block |
||
| 371 | 375 | interface IModule |
| 372 | 376 | { |
| 373 | 377 | public function init($config); |
| 378 | + |
|
| 379 | + /** |
|
| 380 | + * @return string |
|
| 381 | + */ |
|
| 374 | 382 | public function getID(); |
| 375 | 383 | public function setID($id); |
| 376 | 384 | } |
| 377 | 385 | interface IService |
| 378 | 386 | { |
| 379 | 387 | public function init($config); |
| 388 | + |
|
| 389 | + /** |
|
| 390 | + * @return string |
|
| 391 | + */ |
|
| 380 | 392 | public function getID(); |
| 381 | 393 | public function setID($id); |
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * @return boolean |
|
| 397 | + */ |
|
| 382 | 398 | public function getEnabled(); |
| 383 | 399 | public function setEnabled($value); |
| 384 | 400 | public function run(); |
@@ -390,14 +406,37 @@ discard block |
||
| 390 | 406 | } |
| 391 | 407 | interface IUser |
| 392 | 408 | { |
| 409 | + /** |
|
| 410 | + * @return string |
|
| 411 | + */ |
|
| 393 | 412 | public function getName(); |
| 394 | 413 | public function setName($value); |
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * @return boolean |
|
| 417 | + */ |
|
| 395 | 418 | public function getIsGuest(); |
| 419 | + |
|
| 420 | + /** |
|
| 421 | + * @param boolean $value |
|
| 422 | + */ |
|
| 396 | 423 | public function setIsGuest($value); |
| 397 | 424 | public function getRoles(); |
| 398 | 425 | public function setRoles($value); |
| 426 | + |
|
| 427 | + /** |
|
| 428 | + * @return boolean |
|
| 429 | + */ |
|
| 399 | 430 | public function isInRole($role); |
| 431 | + |
|
| 432 | + /** |
|
| 433 | + * @return string |
|
| 434 | + */ |
|
| 400 | 435 | public function saveToString(); |
| 436 | + |
|
| 437 | + /** |
|
| 438 | + * @return TUser |
|
| 439 | + */ |
|
| 401 | 440 | public function loadFromString($string); |
| 402 | 441 | } |
| 403 | 442 | interface IStatePersister |
@@ -409,6 +448,12 @@ discard block |
||
| 409 | 448 | { |
| 410 | 449 | public function get($id); |
| 411 | 450 | public function set($id,$value,$expire=0,$dependency=null); |
| 451 | + |
|
| 452 | + /** |
|
| 453 | + * @param string $id |
|
| 454 | + * |
|
| 455 | + * @return boolean |
|
| 456 | + */ |
|
| 412 | 457 | public function add($id,$value,$expire=0,$dependency=null); |
| 413 | 458 | public function delete($id); |
| 414 | 459 | public function flush(); |
@@ -427,12 +472,22 @@ discard block |
||
| 427 | 472 | } |
| 428 | 473 | interface IStyleable |
| 429 | 474 | { |
| 475 | + /** |
|
| 476 | + * @return boolean |
|
| 477 | + */ |
|
| 430 | 478 | public function getHasStyle(); |
| 479 | + |
|
| 480 | + /** |
|
| 481 | + * @return TStyle |
|
| 482 | + */ |
|
| 431 | 483 | public function getStyle(); |
| 432 | 484 | public function clearStyle(); |
| 433 | 485 | } |
| 434 | 486 | interface IActiveControl |
| 435 | 487 | { |
| 488 | + /** |
|
| 489 | + * @return TBaseActiveControl |
|
| 490 | + */ |
|
| 436 | 491 | public function getActiveControl(); |
| 437 | 492 | } |
| 438 | 493 | interface ICallbackEventHandler |
@@ -442,6 +497,10 @@ discard block |
||
| 442 | 497 | interface IDataRenderer |
| 443 | 498 | { |
| 444 | 499 | public function getData(); |
| 500 | + |
|
| 501 | + /** |
|
| 502 | + * @param TActiveRecord $value |
|
| 503 | + */ |
|
| 445 | 504 | public function setData($value); |
| 446 | 505 | } |
| 447 | 506 | class TApplicationComponent extends TComponent |
@@ -470,6 +529,10 @@ discard block |
||
| 470 | 529 | { |
| 471 | 530 | return Prado::getApplication()->getUser(); |
| 472 | 531 | } |
| 532 | + |
|
| 533 | + /** |
|
| 534 | + * @param string $assetPath |
|
| 535 | + */ |
|
| 473 | 536 | public function publishAsset($assetPath,$className=null) |
| 474 | 537 | { |
| 475 | 538 | if($className===null) |
@@ -478,6 +541,10 @@ discard block |
||
| 478 | 541 | $fullPath=dirname($class->getFileName()).DIRECTORY_SEPARATOR.$assetPath; |
| 479 | 542 | return $this->publishFilePath($fullPath); |
| 480 | 543 | } |
| 544 | + |
|
| 545 | + /** |
|
| 546 | + * @param string $fullPath |
|
| 547 | + */ |
|
| 481 | 548 | public function publishFilePath($fullPath, $checkTimestamp=false) |
| 482 | 549 | { |
| 483 | 550 | return Prado::getApplication()->getAssetManager()->publishFilePath($fullPath, $checkTimestamp); |
@@ -509,6 +576,10 @@ discard block |
||
| 509 | 576 | { |
| 510 | 577 | return $this->_id; |
| 511 | 578 | } |
| 579 | + |
|
| 580 | + /** |
|
| 581 | + * @param string $value |
|
| 582 | + */ |
|
| 512 | 583 | public function setID($value) |
| 513 | 584 | { |
| 514 | 585 | $this->_id=$value; |
@@ -548,6 +619,10 @@ discard block |
||
| 548 | 619 | else |
| 549 | 620 | throw new TConfigurationException('errorhandler_errortemplatepath_invalid',$value); |
| 550 | 621 | } |
| 622 | + |
|
| 623 | + /** |
|
| 624 | + * @param null|TApplication $sender |
|
| 625 | + */ |
|
| 551 | 626 | public function handleError($sender,$param) |
| 552 | 627 | { |
| 553 | 628 | static $handling=false; |
@@ -570,6 +645,10 @@ discard block |
||
| 570 | 645 | $this->handleExternalError(500,$param); |
| 571 | 646 | } |
| 572 | 647 | } |
| 648 | + |
|
| 649 | + /** |
|
| 650 | + * @return string |
|
| 651 | + */ |
|
| 573 | 652 | protected static function hideSecurityRelated($value, $exception=null) |
| 574 | 653 | { |
| 575 | 654 | $aRpl = array(); |
@@ -589,6 +668,10 @@ discard block |
||
| 589 | 668 | $aRpl = array_reverse($aRpl, true); |
| 590 | 669 | return str_replace(array_keys($aRpl), $aRpl, $value); |
| 591 | 670 | } |
| 671 | + |
|
| 672 | + /** |
|
| 673 | + * @param integer $statusCode |
|
| 674 | + */ |
|
| 592 | 675 | protected function handleExternalError($statusCode,$exception) |
| 593 | 676 | { |
| 594 | 677 | if(!($exception instanceof THttpException)) |
@@ -722,6 +805,10 @@ discard block |
||
| 722 | 805 | return null; |
| 723 | 806 | return $result; |
| 724 | 807 | } |
| 808 | + |
|
| 809 | + /** |
|
| 810 | + * @param string $pattern |
|
| 811 | + */ |
|
| 725 | 812 | private function getPropertyAccessTrace($trace,$pattern) |
| 726 | 813 | { |
| 727 | 814 | $result=null; |
@@ -751,6 +838,10 @@ discard block |
||
| 751 | 838 | } |
| 752 | 839 | return $source; |
| 753 | 840 | } |
| 841 | + |
|
| 842 | + /** |
|
| 843 | + * @param string $message |
|
| 844 | + */ |
|
| 754 | 845 | private function addLink($message) |
| 755 | 846 | { |
| 756 | 847 | $baseUrl='http://pradosoft.github.io/docs/manual/class-'; |
@@ -772,6 +863,10 @@ discard block |
||
| 772 | 863 | { |
| 773 | 864 | return $this->_r; |
| 774 | 865 | } |
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * @param boolean $value |
|
| 869 | + */ |
|
| 775 | 870 | protected function setReadOnly($value) |
| 776 | 871 | { |
| 777 | 872 | $this->_r=TPropertyValue::ensureBoolean($value); |
@@ -1018,9 +1113,27 @@ discard block |
||
| 1018 | 1113 | { |
| 1019 | 1114 | throw new TNotSupportedException('cache_flush_unsupported'); |
| 1020 | 1115 | } |
| 1116 | + |
|
| 1117 | + /** |
|
| 1118 | + * @param string $key |
|
| 1119 | + */ |
|
| 1021 | 1120 | abstract protected function getValue($key); |
| 1121 | + |
|
| 1122 | + /** |
|
| 1123 | + * @param string $key |
|
| 1124 | + * @param integer $expire |
|
| 1125 | + */ |
|
| 1022 | 1126 | abstract protected function setValue($key,$value,$expire); |
| 1127 | + |
|
| 1128 | + /** |
|
| 1129 | + * @param string $key |
|
| 1130 | + * @param integer $expire |
|
| 1131 | + */ |
|
| 1023 | 1132 | abstract protected function addValue($key,$value,$expire); |
| 1133 | + |
|
| 1134 | + /** |
|
| 1135 | + * @param string $key |
|
| 1136 | + */ |
|
| 1024 | 1137 | abstract protected function deleteValue($key); |
| 1025 | 1138 | public function offsetExists($id) |
| 1026 | 1139 | { |
@@ -1109,14 +1222,26 @@ discard block |
||
| 1109 | 1222 | { |
| 1110 | 1223 | return $this->generateTimestamps($this->_directory)!=$this->_timestamps; |
| 1111 | 1224 | } |
| 1225 | + |
|
| 1226 | + /** |
|
| 1227 | + * @param string $fileName |
|
| 1228 | + */ |
|
| 1112 | 1229 | protected function validateFile($fileName) |
| 1113 | 1230 | { |
| 1114 | 1231 | return true; |
| 1115 | 1232 | } |
| 1233 | + |
|
| 1234 | + /** |
|
| 1235 | + * @param string $directory |
|
| 1236 | + */ |
|
| 1116 | 1237 | protected function validateDirectory($directory) |
| 1117 | 1238 | { |
| 1118 | 1239 | return true; |
| 1119 | 1240 | } |
| 1241 | + |
|
| 1242 | + /** |
|
| 1243 | + * @param string $directory |
|
| 1244 | + */ |
|
| 1120 | 1245 | protected function generateTimestamps($directory,$level=0) |
| 1121 | 1246 | { |
| 1122 | 1247 | if(($dir=opendir($directory))===false) |
@@ -1207,6 +1332,10 @@ discard block |
||
| 1207 | 1332 | $this->_str=''; |
| 1208 | 1333 | return $str; |
| 1209 | 1334 | } |
| 1335 | + |
|
| 1336 | + /** |
|
| 1337 | + * @param string $str |
|
| 1338 | + */ |
|
| 1210 | 1339 | public function write($str) |
| 1211 | 1340 | { |
| 1212 | 1341 | $this->_str.=$str; |
@@ -1254,6 +1383,10 @@ discard block |
||
| 1254 | 1383 | { |
| 1255 | 1384 | return $this->_dp; |
| 1256 | 1385 | } |
| 1386 | + |
|
| 1387 | + /** |
|
| 1388 | + * @param integer $value |
|
| 1389 | + */ |
|
| 1257 | 1390 | protected function setDefaultPriority($value) |
| 1258 | 1391 | { |
| 1259 | 1392 | $this->_dp=(string)round(TPropertyValue::ensureFloat($value),$this->_p); |
@@ -1262,6 +1395,10 @@ discard block |
||
| 1262 | 1395 | { |
| 1263 | 1396 | return $this->_p; |
| 1264 | 1397 | } |
| 1398 | + |
|
| 1399 | + /** |
|
| 1400 | + * @param integer $value |
|
| 1401 | + */ |
|
| 1265 | 1402 | protected function setPrecision($value) |
| 1266 | 1403 | { |
| 1267 | 1404 | $this->_p=TPropertyValue::ensureInteger($value); |
@@ -1500,6 +1637,10 @@ discard block |
||
| 1500 | 1637 | $this->sortPriorities(); |
| 1501 | 1638 | return $this->_d; |
| 1502 | 1639 | } |
| 1640 | + |
|
| 1641 | + /** |
|
| 1642 | + * @param integer $priority |
|
| 1643 | + */ |
|
| 1503 | 1644 | public function toArrayBelowPriority($priority,$inclusive=false) |
| 1504 | 1645 | { |
| 1505 | 1646 | $this->sortPriorities(); |
@@ -1512,6 +1653,10 @@ discard block |
||
| 1512 | 1653 | } |
| 1513 | 1654 | return $items; |
| 1514 | 1655 | } |
| 1656 | + |
|
| 1657 | + /** |
|
| 1658 | + * @param integer $priority |
|
| 1659 | + */ |
|
| 1515 | 1660 | public function toArrayAbovePriority($priority,$inclusive=true) |
| 1516 | 1661 | { |
| 1517 | 1662 | $this->sortPriorities(); |
@@ -1609,6 +1754,10 @@ discard block |
||
| 1609 | 1754 | { |
| 1610 | 1755 | return $this->_r; |
| 1611 | 1756 | } |
| 1757 | + |
|
| 1758 | + /** |
|
| 1759 | + * @param boolean $value |
|
| 1760 | + */ |
|
| 1612 | 1761 | protected function setReadOnly($value) |
| 1613 | 1762 | { |
| 1614 | 1763 | $this->_r=TPropertyValue::ensureBoolean($value); |
@@ -1681,6 +1830,10 @@ discard block |
||
| 1681 | 1830 | else if($data!==null) |
| 1682 | 1831 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1683 | 1832 | } |
| 1833 | + |
|
| 1834 | + /** |
|
| 1835 | + * @param TMap $data |
|
| 1836 | + */ |
|
| 1684 | 1837 | public function mergeWith($data) |
| 1685 | 1838 | { |
| 1686 | 1839 | if(is_array($data) || $data instanceof Traversable) |
@@ -1732,6 +1885,10 @@ discard block |
||
| 1732 | 1885 | { |
| 1733 | 1886 | return $this->_r; |
| 1734 | 1887 | } |
| 1888 | + |
|
| 1889 | + /** |
|
| 1890 | + * @param boolean $value |
|
| 1891 | + */ |
|
| 1735 | 1892 | protected function setReadOnly($value) |
| 1736 | 1893 | { |
| 1737 | 1894 | $this->_r=TPropertyValue::ensureBoolean($value); |
@@ -1740,6 +1897,10 @@ discard block |
||
| 1740 | 1897 | { |
| 1741 | 1898 | return $this->_dp; |
| 1742 | 1899 | } |
| 1900 | + |
|
| 1901 | + /** |
|
| 1902 | + * @param integer $value |
|
| 1903 | + */ |
|
| 1743 | 1904 | protected function setDefaultPriority($value) |
| 1744 | 1905 | { |
| 1745 | 1906 | $this->_dp = (string)round(TPropertyValue::ensureFloat($value), $this->_p); |
@@ -1748,6 +1909,10 @@ discard block |
||
| 1748 | 1909 | { |
| 1749 | 1910 | return $this->_p; |
| 1750 | 1911 | } |
| 1912 | + |
|
| 1913 | + /** |
|
| 1914 | + * @param integer $value |
|
| 1915 | + */ |
|
| 1751 | 1916 | protected function setPrecision($value) |
| 1752 | 1917 | { |
| 1753 | 1918 | $this->_p=TPropertyValue::ensureInteger($value); |
@@ -2133,6 +2298,10 @@ discard block |
||
| 2133 | 2298 | { |
| 2134 | 2299 | return $this->_parent; |
| 2135 | 2300 | } |
| 2301 | + |
|
| 2302 | + /** |
|
| 2303 | + * @param TXmlElement|null $parent |
|
| 2304 | + */ |
|
| 2136 | 2305 | public function setParent($parent) |
| 2137 | 2306 | { |
| 2138 | 2307 | $this->_parent=$parent; |
@@ -2194,6 +2363,10 @@ discard block |
||
| 2194 | 2363 | } |
| 2195 | 2364 | return null; |
| 2196 | 2365 | } |
| 2366 | + |
|
| 2367 | + /** |
|
| 2368 | + * @param string $tagName |
|
| 2369 | + */ |
|
| 2197 | 2370 | public function getElementsByTagName($tagName) |
| 2198 | 2371 | { |
| 2199 | 2372 | $list=new TList; |
@@ -2263,6 +2436,10 @@ discard block |
||
| 2263 | 2436 | { |
| 2264 | 2437 | return $this->_version; |
| 2265 | 2438 | } |
| 2439 | + |
|
| 2440 | + /** |
|
| 2441 | + * @param string $version |
|
| 2442 | + */ |
|
| 2266 | 2443 | public function setVersion($version) |
| 2267 | 2444 | { |
| 2268 | 2445 | $this->_version=$version; |
@@ -2271,6 +2448,10 @@ discard block |
||
| 2271 | 2448 | { |
| 2272 | 2449 | return $this->_encoding; |
| 2273 | 2450 | } |
| 2451 | + |
|
| 2452 | + /** |
|
| 2453 | + * @param string $encoding |
|
| 2454 | + */ |
|
| 2274 | 2455 | public function setEncoding($encoding) |
| 2275 | 2456 | { |
| 2276 | 2457 | $this->_encoding=$encoding; |
@@ -2499,10 +2680,18 @@ discard block |
||
| 2499 | 2680 | } |
| 2500 | 2681 | return 0; |
| 2501 | 2682 | } |
| 2683 | + |
|
| 2684 | + /** |
|
| 2685 | + * @param IUser $user |
|
| 2686 | + */ |
|
| 2502 | 2687 | private function isUserMatched($user) |
| 2503 | 2688 | { |
| 2504 | 2689 | return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()),$this->_users)); |
| 2505 | 2690 | } |
| 2691 | + |
|
| 2692 | + /** |
|
| 2693 | + * @param IUser $user |
|
| 2694 | + */ |
|
| 2506 | 2695 | private function isRoleMatched($user) |
| 2507 | 2696 | { |
| 2508 | 2697 | foreach($this->_roles as $role) |
@@ -2519,6 +2708,11 @@ discard block |
||
| 2519 | 2708 | } |
| 2520 | 2709 | class TAuthorizationRuleCollection extends TList |
| 2521 | 2710 | { |
| 2711 | + /** |
|
| 2712 | + * @param IUser $user |
|
| 2713 | + * @param string $verb |
|
| 2714 | + * @param string $ip |
|
| 2715 | + */ |
|
| 2522 | 2716 | public function isUserAllowed($user,$verb,$ip) |
| 2523 | 2717 | { |
| 2524 | 2718 | if($user instanceof IUser) |
@@ -2626,6 +2820,10 @@ discard block |
||
| 2626 | 2820 | { |
| 2627 | 2821 | $this->_cryptAlgorithm = $value; |
| 2628 | 2822 | } |
| 2823 | + |
|
| 2824 | + /** |
|
| 2825 | + * @param string $data |
|
| 2826 | + */ |
|
| 2629 | 2827 | public function encrypt($data) |
| 2630 | 2828 | { |
| 2631 | 2829 | $module=$this->openCryptModule(); |
@@ -2638,6 +2836,10 @@ discard block |
||
| 2638 | 2836 | mcrypt_module_close($module); |
| 2639 | 2837 | return $encrypted; |
| 2640 | 2838 | } |
| 2839 | + |
|
| 2840 | + /** |
|
| 2841 | + * @param string $data |
|
| 2842 | + */ |
|
| 2641 | 2843 | public function decrypt($data) |
| 2642 | 2844 | { |
| 2643 | 2845 | $module=$this->openCryptModule(); |
@@ -2699,6 +2901,11 @@ discard block |
||
| 2699 | 2901 | { |
| 2700 | 2902 | return $this->_mbstring ? mb_strlen($string,'8bit') : strlen($string); |
| 2701 | 2903 | } |
| 2904 | + |
|
| 2905 | + /** |
|
| 2906 | + * @param integer $start |
|
| 2907 | + * @param integer $length |
|
| 2908 | + */ |
|
| 2702 | 2909 | private function substr($string,$start,$length) |
| 2703 | 2910 | { |
| 2704 | 2911 | return $this->_mbstring ? mb_substr($string,$start,$length,'8bit') : substr($string,$start,$length); |
@@ -2858,6 +3065,10 @@ discard block |
||
| 2858 | 3065 | self::checkJsonError(); |
| 2859 | 3066 | return $s; |
| 2860 | 3067 | } |
| 3068 | + |
|
| 3069 | + /** |
|
| 3070 | + * @param string $sourceEncoding |
|
| 3071 | + */ |
|
| 2861 | 3072 | private static function convertToUtf8(&$value, $sourceEncoding) { |
| 2862 | 3073 | if(is_string($value)) |
| 2863 | 3074 | $value=iconv($sourceEncoding, 'UTF-8', $value); |
@@ -2867,6 +3078,10 @@ discard block |
||
| 2867 | 3078 | self::convertToUtf8($element, $sourceEncoding); |
| 2868 | 3079 | } |
| 2869 | 3080 | } |
| 3081 | + |
|
| 3082 | + /** |
|
| 3083 | + * @param string $value |
|
| 3084 | + */ |
|
| 2870 | 3085 | public static function jsonDecode($value, $assoc = false, $depth = 512) |
| 2871 | 3086 | { |
| 2872 | 3087 | $s= @json_decode($value, $assoc, $depth); |
@@ -2901,6 +3116,10 @@ discard block |
||
| 2901 | 3116 | } |
| 2902 | 3117 | throw new Exception("JSON error ($err): $msg"); |
| 2903 | 3118 | } |
| 3119 | + |
|
| 3120 | + /** |
|
| 3121 | + * @param string $code |
|
| 3122 | + */ |
|
| 2904 | 3123 | public static function JSMin($code) |
| 2905 | 3124 | { |
| 2906 | 3125 | Prado::using('System.Web.Javascripts.JSMin'); |
@@ -3088,6 +3307,10 @@ discard block |
||
| 3088 | 3307 | { |
| 3089 | 3308 | return $this->getID(); |
| 3090 | 3309 | } |
| 3310 | + |
|
| 3311 | + /** |
|
| 3312 | + * @param TUrlManager $manager |
|
| 3313 | + */ |
|
| 3091 | 3314 | protected function cacheUrlManager($manager) |
| 3092 | 3315 | { |
| 3093 | 3316 | if($this->getEnableCache()) |
@@ -3337,6 +3560,10 @@ discard block |
||
| 3337 | 3560 | { |
| 3338 | 3561 | return $_ENV; |
| 3339 | 3562 | } |
| 3563 | + |
|
| 3564 | + /** |
|
| 3565 | + * @param string $serviceID |
|
| 3566 | + */ |
|
| 3340 | 3567 | public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=true,$encodeGetItems=true) |
| 3341 | 3568 | { |
| 3342 | 3569 | if ($this->_cookieOnly===null) |
@@ -3457,6 +3684,10 @@ discard block |
||
| 3457 | 3684 | class THttpCookieCollection extends TList |
| 3458 | 3685 | { |
| 3459 | 3686 | private $_o; |
| 3687 | + |
|
| 3688 | + /** |
|
| 3689 | + * @param THttpResponse $owner |
|
| 3690 | + */ |
|
| 3460 | 3691 | public function __construct($owner=null) |
| 3461 | 3692 | { |
| 3462 | 3693 | $this->_o=$owner; |
@@ -3520,6 +3751,10 @@ discard block |
||
| 3520 | 3751 | { |
| 3521 | 3752 | return $this->_expire; |
| 3522 | 3753 | } |
| 3754 | + |
|
| 3755 | + /** |
|
| 3756 | + * @param integer $value |
|
| 3757 | + */ |
|
| 3523 | 3758 | public function setExpire($value) |
| 3524 | 3759 | { |
| 3525 | 3760 | $this->_expire=TPropertyValue::ensureInteger($value); |
@@ -3586,6 +3821,10 @@ discard block |
||
| 3586 | 3821 | private $_query; |
| 3587 | 3822 | private $_fragment; |
| 3588 | 3823 | private $_uri; |
| 3824 | + |
|
| 3825 | + /** |
|
| 3826 | + * @param string $uri |
|
| 3827 | + */ |
|
| 3589 | 3828 | public function __construct($uri) |
| 3590 | 3829 | { |
| 3591 | 3830 | if(($ret=@parse_url($uri))!==false) |
@@ -3651,6 +3890,10 @@ discard block |
||
| 3651 | 3890 | class THttpResponseAdapter extends TApplicationComponent |
| 3652 | 3891 | { |
| 3653 | 3892 | private $_response; |
| 3893 | + |
|
| 3894 | + /** |
|
| 3895 | + * @param THttpResponse $response |
|
| 3896 | + */ |
|
| 3654 | 3897 | public function __construct($response) |
| 3655 | 3898 | { |
| 3656 | 3899 | $this->_response=$response; |
@@ -3746,6 +3989,10 @@ discard block |
||
| 3746 | 3989 | { |
| 3747 | 3990 | return $this->_charset; |
| 3748 | 3991 | } |
| 3992 | + |
|
| 3993 | + /** |
|
| 3994 | + * @param string $charset |
|
| 3995 | + */ |
|
| 3749 | 3996 | public function setCharset($charset) |
| 3750 | 3997 | { |
| 3751 | 3998 | $this->_charset = (strToLower($charset) === 'false') ? false : (string)$charset; |
@@ -3969,6 +4216,10 @@ discard block |
||
| 3969 | 4216 | return array_change_key_case($result, $case); |
| 3970 | 4217 | return $result; |
| 3971 | 4218 | } |
| 4219 | + |
|
| 4220 | + /** |
|
| 4221 | + * @param string $value |
|
| 4222 | + */ |
|
| 3972 | 4223 | public function appendHeader($value, $replace=true) |
| 3973 | 4224 | { |
| 3974 | 4225 | header($value, $replace); |
@@ -3977,6 +4228,10 @@ discard block |
||
| 3977 | 4228 | { |
| 3978 | 4229 | error_log($message,$messageType,$destination,$extraHeaders); |
| 3979 | 4230 | } |
| 4231 | + |
|
| 4232 | + /** |
|
| 4233 | + * @param THttpCookie $cookie |
|
| 4234 | + */ |
|
| 3980 | 4235 | public function addCookie($cookie) |
| 3981 | 4236 | { |
| 3982 | 4237 | $request=$this->getRequest(); |
@@ -4034,6 +4289,10 @@ discard block |
||
| 4034 | 4289 | else |
| 4035 | 4290 | return $this->createNewHtmlWriter($type, $this); |
| 4036 | 4291 | } |
| 4292 | + |
|
| 4293 | + /** |
|
| 4294 | + * @param THttpResponse $writer |
|
| 4295 | + */ |
|
| 4037 | 4296 | public function createNewHtmlWriter($type, $writer) |
| 4038 | 4297 | { |
| 4039 | 4298 | return Prado::createComponent($type, $writer); |
@@ -4143,6 +4402,10 @@ discard block |
||
| 4143 | 4402 | { |
| 4144 | 4403 | return $this->_customStorage; |
| 4145 | 4404 | } |
| 4405 | + |
|
| 4406 | + /** |
|
| 4407 | + * @param boolean $value |
|
| 4408 | + */ |
|
| 4146 | 4409 | public function setUseCustomStorage($value) |
| 4147 | 4410 | { |
| 4148 | 4411 | $this->_customStorage=TPropertyValue::ensureBoolean($value); |
@@ -4285,10 +4548,18 @@ discard block |
||
| 4285 | 4548 | { |
| 4286 | 4549 | return array_keys($_SESSION); |
| 4287 | 4550 | } |
| 4551 | + |
|
| 4552 | + /** |
|
| 4553 | + * @param string $key |
|
| 4554 | + */ |
|
| 4288 | 4555 | public function itemAt($key) |
| 4289 | 4556 | { |
| 4290 | 4557 | return isset($_SESSION[$key]) ? $_SESSION[$key] : null; |
| 4291 | 4558 | } |
| 4559 | + |
|
| 4560 | + /** |
|
| 4561 | + * @param string $key |
|
| 4562 | + */ |
|
| 4292 | 4563 | public function add($key,$value) |
| 4293 | 4564 | { |
| 4294 | 4565 | $_SESSION[$key]=$value; |
@@ -4395,6 +4666,10 @@ discard block |
||
| 4395 | 4666 | { |
| 4396 | 4667 | return $this->_caseSensitive; |
| 4397 | 4668 | } |
| 4669 | + |
|
| 4670 | + /** |
|
| 4671 | + * @param boolean $value |
|
| 4672 | + */ |
|
| 4398 | 4673 | public function setCaseSensitive($value) |
| 4399 | 4674 | { |
| 4400 | 4675 | $this->_caseSensitive=TPropertyValue::ensureBoolean($value); |
@@ -4407,6 +4682,10 @@ discard block |
||
| 4407 | 4682 | { |
| 4408 | 4683 | parent::add($this->_caseSensitive?$key:strtolower($key),$value); |
| 4409 | 4684 | } |
| 4685 | + |
|
| 4686 | + /** |
|
| 4687 | + * @param string $key |
|
| 4688 | + */ |
|
| 4410 | 4689 | public function remove($key) |
| 4411 | 4690 | { |
| 4412 | 4691 | return parent::remove($this->_caseSensitive?$key:strtolower($key)); |
@@ -4557,6 +4836,10 @@ discard block |
||
| 4557 | 4836 | } |
| 4558 | 4837 | return $this->_page; |
| 4559 | 4838 | } |
| 4839 | + |
|
| 4840 | + /** |
|
| 4841 | + * @param TPage $page |
|
| 4842 | + */ |
|
| 4560 | 4843 | public function setPage($page) |
| 4561 | 4844 | { |
| 4562 | 4845 | $this->_page=$page; |
@@ -4700,6 +4983,10 @@ discard block |
||
| 4700 | 4983 | else |
| 4701 | 4984 | return $this->getViewState('Visible',true); |
| 4702 | 4985 | } |
| 4986 | + |
|
| 4987 | + /** |
|
| 4988 | + * @param boolean $value |
|
| 4989 | + */ |
|
| 4703 | 4990 | public function setVisible($value) |
| 4704 | 4991 | { |
| 4705 | 4992 | $this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true); |
@@ -4738,6 +5025,10 @@ discard block |
||
| 4738 | 5025 | return $attributes; |
| 4739 | 5026 | } |
| 4740 | 5027 | } |
| 5028 | + |
|
| 5029 | + /** |
|
| 5030 | + * @param string $name |
|
| 5031 | + */ |
|
| 4741 | 5032 | public function hasAttribute($name) |
| 4742 | 5033 | { |
| 4743 | 5034 | if($attributes=$this->getViewState('Attributes',null)) |
@@ -4745,6 +5036,10 @@ discard block |
||
| 4745 | 5036 | else |
| 4746 | 5037 | return false; |
| 4747 | 5038 | } |
| 5039 | + |
|
| 5040 | + /** |
|
| 5041 | + * @param string $name |
|
| 5042 | + */ |
|
| 4748 | 5043 | public function getAttribute($name) |
| 4749 | 5044 | { |
| 4750 | 5045 | if($attributes=$this->getViewState('Attributes',null)) |
@@ -4752,6 +5047,10 @@ discard block |
||
| 4752 | 5047 | else |
| 4753 | 5048 | return null; |
| 4754 | 5049 | } |
| 5050 | + |
|
| 5051 | + /** |
|
| 5052 | + * @param string $name |
|
| 5053 | + */ |
|
| 4755 | 5054 | public function setAttribute($name,$value) |
| 4756 | 5055 | { |
| 4757 | 5056 | $this->getAttributes()->add($name,$value); |
@@ -4775,6 +5074,10 @@ discard block |
||
| 4775 | 5074 | else |
| 4776 | 5075 | return !($this->_flags & self::IS_DISABLE_VIEWSTATE); |
| 4777 | 5076 | } |
| 5077 | + |
|
| 5078 | + /** |
|
| 5079 | + * @param boolean $value |
|
| 5080 | + */ |
|
| 4778 | 5081 | public function setEnableViewState($value) |
| 4779 | 5082 | { |
| 4780 | 5083 | if(TPropertyValue::ensureBoolean($value)) |
@@ -4782,10 +5085,20 @@ discard block |
||
| 4782 | 5085 | else |
| 4783 | 5086 | $this->_flags |= self::IS_DISABLE_VIEWSTATE; |
| 4784 | 5087 | } |
| 5088 | + |
|
| 5089 | + /** |
|
| 5090 | + * @param string $key |
|
| 5091 | + * @param integer $defaultValue |
|
| 5092 | + */ |
|
| 4785 | 5093 | protected function getControlState($key,$defaultValue=null) |
| 4786 | 5094 | { |
| 4787 | 5095 | return isset($this->_rf[self::RF_CONTROLSTATE][$key])?$this->_rf[self::RF_CONTROLSTATE][$key]:$defaultValue; |
| 4788 | 5096 | } |
| 5097 | + |
|
| 5098 | + /** |
|
| 5099 | + * @param string $key |
|
| 5100 | + * @param integer $defaultValue |
|
| 5101 | + */ |
|
| 4789 | 5102 | protected function setControlState($key,$value,$defaultValue=null) |
| 4790 | 5103 | { |
| 4791 | 5104 | if($value===$defaultValue) |
@@ -4797,6 +5110,10 @@ discard block |
||
| 4797 | 5110 | { |
| 4798 | 5111 | unset($this->_rf[self::RF_CONTROLSTATE][$key]); |
| 4799 | 5112 | } |
| 5113 | + |
|
| 5114 | + /** |
|
| 5115 | + * @param boolean $enabled |
|
| 5116 | + */ |
|
| 4800 | 5117 | public function trackViewState($enabled) |
| 4801 | 5118 | { |
| 4802 | 5119 | $this->_trackViewState=TPropertyValue::ensureBoolean($enabled); |
@@ -4814,6 +5131,10 @@ discard block |
||
| 4814 | 5131 | else |
| 4815 | 5132 | return $defaultValue; |
| 4816 | 5133 | } |
| 5134 | + |
|
| 5135 | + /** |
|
| 5136 | + * @param string $key |
|
| 5137 | + */ |
|
| 4817 | 5138 | public function setViewState($key,$value,$defaultValue=null) |
| 4818 | 5139 | { |
| 4819 | 5140 | if($this->_trackViewState) |
@@ -4833,6 +5154,10 @@ discard block |
||
| 4833 | 5154 | $this->_tempState[$key]=$value; |
| 4834 | 5155 | } |
| 4835 | 5156 | } |
| 5157 | + |
|
| 5158 | + /** |
|
| 5159 | + * @param string $key |
|
| 5160 | + */ |
|
| 4836 | 5161 | public function clearViewState($key) |
| 4837 | 5162 | { |
| 4838 | 5163 | unset($this->_viewState[$key]); |
@@ -4889,6 +5214,10 @@ discard block |
||
| 4889 | 5214 | { |
| 4890 | 5215 | return ($this->_flags & self::IS_CHILD_CREATED)!==0; |
| 4891 | 5216 | } |
| 5217 | + |
|
| 5218 | + /** |
|
| 5219 | + * @param boolean $value |
|
| 5220 | + */ |
|
| 4892 | 5221 | final protected function setChildControlsCreated($value) |
| 4893 | 5222 | { |
| 4894 | 5223 | if($value) |
@@ -4948,6 +5277,10 @@ discard block |
||
| 4948 | 5277 | return null; |
| 4949 | 5278 | } |
| 4950 | 5279 | } |
| 5280 | + |
|
| 5281 | + /** |
|
| 5282 | + * @param string $type |
|
| 5283 | + */ |
|
| 4951 | 5284 | public function findControlsByType($type,$strict=true) |
| 4952 | 5285 | { |
| 4953 | 5286 | $controls=array(); |
@@ -4985,6 +5318,10 @@ discard block |
||
| 4985 | 5318 | unset($this->_rf[self::RF_NAMED_CONTROLS_ID]); |
| 4986 | 5319 | $this->clearNameTable(); |
| 4987 | 5320 | } |
| 5321 | + |
|
| 5322 | + /** |
|
| 5323 | + * @param TCheckBox $object |
|
| 5324 | + */ |
|
| 4988 | 5325 | public function registerObject($name,$object) |
| 4989 | 5326 | { |
| 4990 | 5327 | if(isset($this->_rf[self::RF_NAMED_OBJECTS][$name])) |
@@ -5019,6 +5356,10 @@ discard block |
||
| 5019 | 5356 | { |
| 5020 | 5357 | return $this->getControlStage() >= self::CS_PRERENDERED; |
| 5021 | 5358 | } |
| 5359 | + |
|
| 5360 | + /** |
|
| 5361 | + * @param string $name |
|
| 5362 | + */ |
|
| 5022 | 5363 | public function getRegisteredObject($name) |
| 5023 | 5364 | { |
| 5024 | 5365 | return isset($this->_rf[self::RF_NAMED_OBJECTS][$name])?$this->_rf[self::RF_NAMED_OBJECTS][$name]:null; |
@@ -5042,6 +5383,10 @@ discard block |
||
| 5042 | 5383 | $control=$control->_parent; |
| 5043 | 5384 | return $control===$ancestor; |
| 5044 | 5385 | } |
| 5386 | + |
|
| 5387 | + /** |
|
| 5388 | + * @param TControl $control |
|
| 5389 | + */ |
|
| 5045 | 5390 | public function addedControl($control) |
| 5046 | 5391 | { |
| 5047 | 5392 | if($control->_parent) |
@@ -5080,6 +5425,10 @@ discard block |
||
| 5080 | 5425 | } |
| 5081 | 5426 | } |
| 5082 | 5427 | } |
| 5428 | + |
|
| 5429 | + /** |
|
| 5430 | + * @param TControl $control |
|
| 5431 | + */ |
|
| 5083 | 5432 | public function removedControl($control) |
| 5084 | 5433 | { |
| 5085 | 5434 | if($this->_namingContainer) |
@@ -5225,6 +5574,10 @@ discard block |
||
| 5225 | 5574 | $rootControl=(($page=$this->getPage())===null)?$this:$page; |
| 5226 | 5575 | $rootControl->broadcastEventInternal($name,$sender,new TBroadcastEventParameter($name,$param)); |
| 5227 | 5576 | } |
| 5577 | + |
|
| 5578 | + /** |
|
| 5579 | + * @param TBroadcastEventParameter $param |
|
| 5580 | + */ |
|
| 5228 | 5581 | private function broadcastEventInternal($name,$sender,$param) |
| 5229 | 5582 | { |
| 5230 | 5583 | if($this->hasEvent($name)) |
@@ -5370,6 +5723,10 @@ discard block |
||
| 5370 | 5723 | else if($this->_flags & self::IS_STYLESHEET_APPLIED) |
| 5371 | 5724 | throw new TInvalidOperationException('control_stylesheet_applied',get_class($this)); |
| 5372 | 5725 | } |
| 5726 | + |
|
| 5727 | + /** |
|
| 5728 | + * @param boolean $recursive |
|
| 5729 | + */ |
|
| 5373 | 5730 | private function clearCachedUniqueID($recursive) |
| 5374 | 5731 | { |
| 5375 | 5732 | if($recursive && $this->_uid!==null && isset($this->_rf[self::RF_CONTROLS])) |
@@ -5393,6 +5750,10 @@ discard block |
||
| 5393 | 5750 | { |
| 5394 | 5751 | unset($this->_rf[self::RF_NAMED_CONTROLS]); |
| 5395 | 5752 | } |
| 5753 | + |
|
| 5754 | + /** |
|
| 5755 | + * @param TControl $container |
|
| 5756 | + */ |
|
| 5396 | 5757 | private function fillNameTable($container,$controls) |
| 5397 | 5758 | { |
| 5398 | 5759 | foreach($controls as $control) |
@@ -5465,11 +5826,18 @@ discard block |
||
| 5465 | 5826 | } |
| 5466 | 5827 | interface IPostBackEventHandler |
| 5467 | 5828 | { |
| 5829 | + /** |
|
| 5830 | + * @return void |
|
| 5831 | + */ |
|
| 5468 | 5832 | public function raisePostBackEvent($param); |
| 5469 | 5833 | } |
| 5470 | 5834 | interface IPostBackDataHandler |
| 5471 | 5835 | { |
| 5472 | 5836 | public function loadPostData($key,$values); |
| 5837 | + |
|
| 5838 | + /** |
|
| 5839 | + * @return void |
|
| 5840 | + */ |
|
| 5473 | 5841 | public function raisePostDataChangedEvent(); |
| 5474 | 5842 | public function getDataChanged(); |
| 5475 | 5843 | } |
@@ -5477,8 +5845,16 @@ discard block |
||
| 5477 | 5845 | { |
| 5478 | 5846 | public function validate(); |
| 5479 | 5847 | public function getIsValid(); |
| 5848 | + |
|
| 5849 | + /** |
|
| 5850 | + * @return void |
|
| 5851 | + */ |
|
| 5480 | 5852 | public function setIsValid($value); |
| 5481 | 5853 | public function getErrorMessage(); |
| 5854 | + |
|
| 5855 | + /** |
|
| 5856 | + * @return void |
|
| 5857 | + */ |
|
| 5482 | 5858 | public function setErrorMessage($value); |
| 5483 | 5859 | } |
| 5484 | 5860 | interface IValidatable |
@@ -5493,26 +5869,66 @@ discard block |
||
| 5493 | 5869 | } |
| 5494 | 5870 | interface ITheme |
| 5495 | 5871 | { |
| 5872 | + /** |
|
| 5873 | + * @return boolean |
|
| 5874 | + */ |
|
| 5496 | 5875 | public function applySkin($control); |
| 5497 | 5876 | } |
| 5498 | 5877 | interface ITemplate |
| 5499 | 5878 | { |
| 5879 | + /** |
|
| 5880 | + * @return void |
|
| 5881 | + */ |
|
| 5500 | 5882 | public function instantiateIn($parent); |
| 5501 | 5883 | } |
| 5502 | 5884 | interface IButtonControl |
| 5503 | 5885 | { |
| 5504 | 5886 | public function getText(); |
| 5887 | + |
|
| 5888 | + /** |
|
| 5889 | + * @param string $value |
|
| 5890 | + * |
|
| 5891 | + * @return void |
|
| 5892 | + */ |
|
| 5505 | 5893 | public function setText($value); |
| 5506 | 5894 | public function getCausesValidation(); |
| 5895 | + |
|
| 5896 | + /** |
|
| 5897 | + * @return void |
|
| 5898 | + */ |
|
| 5507 | 5899 | public function setCausesValidation($value); |
| 5508 | 5900 | public function getCommandName(); |
| 5901 | + |
|
| 5902 | + /** |
|
| 5903 | + * @return void |
|
| 5904 | + */ |
|
| 5509 | 5905 | public function setCommandName($value); |
| 5510 | 5906 | public function getCommandParameter(); |
| 5907 | + |
|
| 5908 | + /** |
|
| 5909 | + * @return void |
|
| 5910 | + */ |
|
| 5511 | 5911 | public function setCommandParameter($value); |
| 5512 | 5912 | public function getValidationGroup(); |
| 5913 | + |
|
| 5914 | + /** |
|
| 5915 | + * @return void |
|
| 5916 | + */ |
|
| 5513 | 5917 | public function setValidationGroup($value); |
| 5918 | + |
|
| 5919 | + /** |
|
| 5920 | + * @return void |
|
| 5921 | + */ |
|
| 5514 | 5922 | public function onClick($param); |
| 5923 | + |
|
| 5924 | + /** |
|
| 5925 | + * @return void |
|
| 5926 | + */ |
|
| 5515 | 5927 | public function onCommand($param); |
| 5928 | + |
|
| 5929 | + /** |
|
| 5930 | + * @return void |
|
| 5931 | + */ |
|
| 5516 | 5932 | public function setIsDefaultButton($value); |
| 5517 | 5933 | public function getIsDefaultButton(); |
| 5518 | 5934 | } |
@@ -5970,6 +6386,10 @@ discard block |
||
| 5970 | 6386 | { |
| 5971 | 6387 | return $this->_customStyle===null?'':$this->_customStyle; |
| 5972 | 6388 | } |
| 6389 | + |
|
| 6390 | + /** |
|
| 6391 | + * @param string $value |
|
| 6392 | + */ |
|
| 5973 | 6393 | public function setCustomStyle($value) |
| 5974 | 6394 | { |
| 5975 | 6395 | $this->_customStyle=$value; |
@@ -5978,6 +6398,11 @@ discard block |
||
| 5978 | 6398 | { |
| 5979 | 6399 | return isset($this->_fields[$name])?$this->_fields[$name]:''; |
| 5980 | 6400 | } |
| 6401 | + |
|
| 6402 | + /** |
|
| 6403 | + * @param string $name |
|
| 6404 | + * @param string $value |
|
| 6405 | + */ |
|
| 5981 | 6406 | public function setStyleField($name,$value) |
| 5982 | 6407 | { |
| 5983 | 6408 | $this->_fields[$name]=$value; |
@@ -6473,6 +6898,10 @@ discard block |
||
| 6473 | 6898 | { |
| 6474 | 6899 | private $_ensureid=false; |
| 6475 | 6900 | protected $_decorator; |
| 6901 | + |
|
| 6902 | + /** |
|
| 6903 | + * @param boolean $value |
|
| 6904 | + */ |
|
| 6476 | 6905 | public function setEnsureId($value) |
| 6477 | 6906 | { |
| 6478 | 6907 | $this->_ensureid |= TPropertyValue::ensureBoolean($value); |
@@ -6562,6 +6991,10 @@ discard block |
||
| 6562 | 6991 | else |
| 6563 | 6992 | return ''; |
| 6564 | 6993 | } |
| 6994 | + |
|
| 6995 | + /** |
|
| 6996 | + * @param string $value |
|
| 6997 | + */ |
|
| 6565 | 6998 | public function setForeColor($value) |
| 6566 | 6999 | { |
| 6567 | 7000 | $this->getStyle()->setForeColor($value); |
@@ -6592,6 +7025,10 @@ discard block |
||
| 6592 | 7025 | else |
| 6593 | 7026 | return ''; |
| 6594 | 7027 | } |
| 7028 | + |
|
| 7029 | + /** |
|
| 7030 | + * @param string $value |
|
| 7031 | + */ |
|
| 6595 | 7032 | public function setHeight($value) |
| 6596 | 7033 | { |
| 6597 | 7034 | $this->getStyle()->setHeight($value); |
@@ -6653,6 +7090,10 @@ discard block |
||
| 6653 | 7090 | else |
| 6654 | 7091 | return ''; |
| 6655 | 7092 | } |
| 7093 | + |
|
| 7094 | + /** |
|
| 7095 | + * @param string $value |
|
| 7096 | + */ |
|
| 6656 | 7097 | public function setWidth($value) |
| 6657 | 7098 | { |
| 6658 | 7099 | $this->getStyle()->setWidth($value); |
@@ -6780,6 +7221,10 @@ discard block |
||
| 6780 | 7221 | $tpl->instantiateIn($this); |
| 6781 | 7222 | } |
| 6782 | 7223 | } |
| 7224 | + |
|
| 7225 | + /** |
|
| 7226 | + * @param string $id |
|
| 7227 | + */ |
|
| 6783 | 7228 | public function registerContent($id,TContent $object) |
| 6784 | 7229 | { |
| 6785 | 7230 | if(isset($this->_contents[$id])) |
@@ -6787,6 +7232,10 @@ discard block |
||
| 6787 | 7232 | else |
| 6788 | 7233 | $this->_contents[$id]=$object; |
| 6789 | 7234 | } |
| 7235 | + |
|
| 7236 | + /** |
|
| 7237 | + * @param string $id |
|
| 7238 | + */ |
|
| 6790 | 7239 | public function registerContentPlaceHolder($id,TContentPlaceHolder $object) |
| 6791 | 7240 | { |
| 6792 | 7241 | if(isset($this->_placeholders[$id])) |
@@ -6983,6 +7432,10 @@ discard block |
||
| 6983 | 7432 | { |
| 6984 | 7433 | return $this->getViewState('Enctype',''); |
| 6985 | 7434 | } |
| 7435 | + |
|
| 7436 | + /** |
|
| 7437 | + * @param string $value |
|
| 7438 | + */ |
|
| 6986 | 7439 | public function setEnctype($value) |
| 6987 | 7440 | { |
| 6988 | 7441 | $this->setViewState('Enctype',$value,''); |
@@ -7102,6 +7555,10 @@ discard block |
||
| 7102 | 7555 | $scripts = array_unique($scripts); |
| 7103 | 7556 | return $scripts; |
| 7104 | 7557 | } |
| 7558 | + |
|
| 7559 | + /** |
|
| 7560 | + * @param string $base |
|
| 7561 | + */ |
|
| 7105 | 7562 | protected function getPackagePathUrl($base) |
| 7106 | 7563 | { |
| 7107 | 7564 | $assets = Prado::getApplication()->getAssetManager(); |
@@ -7251,6 +7708,11 @@ discard block |
||
| 7251 | 7708 | $params=func_get_args(); |
| 7252 | 7709 | $this->_page->registerCachingAction('Page.ClientScript','registerEndScript',$params); |
| 7253 | 7710 | } |
| 7711 | + |
|
| 7712 | + /** |
|
| 7713 | + * @param string $name |
|
| 7714 | + * @param string $value |
|
| 7715 | + */ |
|
| 7254 | 7716 | public function registerHiddenField($name,$value) |
| 7255 | 7717 | { |
| 7256 | 7718 | $this->_hiddenFields[$name]=$value; |
@@ -7388,6 +7850,10 @@ discard block |
||
| 7388 | 7850 | $this->renderAllPendingScriptFiles($writer); |
| 7389 | 7851 | } |
| 7390 | 7852 | } |
| 7853 | + |
|
| 7854 | + /** |
|
| 7855 | + * @param boolean $initial |
|
| 7856 | + */ |
|
| 7391 | 7857 | protected function renderHiddenFieldsInt($writer, $initial) |
| 7392 | 7858 | { |
| 7393 | 7859 | if ($initial) $this->_renderedHiddenFields = array(); |
@@ -7423,12 +7889,20 @@ discard block |
||
| 7423 | 7889 | abstract class TClientSideOptions extends TComponent |
| 7424 | 7890 | { |
| 7425 | 7891 | private $_options; |
| 7892 | + |
|
| 7893 | + /** |
|
| 7894 | + * @param string $name |
|
| 7895 | + */ |
|
| 7426 | 7896 | protected function setFunction($name, $code) |
| 7427 | 7897 | { |
| 7428 | 7898 | if(!TJavaScript::isJsLiteral($code)) |
| 7429 | 7899 | $code = TJavaScript::quoteJsLiteral($this->ensureFunction($code)); |
| 7430 | 7900 | $this->setOption($name, $code); |
| 7431 | 7901 | } |
| 7902 | + |
|
| 7903 | + /** |
|
| 7904 | + * @param string $name |
|
| 7905 | + */ |
|
| 7432 | 7906 | protected function getOption($name) |
| 7433 | 7907 | { |
| 7434 | 7908 | if ($this->_options) |
@@ -7551,6 +8025,10 @@ discard block |
||
| 7551 | 8025 | $this->renderControl($writer); |
| 7552 | 8026 | $this->unloadRecursive(); |
| 7553 | 8027 | } |
| 8028 | + |
|
| 8029 | + /** |
|
| 8030 | + * @param string $enc |
|
| 8031 | + */ |
|
| 7554 | 8032 | protected static function decodeUTF8($data, $enc) |
| 7555 | 8033 | { |
| 7556 | 8034 | if(is_array($data)) |
@@ -7633,6 +8111,10 @@ discard block |
||
| 7633 | 8111 | else |
| 7634 | 8112 | throw new TInvalidOperationException('page_form_duplicated'); |
| 7635 | 8113 | } |
| 8114 | + |
|
| 8115 | + /** |
|
| 8116 | + * @param string $validationGroup |
|
| 8117 | + */ |
|
| 7636 | 8118 | public function getValidators($validationGroup=null) |
| 7637 | 8119 | { |
| 7638 | 8120 | if(!$this->_validators) |
@@ -7703,6 +8185,10 @@ discard block |
||
| 7703 | 8185 | { |
| 7704 | 8186 | $this->_styleSheet=empty($value)?null:$value; |
| 7705 | 8187 | } |
| 8188 | + |
|
| 8189 | + /** |
|
| 8190 | + * @param TControl $control |
|
| 8191 | + */ |
|
| 7706 | 8192 | public function applyControlSkin($control) |
| 7707 | 8193 | { |
| 7708 | 8194 | if(($theme=$this->getTheme())!==null) |
@@ -7850,6 +8336,10 @@ discard block |
||
| 7850 | 8336 | { |
| 7851 | 8337 | $this->_postBackEventParameter=$value; |
| 7852 | 8338 | } |
| 8339 | + |
|
| 8340 | + /** |
|
| 8341 | + * @param boolean $beforeLoad |
|
| 8342 | + */ |
|
| 7853 | 8343 | protected function processPostData($postData,$beforeLoad) |
| 7854 | 8344 | { |
| 7855 | 8345 | $this->_isLoadingPostData=true; |
@@ -7938,6 +8428,10 @@ discard block |
||
| 7938 | 8428 | $this->getClientScript()->registerFocusControl($lastFocus); |
| 7939 | 8429 | $this->_inFormRender=false; |
| 7940 | 8430 | } |
| 8431 | + |
|
| 8432 | + /** |
|
| 8433 | + * @param TControl $value |
|
| 8434 | + */ |
|
| 7941 | 8435 | public function setFocus($value) |
| 7942 | 8436 | { |
| 7943 | 8437 | $this->_focus=$value; |
@@ -7983,6 +8477,10 @@ discard block |
||
| 7983 | 8477 | { |
| 7984 | 8478 | return $this->_clientState; |
| 7985 | 8479 | } |
| 8480 | + |
|
| 8481 | + /** |
|
| 8482 | + * @param string $state |
|
| 8483 | + */ |
|
| 7986 | 8484 | public function setClientState($state) |
| 7987 | 8485 | { |
| 7988 | 8486 | $this->_clientState=$state; |
@@ -8042,6 +8540,11 @@ discard block |
||
| 8042 | 8540 | { |
| 8043 | 8541 | $this->_pagePath=$value; |
| 8044 | 8542 | } |
| 8543 | + |
|
| 8544 | + /** |
|
| 8545 | + * @param string $context |
|
| 8546 | + * @param string $funcName |
|
| 8547 | + */ |
|
| 8045 | 8548 | public function registerCachingAction($context,$funcName,$funcParams) |
| 8046 | 8549 | { |
| 8047 | 8550 | if($this->_cachingStack) |
@@ -8064,13 +8567,27 @@ discard block |
||
| 8064 | 8567 | } |
| 8065 | 8568 | interface IPageStatePersister |
| 8066 | 8569 | { |
| 8570 | + /** |
|
| 8571 | + * @return TPage |
|
| 8572 | + */ |
|
| 8067 | 8573 | public function getPage(); |
| 8574 | + |
|
| 8575 | + /** |
|
| 8576 | + * @return void |
|
| 8577 | + */ |
|
| 8068 | 8578 | public function setPage(TPage $page); |
| 8579 | + |
|
| 8580 | + /** |
|
| 8581 | + * @return void |
|
| 8582 | + */ |
|
| 8069 | 8583 | public function save($state); |
| 8070 | 8584 | public function load(); |
| 8071 | 8585 | } |
| 8072 | 8586 | class TPageStateFormatter |
| 8073 | 8587 | { |
| 8588 | + /** |
|
| 8589 | + * @param TPage $page |
|
| 8590 | + */ |
|
| 8074 | 8591 | public static function serialize($page,$data) |
| 8075 | 8592 | { |
| 8076 | 8593 | $sm=$page->getApplication()->getSecurityManager(); |
@@ -8084,6 +8601,10 @@ discard block |
||
| 8084 | 8601 | $str=$sm->encrypt($str); |
| 8085 | 8602 | return base64_encode($str); |
| 8086 | 8603 | } |
| 8604 | + |
|
| 8605 | + /** |
|
| 8606 | + * @param TPage $page |
|
| 8607 | + */ |
|
| 8087 | 8608 | public static function unserialize($page,$data) |
| 8088 | 8609 | { |
| 8089 | 8610 | $str=base64_decode($data); |
@@ -8277,6 +8798,10 @@ discard block |
||
| 8277 | 8798 | { |
| 8278 | 8799 | $this->_cacheModuleID=$value; |
| 8279 | 8800 | } |
| 8801 | + |
|
| 8802 | + /** |
|
| 8803 | + * @param string $value |
|
| 8804 | + */ |
|
| 8280 | 8805 | public function setCacheKeyPrefix($value) |
| 8281 | 8806 | { |
| 8282 | 8807 | $this->_keyPrefix=$value; |
@@ -8327,10 +8852,18 @@ discard block |
||
| 8327 | 8852 | { |
| 8328 | 8853 | $this->_cachePostBack=TPropertyValue::ensureBoolean($value); |
| 8329 | 8854 | } |
| 8855 | + |
|
| 8856 | + /** |
|
| 8857 | + * @param TOutputCacheCheckDependencyEventParameter $param |
|
| 8858 | + */ |
|
| 8330 | 8859 | public function onCheckDependency($param) |
| 8331 | 8860 | { |
| 8332 | 8861 | $this->raiseEvent('OnCheckDependency',$this,$param); |
| 8333 | 8862 | } |
| 8863 | + |
|
| 8864 | + /** |
|
| 8865 | + * @param TOutputCacheCalculateKeyEventParameter $param |
|
| 8866 | + */ |
|
| 8334 | 8867 | public function onCalculateKey($param) |
| 8335 | 8868 | { |
| 8336 | 8869 | $this->raiseEvent('OnCalculateKey',$this,$param); |
@@ -8422,6 +8955,10 @@ discard block |
||
| 8422 | 8955 | $tplFile=dirname($class->getFileName()).DIRECTORY_SEPARATOR.$className.self::TEMPLATE_FILE_EXT; |
| 8423 | 8956 | return $this->getTemplateByFileName($tplFile); |
| 8424 | 8957 | } |
| 8958 | + |
|
| 8959 | + /** |
|
| 8960 | + * @param string $fileName |
|
| 8961 | + */ |
|
| 8425 | 8962 | public function getTemplateByFileName($fileName) |
| 8426 | 8963 | { |
| 8427 | 8964 | if(($fileName=$this->getLocalizedTemplate($fileName))!==null) |
@@ -8461,6 +8998,10 @@ discard block |
||
| 8461 | 8998 | else |
| 8462 | 8999 | return null; |
| 8463 | 9000 | } |
| 9001 | + |
|
| 9002 | + /** |
|
| 9003 | + * @return string |
|
| 9004 | + */ |
|
| 8464 | 9005 | protected function getLocalizedTemplate($filename) |
| 8465 | 9006 | { |
| 8466 | 9007 | if(($app=$this->getApplication()->getGlobalization(false))===null) |
@@ -8626,12 +9167,20 @@ discard block |
||
| 8626 | 9167 | $parentControl->addParsedObject($control); |
| 8627 | 9168 | } |
| 8628 | 9169 | } |
| 9170 | + |
|
| 9171 | + /** |
|
| 9172 | + * @param TControl $control |
|
| 9173 | + */ |
|
| 8629 | 9174 | protected function configureControl($control,$name,$value) |
| 8630 | 9175 | { |
| 8631 | 9176 | if(strncasecmp($name,'on',2)===0) $this->configureEvent($control,$name,$value,$control); |
| 8632 | 9177 | else if(($pos=strrpos($name,'.'))===false) $this->configureProperty($control,$name,$value); |
| 8633 | 9178 | else $this->configureSubProperty($control,$name,$value); |
| 8634 | 9179 | } |
| 9180 | + |
|
| 9181 | + /** |
|
| 9182 | + * @param TComponent $component |
|
| 9183 | + */ |
|
| 8635 | 9184 | protected function configureComponent($component,$name,$value) |
| 8636 | 9185 | { |
| 8637 | 9186 | if(strpos($name,'.')===false) $this->configureProperty($component,$name,$value); |
@@ -8941,6 +9490,11 @@ discard block |
||
| 8941 | 9490 | $tpl=$objects; |
| 8942 | 9491 | return $objects; |
| 8943 | 9492 | } |
| 9493 | + |
|
| 9494 | + /** |
|
| 9495 | + * @param string $str |
|
| 9496 | + * @param string $offset |
|
| 9497 | + */ |
|
| 8944 | 9498 | protected function parseAttributes($str,$offset) |
| 8945 | 9499 | { |
| 8946 | 9500 | if($str==='') |
@@ -8972,11 +9526,19 @@ discard block |
||
| 8972 | 9526 | } |
| 8973 | 9527 | return $attributes; |
| 8974 | 9528 | } |
| 9529 | + |
|
| 9530 | + /** |
|
| 9531 | + * @param string $content |
|
| 9532 | + */ |
|
| 8975 | 9533 | protected function parseTemplateProperty($content,$offset) |
| 8976 | 9534 | { |
| 8977 | 9535 | $line=$this->_startingLine+count(explode("\n",substr($this->_content,0,$offset)))-1; |
| 8978 | 9536 | return array(self::CONFIG_TEMPLATE,new TTemplate($content,$this->_contextPath,$this->_tplFile,$line,false)); |
| 8979 | 9537 | } |
| 9538 | + |
|
| 9539 | + /** |
|
| 9540 | + * @param string $value |
|
| 9541 | + */ |
|
| 8980 | 9542 | protected function parseAttribute($value) |
| 8981 | 9543 | { |
| 8982 | 9544 | if(($n=preg_match_all('/<%[#=].*?%>/msS',$value,$matches,PREG_OFFSET_CAPTURE))>0) |
@@ -9099,6 +9661,11 @@ discard block |
||
| 9099 | 9661 | { |
| 9100 | 9662 | return $this->_includedFiles; |
| 9101 | 9663 | } |
| 9664 | + |
|
| 9665 | + /** |
|
| 9666 | + * @param Exception $e |
|
| 9667 | + * @param integer $line |
|
| 9668 | + */ |
|
| 9102 | 9669 | protected function handleException($e,$line,$input=null) |
| 9103 | 9670 | { |
| 9104 | 9671 | $srcFile=$this->_tplFile; |
@@ -9155,6 +9722,10 @@ discard block |
||
| 9155 | 9722 | } |
| 9156 | 9723 | return $input; |
| 9157 | 9724 | } |
| 9725 | + |
|
| 9726 | + /** |
|
| 9727 | + * @param string $method |
|
| 9728 | + */ |
|
| 9158 | 9729 | protected function isClassBehaviorMethod(ReflectionClass $class,$method) |
| 9159 | 9730 | { |
| 9160 | 9731 | $component=new ReflectionClass('TComponent'); |
@@ -9237,6 +9808,10 @@ discard block |
||
| 9237 | 9808 | throw new TInvalidDataValueException('thememanager_basepath_invalid',$value); |
| 9238 | 9809 | } |
| 9239 | 9810 | } |
| 9811 | + |
|
| 9812 | + /** |
|
| 9813 | + * @return string |
|
| 9814 | + */ |
|
| 9240 | 9815 | public function getBaseUrl() |
| 9241 | 9816 | { |
| 9242 | 9817 | if($this->_baseUrl===null) |
@@ -9635,6 +10210,10 @@ discard block |
||
| 9635 | 10210 | { |
| 9636 | 10211 | return $this->_defaultPage; |
| 9637 | 10212 | } |
| 10213 | + |
|
| 10214 | + /** |
|
| 10215 | + * @param string $value |
|
| 10216 | + */ |
|
| 9638 | 10217 | public function setDefaultPage($value) |
| 9639 | 10218 | { |
| 9640 | 10219 | if($this->_initialized) |
@@ -9723,6 +10302,10 @@ discard block |
||
| 9723 | 10302 | $page->setSubProperty($name,$value); |
| 9724 | 10303 | $page->run($this->getResponse()->createHtmlWriter()); |
| 9725 | 10304 | } |
| 10305 | + |
|
| 10306 | + /** |
|
| 10307 | + * @param string $pagePath |
|
| 10308 | + */ |
|
| 9726 | 10309 | public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true) |
| 9727 | 10310 | { |
| 9728 | 10311 | return $this->getRequest()->constructUrl($this->getID(),$pagePath,$getParams,$encodeAmpersand,$encodeGetItems); |
@@ -9794,11 +10377,20 @@ discard block |
||
| 9794 | 10377 | throw new TConfigurationException('pageserviceconf_file_invalid',$fname); |
| 9795 | 10378 | } |
| 9796 | 10379 | } |
| 10380 | + |
|
| 10381 | + /** |
|
| 10382 | + * @param string $configPath |
|
| 10383 | + */ |
|
| 9797 | 10384 | public function loadFromPhp($config,$configPath,$configPagePath) |
| 9798 | 10385 | { |
| 9799 | 10386 | $this->loadApplicationConfigurationFromPhp($config,$configPath); |
| 9800 | 10387 | $this->loadPageConfigurationFromPhp($config,$configPath,$configPagePath); |
| 9801 | 10388 | } |
| 10389 | + |
|
| 10390 | + /** |
|
| 10391 | + * @param TXmlDocument $dom |
|
| 10392 | + * @param string $configPath |
|
| 10393 | + */ |
|
| 9802 | 10394 | public function loadFromXml($dom,$configPath,$configPagePath) |
| 9803 | 10395 | { |
| 9804 | 10396 | $this->loadApplicationConfigurationFromXml($dom,$configPath); |
@@ -10055,6 +10647,10 @@ discard block |
||
| 10055 | 10647 | else |
| 10056 | 10648 | return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash($path); |
| 10057 | 10649 | } |
| 10650 | + |
|
| 10651 | + /** |
|
| 10652 | + * @param string $path |
|
| 10653 | + */ |
|
| 10058 | 10654 | public function getPublishedUrl($path) |
| 10059 | 10655 | { |
| 10060 | 10656 | $path=realpath($path); |
@@ -10063,10 +10659,19 @@ discard block |
||
| 10063 | 10659 | else |
| 10064 | 10660 | return $this->_baseUrl.'/'.$this->hash($path); |
| 10065 | 10661 | } |
| 10662 | + |
|
| 10663 | + /** |
|
| 10664 | + * @param string $dir |
|
| 10665 | + */ |
|
| 10066 | 10666 | protected function hash($dir) |
| 10067 | 10667 | { |
| 10068 | 10668 | return sprintf('%x',crc32($dir.Prado::getVersion())); |
| 10069 | 10669 | } |
| 10670 | + |
|
| 10671 | + /** |
|
| 10672 | + * @param string $src |
|
| 10673 | + * @param string $dst |
|
| 10674 | + */ |
|
| 10070 | 10675 | protected function copyFile($src,$dst) |
| 10071 | 10676 | { |
| 10072 | 10677 | if(!is_dir($dst)) |
@@ -10080,6 +10685,11 @@ discard block |
||
| 10080 | 10685 | @copy($src,$dstFile); |
| 10081 | 10686 | } |
| 10082 | 10687 | } |
| 10688 | + |
|
| 10689 | + /** |
|
| 10690 | + * @param string $src |
|
| 10691 | + * @param string $dst |
|
| 10692 | + */ |
|
| 10083 | 10693 | public function copyDirectory($src,$dst) |
| 10084 | 10694 | { |
| 10085 | 10695 | if(!is_dir($dst)) |
@@ -10109,6 +10719,11 @@ discard block |
||
| 10109 | 10719 | throw new TInvalidDataValueException('assetmanager_source_directory_invalid', $src); |
| 10110 | 10720 | } |
| 10111 | 10721 | } |
| 10722 | + |
|
| 10723 | + /** |
|
| 10724 | + * @param string $tarfile |
|
| 10725 | + * @param string $md5sum |
|
| 10726 | + */ |
|
| 10112 | 10727 | public function publishTarFile($tarfile, $md5sum, $checkTimestamp=false) |
| 10113 | 10728 | { |
| 10114 | 10729 | if(isset($this->_published[$md5sum])) |
@@ -10131,6 +10746,10 @@ discard block |
||
| 10131 | 10746 | return $this->_published[$md5sum]=$this->_baseUrl.'/'.$dir; |
| 10132 | 10747 | } |
| 10133 | 10748 | } |
| 10749 | + |
|
| 10750 | + /** |
|
| 10751 | + * @param string $destination |
|
| 10752 | + */ |
|
| 10134 | 10753 | protected function deployTarFile($path,$destination) |
| 10135 | 10754 | { |
| 10136 | 10755 | if(($fullpath=realpath($path))===false || !is_file($fullpath)) |
@@ -10352,6 +10971,10 @@ discard block |
||
| 10352 | 10971 | $this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null)); |
| 10353 | 10972 | Prado::setPathOfAlias('Application',$this->_basePath); |
| 10354 | 10973 | } |
| 10974 | + |
|
| 10975 | + /** |
|
| 10976 | + * @param string $basePath |
|
| 10977 | + */ |
|
| 10355 | 10978 | protected function resolvePaths($basePath) |
| 10356 | 10979 | { |
| 10357 | 10980 | if(empty($basePath) || ($basePath=realpath($basePath))===false) |
@@ -10417,10 +11040,18 @@ discard block |
||
| 10417 | 11040 | { |
| 10418 | 11041 | return $this->_requestCompleted; |
| 10419 | 11042 | } |
| 11043 | + |
|
| 11044 | + /** |
|
| 11045 | + * @param integer $defaultValue |
|
| 11046 | + */ |
|
| 10420 | 11047 | public function getGlobalState($key,$defaultValue=null) |
| 10421 | 11048 | { |
| 10422 | 11049 | return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue; |
| 10423 | 11050 | } |
| 11051 | + |
|
| 11052 | + /** |
|
| 11053 | + * @param string $key |
|
| 11054 | + */ |
|
| 10424 | 11055 | public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false) |
| 10425 | 11056 | { |
| 10426 | 11057 | $this->_stateChanged=true; |
@@ -10480,6 +11111,10 @@ discard block |
||
| 10480 | 11111 | { |
| 10481 | 11112 | return $this->_basePath; |
| 10482 | 11113 | } |
| 11114 | + |
|
| 11115 | + /** |
|
| 11116 | + * @param string $value |
|
| 11117 | + */ |
|
| 10483 | 11118 | public function setBasePath($value) |
| 10484 | 11119 | { |
| 10485 | 11120 | $this->_basePath=$value; |
@@ -10488,6 +11123,10 @@ discard block |
||
| 10488 | 11123 | { |
| 10489 | 11124 | return $this->_configFile; |
| 10490 | 11125 | } |
| 11126 | + |
|
| 11127 | + /** |
|
| 11128 | + * @param string $value |
|
| 11129 | + */ |
|
| 10491 | 11130 | public function setConfigurationFile($value) |
| 10492 | 11131 | { |
| 10493 | 11132 | $this->_configFile=$value; |
@@ -10496,6 +11135,10 @@ discard block |
||
| 10496 | 11135 | { |
| 10497 | 11136 | return $this->_configType; |
| 10498 | 11137 | } |
| 11138 | + |
|
| 11139 | + /** |
|
| 11140 | + * @param string $value |
|
| 11141 | + */ |
|
| 10499 | 11142 | public function setConfigurationType($value) |
| 10500 | 11143 | { |
| 10501 | 11144 | $this->_configType = $value; |
@@ -10535,6 +11178,10 @@ discard block |
||
| 10535 | 11178 | { |
| 10536 | 11179 | return $this->_runtimePath; |
| 10537 | 11180 | } |
| 11181 | + |
|
| 11182 | + /** |
|
| 11183 | + * @param string $value |
|
| 11184 | + */ |
|
| 10538 | 11185 | public function setRuntimePath($value) |
| 10539 | 11186 | { |
| 10540 | 11187 | $this->_runtimePath=$value; |
@@ -10546,6 +11193,10 @@ discard block |
||
| 10546 | 11193 | { |
| 10547 | 11194 | return $this->_service; |
| 10548 | 11195 | } |
| 11196 | + |
|
| 11197 | + /** |
|
| 11198 | + * @param IService $value |
|
| 11199 | + */ |
|
| 10549 | 11200 | public function setService($value) |
| 10550 | 11201 | { |
| 10551 | 11202 | $this->_service=$value; |
@@ -10826,6 +11477,10 @@ discard block |
||
| 10826 | 11477 | else |
| 10827 | 11478 | throw new THttpException(500,'application_service_unknown',$serviceID); |
| 10828 | 11479 | } |
| 11480 | + |
|
| 11481 | + /** |
|
| 11482 | + * @param Exception $param |
|
| 11483 | + */ |
|
| 10829 | 11484 | public function onError($param) |
| 10830 | 11485 | { |
| 10831 | 11486 | Prado::log($param->getMessage(),TLogger::ERROR,'System.TApplication'); |
@@ -46,8 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $am=self::$_application->getAssetManager(); |
| 48 | 48 | $url=$am->publishFilePath(self::getPathOfNamespace('System.'.$logoName,'.gif')); |
| 49 | - } |
|
| 50 | - else |
|
| 49 | + } else |
|
| 51 | 50 | $url='http://pradosoft.github.io/docs/'.$logoName.'.gif'; |
| 52 | 51 | return '<a title="Powered by PRADO" href="https://github.com/pradosoft/prado" target="_blank"><img src="'.$url.'" style="border-width:0px;" alt="Powered by PRADO" /></a>'; |
| 53 | 52 | } |
@@ -71,8 +70,7 @@ discard block |
||
| 71 | 70 | if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null) |
| 72 | 71 | { |
| 73 | 72 | $errorHandler->handleError(null,$exception); |
| 74 | - } |
|
| 75 | - else |
|
| 73 | + } else |
|
| 76 | 74 | { |
| 77 | 75 | echo $exception; |
| 78 | 76 | } |
@@ -120,14 +118,14 @@ discard block |
||
| 120 | 118 | break; |
| 121 | 119 | default: |
| 122 | 120 | $s='$args[1]'; |
| 123 | - for($i=2;$i<$n;++$i) |
|
| 124 | - $s.=",\$args[$i]"; |
|
| 121 | + for($i=2;$i<$n;++$i) { |
|
| 122 | + $s.=",\$args[$i]"; |
|
| 123 | + } |
|
| 125 | 124 | eval("\$component=new $type($s);"); |
| 126 | 125 | return $component; |
| 127 | 126 | break; |
| 128 | 127 | } |
| 129 | - } |
|
| 130 | - else |
|
| 128 | + } else |
|
| 131 | 129 | return new $type; |
| 132 | 130 | } |
| 133 | 131 | public static function using($namespace,$checkClassExistence=true) |
@@ -138,31 +136,27 @@ discard block |
||
| 138 | 136 | try |
| 139 | 137 | { |
| 140 | 138 | include_once($namespace.self::CLASS_FILE_EXT); |
| 141 | - } |
|
| 142 | - catch(Exception $e) |
|
| 139 | + } catch(Exception $e) |
|
| 143 | 140 | { |
| 144 | 141 | if($checkClassExistence && !class_exists($namespace,false)) |
| 145 | 142 | throw new TInvalidOperationException('prado_component_unknown',$namespace,$e->getMessage()); |
| 146 | 143 | else |
| 147 | 144 | throw $e; |
| 148 | 145 | } |
| 149 | - } |
|
| 150 | - else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null) |
|
| 146 | + } else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null) |
|
| 151 | 147 | { |
| 152 | 148 | $className=substr($namespace,$pos+1); |
| 153 | 149 | if($className==='*') { |
| 154 | 150 | self::$_usings[$namespace]=$path; |
| 155 | 151 | set_include_path(get_include_path().PATH_SEPARATOR.$path); |
| 156 | - } |
|
| 157 | - else { |
|
| 152 | + } else { |
|
| 158 | 153 | self::$_usings[$namespace]=$path; |
| 159 | 154 | if(!$checkClassExistence || !class_exists($className,false)) |
| 160 | 155 | { |
| 161 | 156 | try |
| 162 | 157 | { |
| 163 | 158 | include_once($path); |
| 164 | - } |
|
| 165 | - catch(Exception $e) |
|
| 159 | + } catch(Exception $e) |
|
| 166 | 160 | { |
| 167 | 161 | if($checkClassExistence && !class_exists($className,false)) |
| 168 | 162 | throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage()); |
@@ -171,8 +165,7 @@ discard block |
||
| 171 | 165 | } |
| 172 | 166 | } |
| 173 | 167 | } |
| 174 | - } |
|
| 175 | - else |
|
| 168 | + } else |
|
| 176 | 169 | throw new TInvalidDataValueException('prado_using_invalid',$namespace); |
| 177 | 170 | } |
| 178 | 171 | public static function getPathOfNamespace($namespace, $ext='') |
@@ -208,8 +201,7 @@ discard block |
||
| 208 | 201 | self::$_aliases[$alias]=$rp; |
| 209 | 202 | else |
| 210 | 203 | throw new TInvalidDataValueException('prado_aliasname_invalid',$alias); |
| 211 | - } |
|
| 212 | - else |
|
| 204 | + } else |
|
| 213 | 205 | throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path); |
| 214 | 206 | } |
| 215 | 207 | public static function fatalError($msg) |
@@ -246,8 +238,7 @@ discard block |
||
| 246 | 238 | echo "'". substr($str, 0, 70) . "...'"; |
| 247 | 239 | else |
| 248 | 240 | echo "'" . $str . "'"; |
| 249 | - } |
|
| 250 | - else if (is_int($item) || is_float($item)) |
|
| 241 | + } else if (is_int($item) || is_float($item)) |
|
| 251 | 242 | echo $item; |
| 252 | 243 | else if (is_object($item)) |
| 253 | 244 | echo get_class($item); |
@@ -316,8 +307,7 @@ discard block |
||
| 316 | 307 | if(isset($trace[0]['file']) && isset($trace[0]['line'])) |
| 317 | 308 | $msg.=" (line {$trace[0]['line']}, {$trace[0]['file']})"; |
| 318 | 309 | $level=TLogger::DEBUG; |
| 319 | - } |
|
| 320 | - else |
|
| 310 | + } else |
|
| 321 | 311 | $level=TLogger::INFO; |
| 322 | 312 | self::log($msg,$level,$category,$ctl); |
| 323 | 313 | } |
@@ -343,8 +333,9 @@ discard block |
||
| 343 | 333 | Prado::using('System.I18N.Translation'); |
| 344 | 334 | $app = Prado::getApplication()->getGlobalization(false); |
| 345 | 335 | $params = array(); |
| 346 | - foreach($parameters as $key => $value) |
|
| 347 | - $params['{'.$key.'}'] = $value; |
|
| 336 | + foreach($parameters as $key => $value) { |
|
| 337 | + $params['{'.$key.'}'] = $value; |
|
| 338 | + } |
|
| 348 | 339 | if($app===null || ($config = $app->getTranslationConfiguration())===null) |
| 349 | 340 | return strtr($text, $params); |
| 350 | 341 | if ($catalogue===null) |
@@ -622,8 +613,7 @@ discard block |
||
| 622 | 613 | echo "<body><h1>Recursive Error</h1>\n"; |
| 623 | 614 | echo "<pre>".$exception->__toString()."</pre>\n"; |
| 624 | 615 | echo "</body></html>"; |
| 625 | - } |
|
| 626 | - else |
|
| 616 | + } else |
|
| 627 | 617 | { |
| 628 | 618 | error_log("Error happened while processing an existing error:\n".$exception->__toString()); |
| 629 | 619 | header('HTTP/1.0 500 Internal Error'); |
@@ -645,15 +635,13 @@ discard block |
||
| 645 | 635 | if($fileName==='') |
| 646 | 636 | $fileName='---embedded template---'; |
| 647 | 637 | $errorLine=$exception->getLineNumber(); |
| 648 | - } |
|
| 649 | - else |
|
| 638 | + } else |
|
| 650 | 639 | { |
| 651 | 640 | if(($trace=$this->getExactTrace($exception))!==null) |
| 652 | 641 | { |
| 653 | 642 | $fileName=$trace['file']; |
| 654 | 643 | $errorLine=$trace['line']; |
| 655 | - } |
|
| 656 | - else |
|
| 644 | + } else |
|
| 657 | 645 | { |
| 658 | 646 | $fileName=$exception->getFile(); |
| 659 | 647 | $errorLine=$exception->getLine(); |
@@ -712,8 +700,7 @@ discard block |
||
| 712 | 700 | $result=$trace[0]; |
| 713 | 701 | elseif(isset($trace[1])) |
| 714 | 702 | $result=$trace[1]; |
| 715 | - } |
|
| 716 | - else if($exception instanceof TInvalidOperationException) |
|
| 703 | + } else if($exception instanceof TInvalidOperationException) |
|
| 717 | 704 | { |
| 718 | 705 | if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null) |
| 719 | 706 | $result=$this->getPropertyAccessTrace($trace,'__set'); |
@@ -745,8 +732,7 @@ discard block |
||
| 745 | 732 | { |
| 746 | 733 | $line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",' ',$lines[$i]))); |
| 747 | 734 | $source.="<div class=\"error\">".$line."</div>"; |
| 748 | - } |
|
| 749 | - else |
|
| 735 | + } else |
|
| 750 | 736 | $source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",' ',$lines[$i]))); |
| 751 | 737 | } |
| 752 | 738 | return $source; |
@@ -810,11 +796,9 @@ discard block |
||
| 810 | 796 | { |
| 811 | 797 | array_splice($this->_d,$index,0,array($item)); |
| 812 | 798 | $this->_c++; |
| 813 | - } |
|
| 814 | - else |
|
| 799 | + } else |
|
| 815 | 800 | throw new TInvalidDataValueException('list_index_invalid',$index); |
| 816 | - } |
|
| 817 | - else |
|
| 801 | + } else |
|
| 818 | 802 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 819 | 803 | } |
| 820 | 804 | public function remove($item) |
@@ -825,11 +809,9 @@ discard block |
||
| 825 | 809 | { |
| 826 | 810 | $this->removeAt($index); |
| 827 | 811 | return $index; |
| 828 | - } |
|
| 829 | - else |
|
| 812 | + } else |
|
| 830 | 813 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 831 | - } |
|
| 832 | - else |
|
| 814 | + } else |
|
| 833 | 815 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 834 | 816 | } |
| 835 | 817 | public function removeAt($index) |
@@ -847,17 +829,16 @@ discard block |
||
| 847 | 829 | array_splice($this->_d,$index,1); |
| 848 | 830 | return $item; |
| 849 | 831 | } |
| 850 | - } |
|
| 851 | - else |
|
| 832 | + } else |
|
| 852 | 833 | throw new TInvalidDataValueException('list_index_invalid',$index); |
| 853 | - } |
|
| 854 | - else |
|
| 834 | + } else |
|
| 855 | 835 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 856 | 836 | } |
| 857 | 837 | public function clear() |
| 858 | 838 | { |
| 859 | - for($i=$this->_c-1;$i>=0;--$i) |
|
| 860 | - $this->removeAt($i); |
|
| 839 | + for($i=$this->_c-1;$i>=0;--$i) { |
|
| 840 | + $this->removeAt($i); |
|
| 841 | + } |
|
| 861 | 842 | } |
| 862 | 843 | public function contains($item) |
| 863 | 844 | { |
@@ -878,8 +859,7 @@ discard block |
||
| 878 | 859 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 879 | 860 | $this->insertAt($index, $item); |
| 880 | 861 | return $index; |
| 881 | - } |
|
| 882 | - else |
|
| 862 | + } else |
|
| 883 | 863 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 884 | 864 | } |
| 885 | 865 | public function insertAfter($baseitem, $item) |
@@ -890,8 +870,7 @@ discard block |
||
| 890 | 870 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 891 | 871 | $this->insertAt($index + 1, $item); |
| 892 | 872 | return $index + 1; |
| 893 | - } |
|
| 894 | - else |
|
| 873 | + } else |
|
| 895 | 874 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 896 | 875 | } |
| 897 | 876 | public function toArray() |
@@ -904,20 +883,20 @@ discard block |
||
| 904 | 883 | { |
| 905 | 884 | if($this->_c>0) |
| 906 | 885 | $this->clear(); |
| 907 | - foreach($data as $item) |
|
| 908 | - $this->add($item); |
|
| 909 | - } |
|
| 910 | - else if($data!==null) |
|
| 886 | + foreach($data as $item) { |
|
| 887 | + $this->add($item); |
|
| 888 | + } |
|
| 889 | + } else if($data!==null) |
|
| 911 | 890 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
| 912 | 891 | } |
| 913 | 892 | public function mergeWith($data) |
| 914 | 893 | { |
| 915 | 894 | if(is_array($data) || ($data instanceof Traversable)) |
| 916 | 895 | { |
| 917 | - foreach($data as $item) |
|
| 918 | - $this->add($item); |
|
| 919 | - } |
|
| 920 | - else if($data!==null) |
|
| 896 | + foreach($data as $item) { |
|
| 897 | + $this->add($item); |
|
| 898 | + } |
|
| 899 | + } else if($data!==null) |
|
| 921 | 900 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
| 922 | 901 | } |
| 923 | 902 | public function offsetExists($offset) |
@@ -1131,8 +1110,7 @@ discard block |
||
| 1131 | 1110 | { |
| 1132 | 1111 | if(($this->_recursiveLevel<0 || $level<$this->_recursiveLevel) && $this->validateDirectory($path)) |
| 1133 | 1112 | $timestamps=array_merge($this->generateTimestamps($path,$level+1)); |
| 1134 | - } |
|
| 1135 | - else if($this->validateFile($path)) |
|
| 1113 | + } else if($this->validateFile($path)) |
|
| 1136 | 1114 | $timestamps[$path]=filemtime($path); |
| 1137 | 1115 | } |
| 1138 | 1116 | closedir($dir); |
@@ -1174,9 +1152,10 @@ discard block |
||
| 1174 | 1152 | { |
| 1175 | 1153 | if($this->_dependencies!==null) |
| 1176 | 1154 | { |
| 1177 | - foreach($this->_dependencies as $dependency) |
|
| 1178 | - if($dependency->getHasChanged()) |
|
| 1155 | + foreach($this->_dependencies as $dependency) { |
|
| 1156 | + if($dependency->getHasChanged()) |
|
| 1179 | 1157 | return true; |
| 1158 | + } |
|
| 1180 | 1159 | } |
| 1181 | 1160 | return false; |
| 1182 | 1161 | } |
@@ -1286,8 +1265,9 @@ discard block |
||
| 1286 | 1265 | return $this->_fd; |
| 1287 | 1266 | $this->sortPriorities(); |
| 1288 | 1267 | $this->_fd=array(); |
| 1289 | - foreach($this->_d as $priority => $itemsatpriority) |
|
| 1290 | - $this->_fd=array_merge($this->_fd,$itemsatpriority); |
|
| 1268 | + foreach($this->_d as $priority => $itemsatpriority) { |
|
| 1269 | + $this->_fd=array_merge($this->_fd,$itemsatpriority); |
|
| 1270 | + } |
|
| 1291 | 1271 | return $this->_fd; |
| 1292 | 1272 | } |
| 1293 | 1273 | public function itemAt($index) |
@@ -1339,9 +1319,10 @@ discard block |
||
| 1339 | 1319 | if($preserveCache) { |
| 1340 | 1320 | $this->sortPriorities(); |
| 1341 | 1321 | $cc=0; |
| 1342 | - foreach($this->_d as $prioritykey=>$items) |
|
| 1343 | - if($prioritykey>=$priority) |
|
| 1322 | + foreach($this->_d as $prioritykey=>$items) { |
|
| 1323 | + if($prioritykey>=$priority) |
|
| 1344 | 1324 | break; |
| 1325 | + } |
|
| 1345 | 1326 | else |
| 1346 | 1327 | $cc+=count($items); |
| 1347 | 1328 | if($index===false&&isset($this->_d[$priority])) { |
@@ -1393,8 +1374,7 @@ discard block |
||
| 1393 | 1374 | } |
| 1394 | 1375 | $this->removeAtIndexInPriority($p[1],$p[0]); |
| 1395 | 1376 | return $p[2]; |
| 1396 | - } |
|
| 1397 | - else |
|
| 1377 | + } else |
|
| 1398 | 1378 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 1399 | 1379 | } |
| 1400 | 1380 | public function removeAt($index) |
@@ -1428,8 +1408,9 @@ discard block |
||
| 1428 | 1408 | throw new TInvalidOperationException('list_readonly',get_class($this)); |
| 1429 | 1409 | $d=array_reverse($this->_d,true); |
| 1430 | 1410 | foreach($this->_d as $priority=>$items) { |
| 1431 | - for($index=count($items)-1;$index>=0;$index--) |
|
| 1432 | - $this->removeAtIndexInPriority($index,$priority); |
|
| 1411 | + for($index=count($items)-1;$index>=0;$index--) { |
|
| 1412 | + $this->removeAtIndexInPriority($index,$priority); |
|
| 1413 | + } |
|
| 1433 | 1414 | unset($this->_d[$priority]); |
| 1434 | 1415 | } |
| 1435 | 1416 | } |
@@ -1532,14 +1513,16 @@ discard block |
||
| 1532 | 1513 | $this->clear(); |
| 1533 | 1514 | foreach($data->getPriorities() as $priority) |
| 1534 | 1515 | { |
| 1535 | - foreach($data->itemsAtPriority($priority) as $index=>$item) |
|
| 1536 | - $this->insertAtIndexInPriority($item,$index,$priority); |
|
| 1516 | + foreach($data->itemsAtPriority($priority) as $index=>$item) { |
|
| 1517 | + $this->insertAtIndexInPriority($item,$index,$priority); |
|
| 1518 | + } |
|
| 1537 | 1519 | } |
| 1538 | 1520 | } else if(is_array($data)||$data instanceof Traversable) { |
| 1539 | 1521 | if($this->getCount()>0) |
| 1540 | 1522 | $this->clear(); |
| 1541 | - foreach($data as $key=>$item) |
|
| 1542 | - $this->add($item); |
|
| 1523 | + foreach($data as $key=>$item) { |
|
| 1524 | + $this->add($item); |
|
| 1525 | + } |
|
| 1543 | 1526 | } else if($data!==null) |
| 1544 | 1527 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1545 | 1528 | } |
@@ -1549,16 +1532,16 @@ discard block |
||
| 1549 | 1532 | { |
| 1550 | 1533 | foreach($data->getPriorities() as $priority) |
| 1551 | 1534 | { |
| 1552 | - foreach($data->itemsAtPriority($priority) as $index=>$item) |
|
| 1553 | - $this->insertAtIndexInPriority($item,false,$priority); |
|
| 1535 | + foreach($data->itemsAtPriority($priority) as $index=>$item) { |
|
| 1536 | + $this->insertAtIndexInPriority($item,false,$priority); |
|
| 1537 | + } |
|
| 1554 | 1538 | } |
| 1555 | - } |
|
| 1556 | - else if(is_array($data)||$data instanceof Traversable) |
|
| 1539 | + } else if(is_array($data)||$data instanceof Traversable) |
|
| 1557 | 1540 | { |
| 1558 | - foreach($data as $priority=>$item) |
|
| 1559 | - $this->add($item); |
|
| 1560 | - } |
|
| 1561 | - else if($data!==null) |
|
| 1541 | + foreach($data as $priority=>$item) { |
|
| 1542 | + $this->add($item); |
|
| 1543 | + } |
|
| 1544 | + } else if($data!==null) |
|
| 1562 | 1545 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1563 | 1546 | } |
| 1564 | 1547 | public function offsetExists($offset) |
@@ -1649,17 +1632,16 @@ discard block |
||
| 1649 | 1632 | $value=$this->_d[$key]; |
| 1650 | 1633 | unset($this->_d[$key]); |
| 1651 | 1634 | return $value; |
| 1652 | - } |
|
| 1653 | - else |
|
| 1635 | + } else |
|
| 1654 | 1636 | return null; |
| 1655 | - } |
|
| 1656 | - else |
|
| 1637 | + } else |
|
| 1657 | 1638 | throw new TInvalidOperationException('map_readonly',get_class($this)); |
| 1658 | 1639 | } |
| 1659 | 1640 | public function clear() |
| 1660 | 1641 | { |
| 1661 | - foreach(array_keys($this->_d) as $key) |
|
| 1662 | - $this->remove($key); |
|
| 1642 | + foreach(array_keys($this->_d) as $key) { |
|
| 1643 | + $this->remove($key); |
|
| 1644 | + } |
|
| 1663 | 1645 | } |
| 1664 | 1646 | public function contains($key) |
| 1665 | 1647 | { |
@@ -1675,20 +1657,20 @@ discard block |
||
| 1675 | 1657 | { |
| 1676 | 1658 | if($this->getCount()>0) |
| 1677 | 1659 | $this->clear(); |
| 1678 | - foreach($data as $key=>$value) |
|
| 1679 | - $this->add($key,$value); |
|
| 1680 | - } |
|
| 1681 | - else if($data!==null) |
|
| 1660 | + foreach($data as $key=>$value) { |
|
| 1661 | + $this->add($key,$value); |
|
| 1662 | + } |
|
| 1663 | + } else if($data!==null) |
|
| 1682 | 1664 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1683 | 1665 | } |
| 1684 | 1666 | public function mergeWith($data) |
| 1685 | 1667 | { |
| 1686 | 1668 | if(is_array($data) || $data instanceof Traversable) |
| 1687 | 1669 | { |
| 1688 | - foreach($data as $key=>$value) |
|
| 1689 | - $this->add($key,$value); |
|
| 1690 | - } |
|
| 1691 | - else if($data!==null) |
|
| 1670 | + foreach($data as $key=>$value) { |
|
| 1671 | + $this->add($key,$value); |
|
| 1672 | + } |
|
| 1673 | + } else if($data!==null) |
|
| 1692 | 1674 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1693 | 1675 | } |
| 1694 | 1676 | public function offsetExists($offset) |
@@ -1767,8 +1749,9 @@ discard block |
||
| 1767 | 1749 | return $this->_fd; |
| 1768 | 1750 | $this->sortPriorities(); |
| 1769 | 1751 | $this->_fd = array(); |
| 1770 | - foreach($this->_d as $priority => $itemsatpriority) |
|
| 1771 | - $this->_fd = array_merge($this->_fd, $itemsatpriority); |
|
| 1752 | + foreach($this->_d as $priority => $itemsatpriority) { |
|
| 1753 | + $this->_fd = array_merge($this->_fd, $itemsatpriority); |
|
| 1754 | + } |
|
| 1772 | 1755 | return $this->_fd; |
| 1773 | 1756 | } |
| 1774 | 1757 | public function count() |
@@ -1831,17 +1814,19 @@ discard block |
||
| 1831 | 1814 | public function priorityOf($item) |
| 1832 | 1815 | { |
| 1833 | 1816 | $this->sortPriorities(); |
| 1834 | - foreach($this->_d as $priority=>$items) |
|
| 1835 | - if(($index=array_search($item,$items,true))!==false) |
|
| 1817 | + foreach($this->_d as $priority=>$items) { |
|
| 1818 | + if(($index=array_search($item,$items,true))!==false) |
|
| 1836 | 1819 | return $priority; |
| 1820 | + } |
|
| 1837 | 1821 | return false; |
| 1838 | 1822 | } |
| 1839 | 1823 | public function priorityAt($key) |
| 1840 | 1824 | { |
| 1841 | 1825 | $this->sortPriorities(); |
| 1842 | - foreach($this->_d as $priority=>$items) |
|
| 1843 | - if(array_key_exists($key,$items)) |
|
| 1826 | + foreach($this->_d as $priority=>$items) { |
|
| 1827 | + if(array_key_exists($key,$items)) |
|
| 1844 | 1828 | return $priority; |
| 1829 | + } |
|
| 1845 | 1830 | return false; |
| 1846 | 1831 | } |
| 1847 | 1832 | public function add($key,$value,$priority=null) |
@@ -1851,10 +1836,11 @@ discard block |
||
| 1851 | 1836 | $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); |
| 1852 | 1837 | if(!$this->_r) |
| 1853 | 1838 | { |
| 1854 | - foreach($this->_d as $innerpriority=>$items) |
|
| 1855 | - if(array_key_exists($key,$items)) |
|
| 1839 | + foreach($this->_d as $innerpriority=>$items) { |
|
| 1840 | + if(array_key_exists($key,$items)) |
|
| 1856 | 1841 | { |
| 1857 | 1842 | unset($this->_d[$innerpriority][$key]); |
| 1843 | + } |
|
| 1858 | 1844 | $this->_c--; |
| 1859 | 1845 | if(count($this->_d[$innerpriority])===0) |
| 1860 | 1846 | unset($this->_d[$innerpriority]); |
@@ -1862,13 +1848,11 @@ discard block |
||
| 1862 | 1848 | if(!isset($this->_d[$priority])) { |
| 1863 | 1849 | $this->_d[$priority]=array($key=>$value); |
| 1864 | 1850 | $this->_o=false; |
| 1865 | - } |
|
| 1866 | - else |
|
| 1851 | + } else |
|
| 1867 | 1852 | $this->_d[$priority][$key]=$value; |
| 1868 | 1853 | $this->_c++; |
| 1869 | 1854 | $this->_fd=null; |
| 1870 | - } |
|
| 1871 | - else |
|
| 1855 | + } else |
|
| 1872 | 1856 | throw new TInvalidOperationException('map_readonly',get_class($this)); |
| 1873 | 1857 | return $priority; |
| 1874 | 1858 | } |
@@ -1881,10 +1865,11 @@ discard block |
||
| 1881 | 1865 | if($priority===false) |
| 1882 | 1866 | { |
| 1883 | 1867 | $this->sortPriorities(); |
| 1884 | - foreach($this->_d as $priority=>$items) |
|
| 1885 | - if(array_key_exists($key,$items)) |
|
| 1868 | + foreach($this->_d as $priority=>$items) { |
|
| 1869 | + if(array_key_exists($key,$items)) |
|
| 1886 | 1870 | { |
| 1887 | 1871 | $value=$this->_d[$priority][$key]; |
| 1872 | + } |
|
| 1888 | 1873 | unset($this->_d[$priority][$key]); |
| 1889 | 1874 | $this->_c--; |
| 1890 | 1875 | if(count($this->_d[$priority])===0) |
@@ -1896,8 +1881,7 @@ discard block |
||
| 1896 | 1881 | return $value; |
| 1897 | 1882 | } |
| 1898 | 1883 | return null; |
| 1899 | - } |
|
| 1900 | - else |
|
| 1884 | + } else |
|
| 1901 | 1885 | { |
| 1902 | 1886 | $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); |
| 1903 | 1887 | if(isset($this->_d[$priority])&&(isset($this->_d[$priority][$key])||array_key_exists($key,$this->_d[$priority]))) |
@@ -1911,19 +1895,18 @@ discard block |
||
| 1911 | 1895 | } |
| 1912 | 1896 | $this->_fd=null; |
| 1913 | 1897 | return $value; |
| 1914 | - } |
|
| 1915 | - else |
|
| 1898 | + } else |
|
| 1916 | 1899 | return null; |
| 1917 | 1900 | } |
| 1918 | - } |
|
| 1919 | - else |
|
| 1901 | + } else |
|
| 1920 | 1902 | throw new TInvalidOperationException('map_readonly',get_class($this)); |
| 1921 | 1903 | } |
| 1922 | 1904 | public function clear() |
| 1923 | 1905 | { |
| 1924 | - foreach($this->_d as $priority=>$items) |
|
| 1925 | - foreach(array_keys($items) as $key) |
|
| 1906 | + foreach($this->_d as $priority=>$items) { |
|
| 1907 | + foreach(array_keys($items) as $key) |
|
| 1926 | 1908 | $this->remove($key); |
| 1909 | + } |
|
| 1927 | 1910 | } |
| 1928 | 1911 | public function contains($key) |
| 1929 | 1912 | { |
@@ -1969,15 +1952,14 @@ discard block |
||
| 1969 | 1952 | $this->add($key,$value,$priority); |
| 1970 | 1953 | } |
| 1971 | 1954 | } |
| 1972 | - } |
|
| 1973 | - else if(is_array($data)||$data instanceof Traversable) |
|
| 1955 | + } else if(is_array($data)||$data instanceof Traversable) |
|
| 1974 | 1956 | { |
| 1975 | 1957 | if($this->getCount()>0) |
| 1976 | 1958 | $this->clear(); |
| 1977 | - foreach($data as $key=>$value) |
|
| 1978 | - $this->add($key,$value); |
|
| 1979 | - } |
|
| 1980 | - else if($data!==null) |
|
| 1959 | + foreach($data as $key=>$value) { |
|
| 1960 | + $this->add($key,$value); |
|
| 1961 | + } |
|
| 1962 | + } else if($data!==null) |
|
| 1981 | 1963 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 1982 | 1964 | } |
| 1983 | 1965 | public function mergeWith($data) |
@@ -1986,16 +1968,16 @@ discard block |
||
| 1986 | 1968 | { |
| 1987 | 1969 | foreach($data->getPriorities() as $priority) |
| 1988 | 1970 | { |
| 1989 | - foreach($data->itemsAtPriority($priority) as $key => $value) |
|
| 1990 | - $this->add($key,$value,$priority); |
|
| 1971 | + foreach($data->itemsAtPriority($priority) as $key => $value) { |
|
| 1972 | + $this->add($key,$value,$priority); |
|
| 1973 | + } |
|
| 1991 | 1974 | } |
| 1992 | - } |
|
| 1993 | - else if(is_array($data)||$data instanceof Traversable) |
|
| 1975 | + } else if(is_array($data)||$data instanceof Traversable) |
|
| 1994 | 1976 | { |
| 1995 | - foreach($data as $key=>$value) |
|
| 1996 | - $this->add($key,$value); |
|
| 1997 | - } |
|
| 1998 | - else if($data!==null) |
|
| 1977 | + foreach($data as $key=>$value) { |
|
| 1978 | + $this->add($key,$value); |
|
| 1979 | + } |
|
| 1980 | + } else if($data!==null) |
|
| 1999 | 1981 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 2000 | 1982 | } |
| 2001 | 1983 | public function offsetExists($offset) |
@@ -2038,8 +2020,7 @@ discard block |
||
| 2038 | 2020 | $this->_d[]=$item; |
| 2039 | 2021 | ++$this->_c; |
| 2040 | 2022 | } |
| 2041 | - } |
|
| 2042 | - else if($data!==null) |
|
| 2023 | + } else if($data!==null) |
|
| 2043 | 2024 | throw new TInvalidDataTypeException('stack_data_not_iterable'); |
| 2044 | 2025 | } |
| 2045 | 2026 | public function clear() |
@@ -2188,9 +2169,10 @@ discard block |
||
| 2188 | 2169 | { |
| 2189 | 2170 | if($this->_elements) |
| 2190 | 2171 | { |
| 2191 | - foreach($this->_elements as $element) |
|
| 2192 | - if($element->_tagName===$tagName) |
|
| 2172 | + foreach($this->_elements as $element) { |
|
| 2173 | + if($element->_tagName===$tagName) |
|
| 2193 | 2174 | return $element; |
| 2175 | + } |
|
| 2194 | 2176 | } |
| 2195 | 2177 | return null; |
| 2196 | 2178 | } |
@@ -2199,9 +2181,10 @@ discard block |
||
| 2199 | 2181 | $list=new TList; |
| 2200 | 2182 | if($this->_elements) |
| 2201 | 2183 | { |
| 2202 | - foreach($this->_elements as $element) |
|
| 2203 | - if($element->_tagName===$tagName) |
|
| 2184 | + foreach($this->_elements as $element) { |
|
| 2185 | + if($element->_tagName===$tagName) |
|
| 2204 | 2186 | $list->add($element); |
| 2187 | + } |
|
| 2205 | 2188 | } |
| 2206 | 2189 | return $list; |
| 2207 | 2190 | } |
@@ -2220,17 +2203,16 @@ discard block |
||
| 2220 | 2203 | if($this->getHasElement()) |
| 2221 | 2204 | { |
| 2222 | 2205 | $str=$prefix."<{$this->_tagName}$attr>\n"; |
| 2223 | - foreach($this->getElements() as $element) |
|
| 2224 | - $str.=$element->toString($indent+1)."\n"; |
|
| 2206 | + foreach($this->getElements() as $element) { |
|
| 2207 | + $str.=$element->toString($indent+1)."\n"; |
|
| 2208 | + } |
|
| 2225 | 2209 | $str.=$prefix."</{$this->_tagName}>"; |
| 2226 | 2210 | return $str; |
| 2227 | - } |
|
| 2228 | - else if(($value=$this->getValue())!=='') |
|
| 2211 | + } else if(($value=$this->getValue())!=='') |
|
| 2229 | 2212 | { |
| 2230 | 2213 | $value=$this->xmlEncode($value); |
| 2231 | 2214 | return $prefix."<{$this->_tagName}$attr>$value</{$this->_tagName}>"; |
| 2232 | - } |
|
| 2233 | - else |
|
| 2215 | + } else |
|
| 2234 | 2216 | return $prefix."<{$this->_tagName}$attr />"; |
| 2235 | 2217 | } |
| 2236 | 2218 | public function __toString() |
@@ -2312,8 +2294,9 @@ discard block |
||
| 2312 | 2294 | $attributes->add('xmlns:'.$prefix, $uri); |
| 2313 | 2295 | } |
| 2314 | 2296 | } |
| 2315 | - foreach($element->attributes as $name=>$attr) |
|
| 2316 | - $attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value); |
|
| 2297 | + foreach($element->attributes as $name=>$attr) { |
|
| 2298 | + $attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value); |
|
| 2299 | + } |
|
| 2317 | 2300 | foreach($element->childNodes as $child) |
| 2318 | 2301 | { |
| 2319 | 2302 | if($child instanceof DOMElement) |
@@ -2327,8 +2310,7 @@ discard block |
||
| 2327 | 2310 | { |
| 2328 | 2311 | fwrite($fw,$this->saveToString()); |
| 2329 | 2312 | fclose($fw); |
| 2330 | - } |
|
| 2331 | - else |
|
| 2313 | + } else |
|
| 2332 | 2314 | throw new TIOException('xmldocument_file_write_failed',$file); |
| 2333 | 2315 | } |
| 2334 | 2316 | public function saveToString() |
@@ -2345,8 +2327,9 @@ discard block |
||
| 2345 | 2327 | { |
| 2346 | 2328 | $element=new TXmlElement($node->tagName); |
| 2347 | 2329 | $element->setValue($node->nodeValue); |
| 2348 | - foreach($node->attributes as $name=>$attr) |
|
| 2349 | - $element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value); |
|
| 2330 | + foreach($node->attributes as $name=>$attr) { |
|
| 2331 | + $element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value); |
|
| 2332 | + } |
|
| 2350 | 2333 | foreach($node->childNodes as $child) |
| 2351 | 2334 | { |
| 2352 | 2335 | if($child instanceof DOMElement) |
@@ -2374,8 +2357,7 @@ discard block |
||
| 2374 | 2357 | if($item->getParent()!==null) |
| 2375 | 2358 | $item->getParent()->getElements()->remove($item); |
| 2376 | 2359 | $item->setParent($this->_o); |
| 2377 | - } |
|
| 2378 | - else |
|
| 2360 | + } else |
|
| 2379 | 2361 | throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required'); |
| 2380 | 2362 | } |
| 2381 | 2363 | public function removeAt($index) |
@@ -2419,8 +2401,7 @@ discard block |
||
| 2419 | 2401 | { |
| 2420 | 2402 | $this->_everyone=true; |
| 2421 | 2403 | break; |
| 2422 | - } |
|
| 2423 | - else if($user==='?') |
|
| 2404 | + } else if($user==='?') |
|
| 2424 | 2405 | $this->_guest=true; |
| 2425 | 2406 | else if($user==='@') |
| 2426 | 2407 | $this->_authenticated=true; |
@@ -2530,8 +2511,7 @@ discard block |
||
| 2530 | 2511 | return ($decision>0); |
| 2531 | 2512 | } |
| 2532 | 2513 | return true; |
| 2533 | - } |
|
| 2534 | - else |
|
| 2514 | + } else |
|
| 2535 | 2515 | return false; |
| 2536 | 2516 | } |
| 2537 | 2517 | public function insertAt($index,$item) |
@@ -2661,8 +2641,7 @@ discard block |
||
| 2661 | 2641 | if($module===false) |
| 2662 | 2642 | throw new TNotSupportedException('securitymanager_mcryptextension_initfailed'); |
| 2663 | 2643 | return $module; |
| 2664 | - } |
|
| 2665 | - else |
|
| 2644 | + } else |
|
| 2666 | 2645 | throw new TNotSupportedException('securitymanager_mcryptextension_required'); |
| 2667 | 2646 | } |
| 2668 | 2647 | public function hashData($data) |
@@ -2732,8 +2711,9 @@ discard block |
||
| 2732 | 2711 | public static function renderScriptFiles($files) |
| 2733 | 2712 | { |
| 2734 | 2713 | $str=''; |
| 2735 | - foreach($files as $file) |
|
| 2736 | - $str.= self::renderScriptFile($file); |
|
| 2714 | + foreach($files as $file) { |
|
| 2715 | + $str.= self::renderScriptFile($file); |
|
| 2716 | + } |
|
| 2737 | 2717 | return $str; |
| 2738 | 2718 | } |
| 2739 | 2719 | public static function renderScriptFile($file) |
@@ -2802,8 +2782,7 @@ discard block |
||
| 2802 | 2782 | } |
| 2803 | 2783 | } |
| 2804 | 2784 | return '{'.$results.'}'; |
| 2805 | - } |
|
| 2806 | - else |
|
| 2785 | + } else |
|
| 2807 | 2786 | { |
| 2808 | 2787 | foreach($value as $v) |
| 2809 | 2788 | { |
@@ -2816,8 +2795,7 @@ discard block |
||
| 2816 | 2795 | } |
| 2817 | 2796 | return '['.$results.']'; |
| 2818 | 2797 | } |
| 2819 | - } |
|
| 2820 | - else if(is_integer($value)) |
|
| 2798 | + } else if(is_integer($value)) |
|
| 2821 | 2799 | return "$value"; |
| 2822 | 2800 | else if(is_float($value)) |
| 2823 | 2801 | { |
@@ -2837,8 +2815,7 @@ discard block |
||
| 2837 | 2815 | return str_replace($locale['decimal_point'], '.', "$value"); |
| 2838 | 2816 | break; |
| 2839 | 2817 | } |
| 2840 | - } |
|
| 2841 | - else if(is_object($value)) |
|
| 2818 | + } else if(is_object($value)) |
|
| 2842 | 2819 | if ($value instanceof TJavaScriptLiteral) |
| 2843 | 2820 | return $value->toJavaScriptLiteral(); |
| 2844 | 2821 | else |
@@ -2863,8 +2840,9 @@ discard block |
||
| 2863 | 2840 | $value=iconv($sourceEncoding, 'UTF-8', $value); |
| 2864 | 2841 | else if (is_array($value)) |
| 2865 | 2842 | { |
| 2866 | - foreach($value as &$element) |
|
| 2867 | - self::convertToUtf8($element, $sourceEncoding); |
|
| 2843 | + foreach($value as &$element) { |
|
| 2844 | + self::convertToUtf8($element, $sourceEncoding); |
|
| 2845 | + } |
|
| 2868 | 2846 | } |
| 2869 | 2847 | } |
| 2870 | 2848 | public static function jsonDecode($value, $assoc = false, $depth = 512) |
@@ -2923,23 +2901,22 @@ discard block |
||
| 2923 | 2901 | if(is_array($value)) |
| 2924 | 2902 | { |
| 2925 | 2903 | $name=urlencode($name.'[]'); |
| 2926 | - foreach($value as $v) |
|
| 2927 | - $url.=$amp.$name.'='.urlencode($v); |
|
| 2928 | - } |
|
| 2929 | - else |
|
| 2904 | + foreach($value as $v) { |
|
| 2905 | + $url.=$amp.$name.'='.urlencode($v); |
|
| 2906 | + } |
|
| 2907 | + } else |
|
| 2930 | 2908 | $url.=$amp.urlencode($name).'='.urlencode($value); |
| 2931 | 2909 | } |
| 2932 | - } |
|
| 2933 | - else |
|
| 2910 | + } else |
|
| 2934 | 2911 | { |
| 2935 | 2912 | foreach($getItems as $name=>$value) |
| 2936 | 2913 | { |
| 2937 | 2914 | if(is_array($value)) |
| 2938 | 2915 | { |
| 2939 | - foreach($value as $v) |
|
| 2940 | - $url.=$amp.$name.'[]='.$v; |
|
| 2941 | - } |
|
| 2942 | - else |
|
| 2916 | + foreach($value as $v) { |
|
| 2917 | + $url.=$amp.$name.'[]='.$v; |
|
| 2918 | + } |
|
| 2919 | + } else |
|
| 2943 | 2920 | $url.=$amp.$name.'='.$value; |
| 2944 | 2921 | } |
| 2945 | 2922 | } |
@@ -2977,14 +2954,12 @@ discard block |
||
| 2977 | 2954 | $getVariables[substr($name,0,$pos)][]=$value; |
| 2978 | 2955 | else |
| 2979 | 2956 | $getVariables[$name]=$value; |
| 2980 | - } |
|
| 2981 | - else |
|
| 2957 | + } else |
|
| 2982 | 2958 | $getVariables[$path]=''; |
| 2983 | 2959 | } |
| 2984 | 2960 | } |
| 2985 | 2961 | return $getVariables; |
| 2986 | - } |
|
| 2987 | - else |
|
| 2962 | + } else |
|
| 2988 | 2963 | return array(); |
| 2989 | 2964 | } |
| 2990 | 2965 | } |
@@ -3068,8 +3043,7 @@ discard block |
||
| 3068 | 3043 | $port=$_SERVER['SERVER_PORT']; |
| 3069 | 3044 | if(($port!=80 && !$secure) || ($port!=443 && $secure)) |
| 3070 | 3045 | $url.=':'.$port; |
| 3071 | - } |
|
| 3072 | - else |
|
| 3046 | + } else |
|
| 3073 | 3047 | $url.=$_SERVER['HTTP_HOST']; |
| 3074 | 3048 | $url.=$this->getRequestUri(); |
| 3075 | 3049 | $this->_url=new TUri($url); |
@@ -3139,8 +3113,7 @@ discard block |
||
| 3139 | 3113 | { |
| 3140 | 3114 | $this->_urlManager=new TUrlManager; |
| 3141 | 3115 | $this->_urlManager->init(null); |
| 3142 | - } |
|
| 3143 | - else |
|
| 3116 | + } else |
|
| 3144 | 3117 | { |
| 3145 | 3118 | $this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID); |
| 3146 | 3119 | if($this->_urlManager===null) |
@@ -3205,8 +3178,7 @@ discard block |
||
| 3205 | 3178 | static $result; |
| 3206 | 3179 | if($result === null && function_exists('apache_request_headers')) { |
| 3207 | 3180 | $result = apache_request_headers(); |
| 3208 | - } |
|
| 3209 | - elseif($result === null) { |
|
| 3181 | + } elseif($result === null) { |
|
| 3210 | 3182 | $result = array(); |
| 3211 | 3183 | foreach($_SERVER as $key=>$value) { |
| 3212 | 3184 | if(strncasecmp($key, 'HTTP_', 5) !== 0) continue; |
@@ -3261,8 +3233,7 @@ discard block |
||
| 3261 | 3233 | try |
| 3262 | 3234 | { |
| 3263 | 3235 | return get_browser(); |
| 3264 | - } |
|
| 3265 | - catch(TPhpErrorException $e) |
|
| 3236 | + } catch(TPhpErrorException $e) |
|
| 3266 | 3237 | { |
| 3267 | 3238 | throw new TConfigurationException('httprequest_browscap_required'); |
| 3268 | 3239 | } |
@@ -3316,11 +3287,11 @@ discard block |
||
| 3316 | 3287 | if(($value=$sm->validateData($value))!==false) |
| 3317 | 3288 | $this->_cookies->add(new THttpCookie($key,$value)); |
| 3318 | 3289 | } |
| 3319 | - } |
|
| 3320 | - else |
|
| 3290 | + } else |
|
| 3321 | 3291 | { |
| 3322 | - foreach($_COOKIE as $key=>$value) |
|
| 3323 | - $this->_cookies->add(new THttpCookie($key,$value)); |
|
| 3292 | + foreach($_COOKIE as $key=>$value) { |
|
| 3293 | + $this->_cookies->add(new THttpCookie($key,$value)); |
|
| 3294 | + } |
|
| 3324 | 3295 | } |
| 3325 | 3296 | } |
| 3326 | 3297 | return $this->_cookies; |
@@ -3354,8 +3325,9 @@ discard block |
||
| 3354 | 3325 | public function resolveRequest($serviceIDs) |
| 3355 | 3326 | { |
| 3356 | 3327 | $getParams=$this->parseUrl(); |
| 3357 | - foreach($getParams as $name=>$value) |
|
| 3358 | - $_GET[$name]=$value; |
|
| 3328 | + foreach($getParams as $name=>$value) { |
|
| 3329 | + $_GET[$name]=$value; |
|
| 3330 | + } |
|
| 3359 | 3331 | $this->_items=array_merge($_GET,$_POST); |
| 3360 | 3332 | $this->_requestResolved=true; |
| 3361 | 3333 | foreach($serviceIDs as $serviceID) |
@@ -3420,14 +3392,14 @@ discard block |
||
| 3420 | 3392 | $value=$this->_items[$key]; |
| 3421 | 3393 | unset($this->_items[$key]); |
| 3422 | 3394 | return $value; |
| 3423 | - } |
|
| 3424 | - else |
|
| 3395 | + } else |
|
| 3425 | 3396 | return null; |
| 3426 | 3397 | } |
| 3427 | 3398 | public function clear() |
| 3428 | 3399 | { |
| 3429 | - foreach(array_keys($this->_items) as $key) |
|
| 3430 | - $this->remove($key); |
|
| 3400 | + foreach(array_keys($this->_items) as $key) { |
|
| 3401 | + $this->remove($key); |
|
| 3402 | + } |
|
| 3431 | 3403 | } |
| 3432 | 3404 | public function contains($key) |
| 3433 | 3405 | { |
@@ -3468,8 +3440,7 @@ discard block |
||
| 3468 | 3440 | parent::insertAt($index,$item); |
| 3469 | 3441 | if($this->_o instanceof THttpResponse) |
| 3470 | 3442 | $this->_o->addCookie($item); |
| 3471 | - } |
|
| 3472 | - else |
|
| 3443 | + } else |
|
| 3473 | 3444 | throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required'); |
| 3474 | 3445 | } |
| 3475 | 3446 | public function removeAt($index) |
@@ -3488,9 +3459,10 @@ discard block |
||
| 3488 | 3459 | } |
| 3489 | 3460 | public function findCookieByName($name) |
| 3490 | 3461 | { |
| 3491 | - foreach($this as $cookie) |
|
| 3492 | - if($cookie->getName()===$name) |
|
| 3462 | + foreach($this as $cookie) { |
|
| 3463 | + if($cookie->getName()===$name) |
|
| 3493 | 3464 | return $cookie; |
| 3465 | + } |
|
| 3494 | 3466 | return null; |
| 3495 | 3467 | } |
| 3496 | 3468 | } |
@@ -3599,8 +3571,7 @@ discard block |
||
| 3599 | 3571 | $this->_query=isset($ret['query'])?$ret['query']:''; |
| 3600 | 3572 | $this->_fragment=isset($ret['fragment'])?$ret['fragment']:''; |
| 3601 | 3573 | $this->_uri=$uri; |
| 3602 | - } |
|
| 3603 | - else |
|
| 3574 | + } else |
|
| 3604 | 3575 | { |
| 3605 | 3576 | throw new TInvalidDataValueException('uri_format_invalid',$uri); |
| 3606 | 3577 | } |
@@ -3772,7 +3743,7 @@ discard block |
||
| 3772 | 3743 | $status=TPropertyValue::ensureInteger($status); |
| 3773 | 3744 | if(isset(self::$HTTP_STATUS_CODES[$status])) { |
| 3774 | 3745 | $this->_reason=self::$HTTP_STATUS_CODES[$status]; |
| 3775 | - }else{ |
|
| 3746 | + } else{ |
|
| 3776 | 3747 | if($reason===null || $reason==='') { |
| 3777 | 3748 | throw new TInvalidDataValueException("response_status_reason_missing"); |
| 3778 | 3749 | } |
@@ -3834,10 +3805,10 @@ discard block |
||
| 3834 | 3805 | $this->sendHttpHeader(); |
| 3835 | 3806 | if(is_array($headers)) |
| 3836 | 3807 | { |
| 3837 | - foreach($headers as $h) |
|
| 3838 | - header($h); |
|
| 3839 | - } |
|
| 3840 | - else |
|
| 3808 | + foreach($headers as $h) { |
|
| 3809 | + header($h); |
|
| 3810 | + } |
|
| 3811 | + } else |
|
| 3841 | 3812 | { |
| 3842 | 3813 | header('Pragma: public'); |
| 3843 | 3814 | header('Expires: 0'); |
@@ -3900,13 +3871,11 @@ discard block |
||
| 3900 | 3871 | { |
| 3901 | 3872 | $this->_bufferOutput = false; |
| 3902 | 3873 | ob_end_flush(); |
| 3903 | - } |
|
| 3904 | - else |
|
| 3874 | + } else |
|
| 3905 | 3875 | ob_flush(); |
| 3906 | 3876 | flush(); |
| 3907 | 3877 | } |
| 3908 | - } |
|
| 3909 | - else |
|
| 3878 | + } else |
|
| 3910 | 3879 | flush(); |
| 3911 | 3880 | } |
| 3912 | 3881 | protected function ensureHttpHeaderSent() |
@@ -3992,8 +3961,7 @@ discard block |
||
| 3992 | 3961 | $cookie->getSecure(), |
| 3993 | 3962 | $cookie->getHttpOnly() |
| 3994 | 3963 | ); |
| 3995 | - } |
|
| 3996 | - else { |
|
| 3964 | + } else { |
|
| 3997 | 3965 | setcookie( |
| 3998 | 3966 | $cookie->getName(), |
| 3999 | 3967 | $cookie->getValue(), |
@@ -4173,13 +4141,11 @@ discard block |
||
| 4173 | 4141 | { |
| 4174 | 4142 | ini_set('session.use_cookies','0'); |
| 4175 | 4143 | ini_set('session.use_only_cookies','0'); |
| 4176 | - } |
|
| 4177 | - else if($value===THttpSessionCookieMode::Allow) |
|
| 4144 | + } else if($value===THttpSessionCookieMode::Allow) |
|
| 4178 | 4145 | { |
| 4179 | 4146 | ini_set('session.use_cookies','1'); |
| 4180 | 4147 | ini_set('session.use_only_cookies','0'); |
| 4181 | - } |
|
| 4182 | - else |
|
| 4148 | + } else |
|
| 4183 | 4149 | { |
| 4184 | 4150 | ini_set('session.use_cookies','1'); |
| 4185 | 4151 | ini_set('session.use_only_cookies','1'); |
@@ -4213,8 +4179,7 @@ discard block |
||
| 4213 | 4179 | { |
| 4214 | 4180 | ini_set('session.gc_probability',$value); |
| 4215 | 4181 | ini_set('session.gc_divisor','100'); |
| 4216 | - } |
|
| 4217 | - else |
|
| 4182 | + } else |
|
| 4218 | 4183 | throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value); |
| 4219 | 4184 | } |
| 4220 | 4185 | } |
@@ -4300,14 +4265,14 @@ discard block |
||
| 4300 | 4265 | $value=$_SESSION[$key]; |
| 4301 | 4266 | unset($_SESSION[$key]); |
| 4302 | 4267 | return $value; |
| 4303 | - } |
|
| 4304 | - else |
|
| 4268 | + } else |
|
| 4305 | 4269 | return null; |
| 4306 | 4270 | } |
| 4307 | 4271 | public function clear() |
| 4308 | 4272 | { |
| 4309 | - foreach(array_keys($_SESSION) as $key) |
|
| 4310 | - unset($_SESSION[$key]); |
|
| 4273 | + foreach(array_keys($_SESSION) as $key) { |
|
| 4274 | + unset($_SESSION[$key]); |
|
| 4275 | + } |
|
| 4311 | 4276 | } |
| 4312 | 4277 | public function contains($key) |
| 4313 | 4278 | { |
@@ -4617,10 +4582,8 @@ discard block |
||
| 4617 | 4582 | return $this->_id; |
| 4618 | 4583 | else |
| 4619 | 4584 | return ($this->_uid=$prefix.self::ID_SEPARATOR.$this->_id); |
| 4620 | - } |
|
| 4621 | - else return $this->_id; |
|
| 4622 | - } |
|
| 4623 | - else |
|
| 4585 | + } else return $this->_id; |
|
| 4586 | + } else |
|
| 4624 | 4587 | return $this->_uid; |
| 4625 | 4588 | } |
| 4626 | 4589 | public function focus() |
@@ -4692,12 +4655,12 @@ discard block |
||
| 4692 | 4655 | { |
| 4693 | 4656 | if($checkParents) |
| 4694 | 4657 | { |
| 4695 | - for($control=$this;$control;$control=$control->_parent) |
|
| 4696 | - if(!$control->getVisible(false)) |
|
| 4658 | + for($control=$this;$control;$control=$control->_parent) { |
|
| 4659 | + if(!$control->getVisible(false)) |
|
| 4697 | 4660 | return false; |
| 4661 | + } |
|
| 4698 | 4662 | return true; |
| 4699 | - } |
|
| 4700 | - else |
|
| 4663 | + } else |
|
| 4701 | 4664 | return $this->getViewState('Visible',true); |
| 4702 | 4665 | } |
| 4703 | 4666 | public function setVisible($value) |
@@ -4708,12 +4671,12 @@ discard block |
||
| 4708 | 4671 | { |
| 4709 | 4672 | if($checkParents) |
| 4710 | 4673 | { |
| 4711 | - for($control=$this;$control;$control=$control->_parent) |
|
| 4712 | - if(!$control->getViewState('Enabled',true)) |
|
| 4674 | + for($control=$this;$control;$control=$control->_parent) { |
|
| 4675 | + if(!$control->getViewState('Enabled',true)) |
|
| 4713 | 4676 | return false; |
| 4677 | + } |
|
| 4714 | 4678 | return true; |
| 4715 | - } |
|
| 4716 | - else |
|
| 4679 | + } else |
|
| 4717 | 4680 | return $this->getViewState('Enabled',true); |
| 4718 | 4681 | } |
| 4719 | 4682 | public function setEnabled($value) |
@@ -4767,12 +4730,12 @@ discard block |
||
| 4767 | 4730 | { |
| 4768 | 4731 | if($checkParents) |
| 4769 | 4732 | { |
| 4770 | - for($control=$this;$control!==null;$control=$control->getParent()) |
|
| 4771 | - if($control->_flags & self::IS_DISABLE_VIEWSTATE) |
|
| 4733 | + for($control=$this;$control!==null;$control=$control->getParent()) { |
|
| 4734 | + if($control->_flags & self::IS_DISABLE_VIEWSTATE) |
|
| 4772 | 4735 | return false; |
| 4736 | + } |
|
| 4773 | 4737 | return true; |
| 4774 | - } |
|
| 4775 | - else |
|
| 4738 | + } else |
|
| 4776 | 4739 | return !($this->_flags & self::IS_DISABLE_VIEWSTATE); |
| 4777 | 4740 | } |
| 4778 | 4741 | public function setEnableViewState($value) |
@@ -4810,8 +4773,7 @@ discard block |
||
| 4810 | 4773 | if(is_object($this->_tempState[$key]) && $this->_trackViewState) |
| 4811 | 4774 | $this->_viewState[$key]=$this->_tempState[$key]; |
| 4812 | 4775 | return $this->_tempState[$key]; |
| 4813 | - } |
|
| 4814 | - else |
|
| 4776 | + } else |
|
| 4815 | 4777 | return $defaultValue; |
| 4816 | 4778 | } |
| 4817 | 4779 | public function setViewState($key,$value,$defaultValue=null) |
@@ -4823,8 +4785,7 @@ discard block |
||
| 4823 | 4785 | unset($this->_viewState[$key]); |
| 4824 | 4786 | else |
| 4825 | 4787 | $this->_viewState[$key]=$value; |
| 4826 | - } |
|
| 4827 | - else |
|
| 4788 | + } else |
|
| 4828 | 4789 | { |
| 4829 | 4790 | unset($this->_viewState[$key]); |
| 4830 | 4791 | if($value===$defaultValue) |
@@ -4862,8 +4823,9 @@ discard block |
||
| 4862 | 4823 | { |
| 4863 | 4824 | if(($context=$this->getTemplateControl())===null) |
| 4864 | 4825 | $context=$this; |
| 4865 | - foreach($this->_rf[self::RF_DATA_BINDINGS] as $property=>$expression) |
|
| 4866 | - $this->setSubProperty($property,$context->evaluateExpression($expression)); |
|
| 4826 | + foreach($this->_rf[self::RF_DATA_BINDINGS] as $property=>$expression) { |
|
| 4827 | + $this->setSubProperty($property,$context->evaluateExpression($expression)); |
|
| 4828 | + } |
|
| 4867 | 4829 | } |
| 4868 | 4830 | } |
| 4869 | 4831 | protected function autoDataBindProperties() |
@@ -4872,17 +4834,19 @@ discard block |
||
| 4872 | 4834 | { |
| 4873 | 4835 | if(($context=$this->getTemplateControl())===null) |
| 4874 | 4836 | $context=$this; |
| 4875 | - foreach($this->_rf[self::RF_AUTO_BINDINGS] as $property=>$expression) |
|
| 4876 | - $this->setSubProperty($property,$context->evaluateExpression($expression)); |
|
| 4837 | + foreach($this->_rf[self::RF_AUTO_BINDINGS] as $property=>$expression) { |
|
| 4838 | + $this->setSubProperty($property,$context->evaluateExpression($expression)); |
|
| 4839 | + } |
|
| 4877 | 4840 | } |
| 4878 | 4841 | } |
| 4879 | 4842 | protected function dataBindChildren() |
| 4880 | 4843 | { |
| 4881 | 4844 | if(isset($this->_rf[self::RF_CONTROLS])) |
| 4882 | 4845 | { |
| 4883 | - foreach($this->_rf[self::RF_CONTROLS] as $control) |
|
| 4884 | - if($control instanceof IBindable) |
|
| 4846 | + foreach($this->_rf[self::RF_CONTROLS] as $control) { |
|
| 4847 | + if($control instanceof IBindable) |
|
| 4885 | 4848 | $control->dataBind(); |
| 4849 | + } |
|
| 4886 | 4850 | } |
| 4887 | 4851 | } |
| 4888 | 4852 | final protected function getChildControlsCreated() |
@@ -4913,8 +4877,7 @@ discard block |
||
| 4913 | 4877 | $this->createChildControls(); |
| 4914 | 4878 | $this->_flags &= ~self::IS_CREATING_CHILD; |
| 4915 | 4879 | $this->_flags |= self::IS_CHILD_CREATED; |
| 4916 | - } |
|
| 4917 | - catch(Exception $e) |
|
| 4880 | + } catch(Exception $e) |
|
| 4918 | 4881 | { |
| 4919 | 4882 | $this->_flags &= ~self::IS_CREATING_CHILD; |
| 4920 | 4883 | $this->_flags |= self::IS_CHILD_CREATED; |
@@ -5038,8 +5001,9 @@ discard block |
||
| 5038 | 5001 | final protected function isDescendentOf($ancestor) |
| 5039 | 5002 | { |
| 5040 | 5003 | $control=$this; |
| 5041 | - while($control!==$ancestor && $control->_parent) |
|
| 5042 | - $control=$control->_parent; |
|
| 5004 | + while($control!==$ancestor && $control->_parent) { |
|
| 5005 | + $control=$control->_parent; |
|
| 5006 | + } |
|
| 5043 | 5007 | return $control===$ancestor; |
| 5044 | 5008 | } |
| 5045 | 5009 | public function addedControl($control) |
@@ -5067,8 +5031,7 @@ discard block |
||
| 5067 | 5031 | { |
| 5068 | 5032 | $state=$this->_rf[self::RF_CHILD_STATE][$control->_id]; |
| 5069 | 5033 | unset($this->_rf[self::RF_CHILD_STATE][$control->_id]); |
| 5070 | - } |
|
| 5071 | - else |
|
| 5034 | + } else |
|
| 5072 | 5035 | $state=null; |
| 5073 | 5036 | $control->loadStateRecursive($state,!($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
| 5074 | 5037 | if($this->_stage>=self::CS_LOADED) |
@@ -5178,9 +5141,10 @@ discard block |
||
| 5178 | 5141 | $this->_id=''; |
| 5179 | 5142 | if($this->getHasControls()) |
| 5180 | 5143 | { |
| 5181 | - foreach($this->_rf[self::RF_CONTROLS] as $control) |
|
| 5182 | - if($control instanceof TControl) |
|
| 5144 | + foreach($this->_rf[self::RF_CONTROLS] as $control) { |
|
| 5145 | + if($control instanceof TControl) |
|
| 5183 | 5146 | $control->unloadRecursive(); |
| 5147 | + } |
|
| 5184 | 5148 | } |
| 5185 | 5149 | if(isset($this->_rf[self::RF_ADAPTER])) |
| 5186 | 5150 | $this->_rf[self::RF_ADAPTER]->onUnload(null); |
@@ -5301,8 +5265,7 @@ discard block |
||
| 5301 | 5265 | { |
| 5302 | 5266 | $this->_rf[self::RF_CONTROLSTATE]=&$state[1]; |
| 5303 | 5267 | unset($state[1]); |
| 5304 | - } |
|
| 5305 | - else |
|
| 5268 | + } else |
|
| 5306 | 5269 | unset($this->_rf[self::RF_CONTROLSTATE]); |
| 5307 | 5270 | if($needViewState) |
| 5308 | 5271 | { |
@@ -5366,17 +5329,17 @@ discard block |
||
| 5366 | 5329 | { |
| 5367 | 5330 | $page->applyControlStyleSheet($this); |
| 5368 | 5331 | $this->_flags |= self::IS_STYLESHEET_APPLIED; |
| 5369 | - } |
|
| 5370 | - else if($this->_flags & self::IS_STYLESHEET_APPLIED) |
|
| 5332 | + } else if($this->_flags & self::IS_STYLESHEET_APPLIED) |
|
| 5371 | 5333 | throw new TInvalidOperationException('control_stylesheet_applied',get_class($this)); |
| 5372 | 5334 | } |
| 5373 | 5335 | private function clearCachedUniqueID($recursive) |
| 5374 | 5336 | { |
| 5375 | 5337 | if($recursive && $this->_uid!==null && isset($this->_rf[self::RF_CONTROLS])) |
| 5376 | 5338 | { |
| 5377 | - foreach($this->_rf[self::RF_CONTROLS] as $control) |
|
| 5378 | - if($control instanceof TControl) |
|
| 5339 | + foreach($this->_rf[self::RF_CONTROLS] as $control) { |
|
| 5340 | + if($control instanceof TControl) |
|
| 5379 | 5341 | $control->clearCachedUniqueID($recursive); |
| 5342 | + } |
|
| 5380 | 5343 | } |
| 5381 | 5344 | $this->_uid=null; |
| 5382 | 5345 | } |
@@ -5430,8 +5393,7 @@ discard block |
||
| 5430 | 5393 | { |
| 5431 | 5394 | parent::insertAt($index,$item); |
| 5432 | 5395 | $this->_o->addedControl($item); |
| 5433 | - } |
|
| 5434 | - else if(is_string($item) || ($item instanceof IRenderable)) |
|
| 5396 | + } else if(is_string($item) || ($item instanceof IRenderable)) |
|
| 5435 | 5397 | parent::insertAt($index,$item); |
| 5436 | 5398 | else |
| 5437 | 5399 | throw new TInvalidDataTypeException('controlcollection_control_required'); |
@@ -5591,8 +5553,7 @@ discard block |
||
| 5591 | 5553 | else if($item[0]===self::TYPE_DATABINDING) |
| 5592 | 5554 | $this->_bindings[$id]=$item[1]; |
| 5593 | 5555 | $this->_items[$id]=''; |
| 5594 | - } |
|
| 5595 | - else |
|
| 5556 | + } else |
|
| 5596 | 5557 | $this->_items[$id]=$item; |
| 5597 | 5558 | } |
| 5598 | 5559 | } |
@@ -5607,16 +5568,19 @@ discard block |
||
| 5607 | 5568 | public function evaluateDynamicContent() |
| 5608 | 5569 | { |
| 5609 | 5570 | $context=$this->_container===null?$this:$this->_container; |
| 5610 | - foreach($this->_expressions as $id=>$expression) |
|
| 5611 | - $this->_items[$id]=$context->evaluateExpression($expression); |
|
| 5612 | - foreach($this->_statements as $id=>$statement) |
|
| 5613 | - $this->_items[$id]=$context->evaluateStatements($statement); |
|
| 5571 | + foreach($this->_expressions as $id=>$expression) { |
|
| 5572 | + $this->_items[$id]=$context->evaluateExpression($expression); |
|
| 5573 | + } |
|
| 5574 | + foreach($this->_statements as $id=>$statement) { |
|
| 5575 | + $this->_items[$id]=$context->evaluateStatements($statement); |
|
| 5576 | + } |
|
| 5614 | 5577 | } |
| 5615 | 5578 | public function dataBind() |
| 5616 | 5579 | { |
| 5617 | 5580 | $context=$this->_container===null?$this:$this->_container; |
| 5618 | - foreach($this->_bindings as $id=>$binding) |
|
| 5619 | - $this->_items[$id]=$context->evaluateExpression($binding); |
|
| 5581 | + foreach($this->_bindings as $id=>$binding) { |
|
| 5582 | + $this->_items[$id]=$context->evaluateExpression($binding); |
|
| 5583 | + } |
|
| 5620 | 5584 | } |
| 5621 | 5585 | public function render($writer) |
| 5622 | 5586 | { |
@@ -6678,8 +6642,9 @@ discard block |
||
| 6678 | 6642 | $style->addAttributesToRender($writer); |
| 6679 | 6643 | if($this->getHasAttributes()) |
| 6680 | 6644 | { |
| 6681 | - foreach($this->getAttributes() as $name=>$value) |
|
| 6682 | - $writer->addAttribute($name,$value); |
|
| 6645 | + foreach($this->getAttributes() as $name=>$value) { |
|
| 6646 | + $writer->addAttribute($name,$value); |
|
| 6647 | + } |
|
| 6683 | 6648 | } |
| 6684 | 6649 | } |
| 6685 | 6650 | public function render($writer) |
@@ -6739,8 +6704,7 @@ discard block |
||
| 6739 | 6704 | if(!isset(self::$_template[$class])) |
| 6740 | 6705 | self::$_template[$class]=$this->loadTemplate(); |
| 6741 | 6706 | return self::$_template[$class]; |
| 6742 | - } |
|
| 6743 | - else |
|
| 6707 | + } else |
|
| 6744 | 6708 | return $this->_localTemplate; |
| 6745 | 6709 | } |
| 6746 | 6710 | public function setTemplate($value) |
@@ -6814,8 +6778,7 @@ discard block |
||
| 6814 | 6778 | $controls=$placeholder->getParent()->getControls(); |
| 6815 | 6779 | $loc=$controls->remove($placeholder); |
| 6816 | 6780 | $controls->insertAt($loc,$content); |
| 6817 | - } |
|
| 6818 | - else |
|
| 6781 | + } else |
|
| 6819 | 6782 | throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id); |
| 6820 | 6783 | } |
| 6821 | 6784 | protected function initRecursive($namingContainer=null) |
@@ -6830,10 +6793,10 @@ discard block |
||
| 6830 | 6793 | $this->getControls()->clear(); |
| 6831 | 6794 | $this->getControls()->add($master); |
| 6832 | 6795 | $master->ensureChildControls(); |
| 6833 | - foreach($this->_contents as $id=>$content) |
|
| 6834 | - $master->injectContent($id,$content); |
|
| 6835 | - } |
|
| 6836 | - else if(!empty($this->_contents)) |
|
| 6796 | + foreach($this->_contents as $id=>$content) { |
|
| 6797 | + $master->injectContent($id,$content); |
|
| 6798 | + } |
|
| 6799 | + } else if(!empty($this->_contents)) |
|
| 6837 | 6800 | throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this)); |
| 6838 | 6801 | parent::initRecursive($namingContainer); |
| 6839 | 6802 | } |
@@ -6853,8 +6816,7 @@ discard block |
||
| 6853 | 6816 | $control->Checked = (boolean) $arObj->{$key}; |
| 6854 | 6817 | elseif ($control instanceof TDatePicker) |
| 6855 | 6818 | $control->Date = $arObj->{$key}; |
| 6856 | - } |
|
| 6857 | - else |
|
| 6819 | + } else |
|
| 6858 | 6820 | { |
| 6859 | 6821 | foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
| 6860 | 6822 | { |
@@ -6876,8 +6838,7 @@ discard block |
||
| 6876 | 6838 | } |
| 6877 | 6839 | break; |
| 6878 | 6840 | } |
| 6879 | - } |
|
| 6880 | - catch (Exception $ex) |
|
| 6841 | + } catch (Exception $ex) |
|
| 6881 | 6842 | { |
| 6882 | 6843 | if ($throwExceptions) |
| 6883 | 6844 | throw $ex; |
@@ -6900,8 +6861,7 @@ discard block |
||
| 6900 | 6861 | $arObj->{$key} = $control->Checked; |
| 6901 | 6862 | elseif ($control instanceof TDatePicker) |
| 6902 | 6863 | $arObj->{$key} = $control->Date; |
| 6903 | - } |
|
| 6904 | - catch (Exception $ex) |
|
| 6864 | + } catch (Exception $ex) |
|
| 6905 | 6865 | { |
| 6906 | 6866 | if ($throwExceptions) |
| 6907 | 6867 | throw $ex; |
@@ -6952,8 +6912,7 @@ discard block |
||
| 6952 | 6912 | $page->endFormRender($writer); |
| 6953 | 6913 | $cs->renderScriptFilesEnd($writer); |
| 6954 | 6914 | $cs->renderEndScripts($writer); |
| 6955 | - } |
|
| 6956 | - else |
|
| 6915 | + } else |
|
| 6957 | 6916 | { |
| 6958 | 6917 | $cs->renderHiddenFieldsBegin($writer); |
| 6959 | 6918 | $page->beginFormRender($writer); |
@@ -7059,10 +7018,11 @@ discard block |
||
| 7059 | 7018 | { |
| 7060 | 7019 | foreach (self::$_pradoScripts[$p] as $dep) |
| 7061 | 7020 | { |
| 7062 | - foreach (self::$_pradoPackages[$dep] as $script) |
|
| 7063 | - if (!isset($this->_expandedPradoScripts[$script])) |
|
| 7021 | + foreach (self::$_pradoPackages[$dep] as $script) { |
|
| 7022 | + if (!isset($this->_expandedPradoScripts[$script])) |
|
| 7064 | 7023 | { |
| 7065 | 7024 | $this->_expandedPradoScripts[$script] = true; |
| 7025 | + } |
|
| 7066 | 7026 | if($isDebug) |
| 7067 | 7027 | { |
| 7068 | 7028 | if (!in_array($url=$baseUrl.'/'.$script,$packagesUrl)) |
@@ -7084,8 +7044,9 @@ discard block |
||
| 7084 | 7044 | } |
| 7085 | 7045 | } |
| 7086 | 7046 | } |
| 7087 | - foreach($packagesUrl as $url) |
|
| 7088 | - $this->registerScriptFile($url,$url); |
|
| 7047 | + foreach($packagesUrl as $url) { |
|
| 7048 | + $this->registerScriptFile($url,$url); |
|
| 7049 | + } |
|
| 7089 | 7050 | } |
| 7090 | 7051 | } |
| 7091 | 7052 | } |
@@ -7111,8 +7072,7 @@ discard block |
||
| 7111 | 7072 | $base = $dir; |
| 7112 | 7073 | } |
| 7113 | 7074 | return array($assets->getPublishedPath($base), $assets->publishFilePath($base)); |
| 7114 | - } |
|
| 7115 | - else |
|
| 7075 | + } else |
|
| 7116 | 7076 | { |
| 7117 | 7077 | return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base); |
| 7118 | 7078 | } |
@@ -7208,9 +7168,10 @@ discard block |
||
| 7208 | 7168 | return is_array($e) ? $e[0] : $e; |
| 7209 | 7169 | }, $this->_styleSheetFiles) |
| 7210 | 7170 | ); |
| 7211 | - foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) |
|
| 7212 | - if (substr($url,strlen($url)-4)=='.css') |
|
| 7171 | + foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) { |
|
| 7172 | + if (substr($url,strlen($url)-4)=='.css') |
|
| 7213 | 7173 | $stylesheets[] = $url; |
| 7174 | + } |
|
| 7214 | 7175 | $stylesheets = array_unique($stylesheets); |
| 7215 | 7176 | return $stylesheets; |
| 7216 | 7177 | } |
@@ -7398,10 +7359,10 @@ discard block |
||
| 7398 | 7359 | $id=strtr($name,':','_'); |
| 7399 | 7360 | if(is_array($value)) |
| 7400 | 7361 | { |
| 7401 | - foreach($value as $v) |
|
| 7402 | - $str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
|
| 7403 | - } |
|
| 7404 | - else |
|
| 7362 | + foreach($value as $v) { |
|
| 7363 | + $str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
|
| 7364 | + } |
|
| 7365 | + } else |
|
| 7405 | 7366 | { |
| 7406 | 7367 | $str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
| 7407 | 7368 | } |
@@ -7510,8 +7471,7 @@ discard block |
||
| 7510 | 7471 | $this->processCallbackRequest($writer); |
| 7511 | 7472 | else |
| 7512 | 7473 | $this->processPostBackRequest($writer); |
| 7513 | - } |
|
| 7514 | - else |
|
| 7474 | + } else |
|
| 7515 | 7475 | $this->processNormalRequest($writer); |
| 7516 | 7476 | $this->_writer = null; |
| 7517 | 7477 | } |
@@ -7555,8 +7515,9 @@ discard block |
||
| 7555 | 7515 | { |
| 7556 | 7516 | if(is_array($data)) |
| 7557 | 7517 | { |
| 7558 | - foreach($data as $k=>$v) |
|
| 7559 | - $data[$k]=self::decodeUTF8($v, $enc); |
|
| 7518 | + foreach($data as $k=>$v) { |
|
| 7519 | + $data[$k]=self::decodeUTF8($v, $enc); |
|
| 7520 | + } |
|
| 7560 | 7521 | return $data; |
| 7561 | 7522 | } elseif(is_string($data)) { |
| 7562 | 7523 | return iconv('UTF-8',$enc.'//IGNORE',$data); |
@@ -7574,8 +7535,9 @@ discard block |
||
| 7574 | 7535 | $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter); |
| 7575 | 7536 | if (($g=$this->getApplication()->getGlobalization(false))!==null && |
| 7576 | 7537 | strtoupper($enc=$g->getCharset())!='UTF-8') |
| 7577 | - foreach ($this->_postData as $k=>$v) |
|
| 7578 | - $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
| 7538 | + foreach ($this->_postData as $k=>$v) { |
|
| 7539 | + $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
| 7540 | + } |
|
| 7579 | 7541 | $this->onPreInit(null); |
| 7580 | 7542 | $this->initRecursive(); |
| 7581 | 7543 | $this->onInitComplete(null); |
@@ -7642,9 +7604,10 @@ discard block |
||
| 7642 | 7604 | else |
| 7643 | 7605 | { |
| 7644 | 7606 | $list=new TList; |
| 7645 | - foreach($this->_validators as $validator) |
|
| 7646 | - if($validator->getValidationGroup()===$validationGroup) |
|
| 7607 | + foreach($this->_validators as $validator) { |
|
| 7608 | + if($validator->getValidationGroup()===$validationGroup) |
|
| 7647 | 7609 | $list->add($validator); |
| 7610 | + } |
|
| 7648 | 7611 | return $list; |
| 7649 | 7612 | } |
| 7650 | 7613 | } |
@@ -7655,10 +7618,10 @@ discard block |
||
| 7655 | 7618 | { |
| 7656 | 7619 | if($validationGroup===null) |
| 7657 | 7620 | { |
| 7658 | - foreach($this->_validators as $validator) |
|
| 7659 | - $validator->validate(); |
|
| 7660 | - } |
|
| 7661 | - else |
|
| 7621 | + foreach($this->_validators as $validator) { |
|
| 7622 | + $validator->validate(); |
|
| 7623 | + } |
|
| 7624 | + } else |
|
| 7662 | 7625 | { |
| 7663 | 7626 | foreach($this->_validators as $validator) |
| 7664 | 7627 | { |
@@ -7674,13 +7637,13 @@ discard block |
||
| 7674 | 7637 | { |
| 7675 | 7638 | if($this->_validators && $this->_validators->getCount()) |
| 7676 | 7639 | { |
| 7677 | - foreach($this->_validators as $validator) |
|
| 7678 | - if(!$validator->getIsValid()) |
|
| 7640 | + foreach($this->_validators as $validator) { |
|
| 7641 | + if(!$validator->getIsValid()) |
|
| 7679 | 7642 | return false; |
| 7643 | + } |
|
| 7680 | 7644 | } |
| 7681 | 7645 | return true; |
| 7682 | - } |
|
| 7683 | - else |
|
| 7646 | + } else |
|
| 7684 | 7647 | throw new TInvalidOperationException('page_isvalid_unknown'); |
| 7685 | 7648 | } |
| 7686 | 7649 | public function getTheme() |
@@ -7749,18 +7712,22 @@ discard block |
||
| 7749 | 7712 | $theme=$this->getTheme(); |
| 7750 | 7713 | if($theme instanceof ITheme) |
| 7751 | 7714 | { |
| 7752 | - foreach($theme->getStyleSheetFiles() as $url) |
|
| 7753 | - $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
| 7754 | - foreach($theme->getJavaScriptFiles() as $url) |
|
| 7755 | - $cs->registerHeadScriptFile($url,$url); |
|
| 7715 | + foreach($theme->getStyleSheetFiles() as $url) { |
|
| 7716 | + $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
| 7717 | + } |
|
| 7718 | + foreach($theme->getJavaScriptFiles() as $url) { |
|
| 7719 | + $cs->registerHeadScriptFile($url,$url); |
|
| 7720 | + } |
|
| 7756 | 7721 | } |
| 7757 | 7722 | $styleSheet=$this->getStyleSheetTheme(); |
| 7758 | 7723 | if($styleSheet instanceof ITheme) |
| 7759 | 7724 | { |
| 7760 | - foreach($styleSheet->getStyleSheetFiles() as $url) |
|
| 7761 | - $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
| 7762 | - foreach($styleSheet->getJavaScriptFiles() as $url) |
|
| 7763 | - $cs->registerHeadScriptFile($url,$url); |
|
| 7725 | + foreach($styleSheet->getStyleSheetFiles() as $url) { |
|
| 7726 | + $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
| 7727 | + } |
|
| 7728 | + foreach($styleSheet->getJavaScriptFiles() as $url) { |
|
| 7729 | + $cs->registerHeadScriptFile($url,$url); |
|
| 7730 | + } |
|
| 7764 | 7731 | } |
| 7765 | 7732 | if($cs->getRequiresHead() && $this->getHead()===null) |
| 7766 | 7733 | throw new TConfigurationException('page_head_required'); |
@@ -7820,8 +7787,9 @@ discard block |
||
| 7820 | 7787 | $id=is_string($control)?$control:$control->getUniqueID(); |
| 7821 | 7788 | $this->_controlsRegisteredForPostData[$id]=true; |
| 7822 | 7789 | $params=func_get_args(); |
| 7823 | - foreach($this->getCachingStack() as $item) |
|
| 7824 | - $item->registerAction('Page','registerRequiresPostData',array($id)); |
|
| 7790 | + foreach($this->getCachingStack() as $item) { |
|
| 7791 | + $item->registerAction('Page','registerRequiresPostData',array($id)); |
|
| 7792 | + } |
|
| 7825 | 7793 | } |
| 7826 | 7794 | public function getPostBackEventTarget() |
| 7827 | 7795 | { |
@@ -7865,14 +7833,12 @@ discard block |
||
| 7865 | 7833 | { |
| 7866 | 7834 | if($control->loadPostData($key,$postData)) |
| 7867 | 7835 | $this->_controlsPostDataChanged[]=$control; |
| 7868 | - } |
|
| 7869 | - else if($control instanceof IPostBackEventHandler && |
|
| 7836 | + } else if($control instanceof IPostBackEventHandler && |
|
| 7870 | 7837 | empty($this->_postData[self::FIELD_POSTBACK_TARGET])) |
| 7871 | 7838 | { |
| 7872 | 7839 | $this->_postData->add(self::FIELD_POSTBACK_TARGET,$key); } |
| 7873 | 7840 | unset($this->_controlsRequiringPostData[$key]); |
| 7874 | - } |
|
| 7875 | - else if($beforeLoad) |
|
| 7841 | + } else if($beforeLoad) |
|
| 7876 | 7842 | $this->_restPostData->add($key,$value); |
| 7877 | 7843 | } |
| 7878 | 7844 | foreach($this->_controlsRequiringPostData as $key=>$value) |
@@ -7883,8 +7849,7 @@ discard block |
||
| 7883 | 7849 | { |
| 7884 | 7850 | if($control->loadPostData($key,$this->_postData)) |
| 7885 | 7851 | $this->_controlsPostDataChanged[]=$control; |
| 7886 | - } |
|
| 7887 | - else |
|
| 7852 | + } else |
|
| 7888 | 7853 | throw new TInvalidDataValueException('page_postbackcontrol_invalid',$key); |
| 7889 | 7854 | unset($this->_controlsRequiringPostData[$key]); |
| 7890 | 7855 | } |
@@ -7897,8 +7862,9 @@ discard block |
||
| 7897 | 7862 | } |
| 7898 | 7863 | protected function raiseChangedEvents() |
| 7899 | 7864 | { |
| 7900 | - foreach($this->_controlsPostDataChanged as $control) |
|
| 7901 | - $control->raisePostDataChangedEvent(); |
|
| 7865 | + foreach($this->_controlsPostDataChanged as $control) { |
|
| 7866 | + $control->raisePostDataChangedEvent(); |
|
| 7867 | + } |
|
| 7902 | 7868 | } |
| 7903 | 7869 | protected function raisePostBackEvent() |
| 7904 | 7870 | { |
@@ -7933,8 +7899,7 @@ discard block |
||
| 7933 | 7899 | else |
| 7934 | 7900 | $focus=$this->_focus; |
| 7935 | 7901 | $this->getClientScript()->registerFocusControl($focus); |
| 7936 | - } |
|
| 7937 | - else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null) |
|
| 7902 | + } else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null) |
|
| 7938 | 7903 | $this->getClientScript()->registerFocusControl($lastFocus); |
| 7939 | 7904 | $this->_inFormRender=false; |
| 7940 | 7905 | } |
@@ -8046,8 +8011,9 @@ discard block |
||
| 8046 | 8011 | { |
| 8047 | 8012 | if($this->_cachingStack) |
| 8048 | 8013 | { |
| 8049 | - foreach($this->_cachingStack as $cache) |
|
| 8050 | - $cache->registerAction($context,$funcName,$funcParams); |
|
| 8014 | + foreach($this->_cachingStack as $cache) { |
|
| 8015 | + $cache->registerAction($context,$funcName,$funcParams); |
|
| 8016 | + } |
|
| 8051 | 8017 | } |
| 8052 | 8018 | } |
| 8053 | 8019 | public function getCachingStack() |
@@ -8100,8 +8066,7 @@ discard block |
||
| 8100 | 8066 | { |
| 8101 | 8067 | if(($str=$sm->validateData($str))!==false) |
| 8102 | 8068 | return unserialize($str); |
| 8103 | - } |
|
| 8104 | - else |
|
| 8069 | + } else |
|
| 8105 | 8070 | return unserialize($str); |
| 8106 | 8071 | } |
| 8107 | 8072 | return null; |
@@ -8142,8 +8107,7 @@ discard block |
||
| 8142 | 8107 | $this->_cache=$this->getApplication()->getModule($this->_cacheModuleID); |
| 8143 | 8108 | if(!($this->_cache instanceof ICache)) |
| 8144 | 8109 | throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID); |
| 8145 | - } |
|
| 8146 | - else |
|
| 8110 | + } else |
|
| 8147 | 8111 | $this->_cache=$this->getApplication()->getCache(); |
| 8148 | 8112 | if($this->_cache!==null) |
| 8149 | 8113 | { |
@@ -8155,8 +8119,7 @@ discard block |
||
| 8155 | 8119 | $param->setCacheTime(isset($data[3])?$data[3]:0); |
| 8156 | 8120 | $this->onCheckDependency($param); |
| 8157 | 8121 | $this->_dataCached=$param->getIsValid(); |
| 8158 | - } |
|
| 8159 | - else |
|
| 8122 | + } else |
|
| 8160 | 8123 | $this->_dataCached=false; |
| 8161 | 8124 | if($this->_dataCached) |
| 8162 | 8125 | list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data; |
@@ -8172,8 +8135,7 @@ discard block |
||
| 8172 | 8135 | $stack->push($this); |
| 8173 | 8136 | parent::initRecursive($namingContainer); |
| 8174 | 8137 | $stack->pop(); |
| 8175 | - } |
|
| 8176 | - else |
|
| 8138 | + } else |
|
| 8177 | 8139 | parent::initRecursive($namingContainer); |
| 8178 | 8140 | } |
| 8179 | 8141 | protected function loadRecursive() |
@@ -8184,8 +8146,7 @@ discard block |
||
| 8184 | 8146 | $stack->push($this); |
| 8185 | 8147 | parent::loadRecursive(); |
| 8186 | 8148 | $stack->pop(); |
| 8187 | - } |
|
| 8188 | - else |
|
| 8149 | + } else |
|
| 8189 | 8150 | { |
| 8190 | 8151 | if($this->_dataCached) |
| 8191 | 8152 | $this->performActions(); |
@@ -8214,8 +8175,7 @@ discard block |
||
| 8214 | 8175 | $stack->push($this); |
| 8215 | 8176 | parent::preRenderRecursive(); |
| 8216 | 8177 | $stack->pop(); |
| 8217 | - } |
|
| 8218 | - else |
|
| 8178 | + } else |
|
| 8219 | 8179 | parent::preRenderRecursive(); |
| 8220 | 8180 | } |
| 8221 | 8181 | protected function loadStateRecursive(&$state,$needViewState=true) |
@@ -8351,8 +8311,7 @@ discard block |
||
| 8351 | 8311 | $content=$textwriter->flush(); |
| 8352 | 8312 | $data=array($content,$this->_state,$this->_actions,time()); |
| 8353 | 8313 | $this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency()); |
| 8354 | - } |
|
| 8355 | - else |
|
| 8314 | + } else |
|
| 8356 | 8315 | parent::render($writer); |
| 8357 | 8316 | } |
| 8358 | 8317 | } |
@@ -8398,13 +8357,15 @@ discard block |
||
| 8398 | 8357 | } |
| 8399 | 8358 | public function write($s) |
| 8400 | 8359 | { |
| 8401 | - foreach($this->_writers as $writer) |
|
| 8402 | - $writer->write($s); |
|
| 8360 | + foreach($this->_writers as $writer) { |
|
| 8361 | + $writer->write($s); |
|
| 8362 | + } |
|
| 8403 | 8363 | } |
| 8404 | 8364 | public function flush() |
| 8405 | 8365 | { |
| 8406 | - foreach($this->_writers as $writer) |
|
| 8407 | - $s = $writer->flush(); |
|
| 8366 | + foreach($this->_writers as $writer) { |
|
| 8367 | + $s = $writer->flush(); |
|
| 8368 | + } |
|
| 8408 | 8369 | return $s; |
| 8409 | 8370 | } |
| 8410 | 8371 | } |
@@ -8452,13 +8413,13 @@ discard block |
||
| 8452 | 8413 | $includedFiles=$template->getIncludedFiles(); |
| 8453 | 8414 | $timestamps=array(); |
| 8454 | 8415 | $timestamps[$fileName]=filemtime($fileName); |
| 8455 | - foreach($includedFiles as $includedFile) |
|
| 8456 | - $timestamps[$includedFile]=filemtime($includedFile); |
|
| 8416 | + foreach($includedFiles as $includedFile) { |
|
| 8417 | + $timestamps[$includedFile]=filemtime($includedFile); |
|
| 8418 | + } |
|
| 8457 | 8419 | $cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName,array($template,$timestamps)); |
| 8458 | 8420 | return $template; |
| 8459 | 8421 | } |
| 8460 | - } |
|
| 8461 | - else |
|
| 8422 | + } else |
|
| 8462 | 8423 | return null; |
| 8463 | 8424 | } |
| 8464 | 8425 | protected function getLocalizedTemplate($filename) |
@@ -8569,8 +8530,9 @@ discard block |
||
| 8569 | 8530 | } |
| 8570 | 8531 | $component->trackViewState(false); |
| 8571 | 8532 | $component->applyStyleSheetSkin($page); |
| 8572 | - foreach($properties as $name=>$value) |
|
| 8573 | - $this->configureControl($component,$name,$value); |
|
| 8533 | + foreach($properties as $name=>$value) { |
|
| 8534 | + $this->configureControl($component,$name,$value); |
|
| 8535 | + } |
|
| 8574 | 8536 | $component->trackViewState(true); |
| 8575 | 8537 | if($parent===$parentControl) |
| 8576 | 8538 | $directChildren[]=$component; |
@@ -8578,8 +8540,7 @@ discard block |
||
| 8578 | 8540 | $component->createdOnTemplate($parent); |
| 8579 | 8541 | if($component->getAllowChildControls()) |
| 8580 | 8542 | $controls[$key]=$component; |
| 8581 | - } |
|
| 8582 | - else if($component instanceof TComponent) |
|
| 8543 | + } else if($component instanceof TComponent) |
|
| 8583 | 8544 | { |
| 8584 | 8545 | $controls[$key]=$component; |
| 8585 | 8546 | if(isset($properties['id'])) |
@@ -8590,15 +8551,15 @@ discard block |
||
| 8590 | 8551 | if(!$component->hasProperty('id')) |
| 8591 | 8552 | unset($properties['id']); |
| 8592 | 8553 | } |
| 8593 | - foreach($properties as $name=>$value) |
|
| 8594 | - $this->configureComponent($component,$name,$value); |
|
| 8554 | + foreach($properties as $name=>$value) { |
|
| 8555 | + $this->configureComponent($component,$name,$value); |
|
| 8556 | + } |
|
| 8595 | 8557 | if($parent===$parentControl) |
| 8596 | 8558 | $directChildren[]=$component; |
| 8597 | 8559 | else |
| 8598 | 8560 | $component->createdOnTemplate($parent); |
| 8599 | 8561 | } |
| 8600 | - } |
|
| 8601 | - else |
|
| 8562 | + } else |
|
| 8602 | 8563 | { |
| 8603 | 8564 | if($object[1] instanceof TCompositeLiteral) |
| 8604 | 8565 | { |
@@ -8608,8 +8569,7 @@ discard block |
||
| 8608 | 8569 | $directChildren[]=$o; |
| 8609 | 8570 | else |
| 8610 | 8571 | $parent->addParsedObject($o); |
| 8611 | - } |
|
| 8612 | - else |
|
| 8572 | + } else |
|
| 8613 | 8573 | { |
| 8614 | 8574 | if($parent===$parentControl) |
| 8615 | 8575 | $directChildren[]=$object[1]; |
@@ -8680,8 +8640,7 @@ discard block |
||
| 8680 | 8640 | default: throw new TConfigurationException('template_tag_unexpected',$name,$value[1]); |
| 8681 | 8641 | break; |
| 8682 | 8642 | } |
| 8683 | - } |
|
| 8684 | - else |
|
| 8643 | + } else |
|
| 8685 | 8644 | { |
| 8686 | 8645 | if (substr($name,0,2)=='js') |
| 8687 | 8646 | if ($value and !($value instanceof TJavaScriptLiteral)) |
@@ -8717,8 +8676,7 @@ discard block |
||
| 8717 | 8676 | default: throw new TConfigurationException('template_tag_unexpected',$name,$value[1]); |
| 8718 | 8677 | break; |
| 8719 | 8678 | } |
| 8720 | - } |
|
| 8721 | - else |
|
| 8679 | + } else |
|
| 8722 | 8680 | $component->setSubProperty($name,$value); |
| 8723 | 8681 | } |
| 8724 | 8682 | protected function parse($input) |
@@ -8755,8 +8713,7 @@ discard block |
||
| 8755 | 8713 | $stack[] = $type; |
| 8756 | 8714 | $container=$c-1; |
| 8757 | 8715 | } |
| 8758 | - } |
|
| 8759 | - else if(strpos($str,'</com:')===0) { |
|
| 8716 | + } else if(strpos($str,'</com:')===0) { |
|
| 8760 | 8717 | if($expectPropEnd) |
| 8761 | 8718 | continue; |
| 8762 | 8719 | if($matchStart>$textStart) |
@@ -8772,8 +8729,7 @@ discard block |
||
| 8772 | 8729 | throw new TConfigurationException('template_closingtag_expected',$tag); |
| 8773 | 8730 | } |
| 8774 | 8731 | $container=$tpl[$container][0]; |
| 8775 | - } |
|
| 8776 | - else if(strpos($str,'<%@')===0) { |
|
| 8732 | + } else if(strpos($str,'<%@')===0) { |
|
| 8777 | 8733 | if($expectPropEnd) |
| 8778 | 8734 | continue; |
| 8779 | 8735 | if($matchStart>$textStart) |
@@ -8782,8 +8738,7 @@ discard block |
||
| 8782 | 8738 | if(isset($tpl[0]) || $this->_directive!==null) |
| 8783 | 8739 | throw new TConfigurationException('template_directive_nonunique'); |
| 8784 | 8740 | $this->_directive=$this->parseAttributes($match[4][0],$match[4][1]); |
| 8785 | - } |
|
| 8786 | - else if(strpos($str,'<%')===0) { |
|
| 8741 | + } else if(strpos($str,'<%')===0) { |
|
| 8787 | 8742 | if($expectPropEnd) |
| 8788 | 8743 | continue; |
| 8789 | 8744 | if($matchStart>$textStart) |
@@ -8805,8 +8760,7 @@ discard block |
||
| 8805 | 8760 | $literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\")); |
| 8806 | 8761 | $tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')")); |
| 8807 | 8762 | } |
| 8808 | - } |
|
| 8809 | - else if(strpos($str,'<prop:')===0) { |
|
| 8763 | + } else if(strpos($str,'<prop:')===0) { |
|
| 8810 | 8764 | if(strrpos($str,'/>')===strlen($str)-2) { |
| 8811 | 8765 | if($expectPropEnd) |
| 8812 | 8766 | continue; |
@@ -8816,8 +8770,9 @@ discard block |
||
| 8816 | 8770 | $prop=strtolower($match[6][0]); |
| 8817 | 8771 | $attrs=$this->parseAttributes($match[7][0],$match[7][1]); |
| 8818 | 8772 | $attributes=array(); |
| 8819 | - foreach($attrs as $name=>$value) |
|
| 8820 | - $attributes[$prop.'.'.$name]=$value; |
|
| 8773 | + foreach($attrs as $name=>$value) { |
|
| 8774 | + $attributes[$prop.'.'.$name]=$value; |
|
| 8775 | + } |
|
| 8821 | 8776 | $type=$tpl[$container][1]; |
| 8822 | 8777 | $this->validateAttributes($type,$attributes); |
| 8823 | 8778 | foreach($attributes as $name=>$value) |
@@ -8826,8 +8781,7 @@ discard block |
||
| 8826 | 8781 | throw new TConfigurationException('template_property_duplicated',$name); |
| 8827 | 8782 | $tpl[$container][2][$name]=$value; |
| 8828 | 8783 | } |
| 8829 | - } |
|
| 8830 | - else { |
|
| 8784 | + } else { |
|
| 8831 | 8785 | $prop=strtolower($match[3][0]); |
| 8832 | 8786 | $stack[] = '@'.$prop; |
| 8833 | 8787 | if(!$expectPropEnd) |
@@ -8838,8 +8792,7 @@ discard block |
||
| 8838 | 8792 | $expectPropEnd=true; |
| 8839 | 8793 | } |
| 8840 | 8794 | } |
| 8841 | - } |
|
| 8842 | - else if(strpos($str,'</prop:')===0) { |
|
| 8795 | + } else if(strpos($str,'</prop:')===0) { |
|
| 8843 | 8796 | $prop=strtolower($match[3][0]); |
| 8844 | 8797 | if(empty($stack)) |
| 8845 | 8798 | throw new TConfigurationException('template_closingtag_unexpected',"</prop:$prop>"); |
@@ -8865,21 +8818,18 @@ discard block |
||
| 8865 | 8818 | if(isset($tpl[$container][2][$prop])) |
| 8866 | 8819 | throw new TConfigurationException('template_property_duplicated',$prop); |
| 8867 | 8820 | $tpl[$container][2][$prop]=$value; |
| 8868 | - } |
|
| 8869 | - else $this->_directive[$prop]=$value; |
|
| 8821 | + } else $this->_directive[$prop]=$value; |
|
| 8870 | 8822 | $textStart=$matchEnd+1; |
| 8871 | 8823 | } |
| 8872 | 8824 | $expectPropEnd=false; |
| 8873 | 8825 | } |
| 8874 | - } |
|
| 8875 | - else if(strpos($str,'<!--')===0) { |
|
| 8826 | + } else if(strpos($str,'<!--')===0) { |
|
| 8876 | 8827 | if($expectPropEnd) |
| 8877 | 8828 | throw new TConfigurationException('template_comments_forbidden'); |
| 8878 | 8829 | if($matchStart>$textStart) |
| 8879 | 8830 | $tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart)); |
| 8880 | 8831 | $textStart=$matchEnd+1; |
| 8881 | - } |
|
| 8882 | - else |
|
| 8832 | + } else |
|
| 8883 | 8833 | throw new TConfigurationException('template_matching_unexpected',$match); |
| 8884 | 8834 | } |
| 8885 | 8835 | if(!empty($stack)) |
@@ -8890,8 +8840,7 @@ discard block |
||
| 8890 | 8840 | } |
| 8891 | 8841 | if($textStart<strlen($input)) |
| 8892 | 8842 | $tpl[$c++]=array($container,substr($input,$textStart)); |
| 8893 | - } |
|
| 8894 | - catch(Exception $e) |
|
| 8843 | + } catch(Exception $e) |
|
| 8895 | 8844 | { |
| 8896 | 8845 | if(($e instanceof TException) && ($e instanceof TTemplateException)) |
| 8897 | 8846 | throw $e; |
@@ -8921,14 +8870,12 @@ discard block |
||
| 8921 | 8870 | { |
| 8922 | 8871 | $parent=null; |
| 8923 | 8872 | $objects[$id]=$object; |
| 8924 | - } |
|
| 8925 | - else |
|
| 8873 | + } else |
|
| 8926 | 8874 | { |
| 8927 | 8875 | $parent=$object[0]; |
| 8928 | 8876 | $merged=array($parent,array($object[1])); |
| 8929 | 8877 | } |
| 8930 | - } |
|
| 8931 | - else |
|
| 8878 | + } else |
|
| 8932 | 8879 | $merged[1][]=$object[1]; |
| 8933 | 8880 | } |
| 8934 | 8881 | if($parent!==null) |
@@ -8961,8 +8908,7 @@ discard block |
||
| 8961 | 8908 | $attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1); |
| 8962 | 8909 | else |
| 8963 | 8910 | $attributes[$name]=$this->parseTemplateProperty($value,$match[2][1]); |
| 8964 | - } |
|
| 8965 | - else |
|
| 8911 | + } else |
|
| 8966 | 8912 | { |
| 8967 | 8913 | if($value[0]==='\'' || $value[0]==='"') |
| 8968 | 8914 | $attributes[$name]=$this->parseAttribute(substr($value,1,strlen($value)-2)); |
@@ -9004,8 +8950,7 @@ discard block |
||
| 9004 | 8950 | return array(self::CONFIG_DATABIND,ltrim($expr,'.')); |
| 9005 | 8951 | else |
| 9006 | 8952 | return array(self::CONFIG_EXPRESSION,ltrim($expr,'.')); |
| 9007 | - } |
|
| 9008 | - else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value) |
|
| 8953 | + } else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value) |
|
| 9009 | 8954 | { |
| 9010 | 8955 | $value=$matches[1]; |
| 9011 | 8956 | if($value[2]==='~') |
@@ -9018,8 +8963,7 @@ discard block |
||
| 9018 | 8963 | $literal = trim(substr($value,3,strlen($value)-5)); |
| 9019 | 8964 | return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"); |
| 9020 | 8965 | } |
| 9021 | - } |
|
| 9022 | - else |
|
| 8966 | + } else |
|
| 9023 | 8967 | return $value; |
| 9024 | 8968 | } |
| 9025 | 8969 | protected function validateAttributes($type,$attributes) |
@@ -9039,15 +8983,13 @@ discard block |
||
| 9039 | 8983 | $subname=substr($name,0,$pos); |
| 9040 | 8984 | if(!$class->hasMethod('get'.$subname)) |
| 9041 | 8985 | throw new TConfigurationException('template_property_unknown',$type,$subname); |
| 9042 | - } |
|
| 9043 | - else if(strncasecmp($name,'on',2)===0) |
|
| 8986 | + } else if(strncasecmp($name,'on',2)===0) |
|
| 9044 | 8987 | { |
| 9045 | 8988 | if(!$class->hasMethod($name)) |
| 9046 | 8989 | throw new TConfigurationException('template_event_unknown',$type,$name); |
| 9047 | 8990 | else if(!is_string($att)) |
| 9048 | 8991 | throw new TConfigurationException('template_eventhandler_invalid',$type,$name); |
| 9049 | - } |
|
| 9050 | - else |
|
| 8992 | + } else |
|
| 9051 | 8993 | { |
| 9052 | 8994 | if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) ) |
| 9053 | 8995 | { |
@@ -9055,8 +8997,7 @@ discard block |
||
| 9055 | 8997 | throw new TConfigurationException('template_property_readonly',$type,$name); |
| 9056 | 8998 | else |
| 9057 | 8999 | throw new TConfigurationException('template_property_unknown',$type,$name); |
| 9058 | - } |
|
| 9059 | - else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION) |
|
| 9000 | + } else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION) |
|
| 9060 | 9001 | { |
| 9061 | 9002 | if(strcasecmp($name,'id')===0) |
| 9062 | 9003 | throw new TConfigurationException('template_controlid_invalid',$type); |
@@ -9065,8 +9006,7 @@ discard block |
||
| 9065 | 9006 | } |
| 9066 | 9007 | } |
| 9067 | 9008 | } |
| 9068 | - } |
|
| 9069 | - else if(is_subclass_of($className,'TComponent') || $className==='TComponent') |
|
| 9009 | + } else if(is_subclass_of($className,'TComponent') || $className==='TComponent') |
|
| 9070 | 9010 | { |
| 9071 | 9011 | foreach($attributes as $name=>$att) |
| 9072 | 9012 | { |
@@ -9077,8 +9017,7 @@ discard block |
||
| 9077 | 9017 | $subname=substr($name,0,$pos); |
| 9078 | 9018 | if(!$class->hasMethod('get'.$subname)) |
| 9079 | 9019 | throw new TConfigurationException('template_property_unknown',$type,$subname); |
| 9080 | - } |
|
| 9081 | - else if(strncasecmp($name,'on',2)===0) |
|
| 9020 | + } else if(strncasecmp($name,'on',2)===0) |
|
| 9082 | 9021 | throw new TConfigurationException('template_event_forbidden',$type,$name); |
| 9083 | 9022 | else |
| 9084 | 9023 | { |
@@ -9091,8 +9030,7 @@ discard block |
||
| 9091 | 9030 | } |
| 9092 | 9031 | } |
| 9093 | 9032 | } |
| 9094 | - } |
|
| 9095 | - else |
|
| 9033 | + } else |
|
| 9096 | 9034 | throw new TConfigurationException('template_component_required',$type); |
| 9097 | 9035 | } |
| 9098 | 9036 | public function getIncludedFiles() |
@@ -9112,8 +9050,7 @@ discard block |
||
| 9112 | 9050 | $line=$line-$this->_includeAtLine[$i]+1; |
| 9113 | 9051 | $srcFile=$this->_includedFiles[$i]; |
| 9114 | 9052 | break; |
| 9115 | - } |
|
| 9116 | - else |
|
| 9053 | + } else |
|
| 9117 | 9054 | $line=$line-$this->_includeLines[$i]+1; |
| 9118 | 9055 | } |
| 9119 | 9056 | } |
@@ -9299,8 +9236,7 @@ discard block |
||
| 9299 | 9236 | closedir($dir); |
| 9300 | 9237 | if($cacheValid) |
| 9301 | 9238 | $this->_skins=$skins; |
| 9302 | - } |
|
| 9303 | - else |
|
| 9239 | + } else |
|
| 9304 | 9240 | { |
| 9305 | 9241 | $cacheValid=true; |
| 9306 | 9242 | $this->_cssFiles=$cssFiles; |
@@ -9425,19 +9361,15 @@ discard block |
||
| 9425 | 9361 | { |
| 9426 | 9362 | $setter='set'.$name; |
| 9427 | 9363 | $control->$setter($value); |
| 9428 | - } |
|
| 9429 | - else |
|
| 9364 | + } else |
|
| 9430 | 9365 | throw new TConfigurationException('theme_property_readonly',$type,$name); |
| 9431 | - } |
|
| 9432 | - else |
|
| 9366 | + } else |
|
| 9433 | 9367 | throw new TConfigurationException('theme_property_undefined',$type,$name); |
| 9434 | - } |
|
| 9435 | - else $control->setSubProperty($name,$value); |
|
| 9368 | + } else $control->setSubProperty($name,$value); |
|
| 9436 | 9369 | } |
| 9437 | 9370 | } |
| 9438 | 9371 | return true; |
| 9439 | - } |
|
| 9440 | - else |
|
| 9372 | + } else |
|
| 9441 | 9373 | return false; |
| 9442 | 9374 | } |
| 9443 | 9375 | public function getStyleSheetFiles() |
@@ -9484,8 +9416,9 @@ discard block |
||
| 9484 | 9416 | protected function initPageContext($pageConfig) |
| 9485 | 9417 | { |
| 9486 | 9418 | $application=$this->getApplication(); |
| 9487 | - foreach($pageConfig->getApplicationConfigurations() as $appConfig) |
|
| 9488 | - $application->applyConfiguration($appConfig); |
|
| 9419 | + foreach($pageConfig->getApplicationConfigurations() as $appConfig) { |
|
| 9420 | + $application->applyConfiguration($appConfig); |
|
| 9421 | + } |
|
| 9489 | 9422 | $this->applyConfiguration($pageConfig); |
| 9490 | 9423 | } |
| 9491 | 9424 | protected function applyConfiguration($config) |
@@ -9530,8 +9463,7 @@ discard block |
||
| 9530 | 9463 | $pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),''); |
| 9531 | 9464 | } |
| 9532 | 9465 | $pageConfig->loadFromFiles($this->getBasePath()); |
| 9533 | - } |
|
| 9534 | - else |
|
| 9466 | + } else |
|
| 9535 | 9467 | { |
| 9536 | 9468 | $configCached=true; |
| 9537 | 9469 | $currentTimestamp=array(); |
@@ -9548,8 +9480,7 @@ discard block |
||
| 9548 | 9480 | $currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile); |
| 9549 | 9481 | if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0])) |
| 9550 | 9482 | $configCached=false; |
| 9551 | - } |
|
| 9552 | - else |
|
| 9483 | + } else |
|
| 9553 | 9484 | { |
| 9554 | 9485 | $currentTimestamp[$fileName]=@filemtime($fileName); |
| 9555 | 9486 | if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName])) |
@@ -9557,8 +9488,7 @@ discard block |
||
| 9557 | 9488 | } |
| 9558 | 9489 | } |
| 9559 | 9490 | } |
| 9560 | - } |
|
| 9561 | - else |
|
| 9491 | + } else |
|
| 9562 | 9492 | { |
| 9563 | 9493 | $configCached=false; |
| 9564 | 9494 | $paths=explode('.',$pagePath); |
@@ -9701,8 +9631,7 @@ discard block |
||
| 9701 | 9631 | $className=basename($path); |
| 9702 | 9632 | if(!class_exists($className,false)) |
| 9703 | 9633 | include_once($path.Prado::CLASS_FILE_EXT); |
| 9704 | - } |
|
| 9705 | - else |
|
| 9634 | + } else |
|
| 9706 | 9635 | { |
| 9707 | 9636 | $className=$this->getBasePageClass(); |
| 9708 | 9637 | Prado::using($className); |
@@ -9719,8 +9648,9 @@ discard block |
||
| 9719 | 9648 | } |
| 9720 | 9649 | protected function runPage($page,$properties) |
| 9721 | 9650 | { |
| 9722 | - foreach($properties as $name=>$value) |
|
| 9723 | - $page->setSubProperty($name,$value); |
|
| 9651 | + foreach($properties as $name=>$value) { |
|
| 9652 | + $page->setSubProperty($name,$value); |
|
| 9653 | + } |
|
| 9724 | 9654 | $page->run($this->getResponse()->createHtmlWriter()); |
| 9725 | 9655 | } |
| 9726 | 9656 | public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true) |
@@ -9784,8 +9714,7 @@ discard block |
||
| 9784 | 9714 | { |
| 9785 | 9715 | $fcontent = include $fname; |
| 9786 | 9716 | $this->loadFromPhp($fcontent,dirname($fname),$configPagePath); |
| 9787 | - } |
|
| 9788 | - else |
|
| 9717 | + } else |
|
| 9789 | 9718 | { |
| 9790 | 9719 | $dom=new TXmlDocument; |
| 9791 | 9720 | if($dom->loadFromFile($fname)) |
@@ -10028,8 +9957,7 @@ discard block |
||
| 10028 | 9957 | if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 10029 | 9958 | $this->copyFile($fullpath,$dst); |
| 10030 | 9959 | return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName; |
| 10031 | - } |
|
| 10032 | - else |
|
| 9960 | + } else |
|
| 10033 | 9961 | { |
| 10034 | 9962 | $dir=$this->hash($fullpath); |
| 10035 | 9963 | if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
@@ -10100,8 +10028,7 @@ discard block |
||
| 10100 | 10028 | @copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
| 10101 | 10029 | @chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD); |
| 10102 | 10030 | } |
| 10103 | - } |
|
| 10104 | - else |
|
| 10031 | + } else |
|
| 10105 | 10032 | $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
| 10106 | 10033 | } |
| 10107 | 10034 | closedir($folder); |
@@ -10230,8 +10157,7 @@ discard block |
||
| 10230 | 10157 | throw new TConfigurationException('globalization_source_path_failed', |
| 10231 | 10158 | $config['source']); |
| 10232 | 10159 | chmod($config['source'], PRADO_CHMOD); } |
| 10233 | - } |
|
| 10234 | - else |
|
| 10160 | + } else |
|
| 10235 | 10161 | { |
| 10236 | 10162 | throw new TConfigurationException("invalid source dir '{$config['source']}'"); |
| 10237 | 10163 | } |
@@ -10261,8 +10187,9 @@ discard block |
||
| 10261 | 10187 | if($culture===null) $culture = $this->getCulture(); |
| 10262 | 10188 | $variants = explode('_', $culture); |
| 10263 | 10189 | $result = array(); |
| 10264 | - for(; count($variants) > 0; array_pop($variants)) |
|
| 10265 | - $result[] = implode('_', $variants); |
|
| 10190 | + for(; count($variants) > 0; array_pop($variants)) { |
|
| 10191 | + $result[] = implode('_', $variants); |
|
| 10192 | + } |
|
| 10266 | 10193 | return $result; |
| 10267 | 10194 | } |
| 10268 | 10195 | public function getLocalizedResource($file,$culture=null) |
@@ -10270,11 +10197,13 @@ discard block |
||
| 10270 | 10197 | $files = array(); |
| 10271 | 10198 | $variants = $this->getCultureVariants($culture); |
| 10272 | 10199 | $path = pathinfo($file); |
| 10273 | - foreach($variants as $variant) |
|
| 10274 | - $files[] = $path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename']; |
|
| 10200 | + foreach($variants as $variant) { |
|
| 10201 | + $files[] = $path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename']; |
|
| 10202 | + } |
|
| 10275 | 10203 | $filename = substr($path['basename'],0,strrpos($path['basename'],'.')); |
| 10276 | - foreach($variants as $variant) |
|
| 10277 | - $files[] = $path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension']; |
|
| 10204 | + foreach($variants as $variant) { |
|
| 10205 | + $files[] = $path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension']; |
|
| 10206 | + } |
|
| 10278 | 10207 | $files[] = $file; |
| 10279 | 10208 | return $files; |
| 10280 | 10209 | } |
@@ -10362,8 +10291,7 @@ discard block |
||
| 10362 | 10291 | { |
| 10363 | 10292 | $configFile=$basePath; |
| 10364 | 10293 | $basePath=dirname($configFile); |
| 10365 | - } |
|
| 10366 | - else |
|
| 10294 | + } else |
|
| 10367 | 10295 | $configFile=null; |
| 10368 | 10296 | $runtimePath=$basePath.DIRECTORY_SEPARATOR.self::RUNTIME_PATH; |
| 10369 | 10297 | if(is_writable($runtimePath)) |
@@ -10380,8 +10308,7 @@ discard block |
||
| 10380 | 10308 | } |
| 10381 | 10309 | $this->setBasePath($basePath); |
| 10382 | 10310 | $this->setRuntimePath($runtimePath); |
| 10383 | - } |
|
| 10384 | - else |
|
| 10311 | + } else |
|
| 10385 | 10312 | throw new TConfigurationException('application_runtimepath_invalid',$runtimePath); |
| 10386 | 10313 | } |
| 10387 | 10314 | public function run() |
@@ -10402,8 +10329,7 @@ discard block |
||
| 10402 | 10329 | $this->$method(); |
| 10403 | 10330 | $this->_step++; |
| 10404 | 10331 | } |
| 10405 | - } |
|
| 10406 | - catch(Exception $e) |
|
| 10332 | + } catch(Exception $e) |
|
| 10407 | 10333 | { |
| 10408 | 10334 | $this->onError($e); |
| 10409 | 10335 | } |
@@ -10728,14 +10654,17 @@ discard block |
||
| 10728 | 10654 | { |
| 10729 | 10655 | if($config->getIsEmpty()) |
| 10730 | 10656 | return; |
| 10731 | - foreach($config->getAliases() as $alias=>$path) |
|
| 10732 | - Prado::setPathOfAlias($alias,$path); |
|
| 10733 | - foreach($config->getUsings() as $using) |
|
| 10734 | - Prado::using($using); |
|
| 10657 | + foreach($config->getAliases() as $alias=>$path) { |
|
| 10658 | + Prado::setPathOfAlias($alias,$path); |
|
| 10659 | + } |
|
| 10660 | + foreach($config->getUsings() as $using) { |
|
| 10661 | + Prado::using($using); |
|
| 10662 | + } |
|
| 10735 | 10663 | if(!$withinService) |
| 10736 | 10664 | { |
| 10737 | - foreach($config->getProperties() as $name=>$value) |
|
| 10738 | - $this->setSubProperty($name,$value); |
|
| 10665 | + foreach($config->getProperties() as $name=>$value) { |
|
| 10666 | + $this->setSubProperty($name,$value); |
|
| 10667 | + } |
|
| 10739 | 10668 | } |
| 10740 | 10669 | if(empty($this->_services)) |
| 10741 | 10670 | $this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null)); |
@@ -10744,11 +10673,11 @@ discard block |
||
| 10744 | 10673 | if(is_array($parameter)) |
| 10745 | 10674 | { |
| 10746 | 10675 | $component=Prado::createComponent($parameter[0]); |
| 10747 | - foreach($parameter[1] as $name=>$value) |
|
| 10748 | - $component->setSubProperty($name,$value); |
|
| 10676 | + foreach($parameter[1] as $name=>$value) { |
|
| 10677 | + $component->setSubProperty($name,$value); |
|
| 10678 | + } |
|
| 10749 | 10679 | $this->_parameters->add($id,$component); |
| 10750 | - } |
|
| 10751 | - else |
|
| 10680 | + } else |
|
| 10752 | 10681 | $this->_parameters->add($id,$parameter); |
| 10753 | 10682 | } |
| 10754 | 10683 | $modules=array(); |
@@ -10760,10 +10689,12 @@ discard block |
||
| 10760 | 10689 | if($module = $this->internalLoadModule($id)) |
| 10761 | 10690 | $modules[]=$module; |
| 10762 | 10691 | } |
| 10763 | - foreach($modules as $module) |
|
| 10764 | - $module[0]->init($module[1]); |
|
| 10765 | - foreach($config->getServices() as $serviceID=>$serviceConfig) |
|
| 10766 | - $this->_services[$serviceID]=$serviceConfig; |
|
| 10692 | + foreach($modules as $module) { |
|
| 10693 | + $module[0]->init($module[1]); |
|
| 10694 | + } |
|
| 10695 | + foreach($config->getServices() as $serviceID=>$serviceConfig) { |
|
| 10696 | + $this->_services[$serviceID]=$serviceConfig; |
|
| 10697 | + } |
|
| 10767 | 10698 | foreach($config->getExternalConfigurations() as $filePath=>$condition) |
| 10768 | 10699 | { |
| 10769 | 10700 | if($condition!==true) |
@@ -10789,8 +10720,7 @@ discard block |
||
| 10789 | 10720 | $config->loadFromFile($this->_configFile); |
| 10790 | 10721 | if($this->_cacheFile!==null) |
| 10791 | 10722 | file_put_contents($this->_cacheFile,serialize($config),LOCK_EX); |
| 10792 | - } |
|
| 10793 | - else |
|
| 10723 | + } else |
|
| 10794 | 10724 | $config=unserialize(file_get_contents($this->_cacheFile)); |
| 10795 | 10725 | $this->applyConfiguration($config,false); |
| 10796 | 10726 | } |
@@ -10810,8 +10740,9 @@ discard block |
||
| 10810 | 10740 | throw new THttpException(500,'application_service_unavailable',$serviceClass); |
| 10811 | 10741 | $service->setID($serviceID); |
| 10812 | 10742 | $this->setService($service); |
| 10813 | - foreach($initProperties as $name=>$value) |
|
| 10814 | - $service->setSubProperty($name,$value); |
|
| 10743 | + foreach($initProperties as $name=>$value) { |
|
| 10744 | + $service->setSubProperty($name,$value); |
|
| 10745 | + } |
|
| 10815 | 10746 | if($configElement!==null) |
| 10816 | 10747 | { |
| 10817 | 10748 | $config=new TApplicationConfiguration; |
@@ -10822,8 +10753,7 @@ discard block |
||
| 10822 | 10753 | $this->applyConfiguration($config,true); |
| 10823 | 10754 | } |
| 10824 | 10755 | $service->init($configElement); |
| 10825 | - } |
|
| 10826 | - else |
|
| 10756 | + } else |
|
| 10827 | 10757 | throw new THttpException(500,'application_service_unknown',$serviceID); |
| 10828 | 10758 | } |
| 10829 | 10759 | public function onError($param) |
@@ -10915,8 +10845,7 @@ discard block |
||
| 10915 | 10845 | { |
| 10916 | 10846 | $fcontent = include $fname; |
| 10917 | 10847 | $this->loadFromPhp($fcontent,dirname($fname)); |
| 10918 | - } |
|
| 10919 | - else |
|
| 10848 | + } else |
|
| 10920 | 10849 | { |
| 10921 | 10850 | $dom=new TXmlDocument; |
| 10922 | 10851 | $dom->loadFromFile($fname); |
@@ -11023,8 +10952,7 @@ discard block |
||
| 11023 | 10952 | if(isset($this->_aliases[$id])) |
| 11024 | 10953 | throw new TConfigurationException('appconfig_alias_redefined',$id); |
| 11025 | 10954 | $this->_aliases[$id]=$p; |
| 11026 | - } |
|
| 11027 | - else |
|
| 10955 | + } else |
|
| 11028 | 10956 | throw new TConfigurationException('appconfig_alias_invalid'); |
| 11029 | 10957 | $this->_empty=false; |
| 11030 | 10958 | break; |
@@ -11079,8 +11007,7 @@ discard block |
||
| 11079 | 11007 | else |
| 11080 | 11008 | $this->_modules[$id]=array($type,$properties->toArray(),$element); |
| 11081 | 11009 | $this->_empty=false; |
| 11082 | - } |
|
| 11083 | - else |
|
| 11010 | + } else |
|
| 11084 | 11011 | throw new TConfigurationException('appconfig_modules_invalid',$element->getTagName()); |
| 11085 | 11012 | } |
| 11086 | 11013 | } |
@@ -11112,8 +11039,7 @@ discard block |
||
| 11112 | 11039 | $element->setParent(null); |
| 11113 | 11040 | $this->_services[$id]=array($type,$properties->toArray(),$element); |
| 11114 | 11041 | $this->_empty=false; |
| 11115 | - } |
|
| 11116 | - else |
|
| 11042 | + } else |
|
| 11117 | 11043 | throw new TConfigurationException('appconfig_services_invalid',$element->getTagName()); |
| 11118 | 11044 | } |
| 11119 | 11045 | } |
@@ -11131,8 +11057,7 @@ discard block |
||
| 11131 | 11057 | $properties['id'] = $id; |
| 11132 | 11058 | $this->_parameters[$id] = array($type,$properties); |
| 11133 | 11059 | } |
| 11134 | - } |
|
| 11135 | - else |
|
| 11060 | + } else |
|
| 11136 | 11061 | { |
| 11137 | 11062 | $this->_parameters[$id] = $parameter; |
| 11138 | 11063 | } |
@@ -11153,12 +11078,10 @@ discard block |
||
| 11153 | 11078 | $this->_parameters[$id]=$element; |
| 11154 | 11079 | else |
| 11155 | 11080 | $this->_parameters[$id]=$value; |
| 11156 | - } |
|
| 11157 | - else |
|
| 11081 | + } else |
|
| 11158 | 11082 | $this->_parameters[$id]=array($type,$properties->toArray()); |
| 11159 | 11083 | $this->_empty=false; |
| 11160 | - } |
|
| 11161 | - else |
|
| 11084 | + } else |
|
| 11162 | 11085 | throw new TConfigurationException('appconfig_parameters_invalid',$element->getTagName()); |
| 11163 | 11086 | } |
| 11164 | 11087 | } |