Completed
Branch scrutinizer (4d54e2)
by Fabio
11:55
created
framework/pradolite.php 4 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -4203,10 +4203,10 @@  discard block
 block discarded – undo
4203 4203
 		{
4204 4204
 			$value=TPropertyValue::ensureEnum($value,'THttpSessionCookieMode');
4205 4205
 			if($value===THttpSessionCookieMode::None) 
4206
-      {
4206
+	  {
4207 4207
 				ini_set('session.use_cookies','0');
4208 4208
 			  ini_set('session.use_only_cookies','0');
4209
-      }
4209
+	  }
4210 4210
 			else if($value===THttpSessionCookieMode::Allow)
4211 4211
 			{
4212 4212
 				ini_set('session.use_cookies','1');
@@ -6805,77 +6805,77 @@  discard block
 block discarded – undo
6805 6805
 			throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this));
6806 6806
 		parent::initRecursive($namingContainer);
6807 6807
 	}
6808
-        public function tryToUpdateView($arObj, $throwExceptions = false)
6809
-        {
6810
-                $objAttrs = get_class_vars(get_class($arObj));
6811
-                foreach (array_keys($objAttrs) as $key)
6812
-                {
6813
-                        try
6814
-                        {
6815
-                                if ($key != "RELATIONS")
6816
-                                {
6817
-                                        $control = $this->{$key};
6818
-                                        if ($control instanceof TTextBox)
6819
-                                                $control->Text = $arObj->{$key};
6820
-                                        elseif ($control instanceof TCheckBox)
6821
-                                                $control->Checked = (boolean) $arObj->{$key};
6822
-                                        elseif ($control instanceof TDatePicker)
6823
-                                                $control->Date = $arObj->{$key};
6824
-                                }
6825
-                                else
6826
-                                {
6827
-                                        foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
6828
-                                        {
6829
-                                                $relControl = $this->{$relKey};
6830
-                                                switch ($relValues[0])
6831
-                                                {
6832
-                                                        case TActiveRecord::BELONGS_TO:
6833
-                                                        case TActiveRecord::HAS_ONE:
6834
-                                                                $relControl->Text = $arObj->{$relKey};
6835
-                                                                break;
6836
-                                                        case TActiveRecord::HAS_MANY:
6837
-                                                                if ($relControl instanceof TListControl)
6838
-                                                                {
6839
-                                                                        $relControl->DataSource = $arObj->{$relKey};
6840
-                                                                        $relControl->dataBind();
6841
-                                                                }
6842
-                                                                break;
6843
-                                                }
6844
-                                        }
6845
-                                        break;
6846
-                                }
6847
-                        } 
6848
-                        catch (Exception $ex)
6849
-                        {
6850
-                                if ($throwExceptions)
6851
-                                        throw $ex;
6852
-                        }
6853
-                }
6854
-        }
6855
-        public function tryToUpdateAR($arObj, $throwExceptions = false)
6856
-        {
6857
-                $objAttrs = get_class_vars(get_class($arObj));
6858
-                foreach (array_keys($objAttrs) as $key)
6859
-                {
6860
-                        try
6861
-                        {
6862
-                                if ($key == "RELATIONS")
6863
-                                        break;
6864
-                                $control = $this->{$key};
6865
-                                if ($control instanceof TTextBox)
6866
-                                        $arObj->{$key} = $control->Text;
6867
-                                elseif ($control instanceof TCheckBox)
6868
-                                        $arObj->{$key} = $control->Checked;
6869
-                                elseif ($control instanceof TDatePicker)
6870
-                                        $arObj->{$key} = $control->Date;
6871
-                        } 
6872
-                        catch (Exception $ex)
6873
-                        {
6874
-                                if ($throwExceptions)
6875
-                                        throw $ex;
6876
-                        }
6877
-                }
6878
-        }
6808
+		public function tryToUpdateView($arObj, $throwExceptions = false)
6809
+		{
6810
+				$objAttrs = get_class_vars(get_class($arObj));
6811
+				foreach (array_keys($objAttrs) as $key)
6812
+				{
6813
+						try
6814
+						{
6815
+								if ($key != "RELATIONS")
6816
+								{
6817
+										$control = $this->{$key};
6818
+										if ($control instanceof TTextBox)
6819
+												$control->Text = $arObj->{$key};
6820
+										elseif ($control instanceof TCheckBox)
6821
+												$control->Checked = (boolean) $arObj->{$key};
6822
+										elseif ($control instanceof TDatePicker)
6823
+												$control->Date = $arObj->{$key};
6824
+								}
6825
+								else
6826
+								{
6827
+										foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
6828
+										{
6829
+												$relControl = $this->{$relKey};
6830
+												switch ($relValues[0])
6831
+												{
6832
+														case TActiveRecord::BELONGS_TO:
6833
+														case TActiveRecord::HAS_ONE:
6834
+																$relControl->Text = $arObj->{$relKey};
6835
+																break;
6836
+														case TActiveRecord::HAS_MANY:
6837
+																if ($relControl instanceof TListControl)
6838
+																{
6839
+																		$relControl->DataSource = $arObj->{$relKey};
6840
+																		$relControl->dataBind();
6841
+																}
6842
+																break;
6843
+												}
6844
+										}
6845
+										break;
6846
+								}
6847
+						} 
6848
+						catch (Exception $ex)
6849
+						{
6850
+								if ($throwExceptions)
6851
+										throw $ex;
6852
+						}
6853
+				}
6854
+		}
6855
+		public function tryToUpdateAR($arObj, $throwExceptions = false)
6856
+		{
6857
+				$objAttrs = get_class_vars(get_class($arObj));
6858
+				foreach (array_keys($objAttrs) as $key)
6859
+				{
6860
+						try
6861
+						{
6862
+								if ($key == "RELATIONS")
6863
+										break;
6864
+								$control = $this->{$key};
6865
+								if ($control instanceof TTextBox)
6866
+										$arObj->{$key} = $control->Text;
6867
+								elseif ($control instanceof TCheckBox)
6868
+										$arObj->{$key} = $control->Checked;
6869
+								elseif ($control instanceof TDatePicker)
6870
+										$arObj->{$key} = $control->Date;
6871
+						} 
6872
+						catch (Exception $ex)
6873
+						{
6874
+								if ($throwExceptions)
6875
+										throw $ex;
6876
+						}
6877
+				}
6878
+		}
6879 6879
 }
6880 6880
 class TForm extends TControl
6881 6881
 {
@@ -7536,13 +7536,13 @@  discard block
 block discarded – undo
7536 7536
 	{
7537 7537
 		Prado::using('System.Web.UI.ActiveControls.TActivePageAdapter');
7538 7538
 		$this->setAdapter(new TActivePageAdapter($this));
7539
-        $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER);
7540
-        if(strlen($callbackEventParameter) > 0)
7541
-            $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter);
7542
-                if (($g=$this->getApplication()->getGlobalization(false))!==null &&
7543
-            strtoupper($enc=$g->getCharset())!='UTF-8')
7544
-                foreach ($this->_postData as $k=>$v)
7545
-                	$this->_postData[$k]=self::decodeUTF8($v, $enc);
7539
+		$callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER);
7540
+		if(strlen($callbackEventParameter) > 0)
7541
+			$this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter);
7542
+				if (($g=$this->getApplication()->getGlobalization(false))!==null &&
7543
+			strtoupper($enc=$g->getCharset())!='UTF-8')
7544
+				foreach ($this->_postData as $k=>$v)
7545
+					$this->_postData[$k]=self::decodeUTF8($v, $enc);
7546 7546
 		$this->onPreInit(null);
7547 7547
 		$this->initRecursive();
7548 7548
 		$this->onInitComplete(null);
@@ -9127,15 +9127,15 @@  discard block
 block discarded – undo
9127 9127
 	  $component=new ReflectionClass('TComponent');
9128 9128
 	  $behaviors=$component->getStaticProperties();
9129 9129
 	  if(!isset($behaviors['_um']))
9130
-	    return false;
9130
+		return false;
9131 9131
 	  foreach($behaviors['_um'] as $name=>$list)
9132 9132
 	  {
9133
-	    if(strtolower($class->getShortName())!==$name && !$class->isSubclassOf($name)) continue;
9134
-	    foreach($list as $param)
9135
-	    {
9136
-	      if(method_exists($param->getBehavior(),$method))
9137
-	        return true;
9138
-	    }
9133
+		if(strtolower($class->getShortName())!==$name && !$class->isSubclassOf($name)) continue;
9134
+		foreach($list as $param)
9135
+		{
9136
+		  if(method_exists($param->getBehavior(),$method))
9137
+			return true;
9138
+		}
9139 9139
 	  }
9140 9140
 	  return false;
9141 9141
 	}
Please login to merge, or discard this patch.
Doc Comments   +659 added lines patch added patch discarded remove patch
@@ -78,6 +78,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
@@ -2341,6 +2522,10 @@  discard block
 block discarded – undo
2341 2522
 	{
2342 2523
 		return $this->saveToString();
2343 2524
 	}
2525
+
2526
+	/**
2527
+	 * @param DOMElement $node
2528
+	 */
2344 2529
 	protected function buildElement($node)
2345 2530
 	{
2346 2531
 		$element=new TXmlElement($node->tagName);
@@ -2499,10 +2684,18 @@  discard block
 block discarded – undo
2499 2684
 		}
2500 2685
 		return 0;
2501 2686
 	}
2687
+
2688
+	/**
2689
+	 * @param IUser $user
2690
+	 */
2502 2691
 	private function isUserMatched($user)
2503 2692
 	{
2504 2693
 		return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()),$this->_users));
2505 2694
 	}
2695
+
2696
+	/**
2697
+	 * @param IUser $user
2698
+	 */
2506 2699
 	private function isRoleMatched($user)
2507 2700
 	{
2508 2701
 		foreach($this->_roles as $role)
@@ -2519,6 +2712,11 @@  discard block
 block discarded – undo
2519 2712
 }
2520 2713
 class TAuthorizationRuleCollection extends TList
2521 2714
 {
2715
+	/**
2716
+	 * @param IUser $user
2717
+	 * @param string $verb
2718
+	 * @param string $ip
2719
+	 */
2522 2720
 	public function isUserAllowed($user,$verb,$ip)
2523 2721
 	{
2524 2722
 		if($user instanceof IUser)
@@ -2626,6 +2824,10 @@  discard block
 block discarded – undo
2626 2824
 	{
2627 2825
 		$this->_cryptAlgorithm = $value;
2628 2826
 	}
2827
+
2828
+	/**
2829
+	 * @param string $data
2830
+	 */
2629 2831
 	public function encrypt($data)
2630 2832
 	{
2631 2833
 		$module=$this->openCryptModule();
@@ -2638,6 +2840,10 @@  discard block
 block discarded – undo
2638 2840
 		mcrypt_module_close($module);
2639 2841
 		return $encrypted;
2640 2842
 	}
2843
+
2844
+	/**
2845
+	 * @param string $data
2846
+	 */
2641 2847
 	public function decrypt($data)
2642 2848
 	{
2643 2849
 		$module=$this->openCryptModule();
@@ -2699,6 +2905,11 @@  discard block
 block discarded – undo
2699 2905
 	{
2700 2906
 		return $this->_mbstring ? mb_strlen($string,'8bit') : strlen($string);
2701 2907
 	}
2908
+
2909
+	/**
2910
+	 * @param integer $start
2911
+	 * @param integer $length
2912
+	 */
2702 2913
 	private function substr($string,$start,$length)
2703 2914
 	{
2704 2915
 		return $this->_mbstring ? mb_substr($string,$start,$length,'8bit') : substr($string,$start,$length);
@@ -2858,6 +3069,10 @@  discard block
 block discarded – undo
2858 3069
 		self::checkJsonError();
2859 3070
 		return $s;
2860 3071
 	}
3072
+
3073
+	/**
3074
+	 * @param string $sourceEncoding
3075
+	 */
2861 3076
 	private static function convertToUtf8(&$value, $sourceEncoding) {
2862 3077
 		if(is_string($value))
2863 3078
 			$value=iconv($sourceEncoding, 'UTF-8', $value);
@@ -2867,6 +3082,10 @@  discard block
 block discarded – undo
2867 3082
 				self::convertToUtf8($element, $sourceEncoding);
2868 3083
 		}
2869 3084
 	}
3085
+
3086
+	/**
3087
+	 * @param string $value
3088
+	 */
2870 3089
 	public static function jsonDecode($value, $assoc = false, $depth = 512)
2871 3090
 	{
2872 3091
 		$s= @json_decode($value, $assoc, $depth);
@@ -2901,6 +3120,10 @@  discard block
 block discarded – undo
2901 3120
 		}
2902 3121
 		throw new Exception("JSON error ($err): $msg");
2903 3122
 	}
3123
+
3124
+	/**
3125
+	 * @param string $code
3126
+	 */
2904 3127
 	public static function JSMin($code)
2905 3128
 	{
2906 3129
 		Prado::using('System.Web.Javascripts.JSMin');
@@ -3088,6 +3311,10 @@  discard block
 block discarded – undo
3088 3311
 	{
3089 3312
 		return $this->getID();
3090 3313
 	}
3314
+
3315
+	/**
3316
+	 * @param TUrlManager $manager
3317
+	 */
3091 3318
 	protected function cacheUrlManager($manager)
3092 3319
 	{
3093 3320
 		if($this->getEnableCache())
@@ -3337,6 +3564,10 @@  discard block
 block discarded – undo
3337 3564
 	{
3338 3565
 		return $_ENV;
3339 3566
 	}
3567
+
3568
+	/**
3569
+	 * @param string $serviceID
3570
+	 */
3340 3571
 	public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=true,$encodeGetItems=true)
3341 3572
 	{
3342 3573
 		if ($this->_cookieOnly===null)
@@ -3457,6 +3688,10 @@  discard block
 block discarded – undo
3457 3688
 class THttpCookieCollection extends TList
3458 3689
 {
3459 3690
 	private $_o;
3691
+
3692
+	/**
3693
+	 * @param THttpResponse $owner
3694
+	 */
3460 3695
 	public function __construct($owner=null)
3461 3696
 	{
3462 3697
 		$this->_o=$owner;
@@ -3520,6 +3755,10 @@  discard block
 block discarded – undo
3520 3755
 	{
3521 3756
 		return $this->_expire;
3522 3757
 	}
3758
+
3759
+	/**
3760
+	 * @param integer $value
3761
+	 */
3523 3762
 	public function setExpire($value)
3524 3763
 	{
3525 3764
 		$this->_expire=TPropertyValue::ensureInteger($value);
@@ -3586,6 +3825,10 @@  discard block
 block discarded – undo
3586 3825
 	private $_query;
3587 3826
 	private $_fragment;
3588 3827
 	private $_uri;
3828
+
3829
+	/**
3830
+	 * @param string $uri
3831
+	 */
3589 3832
 	public function __construct($uri)
3590 3833
 	{
3591 3834
 		if(($ret=@parse_url($uri))!==false)
@@ -3651,6 +3894,10 @@  discard block
 block discarded – undo
3651 3894
 class THttpResponseAdapter extends TApplicationComponent
3652 3895
 {
3653 3896
 	private $_response;
3897
+
3898
+	/**
3899
+	 * @param THttpResponse $response
3900
+	 */
3654 3901
 	public function __construct($response)
3655 3902
 	{
3656 3903
 		$this->_response=$response;
@@ -3746,6 +3993,10 @@  discard block
 block discarded – undo
3746 3993
 	{
3747 3994
 		return $this->_charset;
3748 3995
 	}
3996
+
3997
+	/**
3998
+	 * @param string $charset
3999
+	 */
3749 4000
 	public function setCharset($charset)
3750 4001
 	{
3751 4002
 		$this->_charset = (strToLower($charset) === 'false') ? false : (string)$charset;
@@ -3969,6 +4220,10 @@  discard block
 block discarded – undo
3969 4220
 			return array_change_key_case($result, $case);
3970 4221
 		return $result;
3971 4222
 	}
4223
+
4224
+	/**
4225
+	 * @param string $value
4226
+	 */
3972 4227
 	public function appendHeader($value, $replace=true)
3973 4228
 	{
3974 4229
 		header($value, $replace);
@@ -3977,6 +4232,10 @@  discard block
 block discarded – undo
3977 4232
 	{
3978 4233
 		error_log($message,$messageType,$destination,$extraHeaders);
3979 4234
 	}
4235
+
4236
+	/**
4237
+	 * @param THttpCookie $cookie
4238
+	 */
3980 4239
 	public function addCookie($cookie)
3981 4240
 	{
3982 4241
 		$request=$this->getRequest();
@@ -4034,6 +4293,10 @@  discard block
 block discarded – undo
4034 4293
 		else
4035 4294
 			return $this->createNewHtmlWriter($type, $this);
4036 4295
 	}
4296
+
4297
+	/**
4298
+	 * @param THttpResponse $writer
4299
+	 */
4037 4300
 	public function createNewHtmlWriter($type, $writer)
4038 4301
 	{
4039 4302
 		return Prado::createComponent($type, $writer);
@@ -4143,6 +4406,10 @@  discard block
 block discarded – undo
4143 4406
 	{
4144 4407
 		return $this->_customStorage;
4145 4408
 	}
4409
+
4410
+	/**
4411
+	 * @param boolean $value
4412
+	 */
4146 4413
 	public function setUseCustomStorage($value)
4147 4414
 	{
4148 4415
 		$this->_customStorage=TPropertyValue::ensureBoolean($value);
@@ -4285,10 +4552,18 @@  discard block
 block discarded – undo
4285 4552
 	{
4286 4553
 		return array_keys($_SESSION);
4287 4554
 	}
4555
+
4556
+	/**
4557
+	 * @param string $key
4558
+	 */
4288 4559
 	public function itemAt($key)
4289 4560
 	{
4290 4561
 		return isset($_SESSION[$key]) ? $_SESSION[$key] : null;
4291 4562
 	}
4563
+
4564
+	/**
4565
+	 * @param string $key
4566
+	 */
4292 4567
 	public function add($key,$value)
4293 4568
 	{
4294 4569
 		$_SESSION[$key]=$value;
@@ -4395,6 +4670,10 @@  discard block
 block discarded – undo
4395 4670
 	{
4396 4671
 		return $this->_caseSensitive;
4397 4672
 	}
4673
+
4674
+	/**
4675
+	 * @param boolean $value
4676
+	 */
4398 4677
 	public function setCaseSensitive($value)
4399 4678
 	{
4400 4679
 		$this->_caseSensitive=TPropertyValue::ensureBoolean($value);
@@ -4407,6 +4686,10 @@  discard block
 block discarded – undo
4407 4686
 	{
4408 4687
 		parent::add($this->_caseSensitive?$key:strtolower($key),$value);
4409 4688
 	}
4689
+
4690
+	/**
4691
+	 * @param string $key
4692
+	 */
4410 4693
 	public function remove($key)
4411 4694
 	{
4412 4695
 		return parent::remove($this->_caseSensitive?$key:strtolower($key));
@@ -4557,6 +4840,10 @@  discard block
 block discarded – undo
4557 4840
 		}
4558 4841
 		return $this->_page;
4559 4842
 	}
4843
+
4844
+	/**
4845
+	 * @param TPage $page
4846
+	 */
4560 4847
 	public function setPage($page)
4561 4848
 	{
4562 4849
 		$this->_page=$page;
@@ -4700,6 +4987,10 @@  discard block
 block discarded – undo
4700 4987
 		else
4701 4988
 			return $this->getViewState('Visible',true);
4702 4989
 	}
4990
+
4991
+	/**
4992
+	 * @param boolean $value
4993
+	 */
4703 4994
 	public function setVisible($value)
4704 4995
 	{
4705 4996
 		$this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true);
@@ -4738,6 +5029,10 @@  discard block
 block discarded – undo
4738 5029
 			return $attributes;
4739 5030
 		}
4740 5031
 	}
5032
+
5033
+	/**
5034
+	 * @param string $name
5035
+	 */
4741 5036
 	public function hasAttribute($name)
4742 5037
 	{
4743 5038
 		if($attributes=$this->getViewState('Attributes',null))
@@ -4745,6 +5040,10 @@  discard block
 block discarded – undo
4745 5040
 		else
4746 5041
 			return false;
4747 5042
 	}
5043
+
5044
+	/**
5045
+	 * @param string $name
5046
+	 */
4748 5047
 	public function getAttribute($name)
4749 5048
 	{
4750 5049
 		if($attributes=$this->getViewState('Attributes',null))
@@ -4752,6 +5051,10 @@  discard block
 block discarded – undo
4752 5051
 		else
4753 5052
 			return null;
4754 5053
 	}
5054
+
5055
+	/**
5056
+	 * @param string $name
5057
+	 */
4755 5058
 	public function setAttribute($name,$value)
4756 5059
 	{
4757 5060
 		$this->getAttributes()->add($name,$value);
@@ -4775,6 +5078,10 @@  discard block
 block discarded – undo
4775 5078
 		else
4776 5079
 			return !($this->_flags & self::IS_DISABLE_VIEWSTATE);
4777 5080
 	}
5081
+
5082
+	/**
5083
+	 * @param boolean $value
5084
+	 */
4778 5085
 	public function setEnableViewState($value)
4779 5086
 	{
4780 5087
 		if(TPropertyValue::ensureBoolean($value))
@@ -4782,10 +5089,20 @@  discard block
 block discarded – undo
4782 5089
 		else
4783 5090
 			$this->_flags |= self::IS_DISABLE_VIEWSTATE;
4784 5091
 	}
5092
+
5093
+	/**
5094
+	 * @param string $key
5095
+	 * @param integer $defaultValue
5096
+	 */
4785 5097
 	protected function getControlState($key,$defaultValue=null)
4786 5098
 	{
4787 5099
 		return isset($this->_rf[self::RF_CONTROLSTATE][$key])?$this->_rf[self::RF_CONTROLSTATE][$key]:$defaultValue;
4788 5100
 	}
5101
+
5102
+	/**
5103
+	 * @param string $key
5104
+	 * @param integer $defaultValue
5105
+	 */
4789 5106
 	protected function setControlState($key,$value,$defaultValue=null)
4790 5107
 	{
4791 5108
 		if($value===$defaultValue)
@@ -4797,6 +5114,10 @@  discard block
 block discarded – undo
4797 5114
 	{
4798 5115
 		unset($this->_rf[self::RF_CONTROLSTATE][$key]);
4799 5116
 	}
5117
+
5118
+	/**
5119
+	 * @param boolean $enabled
5120
+	 */
4800 5121
 	public function trackViewState($enabled)
4801 5122
 	{
4802 5123
 		$this->_trackViewState=TPropertyValue::ensureBoolean($enabled);
@@ -4814,6 +5135,10 @@  discard block
 block discarded – undo
4814 5135
 		else
4815 5136
 			return $defaultValue;
4816 5137
 	}
5138
+
5139
+	/**
5140
+	 * @param string $key
5141
+	 */
4817 5142
 	public function setViewState($key,$value,$defaultValue=null)
4818 5143
 	{
4819 5144
 		if($this->_trackViewState)
@@ -4833,6 +5158,10 @@  discard block
 block discarded – undo
4833 5158
 				$this->_tempState[$key]=$value;
4834 5159
 		}
4835 5160
 	}
5161
+
5162
+	/**
5163
+	 * @param string $key
5164
+	 */
4836 5165
 	public function clearViewState($key)
4837 5166
 	{
4838 5167
 		unset($this->_viewState[$key]);
@@ -4889,6 +5218,10 @@  discard block
 block discarded – undo
4889 5218
 	{
4890 5219
 		return ($this->_flags & self::IS_CHILD_CREATED)!==0;
4891 5220
 	}
5221
+
5222
+	/**
5223
+	 * @param boolean $value
5224
+	 */
4892 5225
 	final protected function setChildControlsCreated($value)
4893 5226
 	{
4894 5227
 		if($value)
@@ -4948,6 +5281,10 @@  discard block
 block discarded – undo
4948 5281
 				return null;
4949 5282
 		}
4950 5283
 	}
5284
+
5285
+	/**
5286
+	 * @param string $type
5287
+	 */
4951 5288
 	public function findControlsByType($type,$strict=true)
4952 5289
 	{
4953 5290
 		$controls=array();
@@ -4985,6 +5322,10 @@  discard block
 block discarded – undo
4985 5322
 		unset($this->_rf[self::RF_NAMED_CONTROLS_ID]);
4986 5323
 		$this->clearNameTable();
4987 5324
 	}
5325
+
5326
+	/**
5327
+	 * @param TCheckBox $object
5328
+	 */
4988 5329
 	public function registerObject($name,$object)
4989 5330
 	{
4990 5331
 		if(isset($this->_rf[self::RF_NAMED_OBJECTS][$name]))
@@ -5019,6 +5360,10 @@  discard block
 block discarded – undo
5019 5360
 	{
5020 5361
 		return $this->getControlStage() >= self::CS_PRERENDERED;
5021 5362
 	}
5363
+
5364
+	/**
5365
+	 * @param string $name
5366
+	 */
5022 5367
 	public function getRegisteredObject($name)
5023 5368
 	{
5024 5369
 		return isset($this->_rf[self::RF_NAMED_OBJECTS][$name])?$this->_rf[self::RF_NAMED_OBJECTS][$name]:null;
@@ -5042,6 +5387,10 @@  discard block
 block discarded – undo
5042 5387
 			$control=$control->_parent;
5043 5388
 		return $control===$ancestor;
5044 5389
 	}
5390
+
5391
+	/**
5392
+	 * @param TControl $control
5393
+	 */
5045 5394
 	public function addedControl($control)
5046 5395
 	{
5047 5396
 		if($control->_parent)
@@ -5080,6 +5429,10 @@  discard block
 block discarded – undo
5080 5429
 			}
5081 5430
 		}
5082 5431
 	}
5432
+
5433
+	/**
5434
+	 * @param TControl $control
5435
+	 */
5083 5436
 	public function removedControl($control)
5084 5437
 	{
5085 5438
 		if($this->_namingContainer)
@@ -5225,6 +5578,10 @@  discard block
 block discarded – undo
5225 5578
 		$rootControl=(($page=$this->getPage())===null)?$this:$page;
5226 5579
 		$rootControl->broadcastEventInternal($name,$sender,new TBroadcastEventParameter($name,$param));
5227 5580
 	}
5581
+
5582
+	/**
5583
+	 * @param TBroadcastEventParameter $param
5584
+	 */
5228 5585
 	private function broadcastEventInternal($name,$sender,$param)
5229 5586
 	{
5230 5587
 		if($this->hasEvent($name))
@@ -5370,6 +5727,10 @@  discard block
 block discarded – undo
5370 5727
 		else if($this->_flags & self::IS_STYLESHEET_APPLIED)
5371 5728
 			throw new TInvalidOperationException('control_stylesheet_applied',get_class($this));
5372 5729
 	}
5730
+
5731
+	/**
5732
+	 * @param boolean $recursive
5733
+	 */
5373 5734
 	private function clearCachedUniqueID($recursive)
5374 5735
 	{
5375 5736
 		if($recursive && $this->_uid!==null && isset($this->_rf[self::RF_CONTROLS]))
@@ -5393,6 +5754,10 @@  discard block
 block discarded – undo
5393 5754
 	{
5394 5755
 		unset($this->_rf[self::RF_NAMED_CONTROLS]);
5395 5756
 	}
5757
+
5758
+	/**
5759
+	 * @param TControl $container
5760
+	 */
5396 5761
 	private function fillNameTable($container,$controls)
5397 5762
 	{
5398 5763
 		foreach($controls as $control)
@@ -5465,11 +5830,18 @@  discard block
 block discarded – undo
5465 5830
 }
5466 5831
 interface IPostBackEventHandler
5467 5832
 {
5833
+	/**
5834
+	 * @return void
5835
+	 */
5468 5836
 	public function raisePostBackEvent($param);
5469 5837
 }
5470 5838
 interface IPostBackDataHandler
5471 5839
 {
5472 5840
 	public function loadPostData($key,$values);
5841
+
5842
+	/**
5843
+	 * @return void
5844
+	 */
5473 5845
 	public function raisePostDataChangedEvent();
5474 5846
 	public function getDataChanged();
5475 5847
 }
@@ -5477,8 +5849,16 @@  discard block
 block discarded – undo
5477 5849
 {
5478 5850
 	public function validate();
5479 5851
 	public function getIsValid();
5852
+
5853
+	/**
5854
+	 * @return void
5855
+	 */
5480 5856
 	public function setIsValid($value);
5481 5857
 	public function getErrorMessage();
5858
+
5859
+	/**
5860
+	 * @return void
5861
+	 */
5482 5862
 	public function setErrorMessage($value);
5483 5863
 }
5484 5864
 interface IValidatable
@@ -5493,26 +5873,66 @@  discard block
 block discarded – undo
5493 5873
 }
5494 5874
 interface ITheme
5495 5875
 {
5876
+	/**
5877
+	 * @return boolean
5878
+	 */
5496 5879
 	public function applySkin($control);
5497 5880
 }
5498 5881
 interface ITemplate
5499 5882
 {
5883
+	/**
5884
+	 * @return void
5885
+	 */
5500 5886
 	public function instantiateIn($parent);
5501 5887
 }
5502 5888
 interface IButtonControl
5503 5889
 {
5504 5890
 	public function getText();
5891
+
5892
+	/**
5893
+	 * @param string $value
5894
+	 *
5895
+	 * @return void
5896
+	 */
5505 5897
 	public function setText($value);
5506 5898
 	public function getCausesValidation();
5899
+
5900
+	/**
5901
+	 * @return void
5902
+	 */
5507 5903
 	public function setCausesValidation($value);
5508 5904
 	public function getCommandName();
5905
+
5906
+	/**
5907
+	 * @return void
5908
+	 */
5509 5909
 	public function setCommandName($value);
5510 5910
 	public function getCommandParameter();
5911
+
5912
+	/**
5913
+	 * @return void
5914
+	 */
5511 5915
 	public function setCommandParameter($value);
5512 5916
 	public function getValidationGroup();
5917
+
5918
+	/**
5919
+	 * @return void
5920
+	 */
5513 5921
 	public function setValidationGroup($value);
5922
+
5923
+	/**
5924
+	 * @return void
5925
+	 */
5514 5926
 	public function onClick($param);
5927
+
5928
+	/**
5929
+	 * @return void
5930
+	 */
5515 5931
 	public function onCommand($param);
5932
+
5933
+	/**
5934
+	 * @return void
5935
+	 */
5516 5936
 	public function setIsDefaultButton($value);
5517 5937
 	public function getIsDefaultButton();
5518 5938
 }
@@ -5970,6 +6390,10 @@  discard block
 block discarded – undo
5970 6390
 	{
5971 6391
 		return $this->_customStyle===null?'':$this->_customStyle;
5972 6392
 	}
6393
+
6394
+	/**
6395
+	 * @param string $value
6396
+	 */
5973 6397
 	public function setCustomStyle($value)
5974 6398
 	{
5975 6399
 		$this->_customStyle=$value;
@@ -5978,6 +6402,11 @@  discard block
 block discarded – undo
5978 6402
 	{
5979 6403
 		return isset($this->_fields[$name])?$this->_fields[$name]:'';
5980 6404
 	}
6405
+
6406
+	/**
6407
+	 * @param string $name
6408
+	 * @param string $value
6409
+	 */
5981 6410
 	public function setStyleField($name,$value)
5982 6411
 	{
5983 6412
 		$this->_fields[$name]=$value;
@@ -6473,6 +6902,10 @@  discard block
 block discarded – undo
6473 6902
 {
6474 6903
 	private $_ensureid=false;
6475 6904
 	protected $_decorator;
6905
+
6906
+	/**
6907
+	 * @param boolean $value
6908
+	 */
6476 6909
 	public function setEnsureId($value)
6477 6910
 	{
6478 6911
 		$this->_ensureid |= TPropertyValue::ensureBoolean($value);
@@ -6562,6 +6995,10 @@  discard block
 block discarded – undo
6562 6995
 		else
6563 6996
 			return '';
6564 6997
 	}
6998
+
6999
+	/**
7000
+	 * @param string $value
7001
+	 */
6565 7002
 	public function setForeColor($value)
6566 7003
 	{
6567 7004
 		$this->getStyle()->setForeColor($value);
@@ -6592,6 +7029,10 @@  discard block
 block discarded – undo
6592 7029
 		else
6593 7030
 			return '';
6594 7031
 	}
7032
+
7033
+	/**
7034
+	 * @param string $value
7035
+	 */
6595 7036
 	public function setHeight($value)
6596 7037
 	{
6597 7038
 		$this->getStyle()->setHeight($value);
@@ -6653,6 +7094,10 @@  discard block
 block discarded – undo
6653 7094
 		else
6654 7095
 			return '';
6655 7096
 	}
7097
+
7098
+	/**
7099
+	 * @param string $value
7100
+	 */
6656 7101
 	public function setWidth($value)
6657 7102
 	{
6658 7103
 		$this->getStyle()->setWidth($value);
@@ -6780,6 +7225,10 @@  discard block
 block discarded – undo
6780 7225
 			$tpl->instantiateIn($this);
6781 7226
 		}
6782 7227
 	}
7228
+
7229
+	/**
7230
+	 * @param string $id
7231
+	 */
6783 7232
 	public function registerContent($id,TContent $object)
6784 7233
 	{
6785 7234
 		if(isset($this->_contents[$id]))
@@ -6787,6 +7236,10 @@  discard block
 block discarded – undo
6787 7236
 		else
6788 7237
 			$this->_contents[$id]=$object;
6789 7238
 	}
7239
+
7240
+	/**
7241
+	 * @param string $id
7242
+	 */
6790 7243
 	public function registerContentPlaceHolder($id,TContentPlaceHolder $object)
6791 7244
 	{
6792 7245
 		if(isset($this->_placeholders[$id]))
@@ -6983,6 +7436,10 @@  discard block
 block discarded – undo
6983 7436
 	{
6984 7437
 		return $this->getViewState('Enctype','');
6985 7438
 	}
7439
+
7440
+	/**
7441
+	 * @param string $value
7442
+	 */
6986 7443
 	public function setEnctype($value)
6987 7444
 	{
6988 7445
 		$this->setViewState('Enctype',$value,'');
@@ -7102,6 +7559,10 @@  discard block
 block discarded – undo
7102 7559
 		$scripts = array_unique($scripts);
7103 7560
 		return $scripts;
7104 7561
 	}
7562
+
7563
+	/**
7564
+	 * @param string $base
7565
+	 */
7105 7566
 	protected function getPackagePathUrl($base)
7106 7567
 	{
7107 7568
 		$assets = Prado::getApplication()->getAssetManager();
@@ -7251,6 +7712,11 @@  discard block
 block discarded – undo
7251 7712
 		$params=func_get_args();
7252 7713
 		$this->_page->registerCachingAction('Page.ClientScript','registerEndScript',$params);
7253 7714
 	}
7715
+
7716
+	/**
7717
+	 * @param string $name
7718
+	 * @param string $value
7719
+	 */
7254 7720
 	public function registerHiddenField($name,$value)
7255 7721
 	{
7256 7722
 		$this->_hiddenFields[$name]=$value;
@@ -7388,6 +7854,10 @@  discard block
 block discarded – undo
7388 7854
 			$this->renderAllPendingScriptFiles($writer);
7389 7855
 		}
7390 7856
 	}
7857
+
7858
+	/**
7859
+	 * @param boolean $initial
7860
+	 */
7391 7861
 	protected function renderHiddenFieldsInt($writer, $initial)
7392 7862
  	{
7393 7863
 		if ($initial) $this->_renderedHiddenFields = array();
@@ -7423,12 +7893,20 @@  discard block
 block discarded – undo
7423 7893
 abstract class TClientSideOptions extends TComponent
7424 7894
 {
7425 7895
 	private $_options;
7896
+
7897
+	/**
7898
+	 * @param string $name
7899
+	 */
7426 7900
 	protected function setFunction($name, $code)
7427 7901
 	{
7428 7902
 		if(!TJavaScript::isJsLiteral($code))
7429 7903
 			$code = TJavaScript::quoteJsLiteral($this->ensureFunction($code));
7430 7904
 		$this->setOption($name, $code);
7431 7905
 	}
7906
+
7907
+	/**
7908
+	 * @param string $name
7909
+	 */
7432 7910
 	protected function getOption($name)
7433 7911
 	{
7434 7912
 		if ($this->_options)
@@ -7551,6 +8029,10 @@  discard block
 block discarded – undo
7551 8029
 		$this->renderControl($writer);
7552 8030
 		$this->unloadRecursive();
7553 8031
 	}
8032
+
8033
+	/**
8034
+	 * @param string $enc
8035
+	 */
7554 8036
 	protected static function decodeUTF8($data, $enc)
7555 8037
 	{
7556 8038
 		if(is_array($data))
@@ -7633,6 +8115,10 @@  discard block
 block discarded – undo
7633 8115
 		else
7634 8116
 			throw new TInvalidOperationException('page_form_duplicated');
7635 8117
 	}
8118
+
8119
+	/**
8120
+	 * @param string $validationGroup
8121
+	 */
7636 8122
 	public function getValidators($validationGroup=null)
7637 8123
 	{
7638 8124
 		if(!$this->_validators)
@@ -7703,6 +8189,10 @@  discard block
 block discarded – undo
7703 8189
 	{
7704 8190
 		$this->_styleSheet=empty($value)?null:$value;
7705 8191
 	}
8192
+
8193
+	/**
8194
+	 * @param TControl $control
8195
+	 */
7706 8196
 	public function applyControlSkin($control)
7707 8197
 	{
7708 8198
 		if(($theme=$this->getTheme())!==null)
@@ -7850,6 +8340,10 @@  discard block
 block discarded – undo
7850 8340
 	{
7851 8341
 		$this->_postBackEventParameter=$value;
7852 8342
 	}
8343
+
8344
+	/**
8345
+	 * @param boolean $beforeLoad
8346
+	 */
7853 8347
 	protected function processPostData($postData,$beforeLoad)
7854 8348
 	{
7855 8349
 		$this->_isLoadingPostData=true;
@@ -7938,6 +8432,10 @@  discard block
 block discarded – undo
7938 8432
 			$this->getClientScript()->registerFocusControl($lastFocus);
7939 8433
 		$this->_inFormRender=false;
7940 8434
 	}
8435
+
8436
+	/**
8437
+	 * @param TControl $value
8438
+	 */
7941 8439
 	public function setFocus($value)
7942 8440
 	{
7943 8441
 		$this->_focus=$value;
@@ -7983,6 +8481,10 @@  discard block
 block discarded – undo
7983 8481
 	{
7984 8482
 		return $this->_clientState;
7985 8483
 	}
8484
+
8485
+	/**
8486
+	 * @param string $state
8487
+	 */
7986 8488
 	public function setClientState($state)
7987 8489
 	{
7988 8490
 		$this->_clientState=$state;
@@ -8042,6 +8544,11 @@  discard block
 block discarded – undo
8042 8544
 	{
8043 8545
 		$this->_pagePath=$value;
8044 8546
 	}
8547
+
8548
+	/**
8549
+	 * @param string $context
8550
+	 * @param string $funcName
8551
+	 */
8045 8552
 	public function registerCachingAction($context,$funcName,$funcParams)
8046 8553
 	{
8047 8554
 		if($this->_cachingStack)
@@ -8064,13 +8571,27 @@  discard block
 block discarded – undo
8064 8571
 }
8065 8572
 interface IPageStatePersister
8066 8573
 {
8574
+	/**
8575
+	 * @return TPage
8576
+	 */
8067 8577
 	public function getPage();
8578
+
8579
+	/**
8580
+	 * @return void
8581
+	 */
8068 8582
 	public function setPage(TPage $page);
8583
+
8584
+	/**
8585
+	 * @return void
8586
+	 */
8069 8587
 	public function save($state);
8070 8588
 	public function load();
8071 8589
 }
8072 8590
 class TPageStateFormatter
8073 8591
 {
8592
+	/**
8593
+	 * @param TPage $page
8594
+	 */
8074 8595
 	public static function serialize($page,$data)
8075 8596
 	{
8076 8597
 		$sm=$page->getApplication()->getSecurityManager();
@@ -8084,6 +8605,10 @@  discard block
 block discarded – undo
8084 8605
 			$str=$sm->encrypt($str);
8085 8606
 		return base64_encode($str);
8086 8607
 	}
8608
+
8609
+	/**
8610
+	 * @param TPage $page
8611
+	 */
8087 8612
 	public static function unserialize($page,$data)
8088 8613
 	{
8089 8614
 		$str=base64_decode($data);
@@ -8277,6 +8802,10 @@  discard block
 block discarded – undo
8277 8802
 	{
8278 8803
 		$this->_cacheModuleID=$value;
8279 8804
 	}
8805
+
8806
+	/**
8807
+	 * @param string $value
8808
+	 */
8280 8809
 	public function setCacheKeyPrefix($value)
8281 8810
 	{
8282 8811
 		$this->_keyPrefix=$value;
@@ -8327,10 +8856,18 @@  discard block
 block discarded – undo
8327 8856
 	{
8328 8857
 		$this->_cachePostBack=TPropertyValue::ensureBoolean($value);
8329 8858
 	}
8859
+
8860
+	/**
8861
+	 * @param TOutputCacheCheckDependencyEventParameter $param
8862
+	 */
8330 8863
 	public function onCheckDependency($param)
8331 8864
 	{
8332 8865
 		$this->raiseEvent('OnCheckDependency',$this,$param);
8333 8866
 	}
8867
+
8868
+	/**
8869
+	 * @param TOutputCacheCalculateKeyEventParameter $param
8870
+	 */
8334 8871
 	public function onCalculateKey($param)
8335 8872
 	{
8336 8873
 		$this->raiseEvent('OnCalculateKey',$this,$param);
@@ -8422,6 +8959,10 @@  discard block
 block discarded – undo
8422 8959
 		$tplFile=dirname($class->getFileName()).DIRECTORY_SEPARATOR.$className.self::TEMPLATE_FILE_EXT;
8423 8960
 		return $this->getTemplateByFileName($tplFile);
8424 8961
 	}
8962
+
8963
+	/**
8964
+	 * @param string $fileName
8965
+	 */
8425 8966
 	public function getTemplateByFileName($fileName)
8426 8967
 	{
8427 8968
 		if(($fileName=$this->getLocalizedTemplate($fileName))!==null)
@@ -8461,6 +9002,10 @@  discard block
 block discarded – undo
8461 9002
 		else
8462 9003
 			return null;
8463 9004
 	}
9005
+
9006
+	/**
9007
+	 * @return string
9008
+	 */
8464 9009
 	protected function getLocalizedTemplate($filename)
8465 9010
 	{
8466 9011
 		if(($app=$this->getApplication()->getGlobalization(false))===null)
@@ -8626,12 +9171,20 @@  discard block
 block discarded – undo
8626 9171
 				$parentControl->addParsedObject($control);
8627 9172
 		}
8628 9173
 	}
9174
+
9175
+	/**
9176
+	 * @param TControl $control
9177
+	 */
8629 9178
 	protected function configureControl($control,$name,$value)
8630 9179
 	{
8631 9180
 		if(strncasecmp($name,'on',2)===0)					$this->configureEvent($control,$name,$value,$control);
8632 9181
 		else if(($pos=strrpos($name,'.'))===false)				$this->configureProperty($control,$name,$value);
8633 9182
 		else				$this->configureSubProperty($control,$name,$value);
8634 9183
 	}
9184
+
9185
+	/**
9186
+	 * @param TComponent $component
9187
+	 */
8635 9188
 	protected function configureComponent($component,$name,$value)
8636 9189
 	{
8637 9190
 		if(strpos($name,'.')===false)				$this->configureProperty($component,$name,$value);
@@ -8941,6 +9494,11 @@  discard block
 block discarded – undo
8941 9494
 		$tpl=$objects;
8942 9495
 		return $objects;
8943 9496
 	}
9497
+
9498
+	/**
9499
+	 * @param string $str
9500
+	 * @param string $offset
9501
+	 */
8944 9502
 	protected function parseAttributes($str,$offset)
8945 9503
 	{
8946 9504
 		if($str==='')
@@ -8972,11 +9530,19 @@  discard block
 block discarded – undo
8972 9530
 		}
8973 9531
 		return $attributes;
8974 9532
 	}
9533
+
9534
+	/**
9535
+	 * @param string $content
9536
+	 */
8975 9537
 	protected function parseTemplateProperty($content,$offset)
8976 9538
 	{
8977 9539
 		$line=$this->_startingLine+count(explode("\n",substr($this->_content,0,$offset)))-1;
8978 9540
 		return array(self::CONFIG_TEMPLATE,new TTemplate($content,$this->_contextPath,$this->_tplFile,$line,false));
8979 9541
 	}
9542
+
9543
+	/**
9544
+	 * @param string $value
9545
+	 */
8980 9546
 	protected function parseAttribute($value)
8981 9547
 	{
8982 9548
 		if(($n=preg_match_all('/<%[#=].*?%>/msS',$value,$matches,PREG_OFFSET_CAPTURE))>0)
@@ -9099,6 +9665,11 @@  discard block
 block discarded – undo
9099 9665
 	{
9100 9666
 		return $this->_includedFiles;
9101 9667
 	}
9668
+
9669
+	/**
9670
+	 * @param Exception $e
9671
+	 * @param integer $line
9672
+	 */
9102 9673
 	protected function handleException($e,$line,$input=null)
9103 9674
 	{
9104 9675
 		$srcFile=$this->_tplFile;
@@ -9155,6 +9726,10 @@  discard block
 block discarded – undo
9155 9726
 		}
9156 9727
 		return $input;
9157 9728
 	}
9729
+
9730
+	/**
9731
+	 * @param string $method
9732
+	 */
9158 9733
 	protected function isClassBehaviorMethod(ReflectionClass $class,$method)
9159 9734
 	{
9160 9735
 	  $component=new ReflectionClass('TComponent');
@@ -9237,6 +9812,10 @@  discard block
 block discarded – undo
9237 9812
 				throw new TInvalidDataValueException('thememanager_basepath_invalid',$value);
9238 9813
 		}
9239 9814
 	}
9815
+
9816
+	/**
9817
+	 * @return string
9818
+	 */
9240 9819
 	public function getBaseUrl()
9241 9820
 	{
9242 9821
 		if($this->_baseUrl===null)
@@ -9635,6 +10214,10 @@  discard block
 block discarded – undo
9635 10214
 	{
9636 10215
 		return $this->_defaultPage;
9637 10216
 	}
10217
+
10218
+	/**
10219
+	 * @param string $value
10220
+	 */
9638 10221
 	public function setDefaultPage($value)
9639 10222
 	{
9640 10223
 		if($this->_initialized)
@@ -9723,6 +10306,10 @@  discard block
 block discarded – undo
9723 10306
 			$page->setSubProperty($name,$value);
9724 10307
 		$page->run($this->getResponse()->createHtmlWriter());
9725 10308
 	}
10309
+
10310
+	/**
10311
+	 * @param string $pagePath
10312
+	 */
9726 10313
 	public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true)
9727 10314
 	{
9728 10315
 		return $this->getRequest()->constructUrl($this->getID(),$pagePath,$getParams,$encodeAmpersand,$encodeGetItems);
@@ -9794,11 +10381,20 @@  discard block
 block discarded – undo
9794 10381
 				throw new TConfigurationException('pageserviceconf_file_invalid',$fname);
9795 10382
 		}
9796 10383
 	}
10384
+
10385
+	/**
10386
+	 * @param string $configPath
10387
+	 */
9797 10388
 	public function loadFromPhp($config,$configPath,$configPagePath)
9798 10389
 	{
9799 10390
 		$this->loadApplicationConfigurationFromPhp($config,$configPath);
9800 10391
 		$this->loadPageConfigurationFromPhp($config,$configPath,$configPagePath);
9801 10392
 	}
10393
+
10394
+	/**
10395
+	 * @param TXmlDocument $dom
10396
+	 * @param string $configPath
10397
+	 */
9802 10398
 	public function loadFromXml($dom,$configPath,$configPagePath)
9803 10399
 	{
9804 10400
 		$this->loadApplicationConfigurationFromXml($dom,$configPath);
@@ -10055,6 +10651,10 @@  discard block
 block discarded – undo
10055 10651
 		else
10056 10652
 			return $this->_basePath.DIRECTORY_SEPARATOR.$this->hash($path);
10057 10653
 	}
10654
+
10655
+	/**
10656
+	 * @param string $path
10657
+	 */
10058 10658
 	public function getPublishedUrl($path)
10059 10659
 	{
10060 10660
 		$path=realpath($path);
@@ -10063,10 +10663,19 @@  discard block
 block discarded – undo
10063 10663
 		else
10064 10664
 			return $this->_baseUrl.'/'.$this->hash($path);
10065 10665
 	}
10666
+
10667
+	/**
10668
+	 * @param string $dir
10669
+	 */
10066 10670
 	protected function hash($dir)
10067 10671
 	{
10068 10672
 		return sprintf('%x',crc32($dir.Prado::getVersion()));
10069 10673
 	}
10674
+
10675
+	/**
10676
+	 * @param string $src
10677
+	 * @param string $dst
10678
+	 */
10070 10679
 	protected function copyFile($src,$dst)
10071 10680
 	{
10072 10681
 		if(!is_dir($dst))
@@ -10080,6 +10689,11 @@  discard block
 block discarded – undo
10080 10689
 			@copy($src,$dstFile);
10081 10690
 		}
10082 10691
 	}
10692
+
10693
+	/**
10694
+	 * @param string $src
10695
+	 * @param string $dst
10696
+	 */
10083 10697
 	public function copyDirectory($src,$dst)
10084 10698
 	{
10085 10699
 		if(!is_dir($dst))
@@ -10109,6 +10723,11 @@  discard block
 block discarded – undo
10109 10723
 			throw new TInvalidDataValueException('assetmanager_source_directory_invalid', $src);
10110 10724
 		}
10111 10725
 	}
10726
+
10727
+	/**
10728
+	 * @param string $tarfile
10729
+	 * @param string $md5sum
10730
+	 */
10112 10731
 	public function publishTarFile($tarfile, $md5sum, $checkTimestamp=false)
10113 10732
 	{
10114 10733
 		if(isset($this->_published[$md5sum]))
@@ -10131,6 +10750,10 @@  discard block
 block discarded – undo
10131 10750
 			return $this->_published[$md5sum]=$this->_baseUrl.'/'.$dir;
10132 10751
 		}
10133 10752
 	}
10753
+
10754
+	/**
10755
+	 * @param string $destination
10756
+	 */
10134 10757
 	protected function deployTarFile($path,$destination)
10135 10758
 	{
10136 10759
 		if(($fullpath=realpath($path))===false || !is_file($fullpath))
@@ -10352,6 +10975,10 @@  discard block
 block discarded – undo
10352 10975
 		$this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null));
10353 10976
 		Prado::setPathOfAlias('Application',$this->_basePath);
10354 10977
 	}
10978
+
10979
+	/**
10980
+	 * @param string $basePath
10981
+	 */
10355 10982
 	protected function resolvePaths($basePath)
10356 10983
 	{
10357 10984
 				if(empty($basePath) || ($basePath=realpath($basePath))===false)
@@ -10417,10 +11044,18 @@  discard block
 block discarded – undo
10417 11044
 	{
10418 11045
 		return $this->_requestCompleted;
10419 11046
 	}
11047
+
11048
+	/**
11049
+	 * @param integer $defaultValue
11050
+	 */
10420 11051
 	public function getGlobalState($key,$defaultValue=null)
10421 11052
 	{
10422 11053
 		return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue;
10423 11054
 	}
11055
+
11056
+	/**
11057
+	 * @param string $key
11058
+	 */
10424 11059
 	public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false)
10425 11060
 	{
10426 11061
 		$this->_stateChanged=true;
@@ -10480,6 +11115,10 @@  discard block
 block discarded – undo
10480 11115
 	{
10481 11116
 		return $this->_basePath;
10482 11117
 	}
11118
+
11119
+	/**
11120
+	 * @param string $value
11121
+	 */
10483 11122
 	public function setBasePath($value)
10484 11123
 	{
10485 11124
 		$this->_basePath=$value;
@@ -10488,6 +11127,10 @@  discard block
 block discarded – undo
10488 11127
 	{
10489 11128
 		return $this->_configFile;
10490 11129
 	}
11130
+
11131
+	/**
11132
+	 * @param string $value
11133
+	 */
10491 11134
 	public function setConfigurationFile($value)
10492 11135
 	{
10493 11136
 		$this->_configFile=$value;
@@ -10496,6 +11139,10 @@  discard block
 block discarded – undo
10496 11139
 	{
10497 11140
 		return $this->_configType;
10498 11141
 	}
11142
+
11143
+	/**
11144
+	 * @param string $value
11145
+	 */
10499 11146
 	public function setConfigurationType($value)
10500 11147
 	{
10501 11148
 		$this->_configType = $value;
@@ -10535,6 +11182,10 @@  discard block
 block discarded – undo
10535 11182
 	{
10536 11183
 		return $this->_runtimePath;
10537 11184
 	}
11185
+
11186
+	/**
11187
+	 * @param string $value
11188
+	 */
10538 11189
 	public function setRuntimePath($value)
10539 11190
 	{
10540 11191
 		$this->_runtimePath=$value;
@@ -10546,6 +11197,10 @@  discard block
 block discarded – undo
10546 11197
 	{
10547 11198
 		return $this->_service;
10548 11199
 	}
11200
+
11201
+	/**
11202
+	 * @param IService $value
11203
+	 */
10549 11204
 	public function setService($value)
10550 11205
 	{
10551 11206
 		$this->_service=$value;
@@ -10826,6 +11481,10 @@  discard block
 block discarded – undo
10826 11481
 		else
10827 11482
 			throw new THttpException(500,'application_service_unknown',$serviceID);
10828 11483
 	}
11484
+
11485
+	/**
11486
+	 * @param Exception $param
11487
+	 */
10829 11488
 	public function onError($param)
10830 11489
 	{
10831 11490
 		Prado::log($param->getMessage(),TLogger::ERROR,'System.TApplication');
Please login to merge, or discard this patch.
Spacing   +1633 added lines, -1633 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 if(!defined('PRADO_DIR'))
15
-	define('PRADO_DIR',dirname(__FILE__));
15
+	define('PRADO_DIR', dirname(__FILE__));
16 16
 if(!defined('PRADO_CHMOD'))
17
-	define('PRADO_CHMOD',0777);
17
+	define('PRADO_CHMOD', 0777);
18 18
 class PradoBase
19 19
 {
20 20
 	const CLASS_FILE_EXT='.php';
@@ -22,55 +22,55 @@  discard block
 block discarded – undo
22 22
 	private static $_usings=array();
23 23
 	private static $_application=null;
24 24
 	private static $_logger=null;
25
-	protected static $classExists = array();
25
+	protected static $classExists=array();
26 26
 	public static function getVersion()
27 27
 	{
28 28
 		return '3.3.0';
29 29
 	}
30 30
 	public static function initErrorHandlers()
31 31
 	{
32
-		set_error_handler(array('PradoBase','phpErrorHandler'));
33
-		register_shutdown_function(array('PradoBase','phpFatalErrorHandler'));
34
-		set_exception_handler(array('PradoBase','exceptionHandler'));
32
+		set_error_handler(array('PradoBase', 'phpErrorHandler'));
33
+		register_shutdown_function(array('PradoBase', 'phpFatalErrorHandler'));
34
+		set_exception_handler(array('PradoBase', 'exceptionHandler'));
35 35
 	}
36 36
 	public static function autoload($className)
37 37
 	{
38 38
 		include_once($className.self::CLASS_FILE_EXT);
39
-		if(!class_exists($className,false) && !interface_exists($className,false))
39
+		if(!class_exists($className, false) && !interface_exists($className, false))
40 40
 			self::fatalError("Class file for '$className' cannot be found.");
41 41
 	}
42 42
 	public static function poweredByPrado($logoType=0)
43 43
 	{
44
-		$logoName=$logoType==1?'powered2':'powered';
44
+		$logoName=$logoType==1 ? 'powered2' : 'powered';
45 45
 		if(self::$_application!==null)
46 46
 		{
47 47
 			$am=self::$_application->getAssetManager();
48
-			$url=$am->publishFilePath(self::getPathOfNamespace('System.'.$logoName,'.gif'));
48
+			$url=$am->publishFilePath(self::getPathOfNamespace('System.'.$logoName, '.gif'));
49 49
 		}
50 50
 		else
51 51
 			$url='http://pradosoft.github.io/docs/'.$logoName.'.gif';
52 52
 		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 53
 	}
54
-	public static function phpErrorHandler($errno,$errstr,$errfile,$errline)
54
+	public static function phpErrorHandler($errno, $errstr, $errfile, $errline)
55 55
 	{
56 56
 		if(error_reporting() & $errno)
57
-			throw new TPhpErrorException($errno,$errstr,$errfile,$errline);
57
+			throw new TPhpErrorException($errno, $errstr, $errfile, $errline);
58 58
 	}
59 59
 	public static function phpFatalErrorHandler()
60 60
 	{
61
-		$error = error_get_last();
61
+		$error=error_get_last();
62 62
 		if($error && 
63 63
 			TPhpErrorException::isFatalError($error) &&
64 64
 			error_reporting() & $error['type'])
65 65
 		{
66
-			self::exceptionHandler(new TPhpErrorException($error['type'],$error['message'],$error['file'],$error['line']));
66
+			self::exceptionHandler(new TPhpErrorException($error['type'], $error['message'], $error['file'], $error['line']));
67 67
 		}
68 68
 	}
69 69
 	public static function exceptionHandler($exception)
70 70
 	{
71 71
 		if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null)
72 72
 		{
73
-			$errorHandler->handleError(null,$exception);
73
+			$errorHandler->handleError(null, $exception);
74 74
 		}
75 75
 		else
76 76
 		{
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 	public static function createComponent($type)
96 96
 	{
97 97
 		if(!isset(self::$classExists[$type]))
98
-			self::$classExists[$type] = class_exists($type, false);
99
-		if( !isset(self::$_usings[$type]) && !self::$classExists[$type]) {
98
+			self::$classExists[$type]=class_exists($type, false);
99
+		if(!isset(self::$_usings[$type]) && !self::$classExists[$type]) {
100 100
 			self::using($type);
101
-			self::$classExists[$type] = class_exists($type, false);
101
+			self::$classExists[$type]=class_exists($type, false);
102 102
 		}
103
-		if( ($pos = strrpos($type, '.')) !== false)
104
-			$type = substr($type,$pos+1);
105
-		if(($n=func_num_args())>1)
103
+		if(($pos=strrpos($type, '.'))!==false)
104
+			$type=substr($type, $pos + 1);
105
+		if(($n=func_num_args()) > 1)
106 106
 		{
107
-			$args = func_get_args();
107
+			$args=func_get_args();
108 108
 			switch($n) {
109 109
 				case 2:
110 110
 					return new $type($args[1]);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 				break;
121 121
 				default:
122 122
 					$s='$args[1]';
123
-					for($i=2;$i<$n;++$i)
123
+					for($i=2; $i < $n; ++$i)
124 124
 						$s.=",\$args[$i]";
125 125
 					eval("\$component=new $type($s);");
126 126
 					return $component;
@@ -130,33 +130,33 @@  discard block
 block discarded – undo
130 130
 		else
131 131
 			return new $type;
132 132
 	}
133
-	public static function using($namespace,$checkClassExistence=true)
133
+	public static function using($namespace, $checkClassExistence=true)
134 134
 	{
135
-		if(isset(self::$_usings[$namespace]) || class_exists($namespace,false))
135
+		if(isset(self::$_usings[$namespace]) || class_exists($namespace, false))
136 136
 			return;
137
-		if(($pos=strrpos($namespace,'.'))===false)  		{
137
+		if(($pos=strrpos($namespace, '.'))===false) {
138 138
 			try
139 139
 			{
140 140
 				include_once($namespace.self::CLASS_FILE_EXT);
141 141
 			}
142 142
 			catch(Exception $e)
143 143
 			{
144
-				if($checkClassExistence && !class_exists($namespace,false))
145
-					throw new TInvalidOperationException('prado_component_unknown',$namespace,$e->getMessage());
144
+				if($checkClassExistence && !class_exists($namespace, false))
145
+					throw new TInvalidOperationException('prado_component_unknown', $namespace, $e->getMessage());
146 146
 				else
147 147
 					throw $e;
148 148
 			}
149 149
 		}
150
-		else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null)
150
+		else if(($path=self::getPathOfNamespace($namespace, self::CLASS_FILE_EXT))!==null)
151 151
 		{
152
-			$className=substr($namespace,$pos+1);
153
-			if($className==='*')  			{
152
+			$className=substr($namespace, $pos + 1);
153
+			if($className==='*') {
154 154
 				self::$_usings[$namespace]=$path;
155 155
 				set_include_path(get_include_path().PATH_SEPARATOR.$path);
156 156
 			}
157
-			else  			{
157
+			else {
158 158
 				self::$_usings[$namespace]=$path;
159
-				if(!$checkClassExistence || !class_exists($className,false))
159
+				if(!$checkClassExistence || !class_exists($className, false))
160 160
 				{
161 161
 					try
162 162
 					{
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 					}
165 165
 					catch(Exception $e)
166 166
 					{
167
-						if($checkClassExistence && !class_exists($className,false))
168
-							throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage());
167
+						if($checkClassExistence && !class_exists($className, false))
168
+							throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage());
169 169
 						else
170 170
 							throw $e;
171 171
 					}
@@ -173,44 +173,44 @@  discard block
 block discarded – undo
173 173
 			}
174 174
 		}
175 175
 		else
176
-			throw new TInvalidDataValueException('prado_using_invalid',$namespace);
176
+			throw new TInvalidDataValueException('prado_using_invalid', $namespace);
177 177
 	}
178 178
 	public static function getPathOfNamespace($namespace, $ext='')
179 179
 	{
180
-		if(self::CLASS_FILE_EXT === $ext || empty($ext))
180
+		if(self::CLASS_FILE_EXT===$ext || empty($ext))
181 181
 		{
182 182
 			if(isset(self::$_usings[$namespace]))
183 183
 				return self::$_usings[$namespace];
184 184
 			if(isset(self::$_aliases[$namespace]))
185 185
 				return self::$_aliases[$namespace];
186 186
 		}
187
-		$segs = explode('.',$namespace);
188
-		$alias = array_shift($segs);
189
-		if(null !== ($file = array_pop($segs)) && null !== ($root = self::getPathOfAlias($alias)))
190
-			return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR ,$segs),'/\\').(($file === '*') ? '' : DIRECTORY_SEPARATOR.$file.$ext);
187
+		$segs=explode('.', $namespace);
188
+		$alias=array_shift($segs);
189
+		if(null!==($file=array_pop($segs)) && null!==($root=self::getPathOfAlias($alias)))
190
+			return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $segs), '/\\').(($file==='*') ? '' : DIRECTORY_SEPARATOR.$file.$ext);
191 191
 		return null;
192 192
 	}
193 193
 	public static function getPathOfAlias($alias)
194 194
 	{
195
-		return isset(self::$_aliases[$alias])?self::$_aliases[$alias]:null;
195
+		return isset(self::$_aliases[$alias]) ? self::$_aliases[$alias] : null;
196 196
 	}
197 197
 	protected static function getPathAliases()
198 198
 	{
199 199
 		return self::$_aliases;
200 200
 	}
201
-	public static function setPathOfAlias($alias,$path)
201
+	public static function setPathOfAlias($alias, $path)
202 202
 	{
203 203
 		if(isset(self::$_aliases[$alias]) && !defined('PRADO_TEST_RUN'))
204
-			throw new TInvalidOperationException('prado_alias_redefined',$alias);
204
+			throw new TInvalidOperationException('prado_alias_redefined', $alias);
205 205
 		else if(($rp=realpath($path))!==false && is_dir($rp))
206 206
 		{
207
-			if(strpos($alias,'.')===false)
207
+			if(strpos($alias, '.')===false)
208 208
 				self::$_aliases[$alias]=$rp;
209 209
 			else
210
-				throw new TInvalidDataValueException('prado_aliasname_invalid',$alias);
210
+				throw new TInvalidDataValueException('prado_aliasname_invalid', $alias);
211 211
 		}
212 212
 		else
213
-			throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path);
213
+			throw new TInvalidDataValueException('prado_alias_invalid', $alias, $path);
214 214
 	}
215 215
 	public static function fatalError($msg)
216 216
 	{
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 			if($index==0)  				continue;
228 228
 			echo '#'.$index.' ';
229 229
 			if(isset($t['file']))
230
-				echo basename($t['file']) . ':' . $t['line'];
230
+				echo basename($t['file']).':'.$t['line'];
231 231
 			else
232 232
 				 echo '<PHP inner-code>';
233 233
 			echo ' -- ';
234 234
 			if(isset($t['class']))
235
-				echo $t['class'] . $t['type'];
236
-			echo $t['function'] . '(';
235
+				echo $t['class'].$t['type'];
236
+			echo $t['function'].'(';
237 237
 			if(isset($t['args']) && sizeof($t['args']) > 0)
238 238
 			{
239 239
 				$count=0;
@@ -242,25 +242,25 @@  discard block
 block discarded – undo
242 242
 					if(is_string($item))
243 243
 					{
244 244
 						$str=htmlentities(str_replace("\r\n", "", $item), ENT_QUOTES);
245
-						if (strlen($item) > 70)
246
-							echo "'". substr($str, 0, 70) . "...'";
245
+						if(strlen($item) > 70)
246
+							echo "'".substr($str, 0, 70)."...'";
247 247
 						else
248
-							echo "'" . $str . "'";
248
+							echo "'".$str."'";
249 249
 					}
250
-					else if (is_int($item) || is_float($item))
250
+					else if(is_int($item) || is_float($item))
251 251
 						echo $item;
252
-					else if (is_object($item))
252
+					else if(is_object($item))
253 253
 						echo get_class($item);
254
-					else if (is_array($item))
255
-						echo 'array(' . count($item) . ')';
256
-					else if (is_bool($item))
254
+					else if(is_array($item))
255
+						echo 'array('.count($item).')';
256
+					else if(is_bool($item))
257 257
 						echo $item ? 'true' : 'false';
258
-					else if ($item === null)
258
+					else if($item===null)
259 259
 						echo 'NULL';
260
-					else if (is_resource($item))
260
+					else if(is_resource($item))
261 261
 						echo get_resource_type($item);
262 262
 					$count++;
263
-					if (count($t['args']) > $count)
263
+					if(count($t['args']) > $count)
264 264
 						echo ', ';
265 265
 				}
266 266
 			}
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
 			else
280 280
 			{
281 281
 				$languages=array();
282
-				foreach(explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language)
282
+				foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language)
283 283
 				{
284
-					$array=explode(';q=',trim($language));
285
-					$languages[trim($array[0])]=isset($array[1])?(float)$array[1]:1.0;
284
+					$array=explode(';q=', trim($language));
285
+					$languages[trim($array[0])]=isset($array[1]) ? (float) $array[1] : 1.0;
286 286
 				}
287 287
 				arsort($languages);
288 288
 				$languages=array_keys($languages);
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		if($language===null)
299 299
 		{
300 300
 			$langs=Prado::getUserLanguages();
301
-			$lang=explode('-',$langs[0]);
301
+			$lang=explode('-', $langs[0]);
302 302
 			if(empty($lang[0]) || !ctype_alpha($lang[0]))
303 303
 				$language='en';
304 304
 			else
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		}
307 307
 		return $language;
308 308
 	}
309
-	public static function trace($msg,$category='Uncategorized',$ctl=null)
309
+	public static function trace($msg, $category='Uncategorized', $ctl=null)
310 310
 	{
311 311
 		if(self::$_application && self::$_application->getMode()===TApplicationMode::Performance)
312 312
 			return;
@@ -319,13 +319,13 @@  discard block
 block discarded – undo
319 319
 		}
320 320
 		else
321 321
 			$level=TLogger::INFO;
322
-		self::log($msg,$level,$category,$ctl);
322
+		self::log($msg, $level, $category, $ctl);
323 323
 	}
324
-	public static function log($msg,$level=TLogger::INFO,$category='Uncategorized',$ctl=null)
324
+	public static function log($msg, $level=TLogger::INFO, $category='Uncategorized', $ctl=null)
325 325
 	{
326 326
 		if(self::$_logger===null)
327 327
 			self::$_logger=new TLogger;
328
-		self::$_logger->log($msg,$level,$category,$ctl);
328
+		self::$_logger->log($msg, $level, $category, $ctl);
329 329
 	}
330 330
 	public static function getLogger()
331 331
 	{
@@ -333,40 +333,40 @@  discard block
 block discarded – undo
333 333
 			self::$_logger=new TLogger;
334 334
 		return self::$_logger;
335 335
 	}
336
-	public static function varDump($var,$depth=10,$highlight=false)
336
+	public static function varDump($var, $depth=10, $highlight=false)
337 337
 	{
338 338
 		Prado::using('System.Util.TVarDumper');
339
-		return TVarDumper::dump($var,$depth,$highlight);
339
+		return TVarDumper::dump($var, $depth, $highlight);
340 340
 	}
341 341
 	public static function localize($text, $parameters=array(), $catalogue=null, $charset=null)
342 342
 	{
343 343
 		Prado::using('System.I18N.Translation');
344
-		$app = Prado::getApplication()->getGlobalization(false);
345
-		$params = array();
344
+		$app=Prado::getApplication()->getGlobalization(false);
345
+		$params=array();
346 346
 		foreach($parameters as $key => $value)
347
-			$params['{'.$key.'}'] = $value;
348
-				if($app===null || ($config = $app->getTranslationConfiguration())===null)
347
+			$params['{'.$key.'}']=$value;
348
+				if($app===null || ($config=$app->getTranslationConfiguration())===null)
349 349
 			return strtr($text, $params);
350
-		if ($catalogue===null)
351
-			$catalogue=isset($config['catalogue'])?$config['catalogue']:'messages';
350
+		if($catalogue===null)
351
+			$catalogue=isset($config['catalogue']) ? $config['catalogue'] : 'messages';
352 352
 		Translation::init($catalogue);
353
-				$appCharset = $app===null ? '' : $app->getCharset();
354
-				$defaultCharset = ($app===null) ? 'UTF-8' : $app->getDefaultCharset();
355
-				if(empty($charset)) $charset = $appCharset;
356
-		if(empty($charset)) $charset = $defaultCharset;
357
-		return Translation::formatter($catalogue)->format($text,$params,$catalogue,$charset);
353
+				$appCharset=$app===null ? '' : $app->getCharset();
354
+				$defaultCharset=($app===null) ? 'UTF-8' : $app->getDefaultCharset();
355
+				if(empty($charset)) $charset=$appCharset;
356
+		if(empty($charset)) $charset=$defaultCharset;
357
+		return Translation::formatter($catalogue)->format($text, $params, $catalogue, $charset);
358 358
 	}
359 359
 }
360 360
 PradoBase::using('System.TComponent');
361 361
 PradoBase::using('System.Exceptions.TException');
362 362
 PradoBase::using('System.Util.TLogger');
363
-if(!class_exists('Prado',false))
363
+if(!class_exists('Prado', false))
364 364
 {
365 365
 	class Prado extends PradoBase
366 366
 	{
367 367
 	}
368 368
 }
369
-spl_autoload_register(array('Prado','autoload'));
369
+spl_autoload_register(array('Prado', 'autoload'));
370 370
 Prado::initErrorHandlers();
371 371
 interface IModule
372 372
 {
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 interface ICache
409 409
 {
410 410
 	public function get($id);
411
-	public function set($id,$value,$expire=0,$dependency=null);
412
-	public function add($id,$value,$expire=0,$dependency=null);
411
+	public function set($id, $value, $expire=0, $dependency=null);
412
+	public function add($id, $value, $expire=0, $dependency=null);
413 413
 	public function delete($id);
414 414
 	public function flush();
415 415
 }
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	{
471 471
 		return Prado::getApplication()->getUser();
472 472
 	}
473
-	public function publishAsset($assetPath,$className=null)
473
+	public function publishAsset($assetPath, $className=null)
474 474
 	{
475 475
 		if($className===null)
476 476
 			$className=get_class($this);
@@ -546,9 +546,9 @@  discard block
 block discarded – undo
546 546
 		if(($templatePath=Prado::getPathOfNamespace($value))!==null && is_dir($templatePath))
547 547
 			$this->_templatePath=$templatePath;
548 548
 		else
549
-			throw new TConfigurationException('errorhandler_errortemplatepath_invalid',$value);
549
+			throw new TConfigurationException('errorhandler_errortemplatepath_invalid', $value);
550 550
 	}
551
-	public function handleError($sender,$param)
551
+	public function handleError($sender, $param)
552 552
 	{
553 553
 		static $handling=false;
554 554
 								restore_error_handler();
@@ -563,56 +563,56 @@  discard block
 block discarded – undo
563 563
 			if(!headers_sent())
564 564
 				header('Content-Type: text/html; charset=UTF-8');
565 565
 			if($param instanceof THttpException)
566
-				$this->handleExternalError($param->getStatusCode(),$param);
566
+				$this->handleExternalError($param->getStatusCode(), $param);
567 567
 			else if($this->getApplication()->getMode()===TApplicationMode::Debug)
568 568
 				$this->displayException($param);
569 569
 			else
570
-				$this->handleExternalError(500,$param);
570
+				$this->handleExternalError(500, $param);
571 571
 		}
572 572
 	}
573 573
 	protected static function hideSecurityRelated($value, $exception=null)
574 574
 	{
575
-		$aRpl = array();
576
-		if($exception !== null && $exception instanceof Exception)
575
+		$aRpl=array();
576
+		if($exception!==null && $exception instanceof Exception)
577 577
 		{
578
-			$aTrace = $exception->getTrace();
578
+			$aTrace=$exception->getTrace();
579 579
 			foreach($aTrace as $item)
580 580
 			{
581 581
 				if(isset($item['file']))
582
-					$aRpl[dirname($item['file']) . DIRECTORY_SEPARATOR] = '<hidden>' . DIRECTORY_SEPARATOR;
582
+					$aRpl[dirname($item['file']).DIRECTORY_SEPARATOR]='<hidden>'.DIRECTORY_SEPARATOR;
583 583
 			}
584 584
 		}
585
-		$aRpl[$_SERVER['DOCUMENT_ROOT']] = '${DocumentRoot}';
586
-		$aRpl[str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT'])] = '${DocumentRoot}';
587
-		$aRpl[PRADO_DIR . DIRECTORY_SEPARATOR] = '${PradoFramework}' . DIRECTORY_SEPARATOR;
585
+		$aRpl[$_SERVER['DOCUMENT_ROOT']]='${DocumentRoot}';
586
+		$aRpl[str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT'])]='${DocumentRoot}';
587
+		$aRpl[PRADO_DIR.DIRECTORY_SEPARATOR]='${PradoFramework}'.DIRECTORY_SEPARATOR;
588 588
 		if(isset($aRpl[DIRECTORY_SEPARATOR])) unset($aRpl[DIRECTORY_SEPARATOR]);
589
-		$aRpl = array_reverse($aRpl, true);
589
+		$aRpl=array_reverse($aRpl, true);
590 590
 		return str_replace(array_keys($aRpl), $aRpl, $value);
591 591
 	}
592
-	protected function handleExternalError($statusCode,$exception)
592
+	protected function handleExternalError($statusCode, $exception)
593 593
 	{
594 594
 		if(!($exception instanceof THttpException))
595 595
 			error_log($exception->__toString());
596
-		$content=$this->getErrorTemplate($statusCode,$exception);
597
-		$serverAdmin=isset($_SERVER['SERVER_ADMIN'])?$_SERVER['SERVER_ADMIN']:'';
598
-		$isDebug = $this->getApplication()->getMode()===TApplicationMode::Debug;
599
-		$errorMessage = $exception->getMessage();
596
+		$content=$this->getErrorTemplate($statusCode, $exception);
597
+		$serverAdmin=isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : '';
598
+		$isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug;
599
+		$errorMessage=$exception->getMessage();
600 600
 		if($isDebug)
601 601
 			$version=$_SERVER['SERVER_SOFTWARE'].' <a href="https://github.com/pradosoft/prado">PRADO</a>/'.Prado::getVersion();
602 602
 		else
603 603
 		{
604 604
 			$version='';
605
-			$errorMessage = self::hideSecurityRelated($errorMessage, $exception);
605
+			$errorMessage=self::hideSecurityRelated($errorMessage, $exception);
606 606
 		}
607 607
 		$tokens=array(
608 608
 			'%%StatusCode%%' => "$statusCode",
609 609
 			'%%ErrorMessage%%' => htmlspecialchars($errorMessage),
610 610
 			'%%ServerAdmin%%' => $serverAdmin,
611 611
 			'%%Version%%' => $version,
612
-			'%%Time%%' => @strftime('%Y-%m-%d %H:%M',time())
612
+			'%%Time%%' => @strftime('%Y-%m-%d %H:%M', time())
613 613
 		);
614 614
 		$this->getApplication()->getResponse()->setStatusCode($statusCode, $isDebug ? $exception->getMessage() : null);
615
-		echo strtr($content,$tokens);
615
+		echo strtr($content, $tokens);
616 616
 	}
617 617
 	protected function handleRecursiveError($exception)
618 618
 	{
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 		if($exception instanceof TTemplateException)
641 641
 		{
642 642
 			$fileName=$exception->getTemplateFile();
643
-			$lines=empty($fileName)?explode("\n",$exception->getTemplateSource()):@file($fileName);
644
-			$source=$this->getSourceCode($lines,$exception->getLineNumber());
643
+			$lines=empty($fileName) ? explode("\n", $exception->getTemplateSource()) : @file($fileName);
644
+			$source=$this->getSourceCode($lines, $exception->getLineNumber());
645 645
 			if($fileName==='')
646 646
 				$fileName='---embedded template---';
647 647
 			$errorLine=$exception->getLineNumber();
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 				$fileName=$exception->getFile();
659 659
 				$errorLine=$exception->getLine();
660 660
 			}
661
-			$source=$this->getSourceCode(@file($fileName),$errorLine);
661
+			$source=$this->getSourceCode(@file($fileName), $errorLine);
662 662
 		}
663 663
 		if($this->getApplication()->getMode()===TApplicationMode::Debug)
664 664
 			$version=$_SERVER['SERVER_SOFTWARE'].' <a href="https://github.com/pradosoft/prado">PRADO</a>/'.Prado::getVersion();
@@ -671,10 +671,10 @@  discard block
 block discarded – undo
671 671
 			'%%SourceCode%%' => $source,
672 672
 			'%%StackTrace%%' => htmlspecialchars($exception->getTraceAsString()),
673 673
 			'%%Version%%' => $version,
674
-			'%%Time%%' => @strftime('%Y-%m-%d %H:%M',time())
674
+			'%%Time%%' => @strftime('%Y-%m-%d %H:%M', time())
675 675
 		);
676 676
 		$content=$this->getExceptionTemplate($exception);
677
-		echo strtr($content,$tokens);
677
+		echo strtr($content, $tokens);
678 678
 	}
679 679
 	protected function getExceptionTemplate($exception)
680 680
 	{
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 			die("Unable to open exception template file '$exceptionFile'.");
687 687
 		return $content;
688 688
 	}
689
-	protected function getErrorTemplate($statusCode,$exception)
689
+	protected function getErrorTemplate($statusCode, $exception)
690 690
 	{
691 691
 		$base=$this->getErrorTemplatePath().DIRECTORY_SEPARATOR.self::ERROR_FILE_NAME;
692 692
 		$lang=Prado::getPreferredLanguage();
@@ -715,14 +715,14 @@  discard block
 block discarded – undo
715 715
 		}
716 716
 		else if($exception instanceof TInvalidOperationException)
717 717
 		{
718
-						if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null)
719
-				$result=$this->getPropertyAccessTrace($trace,'__set');
718
+						if(($result=$this->getPropertyAccessTrace($trace, '__get'))===null)
719
+				$result=$this->getPropertyAccessTrace($trace, '__set');
720 720
 		}
721
-		if($result!==null && strpos($result['file'],': eval()\'d code')!==false)
721
+		if($result!==null && strpos($result['file'], ': eval()\'d code')!==false)
722 722
 			return null;
723 723
 		return $result;
724 724
 	}
725
-	private function getPropertyAccessTrace($trace,$pattern)
725
+	private function getPropertyAccessTrace($trace, $pattern)
726 726
 	{
727 727
 		$result=null;
728 728
 		foreach($trace as $t)
@@ -734,35 +734,35 @@  discard block
 block discarded – undo
734 734
 		}
735 735
 		return $result;
736 736
 	}
737
-	private function getSourceCode($lines,$errorLine)
737
+	private function getSourceCode($lines, $errorLine)
738 738
 	{
739
-		$beginLine=$errorLine-self::SOURCE_LINES>=0?$errorLine-self::SOURCE_LINES:0;
740
-		$endLine=$errorLine+self::SOURCE_LINES<=count($lines)?$errorLine+self::SOURCE_LINES:count($lines);
739
+		$beginLine=$errorLine - self::SOURCE_LINES >= 0 ? $errorLine - self::SOURCE_LINES : 0;
740
+		$endLine=$errorLine + self::SOURCE_LINES <= count($lines) ? $errorLine + self::SOURCE_LINES : count($lines);
741 741
 		$source='';
742
-		for($i=$beginLine;$i<$endLine;++$i)
742
+		for($i=$beginLine; $i < $endLine; ++$i)
743 743
 		{
744
-			if($i===$errorLine-1)
744
+			if($i===$errorLine - 1)
745 745
 			{
746
-				$line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
746
+				$line=htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
747 747
 				$source.="<div class=\"error\">".$line."</div>";
748 748
 			}
749 749
 			else
750
-				$source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
750
+				$source.=htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
751 751
 		}
752 752
 		return $source;
753 753
 	}
754 754
 	private function addLink($message)
755 755
 	{
756 756
 		$baseUrl='http://pradosoft.github.io/docs/manual/class-';
757
-		return preg_replace('/\b(T[A-Z]\w+)\b/',"<a href=\"$baseUrl\${1}\" target=\"_blank\">\${1}</a>",$message);
757
+		return preg_replace('/\b(T[A-Z]\w+)\b/', "<a href=\"$baseUrl\${1}\" target=\"_blank\">\${1}</a>", $message);
758 758
 	}
759 759
 }
760
-class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countable
760
+class TList extends TComponent implements IteratorAggregate, ArrayAccess, Countable
761 761
 {
762 762
 	private $_d=array();
763 763
 	private $_c=0;
764 764
 	private $_r=false;
765
-	public function __construct($data=null,$readOnly=false)
765
+	public function __construct($data=null, $readOnly=false)
766 766
 	{
767 767
 		if($data!==null)
768 768
 			$this->copyFrom($data);
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 	}
779 779
 	public function getIterator()
780 780
 	{
781
-		return new ArrayIterator( $this->_d );
781
+		return new ArrayIterator($this->_d);
782 782
 	}
783 783
 	public function count()
784 784
 	{
@@ -790,38 +790,38 @@  discard block
 block discarded – undo
790 790
 	}
791 791
 	public function itemAt($index)
792 792
 	{
793
-		if($index>=0 && $index<$this->_c)
793
+		if($index >= 0 && $index < $this->_c)
794 794
 			return $this->_d[$index];
795 795
 		else
796
-			throw new TInvalidDataValueException('list_index_invalid',$index);
796
+			throw new TInvalidDataValueException('list_index_invalid', $index);
797 797
 	}
798 798
 	public function add($item)
799 799
 	{
800
-		$this->insertAt($this->_c,$item);
801
-		return $this->_c-1;
800
+		$this->insertAt($this->_c, $item);
801
+		return $this->_c - 1;
802 802
 	}
803
-	public function insertAt($index,$item)
803
+	public function insertAt($index, $item)
804 804
 	{
805 805
 		if(!$this->_r)
806 806
 		{
807 807
 			if($index===$this->_c)
808 808
 				$this->_d[$this->_c++]=$item;
809
-			else if($index>=0 && $index<$this->_c)
809
+			else if($index >= 0 && $index < $this->_c)
810 810
 			{
811
-				array_splice($this->_d,$index,0,array($item));
811
+				array_splice($this->_d, $index, 0, array($item));
812 812
 				$this->_c++;
813 813
 			}
814 814
 			else
815
-				throw new TInvalidDataValueException('list_index_invalid',$index);
815
+				throw new TInvalidDataValueException('list_index_invalid', $index);
816 816
 		}
817 817
 		else
818
-			throw new TInvalidOperationException('list_readonly',get_class($this));
818
+			throw new TInvalidOperationException('list_readonly', get_class($this));
819 819
 	}
820 820
 	public function remove($item)
821 821
 	{
822 822
 		if(!$this->_r)
823 823
 		{
824
-			if(($index=$this->indexOf($item))>=0)
824
+			if(($index=$this->indexOf($item)) >= 0)
825 825
 			{
826 826
 				$this->removeAt($index);
827 827
 				return $index;
@@ -830,13 +830,13 @@  discard block
 block discarded – undo
830 830
 				throw new TInvalidDataValueException('list_item_inexistent');
831 831
 		}
832 832
 		else
833
-			throw new TInvalidOperationException('list_readonly',get_class($this));
833
+			throw new TInvalidOperationException('list_readonly', get_class($this));
834 834
 	}
835 835
 	public function removeAt($index)
836 836
 	{
837 837
 		if(!$this->_r)
838 838
 		{
839
-			if($index>=0 && $index<$this->_c)
839
+			if($index >= 0 && $index < $this->_c)
840 840
 			{
841 841
 				$this->_c--;
842 842
 				if($index===$this->_c)
@@ -844,28 +844,28 @@  discard block
 block discarded – undo
844 844
 				else
845 845
 				{
846 846
 					$item=$this->_d[$index];
847
-					array_splice($this->_d,$index,1);
847
+					array_splice($this->_d, $index, 1);
848 848
 					return $item;
849 849
 				}
850 850
 			}
851 851
 			else
852
-				throw new TInvalidDataValueException('list_index_invalid',$index);
852
+				throw new TInvalidDataValueException('list_index_invalid', $index);
853 853
 		}
854 854
 		else
855
-			throw new TInvalidOperationException('list_readonly',get_class($this));
855
+			throw new TInvalidOperationException('list_readonly', get_class($this));
856 856
 	}
857 857
 	public function clear()
858 858
 	{
859
-		for($i=$this->_c-1;$i>=0;--$i)
859
+		for($i=$this->_c - 1; $i >= 0; --$i)
860 860
 			$this->removeAt($i);
861 861
 	}
862 862
 	public function contains($item)
863 863
 	{
864
-		return $this->indexOf($item)>=0;
864
+		return $this->indexOf($item) >= 0;
865 865
 	}
866 866
 	public function indexOf($item)
867 867
 	{
868
-		if(($index=array_search($item,$this->_d,true))===false)
868
+		if(($index=array_search($item, $this->_d, true))===false)
869 869
 			return -1;
870 870
 		else
871 871
 			return $index;
@@ -874,25 +874,25 @@  discard block
 block discarded – undo
874 874
 	{
875 875
 		if(!$this->_r)
876 876
 		{
877
-			if(($index = $this->indexOf($baseitem)) == -1)
877
+			if(($index=$this->indexOf($baseitem))==-1)
878 878
 				throw new TInvalidDataValueException('list_item_inexistent');
879 879
 			$this->insertAt($index, $item);
880 880
 			return $index;
881 881
 		}
882 882
 		else
883
-			throw new TInvalidOperationException('list_readonly',get_class($this));
883
+			throw new TInvalidOperationException('list_readonly', get_class($this));
884 884
 	}
885 885
 	public function insertAfter($baseitem, $item)
886 886
 	{
887 887
 		if(!$this->_r)
888 888
 		{
889
-			if(($index = $this->indexOf($baseitem)) == -1)
889
+			if(($index=$this->indexOf($baseitem))==-1)
890 890
 				throw new TInvalidDataValueException('list_item_inexistent');
891 891
 			$this->insertAt($index + 1, $item);
892 892
 			return $index + 1;
893 893
 		}
894 894
 		else
895
-			throw new TInvalidOperationException('list_readonly',get_class($this));
895
+			throw new TInvalidOperationException('list_readonly', get_class($this));
896 896
 	}
897 897
 	public function toArray()
898 898
 	{
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 	{
903 903
 		if(is_array($data) || ($data instanceof Traversable))
904 904
 		{
905
-			if($this->_c>0)
905
+			if($this->_c > 0)
906 906
 				$this->clear();
907 907
 			foreach($data as $item)
908 908
 				$this->add($item);
@@ -922,20 +922,20 @@  discard block
 block discarded – undo
922 922
 	}
923 923
 	public function offsetExists($offset)
924 924
 	{
925
-		return ($offset>=0 && $offset<$this->_c);
925
+		return ($offset >= 0 && $offset < $this->_c);
926 926
 	}
927 927
 	public function offsetGet($offset)
928 928
 	{
929 929
 		return $this->itemAt($offset);
930 930
 	}
931
-	public function offsetSet($offset,$item)
931
+	public function offsetSet($offset, $item)
932 932
 	{
933 933
 		if($offset===null || $offset===$this->_c)
934
-			$this->insertAt($this->_c,$item);
934
+			$this->insertAt($this->_c, $item);
935 935
 		else
936 936
 		{
937 937
 			$this->removeAt($offset);
938
-			$this->insertAt($offset,$item);
938
+			$this->insertAt($offset, $item);
939 939
 		}
940 940
 	}
941 941
 	public function offsetUnset($offset)
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 			if($this->getApplication()->getCache()===null)
960 960
 				$this->getApplication()->setCache($this);
961 961
 			else
962
-				throw new TConfigurationException('cache_primary_duplicated',get_class($this));
962
+				throw new TConfigurationException('cache_primary_duplicated', get_class($this));
963 963
 		}
964 964
 	}
965 965
 	public function getPrimaryCache()
@@ -993,22 +993,22 @@  discard block
 block discarded – undo
993 993
 		}
994 994
 		return false;
995 995
 	}
996
-	public function set($id,$value,$expire=0,$dependency=null)
996
+	public function set($id, $value, $expire=0, $dependency=null)
997 997
 	{
998
-		if(empty($value) && $expire === 0)
998
+		if(empty($value) && $expire===0)
999 999
 			$this->delete($id);
1000 1000
 		else
1001 1001
 		{
1002
-			$data=array($value,$dependency);
1003
-			return $this->setValue($this->generateUniqueKey($id),$data,$expire);
1002
+			$data=array($value, $dependency);
1003
+			return $this->setValue($this->generateUniqueKey($id), $data, $expire);
1004 1004
 		}
1005 1005
 	}
1006
-	public function add($id,$value,$expire=0,$dependency=null)
1006
+	public function add($id, $value, $expire=0, $dependency=null)
1007 1007
 	{
1008
-		if(empty($value) && $expire === 0)
1008
+		if(empty($value) && $expire===0)
1009 1009
 			return false;
1010
-		$data=array($value,$dependency);
1011
-		return $this->addValue($this->generateUniqueKey($id),$data,$expire);
1010
+		$data=array($value, $dependency);
1011
+		return $this->addValue($this->generateUniqueKey($id), $data, $expire);
1012 1012
 	}
1013 1013
 	public function delete($id)
1014 1014
 	{
@@ -1019,12 +1019,12 @@  discard block
 block discarded – undo
1019 1019
 		throw new TNotSupportedException('cache_flush_unsupported');
1020 1020
 	}
1021 1021
 	abstract protected function getValue($key);
1022
-	abstract protected function setValue($key,$value,$expire);
1023
-	abstract protected function addValue($key,$value,$expire);
1022
+	abstract protected function setValue($key, $value, $expire);
1023
+	abstract protected function addValue($key, $value, $expire);
1024 1024
 	abstract protected function deleteValue($key);
1025 1025
 	public function offsetExists($id)
1026 1026
 	{
1027
-		return $this->get($id) !== false;
1027
+		return $this->get($id)!==false;
1028 1028
 	}
1029 1029
 	public function offsetGet($id)
1030 1030
 	{
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	public function setDirectory($directory)
1086 1086
 	{
1087 1087
 		if(($path=realpath($directory))===false || !is_dir($path))
1088
-			throw new TInvalidDataValueException('directorycachedependency_directory_invalid',$directory);
1088
+			throw new TInvalidDataValueException('directorycachedependency_directory_invalid', $directory);
1089 1089
 		$this->_directory=$path;
1090 1090
 		$this->_timestamps=$this->generateTimestamps($path);
1091 1091
 	}
@@ -1117,10 +1117,10 @@  discard block
 block discarded – undo
1117 1117
 	{
1118 1118
 		return true;
1119 1119
 	}
1120
-	protected function generateTimestamps($directory,$level=0)
1120
+	protected function generateTimestamps($directory, $level=0)
1121 1121
 	{
1122 1122
 		if(($dir=opendir($directory))===false)
1123
-			throw new TIOException('directorycachedependency_directory_invalid',$directory);
1123
+			throw new TIOException('directorycachedependency_directory_invalid', $directory);
1124 1124
 		$timestamps=array();
1125 1125
 		while(($file=readdir($dir))!==false)
1126 1126
 		{
@@ -1129,8 +1129,8 @@  discard block
 block discarded – undo
1129 1129
 				continue;
1130 1130
 			else if(is_dir($path))
1131 1131
 			{
1132
-				if(($this->_recursiveLevel<0 || $level<$this->_recursiveLevel) && $this->validateDirectory($path))
1133
-					$timestamps=array_merge($this->generateTimestamps($path,$level+1));
1132
+				if(($this->_recursiveLevel < 0 || $level < $this->_recursiveLevel) && $this->validateDirectory($path))
1133
+					$timestamps=array_merge($this->generateTimestamps($path, $level + 1));
1134 1134
 			}
1135 1135
 			else if($this->validateFile($path))
1136 1136
 				$timestamps[$path]=filemtime($path);
@@ -1190,10 +1190,10 @@  discard block
 block discarded – undo
1190 1190
 }
1191 1191
 class TCacheDependencyList extends TList
1192 1192
 {
1193
-	public function insertAt($index,$item)
1193
+	public function insertAt($index, $item)
1194 1194
 	{
1195 1195
 		if($item instanceof ICacheDependency)
1196
-			parent::insertAt($index,$item);
1196
+			parent::insertAt($index, $item);
1197 1197
 		else
1198 1198
 			throw new TInvalidDataTypeException('cachedependencylist_cachedependency_required');
1199 1199
 	}
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 	private $_c=0;
1225 1225
 	private $_dp=10;
1226 1226
 	private $_p=8;
1227
-	public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8)
1227
+	public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8)
1228 1228
 	{
1229 1229
 		parent::__construct();
1230 1230
 		if($data!==null)
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 	{
1246 1246
 		if($priority===null)
1247 1247
 			$priority=$this->getDefaultPriority();
1248
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1248
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1249 1249
 		if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority]))
1250 1250
 			return false;
1251 1251
 		return count($this->_d[$priority]);
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 	}
1257 1257
 	protected function setDefaultPriority($value)
1258 1258
 	{
1259
-		$this->_dp=(string)round(TPropertyValue::ensureFloat($value),$this->_p);
1259
+		$this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p);
1260 1260
 	}
1261 1261
 	public function getPrecision()
1262 1262
 	{
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
 	}
1278 1278
 	protected function sortPriorities() {
1279 1279
 		if(!$this->_o) {
1280
-			ksort($this->_d,SORT_NUMERIC);
1280
+			ksort($this->_d, SORT_NUMERIC);
1281 1281
 			$this->_o=true;
1282 1282
 		}
1283 1283
 	}
@@ -1287,111 +1287,111 @@  discard block
 block discarded – undo
1287 1287
 		$this->sortPriorities();
1288 1288
 		$this->_fd=array();
1289 1289
 		foreach($this->_d as $priority => $itemsatpriority)
1290
-			$this->_fd=array_merge($this->_fd,$itemsatpriority);
1290
+			$this->_fd=array_merge($this->_fd, $itemsatpriority);
1291 1291
 		return $this->_fd;
1292 1292
 	}
1293 1293
 	public function itemAt($index)
1294 1294
 	{
1295
-		if($index>=0&&$index<$this->getCount()) {
1295
+		if($index >= 0 && $index < $this->getCount()) {
1296 1296
 			$arr=$this->flattenPriorities();
1297 1297
 			return $arr[$index];
1298 1298
 		} else
1299
-			throw new TInvalidDataValueException('list_index_invalid',$index);
1299
+			throw new TInvalidDataValueException('list_index_invalid', $index);
1300 1300
 	}
1301 1301
 	public function itemsAtPriority($priority=null)
1302 1302
 	{
1303 1303
 		if($priority===null)
1304 1304
 			$priority=$this->getDefaultPriority();
1305
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1306
-		return isset($this->_d[$priority])?$this->_d[$priority]:null;
1305
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1306
+		return isset($this->_d[$priority]) ? $this->_d[$priority] : null;
1307 1307
 	}
1308
-	public function itemAtIndexInPriority($index,$priority=null)
1308
+	public function itemAtIndexInPriority($index, $priority=null)
1309 1309
 	{
1310 1310
 		if($priority===null)
1311 1311
 			$priority=$this->getDefaultPriority();
1312
-		$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
1313
-		return !isset($this->_d[$priority])?false:(
1314
-				isset($this->_d[$priority][$index])?$this->_d[$priority][$index]:false
1312
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1313
+		return !isset($this->_d[$priority]) ? false : (
1314
+				isset($this->_d[$priority][$index]) ? $this->_d[$priority][$index] : false
1315 1315
 			);
1316 1316
 	}
1317
-	public function add($item,$priority=null)
1317
+	public function add($item, $priority=null)
1318 1318
 	{
1319 1319
 		if($this->getReadOnly())
1320
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1321
-		return $this->insertAtIndexInPriority($item,false,$priority,true);
1320
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1321
+		return $this->insertAtIndexInPriority($item, false, $priority, true);
1322 1322
 	}
1323
-	public function insertAt($index,$item)
1323
+	public function insertAt($index, $item)
1324 1324
 	{
1325 1325
 		if($this->getReadOnly())
1326
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1327
-		if(($priority=$this->priorityAt($index,true))!==false)
1328
-			$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
1326
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1327
+		if(($priority=$this->priorityAt($index, true))!==false)
1328
+			$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
1329 1329
 		else
1330
-			throw new TInvalidDataValueException('list_index_invalid',$index);
1330
+			throw new TInvalidDataValueException('list_index_invalid', $index);
1331 1331
 	}
1332
-	public function insertAtIndexInPriority($item,$index=false,$priority=null,$preserveCache=false)
1332
+	public function insertAtIndexInPriority($item, $index=false, $priority=null, $preserveCache=false)
1333 1333
 	{
1334 1334
 		if($this->getReadOnly())
1335
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1335
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1336 1336
 		if($priority===null)
1337 1337
 			$priority=$this->getDefaultPriority();
1338
-		$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
1338
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1339 1339
 		if($preserveCache) {
1340 1340
 			$this->sortPriorities();
1341 1341
 			$cc=0;
1342 1342
 			foreach($this->_d as $prioritykey=>$items)
1343
-				if($prioritykey>=$priority)
1343
+				if($prioritykey >= $priority)
1344 1344
 					break;
1345 1345
 				else
1346 1346
 					$cc+=count($items);
1347
-			if($index===false&&isset($this->_d[$priority])) {
1347
+			if($index===false && isset($this->_d[$priority])) {
1348 1348
 				$c=count($this->_d[$priority]);
1349 1349
 				$c+=$cc;
1350 1350
 				$this->_d[$priority][]=$item;
1351 1351
 			} else if(isset($this->_d[$priority])) {
1352
-				$c=$index+$cc;
1353
-				array_splice($this->_d[$priority],$index,0,array($item));
1352
+				$c=$index + $cc;
1353
+				array_splice($this->_d[$priority], $index, 0, array($item));
1354 1354
 			} else {
1355
-				$c = $cc;
1356
-				$this->_o = false;
1355
+				$c=$cc;
1356
+				$this->_o=false;
1357 1357
 				$this->_d[$priority]=array($item);
1358 1358
 			}
1359
-			if($this->_fd&&is_array($this->_fd)) 				array_splice($this->_fd,$c,0,array($item));
1359
+			if($this->_fd && is_array($this->_fd)) 				array_splice($this->_fd, $c, 0, array($item));
1360 1360
 		} else {
1361 1361
 			$c=null;
1362
-			if($index===false&&isset($this->_d[$priority])) {
1362
+			if($index===false && isset($this->_d[$priority])) {
1363 1363
 				$cc=count($this->_d[$priority]);
1364 1364
 				$this->_d[$priority][]=$item;
1365 1365
 			} else if(isset($this->_d[$priority])) {
1366 1366
 				$cc=$index;
1367
-				array_splice($this->_d[$priority],$index,0,array($item));
1367
+				array_splice($this->_d[$priority], $index, 0, array($item));
1368 1368
 			} else {
1369 1369
 				$cc=0;
1370 1370
 				$this->_o=false;
1371 1371
 				$this->_d[$priority]=array($item);
1372 1372
 			}
1373
-			if($this->_fd&&is_array($this->_fd)&&count($this->_d)==1)
1374
-				array_splice($this->_fd,$cc,0,array($item));
1373
+			if($this->_fd && is_array($this->_fd) && count($this->_d)==1)
1374
+				array_splice($this->_fd, $cc, 0, array($item));
1375 1375
 			else
1376 1376
 				$this->_fd=null;
1377 1377
 		}
1378 1378
 		$this->_c++;
1379 1379
 		return $c;
1380 1380
 	}
1381
-	public function remove($item,$priority=false)
1381
+	public function remove($item, $priority=false)
1382 1382
 	{
1383 1383
 		if($this->getReadOnly())
1384
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1385
-		if(($p=$this->priorityOf($item,true))!==false)
1384
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1385
+		if(($p=$this->priorityOf($item, true))!==false)
1386 1386
 		{
1387 1387
 			if($priority!==false) {
1388 1388
 				if($priority===null)
1389 1389
 					$priority=$this->getDefaultPriority();
1390
-				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1390
+				$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1391 1391
 				if($p[0]!=$priority)
1392 1392
 					throw new TInvalidDataValueException('list_item_inexistent');
1393 1393
 			}
1394
-			$this->removeAtIndexInPriority($p[1],$p[0]);
1394
+			$this->removeAtIndexInPriority($p[1], $p[0]);
1395 1395
 			return $p[2];
1396 1396
 		}
1397 1397
 		else
@@ -1400,21 +1400,21 @@  discard block
 block discarded – undo
1400 1400
 	public function removeAt($index)
1401 1401
 	{
1402 1402
 		if($this->getReadOnly())
1403
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1403
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1404 1404
 		if(($priority=$this->priorityAt($index, true))!==false)
1405
-			return $this->removeAtIndexInPriority($priority[1],$priority[0]);
1406
-		throw new TInvalidDataValueException('list_index_invalid',$index);
1405
+			return $this->removeAtIndexInPriority($priority[1], $priority[0]);
1406
+		throw new TInvalidDataValueException('list_index_invalid', $index);
1407 1407
 	}
1408 1408
 	public function removeAtIndexInPriority($index, $priority=null)
1409 1409
 	{
1410 1410
 		if($this->getReadOnly())
1411
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1411
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1412 1412
 		if($priority===null)
1413 1413
 			$priority=$this->getDefaultPriority();
1414
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1415
-		if(!isset($this->_d[$priority])||$index<0||$index>=count($this->_d[$priority]))
1414
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1415
+		if(!isset($this->_d[$priority]) || $index < 0 || $index >= count($this->_d[$priority]))
1416 1416
 			throw new TInvalidDataValueException('list_item_inexistent');
1417
-				$value=array_splice($this->_d[$priority],$index,1);
1417
+				$value=array_splice($this->_d[$priority], $index, 1);
1418 1418
 		$value=$value[0];
1419 1419
 		if(!count($this->_d[$priority]))
1420 1420
 			unset($this->_d[$priority]);
@@ -1425,71 +1425,71 @@  discard block
 block discarded – undo
1425 1425
 	public function clear()
1426 1426
 	{
1427 1427
 		if($this->getReadOnly())
1428
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1429
-		$d=array_reverse($this->_d,true);
1428
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1429
+		$d=array_reverse($this->_d, true);
1430 1430
 		foreach($this->_d as $priority=>$items) {
1431
-			for($index=count($items)-1;$index>=0;$index--)
1432
-				$this->removeAtIndexInPriority($index,$priority);
1431
+			for($index=count($items) - 1; $index >= 0; $index--)
1432
+				$this->removeAtIndexInPriority($index, $priority);
1433 1433
 			unset($this->_d[$priority]);
1434 1434
 		}
1435 1435
 	}
1436 1436
 	public function contains($item)
1437 1437
 	{
1438
-		return $this->indexOf($item)>=0;
1438
+		return $this->indexOf($item) >= 0;
1439 1439
 	}
1440 1440
 	public function indexOf($item)
1441 1441
 	{
1442
-		if(($index=array_search($item,$this->flattenPriorities(),true))===false)
1442
+		if(($index=array_search($item, $this->flattenPriorities(), true))===false)
1443 1443
 			return -1;
1444 1444
 		else
1445 1445
 			return $index;
1446 1446
 	}
1447
-	public function priorityOf($item,$withindex = false)
1447
+	public function priorityOf($item, $withindex=false)
1448 1448
 	{
1449 1449
 		$this->sortPriorities();
1450
-		$absindex = 0;
1450
+		$absindex=0;
1451 1451
 		foreach($this->_d as $priority=>$items) {
1452
-			if(($index=array_search($item,$items,true))!==false) {
1452
+			if(($index=array_search($item, $items, true))!==false) {
1453 1453
 				$absindex+=$index;
1454
-				return $withindex?array($priority,$index,$absindex,
1455
-						'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
1454
+				return $withindex ? array($priority, $index, $absindex,
1455
+						'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority;
1456 1456
 			} else
1457 1457
 				$absindex+=count($items);
1458 1458
 		}
1459 1459
 		return false;
1460 1460
 	}
1461
-	public function priorityAt($index,$withindex = false)
1461
+	public function priorityAt($index, $withindex=false)
1462 1462
 	{
1463
-		if($index<0||$index>=$this->getCount())
1464
-			throw new TInvalidDataValueException('list_index_invalid',$index);
1463
+		if($index < 0 || $index >= $this->getCount())
1464
+			throw new TInvalidDataValueException('list_index_invalid', $index);
1465 1465
 		$absindex=$index;
1466 1466
 		$this->sortPriorities();
1467 1467
 		foreach($this->_d as $priority=>$items) {
1468
-			if($index>=($c=count($items)))
1468
+			if($index >= ($c=count($items)))
1469 1469
 				$index-=$c;
1470 1470
 			else
1471
-				return $withindex?array($priority,$index,$absindex,
1472
-						'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
1471
+				return $withindex ? array($priority, $index, $absindex,
1472
+						'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority;
1473 1473
 		}
1474 1474
 		return false;
1475 1475
 	}
1476 1476
 	public function insertBefore($indexitem, $item)
1477 1477
 	{
1478 1478
 		if($this->getReadOnly())
1479
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1480
-		if(($priority=$this->priorityOf($indexitem,true))===false)
1479
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1480
+		if(($priority=$this->priorityOf($indexitem, true))===false)
1481 1481
 			throw new TInvalidDataValueException('list_item_inexistent');
1482
-		$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
1482
+		$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
1483 1483
 		return $priority[2];
1484 1484
 	}
1485 1485
 	public function insertAfter($indexitem, $item)
1486 1486
 	{
1487 1487
 		if($this->getReadOnly())
1488
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1489
-		if(($priority=$this->priorityOf($indexitem,true))===false)
1488
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1489
+		if(($priority=$this->priorityOf($indexitem, true))===false)
1490 1490
 			throw new TInvalidDataValueException('list_item_inexistent');
1491
-		$this->insertAtIndexInPriority($item,$priority[1]+1,$priority[0]);
1492
-		return $priority[2]+1;
1491
+		$this->insertAtIndexInPriority($item, $priority[1] + 1, $priority[0]);
1492
+		return $priority[2] + 1;
1493 1493
 	}
1494 1494
 	public function toArray()
1495 1495
 	{
@@ -1500,27 +1500,27 @@  discard block
 block discarded – undo
1500 1500
 		$this->sortPriorities();
1501 1501
 		return $this->_d;
1502 1502
 	}
1503
-	public function toArrayBelowPriority($priority,$inclusive=false)
1503
+	public function toArrayBelowPriority($priority, $inclusive=false)
1504 1504
 	{
1505 1505
 		$this->sortPriorities();
1506 1506
 		$items=array();
1507 1507
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
1508 1508
 		{
1509
-			if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority)
1509
+			if((!$inclusive && $itemspriority >= $priority) || $itemspriority > $priority)
1510 1510
 				break;
1511
-			$items=array_merge($items,$itemsatpriority);
1511
+			$items=array_merge($items, $itemsatpriority);
1512 1512
 		}
1513 1513
 		return $items;
1514 1514
 	}
1515
-	public function toArrayAbovePriority($priority,$inclusive=true)
1515
+	public function toArrayAbovePriority($priority, $inclusive=true)
1516 1516
 	{
1517 1517
 		$this->sortPriorities();
1518 1518
 		$items=array();
1519 1519
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
1520 1520
 		{
1521
-			if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority)
1521
+			if((!$inclusive && $itemspriority <= $priority) || $itemspriority < $priority)
1522 1522
 				continue;
1523
-			$items=array_merge($items,$itemsatpriority);
1523
+			$items=array_merge($items, $itemsatpriority);
1524 1524
 		}
1525 1525
 		return $items;
1526 1526
 	}
@@ -1528,15 +1528,15 @@  discard block
 block discarded – undo
1528 1528
 	{
1529 1529
 		if($data instanceof TPriorityList)
1530 1530
 		{
1531
-			if($this->getCount()>0)
1531
+			if($this->getCount() > 0)
1532 1532
 				$this->clear();
1533 1533
 			foreach($data->getPriorities() as $priority)
1534 1534
 			{
1535 1535
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
1536
-					$this->insertAtIndexInPriority($item,$index,$priority);
1536
+					$this->insertAtIndexInPriority($item, $index, $priority);
1537 1537
 			}
1538
-		} else if(is_array($data)||$data instanceof Traversable) {
1539
-			if($this->getCount()>0)
1538
+		} else if(is_array($data) || $data instanceof Traversable) {
1539
+			if($this->getCount() > 0)
1540 1540
 				$this->clear();
1541 1541
 			foreach($data as $key=>$item)
1542 1542
 				$this->add($item);
@@ -1550,10 +1550,10 @@  discard block
 block discarded – undo
1550 1550
 			foreach($data->getPriorities() as $priority)
1551 1551
 			{
1552 1552
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
1553
-					$this->insertAtIndexInPriority($item,false,$priority);
1553
+					$this->insertAtIndexInPriority($item, false, $priority);
1554 1554
 			}
1555 1555
 		}
1556
-		else if(is_array($data)||$data instanceof Traversable)
1556
+		else if(is_array($data) || $data instanceof Traversable)
1557 1557
 		{
1558 1558
 			foreach($data as $priority=>$item)
1559 1559
 				$this->add($item);
@@ -1563,43 +1563,43 @@  discard block
 block discarded – undo
1563 1563
 	}
1564 1564
 	public function offsetExists($offset)
1565 1565
 	{
1566
-		return ($offset>=0&&$offset<$this->getCount());
1566
+		return ($offset >= 0 && $offset < $this->getCount());
1567 1567
 	}
1568 1568
 	public function offsetGet($offset)
1569 1569
 	{
1570 1570
 		return $this->itemAt($offset);
1571 1571
 	}
1572
-	public function offsetSet($offset,$item)
1572
+	public function offsetSet($offset, $item)
1573 1573
 	{
1574 1574
 		if($offset===null)
1575 1575
 			return $this->add($item);
1576 1576
 		if($offset===$this->getCount()) {
1577
-			$priority=$this->priorityAt($offset-1,true);
1577
+			$priority=$this->priorityAt($offset - 1, true);
1578 1578
 			$priority[1]++;
1579 1579
 		} else {
1580
-			$priority=$this->priorityAt($offset,true);
1581
-			$this->removeAtIndexInPriority($priority[1],$priority[0]);
1580
+			$priority=$this->priorityAt($offset, true);
1581
+			$this->removeAtIndexInPriority($priority[1], $priority[0]);
1582 1582
 		}
1583
-		$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
1583
+		$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
1584 1584
 	}
1585 1585
 	public function offsetUnset($offset)
1586 1586
 	{
1587 1587
 		$this->removeAt($offset);
1588 1588
 	}
1589 1589
 }
1590
-class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable
1590
+class TMap extends TComponent implements IteratorAggregate, ArrayAccess, Countable
1591 1591
 {
1592 1592
 	private $_d=array();
1593 1593
 	private $_r=false;
1594 1594
 	protected function __getZappableSleepProps(&$exprops)
1595 1595
 	{
1596 1596
 		parent::__getZappableSleepProps($exprops);
1597
-		if ($this->_d===array())
1598
-			$exprops[] = "\0TMap\0_d";
1599
-		if ($this->_r===false)
1600
-			$exprops[] = "\0TMap\0_r";
1597
+		if($this->_d===array())
1598
+			$exprops[]="\0TMap\0_d";
1599
+		if($this->_r===false)
1600
+			$exprops[]="\0TMap\0_r";
1601 1601
 	}
1602
-	public function __construct($data=null,$readOnly=false)
1602
+	public function __construct($data=null, $readOnly=false)
1603 1603
 	{
1604 1604
 		if($data!==null)
1605 1605
 			$this->copyFrom($data);
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
 	}
1616 1616
 	public function getIterator()
1617 1617
 	{
1618
-		return new ArrayIterator( $this->_d );
1618
+		return new ArrayIterator($this->_d);
1619 1619
 	}
1620 1620
 	public function count()
1621 1621
 	{
@@ -1633,18 +1633,18 @@  discard block
 block discarded – undo
1633 1633
 	{
1634 1634
 		return isset($this->_d[$key]) ? $this->_d[$key] : null;
1635 1635
 	}
1636
-	public function add($key,$value)
1636
+	public function add($key, $value)
1637 1637
 	{
1638 1638
 		if(!$this->_r)
1639 1639
 			$this->_d[$key]=$value;
1640 1640
 		else
1641
-			throw new TInvalidOperationException('map_readonly',get_class($this));
1641
+			throw new TInvalidOperationException('map_readonly', get_class($this));
1642 1642
 	}
1643 1643
 	public function remove($key)
1644 1644
 	{
1645 1645
 		if(!$this->_r)
1646 1646
 		{
1647
-			if(isset($this->_d[$key]) || array_key_exists($key,$this->_d))
1647
+			if(isset($this->_d[$key]) || array_key_exists($key, $this->_d))
1648 1648
 			{
1649 1649
 				$value=$this->_d[$key];
1650 1650
 				unset($this->_d[$key]);
@@ -1654,7 +1654,7 @@  discard block
 block discarded – undo
1654 1654
 				return null;
1655 1655
 		}
1656 1656
 		else
1657
-			throw new TInvalidOperationException('map_readonly',get_class($this));
1657
+			throw new TInvalidOperationException('map_readonly', get_class($this));
1658 1658
 	}
1659 1659
 	public function clear()
1660 1660
 	{
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
 	}
1664 1664
 	public function contains($key)
1665 1665
 	{
1666
-		return isset($this->_d[$key]) || array_key_exists($key,$this->_d);
1666
+		return isset($this->_d[$key]) || array_key_exists($key, $this->_d);
1667 1667
 	}
1668 1668
 	public function toArray()
1669 1669
 	{
@@ -1673,10 +1673,10 @@  discard block
 block discarded – undo
1673 1673
 	{
1674 1674
 		if(is_array($data) || $data instanceof Traversable)
1675 1675
 		{
1676
-			if($this->getCount()>0)
1676
+			if($this->getCount() > 0)
1677 1677
 				$this->clear();
1678 1678
 			foreach($data as $key=>$value)
1679
-				$this->add($key,$value);
1679
+				$this->add($key, $value);
1680 1680
 		}
1681 1681
 		else if($data!==null)
1682 1682
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -1686,7 +1686,7 @@  discard block
 block discarded – undo
1686 1686
 		if(is_array($data) || $data instanceof Traversable)
1687 1687
 		{
1688 1688
 			foreach($data as $key=>$value)
1689
-				$this->add($key,$value);
1689
+				$this->add($key, $value);
1690 1690
 		}
1691 1691
 		else if($data!==null)
1692 1692
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -1699,9 +1699,9 @@  discard block
 block discarded – undo
1699 1699
 	{
1700 1700
 		return $this->itemAt($offset);
1701 1701
 	}
1702
-	public function offsetSet($offset,$item)
1702
+	public function offsetSet($offset, $item)
1703 1703
 	{
1704
-		$this->add($offset,$item);
1704
+		$this->add($offset, $item);
1705 1705
 	}
1706 1706
 	public function offsetUnset($offset)
1707 1707
 	{
@@ -1720,7 +1720,7 @@  discard block
 block discarded – undo
1720 1720
 	private $_c=0;
1721 1721
 	private $_dp=10;
1722 1722
 	private $_p=8;
1723
-	public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8)
1723
+	public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8)
1724 1724
 	{
1725 1725
 		if($data!==null)
1726 1726
 			$this->copyFrom($data);
@@ -1742,7 +1742,7 @@  discard block
 block discarded – undo
1742 1742
 	}
1743 1743
 	protected function setDefaultPriority($value)
1744 1744
 	{
1745
-		$this->_dp = (string)round(TPropertyValue::ensureFloat($value), $this->_p);
1745
+		$this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p);
1746 1746
 	}
1747 1747
 	public function getPrecision()
1748 1748
 	{
@@ -1766,9 +1766,9 @@  discard block
 block discarded – undo
1766 1766
 		if(is_array($this->_fd))
1767 1767
 			return $this->_fd;
1768 1768
 		$this->sortPriorities();
1769
-		$this->_fd = array();
1769
+		$this->_fd=array();
1770 1770
 		foreach($this->_d as $priority => $itemsatpriority)
1771
-			$this->_fd = array_merge($this->_fd, $itemsatpriority);
1771
+			$this->_fd=array_merge($this->_fd, $itemsatpriority);
1772 1772
 		return $this->_fd;
1773 1773
 	}
1774 1774
 	public function count()
@@ -1783,8 +1783,8 @@  discard block
 block discarded – undo
1783 1783
 	{
1784 1784
 		if($priority===null)
1785 1785
 			$priority=$this->getDefaultPriority();
1786
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1787
-		if(!isset($this->_d[$priority])||!is_array($this->_d[$priority]))
1786
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1787
+		if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority]))
1788 1788
 			return false;
1789 1789
 		return count($this->_d[$priority]);
1790 1790
 	}
@@ -1797,27 +1797,27 @@  discard block
 block discarded – undo
1797 1797
 	{
1798 1798
 		return array_keys($this->flattenPriorities());
1799 1799
 	}
1800
-	public function itemAt($key,$priority=false)
1800
+	public function itemAt($key, $priority=false)
1801 1801
 	{
1802
-		if($priority===false){
1802
+		if($priority===false) {
1803 1803
 			$map=$this->flattenPriorities();
1804
-			return isset($map[$key])?$map[$key]:null;
1804
+			return isset($map[$key]) ? $map[$key] : null;
1805 1805
 		} else {
1806 1806
 			if($priority===null)
1807 1807
 				$priority=$this->getDefaultPriority();
1808
-			$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1809
-			return (isset($this->_d[$priority])&&isset($this->_d[$priority][$key]))?$this->_d[$priority][$key]:null;
1808
+			$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1809
+			return (isset($this->_d[$priority]) && isset($this->_d[$priority][$key])) ? $this->_d[$priority][$key] : null;
1810 1810
 		}
1811 1811
 	}
1812
-	public function setPriorityAt($key,$priority=null)
1812
+	public function setPriorityAt($key, $priority=null)
1813 1813
 	{
1814 1814
 		if($priority===null)
1815 1815
 			$priority=$this->getDefaultPriority();
1816
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1816
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1817 1817
 		$oldpriority=$this->priorityAt($key);
1818
-		if($oldpriority!==false&&$oldpriority!=$priority) {
1819
-			$value=$this->remove($key,$oldpriority);
1820
-			$this->add($key,$value,$priority);
1818
+		if($oldpriority!==false && $oldpriority!=$priority) {
1819
+			$value=$this->remove($key, $oldpriority);
1820
+			$this->add($key, $value, $priority);
1821 1821
 		}
1822 1822
 		return $oldpriority;
1823 1823
 	}
@@ -1825,14 +1825,14 @@  discard block
 block discarded – undo
1825 1825
 	{
1826 1826
 		if($priority===null)
1827 1827
 			$priority=$this->getDefaultPriority();
1828
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1829
-		return isset($this->_d[$priority])?$this->_d[$priority]:null;
1828
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1829
+		return isset($this->_d[$priority]) ? $this->_d[$priority] : null;
1830 1830
 	}
1831 1831
 	public function priorityOf($item)
1832 1832
 	{
1833 1833
 		$this->sortPriorities();
1834 1834
 		foreach($this->_d as $priority=>$items)
1835
-			if(($index=array_search($item,$items,true))!==false)
1835
+			if(($index=array_search($item, $items, true))!==false)
1836 1836
 				return $priority;
1837 1837
 		return false;
1838 1838
 	}
@@ -1840,19 +1840,19 @@  discard block
 block discarded – undo
1840 1840
 	{
1841 1841
 		$this->sortPriorities();
1842 1842
 		foreach($this->_d as $priority=>$items)
1843
-			if(array_key_exists($key,$items))
1843
+			if(array_key_exists($key, $items))
1844 1844
 				return $priority;
1845 1845
 		return false;
1846 1846
 	}
1847
-	public function add($key,$value,$priority=null)
1847
+	public function add($key, $value, $priority=null)
1848 1848
 	{
1849 1849
 		if($priority===null)
1850 1850
 			$priority=$this->getDefaultPriority();
1851
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1851
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1852 1852
 		if(!$this->_r)
1853 1853
 		{
1854 1854
 			foreach($this->_d as $innerpriority=>$items)
1855
-				if(array_key_exists($key,$items))
1855
+				if(array_key_exists($key, $items))
1856 1856
 				{
1857 1857
 					unset($this->_d[$innerpriority][$key]);
1858 1858
 					$this->_c--;
@@ -1869,10 +1869,10 @@  discard block
 block discarded – undo
1869 1869
 			$this->_fd=null;
1870 1870
 		}
1871 1871
 		else
1872
-			throw new TInvalidOperationException('map_readonly',get_class($this));
1872
+			throw new TInvalidOperationException('map_readonly', get_class($this));
1873 1873
 		return $priority;
1874 1874
 	}
1875
-	public function remove($key,$priority=false)
1875
+	public function remove($key, $priority=false)
1876 1876
 	{
1877 1877
 		if(!$this->_r)
1878 1878
 		{
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
 			{
1883 1883
 				$this->sortPriorities();
1884 1884
 				foreach($this->_d as $priority=>$items)
1885
-					if(array_key_exists($key,$items))
1885
+					if(array_key_exists($key, $items))
1886 1886
 					{
1887 1887
 						$value=$this->_d[$priority][$key];
1888 1888
 						unset($this->_d[$priority][$key]);
@@ -1899,8 +1899,8 @@  discard block
 block discarded – undo
1899 1899
 			}
1900 1900
 			else
1901 1901
 			{
1902
-				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1903
-				if(isset($this->_d[$priority])&&(isset($this->_d[$priority][$key])||array_key_exists($key,$this->_d[$priority])))
1902
+				$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1903
+				if(isset($this->_d[$priority]) && (isset($this->_d[$priority][$key]) || array_key_exists($key, $this->_d[$priority])))
1904 1904
 				{
1905 1905
 					$value=$this->_d[$priority][$key];
1906 1906
 					unset($this->_d[$priority][$key]);
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
 			}
1918 1918
 		}
1919 1919
 		else
1920
-			throw new TInvalidOperationException('map_readonly',get_class($this));
1920
+			throw new TInvalidOperationException('map_readonly', get_class($this));
1921 1921
 	}
1922 1922
 	public function clear()
1923 1923
 	{
@@ -1928,33 +1928,33 @@  discard block
 block discarded – undo
1928 1928
 	public function contains($key)
1929 1929
 	{
1930 1930
 		$map=$this->flattenPriorities();
1931
-		return isset($map[$key])||array_key_exists($key,$map);
1931
+		return isset($map[$key]) || array_key_exists($key, $map);
1932 1932
 	}
1933 1933
 	public function toArray()
1934 1934
 	{
1935 1935
 		return $this->flattenPriorities();
1936 1936
 	}
1937
-	public function toArrayBelowPriority($priority,$inclusive=false)
1937
+	public function toArrayBelowPriority($priority, $inclusive=false)
1938 1938
 	{
1939 1939
 		$this->sortPriorities();
1940 1940
 		$items=array();
1941 1941
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
1942 1942
 		{
1943
-			if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority)
1943
+			if((!$inclusive && $itemspriority >= $priority) || $itemspriority > $priority)
1944 1944
 				break;
1945
-			$items=array_merge($items,$itemsatpriority);
1945
+			$items=array_merge($items, $itemsatpriority);
1946 1946
 		}
1947 1947
 		return $items;
1948 1948
 	}
1949
-	public function toArrayAbovePriority($priority,$inclusive=true)
1949
+	public function toArrayAbovePriority($priority, $inclusive=true)
1950 1950
 	{
1951 1951
 		$this->sortPriorities();
1952 1952
 		$items=array();
1953 1953
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
1954 1954
 		{
1955
-			if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority)
1955
+			if((!$inclusive && $itemspriority <= $priority) || $itemspriority < $priority)
1956 1956
 				continue;
1957
-			$items=array_merge($items,$itemsatpriority);
1957
+			$items=array_merge($items, $itemsatpriority);
1958 1958
 		}
1959 1959
 		return $items;
1960 1960
 	}
@@ -1962,20 +1962,20 @@  discard block
 block discarded – undo
1962 1962
 	{
1963 1963
 		if($data instanceof TPriorityMap)
1964 1964
 		{
1965
-			if($this->getCount()>0)
1965
+			if($this->getCount() > 0)
1966 1966
 				$this->clear();
1967 1967
 			foreach($data->getPriorities() as $priority) {
1968 1968
 				foreach($data->itemsAtPriority($priority) as $key => $value) {
1969
-					$this->add($key,$value,$priority);
1969
+					$this->add($key, $value, $priority);
1970 1970
 				}
1971 1971
 			}
1972 1972
 		}
1973
-		else if(is_array($data)||$data instanceof Traversable)
1973
+		else if(is_array($data) || $data instanceof Traversable)
1974 1974
 		{
1975
-			if($this->getCount()>0)
1975
+			if($this->getCount() > 0)
1976 1976
 				$this->clear();
1977 1977
 			foreach($data as $key=>$value)
1978
-				$this->add($key,$value);
1978
+				$this->add($key, $value);
1979 1979
 		}
1980 1980
 		else if($data!==null)
1981 1981
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -1987,13 +1987,13 @@  discard block
 block discarded – undo
1987 1987
 			foreach($data->getPriorities() as $priority)
1988 1988
 			{
1989 1989
 				foreach($data->itemsAtPriority($priority) as $key => $value)
1990
-					$this->add($key,$value,$priority);
1990
+					$this->add($key, $value, $priority);
1991 1991
 			}
1992 1992
 		}
1993
-		else if(is_array($data)||$data instanceof Traversable)
1993
+		else if(is_array($data) || $data instanceof Traversable)
1994 1994
 		{
1995 1995
 			foreach($data as $key=>$value)
1996
-				$this->add($key,$value);
1996
+				$this->add($key, $value);
1997 1997
 		}
1998 1998
 		else if($data!==null)
1999 1999
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -2006,16 +2006,16 @@  discard block
 block discarded – undo
2006 2006
 	{
2007 2007
 		return $this->itemAt($offset);
2008 2008
 	}
2009
-	public function offsetSet($offset,$item)
2009
+	public function offsetSet($offset, $item)
2010 2010
 	{
2011
-		$this->add($offset,$item);
2011
+		$this->add($offset, $item);
2012 2012
 	}
2013 2013
 	public function offsetUnset($offset)
2014 2014
 	{
2015 2015
 		$this->remove($offset);
2016 2016
 	}
2017 2017
 }
2018
-class TStack extends TComponent implements IteratorAggregate,Countable
2018
+class TStack extends TComponent implements IteratorAggregate, Countable
2019 2019
 {
2020 2020
 	private $_d=array();
2021 2021
 	private $_c=0;
@@ -2049,14 +2049,14 @@  discard block
 block discarded – undo
2049 2049
 	}
2050 2050
 	public function contains($item)
2051 2051
 	{
2052
-		return array_search($item,$this->_d,true)!==false;
2052
+		return array_search($item, $this->_d, true)!==false;
2053 2053
 	}
2054 2054
 	public function peek()
2055 2055
 	{
2056 2056
 		if($this->_c===0)
2057 2057
 			throw new TInvalidOperationException('stack_empty');
2058 2058
 		else
2059
-			return $this->_d[$this->_c-1];
2059
+			return $this->_d[$this->_c - 1];
2060 2060
 	}
2061 2061
 	public function pop()
2062 2062
 	{
@@ -2071,11 +2071,11 @@  discard block
 block discarded – undo
2071 2071
 	public function push($item)
2072 2072
 	{
2073 2073
 		++$this->_c;
2074
-		$this->_d[] = $item;
2074
+		$this->_d[]=$item;
2075 2075
 	}
2076 2076
 	public function getIterator()
2077 2077
 	{
2078
-		return new ArrayIterator( $this->_d );
2078
+		return new ArrayIterator($this->_d);
2079 2079
 	}
2080 2080
 	public function getCount()
2081 2081
 	{
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
 	}
2116 2116
 	public function valid()
2117 2117
 	{
2118
-		return $this->_i<$this->_c;
2118
+		return $this->_i < $this->_c;
2119 2119
 	}
2120 2120
 }
2121 2121
 class TXmlElement extends TComponent
@@ -2155,11 +2155,11 @@  discard block
 block discarded – undo
2155 2155
 	}
2156 2156
 	public function getHasElement()
2157 2157
 	{
2158
-		return $this->_elements!==null && $this->_elements->getCount()>0;
2158
+		return $this->_elements!==null && $this->_elements->getCount() > 0;
2159 2159
 	}
2160 2160
 	public function getHasAttribute()
2161 2161
 	{
2162
-		return $this->_attributes!==null && $this->_attributes->getCount()>0;
2162
+		return $this->_attributes!==null && $this->_attributes->getCount() > 0;
2163 2163
 	}
2164 2164
 	public function getAttribute($name)
2165 2165
 	{
@@ -2168,9 +2168,9 @@  discard block
 block discarded – undo
2168 2168
 		else
2169 2169
 			return null;
2170 2170
 	}
2171
-	public function setAttribute($name,$value)
2171
+	public function setAttribute($name, $value)
2172 2172
 	{
2173
-		$this->getAttributes()->add($name,TPropertyValue::ensureString($value));
2173
+		$this->getAttributes()->add($name, TPropertyValue::ensureString($value));
2174 2174
 	}
2175 2175
 	public function getElements()
2176 2176
 	{
@@ -2216,12 +2216,12 @@  discard block
 block discarded – undo
2216 2216
 				$attr.=" $name=\"$value\"";
2217 2217
 			}
2218 2218
 		}
2219
-		$prefix=str_repeat(' ',$indent*4);
2219
+		$prefix=str_repeat(' ', $indent * 4);
2220 2220
 		if($this->getHasElement())
2221 2221
 		{
2222 2222
 			$str=$prefix."<{$this->_tagName}$attr>\n";
2223 2223
 			foreach($this->getElements() as $element)
2224
-				$str.=$element->toString($indent+1)."\n";
2224
+				$str.=$element->toString($indent + 1)."\n";
2225 2225
 			$str.=$prefix."</{$this->_tagName}>";
2226 2226
 			return $str;
2227 2227
 		}
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
 	}
2240 2240
 	private function xmlEncode($str)
2241 2241
 	{
2242
-		return strtr($str,array(
2242
+		return strtr($str, array(
2243 2243
 			'>'=>'&gt;',
2244 2244
 			'<'=>'&lt;',
2245 2245
 			'&'=>'&amp;',
@@ -2253,7 +2253,7 @@  discard block
 block discarded – undo
2253 2253
 {
2254 2254
 	private $_version;
2255 2255
 	private $_encoding;
2256
-	public function __construct($version='1.0',$encoding='')
2256
+	public function __construct($version='1.0', $encoding='')
2257 2257
 	{
2258 2258
 		parent::__construct('');
2259 2259
 		$this->setVersion($version);
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
 		if(($str=@file_get_contents($file))!==false)
2281 2281
 			return $this->loadFromString($str);
2282 2282
 		else
2283
-			throw new TIOException('xmldocument_file_read_failed',$file);
2283
+			throw new TIOException('xmldocument_file_read_failed', $file);
2284 2284
 	}
2285 2285
 	public function loadFromString($string)
2286 2286
 	{
@@ -2297,23 +2297,23 @@  discard block
 block discarded – undo
2297 2297
 		$elements->clear();
2298 2298
 		$attributes->clear();
2299 2299
 		static $bSimpleXml;
2300
-		if($bSimpleXml === null)
2301
-			$bSimpleXml = (boolean)function_exists('simplexml_load_string');
2300
+		if($bSimpleXml===null)
2301
+			$bSimpleXml=(boolean) function_exists('simplexml_load_string');
2302 2302
 		if($bSimpleXml)
2303 2303
 		{
2304
-			$simpleDoc = simplexml_load_string($string);
2305
-			$docNamespaces = $simpleDoc->getDocNamespaces(false);
2306
-			$simpleDoc = null;
2304
+			$simpleDoc=simplexml_load_string($string);
2305
+			$docNamespaces=$simpleDoc->getDocNamespaces(false);
2306
+			$simpleDoc=null;
2307 2307
 			foreach($docNamespaces as $prefix => $uri)
2308 2308
 			{
2309
- 				if($prefix === '')
2309
+ 				if($prefix==='')
2310 2310
    					$attributes->add('xmlns', $uri);
2311 2311
    				else
2312 2312
    					$attributes->add('xmlns:'.$prefix, $uri);
2313 2313
 			}
2314 2314
 		}
2315 2315
 		foreach($element->attributes as $name=>$attr)
2316
-			$attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value);
2316
+			$attributes->add(($attr->prefix==='' ? '' : $attr->prefix.':').$name, $attr->value);
2317 2317
 		foreach($element->childNodes as $child)
2318 2318
 		{
2319 2319
 			if($child instanceof DOMElement)
@@ -2323,18 +2323,18 @@  discard block
 block discarded – undo
2323 2323
 	}
2324 2324
 	public function saveToFile($file)
2325 2325
 	{
2326
-		if(($fw=fopen($file,'w'))!==false)
2326
+		if(($fw=fopen($file, 'w'))!==false)
2327 2327
 		{
2328
-			fwrite($fw,$this->saveToString());
2328
+			fwrite($fw, $this->saveToString());
2329 2329
 			fclose($fw);
2330 2330
 		}
2331 2331
 		else
2332
-			throw new TIOException('xmldocument_file_write_failed',$file);
2332
+			throw new TIOException('xmldocument_file_write_failed', $file);
2333 2333
 	}
2334 2334
 	public function saveToString()
2335 2335
 	{
2336
-		$version=empty($this->_version)?' version="1.0"':' version="'.$this->_version.'"';
2337
-		$encoding=empty($this->_encoding)?'':' encoding="'.$this->_encoding.'"';
2336
+		$version=empty($this->_version) ? ' version="1.0"' : ' version="'.$this->_version.'"';
2337
+		$encoding=empty($this->_encoding) ? '' : ' encoding="'.$this->_encoding.'"';
2338 2338
 		return "<?xml{$version}{$encoding}?>\n".$this->toString(0);
2339 2339
 	}
2340 2340
 	public function __toString()
@@ -2346,7 +2346,7 @@  discard block
 block discarded – undo
2346 2346
 		$element=new TXmlElement($node->tagName);
2347 2347
 		$element->setValue($node->nodeValue);
2348 2348
 		foreach($node->attributes as $name=>$attr)
2349
-			$element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value);
2349
+			$element->getAttributes()->add(($attr->prefix==='' ? '' : $attr->prefix.':').$name, $attr->value);
2350 2350
 		foreach($node->childNodes as $child)
2351 2351
 		{
2352 2352
 			if($child instanceof DOMElement)
@@ -2366,11 +2366,11 @@  discard block
 block discarded – undo
2366 2366
 	{
2367 2367
 		return $this->_o;
2368 2368
 	}
2369
-	public function insertAt($index,$item)
2369
+	public function insertAt($index, $item)
2370 2370
 	{
2371 2371
 		if($item instanceof TXmlElement)
2372 2372
 		{
2373
-			parent::insertAt($index,$item);
2373
+			parent::insertAt($index, $item);
2374 2374
 			if($item->getParent()!==null)
2375 2375
 				$item->getParent()->getElements()->remove($item);
2376 2376
 			$item->setParent($this->_o);
@@ -2396,13 +2396,13 @@  discard block
 block discarded – undo
2396 2396
 	private $_everyone;
2397 2397
 	private $_guest;
2398 2398
 	private $_authenticated;
2399
-	public function __construct($action,$users,$roles,$verb='',$ipRules='')
2399
+	public function __construct($action, $users, $roles, $verb='', $ipRules='')
2400 2400
 	{
2401 2401
 		$action=strtolower(trim($action));
2402 2402
 		if($action==='allow' || $action==='deny')
2403 2403
 			$this->_action=$action;
2404 2404
 		else
2405
-			throw new TInvalidDataValueException('authorizationrule_action_invalid',$action);
2405
+			throw new TInvalidDataValueException('authorizationrule_action_invalid', $action);
2406 2406
 		$this->_users=array();
2407 2407
 		$this->_roles=array();
2408 2408
 		$this->_ipRules=array();
@@ -2411,7 +2411,7 @@  discard block
 block discarded – undo
2411 2411
 		$this->_authenticated=false;
2412 2412
 		if(trim($users)==='')
2413 2413
 			$users='*';
2414
-		foreach(explode(',',$users) as $user)
2414
+		foreach(explode(',', $users) as $user)
2415 2415
 		{
2416 2416
 			if(($user=trim(strtolower($user)))!=='')
2417 2417
 			{
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
 		}
2431 2431
 		if(trim($roles)==='')
2432 2432
 			$roles='*';
2433
-		foreach(explode(',',$roles) as $role)
2433
+		foreach(explode(',', $roles) as $role)
2434 2434
 		{
2435 2435
 			if(($role=trim(strtolower($role)))!=='')
2436 2436
 				$this->_roles[]=$role;
@@ -2440,10 +2440,10 @@  discard block
 block discarded – undo
2440 2440
 		if($verb==='*' || $verb==='get' || $verb==='post')
2441 2441
 			$this->_verb=$verb;
2442 2442
 		else
2443
-			throw new TInvalidDataValueException('authorizationrule_verb_invalid',$verb);
2443
+			throw new TInvalidDataValueException('authorizationrule_verb_invalid', $verb);
2444 2444
 		if(trim($ipRules)==='')
2445 2445
 			$ipRules='*';
2446
-		foreach(explode(',',$ipRules) as $ipRule)
2446
+		foreach(explode(',', $ipRules) as $ipRule)
2447 2447
 		{
2448 2448
 			if(($ipRule=trim($ipRule))!=='')
2449 2449
 				$this->_ipRules[]=$ipRule;
@@ -2481,10 +2481,10 @@  discard block
 block discarded – undo
2481 2481
 	{
2482 2482
 		return $this->_authenticated || $this->_everyone;
2483 2483
 	}
2484
-	public function isUserAllowed(IUser $user,$verb,$ip)
2484
+	public function isUserAllowed(IUser $user, $verb, $ip)
2485 2485
 	{
2486 2486
 		if($this->isVerbMatched($verb) && $this->isIpMatched($ip) && $this->isUserMatched($user) && $this->isRoleMatched($user))
2487
-			return ($this->_action==='allow')?1:-1;
2487
+			return ($this->_action==='allow') ? 1 : -1;
2488 2488
 		else
2489 2489
 			return 0;
2490 2490
 	}
@@ -2494,14 +2494,14 @@  discard block
 block discarded – undo
2494 2494
 			return 1;
2495 2495
 		foreach($this->_ipRules as $rule)
2496 2496
 		{
2497
-			if($rule==='*' || $rule===$ip || (($pos=strpos($rule,'*'))!==false && strncmp($ip,$rule,$pos)===0))
2497
+			if($rule==='*' || $rule===$ip || (($pos=strpos($rule, '*'))!==false && strncmp($ip, $rule, $pos)===0))
2498 2498
 				return 1;
2499 2499
 		}
2500 2500
 		return 0;
2501 2501
 	}
2502 2502
 	private function isUserMatched($user)
2503 2503
 	{
2504
-		return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()),$this->_users));
2504
+		return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()), $this->_users));
2505 2505
 	}
2506 2506
 	private function isRoleMatched($user)
2507 2507
 	{
@@ -2514,42 +2514,42 @@  discard block
 block discarded – undo
2514 2514
 	}
2515 2515
 	private function isVerbMatched($verb)
2516 2516
 	{
2517
-		return ($this->_verb==='*' || strcasecmp($verb,$this->_verb)===0);
2517
+		return ($this->_verb==='*' || strcasecmp($verb, $this->_verb)===0);
2518 2518
 	}
2519 2519
 }
2520 2520
 class TAuthorizationRuleCollection extends TList
2521 2521
 {
2522
-	public function isUserAllowed($user,$verb,$ip)
2522
+	public function isUserAllowed($user, $verb, $ip)
2523 2523
 	{
2524 2524
 		if($user instanceof IUser)
2525 2525
 		{
2526 2526
 			$verb=strtolower(trim($verb));
2527 2527
 			foreach($this as $rule)
2528 2528
 			{
2529
-				if(($decision=$rule->isUserAllowed($user,$verb,$ip))!==0)
2530
-					return ($decision>0);
2529
+				if(($decision=$rule->isUserAllowed($user, $verb, $ip))!==0)
2530
+					return ($decision > 0);
2531 2531
 			}
2532 2532
 			return true;
2533 2533
 		}
2534 2534
 		else
2535 2535
 			return false;
2536 2536
 	}
2537
-	public function insertAt($index,$item)
2537
+	public function insertAt($index, $item)
2538 2538
 	{
2539 2539
 		if($item instanceof TAuthorizationRule)
2540
-			parent::insertAt($index,$item);
2540
+			parent::insertAt($index, $item);
2541 2541
 		else
2542 2542
 			throw new TInvalidDataTypeException('authorizationrulecollection_authorizationrule_required');
2543 2543
 	}
2544 2544
 }
2545 2545
 class TSecurityManager extends TModule
2546 2546
 {
2547
-	const STATE_VALIDATION_KEY = 'prado:securitymanager:validationkey';
2548
-	const STATE_ENCRYPTION_KEY = 'prado:securitymanager:encryptionkey';
2549
-	private $_validationKey = null;
2550
-	private $_encryptionKey = null;
2551
-	private $_hashAlgorithm = 'sha1';
2552
-	private $_cryptAlgorithm = 'rijndael-256';
2547
+	const STATE_VALIDATION_KEY='prado:securitymanager:validationkey';
2548
+	const STATE_ENCRYPTION_KEY='prado:securitymanager:encryptionkey';
2549
+	private $_validationKey=null;
2550
+	private $_encryptionKey=null;
2551
+	private $_hashAlgorithm='sha1';
2552
+	private $_cryptAlgorithm='rijndael-256';
2553 2553
 	private $_mbstring;
2554 2554
 	public function init($config)
2555 2555
 	{
@@ -2558,13 +2558,13 @@  discard block
 block discarded – undo
2558 2558
 	}
2559 2559
 	protected function generateRandomKey()
2560 2560
 	{
2561
-		return sprintf('%08x%08x%08x%08x',mt_rand(),mt_rand(),mt_rand(),mt_rand());
2561
+		return sprintf('%08x%08x%08x%08x', mt_rand(), mt_rand(), mt_rand(), mt_rand());
2562 2562
 	}
2563 2563
 	public function getValidationKey()
2564 2564
 	{
2565
-		if(null === $this->_validationKey) {
2566
-			if(null === ($this->_validationKey = $this->getApplication()->getGlobalState(self::STATE_VALIDATION_KEY))) {
2567
-				$this->_validationKey = $this->generateRandomKey();
2565
+		if(null===$this->_validationKey) {
2566
+			if(null===($this->_validationKey=$this->getApplication()->getGlobalState(self::STATE_VALIDATION_KEY))) {
2567
+				$this->_validationKey=$this->generateRandomKey();
2568 2568
 				$this->getApplication()->setGlobalState(self::STATE_VALIDATION_KEY, $this->_validationKey, null, true);
2569 2569
 			}
2570 2570
 		}
@@ -2572,15 +2572,15 @@  discard block
 block discarded – undo
2572 2572
 	}
2573 2573
 	public function setValidationKey($value)
2574 2574
 	{
2575
-		if('' === $value)
2575
+		if(''===$value)
2576 2576
 			throw new TInvalidDataValueException('securitymanager_validationkey_invalid');
2577
-		$this->_validationKey = $value;
2577
+		$this->_validationKey=$value;
2578 2578
 	}
2579 2579
 	public function getEncryptionKey()
2580 2580
 	{
2581
-		if(null === $this->_encryptionKey) {
2582
-			if(null === ($this->_encryptionKey = $this->getApplication()->getGlobalState(self::STATE_ENCRYPTION_KEY))) {
2583
-				$this->_encryptionKey = $this->generateRandomKey();
2581
+		if(null===$this->_encryptionKey) {
2582
+			if(null===($this->_encryptionKey=$this->getApplication()->getGlobalState(self::STATE_ENCRYPTION_KEY))) {
2583
+				$this->_encryptionKey=$this->generateRandomKey();
2584 2584
 				$this->getApplication()->setGlobalState(self::STATE_ENCRYPTION_KEY, $this->_encryptionKey, null, true);
2585 2585
 			}
2586 2586
 		}
@@ -2588,9 +2588,9 @@  discard block
 block discarded – undo
2588 2588
 	}
2589 2589
 	public function setEncryptionKey($value)
2590 2590
 	{
2591
-		if('' === $value)
2591
+		if(''===$value)
2592 2592
 			throw new TInvalidDataValueException('securitymanager_encryptionkey_invalid');
2593
-		$this->_encryptionKey = $value;
2593
+		$this->_encryptionKey=$value;
2594 2594
 	}
2595 2595
 	public function getValidation()
2596 2596
 	{
@@ -2602,11 +2602,11 @@  discard block
 block discarded – undo
2602 2602
 	}
2603 2603
 	public function setValidation($value)
2604 2604
 	{
2605
-		$this->_hashAlgorithm = TPropertyValue::ensureEnum($value, 'TSecurityManagerValidationMode');
2605
+		$this->_hashAlgorithm=TPropertyValue::ensureEnum($value, 'TSecurityManagerValidationMode');
2606 2606
 	}
2607 2607
 	public function setHashAlgorithm($value)
2608 2608
 	{
2609
-		$this->_hashAlgorithm = TPropertyValue::ensureString($value);
2609
+		$this->_hashAlgorithm=TPropertyValue::ensureString($value);
2610 2610
 	}
2611 2611
 	public function getEncryption()
2612 2612
 	{
@@ -2616,7 +2616,7 @@  discard block
 block discarded – undo
2616 2616
 	}
2617 2617
 	public function setEncryption($value)
2618 2618
 	{
2619
-		$this->_cryptAlgorithm = $value;
2619
+		$this->_cryptAlgorithm=$value;
2620 2620
 	}
2621 2621
 	public function getCryptAlgorithm()
2622 2622
 	{
@@ -2624,16 +2624,16 @@  discard block
 block discarded – undo
2624 2624
 	}
2625 2625
 	public function setCryptAlgorithm($value)
2626 2626
 	{
2627
-		$this->_cryptAlgorithm = $value;
2627
+		$this->_cryptAlgorithm=$value;
2628 2628
 	}
2629 2629
 	public function encrypt($data)
2630 2630
 	{
2631 2631
 		$module=$this->openCryptModule();
2632
-		$key = $this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
2632
+		$key=$this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
2633 2633
 		srand();
2634
-		$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($module), MCRYPT_RAND);
2634
+		$iv=mcrypt_create_iv(mcrypt_enc_get_iv_size($module), MCRYPT_RAND);
2635 2635
 		mcrypt_generic_init($module, $key, $iv);
2636
-		$encrypted = $iv.mcrypt_generic($module, $data);
2636
+		$encrypted=$iv.mcrypt_generic($module, $data);
2637 2637
 		mcrypt_generic_deinit($module);
2638 2638
 		mcrypt_module_close($module);
2639 2639
 		return $encrypted;
@@ -2641,11 +2641,11 @@  discard block
 block discarded – undo
2641 2641
 	public function decrypt($data)
2642 2642
 	{
2643 2643
 		$module=$this->openCryptModule();
2644
-		$key = $this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
2645
-		$ivSize = mcrypt_enc_get_iv_size($module);
2646
-		$iv = $this->substr($data, 0, $ivSize);
2644
+		$key=$this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
2645
+		$ivSize=mcrypt_enc_get_iv_size($module);
2646
+		$iv=$this->substr($data, 0, $ivSize);
2647 2647
 		mcrypt_generic_init($module, $key, $iv);
2648
-		$decrypted = mdecrypt_generic($module, $this->substr($data, $ivSize, $this->strlen($data)));
2648
+		$decrypted=mdecrypt_generic($module, $this->substr($data, $ivSize, $this->strlen($data)));
2649 2649
 		mcrypt_generic_deinit($module);
2650 2650
 		mcrypt_module_close($module);
2651 2651
 		return $decrypted;
@@ -2655,9 +2655,9 @@  discard block
 block discarded – undo
2655 2655
 		if(extension_loaded('mcrypt'))
2656 2656
 		{
2657 2657
 			if(is_array($this->_cryptAlgorithm))
2658
-				$module=@call_user_func_array('mcrypt_module_open',$this->_cryptAlgorithm);
2658
+				$module=@call_user_func_array('mcrypt_module_open', $this->_cryptAlgorithm);
2659 2659
 			else
2660
-				$module=@mcrypt_module_open($this->_cryptAlgorithm,'', MCRYPT_MODE_CBC,'');
2660
+				$module=@mcrypt_module_open($this->_cryptAlgorithm, '', MCRYPT_MODE_CBC, '');
2661 2661
 			if($module===false)
2662 2662
 				throw new TNotSupportedException('securitymanager_mcryptextension_initfailed');
2663 2663
 			return $module;
@@ -2667,7 +2667,7 @@  discard block
 block discarded – undo
2667 2667
 	}
2668 2668
 	public function hashData($data)
2669 2669
 	{
2670
-		$hmac = $this->computeHMAC($data);
2670
+		$hmac=$this->computeHMAC($data);
2671 2671
 		return $hmac.$data;
2672 2672
 	}
2673 2673
 	public function validateData($data)
@@ -2675,56 +2675,56 @@  discard block
 block discarded – undo
2675 2675
 		$len=$this->strlen($this->computeHMAC('test'));
2676 2676
 		if($this->strlen($data) < $len)
2677 2677
 			return false;
2678
-		$hmac = $this->substr($data, 0, $len);
2678
+		$hmac=$this->substr($data, 0, $len);
2679 2679
 		$data2=$this->substr($data, $len, $this->strlen($data));
2680
-		return $hmac === $this->computeHMAC($data2) ? $data2 : false;
2680
+		return $hmac===$this->computeHMAC($data2) ? $data2 : false;
2681 2681
 	}
2682 2682
 	protected function computeHMAC($data)
2683 2683
 	{
2684
-		$key = $this->getValidationKey();
2684
+		$key=$this->getValidationKey();
2685 2685
 		if(function_exists('hash_hmac'))
2686 2686
 			return hash_hmac($this->_hashAlgorithm, $data, $key);
2687
-		if(!strcasecmp($this->_hashAlgorithm,'sha1'))
2687
+		if(!strcasecmp($this->_hashAlgorithm, 'sha1'))
2688 2688
 		{
2689
-			$pack = 'H40';
2690
-			$func = 'sha1';
2689
+			$pack='H40';
2690
+			$func='sha1';
2691 2691
 		} else {
2692
-			$pack = 'H32';
2693
-			$func = 'md5';
2692
+			$pack='H32';
2693
+			$func='md5';
2694 2694
 		}
2695
-		$key = str_pad($func($key), 64, chr(0));
2696
-		return $func((str_repeat(chr(0x5C), 64) ^ substr($key, 0, 64)) . pack($pack, $func((str_repeat(chr(0x36), 64) ^ substr($key, 0, 64)) . $data)));
2695
+		$key=str_pad($func($key), 64, chr(0));
2696
+		return $func((str_repeat(chr(0x5C), 64) ^ substr($key, 0, 64)).pack($pack, $func((str_repeat(chr(0x36), 64) ^ substr($key, 0, 64)).$data)));
2697 2697
 	}
2698 2698
 	private function strlen($string)
2699 2699
 	{
2700
-		return $this->_mbstring ? mb_strlen($string,'8bit') : strlen($string);
2700
+		return $this->_mbstring ? mb_strlen($string, '8bit') : strlen($string);
2701 2701
 	}
2702
-	private function substr($string,$start,$length)
2702
+	private function substr($string, $start, $length)
2703 2703
 	{
2704
-		return $this->_mbstring ? mb_substr($string,$start,$length,'8bit') : substr($string,$start,$length);
2704
+		return $this->_mbstring ? mb_substr($string, $start, $length, '8bit') : substr($string, $start, $length);
2705 2705
 	}
2706 2706
 }
2707 2707
 class TSecurityManagerValidationMode extends TEnumerable
2708 2708
 {
2709
-	const MD5 = 'MD5';
2710
-	const SHA1 = 'SHA1';
2709
+	const MD5='MD5';
2710
+	const SHA1='SHA1';
2711 2711
 }
2712 2712
 class THttpUtility
2713 2713
 {
2714
-	private static $_encodeTable=array('<'=>'&lt;','>'=>'&gt;','"'=>'&quot;');
2715
-	private static $_decodeTable=array('&lt;'=>'<','&gt;'=>'>','&quot;'=>'"');
2716
-	private static $_stripTable=array('&lt;'=>'','&gt;'=>'','&quot;'=>'');
2714
+	private static $_encodeTable=array('<'=>'&lt;', '>'=>'&gt;', '"'=>'&quot;');
2715
+	private static $_decodeTable=array('&lt;'=>'<', '&gt;'=>'>', '&quot;'=>'"');
2716
+	private static $_stripTable=array('&lt;'=>'', '&gt;'=>'', '&quot;'=>'');
2717 2717
 	public static function htmlEncode($s)
2718 2718
 	{
2719
-		return strtr($s,self::$_encodeTable);
2719
+		return strtr($s, self::$_encodeTable);
2720 2720
 	}
2721 2721
 	public static function htmlDecode($s)
2722 2722
 	{
2723
-		return strtr($s,self::$_decodeTable);
2723
+		return strtr($s, self::$_decodeTable);
2724 2724
 	}
2725 2725
 	public static function htmlStrip($s)
2726 2726
 	{
2727
-		return strtr($s,self::$_stripTable);
2727
+		return strtr($s, self::$_stripTable);
2728 2728
 	}
2729 2729
 }
2730 2730
 class TJavaScript
@@ -2733,7 +2733,7 @@  discard block
 block discarded – undo
2733 2733
 	{
2734 2734
 		$str='';
2735 2735
 		foreach($files as $file)
2736
-			$str.= self::renderScriptFile($file);
2736
+			$str.=self::renderScriptFile($file);
2737 2737
 		return $str;
2738 2738
 	}
2739 2739
 	public static function renderScriptFile($file)
@@ -2743,14 +2743,14 @@  discard block
 block discarded – undo
2743 2743
 	public static function renderScriptBlocks($scripts)
2744 2744
 	{
2745 2745
 		if(count($scripts))
2746
-			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n",$scripts)."\n/*]]>*/\n</script>\n";
2746
+			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n", $scripts)."\n/*]]>*/\n</script>\n";
2747 2747
 		else
2748 2748
 			return '';
2749 2749
 	}
2750 2750
 	public static function renderScriptBlocksCallback($scripts)
2751 2751
 	{
2752 2752
 		if(count($scripts))
2753
-			return implode("\n",$scripts)."\n";
2753
+			return implode("\n", $scripts)."\n";
2754 2754
 		else
2755 2755
 			return '';
2756 2756
 	}
@@ -2760,7 +2760,7 @@  discard block
 block discarded – undo
2760 2760
 	}
2761 2761
 	public static function quoteString($js)
2762 2762
 	{
2763
-		return self::jsonEncode($js,JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG);
2763
+		return self::jsonEncode($js, JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG);
2764 2764
 	}
2765 2765
 	public static function quoteJsLiteral($js)
2766 2766
 	{
@@ -2781,16 +2781,16 @@  discard block
 block discarded – undo
2781 2781
 	{
2782 2782
 		return self::isJsLiteral($js);
2783 2783
 	}
2784
-	public static function encode($value,$toMap=true,$encodeEmptyStrings=false)
2784
+	public static function encode($value, $toMap=true, $encodeEmptyStrings=false)
2785 2785
 	{
2786 2786
 		if(is_string($value))
2787 2787
 			return self::quoteString($value);
2788 2788
 		else if(is_bool($value))
2789
-			return $value?'true':'false';
2789
+			return $value ? 'true' : 'false';
2790 2790
 		else if(is_array($value))
2791 2791
 		{
2792 2792
 			$results='';
2793
-			if(($n=count($value))>0 && array_keys($value)!==range(0,$n-1))
2793
+			if(($n=count($value)) > 0 && array_keys($value)!==range(0, $n - 1))
2794 2794
 			{
2795 2795
 				foreach($value as $k=>$v)
2796 2796
 				{
@@ -2798,7 +2798,7 @@  discard block
 block discarded – undo
2798 2798
 					{
2799 2799
 						if($results!=='')
2800 2800
 							$results.=',';
2801
-						$results.="'$k':".self::encode($v,$toMap,$encodeEmptyStrings);
2801
+						$results.="'$k':".self::encode($v, $toMap, $encodeEmptyStrings);
2802 2802
 					}
2803 2803
 				}
2804 2804
 				return '{'.$results.'}';
@@ -2811,7 +2811,7 @@  discard block
 block discarded – undo
2811 2811
 					{
2812 2812
 						if($results!=='')
2813 2813
 							$results.=',';
2814
-						$results.=self::encode($v,$toMap, $encodeEmptyStrings);
2814
+						$results.=self::encode($v, $toMap, $encodeEmptyStrings);
2815 2815
 					}
2816 2816
 				}
2817 2817
 				return '['.$results.']';
@@ -2839,64 +2839,64 @@  discard block
 block discarded – undo
2839 2839
 			}
2840 2840
 		}
2841 2841
 		else if(is_object($value))
2842
-			if ($value instanceof TJavaScriptLiteral)
2842
+			if($value instanceof TJavaScriptLiteral)
2843 2843
 				return $value->toJavaScriptLiteral();
2844 2844
 			else
2845
-				return self::encode(get_object_vars($value),$toMap);
2845
+				return self::encode(get_object_vars($value), $toMap);
2846 2846
 		else if($value===null)
2847 2847
 			return 'null';
2848 2848
 		else
2849 2849
 			return '';
2850 2850
 	}
2851
-	public static function jsonEncode($value, $options = 0)
2851
+	public static function jsonEncode($value, $options=0)
2852 2852
 	{
2853
-		if (($g=Prado::getApplication()->getGlobalization(false))!==null &&
2853
+		if(($g=Prado::getApplication()->getGlobalization(false))!==null &&
2854 2854
 			strtoupper($enc=$g->getCharset())!='UTF-8') {
2855 2855
 			self::convertToUtf8($value, $enc);
2856 2856
 		}
2857
-		$s = @json_encode($value,$options);
2857
+		$s=@json_encode($value, $options);
2858 2858
 		self::checkJsonError();
2859 2859
 		return $s;
2860 2860
 	}
2861 2861
 	private static function convertToUtf8(&$value, $sourceEncoding) {
2862 2862
 		if(is_string($value))
2863 2863
 			$value=iconv($sourceEncoding, 'UTF-8', $value);
2864
-		else if (is_array($value))
2864
+		else if(is_array($value))
2865 2865
 		{
2866 2866
 			foreach($value as &$element)
2867 2867
 				self::convertToUtf8($element, $sourceEncoding);
2868 2868
 		}
2869 2869
 	}
2870
-	public static function jsonDecode($value, $assoc = false, $depth = 512)
2870
+	public static function jsonDecode($value, $assoc=false, $depth=512)
2871 2871
 	{
2872
-		$s= @json_decode($value, $assoc, $depth);
2872
+		$s=@json_decode($value, $assoc, $depth);
2873 2873
 		self::checkJsonError();
2874 2874
 		return $s;
2875 2875
 	}
2876 2876
 	private static function checkJsonError()
2877 2877
 	{
2878
-		switch ($err = json_last_error())
2878
+		switch($err=json_last_error())
2879 2879
 		{
2880 2880
 			case JSON_ERROR_NONE:
2881 2881
 				return;
2882 2882
 				break;
2883 2883
 			case JSON_ERROR_DEPTH:
2884
-				$msg = 'Maximum stack depth exceeded';
2884
+				$msg='Maximum stack depth exceeded';
2885 2885
 				break;
2886 2886
 			case JSON_ERROR_STATE_MISMATCH:
2887
-				$msg = 'Underflow or the modes mismatch';
2887
+				$msg='Underflow or the modes mismatch';
2888 2888
 				break;
2889 2889
 			case JSON_ERROR_CTRL_CHAR:
2890
-				$msg = 'Unexpected control character found';
2890
+				$msg='Unexpected control character found';
2891 2891
 				break;
2892 2892
 			case JSON_ERROR_SYNTAX:
2893
-				$msg = 'Syntax error, malformed JSON';
2893
+				$msg='Syntax error, malformed JSON';
2894 2894
 				break;
2895 2895
 			case JSON_ERROR_UTF8:
2896
-				$msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
2896
+				$msg='Malformed UTF-8 characters, possibly incorrectly encoded';
2897 2897
 				break;
2898 2898
 			default:
2899
-				$msg = 'Unknown error';
2899
+				$msg='Unknown error';
2900 2900
 				break;
2901 2901
 		}
2902 2902
 		throw new Exception("JSON error ($err): $msg");
@@ -2909,10 +2909,10 @@  discard block
 block discarded – undo
2909 2909
 }
2910 2910
 class TUrlManager extends TModule
2911 2911
 {
2912
-	public function constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems)
2912
+	public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems)
2913 2913
 	{
2914 2914
 		$url=$serviceID.'='.urlencode($serviceParam);
2915
-		$amp=$encodeAmpersand?'&amp;':'&';
2915
+		$amp=$encodeAmpersand ? '&amp;' : '&';
2916 2916
 		$request=$this->getRequest();
2917 2917
 		if(is_array($getItems) || $getItems instanceof Traversable)
2918 2918
 		{
@@ -2947,9 +2947,9 @@  discard block
 block discarded – undo
2947 2947
 		switch($request->getUrlFormat())
2948 2948
 		{
2949 2949
 			case THttpRequestUrlFormat::Path:
2950
-				return $request->getApplicationUrl().'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator()));
2950
+				return $request->getApplicationUrl().'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator()));
2951 2951
 			case THttpRequestUrlFormat::HiddenPath:
2952
-				return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator()));
2952
+				return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator()));
2953 2953
 			default:
2954 2954
 				return $request->getApplicationUrl().'?'.$url;
2955 2955
 		}
@@ -2957,24 +2957,24 @@  discard block
 block discarded – undo
2957 2957
 	public function parseUrl()
2958 2958
 	{
2959 2959
 		$request=$this->getRequest();
2960
-		$pathInfo=trim($request->getPathInfo(),'/');
2960
+		$pathInfo=trim($request->getPathInfo(), '/');
2961 2961
 		if(($request->getUrlFormat()===THttpRequestUrlFormat::Path ||
2962 2962
 			$request->getUrlFormat()===THttpRequestUrlFormat::HiddenPath) &&
2963 2963
 			$pathInfo!=='')
2964 2964
 		{
2965 2965
 			$separator=$request->getUrlParamSeparator();
2966
-			$paths=explode('/',$pathInfo);
2966
+			$paths=explode('/', $pathInfo);
2967 2967
 			$getVariables=array();
2968 2968
 			foreach($paths as $path)
2969 2969
 			{
2970 2970
 				if(($path=trim($path))!=='')
2971 2971
 				{
2972
-					if(($pos=strpos($path,$separator))!==false)
2972
+					if(($pos=strpos($path, $separator))!==false)
2973 2973
 					{
2974
-						$name=substr($path,0,$pos);
2975
-						$value=substr($path,$pos+1);
2976
-						if(($pos=strpos($name,'[]'))!==false)
2977
-							$getVariables[substr($name,0,$pos)][]=$value;
2974
+						$name=substr($path, 0, $pos);
2975
+						$value=substr($path, $pos + 1);
2976
+						if(($pos=strpos($name, '[]'))!==false)
2977
+							$getVariables[substr($name, 0, $pos)][]=$value;
2978 2978
 						else
2979 2979
 							$getVariables[$name]=$value;
2980 2980
 					}
@@ -2988,10 +2988,10 @@  discard block
 block discarded – undo
2988 2988
 			return array();
2989 2989
 	}
2990 2990
 }
2991
-class THttpRequest extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule
2991
+class THttpRequest extends TApplicationComponent implements IteratorAggregate, ArrayAccess, Countable, IModule
2992 2992
 {
2993
-	const CGIFIX__PATH_INFO		= 1;
2994
-	const CGIFIX__SCRIPT_NAME	= 2;
2993
+	const CGIFIX__PATH_INFO=1;
2994
+	const CGIFIX__SCRIPT_NAME=2;
2995 2995
 	private $_urlManager=null;
2996 2996
 	private $_urlManagerID='';
2997 2997
 	private $_separator=',';
@@ -3030,13 +3030,13 @@  discard block
 block discarded – undo
3030 3030
 		}
3031 3031
 														if(isset($_SERVER['REQUEST_URI']))
3032 3032
 			$this->_requestUri=$_SERVER['REQUEST_URI'];
3033
-		else  			$this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING'])?'':'?'.$_SERVER['QUERY_STRING']);
3034
-		if($this->_cgiFix&self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO']))
3033
+		else  			$this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING']) ? '' : '?'.$_SERVER['QUERY_STRING']);
3034
+		if($this->_cgiFix & self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO']))
3035 3035
 			$this->_pathInfo=substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME']));
3036 3036
 		elseif(isset($_SERVER['PATH_INFO']))
3037 3037
 			$this->_pathInfo=$_SERVER['PATH_INFO'];
3038
-		else if(strpos($_SERVER['PHP_SELF'],$_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME'])
3039
-			$this->_pathInfo=substr($_SERVER['PHP_SELF'],strlen($_SERVER['SCRIPT_NAME']));
3038
+		else if(strpos($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME'])
3039
+			$this->_pathInfo=substr($_SERVER['PHP_SELF'], strlen($_SERVER['SCRIPT_NAME']));
3040 3040
 		else
3041 3041
 			$this->_pathInfo='';
3042 3042
 		if(get_magic_quotes_gpc())
@@ -3054,14 +3054,14 @@  discard block
 block discarded – undo
3054 3054
 	}
3055 3055
 	public function stripSlashes(&$data)
3056 3056
 	{
3057
-		return is_array($data)?array_map(array($this,'stripSlashes'),$data):stripslashes($data);
3057
+		return is_array($data) ? array_map(array($this, 'stripSlashes'), $data) : stripslashes($data);
3058 3058
 	}
3059 3059
 	public function getUrl()
3060 3060
 	{
3061 3061
 		if($this->_url===null)
3062 3062
 		{
3063 3063
 			$secure=$this->getIsSecureConnection();
3064
-			$url=$secure?'https://':'http://';
3064
+			$url=$secure ? 'https://' : 'http://';
3065 3065
 			if(empty($_SERVER['HTTP_HOST']))
3066 3066
 			{
3067 3067
 				$url.=$_SERVER['SERVER_NAME'];
@@ -3078,7 +3078,7 @@  discard block
 block discarded – undo
3078 3078
 	}
3079 3079
 	public function setEnableCache($value)
3080 3080
 	{
3081
-		$this->_enableCache = TPropertyValue::ensureBoolean($value);
3081
+		$this->_enableCache=TPropertyValue::ensureBoolean($value);
3082 3082
 	}
3083 3083
 	public function getEnableCache()
3084 3084
 	{
@@ -3092,15 +3092,15 @@  discard block
 block discarded – undo
3092 3092
 	{
3093 3093
 		if($this->getEnableCache())
3094 3094
 		{
3095
-			$cache = $this->getApplication()->getCache();
3096
-			if($cache !== null)
3095
+			$cache=$this->getApplication()->getCache();
3096
+			if($cache!==null)
3097 3097
 			{
3098
-				$dependencies = null;
3099
-				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
3100
-					if ($manager instanceof TUrlMapping && $fn = $manager->getConfigFile())
3098
+				$dependencies=null;
3099
+				if($this->getApplication()->getMode()!==TApplicationMode::Performance)
3100
+					if($manager instanceof TUrlMapping && $fn=$manager->getConfigFile())
3101 3101
 					{
3102
-						$fn = Prado::getPathOfNamespace($fn,$this->getApplication()->getConfigurationFileExt());
3103
-						$dependencies = new TFileCacheDependency($fn);
3102
+						$fn=Prado::getPathOfNamespace($fn, $this->getApplication()->getConfigurationFileExt());
3103
+						$dependencies=new TFileCacheDependency($fn);
3104 3104
 					}
3105 3105
 				return $cache->set($this->getCacheKey(), $manager, 0, $dependencies);
3106 3106
 			}
@@ -3111,10 +3111,10 @@  discard block
 block discarded – undo
3111 3111
 	{
3112 3112
 		if($this->getEnableCache())
3113 3113
 		{
3114
-			$cache = $this->getApplication()->getCache();
3115
-			if($cache !== null)
3114
+			$cache=$this->getApplication()->getCache();
3115
+			if($cache!==null)
3116 3116
 			{
3117
-				$manager = $cache->get($this->getCacheKey());
3117
+				$manager=$cache->get($this->getCacheKey());
3118 3118
 				if($manager instanceof TUrlManager)
3119 3119
 					return $manager;
3120 3120
 			}
@@ -3133,7 +3133,7 @@  discard block
 block discarded – undo
3133 3133
 	{
3134 3134
 		if($this->_urlManager===null)
3135 3135
 		{
3136
-			if(($this->_urlManager = $this->loadCachedUrlManager())===null)
3136
+			if(($this->_urlManager=$this->loadCachedUrlManager())===null)
3137 3137
 			{
3138 3138
 				if(empty($this->_urlManagerID))
3139 3139
 				{
@@ -3144,9 +3144,9 @@  discard block
 block discarded – undo
3144 3144
 				{
3145 3145
 					$this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID);
3146 3146
 					if($this->_urlManager===null)
3147
-						throw new TConfigurationException('httprequest_urlmanager_inexist',$this->_urlManagerID);
3147
+						throw new TConfigurationException('httprequest_urlmanager_inexist', $this->_urlManagerID);
3148 3148
 					if(!($this->_urlManager instanceof TUrlManager))
3149
-						throw new TConfigurationException('httprequest_urlmanager_invalid',$this->_urlManagerID);
3149
+						throw new TConfigurationException('httprequest_urlmanager_invalid', $this->_urlManagerID);
3150 3150
 				}
3151 3151
 				$this->cacheUrlManager($this->_urlManager);
3152 3152
 			}
@@ -3159,7 +3159,7 @@  discard block
 block discarded – undo
3159 3159
 	}
3160 3160
 	public function setUrlFormat($value)
3161 3161
 	{
3162
-		$this->_urlFormat=TPropertyValue::ensureEnum($value,'THttpRequestUrlFormat');
3162
+		$this->_urlFormat=TPropertyValue::ensureEnum($value, 'THttpRequestUrlFormat');
3163 3163
 	}
3164 3164
 	public function getUrlParamSeparator()
3165 3165
 	{
@@ -3174,19 +3174,19 @@  discard block
 block discarded – undo
3174 3174
 	}
3175 3175
 	public function getRequestType()
3176 3176
 	{
3177
-		return isset($_SERVER['REQUEST_METHOD'])?$_SERVER['REQUEST_METHOD']:null;
3177
+		return isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
3178 3178
 	}
3179
-	public function getContentType($mimetypeOnly = true)
3179
+	public function getContentType($mimetypeOnly=true)
3180 3180
 	{
3181 3181
 		if(!isset($_SERVER['CONTENT_TYPE']))
3182 3182
 			return null;
3183
-		if($mimetypeOnly === true && ($_pos = strpos(';', $_SERVER['CONTENT_TYPE'])) !== false)
3183
+		if($mimetypeOnly===true && ($_pos=strpos(';', $_SERVER['CONTENT_TYPE']))!==false)
3184 3184
 			return substr($_SERVER['CONTENT_TYPE'], 0, $_pos);
3185 3185
 		return $_SERVER['CONTENT_TYPE'];
3186 3186
 	}
3187 3187
 	public function getIsSecureConnection()
3188 3188
 	{
3189
-			return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'],'off');
3189
+			return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'off');
3190 3190
 	}
3191 3191
 	public function getPathInfo()
3192 3192
 	{
@@ -3194,27 +3194,27 @@  discard block
 block discarded – undo
3194 3194
 	}
3195 3195
 	public function getQueryString()
3196 3196
 	{
3197
-		return isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:null;
3197
+		return isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null;
3198 3198
 	}
3199 3199
 	public function getHttpProtocolVersion()
3200 3200
 	{
3201
-		return isset($_SERVER['SERVER_PROTOCOL'])?$_SERVER['SERVER_PROTOCOL']:null;
3201
+		return isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : null;
3202 3202
 	}
3203 3203
 	public function getHeaders($case=null)
3204 3204
 	{
3205 3205
 		static $result;
3206
-		if($result === null && function_exists('apache_request_headers')) {
3207
-			$result = apache_request_headers();
3206
+		if($result===null && function_exists('apache_request_headers')) {
3207
+			$result=apache_request_headers();
3208 3208
 		}
3209
-		elseif($result === null) {
3210
-			$result = array();
3209
+		elseif($result===null) {
3210
+			$result=array();
3211 3211
 			foreach($_SERVER as $key=>$value) {
3212
-				if(strncasecmp($key, 'HTTP_', 5) !== 0) continue;
3213
-					$key = str_replace(' ','-', ucwords(strtolower(str_replace('_',' ', substr($key, 5)))));
3214
-					$result[$key] = $value;
3212
+				if(strncasecmp($key, 'HTTP_', 5)!==0) continue;
3213
+					$key=str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
3214
+					$result[$key]=$value;
3215 3215
 			}
3216 3216
 		}
3217
-		if($case !== null)
3217
+		if($case!==null)
3218 3218
 			return array_change_key_case($result, $case);
3219 3219
 		return $result;
3220 3220
 	}
@@ -3225,36 +3225,36 @@  discard block
 block discarded – undo
3225 3225
 	public function getBaseUrl($forceSecureConnection=null)
3226 3226
 	{
3227 3227
 		$url=$this->getUrl();
3228
-		$scheme=($forceSecureConnection)?"https": (($forceSecureConnection === null)?$url->getScheme():'http');
3228
+		$scheme=($forceSecureConnection) ? "https" : (($forceSecureConnection===null) ? $url->getScheme() : 'http');
3229 3229
 		$host=$url->getHost();
3230
-		if (($port=$url->getPort())) $host.=':'.$port;
3230
+		if(($port=$url->getPort())) $host.=':'.$port;
3231 3231
 		return $scheme.'://'.$host;
3232 3232
 	}
3233 3233
 	public function getApplicationUrl()
3234 3234
 	{
3235
-		if($this->_cgiFix&self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
3235
+		if($this->_cgiFix & self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
3236 3236
 			return $_SERVER['ORIG_SCRIPT_NAME'];
3237
-		return isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:null;
3237
+		return isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : null;
3238 3238
 	}
3239 3239
 	public function getAbsoluteApplicationUrl($forceSecureConnection=null)
3240 3240
 	{
3241
-		return $this->getBaseUrl($forceSecureConnection) . $this->getApplicationUrl();
3241
+		return $this->getBaseUrl($forceSecureConnection).$this->getApplicationUrl();
3242 3242
 	}
3243 3243
 	public function getApplicationFilePath()
3244 3244
 	{
3245
-		return realpath(isset($_SERVER['SCRIPT_FILENAME'])?$_SERVER['SCRIPT_FILENAME']:null);
3245
+		return realpath(isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : null);
3246 3246
 	}
3247 3247
 	public function getServerName()
3248 3248
 	{
3249
-		return isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:null;
3249
+		return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null;
3250 3250
 	}
3251 3251
 	public function getServerPort()
3252 3252
 	{
3253
-		return isset($_SERVER['SERVER_PORT'])?$_SERVER['SERVER_PORT']:null;
3253
+		return isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : null;
3254 3254
 	}
3255 3255
 	public function getUrlReferrer()
3256 3256
 	{
3257
-		return isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:null;
3257
+		return isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
3258 3258
 	}
3259 3259
 	public function getBrowser()
3260 3260
 	{
@@ -3269,19 +3269,19 @@  discard block
 block discarded – undo
3269 3269
 	}
3270 3270
 	public function getUserAgent()
3271 3271
 	{
3272
-		return isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:null;
3272
+		return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
3273 3273
 	}
3274 3274
 	public function getUserHostAddress()
3275 3275
 	{
3276
-		return isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:null;
3276
+		return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
3277 3277
 	}
3278 3278
 	public function getUserHost()
3279 3279
 	{
3280
-		return isset($_SERVER['REMOTE_HOST'])?$_SERVER['REMOTE_HOST']:null;
3280
+		return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : null;
3281 3281
 	}
3282 3282
 	public function getAcceptTypes()
3283 3283
 	{
3284
-				return isset($_SERVER['HTTP_ACCEPT'])?$_SERVER['HTTP_ACCEPT']:null;
3284
+				return isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
3285 3285
 	}
3286 3286
 	public function getUserLanguages()
3287 3287
 	{
@@ -3314,13 +3314,13 @@  discard block
 block discarded – undo
3314 3314
 				foreach($_COOKIE as $key=>$value)
3315 3315
 				{
3316 3316
 					if(($value=$sm->validateData($value))!==false)
3317
-						$this->_cookies->add(new THttpCookie($key,$value));
3317
+						$this->_cookies->add(new THttpCookie($key, $value));
3318 3318
 				}
3319 3319
 			}
3320 3320
 			else
3321 3321
 			{
3322 3322
 				foreach($_COOKIE as $key=>$value)
3323
-					$this->_cookies->add(new THttpCookie($key,$value));
3323
+					$this->_cookies->add(new THttpCookie($key, $value));
3324 3324
 			}
3325 3325
 		}
3326 3326
 		return $this->_cookies;
@@ -3337,13 +3337,13 @@  discard block
 block discarded – undo
3337 3337
 	{
3338 3338
 		return $_ENV;
3339 3339
 	}
3340
-	public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=true,$encodeGetItems=true)
3340
+	public function constructUrl($serviceID, $serviceParam, $getItems=null, $encodeAmpersand=true, $encodeGetItems=true)
3341 3341
 	{
3342
-		if ($this->_cookieOnly===null)
3343
-				$this->_cookieOnly=(int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies');
3344
-		$url=$this->getUrlManagerModule()->constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems);
3345
-		if(defined('SID') && SID != '' && !$this->_cookieOnly)
3346
-			return $url . (strpos($url,'?')===false? '?' : ($encodeAmpersand?'&amp;':'&')) . SID;
3342
+		if($this->_cookieOnly===null)
3343
+				$this->_cookieOnly=(int) ini_get('session.use_cookies') && (int) ini_get('session.use_only_cookies');
3344
+		$url=$this->getUrlManagerModule()->constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems);
3345
+		if(defined('SID') && SID!='' && !$this->_cookieOnly)
3346
+			return $url.(strpos($url, '?')===false ? '?' : ($encodeAmpersand ? '&amp;' : '&')).SID;
3347 3347
 		else
3348 3348
 			return $url;
3349 3349
 	}
@@ -3356,7 +3356,7 @@  discard block
 block discarded – undo
3356 3356
 		$getParams=$this->parseUrl();
3357 3357
 		foreach($getParams as $name=>$value)
3358 3358
 			$_GET[$name]=$value;
3359
-		$this->_items=array_merge($_GET,$_POST);
3359
+		$this->_items=array_merge($_GET, $_POST);
3360 3360
 		$this->_requestResolved=true;
3361 3361
 		foreach($serviceIDs as $serviceID)
3362 3362
 		{
@@ -3409,13 +3409,13 @@  discard block
 block discarded – undo
3409 3409
 	{
3410 3410
 		return isset($this->_items[$key]) ? $this->_items[$key] : null;
3411 3411
 	}
3412
-	public function add($key,$value)
3412
+	public function add($key, $value)
3413 3413
 	{
3414 3414
 		$this->_items[$key]=$value;
3415 3415
 	}
3416 3416
 	public function remove($key)
3417 3417
 	{
3418
-		if(isset($this->_items[$key]) || array_key_exists($key,$this->_items))
3418
+		if(isset($this->_items[$key]) || array_key_exists($key, $this->_items))
3419 3419
 		{
3420 3420
 			$value=$this->_items[$key];
3421 3421
 			unset($this->_items[$key]);
@@ -3431,7 +3431,7 @@  discard block
 block discarded – undo
3431 3431
 	}
3432 3432
 	public function contains($key)
3433 3433
 	{
3434
-		return isset($this->_items[$key]) || array_key_exists($key,$this->_items);
3434
+		return isset($this->_items[$key]) || array_key_exists($key, $this->_items);
3435 3435
 	}
3436 3436
 	public function toArray()
3437 3437
 	{
@@ -3445,9 +3445,9 @@  discard block
 block discarded – undo
3445 3445
 	{
3446 3446
 		return $this->itemAt($offset);
3447 3447
 	}
3448
-	public function offsetSet($offset,$item)
3448
+	public function offsetSet($offset, $item)
3449 3449
 	{
3450
-		$this->add($offset,$item);
3450
+		$this->add($offset, $item);
3451 3451
 	}
3452 3452
 	public function offsetUnset($offset)
3453 3453
 	{
@@ -3461,11 +3461,11 @@  discard block
 block discarded – undo
3461 3461
 	{
3462 3462
 		$this->_o=$owner;
3463 3463
 	}
3464
-	public function insertAt($index,$item)
3464
+	public function insertAt($index, $item)
3465 3465
 	{
3466 3466
 		if($item instanceof THttpCookie)
3467 3467
 		{
3468
-			parent::insertAt($index,$item);
3468
+			parent::insertAt($index, $item);
3469 3469
 			if($this->_o instanceof THttpResponse)
3470 3470
 				$this->_o->addCookie($item);
3471 3471
 		}
@@ -3503,7 +3503,7 @@  discard block
 block discarded – undo
3503 3503
 	private $_path='/';
3504 3504
 	private $_secure=false;
3505 3505
 	private $_httpOnly=false;
3506
-	public function __construct($name,$value)
3506
+	public function __construct($name, $value)
3507 3507
 	{
3508 3508
 		$this->_name=$name;
3509 3509
 		$this->_value=$value;
@@ -3530,7 +3530,7 @@  discard block
 block discarded – undo
3530 3530
 	}
3531 3531
 	public function setHttpOnly($value)
3532 3532
 	{
3533
-		$this->_httpOnly = TPropertyValue::ensureBoolean($value);
3533
+		$this->_httpOnly=TPropertyValue::ensureBoolean($value);
3534 3534
 	}
3535 3535
 	public function getName()
3536 3536
 	{
@@ -3590,19 +3590,19 @@  discard block
 block discarded – undo
3590 3590
 	{
3591 3591
 		if(($ret=@parse_url($uri))!==false)
3592 3592
 		{
3593
-						$this->_scheme=isset($ret['scheme'])?$ret['scheme']:'';
3594
-			$this->_host=isset($ret['host'])?$ret['host']:'';
3595
-			$this->_port=isset($ret['port'])?$ret['port']:'';
3596
-			$this->_user=isset($ret['user'])?$ret['user']:'';
3597
-			$this->_pass=isset($ret['pass'])?$ret['pass']:'';
3598
-			$this->_path=isset($ret['path'])?$ret['path']:'';
3599
-			$this->_query=isset($ret['query'])?$ret['query']:'';
3600
-			$this->_fragment=isset($ret['fragment'])?$ret['fragment']:'';
3593
+						$this->_scheme=isset($ret['scheme']) ? $ret['scheme'] : '';
3594
+			$this->_host=isset($ret['host']) ? $ret['host'] : '';
3595
+			$this->_port=isset($ret['port']) ? $ret['port'] : '';
3596
+			$this->_user=isset($ret['user']) ? $ret['user'] : '';
3597
+			$this->_pass=isset($ret['pass']) ? $ret['pass'] : '';
3598
+			$this->_path=isset($ret['path']) ? $ret['path'] : '';
3599
+			$this->_query=isset($ret['query']) ? $ret['query'] : '';
3600
+			$this->_fragment=isset($ret['fragment']) ? $ret['fragment'] : '';
3601 3601
 			$this->_uri=$uri;
3602 3602
 		}
3603 3603
 		else
3604 3604
 		{
3605
-			throw new TInvalidDataValueException('uri_format_invalid',$uri);
3605
+			throw new TInvalidDataValueException('uri_format_invalid', $uri);
3606 3606
 		}
3607 3607
 	}
3608 3608
 	public function getUri()
@@ -3669,14 +3669,14 @@  discard block
 block discarded – undo
3669 3669
 	}
3670 3670
 	public function createNewHtmlWriter($type, $writer)
3671 3671
 	{
3672
-		return $this->_response->createNewHtmlWriter($type,$writer);
3672
+		return $this->_response->createNewHtmlWriter($type, $writer);
3673 3673
 	}
3674 3674
 }
3675 3675
 class THttpResponse extends TModule implements ITextWriter
3676 3676
 {
3677
-	const DEFAULT_CONTENTTYPE	= 'text/html';
3678
-	const DEFAULT_CHARSET		= 'UTF-8';
3679
-	private static $HTTP_STATUS_CODES = array(
3677
+	const DEFAULT_CONTENTTYPE='text/html';
3678
+	const DEFAULT_CHARSET='UTF-8';
3679
+	private static $HTTP_STATUS_CODES=array(
3680 3680
 		100 => 'Continue', 101 => 'Switching Protocols',
3681 3681
 		200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content',
3682 3682
 		300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect',
@@ -3730,13 +3730,13 @@  discard block
 block discarded – undo
3730 3730
 	}
3731 3731
 	public function setCacheControl($value)
3732 3732
 	{
3733
-		session_cache_limiter(TPropertyValue::ensureEnum($value,array('none','nocache','private','private_no_expire','public')));
3733
+		session_cache_limiter(TPropertyValue::ensureEnum($value, array('none', 'nocache', 'private', 'private_no_expire', 'public')));
3734 3734
 	}
3735 3735
 	public function setContentType($type)
3736 3736
 	{
3737
-		if ($this->_contentTypeHeaderSent)
3737
+		if($this->_contentTypeHeaderSent)
3738 3738
 			throw new Exception('Unable to alter content-type as it has been already sent');
3739
-		$this->_contentType = $type;
3739
+		$this->_contentType=$type;
3740 3740
 	}
3741 3741
 	public function getContentType()
3742 3742
 	{
@@ -3748,7 +3748,7 @@  discard block
 block discarded – undo
3748 3748
 	}
3749 3749
 	public function setCharset($charset)
3750 3750
 	{
3751
-		$this->_charset = (strToLower($charset) === 'false') ? false : (string)$charset;
3751
+		$this->_charset=(strToLower($charset)==='false') ? false : (string) $charset;
3752 3752
 	}
3753 3753
 	public function getBufferOutput()
3754 3754
 	{
@@ -3767,12 +3767,12 @@  discard block
 block discarded – undo
3767 3767
 	}
3768 3768
 	public function setStatusCode($status, $reason=null)
3769 3769
 	{
3770
-		if ($this->_httpHeaderSent)
3770
+		if($this->_httpHeaderSent)
3771 3771
 			throw new Exception('Unable to alter response as HTTP header already sent');
3772 3772
 		$status=TPropertyValue::ensureInteger($status);
3773 3773
 		if(isset(self::$HTTP_STATUS_CODES[$status])) {
3774 3774
 			$this->_reason=self::$HTTP_STATUS_CODES[$status];
3775
-		}else{
3775
+		} else {
3776 3776
 			if($reason===null || $reason==='') {
3777 3777
 				throw new TInvalidDataValueException("response_status_reason_missing");
3778 3778
 			}
@@ -3795,11 +3795,11 @@  discard block
 block discarded – undo
3795 3795
 	}
3796 3796
 	public function write($str)
3797 3797
 	{
3798
-				if (!$this->_bufferOutput and !$this->_httpHeaderSent)
3798
+				if(!$this->_bufferOutput and !$this->_httpHeaderSent)
3799 3799
 			$this->ensureHeadersSent();
3800 3800
 		echo $str;
3801 3801
 	}
3802
-	public function writeFile($fileName,$content=null,$mimeType=null,$headers=null,$forceDownload=true,$clientFileName=null,$fileSize=null)
3802
+	public function writeFile($fileName, $content=null, $mimeType=null, $headers=null, $forceDownload=true, $clientFileName=null, $fileSize=null)
3803 3803
 	{
3804 3804
 		static $defaultMimeTypes=array(
3805 3805
 			'css'=>'text/css',
@@ -3818,9 +3818,9 @@  discard block
 block discarded – undo
3818 3818
 			$mimeType='text/plain';
3819 3819
 			if(function_exists('mime_content_type'))
3820 3820
 				$mimeType=mime_content_type($fileName);
3821
-			else if(($ext=strrchr($fileName,'.'))!==false)
3821
+			else if(($ext=strrchr($fileName, '.'))!==false)
3822 3822
 			{
3823
-				$ext=substr($ext,1);
3823
+				$ext=substr($ext, 1);
3824 3824
 				if(isset($defaultMimeTypes[$ext]))
3825 3825
 					$mimeType=$defaultMimeTypes[$ext];
3826 3826
 			}
@@ -3830,7 +3830,7 @@  discard block
 block discarded – undo
3830 3830
 		else
3831 3831
 			$clientFileName=basename($clientFileName);
3832 3832
 		if($fileSize===null || $fileSize < 0)
3833
-			$fileSize = ($content===null?filesize($fileName):strlen($content));
3833
+			$fileSize=($content===null ? filesize($fileName) : strlen($content));
3834 3834
 		$this->sendHttpHeader();
3835 3835
 		if(is_array($headers))
3836 3836
 		{
@@ -3843,10 +3843,10 @@  discard block
 block discarded – undo
3843 3843
 			header('Expires: 0');
3844 3844
 			header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
3845 3845
 			header("Content-Type: $mimeType");
3846
-			$this->_contentTypeHeaderSent = true;
3846
+			$this->_contentTypeHeaderSent=true;
3847 3847
 		}
3848 3848
 		header('Content-Length: '.$fileSize);
3849
-		header("Content-Disposition: " . ($forceDownload ? 'attachment' : 'inline') . "; filename=\"$clientFileName\"");
3849
+		header("Content-Disposition: ".($forceDownload ? 'attachment' : 'inline')."; filename=\"$clientFileName\"");
3850 3850
 		header('Content-Transfer-Encoding: binary');
3851 3851
 		if($content===null)
3852 3852
 			readfile($fileName);
@@ -3865,10 +3865,10 @@  discard block
 block discarded – undo
3865 3865
 		$this->ensureHeadersSent();
3866 3866
 		if($url[0]==='/')
3867 3867
 			$url=$this->getRequest()->getBaseUrl().$url;
3868
-		if ($this->_status >= 300 && $this->_status < 400)
3869
-						header('Location: '.str_replace('&amp;','&',$url), true, $this->_status);
3868
+		if($this->_status >= 300 && $this->_status < 400)
3869
+						header('Location: '.str_replace('&amp;', '&', $url), true, $this->_status);
3870 3870
 		else
3871
-			header('Location: '.str_replace('&amp;','&',$url));
3871
+			header('Location: '.str_replace('&amp;', '&', $url));
3872 3872
 		if(!$this->getApplication()->getRequestCompleted())
3873 3873
 			$this->getApplication()->onEndRequest();
3874 3874
 		exit();
@@ -3877,7 +3877,7 @@  discard block
 block discarded – undo
3877 3877
 	{
3878 3878
 		$this->redirect($this->getRequest()->getRequestUri());
3879 3879
 	}
3880
-	public function flush($continueBuffering = true)
3880
+	public function flush($continueBuffering=true)
3881 3881
 	{
3882 3882
 		if($this->getHasAdapter())
3883 3883
 			$this->_adapter->flushContent($continueBuffering);
@@ -3889,16 +3889,16 @@  discard block
 block discarded – undo
3889 3889
 		$this->ensureHttpHeaderSent();
3890 3890
 		$this->ensureContentTypeHeaderSent();
3891 3891
 	}
3892
-	public function flushContent($continueBuffering = true)
3892
+	public function flushContent($continueBuffering=true)
3893 3893
 	{
3894 3894
 		$this->ensureHeadersSent();
3895 3895
 		if($this->_bufferOutput)
3896 3896
 		{
3897
-						if (ob_get_length()>0)
3897
+						if(ob_get_length() > 0)
3898 3898
 			{
3899
-				if (!$continueBuffering)
3899
+				if(!$continueBuffering)
3900 3900
 				{
3901
-					$this->_bufferOutput = false;
3901
+					$this->_bufferOutput=false;
3902 3902
 					ob_end_flush();
3903 3903
 				}
3904 3904
 				else
@@ -3911,41 +3911,41 @@  discard block
 block discarded – undo
3911 3911
 	}
3912 3912
 	protected function ensureHttpHeaderSent()
3913 3913
 	{
3914
-		if (!$this->_httpHeaderSent)
3914
+		if(!$this->_httpHeaderSent)
3915 3915
 			$this->sendHttpHeader();
3916 3916
 	}
3917 3917
 	protected function sendHttpHeader()
3918 3918
 	{
3919 3919
 		$protocol=$this->getRequest()->getHttpProtocolVersion();
3920
-		if($this->getRequest()->getHttpProtocolVersion() === null)
3920
+		if($this->getRequest()->getHttpProtocolVersion()===null)
3921 3921
 			$protocol='HTTP/1.1';
3922
-		$phpSapiName = substr(php_sapi_name(), 0, 3);
3923
-		$cgi = $phpSapiName == 'cgi' || $phpSapiName == 'fpm';
3922
+		$phpSapiName=substr(php_sapi_name(), 0, 3);
3923
+		$cgi=$phpSapiName=='cgi' || $phpSapiName=='fpm';
3924 3924
 		header(($cgi ? 'Status:' : $protocol).' '.$this->_status.' '.$this->_reason, true, TPropertyValue::ensureInteger($this->_status));
3925
-		$this->_httpHeaderSent = true;
3925
+		$this->_httpHeaderSent=true;
3926 3926
 	}
3927 3927
 	protected function ensureContentTypeHeaderSent()
3928 3928
 	{
3929
-		if (!$this->_contentTypeHeaderSent)
3929
+		if(!$this->_contentTypeHeaderSent)
3930 3930
 			$this->sendContentTypeHeader();
3931 3931
 	}
3932 3932
 	protected function sendContentTypeHeader()
3933 3933
 	{
3934
-		$contentType=$this->_contentType===null?self::DEFAULT_CONTENTTYPE:$this->_contentType;
3934
+		$contentType=$this->_contentType===null ? self::DEFAULT_CONTENTTYPE : $this->_contentType;
3935 3935
 		$charset=$this->getCharset();
3936
-		if($charset === false) {
3936
+		if($charset===false) {
3937 3937
 			$this->appendHeader('Content-Type: '.$contentType);
3938 3938
 			return;
3939 3939
 		}
3940 3940
 		if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null)
3941 3941
 			$charset=$globalization->getCharset();
3942
-		if($charset==='') $charset = self::DEFAULT_CHARSET;
3942
+		if($charset==='') $charset=self::DEFAULT_CHARSET;
3943 3943
 		$this->appendHeader('Content-Type: '.$contentType.';charset='.$charset);
3944
-		$this->_contentTypeHeaderSent = true;
3944
+		$this->_contentTypeHeaderSent=true;
3945 3945
 	}
3946 3946
 	public function getContents()
3947 3947
 	{
3948
-		return $this->_bufferOutput?ob_get_contents():'';
3948
+		return $this->_bufferOutput ? ob_get_contents() : '';
3949 3949
 	}
3950 3950
 	public function clear()
3951 3951
 	{
@@ -3954,18 +3954,18 @@  discard block
 block discarded – undo
3954 3954
 	}
3955 3955
 	public function getHeaders($case=null)
3956 3956
 	{
3957
-		$result = array();
3958
-		$headers = headers_list();
3957
+		$result=array();
3958
+		$headers=headers_list();
3959 3959
 		foreach($headers as $header) {
3960
-			$tmp = explode(':', $header);
3961
-			$key = trim(array_shift($tmp));
3962
-			$value = trim(implode(':', $tmp));
3960
+			$tmp=explode(':', $header);
3961
+			$key=trim(array_shift($tmp));
3962
+			$value=trim(implode(':', $tmp));
3963 3963
 			if(isset($result[$key]))
3964
-				$result[$key] .= ', ' . $value;
3964
+				$result[$key].=', '.$value;
3965 3965
 			else
3966
-				$result[$key] = $value;
3966
+				$result[$key]=$value;
3967 3967
 		}
3968
-		if($case !== null)
3968
+		if($case!==null)
3969 3969
 			return array_change_key_case($result, $case);
3970 3970
 		return $result;
3971 3971
 	}
@@ -3973,9 +3973,9 @@  discard block
 block discarded – undo
3973 3973
 	{
3974 3974
 		header($value, $replace);
3975 3975
 	}
3976
-	public function appendLog($message,$messageType=0,$destination='',$extraHeaders='')
3976
+	public function appendLog($message, $messageType=0, $destination='', $extraHeaders='')
3977 3977
 	{
3978
-		error_log($message,$messageType,$destination,$extraHeaders);
3978
+		error_log($message, $messageType, $destination, $extraHeaders);
3979 3979
 	}
3980 3980
 	public function addCookie($cookie)
3981 3981
 	{
@@ -4039,7 +4039,7 @@  discard block
 block discarded – undo
4039 4039
 		return Prado::createComponent($type, $writer);
4040 4040
 	}
4041 4041
 }
4042
-class THttpSession extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule
4042
+class THttpSession extends TApplicationComponent implements IteratorAggregate, ArrayAccess, Countable, IModule
4043 4043
 {
4044 4044
 	private $_initialized=false;
4045 4045
 	private $_started=false;
@@ -4068,9 +4068,9 @@  discard block
 block discarded – undo
4068 4068
 		if(!$this->_started)
4069 4069
 		{
4070 4070
 			if($this->_customStorage)
4071
-				session_set_save_handler(array($this,'_open'),array($this,'_close'),array($this,'_read'),array($this,'_write'),array($this,'_destroy'),array($this,'_gc'));
4071
+				session_set_save_handler(array($this, '_open'), array($this, '_close'), array($this, '_read'), array($this, '_write'), array($this, '_destroy'), array($this, '_gc'));
4072 4072
 			if($this->_cookie!==null)
4073
-				session_set_cookie_params($this->_cookie->getExpire(),$this->_cookie->getPath(),$this->_cookie->getDomain(),$this->_cookie->getSecure(),$this->_cookie->getHttpOnly());
4073
+				session_set_cookie_params($this->_cookie->getExpire(), $this->_cookie->getPath(), $this->_cookie->getDomain(), $this->_cookie->getSecure(), $this->_cookie->getHttpOnly());
4074 4074
 			if(ini_get('session.auto_start')!=='1')
4075 4075
 				session_start();
4076 4076
 			$this->_started=true;
@@ -4094,7 +4094,7 @@  discard block
 block discarded – undo
4094 4094
 	}
4095 4095
 	public function regenerate($deleteOld=false)
4096 4096
 	{
4097
-		$old = $this->getSessionID();
4097
+		$old=$this->getSessionID();
4098 4098
 		session_regenerate_id($deleteOld);
4099 4099
 		return $old;
4100 4100
 	}
@@ -4124,7 +4124,7 @@  discard block
 block discarded – undo
4124 4124
 		else if(ctype_alnum($value))
4125 4125
 			session_name($value);
4126 4126
 		else
4127
-			throw new TInvalidDataValueException('httpsession_sessionname_invalid',$value);
4127
+			throw new TInvalidDataValueException('httpsession_sessionname_invalid', $value);
4128 4128
 	}
4129 4129
 	public function getSavePath()
4130 4130
 	{
@@ -4137,7 +4137,7 @@  discard block
 block discarded – undo
4137 4137
 		else if(is_dir($value))
4138 4138
 			session_save_path($value);
4139 4139
 		else
4140
-			throw new TInvalidDataValueException('httpsession_savepath_invalid',$value);
4140
+			throw new TInvalidDataValueException('httpsession_savepath_invalid', $value);
4141 4141
 	}
4142 4142
 	public function getUseCustomStorage()
4143 4143
 	{
@@ -4150,7 +4150,7 @@  discard block
 block discarded – undo
4150 4150
 	public function getCookie()
4151 4151
 	{
4152 4152
 		if($this->_cookie===null)
4153
-			$this->_cookie=new THttpCookie($this->getSessionName(),$this->getSessionID());
4153
+			$this->_cookie=new THttpCookie($this->getSessionName(), $this->getSessionID());
4154 4154
 		return $this->_cookie;
4155 4155
 	}
4156 4156
 	public function getCookieMode()
@@ -4168,21 +4168,21 @@  discard block
 block discarded – undo
4168 4168
 			throw new TInvalidOperationException('httpsession_cookiemode_unchangeable');
4169 4169
 		else
4170 4170
 		{
4171
-			$value=TPropertyValue::ensureEnum($value,'THttpSessionCookieMode');
4171
+			$value=TPropertyValue::ensureEnum($value, 'THttpSessionCookieMode');
4172 4172
 			if($value===THttpSessionCookieMode::None) 
4173 4173
       {
4174
-				ini_set('session.use_cookies','0');
4175
-			  ini_set('session.use_only_cookies','0');
4174
+				ini_set('session.use_cookies', '0');
4175
+			  ini_set('session.use_only_cookies', '0');
4176 4176
       }
4177 4177
 			else if($value===THttpSessionCookieMode::Allow)
4178 4178
 			{
4179
-				ini_set('session.use_cookies','1');
4180
-				ini_set('session.use_only_cookies','0');
4179
+				ini_set('session.use_cookies', '1');
4180
+				ini_set('session.use_only_cookies', '0');
4181 4181
 			}
4182 4182
 			else
4183 4183
 			{
4184
-				ini_set('session.use_cookies','1');
4185
-				ini_set('session.use_only_cookies','1');
4184
+				ini_set('session.use_cookies', '1');
4185
+				ini_set('session.use_only_cookies', '1');
4186 4186
 				ini_set('session.use_trans_sid', 0);
4187 4187
 			}
4188 4188
 		}
@@ -4209,13 +4209,13 @@  discard block
 block discarded – undo
4209 4209
 		else
4210 4210
 		{
4211 4211
 			$value=TPropertyValue::ensureInteger($value);
4212
-			if($value>=0 && $value<=100)
4212
+			if($value >= 0 && $value <= 100)
4213 4213
 			{
4214
-				ini_set('session.gc_probability',$value);
4215
-				ini_set('session.gc_divisor','100');
4214
+				ini_set('session.gc_probability', $value);
4215
+				ini_set('session.gc_divisor', '100');
4216 4216
 			}
4217 4217
 			else
4218
-				throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value);
4218
+				throw new TInvalidDataValueException('httpsession_gcprobability_invalid', $value);
4219 4219
 		}
4220 4220
 	}
4221 4221
 	public function getUseTransparentSessionID()
@@ -4229,9 +4229,9 @@  discard block
 block discarded – undo
4229 4229
 		else
4230 4230
 		{
4231 4231
 			$value=TPropertyValue::ensureBoolean($value);
4232
-			if ($value && $this->getCookieMode()==THttpSessionCookieMode::Only)
4232
+			if($value && $this->getCookieMode()==THttpSessionCookieMode::Only)
4233 4233
 					throw new TInvalidOperationException('httpsession_transid_cookieonly');
4234
-			ini_set('session.use_trans_sid',$value?'1':'0');
4234
+			ini_set('session.use_trans_sid', $value ? '1' : '0');
4235 4235
 		}
4236 4236
 	}
4237 4237
 	public function getTimeout()
@@ -4243,9 +4243,9 @@  discard block
 block discarded – undo
4243 4243
 		if($this->_started)
4244 4244
 			throw new TInvalidOperationException('httpsession_maxlifetime_unchangeable');
4245 4245
 		else
4246
-			ini_set('session.gc_maxlifetime',$value);
4246
+			ini_set('session.gc_maxlifetime', $value);
4247 4247
 	}
4248
-	public function _open($savePath,$sessionName)
4248
+	public function _open($savePath, $sessionName)
4249 4249
 	{
4250 4250
 		return true;
4251 4251
 	}
@@ -4257,7 +4257,7 @@  discard block
 block discarded – undo
4257 4257
 	{
4258 4258
 		return '';
4259 4259
 	}
4260
-	public function _write($id,$data)
4260
+	public function _write($id, $data)
4261 4261
 	{
4262 4262
 		return true;
4263 4263
 	}
@@ -4289,7 +4289,7 @@  discard block
 block discarded – undo
4289 4289
 	{
4290 4290
 		return isset($_SESSION[$key]) ? $_SESSION[$key] : null;
4291 4291
 	}
4292
-	public function add($key,$value)
4292
+	public function add($key, $value)
4293 4293
 	{
4294 4294
 		$_SESSION[$key]=$value;
4295 4295
 	}
@@ -4325,7 +4325,7 @@  discard block
 block discarded – undo
4325 4325
 	{
4326 4326
 		return isset($_SESSION[$offset]) ? $_SESSION[$offset] : null;
4327 4327
 	}
4328
-	public function offsetSet($offset,$item)
4328
+	public function offsetSet($offset, $item)
4329 4329
 	{
4330 4330
 		$_SESSION[$offset]=$item;
4331 4331
 	}
@@ -4352,7 +4352,7 @@  discard block
 block discarded – undo
4352 4352
 	}
4353 4353
 	public function current()
4354 4354
 	{
4355
-		return isset($_SESSION[$this->_key])?$_SESSION[$this->_key]:null;
4355
+		return isset($_SESSION[$this->_key]) ? $_SESSION[$this->_key] : null;
4356 4356
 	}
4357 4357
 	public function next()
4358 4358
 	{
@@ -4380,16 +4380,16 @@  discard block
 block discarded – undo
4380 4380
 	protected function __getZappableSleepProps(&$exprops)
4381 4381
 	{
4382 4382
 		parent::__getZappableSleepProps($exprops);
4383
-		if ($this->_caseSensitive===false)
4384
-			$exprops[] = "\0TAttributeCollection\0_caseSensitive";
4383
+		if($this->_caseSensitive===false)
4384
+			$exprops[]="\0TAttributeCollection\0_caseSensitive";
4385 4385
 	}
4386 4386
 	public function __get($name)
4387 4387
 	{
4388
-		return $this->contains($name)?$this->itemAt($name):parent::__get($name);
4388
+		return $this->contains($name) ? $this->itemAt($name) : parent::__get($name);
4389 4389
 	}
4390
-	public function __set($name,$value)
4390
+	public function __set($name, $value)
4391 4391
 	{
4392
-		$this->add($name,$value);
4392
+		$this->add($name, $value);
4393 4393
 	}
4394 4394
 	public function getCaseSensitive()
4395 4395
 	{
@@ -4401,19 +4401,19 @@  discard block
 block discarded – undo
4401 4401
 	}
4402 4402
 	public function itemAt($key)
4403 4403
 	{
4404
-		return parent::itemAt($this->_caseSensitive?$key:strtolower($key));
4404
+		return parent::itemAt($this->_caseSensitive ? $key : strtolower($key));
4405 4405
 	}
4406
-	public function add($key,$value)
4406
+	public function add($key, $value)
4407 4407
 	{
4408
-		parent::add($this->_caseSensitive?$key:strtolower($key),$value);
4408
+		parent::add($this->_caseSensitive ? $key : strtolower($key), $value);
4409 4409
 	}
4410 4410
 	public function remove($key)
4411 4411
 	{
4412
-		return parent::remove($this->_caseSensitive?$key:strtolower($key));
4412
+		return parent::remove($this->_caseSensitive ? $key : strtolower($key));
4413 4413
 	}
4414 4414
 	public function contains($key)
4415 4415
 	{
4416
-		return parent::contains($this->_caseSensitive?$key:strtolower($key));
4416
+		return parent::contains($this->_caseSensitive ? $key : strtolower($key));
4417 4417
 	}
4418 4418
 	public function hasProperty($name)
4419 4419
 	{
@@ -4441,7 +4441,7 @@  discard block
 block discarded – undo
4441 4441
 	}
4442 4442
 	public function getPage()
4443 4443
 	{
4444
-		return $this->_control?$this->_control->getPage():null;
4444
+		return $this->_control ? $this->_control->getPage() : null;
4445 4445
 	}
4446 4446
 	public function createChildControls()
4447 4447
 	{
@@ -4499,7 +4499,7 @@  discard block
 block discarded – undo
4499 4499
 	const IS_DISABLE_THEMING=0x10;
4500 4500
 	const IS_CHILD_CREATED=0x20;
4501 4501
 	const IS_CREATING_CHILD=0x40;
4502
-	const RF_CONTROLS=0;				const RF_CHILD_STATE=1;				const RF_NAMED_CONTROLS=2;			const RF_NAMED_CONTROLS_ID=3;		const RF_SKIN_ID=4;					const RF_DATA_BINDINGS=5;			const RF_EVENTS=6;					const RF_CONTROLSTATE=7;			const RF_NAMED_OBJECTS=8;			const RF_ADAPTER=9;					const RF_AUTO_BINDINGS=10;		
4502
+	const RF_CONTROLS=0; const RF_CHILD_STATE=1; const RF_NAMED_CONTROLS=2; const RF_NAMED_CONTROLS_ID=3; const RF_SKIN_ID=4; const RF_DATA_BINDINGS=5; const RF_EVENTS=6; const RF_CONTROLSTATE=7; const RF_NAMED_OBJECTS=8; const RF_ADAPTER=9; const RF_AUTO_BINDINGS=10;		
4503 4503
 	private $_id='';
4504 4504
 	private $_uid;
4505 4505
 	private $_parent;
@@ -4525,7 +4525,7 @@  discard block
 block discarded – undo
4525 4525
 	}
4526 4526
 	public function getAdapter()
4527 4527
 	{
4528
-		return isset($this->_rf[self::RF_ADAPTER])?$this->_rf[self::RF_ADAPTER]:null;
4528
+		return isset($this->_rf[self::RF_ADAPTER]) ? $this->_rf[self::RF_ADAPTER] : null;
4529 4529
 	}
4530 4530
 	public function setAdapter(TControlAdapter $adapter)
4531 4531
 	{
@@ -4598,18 +4598,18 @@  discard block
 block discarded – undo
4598 4598
 	}
4599 4599
 	public function setID($id)
4600 4600
 	{
4601
-		if(!preg_match(self::ID_FORMAT,$id))
4602
-			throw new TInvalidDataValueException('control_id_invalid',get_class($this),$id);
4601
+		if(!preg_match(self::ID_FORMAT, $id))
4602
+			throw new TInvalidDataValueException('control_id_invalid', get_class($this), $id);
4603 4603
 		$this->_id=$id;
4604
-		$this->_flags |= self::IS_ID_SET;
4604
+		$this->_flags|=self::IS_ID_SET;
4605 4605
 		$this->clearCachedUniqueID($this instanceof INamingContainer);
4606 4606
 		if($this->_namingContainer)
4607 4607
 			$this->_namingContainer->clearNameTable();
4608 4608
 	}
4609 4609
 	public function getUniqueID()
4610 4610
 	{
4611
-		if($this->_uid==='' || $this->_uid===null)			{
4612
-			$this->_uid='';  			if($namingContainer=$this->getNamingContainer())
4611
+		if($this->_uid==='' || $this->_uid===null) {
4612
+			$this->_uid=''; if($namingContainer=$this->getNamingContainer())
4613 4613
 			{
4614 4614
 				if($this->getPage()===$namingContainer)
4615 4615
 					return ($this->_uid=$this->_id);
@@ -4629,20 +4629,20 @@  discard block
 block discarded – undo
4629 4629
 	}
4630 4630
 	public function getClientID()
4631 4631
 	{
4632
-		return strtr($this->getUniqueID(),self::ID_SEPARATOR,self::CLIENT_ID_SEPARATOR);
4632
+		return strtr($this->getUniqueID(), self::ID_SEPARATOR, self::CLIENT_ID_SEPARATOR);
4633 4633
 	}
4634 4634
 	public static function convertUniqueIdToClientId($uniqueID)
4635 4635
 	{
4636
-		return strtr($uniqueID,self::ID_SEPARATOR,self::CLIENT_ID_SEPARATOR);
4636
+		return strtr($uniqueID, self::ID_SEPARATOR, self::CLIENT_ID_SEPARATOR);
4637 4637
 	}
4638 4638
 	public function getSkinID()
4639 4639
 	{
4640
-		return isset($this->_rf[self::RF_SKIN_ID])?$this->_rf[self::RF_SKIN_ID]:'';
4640
+		return isset($this->_rf[self::RF_SKIN_ID]) ? $this->_rf[self::RF_SKIN_ID] : '';
4641 4641
 	}
4642 4642
 	public function setSkinID($value)
4643 4643
 	{
4644
-		if(($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage>=self::CS_CHILD_INITIALIZED)
4645
-			throw new TInvalidOperationException('control_skinid_unchangeable',get_class($this));
4644
+		if(($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage >= self::CS_CHILD_INITIALIZED)
4645
+			throw new TInvalidOperationException('control_skinid_unchangeable', get_class($this));
4646 4646
 		else
4647 4647
 			$this->_rf[self::RF_SKIN_ID]=$value;
4648 4648
 	}
@@ -4655,28 +4655,28 @@  discard block
 block discarded – undo
4655 4655
 		if($this->_flags & self::IS_DISABLE_THEMING)
4656 4656
 			return false;
4657 4657
 		else
4658
-			return $this->_parent?$this->_parent->getEnableTheming():true;
4658
+			return $this->_parent ? $this->_parent->getEnableTheming() : true;
4659 4659
 	}
4660 4660
 	public function setEnableTheming($value)
4661 4661
 	{
4662
-		if($this->_stage>=self::CS_CHILD_INITIALIZED)
4663
-			throw new TInvalidOperationException('control_enabletheming_unchangeable',get_class($this),$this->getUniqueID());
4662
+		if($this->_stage >= self::CS_CHILD_INITIALIZED)
4663
+			throw new TInvalidOperationException('control_enabletheming_unchangeable', get_class($this), $this->getUniqueID());
4664 4664
 		else if(TPropertyValue::ensureBoolean($value))
4665
-			$this->_flags &= ~self::IS_DISABLE_THEMING;
4665
+			$this->_flags&=~self::IS_DISABLE_THEMING;
4666 4666
 		else
4667
-			$this->_flags |= self::IS_DISABLE_THEMING;
4667
+			$this->_flags|=self::IS_DISABLE_THEMING;
4668 4668
 	}
4669 4669
 	public function getCustomData()
4670 4670
 	{
4671
-		return $this->getViewState('CustomData',null);
4671
+		return $this->getViewState('CustomData', null);
4672 4672
 	}
4673 4673
 	public function setCustomData($value)
4674 4674
 	{
4675
-		$this->setViewState('CustomData',$value,null);
4675
+		$this->setViewState('CustomData', $value, null);
4676 4676
 	}
4677 4677
 	public function getHasControls()
4678 4678
 	{
4679
-		return isset($this->_rf[self::RF_CONTROLS]) && $this->_rf[self::RF_CONTROLS]->getCount()>0;
4679
+		return isset($this->_rf[self::RF_CONTROLS]) && $this->_rf[self::RF_CONTROLS]->getCount() > 0;
4680 4680
 	}
4681 4681
 	public function getControls()
4682 4682
 	{
@@ -4686,79 +4686,79 @@  discard block
 block discarded – undo
4686 4686
 	}
4687 4687
 	protected function createControlCollection()
4688 4688
 	{
4689
-		return $this->getAllowChildControls()?new TControlCollection($this):new TEmptyControlCollection($this);
4689
+		return $this->getAllowChildControls() ? new TControlCollection($this) : new TEmptyControlCollection($this);
4690 4690
 	}
4691 4691
 	public function getVisible($checkParents=true)
4692 4692
 	{
4693 4693
 		if($checkParents)
4694 4694
 		{
4695
-			for($control=$this;$control;$control=$control->_parent)
4695
+			for($control=$this; $control; $control=$control->_parent)
4696 4696
 				if(!$control->getVisible(false))
4697 4697
 					return false;
4698 4698
 			return true;
4699 4699
 		}
4700 4700
 		else
4701
-			return $this->getViewState('Visible',true);
4701
+			return $this->getViewState('Visible', true);
4702 4702
 	}
4703 4703
 	public function setVisible($value)
4704 4704
 	{
4705
-		$this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true);
4705
+		$this->setViewState('Visible', TPropertyValue::ensureBoolean($value), true);
4706 4706
 	}
4707 4707
 	public function getEnabled($checkParents=false)
4708 4708
 	{
4709 4709
 		if($checkParents)
4710 4710
 		{
4711
-			for($control=$this;$control;$control=$control->_parent)
4712
-				if(!$control->getViewState('Enabled',true))
4711
+			for($control=$this; $control; $control=$control->_parent)
4712
+				if(!$control->getViewState('Enabled', true))
4713 4713
 					return false;
4714 4714
 			return true;
4715 4715
 		}
4716 4716
 		else
4717
-			return $this->getViewState('Enabled',true);
4717
+			return $this->getViewState('Enabled', true);
4718 4718
 	}
4719 4719
 	public function setEnabled($value)
4720 4720
 	{
4721
-		$this->setViewState('Enabled',TPropertyValue::ensureBoolean($value),true);
4721
+		$this->setViewState('Enabled', TPropertyValue::ensureBoolean($value), true);
4722 4722
 	}
4723 4723
 	public function getHasAttributes()
4724 4724
 	{
4725
-		if($attributes=$this->getViewState('Attributes',null))
4726
-			return $attributes->getCount()>0;
4725
+		if($attributes=$this->getViewState('Attributes', null))
4726
+			return $attributes->getCount() > 0;
4727 4727
 		else
4728 4728
 			return false;
4729 4729
 	}
4730 4730
 	public function getAttributes()
4731 4731
 	{
4732
-		if($attributes=$this->getViewState('Attributes',null))
4732
+		if($attributes=$this->getViewState('Attributes', null))
4733 4733
 			return $attributes;
4734 4734
 		else
4735 4735
 		{
4736 4736
 			$attributes=new TAttributeCollection;
4737
-			$this->setViewState('Attributes',$attributes,null);
4737
+			$this->setViewState('Attributes', $attributes, null);
4738 4738
 			return $attributes;
4739 4739
 		}
4740 4740
 	}
4741 4741
 	public function hasAttribute($name)
4742 4742
 	{
4743
-		if($attributes=$this->getViewState('Attributes',null))
4743
+		if($attributes=$this->getViewState('Attributes', null))
4744 4744
 			return $attributes->contains($name);
4745 4745
 		else
4746 4746
 			return false;
4747 4747
 	}
4748 4748
 	public function getAttribute($name)
4749 4749
 	{
4750
-		if($attributes=$this->getViewState('Attributes',null))
4750
+		if($attributes=$this->getViewState('Attributes', null))
4751 4751
 			return $attributes->itemAt($name);
4752 4752
 		else
4753 4753
 			return null;
4754 4754
 	}
4755
-	public function setAttribute($name,$value)
4755
+	public function setAttribute($name, $value)
4756 4756
 	{
4757
-		$this->getAttributes()->add($name,$value);
4757
+		$this->getAttributes()->add($name, $value);
4758 4758
 	}
4759 4759
 	public function removeAttribute($name)
4760 4760
 	{
4761
-		if($attributes=$this->getViewState('Attributes',null))
4761
+		if($attributes=$this->getViewState('Attributes', null))
4762 4762
 			return $attributes->remove($name);
4763 4763
 		else
4764 4764
 			return null;
@@ -4767,7 +4767,7 @@  discard block
 block discarded – undo
4767 4767
 	{
4768 4768
 		if($checkParents)
4769 4769
 		{
4770
-			for($control=$this;$control!==null;$control=$control->getParent())
4770
+			for($control=$this; $control!==null; $control=$control->getParent())
4771 4771
 				if($control->_flags & self::IS_DISABLE_VIEWSTATE)
4772 4772
 					return false;
4773 4773
 			return true;
@@ -4778,15 +4778,15 @@  discard block
 block discarded – undo
4778 4778
 	public function setEnableViewState($value)
4779 4779
 	{
4780 4780
 		if(TPropertyValue::ensureBoolean($value))
4781
-			$this->_flags &= ~self::IS_DISABLE_VIEWSTATE;
4781
+			$this->_flags&=~self::IS_DISABLE_VIEWSTATE;
4782 4782
 		else
4783
-			$this->_flags |= self::IS_DISABLE_VIEWSTATE;
4783
+			$this->_flags|=self::IS_DISABLE_VIEWSTATE;
4784 4784
 	}
4785
-	protected function getControlState($key,$defaultValue=null)
4785
+	protected function getControlState($key, $defaultValue=null)
4786 4786
 	{
4787
-		return isset($this->_rf[self::RF_CONTROLSTATE][$key])?$this->_rf[self::RF_CONTROLSTATE][$key]:$defaultValue;
4787
+		return isset($this->_rf[self::RF_CONTROLSTATE][$key]) ? $this->_rf[self::RF_CONTROLSTATE][$key] : $defaultValue;
4788 4788
 	}
4789
-	protected function setControlState($key,$value,$defaultValue=null)
4789
+	protected function setControlState($key, $value, $defaultValue=null)
4790 4790
 	{
4791 4791
 		if($value===$defaultValue)
4792 4792
 			unset($this->_rf[self::RF_CONTROLSTATE][$key]);
@@ -4801,10 +4801,10 @@  discard block
 block discarded – undo
4801 4801
 	{
4802 4802
 		$this->_trackViewState=TPropertyValue::ensureBoolean($enabled);
4803 4803
 	}
4804
-	public function getViewState($key,$defaultValue=null)
4804
+	public function getViewState($key, $defaultValue=null)
4805 4805
 	{
4806 4806
 		if(isset($this->_viewState[$key]))
4807
-			return $this->_viewState[$key]!==null?$this->_viewState[$key]:$defaultValue;
4807
+			return $this->_viewState[$key]!==null ? $this->_viewState[$key] : $defaultValue;
4808 4808
 		else if(isset($this->_tempState[$key]))
4809 4809
 		{
4810 4810
 			if(is_object($this->_tempState[$key]) && $this->_trackViewState)
@@ -4814,7 +4814,7 @@  discard block
 block discarded – undo
4814 4814
 		else
4815 4815
 			return $defaultValue;
4816 4816
 	}
4817
-	public function setViewState($key,$value,$defaultValue=null)
4817
+	public function setViewState($key, $value, $defaultValue=null)
4818 4818
 	{
4819 4819
 		if($this->_trackViewState)
4820 4820
 		{
@@ -4838,7 +4838,7 @@  discard block
 block discarded – undo
4838 4838
 		unset($this->_viewState[$key]);
4839 4839
 		unset($this->_tempState[$key]);
4840 4840
 	}
4841
-	public function bindProperty($name,$expression)
4841
+	public function bindProperty($name, $expression)
4842 4842
 	{
4843 4843
 		$this->_rf[self::RF_DATA_BINDINGS][$name]=$expression;
4844 4844
 	}
@@ -4846,7 +4846,7 @@  discard block
 block discarded – undo
4846 4846
 	{
4847 4847
 		unset($this->_rf[self::RF_DATA_BINDINGS][$name]);
4848 4848
 	}
4849
-	public function autoBindProperty($name,$expression)
4849
+	public function autoBindProperty($name, $expression)
4850 4850
 	{
4851 4851
 		$this->_rf[self::RF_AUTO_BINDINGS][$name]=$expression;
4852 4852
 	}
@@ -4863,7 +4863,7 @@  discard block
 block discarded – undo
4863 4863
 			if(($context=$this->getTemplateControl())===null)
4864 4864
 				$context=$this;
4865 4865
 			foreach($this->_rf[self::RF_DATA_BINDINGS] as $property=>$expression)
4866
-				$this->setSubProperty($property,$context->evaluateExpression($expression));
4866
+				$this->setSubProperty($property, $context->evaluateExpression($expression));
4867 4867
 		}
4868 4868
 	}
4869 4869
 	protected function autoDataBindProperties()
@@ -4873,7 +4873,7 @@  discard block
 block discarded – undo
4873 4873
 			if(($context=$this->getTemplateControl())===null)
4874 4874
 				$context=$this;
4875 4875
 			foreach($this->_rf[self::RF_AUTO_BINDINGS] as $property=>$expression)
4876
-				$this->setSubProperty($property,$context->evaluateExpression($expression));
4876
+				$this->setSubProperty($property, $context->evaluateExpression($expression));
4877 4877
 		}
4878 4878
 	}
4879 4879
 	protected function dataBindChildren()
@@ -4892,12 +4892,12 @@  discard block
 block discarded – undo
4892 4892
 	final protected function setChildControlsCreated($value)
4893 4893
 	{
4894 4894
 		if($value)
4895
-			$this->_flags |= self::IS_CHILD_CREATED;
4895
+			$this->_flags|=self::IS_CHILD_CREATED;
4896 4896
 		else
4897 4897
 		{
4898 4898
 			if($this->getHasControls() && ($this->_flags & self::IS_CHILD_CREATED))
4899 4899
 				$this->getControls()->clear();
4900
-			$this->_flags &= ~self::IS_CHILD_CREATED;
4900
+			$this->_flags&=~self::IS_CHILD_CREATED;
4901 4901
 		}
4902 4902
 	}
4903 4903
 	public function ensureChildControls()
@@ -4906,18 +4906,18 @@  discard block
 block discarded – undo
4906 4906
 		{
4907 4907
 			try
4908 4908
 			{
4909
-				$this->_flags |= self::IS_CREATING_CHILD;
4909
+				$this->_flags|=self::IS_CREATING_CHILD;
4910 4910
 				if(isset($this->_rf[self::RF_ADAPTER]))
4911 4911
 					$this->_rf[self::RF_ADAPTER]->createChildControls();
4912 4912
 				else
4913 4913
 					$this->createChildControls();
4914
-				$this->_flags &= ~self::IS_CREATING_CHILD;
4915
-				$this->_flags |= self::IS_CHILD_CREATED;
4914
+				$this->_flags&=~self::IS_CREATING_CHILD;
4915
+				$this->_flags|=self::IS_CHILD_CREATED;
4916 4916
 			}
4917 4917
 			catch(Exception $e)
4918 4918
 			{
4919
-				$this->_flags &= ~self::IS_CREATING_CHILD;
4920
-				$this->_flags |= self::IS_CHILD_CREATED;
4919
+				$this->_flags&=~self::IS_CREATING_CHILD;
4920
+				$this->_flags|=self::IS_CHILD_CREATED;
4921 4921
 				throw $e;
4922 4922
 			}
4923 4923
 		}
@@ -4927,28 +4927,28 @@  discard block
 block discarded – undo
4927 4927
 	}
4928 4928
 	public function findControl($id)
4929 4929
 	{
4930
-		$id=strtr($id,'.',self::ID_SEPARATOR);
4931
-		$container=($this instanceof INamingContainer)?$this:$this->getNamingContainer();
4930
+		$id=strtr($id, '.', self::ID_SEPARATOR);
4931
+		$container=($this instanceof INamingContainer) ? $this : $this->getNamingContainer();
4932 4932
 		if(!$container || !$container->getHasControls())
4933 4933
 			return null;
4934 4934
 		if(!isset($container->_rf[self::RF_NAMED_CONTROLS]))
4935 4935
 		{
4936 4936
 			$container->_rf[self::RF_NAMED_CONTROLS]=array();
4937
-			$container->fillNameTable($container,$container->_rf[self::RF_CONTROLS]);
4937
+			$container->fillNameTable($container, $container->_rf[self::RF_CONTROLS]);
4938 4938
 		}
4939
-		if(($pos=strpos($id,self::ID_SEPARATOR))===false)
4940
-			return isset($container->_rf[self::RF_NAMED_CONTROLS][$id])?$container->_rf[self::RF_NAMED_CONTROLS][$id]:null;
4939
+		if(($pos=strpos($id, self::ID_SEPARATOR))===false)
4940
+			return isset($container->_rf[self::RF_NAMED_CONTROLS][$id]) ? $container->_rf[self::RF_NAMED_CONTROLS][$id] : null;
4941 4941
 		else
4942 4942
 		{
4943
-			$cid=substr($id,0,$pos);
4944
-			$sid=substr($id,$pos+1);
4943
+			$cid=substr($id, 0, $pos);
4944
+			$sid=substr($id, $pos + 1);
4945 4945
 			if(isset($container->_rf[self::RF_NAMED_CONTROLS][$cid]))
4946 4946
 				return $container->_rf[self::RF_NAMED_CONTROLS][$cid]->findControl($sid);
4947 4947
 			else
4948 4948
 				return null;
4949 4949
 		}
4950 4950
 	}
4951
-	public function findControlsByType($type,$strict=true)
4951
+	public function findControlsByType($type, $strict=true)
4952 4952
 	{
4953 4953
 		$controls=array();
4954 4954
 		if($this->getHasControls())
@@ -4958,7 +4958,7 @@  discard block
 block discarded – undo
4958 4958
 				if(is_object($control) && (get_class($control)===$type || (!$strict && ($control instanceof $type))))
4959 4959
 					$controls[]=$control;
4960 4960
 				if(($control instanceof TControl) && $control->getHasControls())
4961
-					$controls=array_merge($controls,$control->findControlsByType($type,$strict));
4961
+					$controls=array_merge($controls, $control->findControlsByType($type, $strict));
4962 4962
 			}
4963 4963
 		}
4964 4964
 		return $controls;
@@ -4974,7 +4974,7 @@  discard block
 block discarded – undo
4974 4974
 				{
4975 4975
 					if($control->_id===$id)
4976 4976
 						$controls[]=$control;
4977
-					$controls=array_merge($controls,$control->findControlsByID($id));
4977
+					$controls=array_merge($controls, $control->findControlsByID($id));
4978 4978
 				}
4979 4979
 			}
4980 4980
 		}
@@ -4985,10 +4985,10 @@  discard block
 block discarded – undo
4985 4985
 		unset($this->_rf[self::RF_NAMED_CONTROLS_ID]);
4986 4986
 		$this->clearNameTable();
4987 4987
 	}
4988
-	public function registerObject($name,$object)
4988
+	public function registerObject($name, $object)
4989 4989
 	{
4990 4990
 		if(isset($this->_rf[self::RF_NAMED_OBJECTS][$name]))
4991
-			throw new TInvalidOperationException('control_object_reregistered',$name);
4991
+			throw new TInvalidOperationException('control_object_reregistered', $name);
4992 4992
 		$this->_rf[self::RF_NAMED_OBJECTS][$name]=$object;
4993 4993
 	}
4994 4994
 	public function unregisterObject($name)
@@ -5021,7 +5021,7 @@  discard block
 block discarded – undo
5021 5021
 	}
5022 5022
 	public function getRegisteredObject($name)
5023 5023
 	{
5024
-		return isset($this->_rf[self::RF_NAMED_OBJECTS][$name])?$this->_rf[self::RF_NAMED_OBJECTS][$name]:null;
5024
+		return isset($this->_rf[self::RF_NAMED_OBJECTS][$name]) ? $this->_rf[self::RF_NAMED_OBJECTS][$name] : null;
5025 5025
 	}
5026 5026
 	public function getAllowChildControls()
5027 5027
 	{
@@ -5048,7 +5048,7 @@  discard block
 block discarded – undo
5048 5048
 			$control->_parent->getControls()->remove($control);
5049 5049
 		$control->_parent=$this;
5050 5050
 		$control->_page=$this->getPage();
5051
-		$namingContainer=($this instanceof INamingContainer)?$this:$this->_namingContainer;
5051
+		$namingContainer=($this instanceof INamingContainer) ? $this : $this->_namingContainer;
5052 5052
 		if($namingContainer)
5053 5053
 		{
5054 5054
 			$control->_namingContainer=$namingContainer;
@@ -5058,10 +5058,10 @@  discard block
 block discarded – undo
5058 5058
 				$namingContainer->clearNameTable();
5059 5059
 			$control->clearCachedUniqueID($control instanceof INamingContainer);
5060 5060
 		}
5061
-		if($this->_stage>=self::CS_CHILD_INITIALIZED)
5061
+		if($this->_stage >= self::CS_CHILD_INITIALIZED)
5062 5062
 		{
5063 5063
 			$control->initRecursive($namingContainer);
5064
-			if($this->_stage>=self::CS_STATE_LOADED)
5064
+			if($this->_stage >= self::CS_STATE_LOADED)
5065 5065
 			{
5066 5066
 				if(isset($this->_rf[self::RF_CHILD_STATE][$control->_id]))
5067 5067
 				{
@@ -5070,11 +5070,11 @@  discard block
 block discarded – undo
5070 5070
 				}
5071 5071
 				else
5072 5072
 					$state=null;
5073
-				$control->loadStateRecursive($state,!($this->_flags & self::IS_DISABLE_VIEWSTATE));
5074
-				if($this->_stage>=self::CS_LOADED)
5073
+				$control->loadStateRecursive($state, !($this->_flags & self::IS_DISABLE_VIEWSTATE));
5074
+				if($this->_stage >= self::CS_LOADED)
5075 5075
 				{
5076 5076
 					$control->loadRecursive();
5077
-					if($this->_stage>=self::CS_PRERENDERED)
5077
+					if($this->_stage >= self::CS_PRERENDERED)
5078 5078
 						$control->preRenderRecursive();
5079 5079
 				}
5080 5080
 			}
@@ -5115,13 +5115,13 @@  discard block
 block discarded – undo
5115 5115
 				}
5116 5116
 			}
5117 5117
 		}
5118
-		if($this->_stage<self::CS_INITIALIZED)
5118
+		if($this->_stage < self::CS_INITIALIZED)
5119 5119
 		{
5120 5120
 			$this->_stage=self::CS_CHILD_INITIALIZED;
5121 5121
 			if(($page=$this->getPage()) && $this->getEnableTheming() && !($this->_flags & self::IS_SKIN_APPLIED))
5122 5122
 			{
5123 5123
 				$page->applyControlSkin($this);
5124
-				$this->_flags |= self::IS_SKIN_APPLIED;
5124
+				$this->_flags|=self::IS_SKIN_APPLIED;
5125 5125
 			}
5126 5126
 			if(isset($this->_rf[self::RF_ADAPTER]))
5127 5127
 				$this->_rf[self::RF_ADAPTER]->onInit(null);
@@ -5132,7 +5132,7 @@  discard block
 block discarded – undo
5132 5132
 	}
5133 5133
 	protected function loadRecursive()
5134 5134
 	{
5135
-		if($this->_stage<self::CS_LOADED)
5135
+		if($this->_stage < self::CS_LOADED)
5136 5136
 		{
5137 5137
 			if(isset($this->_rf[self::RF_ADAPTER]))
5138 5138
 				$this->_rf[self::RF_ADAPTER]->onLoad(null);
@@ -5147,7 +5147,7 @@  discard block
 block discarded – undo
5147 5147
 					$control->loadRecursive();
5148 5148
 			}
5149 5149
 		}
5150
-		if($this->_stage<self::CS_LOADED)
5150
+		if($this->_stage < self::CS_LOADED)
5151 5151
 			$this->_stage=self::CS_LOADED;
5152 5152
 	}
5153 5153
 	protected function preRenderRecursive()
@@ -5189,73 +5189,73 @@  discard block
 block discarded – undo
5189 5189
 	}
5190 5190
 	public function onInit($param)
5191 5191
 	{
5192
-		$this->raiseEvent('OnInit',$this,$param);
5192
+		$this->raiseEvent('OnInit', $this, $param);
5193 5193
 	}
5194 5194
 	public function onLoad($param)
5195 5195
 	{
5196
-		$this->raiseEvent('OnLoad',$this,$param);
5196
+		$this->raiseEvent('OnLoad', $this, $param);
5197 5197
 	}
5198 5198
 	public function onDataBinding($param)
5199 5199
 	{
5200
-		$this->raiseEvent('OnDataBinding',$this,$param);
5200
+		$this->raiseEvent('OnDataBinding', $this, $param);
5201 5201
 	}
5202 5202
 	public function onUnload($param)
5203 5203
 	{
5204
-		$this->raiseEvent('OnUnload',$this,$param);
5204
+		$this->raiseEvent('OnUnload', $this, $param);
5205 5205
 	}
5206 5206
 	public function onPreRender($param)
5207 5207
 	{
5208
-		$this->raiseEvent('OnPreRender',$this,$param);
5208
+		$this->raiseEvent('OnPreRender', $this, $param);
5209 5209
 	}
5210
-	protected function raiseBubbleEvent($sender,$param)
5210
+	protected function raiseBubbleEvent($sender, $param)
5211 5211
 	{
5212 5212
 		$control=$this;
5213 5213
 		while($control=$control->_parent)
5214 5214
 		{
5215
-			if($control->bubbleEvent($sender,$param))
5215
+			if($control->bubbleEvent($sender, $param))
5216 5216
 				break;
5217 5217
 		}
5218 5218
 	}
5219
-	public function bubbleEvent($sender,$param)
5219
+	public function bubbleEvent($sender, $param)
5220 5220
 	{
5221 5221
 		return false;
5222 5222
 	}
5223
-	public function broadcastEvent($name,$sender,$param)
5223
+	public function broadcastEvent($name, $sender, $param)
5224 5224
 	{
5225
-		$rootControl=(($page=$this->getPage())===null)?$this:$page;
5226
-		$rootControl->broadcastEventInternal($name,$sender,new TBroadcastEventParameter($name,$param));
5225
+		$rootControl=(($page=$this->getPage())===null) ? $this : $page;
5226
+		$rootControl->broadcastEventInternal($name, $sender, new TBroadcastEventParameter($name, $param));
5227 5227
 	}
5228
-	private function broadcastEventInternal($name,$sender,$param)
5228
+	private function broadcastEventInternal($name, $sender, $param)
5229 5229
 	{
5230 5230
 		if($this->hasEvent($name))
5231
-			$this->raiseEvent($name,$sender,$param->getParameter());
5231
+			$this->raiseEvent($name, $sender, $param->getParameter());
5232 5232
 		if($this instanceof IBroadcastEventReceiver)
5233
-			$this->broadcastEventReceived($sender,$param);
5233
+			$this->broadcastEventReceived($sender, $param);
5234 5234
 		if($this->getHasControls())
5235 5235
 		{
5236 5236
 			foreach($this->_rf[self::RF_CONTROLS] as $control)
5237 5237
 			{
5238 5238
 				if($control instanceof TControl)
5239
-					$control->broadcastEventInternal($name,$sender,$param);
5239
+					$control->broadcastEventInternal($name, $sender, $param);
5240 5240
 			}
5241 5241
 		}
5242 5242
 	}
5243
-	protected function traverseChildControls($param,$preCallback=null,$postCallback=null)
5243
+	protected function traverseChildControls($param, $preCallback=null, $postCallback=null)
5244 5244
 	{
5245 5245
 		if($preCallback!==null)
5246
-			call_user_func($preCallback,$this,$param);
5246
+			call_user_func($preCallback, $this, $param);
5247 5247
 		if($this->getHasControls())
5248 5248
 		{
5249 5249
 			foreach($this->_rf[self::RF_CONTROLS] as $control)
5250 5250
 			{
5251 5251
 				if($control instanceof TControl)
5252 5252
 				{
5253
-					$control->traverseChildControls($param,$preCallback,$postCallback);
5253
+					$control->traverseChildControls($param, $preCallback, $postCallback);
5254 5254
 				}
5255 5255
 			}
5256 5256
 		}
5257 5257
 		if($postCallback!==null)
5258
-			call_user_func($postCallback,$this,$param);
5258
+			call_user_func($postCallback, $this, $param);
5259 5259
 	}
5260 5260
 	public function renderControl($writer)
5261 5261
 	{
@@ -5292,7 +5292,7 @@  discard block
 block discarded – undo
5292 5292
 	public function loadState()
5293 5293
 	{
5294 5294
 	}
5295
-	protected function loadStateRecursive(&$state,$needViewState=true)
5295
+	protected function loadStateRecursive(&$state, $needViewState=true)
5296 5296
 	{
5297 5297
 		if(is_array($state))
5298 5298
 		{
@@ -5320,7 +5320,7 @@  discard block
 block discarded – undo
5320 5320
 					{
5321 5321
 						if(isset($state[$control->_id]))
5322 5322
 						{
5323
-							$control->loadStateRecursive($state[$control->_id],$needViewState);
5323
+							$control->loadStateRecursive($state[$control->_id], $needViewState);
5324 5324
 							unset($state[$control->_id]);
5325 5325
 						}
5326 5326
 					}
@@ -5349,7 +5349,7 @@  discard block
 block discarded – undo
5349 5349
 			{
5350 5350
 				if($control instanceof TControl)
5351 5351
 				{
5352
-					if(count($tmp = &$control->saveStateRecursive($needViewState)))
5352
+					if(count($tmp=&$control->saveStateRecursive($needViewState)))
5353 5353
 						$state[$control->_id]=$tmp;
5354 5354
 				}
5355 5355
 			}
@@ -5365,10 +5365,10 @@  discard block
 block discarded – undo
5365 5365
 		if($page && !($this->_flags & self::IS_STYLESHEET_APPLIED))
5366 5366
 		{
5367 5367
 			$page->applyControlStyleSheet($this);
5368
-			$this->_flags |= self::IS_STYLESHEET_APPLIED;
5368
+			$this->_flags|=self::IS_STYLESHEET_APPLIED;
5369 5369
 		}
5370 5370
 		else if($this->_flags & self::IS_STYLESHEET_APPLIED)
5371
-			throw new TInvalidOperationException('control_stylesheet_applied',get_class($this));
5371
+			throw new TInvalidOperationException('control_stylesheet_applied', get_class($this));
5372 5372
 	}
5373 5373
 	private function clearCachedUniqueID($recursive)
5374 5374
 	{
@@ -5382,18 +5382,18 @@  discard block
 block discarded – undo
5382 5382
 	}
5383 5383
 	private function generateAutomaticID()
5384 5384
 	{
5385
-		$this->_flags &= ~self::IS_ID_SET;
5385
+		$this->_flags&=~self::IS_ID_SET;
5386 5386
 		if(!isset($this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]))
5387 5387
 			$this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]=0;
5388 5388
 		$id=$this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]++;
5389
-		$this->_id=self::AUTOMATIC_ID_PREFIX . $id;
5389
+		$this->_id=self::AUTOMATIC_ID_PREFIX.$id;
5390 5390
 		$this->_namingContainer->clearNameTable();
5391 5391
 	}
5392 5392
 	private function clearNameTable()
5393 5393
 	{
5394 5394
 		unset($this->_rf[self::RF_NAMED_CONTROLS]);
5395 5395
 	}
5396
-	private function fillNameTable($container,$controls)
5396
+	private function fillNameTable($container, $controls)
5397 5397
 	{
5398 5398
 		foreach($controls as $control)
5399 5399
 		{
@@ -5402,12 +5402,12 @@  discard block
 block discarded – undo
5402 5402
 				if($control->_id!=='')
5403 5403
 				{
5404 5404
 					if(isset($container->_rf[self::RF_NAMED_CONTROLS][$control->_id]))
5405
-						throw new TInvalidDataValueException('control_id_nonunique',get_class($control),$control->_id);
5405
+						throw new TInvalidDataValueException('control_id_nonunique', get_class($control), $control->_id);
5406 5406
 					else
5407 5407
 						$container->_rf[self::RF_NAMED_CONTROLS][$control->_id]=$control;
5408 5408
 				}
5409 5409
 				if(!($control instanceof INamingContainer) && $control->getHasControls())
5410
-					$this->fillNameTable($container,$control->_rf[self::RF_CONTROLS]);
5410
+					$this->fillNameTable($container, $control->_rf[self::RF_CONTROLS]);
5411 5411
 			}
5412 5412
 		}
5413 5413
 	}
@@ -5415,24 +5415,24 @@  discard block
 block discarded – undo
5415 5415
 class TControlCollection extends TList
5416 5416
 {
5417 5417
 	private $_o;
5418
-	public function __construct(TControl $owner,$readOnly=false)
5418
+	public function __construct(TControl $owner, $readOnly=false)
5419 5419
 	{
5420 5420
 		$this->_o=$owner;
5421
-		parent::__construct(null,$readOnly);
5421
+		parent::__construct(null, $readOnly);
5422 5422
 	}
5423 5423
 	protected function getOwner()
5424 5424
 	{
5425 5425
 		return $this->_o;
5426 5426
 	}
5427
-	public function insertAt($index,$item)
5427
+	public function insertAt($index, $item)
5428 5428
 	{
5429 5429
 		if($item instanceof TControl)
5430 5430
 		{
5431
-			parent::insertAt($index,$item);
5431
+			parent::insertAt($index, $item);
5432 5432
 			$this->_o->addedControl($item);
5433 5433
 		}
5434 5434
 		else if(is_string($item) || ($item instanceof IRenderable))
5435
-			parent::insertAt($index,$item);
5435
+			parent::insertAt($index, $item);
5436 5436
 		else
5437 5437
 			throw new TInvalidDataTypeException('controlcollection_control_required');
5438 5438
 	}
@@ -5454,11 +5454,11 @@  discard block
 block discarded – undo
5454 5454
 {
5455 5455
 	public function __construct(TControl $owner)
5456 5456
 	{
5457
-		parent::__construct($owner,true);
5457
+		parent::__construct($owner, true);
5458 5458
 	}
5459
-	public function insertAt($index,$item)
5459
+	public function insertAt($index, $item)
5460 5460
 	{
5461
-		if(!is_string($item))  			parent::insertAt($index,$item);  	}
5461
+		if(!is_string($item))  			parent::insertAt($index, $item); }
5462 5462
 }
5463 5463
 interface INamingContainer
5464 5464
 {
@@ -5469,7 +5469,7 @@  discard block
 block discarded – undo
5469 5469
 }
5470 5470
 interface IPostBackDataHandler
5471 5471
 {
5472
-	public function loadPostData($key,$values);
5472
+	public function loadPostData($key, $values);
5473 5473
 	public function raisePostDataChangedEvent();
5474 5474
 	public function getDataChanged();
5475 5475
 }
@@ -5489,7 +5489,7 @@  discard block
 block discarded – undo
5489 5489
 }
5490 5490
 interface IBroadcastEventReceiver
5491 5491
 {
5492
-	public function broadcastEventReceived($sender,$param);
5492
+	public function broadcastEventReceived($sender, $param);
5493 5493
 }
5494 5494
 interface ITheme
5495 5495
 {
@@ -5525,7 +5525,7 @@  discard block
 block discarded – undo
5525 5525
 {
5526 5526
 	private $_name;
5527 5527
 	private $_param;
5528
-	public function __construct($name='',$parameter=null)
5528
+	public function __construct($name='', $parameter=null)
5529 5529
 	{
5530 5530
 		$this->_name=$name;
5531 5531
 		$this->_param=$parameter;
@@ -5551,7 +5551,7 @@  discard block
 block discarded – undo
5551 5551
 {
5552 5552
 	private $_name;
5553 5553
 	private $_param;
5554
-	public function __construct($name='',$parameter='')
5554
+	public function __construct($name='', $parameter='')
5555 5555
 	{
5556 5556
 		$this->_name=$name;
5557 5557
 		$this->_param=$parameter;
@@ -5606,7 +5606,7 @@  discard block
 block discarded – undo
5606 5606
 	}
5607 5607
 	public function evaluateDynamicContent()
5608 5608
 	{
5609
-		$context=$this->_container===null?$this:$this->_container;
5609
+		$context=$this->_container===null ? $this : $this->_container;
5610 5610
 		foreach($this->_expressions as $id=>$expression)
5611 5611
 			$this->_items[$id]=$context->evaluateExpression($expression);
5612 5612
 		foreach($this->_statements as $id=>$statement)
@@ -5614,13 +5614,13 @@  discard block
 block discarded – undo
5614 5614
 	}
5615 5615
 	public function dataBind()
5616 5616
 	{
5617
-		$context=$this->_container===null?$this:$this->_container;
5617
+		$context=$this->_container===null ? $this : $this->_container;
5618 5618
 		foreach($this->_bindings as $id=>$binding)
5619 5619
 			$this->_items[$id]=$context->evaluateExpression($binding);
5620 5620
 	}
5621 5621
 	public function render($writer)
5622 5622
 	{
5623
-		$writer->write(implode('',$this->_items));
5623
+		$writer->write(implode('', $this->_items));
5624 5624
 	}
5625 5625
 }
5626 5626
 class TFont extends TComponent
@@ -5643,12 +5643,12 @@  discard block
 block discarded – undo
5643 5643
 	protected function __getZappableSleepProps(&$exprops)
5644 5644
 	{
5645 5645
 		parent::__getZappableSleepProps($exprops);
5646
-		if ($this->_flags===0)
5647
-			$exprops[] = "\0TFont\0_flags";
5648
-		if ($this->_name==='')
5649
-			$exprops[] = "\0TFont\0_name";
5650
-		if ($this->_size==='')
5651
-			$exprops[] = "\0TFont\0_size";
5646
+		if($this->_flags===0)
5647
+			$exprops[]="\0TFont\0_flags";
5648
+		if($this->_name==='')
5649
+			$exprops[]="\0TFont\0_name";
5650
+		if($this->_size==='')
5651
+			$exprops[]="\0TFont\0_size";
5652 5652
 	}
5653 5653
 	public function getBold()
5654 5654
 	{
@@ -5656,11 +5656,11 @@  discard block
 block discarded – undo
5656 5656
 	}
5657 5657
 	public function setBold($value)
5658 5658
 	{
5659
-		$this->_flags |= self::IS_SET_BOLD;
5659
+		$this->_flags|=self::IS_SET_BOLD;
5660 5660
 		if(TPropertyValue::ensureBoolean($value))
5661
-			$this->_flags |= self::IS_BOLD;
5661
+			$this->_flags|=self::IS_BOLD;
5662 5662
 		else
5663
-			$this->_flags &= ~self::IS_BOLD;
5663
+			$this->_flags&=~self::IS_BOLD;
5664 5664
 	}
5665 5665
 	public function getItalic()
5666 5666
 	{
@@ -5668,11 +5668,11 @@  discard block
 block discarded – undo
5668 5668
 	}
5669 5669
 	public function setItalic($value)
5670 5670
 	{
5671
-		$this->_flags |= self::IS_SET_ITALIC;
5671
+		$this->_flags|=self::IS_SET_ITALIC;
5672 5672
 		if(TPropertyValue::ensureBoolean($value))
5673
-			$this->_flags |= self::IS_ITALIC;
5673
+			$this->_flags|=self::IS_ITALIC;
5674 5674
 		else
5675
-			$this->_flags &= ~self::IS_ITALIC;
5675
+			$this->_flags&=~self::IS_ITALIC;
5676 5676
 	}
5677 5677
 	public function getOverline()
5678 5678
 	{
@@ -5680,11 +5680,11 @@  discard block
 block discarded – undo
5680 5680
 	}
5681 5681
 	public function setOverline($value)
5682 5682
 	{
5683
-		$this->_flags |= self::IS_SET_OVERLINE;
5683
+		$this->_flags|=self::IS_SET_OVERLINE;
5684 5684
 		if(TPropertyValue::ensureBoolean($value))
5685
-			$this->_flags |= self::IS_OVERLINE;
5685
+			$this->_flags|=self::IS_OVERLINE;
5686 5686
 		else
5687
-			$this->_flags &= ~self::IS_OVERLINE;
5687
+			$this->_flags&=~self::IS_OVERLINE;
5688 5688
 	}
5689 5689
 	public function getSize()
5690 5690
 	{
@@ -5692,7 +5692,7 @@  discard block
 block discarded – undo
5692 5692
 	}
5693 5693
 	public function setSize($value)
5694 5694
 	{
5695
-		$this->_flags |= self::IS_SET_SIZE;
5695
+		$this->_flags|=self::IS_SET_SIZE;
5696 5696
 		$this->_size=$value;
5697 5697
 	}
5698 5698
 	public function getStrikeout()
@@ -5701,11 +5701,11 @@  discard block
 block discarded – undo
5701 5701
 	}
5702 5702
 	public function setStrikeout($value)
5703 5703
 	{
5704
-		$this->_flags |= self::IS_SET_STRIKEOUT;
5704
+		$this->_flags|=self::IS_SET_STRIKEOUT;
5705 5705
 		if(TPropertyValue::ensureBoolean($value))
5706
-			$this->_flags |= self::IS_STRIKEOUT;
5706
+			$this->_flags|=self::IS_STRIKEOUT;
5707 5707
 		else
5708
-			$this->_flags &= ~self::IS_STRIKEOUT;
5708
+			$this->_flags&=~self::IS_STRIKEOUT;
5709 5709
 	}
5710 5710
 	public function getUnderline()
5711 5711
 	{
@@ -5713,11 +5713,11 @@  discard block
 block discarded – undo
5713 5713
 	}
5714 5714
 	public function setUnderline($value)
5715 5715
 	{
5716
-		$this->_flags |= self::IS_SET_UNDERLINE;
5716
+		$this->_flags|=self::IS_SET_UNDERLINE;
5717 5717
 		if(TPropertyValue::ensureBoolean($value))
5718
-			$this->_flags |= self::IS_UNDERLINE;
5718
+			$this->_flags|=self::IS_UNDERLINE;
5719 5719
 		else
5720
-			$this->_flags &= ~self::IS_UNDERLINE;
5720
+			$this->_flags&=~self::IS_UNDERLINE;
5721 5721
 	}
5722 5722
 	public function getName()
5723 5723
 	{
@@ -5725,7 +5725,7 @@  discard block
 block discarded – undo
5725 5725
 	}
5726 5726
 	public function setName($value)
5727 5727
 	{
5728
-		$this->_flags |= self::IS_SET_NAME;
5728
+		$this->_flags|=self::IS_SET_NAME;
5729 5729
 		$this->_name=$value;
5730 5730
 	}
5731 5731
 	public function getIsEmpty()
@@ -5782,9 +5782,9 @@  discard block
 block discarded – undo
5782 5782
 			return '';
5783 5783
 		$str='';
5784 5784
 		if($this->_flags & self::IS_SET_BOLD)
5785
-			$str.='font-weight:'.(($this->_flags & self::IS_BOLD)?'bold;':'normal;');
5785
+			$str.='font-weight:'.(($this->_flags & self::IS_BOLD) ? 'bold;' : 'normal;');
5786 5786
 		if($this->_flags & self::IS_SET_ITALIC)
5787
-			$str.='font-style:'.(($this->_flags & self::IS_ITALIC)?'italic;':'normal;');
5787
+			$str.='font-style:'.(($this->_flags & self::IS_ITALIC) ? 'italic;' : 'normal;');
5788 5788
 		$textDec='';
5789 5789
 		if($this->_flags & self::IS_UNDERLINE)
5790 5790
 			$textDec.='underline';
@@ -5806,9 +5806,9 @@  discard block
 block discarded – undo
5806 5806
 		if($this->_flags===0)
5807 5807
 			return;
5808 5808
 		if($this->_flags & self::IS_SET_BOLD)
5809
-			$writer->addStyleAttribute('font-weight',(($this->_flags & self::IS_BOLD)?'bold':'normal'));
5809
+			$writer->addStyleAttribute('font-weight', (($this->_flags & self::IS_BOLD) ? 'bold' : 'normal'));
5810 5810
 		if($this->_flags & self::IS_SET_ITALIC)
5811
-			$writer->addStyleAttribute('font-style',(($this->_flags & self::IS_ITALIC)?'italic':'normal'));
5811
+			$writer->addStyleAttribute('font-style', (($this->_flags & self::IS_ITALIC) ? 'italic' : 'normal'));
5812 5812
 		$textDec='';
5813 5813
 		if($this->_flags & self::IS_UNDERLINE)
5814 5814
 			$textDec.='underline';
@@ -5818,11 +5818,11 @@  discard block
 block discarded – undo
5818 5818
 			$textDec.=' line-through';
5819 5819
 		$textDec=ltrim($textDec);
5820 5820
 		if($textDec!=='')
5821
-			$writer->addStyleAttribute('text-decoration',$textDec);
5821
+			$writer->addStyleAttribute('text-decoration', $textDec);
5822 5822
 		if($this->_size!=='')
5823
-			$writer->addStyleAttribute('font-size',$this->_size);
5823
+			$writer->addStyleAttribute('font-size', $this->_size);
5824 5824
 		if($this->_name!=='')
5825
-			$writer->addStyleAttribute('font-family',$this->_name);
5825
+			$writer->addStyleAttribute('font-family', $this->_name);
5826 5826
 	}
5827 5827
 }
5828 5828
 class TStyle extends TComponent
@@ -5835,16 +5835,16 @@  discard block
 block discarded – undo
5835 5835
 	protected function __getZappableSleepProps(&$exprops)
5836 5836
 	{
5837 5837
 		parent::__getZappableSleepProps($exprops);
5838
-		if ($this->_fields===array())
5839
-			$exprops[] = "\0TStyle\0_fields";
5838
+		if($this->_fields===array())
5839
+			$exprops[]="\0TStyle\0_fields";
5840 5840
 		if($this->_font===null)
5841
-			$exprops[] = "\0TStyle\0_font";
5841
+			$exprops[]="\0TStyle\0_font";
5842 5842
 		if($this->_class===null)
5843
-			$exprops[] = "\0TStyle\0_class";
5844
-		if ($this->_customStyle===null)
5845
-			$exprops[] = "\0TStyle\0_customStyle";
5846
-		if ($this->_displayStyle==='Fixed')
5847
-			$exprops[] = "\0TStyle\0_displayStyle";
5843
+			$exprops[]="\0TStyle\0_class";
5844
+		if($this->_customStyle===null)
5845
+			$exprops[]="\0TStyle\0_customStyle";
5846
+		if($this->_displayStyle==='Fixed')
5847
+			$exprops[]="\0TStyle\0_displayStyle";
5848 5848
 	}
5849 5849
 	public function __construct($style=null)
5850 5850
 	{
@@ -5854,11 +5854,11 @@  discard block
 block discarded – undo
5854 5854
 	public function __clone()
5855 5855
 	{
5856 5856
 		if($this->_font!==null)
5857
-			$this->_font = clone($this->_font);
5857
+			$this->_font=clone($this->_font);
5858 5858
 	}
5859 5859
 	public function getBackColor()
5860 5860
 	{
5861
-		return isset($this->_fields['background-color'])?$this->_fields['background-color']:'';
5861
+		return isset($this->_fields['background-color']) ? $this->_fields['background-color'] : '';
5862 5862
 	}
5863 5863
 	public function setBackColor($value)
5864 5864
 	{
@@ -5869,7 +5869,7 @@  discard block
 block discarded – undo
5869 5869
 	}
5870 5870
 	public function getBorderColor()
5871 5871
 	{
5872
-		return isset($this->_fields['border-color'])?$this->_fields['border-color']:'';
5872
+		return isset($this->_fields['border-color']) ? $this->_fields['border-color'] : '';
5873 5873
 	}
5874 5874
 	public function setBorderColor($value)
5875 5875
 	{
@@ -5880,7 +5880,7 @@  discard block
 block discarded – undo
5880 5880
 	}
5881 5881
 	public function getBorderStyle()
5882 5882
 	{
5883
-		return isset($this->_fields['border-style'])?$this->_fields['border-style']:'';
5883
+		return isset($this->_fields['border-style']) ? $this->_fields['border-style'] : '';
5884 5884
 	}
5885 5885
 	public function setBorderStyle($value)
5886 5886
 	{
@@ -5891,7 +5891,7 @@  discard block
 block discarded – undo
5891 5891
 	}
5892 5892
 	public function getBorderWidth()
5893 5893
 	{
5894
-		return isset($this->_fields['border-width'])?$this->_fields['border-width']:'';
5894
+		return isset($this->_fields['border-width']) ? $this->_fields['border-width'] : '';
5895 5895
 	}
5896 5896
 	public function setBorderWidth($value)
5897 5897
 	{
@@ -5902,7 +5902,7 @@  discard block
 block discarded – undo
5902 5902
 	}
5903 5903
 	public function getCssClass()
5904 5904
 	{
5905
-		return $this->_class===null?'':$this->_class;
5905
+		return $this->_class===null ? '' : $this->_class;
5906 5906
 	}
5907 5907
 	public function hasCssClass()
5908 5908
 	{
@@ -5920,23 +5920,23 @@  discard block
 block discarded – undo
5920 5920
 	}
5921 5921
 	public function hasFont()
5922 5922
 	{
5923
-		return $this->_font !== null;
5923
+		return $this->_font!==null;
5924 5924
 	}
5925 5925
 	public function setDisplayStyle($value)
5926 5926
 	{
5927
-		$this->_displayStyle = TPropertyValue::ensureEnum($value, 'TDisplayStyle');
5927
+		$this->_displayStyle=TPropertyValue::ensureEnum($value, 'TDisplayStyle');
5928 5928
 		switch($this->_displayStyle)
5929 5929
 		{
5930 5930
 			case TDisplayStyle::None:
5931
-				$this->_fields['display'] = 'none';
5931
+				$this->_fields['display']='none';
5932 5932
 				break;
5933 5933
 			case TDisplayStyle::Dynamic:
5934
-				$this->_fields['display'] = ''; 				break;
5934
+				$this->_fields['display']=''; break;
5935 5935
 			case TDisplayStyle::Fixed:
5936
-				$this->_fields['visibility'] = 'visible';
5936
+				$this->_fields['visibility']='visible';
5937 5937
 				break;
5938 5938
 			case TDisplayStyle::Hidden:
5939
-				$this->_fields['visibility'] = 'hidden';
5939
+				$this->_fields['visibility']='hidden';
5940 5940
 				break;
5941 5941
 		}
5942 5942
 	}
@@ -5946,7 +5946,7 @@  discard block
 block discarded – undo
5946 5946
 	}
5947 5947
 	public function getForeColor()
5948 5948
 	{
5949
-		return isset($this->_fields['color'])?$this->_fields['color']:'';
5949
+		return isset($this->_fields['color']) ? $this->_fields['color'] : '';
5950 5950
 	}
5951 5951
 	public function setForeColor($value)
5952 5952
 	{
@@ -5957,7 +5957,7 @@  discard block
 block discarded – undo
5957 5957
 	}
5958 5958
 	public function getHeight()
5959 5959
 	{
5960
-		return isset($this->_fields['height'])?$this->_fields['height']:'';
5960
+		return isset($this->_fields['height']) ? $this->_fields['height'] : '';
5961 5961
 	}
5962 5962
 	public function setHeight($value)
5963 5963
 	{
@@ -5968,7 +5968,7 @@  discard block
 block discarded – undo
5968 5968
 	}
5969 5969
 	public function getCustomStyle()
5970 5970
 	{
5971
-		return $this->_customStyle===null?'':$this->_customStyle;
5971
+		return $this->_customStyle===null ? '' : $this->_customStyle;
5972 5972
 	}
5973 5973
 	public function setCustomStyle($value)
5974 5974
 	{
@@ -5976,9 +5976,9 @@  discard block
 block discarded – undo
5976 5976
 	}
5977 5977
 	public function getStyleField($name)
5978 5978
 	{
5979
-		return isset($this->_fields[$name])?$this->_fields[$name]:'';
5979
+		return isset($this->_fields[$name]) ? $this->_fields[$name] : '';
5980 5980
 	}
5981
-	public function setStyleField($name,$value)
5981
+	public function setStyleField($name, $value)
5982 5982
 	{
5983 5983
 		$this->_fields[$name]=$value;
5984 5984
 	}
@@ -5992,7 +5992,7 @@  discard block
 block discarded – undo
5992 5992
 	}
5993 5993
 	public function getWidth()
5994 5994
 	{
5995
-		return isset($this->_fields['width'])?$this->_fields['width']:'';
5995
+		return isset($this->_fields['width']) ? $this->_fields['width'] : '';
5996 5996
 	}
5997 5997
 	public function setWidth($value)
5998 5998
 	{
@@ -6009,7 +6009,7 @@  discard block
 block discarded – undo
6009 6009
 	{
6010 6010
 		if($style instanceof TStyle)
6011 6011
 		{
6012
-			$this->_fields=array_merge($this->_fields,$style->_fields);
6012
+			$this->_fields=array_merge($this->_fields, $style->_fields);
6013 6013
 			if($style->_class!==null)
6014 6014
 				$this->_class=$style->_class;
6015 6015
 			if($style->_customStyle!==null)
@@ -6022,7 +6022,7 @@  discard block
 block discarded – undo
6022 6022
 	{
6023 6023
 		if($style instanceof TStyle)
6024 6024
 		{
6025
-			$this->_fields=array_merge($style->_fields,$this->_fields);
6025
+			$this->_fields=array_merge($style->_fields, $this->_fields);
6026 6026
 			if($this->_class===null)
6027 6027
 				$this->_class=$style->_class;
6028 6028
 			if($this->_customStyle===null)
@@ -6035,18 +6035,18 @@  discard block
 block discarded – undo
6035 6035
 	{
6036 6036
 		if($this->_customStyle!==null)
6037 6037
 		{
6038
-			foreach(explode(';',$this->_customStyle) as $style)
6038
+			foreach(explode(';', $this->_customStyle) as $style)
6039 6039
 			{
6040
-				$arr=explode(':',$style,2);
6040
+				$arr=explode(':', $style, 2);
6041 6041
 				if(isset($arr[1]) && trim($arr[0])!=='')
6042
-					$writer->addStyleAttribute(trim($arr[0]),trim($arr[1]));
6042
+					$writer->addStyleAttribute(trim($arr[0]), trim($arr[1]));
6043 6043
 			}
6044 6044
 		}
6045 6045
 		$writer->addStyleAttributes($this->_fields);
6046 6046
 		if($this->_font!==null)
6047 6047
 			$this->_font->addAttributesToRender($writer);
6048 6048
 		if($this->_class!==null)
6049
-			$writer->addAttribute('class',$this->_class);
6049
+			$writer->addAttribute('class', $this->_class);
6050 6050
 	}
6051 6051
 	public function getStyleFields()
6052 6052
 	{
@@ -6071,18 +6071,18 @@  discard block
 block discarded – undo
6071 6071
 	protected function __getZappableSleepProps(&$exprops)
6072 6072
 	{
6073 6073
 		parent::__getZappableSleepProps($exprops);
6074
-		if ($this->_backImageUrl===null)
6075
-			$exprops[] = "\0TTableStyle\0_backImageUrl";
6076
-		if ($this->_horizontalAlign===null)
6077
-			$exprops[] = "\0TTableStyle\0_horizontalAlign";
6078
-		if ($this->_cellPadding===null)
6079
-			$exprops[] = "\0TTableStyle\0_cellPadding";
6080
-		if ($this->_cellSpacing===null)
6081
-			$exprops[] = "\0TTableStyle\0_cellSpacing";
6082
-		if ($this->_gridLines===null)
6083
-			$exprops[] = "\0TTableStyle\0_gridLines";
6084
-		if ($this->_borderCollapse===null)
6085
-			$exprops[] = "\0TTableStyle\0_borderCollapse";
6074
+		if($this->_backImageUrl===null)
6075
+			$exprops[]="\0TTableStyle\0_backImageUrl";
6076
+		if($this->_horizontalAlign===null)
6077
+			$exprops[]="\0TTableStyle\0_horizontalAlign";
6078
+		if($this->_cellPadding===null)
6079
+			$exprops[]="\0TTableStyle\0_cellPadding";
6080
+		if($this->_cellSpacing===null)
6081
+			$exprops[]="\0TTableStyle\0_cellSpacing";
6082
+		if($this->_gridLines===null)
6083
+			$exprops[]="\0TTableStyle\0_gridLines";
6084
+		if($this->_borderCollapse===null)
6085
+			$exprops[]="\0TTableStyle\0_borderCollapse";
6086 6086
 	}
6087 6087
 	public function reset()
6088 6088
 	{
@@ -6134,26 +6134,26 @@  discard block
 block discarded – undo
6134 6134
 	public function addAttributesToRender($writer)
6135 6135
 	{
6136 6136
 		if(($url=trim($this->getBackImageUrl()))!=='')
6137
-			$writer->addStyleAttribute('background-image','url('.$url.')');
6137
+			$writer->addStyleAttribute('background-image', 'url('.$url.')');
6138 6138
 		if(($horizontalAlign=$this->getHorizontalAlign())!==THorizontalAlign::NotSet)
6139
-			$writer->addStyleAttribute('text-align',strtolower($horizontalAlign));
6140
-		if(($cellPadding=$this->getCellPadding())>=0)
6141
-			$writer->addAttribute('cellpadding',"$cellPadding");
6142
-		if(($cellSpacing=$this->getCellSpacing())>=0)
6143
-			$writer->addAttribute('cellspacing',"$cellSpacing");
6139
+			$writer->addStyleAttribute('text-align', strtolower($horizontalAlign));
6140
+		if(($cellPadding=$this->getCellPadding()) >= 0)
6141
+			$writer->addAttribute('cellpadding', "$cellPadding");
6142
+		if(($cellSpacing=$this->getCellSpacing()) >= 0)
6143
+			$writer->addAttribute('cellspacing', "$cellSpacing");
6144 6144
 		if($this->getBorderCollapse())
6145
-			$writer->addStyleAttribute('border-collapse','collapse');
6145
+			$writer->addStyleAttribute('border-collapse', 'collapse');
6146 6146
 		switch($this->getGridLines())
6147 6147
 		{
6148
-			case TTableGridLines::Horizontal : $writer->addAttribute('rules','rows'); break;
6149
-			case TTableGridLines::Vertical : $writer->addAttribute('rules','cols'); break;
6150
-			case TTableGridLines::Both : $writer->addAttribute('rules','all'); break;
6148
+			case TTableGridLines::Horizontal : $writer->addAttribute('rules', 'rows'); break;
6149
+			case TTableGridLines::Vertical : $writer->addAttribute('rules', 'cols'); break;
6150
+			case TTableGridLines::Both : $writer->addAttribute('rules', 'all'); break;
6151 6151
 		}
6152 6152
 		parent::addAttributesToRender($writer);
6153 6153
 	}
6154 6154
 	public function getBackImageUrl()
6155 6155
 	{
6156
-		return $this->_backImageUrl===null?'':$this->_backImageUrl;
6156
+		return $this->_backImageUrl===null ? '' : $this->_backImageUrl;
6157 6157
 	}
6158 6158
 	public function setBackImageUrl($value)
6159 6159
 	{
@@ -6161,41 +6161,41 @@  discard block
 block discarded – undo
6161 6161
 	}
6162 6162
 	public function getHorizontalAlign()
6163 6163
 	{
6164
-		return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign;
6164
+		return $this->_horizontalAlign===null ? THorizontalAlign::NotSet : $this->_horizontalAlign;
6165 6165
 	}
6166 6166
 	public function setHorizontalAlign($value)
6167 6167
 	{
6168
-		$this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign');
6168
+		$this->_horizontalAlign=TPropertyValue::ensureEnum($value, 'THorizontalAlign');
6169 6169
 	}
6170 6170
 	public function getCellPadding()
6171 6171
 	{
6172
-		return $this->_cellPadding===null?-1:$this->_cellPadding;
6172
+		return $this->_cellPadding===null ?-1 : $this->_cellPadding;
6173 6173
 	}
6174 6174
 	public function setCellPadding($value)
6175 6175
 	{
6176
-		if(($this->_cellPadding=TPropertyValue::ensureInteger($value))<-1)
6176
+		if(($this->_cellPadding=TPropertyValue::ensureInteger($value)) < -1)
6177 6177
 			throw new TInvalidDataValueException('tablestyle_cellpadding_invalid');
6178 6178
 	}
6179 6179
 	public function getCellSpacing()
6180 6180
 	{
6181
-		return $this->_cellSpacing===null?-1:$this->_cellSpacing;
6181
+		return $this->_cellSpacing===null ?-1 : $this->_cellSpacing;
6182 6182
 	}
6183 6183
 	public function setCellSpacing($value)
6184 6184
 	{
6185
-		if(($this->_cellSpacing=TPropertyValue::ensureInteger($value))<-1)
6185
+		if(($this->_cellSpacing=TPropertyValue::ensureInteger($value)) < -1)
6186 6186
 			throw new TInvalidDataValueException('tablestyle_cellspacing_invalid');
6187 6187
 	}
6188 6188
 	public function getGridLines()
6189 6189
 	{
6190
-		return $this->_gridLines===null?TTableGridLines::None:$this->_gridLines;
6190
+		return $this->_gridLines===null ? TTableGridLines::None : $this->_gridLines;
6191 6191
 	}
6192 6192
 	public function setGridLines($value)
6193 6193
 	{
6194
-		$this->_gridLines=TPropertyValue::ensureEnum($value,'TTableGridLines');
6194
+		$this->_gridLines=TPropertyValue::ensureEnum($value, 'TTableGridLines');
6195 6195
 	}
6196 6196
 	public function getBorderCollapse()
6197 6197
 	{
6198
-		return $this->_borderCollapse===null?false:$this->_borderCollapse;
6198
+		return $this->_borderCollapse===null ? false : $this->_borderCollapse;
6199 6199
 	}
6200 6200
 	public function setBorderCollapse($value)
6201 6201
 	{
@@ -6210,12 +6210,12 @@  discard block
 block discarded – undo
6210 6210
 	protected function __getZappableSleepProps(&$exprops)
6211 6211
 	{
6212 6212
 		parent::__getZappableSleepProps($exprops);
6213
-		if ($this->_horizontalAlign===null)
6214
-			$exprops[] = "\0TTableItemStyle\0_horizontalAlign";
6215
-		if ($this->_verticalAlign===null)
6216
-			$exprops[] = "\0TTableItemStyle\0_verticalAlign";
6217
-		if ($this->_wrap===null)
6218
-			$exprops[] = "\0TTableItemStyle\0_wrap";
6213
+		if($this->_horizontalAlign===null)
6214
+			$exprops[]="\0TTableItemStyle\0_horizontalAlign";
6215
+		if($this->_verticalAlign===null)
6216
+			$exprops[]="\0TTableItemStyle\0_verticalAlign";
6217
+		if($this->_wrap===null)
6218
+			$exprops[]="\0TTableItemStyle\0_wrap";
6219 6219
 	}
6220 6220
 	public function reset()
6221 6221
 	{
@@ -6253,32 +6253,32 @@  discard block
 block discarded – undo
6253 6253
 	public function addAttributesToRender($writer)
6254 6254
 	{
6255 6255
 		if(!$this->getWrap())
6256
-			$writer->addStyleAttribute('white-space','nowrap');
6256
+			$writer->addStyleAttribute('white-space', 'nowrap');
6257 6257
 		if(($horizontalAlign=$this->getHorizontalAlign())!==THorizontalAlign::NotSet)
6258
-			$writer->addAttribute('align',strtolower($horizontalAlign));
6258
+			$writer->addAttribute('align', strtolower($horizontalAlign));
6259 6259
 		if(($verticalAlign=$this->getVerticalAlign())!==TVerticalAlign::NotSet)
6260
-			$writer->addAttribute('valign',strtolower($verticalAlign));
6260
+			$writer->addAttribute('valign', strtolower($verticalAlign));
6261 6261
 		parent::addAttributesToRender($writer);
6262 6262
 	}
6263 6263
 	public function getHorizontalAlign()
6264 6264
 	{
6265
-		return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign;
6265
+		return $this->_horizontalAlign===null ? THorizontalAlign::NotSet : $this->_horizontalAlign;
6266 6266
 	}
6267 6267
 	public function setHorizontalAlign($value)
6268 6268
 	{
6269
-		$this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign');
6269
+		$this->_horizontalAlign=TPropertyValue::ensureEnum($value, 'THorizontalAlign');
6270 6270
 	}
6271 6271
 	public function getVerticalAlign()
6272 6272
 	{
6273
-		return $this->_verticalAlign===null?TVerticalAlign::NotSet:$this->_verticalAlign;
6273
+		return $this->_verticalAlign===null ? TVerticalAlign::NotSet : $this->_verticalAlign;
6274 6274
 	}
6275 6275
 	public function setVerticalAlign($value)
6276 6276
 	{
6277
-		$this->_verticalAlign=TPropertyValue::ensureEnum($value,'TVerticalAlign');
6277
+		$this->_verticalAlign=TPropertyValue::ensureEnum($value, 'TVerticalAlign');
6278 6278
 	}
6279 6279
 	public function getWrap()
6280 6280
 	{
6281
-		return $this->_wrap===null?true:$this->_wrap;
6281
+		return $this->_wrap===null ? true : $this->_wrap;
6282 6282
 	}
6283 6283
 	public function setWrap($value)
6284 6284
 	{
@@ -6330,21 +6330,21 @@  discard block
 block discarded – undo
6330 6330
 }
6331 6331
 class TWebControlDecorator extends TComponent {
6332 6332
 	private $_internalonly;
6333
-	private $_usestate = false;
6333
+	private $_usestate=false;
6334 6334
 	private $_control;
6335 6335
 	private $_outercontrol;
6336 6336
 	private $_addedTemplateDecoration=false;
6337
-	private $_pretagtext = '';
6338
-	private $_precontentstext = '';
6339
-	private $_postcontentstext = '';
6340
-	private $_posttagtext = '';
6337
+	private $_pretagtext='';
6338
+	private $_precontentstext='';
6339
+	private $_postcontentstext='';
6340
+	private $_posttagtext='';
6341 6341
 	private $_pretagtemplate;
6342 6342
 	private $_precontentstemplate;
6343 6343
 	private $_postcontentstemplate;
6344 6344
 	private $_posttagtemplate;
6345
-	public function __construct($control, $onlyinternal = false) {
6346
-		$this->_control = $control;
6347
-		$this->_internalonly = $onlyinternal;
6345
+	public function __construct($control, $onlyinternal=false) {
6346
+		$this->_control=$control;
6347
+		$this->_internalonly=$onlyinternal;
6348 6348
 	}
6349 6349
 	public function getUseState()
6350 6350
 	{
@@ -6352,91 +6352,91 @@  discard block
 block discarded – undo
6352 6352
 	}
6353 6353
 	public function setUseState($value)
6354 6354
 	{
6355
-		$this->_usestate = TPropertyValue::ensureBoolean($value);
6355
+		$this->_usestate=TPropertyValue::ensureBoolean($value);
6356 6356
 	}
6357 6357
 	public function getPreTagText() {
6358 6358
 		return $this->_pretagtext;
6359 6359
 	}
6360 6360
 	public function setPreTagText($value) {
6361 6361
 		if(!$this->_internalonly && !$this->_control->getIsSkinApplied())
6362
-			$this->_pretagtext = TPropertyValue::ensureString($value);
6362
+			$this->_pretagtext=TPropertyValue::ensureString($value);
6363 6363
 	}
6364 6364
 	public function getPreContentsText() {
6365 6365
 		return $this->_precontentstext;
6366 6366
 	}
6367 6367
 	public function setPreContentsText($value) {
6368 6368
 		if(!$this->_control->getIsSkinApplied())
6369
-			$this->_precontentstext = TPropertyValue::ensureString($value);
6369
+			$this->_precontentstext=TPropertyValue::ensureString($value);
6370 6370
 	}
6371 6371
 	public function getPostContentsText() {
6372 6372
 		return $this->_postcontentstext;
6373 6373
 	}
6374 6374
 	public function setPostContentsText($value) {
6375 6375
 		if(!$this->_control->getIsSkinApplied())
6376
-			$this->_postcontentstext = TPropertyValue::ensureString($value);
6376
+			$this->_postcontentstext=TPropertyValue::ensureString($value);
6377 6377
 	}
6378 6378
 	public function getPostTagText() {
6379 6379
 		return $this->_posttagtext;
6380 6380
 	}
6381 6381
 	public function setPostTagText($value) {
6382 6382
 		if(!$this->_internalonly && !$this->_control->getIsSkinApplied())
6383
-			$this->_posttagtext = TPropertyValue::ensureString($value);
6383
+			$this->_posttagtext=TPropertyValue::ensureString($value);
6384 6384
 	}
6385 6385
 	public function getPreTagTemplate() {
6386 6386
 		return $this->_pretagtemplate;
6387 6387
 	}
6388 6388
 	public function setPreTagTemplate($value) {
6389 6389
 		if(!$this->_internalonly && !$this->_control->getIsSkinApplied())
6390
-			$this->_pretagtemplate = $value;
6390
+			$this->_pretagtemplate=$value;
6391 6391
 	}
6392 6392
 	public function getPreContentsTemplate() {
6393 6393
 		return $this->_precontentstemplate;
6394 6394
 	}
6395 6395
 	public function setPreContentsTemplate($value) {
6396 6396
 		if(!$this->_control->getIsSkinApplied())
6397
-			$this->_precontentstemplate = $value;
6397
+			$this->_precontentstemplate=$value;
6398 6398
 	}
6399 6399
 	public function getPostContentsTemplate() {
6400 6400
 		return $this->_postcontentstemplate;
6401 6401
 	}
6402 6402
 	public function setPostContentsTemplate($value) {
6403 6403
 		if(!$this->_control->getIsSkinApplied())
6404
-			$this->_postcontentstemplate = $value;
6404
+			$this->_postcontentstemplate=$value;
6405 6405
 	}
6406 6406
 	public function getPostTagTemplate() {
6407 6407
 		return $this->_posttagtemplate;
6408 6408
 	}
6409 6409
 	public function setPostTagTemplate($value) {
6410 6410
 		if(!$this->_internalonly && !$this->_control->getIsSkinApplied())
6411
-			$this->_posttagtemplate = $value;
6411
+			$this->_posttagtemplate=$value;
6412 6412
 	}
6413
-	public function instantiate($outercontrol = null) {
6413
+	public function instantiate($outercontrol=null) {
6414 6414
 		if($this->getPreTagTemplate() || $this->getPreContentsTemplate() ||
6415 6415
 			$this->getPostContentsTemplate() || $this->getPostTagTemplate()) {
6416
-			$this->_outercontrol = $outercontrol;
6416
+			$this->_outercontrol=$outercontrol;
6417 6417
 			if($this->getUseState())
6418 6418
 				$this->ensureTemplateDecoration();
6419 6419
 			else
6420
-				$this->_control->getPage()->onSaveStateComplete[] = array($this, 'ensureTemplateDecoration');
6420
+				$this->_control->getPage()->onSaveStateComplete[]=array($this, 'ensureTemplateDecoration');
6421 6421
 		}
6422 6422
 	}
6423 6423
 	public function ensureTemplateDecoration($sender=null, $param=null) {
6424
-		$control = $this->_control;
6425
-		$outercontrol = $this->_outercontrol;
6426
-		if($outercontrol === null)
6427
-			$outercontrol = $control;
6424
+		$control=$this->_control;
6425
+		$outercontrol=$this->_outercontrol;
6426
+		if($outercontrol===null)
6427
+			$outercontrol=$control;
6428 6428
 		if($this->_addedTemplateDecoration)
6429 6429
 			return $this->_addedTemplateDecoration;
6430
-		$this->_addedTemplateDecoration = true;
6430
+		$this->_addedTemplateDecoration=true;
6431 6431
 		if($this->getPreContentsTemplate())
6432 6432
 		{
6433
-			$precontents = Prado::createComponent('TCompositeControl');
6433
+			$precontents=Prado::createComponent('TCompositeControl');
6434 6434
 			$this->getPreContentsTemplate()->instantiateIn($precontents);
6435 6435
 			$control->getControls()->insertAt(0, $precontents);
6436 6436
 		}
6437 6437
 		if($this->getPostContentsTemplate())
6438 6438
 		{
6439
-			$postcontents = Prado::createComponent('TCompositeControl');
6439
+			$postcontents=Prado::createComponent('TCompositeControl');
6440 6440
 			$this->getPostContentsTemplate()->instantiateIn($postcontents);
6441 6441
 			$control->getControls()->add($postcontents);
6442 6442
 		}
@@ -6444,13 +6444,13 @@  discard block
 block discarded – undo
6444 6444
 			return $this->_addedTemplateDecoration;
6445 6445
 		if($this->getPreTagTemplate())
6446 6446
 		{
6447
-			$pretag = Prado::createComponent('TCompositeControl');
6447
+			$pretag=Prado::createComponent('TCompositeControl');
6448 6448
 			$this->getPreTagTemplate()->instantiateIn($pretag);
6449 6449
 			$outercontrol->getParent()->getControls()->insertBefore($outercontrol, $pretag);
6450 6450
 		}
6451 6451
 		if($this->getPostTagTemplate())
6452 6452
 		{
6453
-			$posttag = Prado::createComponent('TCompositeControl');
6453
+			$posttag=Prado::createComponent('TCompositeControl');
6454 6454
 			$this->getPostTagTemplate()->instantiateIn($posttag);
6455 6455
 			$outercontrol->getParent()->getControls()->insertAfter($outercontrol, $posttag);
6456 6456
 		}
@@ -6475,7 +6475,7 @@  discard block
 block discarded – undo
6475 6475
 	protected $_decorator;
6476 6476
 	public function setEnsureId($value)
6477 6477
 	{
6478
-		$this->_ensureid |= TPropertyValue::ensureBoolean($value);
6478
+		$this->_ensureid|=TPropertyValue::ensureBoolean($value);
6479 6479
 	}
6480 6480
 	public function getEnsureId()
6481 6481
 	{
@@ -6484,7 +6484,7 @@  discard block
 block discarded – undo
6484 6484
 	public function getDecorator($create=true)
6485 6485
 	{
6486 6486
 		if($create && !$this->_decorator)
6487
-			$this->_decorator = Prado::createComponent('TWebControlDecorator', $this);
6487
+			$this->_decorator=Prado::createComponent('TWebControlDecorator', $this);
6488 6488
 		return $this->_decorator;
6489 6489
 	}
6490 6490
 	public function copyBaseAttributes(TWebControl $control)
@@ -6499,17 +6499,17 @@  discard block
 block discarded – undo
6499 6499
 	}
6500 6500
 	public function getAccessKey()
6501 6501
 	{
6502
-		return $this->getViewState('AccessKey','');
6502
+		return $this->getViewState('AccessKey', '');
6503 6503
 	}
6504 6504
 	public function setAccessKey($value)
6505 6505
 	{
6506
-		if(strlen($value)>1)
6507
-			throw new TInvalidDataValueException('webcontrol_accesskey_invalid',get_class($this),$value);
6508
-		$this->setViewState('AccessKey',$value,'');
6506
+		if(strlen($value) > 1)
6507
+			throw new TInvalidDataValueException('webcontrol_accesskey_invalid', get_class($this), $value);
6508
+		$this->setViewState('AccessKey', $value, '');
6509 6509
 	}
6510 6510
 	public function getBackColor()
6511 6511
 	{
6512
-		if($style=$this->getViewState('Style',null))
6512
+		if($style=$this->getViewState('Style', null))
6513 6513
 			return $style->getBackColor();
6514 6514
 		else
6515 6515
 			return '';
@@ -6520,7 +6520,7 @@  discard block
 block discarded – undo
6520 6520
 	}
6521 6521
 	public function getBorderColor()
6522 6522
 	{
6523
-		if($style=$this->getViewState('Style',null))
6523
+		if($style=$this->getViewState('Style', null))
6524 6524
 			return $style->getBorderColor();
6525 6525
 		else
6526 6526
 			return '';
@@ -6531,7 +6531,7 @@  discard block
 block discarded – undo
6531 6531
 	}
6532 6532
 	public function getBorderStyle()
6533 6533
 	{
6534
-		if($style=$this->getViewState('Style',null))
6534
+		if($style=$this->getViewState('Style', null))
6535 6535
 			return $style->getBorderStyle();
6536 6536
 		else
6537 6537
 			return '';
@@ -6542,7 +6542,7 @@  discard block
 block discarded – undo
6542 6542
 	}
6543 6543
 	public function getBorderWidth()
6544 6544
 	{
6545
-		if($style=$this->getViewState('Style',null))
6545
+		if($style=$this->getViewState('Style', null))
6546 6546
 			return $style->getBorderWidth();
6547 6547
 		else
6548 6548
 			return '';
@@ -6557,7 +6557,7 @@  discard block
 block discarded – undo
6557 6557
 	}
6558 6558
 	public function getForeColor()
6559 6559
 	{
6560
-		if($style=$this->getViewState('Style',null))
6560
+		if($style=$this->getViewState('Style', null))
6561 6561
 			return $style->getForeColor();
6562 6562
 		else
6563 6563
 			return '';
@@ -6568,7 +6568,7 @@  discard block
 block discarded – undo
6568 6568
 	}
6569 6569
 	public function getHeight()
6570 6570
 	{
6571
-		if($style=$this->getViewState('Style',null))
6571
+		if($style=$this->getViewState('Style', null))
6572 6572
 			return $style->getHeight();
6573 6573
 		else
6574 6574
 			return '';
@@ -6587,7 +6587,7 @@  discard block
 block discarded – undo
6587 6587
 	}
6588 6588
 	public function getCssClass()
6589 6589
 	{
6590
-		if($style=$this->getViewState('Style',null))
6590
+		if($style=$this->getViewState('Style', null))
6591 6591
 			return $style->getCssClass();
6592 6592
 		else
6593 6593
 			return '';
@@ -6598,7 +6598,7 @@  discard block
 block discarded – undo
6598 6598
 	}
6599 6599
 	public function getHasStyle()
6600 6600
 	{
6601
-		return $this->getViewState('Style',null)!==null;
6601
+		return $this->getViewState('Style', null)!==null;
6602 6602
 	}
6603 6603
 	protected function createStyle()
6604 6604
 	{
@@ -6606,12 +6606,12 @@  discard block
 block discarded – undo
6606 6606
 	}
6607 6607
 	public function getStyle()
6608 6608
 	{
6609
-		if($style=$this->getViewState('Style',null))
6609
+		if($style=$this->getViewState('Style', null))
6610 6610
 			return $style;
6611 6611
 		else
6612 6612
 		{
6613 6613
 			$style=$this->createStyle();
6614
-			$this->setViewState('Style',$style,null);
6614
+			$this->setViewState('Style', $style, null);
6615 6615
 			return $style;
6616 6616
 		}
6617 6617
 	}
@@ -6620,7 +6620,7 @@  discard block
 block discarded – undo
6620 6620
 		if(is_string($value))
6621 6621
 			$this->getStyle()->setCustomStyle($value);
6622 6622
 		else
6623
-			throw new TInvalidDataValueException('webcontrol_style_invalid',get_class($this));
6623
+			throw new TInvalidDataValueException('webcontrol_style_invalid', get_class($this));
6624 6624
 	}
6625 6625
 	public function clearStyle()
6626 6626
 	{
@@ -6628,11 +6628,11 @@  discard block
 block discarded – undo
6628 6628
 	}
6629 6629
 	public function getTabIndex()
6630 6630
 	{
6631
-		return $this->getViewState('TabIndex',0);
6631
+		return $this->getViewState('TabIndex', 0);
6632 6632
 	}
6633 6633
 	public function setTabIndex($value)
6634 6634
 	{
6635
-		$this->setViewState('TabIndex',TPropertyValue::ensureInteger($value),0);
6635
+		$this->setViewState('TabIndex', TPropertyValue::ensureInteger($value), 0);
6636 6636
 	}
6637 6637
 	protected function getTagName()
6638 6638
 	{
@@ -6640,15 +6640,15 @@  discard block
 block discarded – undo
6640 6640
 	}
6641 6641
 	public function getToolTip()
6642 6642
 	{
6643
-		return $this->getViewState('ToolTip','');
6643
+		return $this->getViewState('ToolTip', '');
6644 6644
 	}
6645 6645
 	public function setToolTip($value)
6646 6646
 	{
6647
-		$this->setViewState('ToolTip',$value,'');
6647
+		$this->setViewState('ToolTip', $value, '');
6648 6648
 	}
6649 6649
 	public function getWidth()
6650 6650
 	{
6651
-		if($style=$this->getViewState('Style',null))
6651
+		if($style=$this->getViewState('Style', null))
6652 6652
 			return $style->getWidth();
6653 6653
 		else
6654 6654
 			return '';
@@ -6658,28 +6658,28 @@  discard block
 block discarded – undo
6658 6658
 		$this->getStyle()->setWidth($value);
6659 6659
 	}
6660 6660
 	public function onPreRender($param) {
6661
-		if($decorator = $this->getDecorator(false))
6661
+		if($decorator=$this->getDecorator(false))
6662 6662
 			$decorator->instantiate();
6663 6663
 		parent::onPreRender($param);
6664 6664
 	}
6665 6665
 	protected function addAttributesToRender($writer)
6666 6666
 	{
6667 6667
 		if($this->getID()!=='' || $this->getEnsureId())
6668
-			$writer->addAttribute('id',$this->getClientID());
6668
+			$writer->addAttribute('id', $this->getClientID());
6669 6669
 		if(($accessKey=$this->getAccessKey())!=='')
6670
-			$writer->addAttribute('accesskey',$accessKey);
6670
+			$writer->addAttribute('accesskey', $accessKey);
6671 6671
 		if(!$this->getEnabled())
6672
-			$writer->addAttribute('disabled','disabled');
6673
-		if(($tabIndex=$this->getTabIndex())>0)
6674
-			$writer->addAttribute('tabindex',"$tabIndex");
6672
+			$writer->addAttribute('disabled', 'disabled');
6673
+		if(($tabIndex=$this->getTabIndex()) > 0)
6674
+			$writer->addAttribute('tabindex', "$tabIndex");
6675 6675
 		if(($toolTip=$this->getToolTip())!=='')
6676
-			$writer->addAttribute('title',$toolTip);
6677
-		if($style=$this->getViewState('Style',null))
6676
+			$writer->addAttribute('title', $toolTip);
6677
+		if($style=$this->getViewState('Style', null))
6678 6678
 			$style->addAttributesToRender($writer);
6679 6679
 		if($this->getHasAttributes())
6680 6680
 		{
6681 6681
 			foreach($this->getAttributes() as $name=>$value)
6682
-				$writer->addAttribute($name,$value);
6682
+				$writer->addAttribute($name, $value);
6683 6683
 		}
6684 6684
 	}
6685 6685
 	public function render($writer)
@@ -6690,7 +6690,7 @@  discard block
 block discarded – undo
6690 6690
 	}
6691 6691
 	public function renderBeginTag($writer)
6692 6692
 	{
6693
-		if($decorator = $this->getDecorator(false)) {
6693
+		if($decorator=$this->getDecorator(false)) {
6694 6694
 			$decorator->renderPreTagText($writer);
6695 6695
 			$this->addAttributesToRender($writer);
6696 6696
 			$writer->renderBeginTag($this->getTagName());
@@ -6706,7 +6706,7 @@  discard block
 block discarded – undo
6706 6706
 	}
6707 6707
 	public function renderEndTag($writer)
6708 6708
 	{
6709
-		if($decorator = $this->getDecorator(false)) {
6709
+		if($decorator=$this->getDecorator(false)) {
6710 6710
 			$decorator->renderPostContentsText($writer);
6711 6711
 			$writer->renderEndTag();
6712 6712
 			$decorator->renderPostTagText($writer);
@@ -6773,24 +6773,24 @@  discard block
 block discarded – undo
6773 6773
 			foreach($tpl->getDirective() as $name=>$value)
6774 6774
 			{
6775 6775
 				if(is_string($value))
6776
-					$this->setSubProperty($name,$value);
6776
+					$this->setSubProperty($name, $value);
6777 6777
 				else
6778
-					throw new TConfigurationException('templatecontrol_directive_invalid',get_class($this),$name);
6778
+					throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name);
6779 6779
 			}
6780 6780
 			$tpl->instantiateIn($this);
6781 6781
 		}
6782 6782
 	}
6783
-	public function registerContent($id,TContent $object)
6783
+	public function registerContent($id, TContent $object)
6784 6784
 	{
6785 6785
 		if(isset($this->_contents[$id]))
6786
-			throw new TConfigurationException('templatecontrol_contentid_duplicated',$id);
6786
+			throw new TConfigurationException('templatecontrol_contentid_duplicated', $id);
6787 6787
 		else
6788 6788
 			$this->_contents[$id]=$object;
6789 6789
 	}
6790
-	public function registerContentPlaceHolder($id,TContentPlaceHolder $object)
6790
+	public function registerContentPlaceHolder($id, TContentPlaceHolder $object)
6791 6791
 	{
6792 6792
 		if(isset($this->_placeholders[$id]))
6793
-			throw new TConfigurationException('templatecontrol_placeholderid_duplicated',$id);
6793
+			throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id);
6794 6794
 		else
6795 6795
 			$this->_placeholders[$id]=$object;
6796 6796
 	}
@@ -6806,17 +6806,17 @@  discard block
 block discarded – undo
6806 6806
 	{
6807 6807
 		return $this->_master;
6808 6808
 	}
6809
-	public function injectContent($id,$content)
6809
+	public function injectContent($id, $content)
6810 6810
 	{
6811 6811
 		if(isset($this->_placeholders[$id]))
6812 6812
 		{
6813 6813
 			$placeholder=$this->_placeholders[$id];
6814 6814
 			$controls=$placeholder->getParent()->getControls();
6815 6815
 			$loc=$controls->remove($placeholder);
6816
-			$controls->insertAt($loc,$content);
6816
+			$controls->insertAt($loc, $content);
6817 6817
 		}
6818 6818
 		else
6819
-			throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id);
6819
+			throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id);
6820 6820
 	}
6821 6821
 	protected function initRecursive($namingContainer=null)
6822 6822
 	{
@@ -6831,44 +6831,44 @@  discard block
 block discarded – undo
6831 6831
 			$this->getControls()->add($master);
6832 6832
 			$master->ensureChildControls();
6833 6833
 			foreach($this->_contents as $id=>$content)
6834
-				$master->injectContent($id,$content);
6834
+				$master->injectContent($id, $content);
6835 6835
 		}
6836 6836
 		else if(!empty($this->_contents))
6837
-			throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this));
6837
+			throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this));
6838 6838
 		parent::initRecursive($namingContainer);
6839 6839
 	}
6840
-        public function tryToUpdateView($arObj, $throwExceptions = false)
6840
+        public function tryToUpdateView($arObj, $throwExceptions=false)
6841 6841
         {
6842
-                $objAttrs = get_class_vars(get_class($arObj));
6843
-                foreach (array_keys($objAttrs) as $key)
6842
+                $objAttrs=get_class_vars(get_class($arObj));
6843
+                foreach(array_keys($objAttrs) as $key)
6844 6844
                 {
6845 6845
                         try
6846 6846
                         {
6847
-                                if ($key != "RELATIONS")
6847
+                                if($key!="RELATIONS")
6848 6848
                                 {
6849
-                                        $control = $this->{$key};
6850
-                                        if ($control instanceof TTextBox)
6851
-                                                $control->Text = $arObj->{$key};
6852
-                                        elseif ($control instanceof TCheckBox)
6853
-                                                $control->Checked = (boolean) $arObj->{$key};
6854
-                                        elseif ($control instanceof TDatePicker)
6855
-                                                $control->Date = $arObj->{$key};
6849
+                                        $control=$this->{$key};
6850
+                                        if($control instanceof TTextBox)
6851
+                                                $control->Text=$arObj->{$key};
6852
+                                        elseif($control instanceof TCheckBox)
6853
+                                                $control->Checked=(boolean) $arObj->{$key};
6854
+                                        elseif($control instanceof TDatePicker)
6855
+                                                $control->Date=$arObj->{$key};
6856 6856
                                 }
6857 6857
                                 else
6858 6858
                                 {
6859
-                                        foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
6859
+                                        foreach($objAttrs["RELATIONS"] as $relKey => $relValues)
6860 6860
                                         {
6861
-                                                $relControl = $this->{$relKey};
6862
-                                                switch ($relValues[0])
6861
+                                                $relControl=$this->{$relKey};
6862
+                                                switch($relValues[0])
6863 6863
                                                 {
6864 6864
                                                         case TActiveRecord::BELONGS_TO:
6865 6865
                                                         case TActiveRecord::HAS_ONE:
6866
-                                                                $relControl->Text = $arObj->{$relKey};
6866
+                                                                $relControl->Text=$arObj->{$relKey};
6867 6867
                                                                 break;
6868 6868
                                                         case TActiveRecord::HAS_MANY:
6869
-                                                                if ($relControl instanceof TListControl)
6869
+                                                                if($relControl instanceof TListControl)
6870 6870
                                                                 {
6871
-                                                                        $relControl->DataSource = $arObj->{$relKey};
6871
+                                                                        $relControl->DataSource=$arObj->{$relKey};
6872 6872
                                                                         $relControl->dataBind();
6873 6873
                                                                 }
6874 6874
                                                                 break;
@@ -6877,33 +6877,33 @@  discard block
 block discarded – undo
6877 6877
                                         break;
6878 6878
                                 }
6879 6879
                         } 
6880
-                        catch (Exception $ex)
6880
+                        catch(Exception $ex)
6881 6881
                         {
6882
-                                if ($throwExceptions)
6882
+                                if($throwExceptions)
6883 6883
                                         throw $ex;
6884 6884
                         }
6885 6885
                 }
6886 6886
         }
6887
-        public function tryToUpdateAR($arObj, $throwExceptions = false)
6887
+        public function tryToUpdateAR($arObj, $throwExceptions=false)
6888 6888
         {
6889
-                $objAttrs = get_class_vars(get_class($arObj));
6890
-                foreach (array_keys($objAttrs) as $key)
6889
+                $objAttrs=get_class_vars(get_class($arObj));
6890
+                foreach(array_keys($objAttrs) as $key)
6891 6891
                 {
6892 6892
                         try
6893 6893
                         {
6894
-                                if ($key == "RELATIONS")
6894
+                                if($key=="RELATIONS")
6895 6895
                                         break;
6896
-                                $control = $this->{$key};
6897
-                                if ($control instanceof TTextBox)
6898
-                                        $arObj->{$key} = $control->Text;
6899
-                                elseif ($control instanceof TCheckBox)
6900
-                                        $arObj->{$key} = $control->Checked;
6901
-                                elseif ($control instanceof TDatePicker)
6902
-                                        $arObj->{$key} = $control->Date;
6896
+                                $control=$this->{$key};
6897
+                                if($control instanceof TTextBox)
6898
+                                        $arObj->{$key}=$control->Text;
6899
+                                elseif($control instanceof TCheckBox)
6900
+                                        $arObj->{$key}=$control->Checked;
6901
+                                elseif($control instanceof TDatePicker)
6902
+                                        $arObj->{$key}=$control->Date;
6903 6903
                         } 
6904
-                        catch (Exception $ex)
6904
+                        catch(Exception $ex)
6905 6905
                         {
6906
-                                if ($throwExceptions)
6906
+                                if($throwExceptions)
6907 6907
                                         throw $ex;
6908 6908
                         }
6909 6909
                 }
@@ -6918,12 +6918,12 @@  discard block
 block discarded – undo
6918 6918
 	}
6919 6919
 	protected function addAttributesToRender($writer)
6920 6920
 	{
6921
-		$writer->addAttribute('id',$this->getClientID());
6922
-		$writer->addAttribute('method',$this->getMethod());
6921
+		$writer->addAttribute('id', $this->getClientID());
6922
+		$writer->addAttribute('method', $this->getMethod());
6923 6923
 		$uri=$this->getRequest()->getRequestURI();
6924
-		$writer->addAttribute('action',str_replace('&','&amp;',str_replace('&amp;','&',$uri)));
6924
+		$writer->addAttribute('action', str_replace('&', '&amp;', str_replace('&amp;', '&', $uri)));
6925 6925
 		if(($enctype=$this->getEnctype())!=='')
6926
-			$writer->addAttribute('enctype',$enctype);
6926
+			$writer->addAttribute('enctype', $enctype);
6927 6927
 		$attributes=$this->getAttributes();
6928 6928
 		$attributes->remove('action');
6929 6929
 		$writer->addAttributes($attributes);
@@ -6932,7 +6932,7 @@  discard block
 block discarded – undo
6932 6932
 			if(($button=$this->findControl($butt))!==null)
6933 6933
 				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
6934 6934
 			else
6935
-				throw new TInvalidDataValueException('form_defaultbutton_invalid',$butt);
6935
+				throw new TInvalidDataValueException('form_defaultbutton_invalid', $butt);
6936 6936
 		}
6937 6937
 	}
6938 6938
 	public function render($writer)
@@ -6965,27 +6965,27 @@  discard block
 block discarded – undo
6965 6965
 	}
6966 6966
 	public function getDefaultButton()
6967 6967
 	{
6968
-		return $this->getViewState('DefaultButton','');
6968
+		return $this->getViewState('DefaultButton', '');
6969 6969
 	}
6970 6970
 	public function setDefaultButton($value)
6971 6971
 	{
6972
-		$this->setViewState('DefaultButton',$value,'');
6972
+		$this->setViewState('DefaultButton', $value, '');
6973 6973
 	}
6974 6974
 	public function getMethod()
6975 6975
 	{
6976
-		return $this->getViewState('Method','post');
6976
+		return $this->getViewState('Method', 'post');
6977 6977
 	}
6978 6978
 	public function setMethod($value)
6979 6979
 	{
6980
-		$this->setViewState('Method',TPropertyValue::ensureEnum($value,'post','get'),'post');
6980
+		$this->setViewState('Method', TPropertyValue::ensureEnum($value, 'post', 'get'), 'post');
6981 6981
 	}
6982 6982
 	public function getEnctype()
6983 6983
 	{
6984
-		return $this->getViewState('Enctype','');
6984
+		return $this->getViewState('Enctype', '');
6985 6985
 	}
6986 6986
 	public function setEnctype($value)
6987 6987
 	{
6988
-		$this->setViewState('Enctype',$value,'');
6988
+		$this->setViewState('Enctype', $value, '');
6989 6989
 	}
6990 6990
 	public function getName()
6991 6991
 	{
@@ -7032,43 +7032,43 @@  discard block
 block discarded – undo
7032 7032
 	{
7033 7033
 		$this->registerPradoScriptInternal($name);
7034 7034
 		$params=func_get_args();
7035
-		$this->_page->registerCachingAction('Page.ClientScript','registerPradoScript',$params);
7035
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerPradoScript', $params);
7036 7036
 	}
7037 7037
 	protected function registerPradoScriptInternal($name)
7038 7038
 	{
7039 7039
 				if(!isset($this->_registeredPradoScripts[$name]))
7040 7040
 		{
7041
-			if(self::$_pradoScripts === null)
7041
+			if(self::$_pradoScripts===null)
7042 7042
 			{
7043
-				$packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::PACKAGES_FILE;
7044
-				list($packages,$deps)= include($packageFile);
7045
-				self::$_pradoScripts = $deps;
7046
-				self::$_pradoPackages = $packages;
7043
+				$packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::PACKAGES_FILE;
7044
+				list($packages, $deps)=include($packageFile);
7045
+				self::$_pradoScripts=$deps;
7046
+				self::$_pradoPackages=$packages;
7047 7047
 			}
7048
-			if (isset(self::$_pradoScripts[$name]))
7048
+			if(isset(self::$_pradoScripts[$name]))
7049 7049
 				$this->_registeredPradoScripts[$name]=true;
7050 7050
 			else
7051
-				throw new TInvalidOperationException('csmanager_pradoscript_invalid',$name);
7051
+				throw new TInvalidOperationException('csmanager_pradoscript_invalid', $name);
7052 7052
 			if(($packages=array_keys($this->_registeredPradoScripts))!==array())
7053 7053
 			{
7054
-				$base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7055
-				list($path,$baseUrl)=$this->getPackagePathUrl($base);
7054
+				$base=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7055
+				list($path, $baseUrl)=$this->getPackagePathUrl($base);
7056 7056
 				$packagesUrl=array();
7057 7057
 				$isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug;
7058
-				foreach ($packages as $p)
7058
+				foreach($packages as $p)
7059 7059
 				{
7060
-					foreach (self::$_pradoScripts[$p] as $dep)
7060
+					foreach(self::$_pradoScripts[$p] as $dep)
7061 7061
 					{
7062
-						foreach (self::$_pradoPackages[$dep] as $script)
7063
-						if (!isset($this->_expandedPradoScripts[$script]))
7062
+						foreach(self::$_pradoPackages[$dep] as $script)
7063
+						if(!isset($this->_expandedPradoScripts[$script]))
7064 7064
 						{
7065
-							$this->_expandedPradoScripts[$script] = true;
7065
+							$this->_expandedPradoScripts[$script]=true;
7066 7066
 							if($isDebug)
7067 7067
 							{
7068
-								if (!in_array($url=$baseUrl.'/'.$script,$packagesUrl))
7068
+								if(!in_array($url=$baseUrl.'/'.$script, $packagesUrl))
7069 7069
 									$packagesUrl[]=$url;
7070 7070
 							} else {
7071
-								if (!in_array($url=$baseUrl.'/min/'.$script,$packagesUrl))
7071
+								if(!in_array($url=$baseUrl.'/min/'.$script, $packagesUrl))
7072 7072
 								{
7073 7073
 									if(!is_file($filePath=$path.'/min/'.$script))
7074 7074
 									{
@@ -7085,47 +7085,47 @@  discard block
 block discarded – undo
7085 7085
 					}
7086 7086
 				}
7087 7087
 				foreach($packagesUrl as $url)
7088
-					$this->registerScriptFile($url,$url);
7088
+					$this->registerScriptFile($url, $url);
7089 7089
 			}
7090 7090
 		}
7091 7091
 	}
7092 7092
 	public function getPradoScriptAssetUrl()
7093 7093
 	{
7094
-		$base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7095
-		$assets = Prado::getApplication()->getAssetManager();
7094
+		$base=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7095
+		$assets=Prado::getApplication()->getAssetManager();
7096 7096
 		return $assets->getPublishedUrl($base);
7097 7097
 	}
7098 7098
 	public function getScriptUrls()
7099 7099
 	{
7100
-		$scripts = array_values($this->_headScriptFiles);
7101
-		$scripts = array_merge($scripts, array_values($this->_scriptFiles));
7102
-		$scripts = array_unique($scripts);
7100
+		$scripts=array_values($this->_headScriptFiles);
7101
+		$scripts=array_merge($scripts, array_values($this->_scriptFiles));
7102
+		$scripts=array_unique($scripts);
7103 7103
 		return $scripts;
7104 7104
 	}
7105 7105
 	protected function getPackagePathUrl($base)
7106 7106
 	{
7107
-		$assets = Prado::getApplication()->getAssetManager();
7107
+		$assets=Prado::getApplication()->getAssetManager();
7108 7108
 		if(strpos($base, $assets->getBaseUrl())===false)
7109 7109
 		{
7110
-			if(($dir = Prado::getPathOfNameSpace($base)) !== null) {
7111
-				$base = $dir;
7110
+			if(($dir=Prado::getPathOfNameSpace($base))!==null) {
7111
+				$base=$dir;
7112 7112
 			}
7113 7113
 			return array($assets->getPublishedPath($base), $assets->publishFilePath($base));
7114 7114
 		}
7115 7115
 		else
7116 7116
 		{
7117
-			return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base);
7117
+			return array($assets->getBasePath().str_replace($assets->getBaseUrl(), '', $base), $base);
7118 7118
 		}
7119 7119
 	}
7120 7120
 	public function getCallbackReference(ICallbackEventHandler $callbackHandler, $options=null)
7121 7121
 	{
7122
-		$options = !is_array($options) ? array() : $options;
7123
-		$class = new ReflectionClass($callbackHandler);
7124
-		$clientSide = $callbackHandler->getActiveControl()->getClientSide();
7125
-		$options = array_merge($options, $clientSide->getOptions()->toArray());
7126
-		$optionString = TJavaScript::encode($options);
7122
+		$options=!is_array($options) ? array() : $options;
7123
+		$class=new ReflectionClass($callbackHandler);
7124
+		$clientSide=$callbackHandler->getActiveControl()->getClientSide();
7125
+		$options=array_merge($options, $clientSide->getOptions()->toArray());
7126
+		$optionString=TJavaScript::encode($options);
7127 7127
 		$this->registerPradoScriptInternal('ajax');
7128
-		$id = $callbackHandler->getUniqueID();
7128
+		$id=$callbackHandler->getUniqueID();
7129 7129
 		return "new Prado.CallbackRequest('{$id}',{$optionString})";
7130 7130
 	}
7131 7131
 	public function registerCallbackControl($class, $options)
@@ -7135,11 +7135,11 @@  discard block
 block discarded – undo
7135 7135
 		$this->_endScripts[sprintf('%08X', crc32($code))]=$code;
7136 7136
 		$this->registerPradoScriptInternal('ajax');
7137 7137
 		$params=func_get_args();
7138
-		$this->_page->registerCachingAction('Page.ClientScript','registerCallbackControl',$params);
7138
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerCallbackControl', $params);
7139 7139
 	}
7140
-	public function registerPostBackControl($class,$options)
7140
+	public function registerPostBackControl($class, $options)
7141 7141
 	{
7142
-		if($class === null) {
7142
+		if($class===null) {
7143 7143
 			return;
7144 7144
 		}
7145 7145
 		if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null)
@@ -7149,11 +7149,11 @@  discard block
 block discarded – undo
7149 7149
 		$this->_endScripts[sprintf('%08X', crc32($code))]=$code;
7150 7150
 		$this->registerPradoScriptInternal('prado');
7151 7151
 		$params=func_get_args();
7152
-		$this->_page->registerCachingAction('Page.ClientScript','registerPostBackControl',$params);
7152
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerPostBackControl', $params);
7153 7153
 	}
7154 7154
 	public function registerDefaultButton($panel, $button)
7155 7155
 	{
7156
-		$panelID=is_string($panel)?$panel:$panel->getUniqueID();
7156
+		$panelID=is_string($panel) ? $panel : $panel->getUniqueID();
7157 7157
 		if(is_string($button))
7158 7158
 			$buttonID=$button;
7159 7159
 		else
@@ -7161,20 +7161,20 @@  discard block
 block discarded – undo
7161 7161
 			$button->setIsDefaultButton(true);
7162 7162
 			$buttonID=$button->getUniqueID();
7163 7163
 		}
7164
-		$options = TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID));
7165
-		$code = "new Prado.WebUI.DefaultButton($options);";
7164
+		$options=TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID));
7165
+		$code="new Prado.WebUI.DefaultButton($options);";
7166 7166
 		$this->_endScripts['prado:'.$panelID]=$code;
7167 7167
 		$this->registerPradoScriptInternal('prado');
7168
-		$params=array($panelID,$buttonID);
7169
-		$this->_page->registerCachingAction('Page.ClientScript','registerDefaultButton',$params);
7168
+		$params=array($panelID, $buttonID);
7169
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerDefaultButton', $params);
7170 7170
 	}
7171 7171
 	protected function getDefaultButtonOptions($panelID, $buttonID)
7172 7172
 	{
7173
-		$options['ID'] = TControl::convertUniqueIdToClientId($panelID);
7174
-		$options['Panel'] = TControl::convertUniqueIdToClientId($panelID);
7175
-		$options['Target'] = TControl::convertUniqueIdToClientId($buttonID);
7176
-		$options['EventTarget'] = $buttonID;
7177
-		$options['Event'] = 'click';
7173
+		$options['ID']=TControl::convertUniqueIdToClientId($panelID);
7174
+		$options['Panel']=TControl::convertUniqueIdToClientId($panelID);
7175
+		$options['Target']=TControl::convertUniqueIdToClientId($buttonID);
7176
+		$options['EventTarget']=$buttonID;
7177
+		$options['Event']='click';
7178 7178
 		return $options;
7179 7179
 	}
7180 7180
 	public function registerFocusControl($target)
@@ -7182,80 +7182,80 @@  discard block
 block discarded – undo
7182 7182
 		$this->registerPradoScriptInternal('jquery');
7183 7183
 		if($target instanceof TControl)
7184 7184
 			$target=$target->getClientID();
7185
-		$this->_endScripts['prado:focus'] = 'jQuery(\'#'.$target.'\').focus();';
7185
+		$this->_endScripts['prado:focus']='jQuery(\'#'.$target.'\').focus();';
7186 7186
 		$params=func_get_args();
7187
-		$this->_page->registerCachingAction('Page.ClientScript','registerFocusControl',$params);
7187
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerFocusControl', $params);
7188 7188
 	}
7189
-	public function registerStyleSheetFile($key,$url,$media='')
7189
+	public function registerStyleSheetFile($key, $url, $media='')
7190 7190
 	{
7191 7191
 		if($media==='')
7192 7192
 			$this->_styleSheetFiles[$key]=$url;
7193 7193
 		else
7194
-			$this->_styleSheetFiles[$key]=array($url,$media);
7194
+			$this->_styleSheetFiles[$key]=array($url, $media);
7195 7195
 		$params=func_get_args();
7196
-		$this->_page->registerCachingAction('Page.ClientScript','registerStyleSheetFile',$params);
7196
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheetFile', $params);
7197 7197
 	}
7198
-	public function registerStyleSheet($key,$css,$media='')
7198
+	public function registerStyleSheet($key, $css, $media='')
7199 7199
 	{
7200 7200
 		$this->_styleSheets[$key]=$css;
7201 7201
 		$params=func_get_args();
7202
-		$this->_page->registerCachingAction('Page.ClientScript','registerStyleSheet',$params);
7202
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheet', $params);
7203 7203
 	}
7204 7204
 	public function getStyleSheetUrls()
7205 7205
 	{
7206
-		$stylesheets = array_values(
7206
+		$stylesheets=array_values(
7207 7207
 			array_map(function($e) {
7208 7208
 				return is_array($e) ? $e[0] : $e;
7209 7209
 			}, $this->_styleSheetFiles)
7210 7210
 		);
7211 7211
 		foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url)
7212
-			if (substr($url,strlen($url)-4)=='.css')
7213
-				$stylesheets[] = $url;
7214
-		$stylesheets = array_unique($stylesheets);
7212
+			if(substr($url, strlen($url) - 4)=='.css')
7213
+				$stylesheets[]=$url;
7214
+		$stylesheets=array_unique($stylesheets);
7215 7215
 		return $stylesheets;
7216 7216
 	}
7217 7217
 	public function getStyleSheetCodes()
7218 7218
 	{
7219 7219
 		return array_unique(array_values($this->_styleSheets));
7220 7220
 	}
7221
-	public function registerHeadScriptFile($key,$url)
7221
+	public function registerHeadScriptFile($key, $url)
7222 7222
 	{
7223 7223
 		$this->checkIfNotInRender();
7224 7224
 		$this->_headScriptFiles[$key]=$url;
7225 7225
 		$params=func_get_args();
7226
-		$this->_page->registerCachingAction('Page.ClientScript','registerHeadScriptFile',$params);
7226
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScriptFile', $params);
7227 7227
 	}
7228
-	public function registerHeadScript($key,$script)
7228
+	public function registerHeadScript($key, $script)
7229 7229
 	{
7230 7230
 		$this->checkIfNotInRender();
7231 7231
 		$this->_headScripts[$key]=$script;
7232 7232
 		$params=func_get_args();
7233
-		$this->_page->registerCachingAction('Page.ClientScript','registerHeadScript',$params);
7233
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScript', $params);
7234 7234
 	}
7235 7235
 	public function registerScriptFile($key, $url)
7236 7236
 	{
7237 7237
 		$this->_scriptFiles[$key]=$url;
7238 7238
 		$params=func_get_args();
7239
-		$this->_page->registerCachingAction('Page.ClientScript','registerScriptFile',$params);
7239
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerScriptFile', $params);
7240 7240
 	}
7241
-	public function registerBeginScript($key,$script)
7241
+	public function registerBeginScript($key, $script)
7242 7242
 	{
7243 7243
 		$this->checkIfNotInRender();
7244 7244
 		$this->_beginScripts[$key]=$script;
7245 7245
 		$params=func_get_args();
7246
-		$this->_page->registerCachingAction('Page.ClientScript','registerBeginScript',$params);
7246
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerBeginScript', $params);
7247 7247
 	}
7248
-	public function registerEndScript($key,$script)
7248
+	public function registerEndScript($key, $script)
7249 7249
 	{
7250 7250
 		$this->_endScripts[$key]=$script;
7251 7251
 		$params=func_get_args();
7252
-		$this->_page->registerCachingAction('Page.ClientScript','registerEndScript',$params);
7252
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerEndScript', $params);
7253 7253
 	}
7254
-	public function registerHiddenField($name,$value)
7254
+	public function registerHiddenField($name, $value)
7255 7255
 	{
7256 7256
 		$this->_hiddenFields[$name]=$value;
7257 7257
 		$params=func_get_args();
7258
-		$this->_page->registerCachingAction('Page.ClientScript','registerHiddenField',$params);
7258
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerHiddenField', $params);
7259 7259
 	}
7260 7260
 	public function isStyleSheetFileRegistered($key)
7261 7261
 	{
@@ -7312,11 +7312,11 @@  discard block
 block discarded – undo
7312 7312
 	public function renderStyleSheets($writer)
7313 7313
 	{
7314 7314
 		if(count($this->_styleSheets))
7315
-			$writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n",$this->_styleSheets)."\n/*]]>*/\n</style>\n");
7315
+			$writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n", $this->_styleSheets)."\n/*]]>*/\n</style>\n");
7316 7316
 	}
7317 7317
 	public function renderHeadScriptFiles($writer)
7318 7318
 	{
7319
-		$this->renderScriptFiles($writer,$this->_headScriptFiles);
7319
+		$this->renderScriptFiles($writer, $this->_headScriptFiles);
7320 7320
 	}
7321 7321
 	public function renderHeadScripts($writer)
7322 7322
 	{
@@ -7332,9 +7332,9 @@  discard block
 block discarded – undo
7332 7332
 	}
7333 7333
 	public function markScriptFileAsRendered($url)
7334 7334
 	{
7335
-		$this->_renderedScriptFiles[$url] = $url;
7335
+		$this->_renderedScriptFiles[$url]=$url;
7336 7336
 		$params=func_get_args();
7337
-		$this->_page->registerCachingAction('Page.ClientScript','markScriptFileAsRendered',$params);
7337
+		$this->_page->registerCachingAction('Page.ClientScript', 'markScriptFileAsRendered', $params);
7338 7338
 	}
7339 7339
 	protected function renderScriptFiles($writer, Array $scripts)
7340 7340
 	{
@@ -7352,8 +7352,8 @@  discard block
 block discarded – undo
7352 7352
 	{
7353 7353
 		if(!empty($this->_scriptFiles))
7354 7354
 		{
7355
-			$addedScripts = array_diff($this->_scriptFiles,$this->getRenderedScriptFiles());
7356
-			$this->renderScriptFiles($writer,$addedScripts);
7355
+			$addedScripts=array_diff($this->_scriptFiles, $this->getRenderedScriptFiles());
7356
+			$this->renderScriptFiles($writer, $addedScripts);
7357 7357
 		}
7358 7358
 	}
7359 7359
 	public function renderBeginScripts($writer)
@@ -7374,11 +7374,11 @@  discard block
 block discarded – undo
7374 7374
 	}
7375 7375
 	public function renderHiddenFieldsBegin($writer)
7376 7376
 	{
7377
-		$this->renderHiddenFieldsInt($writer,true);
7377
+		$this->renderHiddenFieldsInt($writer, true);
7378 7378
 	}
7379 7379
 	public function renderHiddenFieldsEnd($writer)
7380 7380
 	{
7381
-		$this->renderHiddenFieldsInt($writer,false);
7381
+		$this->renderHiddenFieldsInt($writer, false);
7382 7382
 	}
7383 7383
 	public function flushScriptFiles($writer, $control=null)
7384 7384
 	{
@@ -7390,12 +7390,12 @@  discard block
 block discarded – undo
7390 7390
 	}
7391 7391
 	protected function renderHiddenFieldsInt($writer, $initial)
7392 7392
  	{
7393
-		if ($initial) $this->_renderedHiddenFields = array();
7393
+		if($initial) $this->_renderedHiddenFields=array();
7394 7394
 		$str='';
7395 7395
 		foreach($this->_hiddenFields as $name=>$value)
7396 7396
 		{
7397
-			if (in_array($name,$this->_renderedHiddenFields)) continue;
7398
-			$id=strtr($name,':','_');
7397
+			if(in_array($name, $this->_renderedHiddenFields)) continue;
7398
+			$id=strtr($name, ':', '_');
7399 7399
 			if(is_array($value))
7400 7400
 			{
7401 7401
 				foreach($value as $v)
@@ -7405,7 +7405,7 @@  discard block
 block discarded – undo
7405 7405
 			{
7406 7406
 				$str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n";
7407 7407
 			}
7408
-			$this->_renderedHiddenFields[] = $name;
7408
+			$this->_renderedHiddenFields[]=$name;
7409 7409
 		}
7410 7410
 		if($str!=='')
7411 7411
 			$writer->write("<div style=\"visibility:hidden;\">\n".$str."</div>\n");
@@ -7416,7 +7416,7 @@  discard block
 block discarded – undo
7416 7416
 	}
7417 7417
 	protected function checkIfNotInRender()
7418 7418
 	{
7419
-		if ($form = $this->_page->InFormRender)
7419
+		if($form=$this->_page->InFormRender)
7420 7420
 			throw new Exception('Operation invalid when page is already rendering');
7421 7421
 	}
7422 7422
 }
@@ -7426,12 +7426,12 @@  discard block
 block discarded – undo
7426 7426
 	protected function setFunction($name, $code)
7427 7427
 	{
7428 7428
 		if(!TJavaScript::isJsLiteral($code))
7429
-			$code = TJavaScript::quoteJsLiteral($this->ensureFunction($code));
7429
+			$code=TJavaScript::quoteJsLiteral($this->ensureFunction($code));
7430 7430
 		$this->setOption($name, $code);
7431 7431
 	}
7432 7432
 	protected function getOption($name)
7433 7433
 	{
7434
-		if ($this->_options)
7434
+		if($this->_options)
7435 7435
 			return $this->_options->itemAt($name);
7436 7436
 		else
7437 7437
 			return null;
@@ -7442,8 +7442,8 @@  discard block
 block discarded – undo
7442 7442
 	}
7443 7443
 	public function getOptions()
7444 7444
 	{
7445
-		if (!$this->_options)
7446
-			$this->_options = Prado::createComponent('System.Collections.TMap');
7445
+		if(!$this->_options)
7446
+			$this->_options=Prado::createComponent('System.Collections.TMap');
7447 7447
 		return $this->_options;
7448 7448
 	}
7449 7449
 	protected function ensureFunction($javascript)
@@ -7502,7 +7502,7 @@  discard block
 block discarded – undo
7502 7502
 	}
7503 7503
 	public function run($writer)
7504 7504
 	{
7505
-		$this->_writer = $writer;
7505
+		$this->_writer=$writer;
7506 7506
 		$this->determinePostBackMode();
7507 7507
 		if($this->getIsPostBack())
7508 7508
 		{
@@ -7513,7 +7513,7 @@  discard block
 block discarded – undo
7513 7513
 		}
7514 7514
 		else
7515 7515
 			$this->processNormalRequest($writer);
7516
-		$this->_writer = null;
7516
+		$this->_writer=null;
7517 7517
 	}
7518 7518
 	protected function processNormalRequest($writer)
7519 7519
 	{
@@ -7537,10 +7537,10 @@  discard block
 block discarded – undo
7537 7537
 		$this->onInitComplete(null);
7538 7538
 		$this->_restPostData=new TMap;
7539 7539
 		$this->loadPageState();
7540
-		$this->processPostData($this->_postData,true);
7540
+		$this->processPostData($this->_postData, true);
7541 7541
 		$this->onPreLoad(null);
7542 7542
 		$this->loadRecursive();
7543
-		$this->processPostData($this->_restPostData,false);
7543
+		$this->processPostData($this->_restPostData, false);
7544 7544
 		$this->raiseChangedEvents();
7545 7545
 		$this->raisePostBackEvent();
7546 7546
 		$this->onLoadComplete(null);
@@ -7559,7 +7559,7 @@  discard block
 block discarded – undo
7559 7559
 				$data[$k]=self::decodeUTF8($v, $enc);
7560 7560
 			return $data;
7561 7561
 		} elseif(is_string($data)) {
7562
-			return iconv('UTF-8',$enc.'//IGNORE',$data);
7562
+			return iconv('UTF-8', $enc.'//IGNORE', $data);
7563 7563
 		} else {
7564 7564
 			return $data;
7565 7565
 		}
@@ -7569,22 +7569,22 @@  discard block
 block discarded – undo
7569 7569
 		Prado::using('System.Web.UI.ActiveControls.TActivePageAdapter');
7570 7570
 		Prado::using('System.Web.UI.JuiControls.TJuiControlOptions');
7571 7571
 		$this->setAdapter(new TActivePageAdapter($this));
7572
-        $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER);
7572
+        $callbackEventParameter=$this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER);
7573 7573
         if(strlen($callbackEventParameter) > 0)
7574
-            $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter);
7575
-                if (($g=$this->getApplication()->getGlobalization(false))!==null &&
7574
+            $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string) $callbackEventParameter);
7575
+                if(($g=$this->getApplication()->getGlobalization(false))!==null &&
7576 7576
             strtoupper($enc=$g->getCharset())!='UTF-8')
7577
-                foreach ($this->_postData as $k=>$v)
7577
+                foreach($this->_postData as $k=>$v)
7578 7578
                 	$this->_postData[$k]=self::decodeUTF8($v, $enc);
7579 7579
 		$this->onPreInit(null);
7580 7580
 		$this->initRecursive();
7581 7581
 		$this->onInitComplete(null);
7582 7582
 		$this->_restPostData=new TMap;
7583 7583
 		$this->loadPageState();
7584
-		$this->processPostData($this->_postData,true);
7584
+		$this->processPostData($this->_postData, true);
7585 7585
 		$this->onPreLoad(null);
7586 7586
 		$this->loadRecursive();
7587
-		$this->processPostData($this->_restPostData,false);
7587
+		$this->processPostData($this->_restPostData, false);
7588 7588
 		$this->raiseChangedEvents();
7589 7589
 		$this->getAdapter()->processCallbackEvent($writer);
7590 7590
 		$this->onLoadComplete(null);
@@ -7597,7 +7597,7 @@  discard block
 block discarded – undo
7597 7597
 	}
7598 7598
 	public function getCallbackClient()
7599 7599
 	{
7600
-		if($this->getAdapter() !== null)
7600
+		if($this->getAdapter()!==null)
7601 7601
 			return $this->getAdapter()->getCallbackClientHandler();
7602 7602
 		else
7603 7603
 			return new TCallbackClientScript();
@@ -7637,7 +7637,7 @@  discard block
 block discarded – undo
7637 7637
 	{
7638 7638
 		if(!$this->_validators)
7639 7639
 			$this->_validators=new TList;
7640
-		if(empty($validationGroup) === true)
7640
+		if(empty($validationGroup)===true)
7641 7641
 			return $this->_validators;
7642 7642
 		else
7643 7643
 		{
@@ -7691,7 +7691,7 @@  discard block
 block discarded – undo
7691 7691
 	}
7692 7692
 	public function setTheme($value)
7693 7693
 	{
7694
-		$this->_theme=empty($value)?null:$value;
7694
+		$this->_theme=empty($value) ? null : $value;
7695 7695
 	}
7696 7696
 	public function getStyleSheetTheme()
7697 7697
 	{
@@ -7701,7 +7701,7 @@  discard block
 block discarded – undo
7701 7701
 	}
7702 7702
 	public function setStyleSheetTheme($value)
7703 7703
 	{
7704
-		$this->_styleSheet=empty($value)?null:$value;
7704
+		$this->_styleSheet=empty($value) ? null : $value;
7705 7705
 	}
7706 7706
 	public function applyControlSkin($control)
7707 7707
 	{
@@ -7716,66 +7716,66 @@  discard block
 block discarded – undo
7716 7716
 	public function getClientScript()
7717 7717
 	{
7718 7718
 		if(!$this->_clientScript) {
7719
-			$className = $classPath = $this->getService()->getClientScriptManagerClass();
7719
+			$className=$classPath=$this->getService()->getClientScriptManagerClass();
7720 7720
 			Prado::using($className);
7721
-			if(($pos=strrpos($className,'.'))!==false)
7722
-				$className=substr($className,$pos+1);
7723
- 			if(!class_exists($className,false) || ($className!=='TClientScriptManager' && !is_subclass_of($className,'TClientScriptManager')))
7724
-				throw new THttpException(404,'page_csmanagerclass_invalid',$classPath);
7721
+			if(($pos=strrpos($className, '.'))!==false)
7722
+				$className=substr($className, $pos + 1);
7723
+ 			if(!class_exists($className, false) || ($className!=='TClientScriptManager' && !is_subclass_of($className, 'TClientScriptManager')))
7724
+				throw new THttpException(404, 'page_csmanagerclass_invalid', $classPath);
7725 7725
 			$this->_clientScript=new $className($this);
7726 7726
 		}
7727 7727
 		return $this->_clientScript;
7728 7728
 	}
7729 7729
 	public function onPreInit($param)
7730 7730
 	{
7731
-		$this->raiseEvent('OnPreInit',$this,$param);
7731
+		$this->raiseEvent('OnPreInit', $this, $param);
7732 7732
 	}
7733 7733
 	public function onInitComplete($param)
7734 7734
 	{
7735
-		$this->raiseEvent('OnInitComplete',$this,$param);
7735
+		$this->raiseEvent('OnInitComplete', $this, $param);
7736 7736
 	}
7737 7737
 	public function onPreLoad($param)
7738 7738
 	{
7739
-		$this->raiseEvent('OnPreLoad',$this,$param);
7739
+		$this->raiseEvent('OnPreLoad', $this, $param);
7740 7740
 	}
7741 7741
 	public function onLoadComplete($param)
7742 7742
 	{
7743
-		$this->raiseEvent('OnLoadComplete',$this,$param);
7743
+		$this->raiseEvent('OnLoadComplete', $this, $param);
7744 7744
 	}
7745 7745
 	public function onPreRenderComplete($param)
7746 7746
 	{
7747
-		$this->raiseEvent('OnPreRenderComplete',$this,$param);
7747
+		$this->raiseEvent('OnPreRenderComplete', $this, $param);
7748 7748
 		$cs=$this->getClientScript();
7749 7749
 		$theme=$this->getTheme();
7750 7750
 		if($theme instanceof ITheme)
7751 7751
 		{
7752 7752
 			foreach($theme->getStyleSheetFiles() as $url)
7753
-				$cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
7753
+				$cs->registerStyleSheetFile($url, $url, $this->getCssMediaType($url));
7754 7754
 			foreach($theme->getJavaScriptFiles() as $url)
7755
-				$cs->registerHeadScriptFile($url,$url);
7755
+				$cs->registerHeadScriptFile($url, $url);
7756 7756
 		}
7757 7757
 		$styleSheet=$this->getStyleSheetTheme();
7758 7758
 		if($styleSheet instanceof ITheme)
7759 7759
 		{
7760 7760
 			foreach($styleSheet->getStyleSheetFiles() as $url)
7761
-				$cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
7761
+				$cs->registerStyleSheetFile($url, $url, $this->getCssMediaType($url));
7762 7762
 			foreach($styleSheet->getJavaScriptFiles() as $url)
7763
-				$cs->registerHeadScriptFile($url,$url);
7763
+				$cs->registerHeadScriptFile($url, $url);
7764 7764
 		}
7765 7765
 		if($cs->getRequiresHead() && $this->getHead()===null)
7766 7766
 			throw new TConfigurationException('page_head_required');
7767 7767
 	}
7768 7768
 	private function getCssMediaType($url)
7769 7769
 	{
7770
-		$segs=explode('.',basename($url));
7770
+		$segs=explode('.', basename($url));
7771 7771
 		if(isset($segs[2]))
7772
-			return $segs[count($segs)-2];
7772
+			return $segs[count($segs) - 2];
7773 7773
 		else
7774 7774
 			return '';
7775 7775
 	}
7776 7776
 	public function onSaveStateComplete($param)
7777 7777
 	{
7778
-		$this->raiseEvent('OnSaveStateComplete',$this,$param);
7778
+		$this->raiseEvent('OnSaveStateComplete', $this, $param);
7779 7779
 	}
7780 7780
 	private function determinePostBackMode()
7781 7781
 	{
@@ -7794,17 +7794,17 @@  discard block
 block discarded – undo
7794 7794
 	public function saveState()
7795 7795
 	{
7796 7796
 		parent::saveState();
7797
-		$this->setViewState('ControlsRequiringPostBack',$this->_controlsRegisteredForPostData,array());
7797
+		$this->setViewState('ControlsRequiringPostBack', $this->_controlsRegisteredForPostData, array());
7798 7798
 	}
7799 7799
 	public function loadState()
7800 7800
 	{
7801 7801
 		parent::loadState();
7802
-		$this->_controlsRequiringPostData=$this->getViewState('ControlsRequiringPostBack',array());
7802
+		$this->_controlsRequiringPostData=$this->getViewState('ControlsRequiringPostBack', array());
7803 7803
 	}
7804 7804
 	protected function loadPageState()
7805 7805
 	{
7806 7806
 		$state=$this->getStatePersister()->load();
7807
-		$this->loadStateRecursive($state,$this->getEnableViewState());
7807
+		$this->loadStateRecursive($state, $this->getEnableViewState());
7808 7808
 	}
7809 7809
 	protected function savePageState()
7810 7810
 	{
@@ -7817,11 +7817,11 @@  discard block
 block discarded – undo
7817 7817
 	}
7818 7818
 	public function registerRequiresPostData($control)
7819 7819
 	{
7820
-		$id=is_string($control)?$control:$control->getUniqueID();
7820
+		$id=is_string($control) ? $control : $control->getUniqueID();
7821 7821
 		$this->_controlsRegisteredForPostData[$id]=true;
7822 7822
 		$params=func_get_args();
7823 7823
 		foreach($this->getCachingStack() as $item)
7824
-			$item->registerAction('Page','registerRequiresPostData',array($id));
7824
+			$item->registerAction('Page', 'registerRequiresPostData', array($id));
7825 7825
 	}
7826 7826
 	public function getPostBackEventTarget()
7827 7827
 	{
@@ -7850,7 +7850,7 @@  discard block
 block discarded – undo
7850 7850
 	{
7851 7851
 		$this->_postBackEventParameter=$value;
7852 7852
 	}
7853
-	protected function processPostData($postData,$beforeLoad)
7853
+	protected function processPostData($postData, $beforeLoad)
7854 7854
 	{
7855 7855
 		$this->_isLoadingPostData=true;
7856 7856
 		if($beforeLoad)
@@ -7863,17 +7863,17 @@  discard block
 block discarded – undo
7863 7863
 			{
7864 7864
 				if($control instanceof IPostBackDataHandler)
7865 7865
 				{
7866
-					if($control->loadPostData($key,$postData))
7866
+					if($control->loadPostData($key, $postData))
7867 7867
 						$this->_controlsPostDataChanged[]=$control;
7868 7868
 				}
7869 7869
 				else if($control instanceof IPostBackEventHandler &&
7870 7870
 					empty($this->_postData[self::FIELD_POSTBACK_TARGET]))
7871 7871
 				{
7872
-					$this->_postData->add(self::FIELD_POSTBACK_TARGET,$key);  				}
7872
+					$this->_postData->add(self::FIELD_POSTBACK_TARGET, $key); }
7873 7873
 				unset($this->_controlsRequiringPostData[$key]);
7874 7874
 			}
7875 7875
 			else if($beforeLoad)
7876
-				$this->_restPostData->add($key,$value);
7876
+				$this->_restPostData->add($key, $value);
7877 7877
 		}
7878 7878
 		foreach($this->_controlsRequiringPostData as $key=>$value)
7879 7879
 		{
@@ -7881,11 +7881,11 @@  discard block
 block discarded – undo
7881 7881
 			{
7882 7882
 				if($control instanceof IPostBackDataHandler)
7883 7883
 				{
7884
-					if($control->loadPostData($key,$this->_postData))
7884
+					if($control->loadPostData($key, $this->_postData))
7885 7885
 						$this->_controlsPostDataChanged[]=$control;
7886 7886
 				}
7887 7887
 				else
7888
-					throw new TInvalidDataValueException('page_postbackcontrol_invalid',$key);
7888
+					throw new TInvalidDataValueException('page_postbackcontrol_invalid', $key);
7889 7889
 				unset($this->_controlsRequiringPostData[$key]);
7890 7890
 			}
7891 7891
 		}
@@ -7914,14 +7914,14 @@  discard block
 block discarded – undo
7914 7914
 	public function ensureRenderInForm($control)
7915 7915
 	{
7916 7916
 		if(!$this->getIsCallback() && !$this->_inFormRender)
7917
-			throw new TConfigurationException('page_control_outofform',get_class($control), $control ? $control->getUniqueID() : null);
7917
+			throw new TConfigurationException('page_control_outofform', get_class($control), $control ? $control->getUniqueID() : null);
7918 7918
 	}
7919 7919
 	public function beginFormRender($writer)
7920 7920
 	{
7921 7921
 		if($this->_formRendered)
7922 7922
 			throw new TConfigurationException('page_form_duplicated');
7923 7923
 		$this->_formRendered=true;
7924
-		$this->getClientScript()->registerHiddenField(self::FIELD_PAGESTATE,$this->getClientState());
7924
+		$this->getClientScript()->registerHiddenField(self::FIELD_PAGESTATE, $this->getClientState());
7925 7925
 		$this->_inFormRender=true;
7926 7926
 	}
7927 7927
 	public function endFormRender($writer)
@@ -8042,12 +8042,12 @@  discard block
 block discarded – undo
8042 8042
 	{
8043 8043
 		$this->_pagePath=$value;
8044 8044
 	}
8045
-	public function registerCachingAction($context,$funcName,$funcParams)
8045
+	public function registerCachingAction($context, $funcName, $funcParams)
8046 8046
 	{
8047 8047
 		if($this->_cachingStack)
8048 8048
 		{
8049 8049
 			foreach($this->_cachingStack as $cache)
8050
-				$cache->registerAction($context,$funcName,$funcParams);
8050
+				$cache->registerAction($context, $funcName, $funcParams);
8051 8051
 		}
8052 8052
 	}
8053 8053
 	public function getCachingStack()
@@ -8058,7 +8058,7 @@  discard block
 block discarded – undo
8058 8058
 	}
8059 8059
 	public function flushWriter()
8060 8060
 	{
8061
-		if ($this->_writer)
8061
+		if($this->_writer)
8062 8062
 			$this->Response->write($this->_writer->flush());
8063 8063
 	}
8064 8064
 }
@@ -8071,7 +8071,7 @@  discard block
 block discarded – undo
8071 8071
 }
8072 8072
 class TPageStateFormatter
8073 8073
 {
8074
-	public static function serialize($page,$data)
8074
+	public static function serialize($page, $data)
8075 8075
 	{
8076 8076
 		$sm=$page->getApplication()->getSecurityManager();
8077 8077
 		if($page->getEnableStateValidation())
@@ -8084,7 +8084,7 @@  discard block
 block discarded – undo
8084 8084
 			$str=$sm->encrypt($str);
8085 8085
 		return base64_encode($str);
8086 8086
 	}
8087
-	public static function unserialize($page,$data)
8087
+	public static function unserialize($page, $data)
8088 8088
 	{
8089 8089
 		$str=base64_decode($data);
8090 8090
 		if($str==='')
@@ -8135,13 +8135,13 @@  discard block
 block discarded – undo
8135 8135
 		if(!$this->_cacheChecked)
8136 8136
 		{
8137 8137
 			$this->_cacheChecked=true;
8138
-			if($this->_duration>0 && ($this->_cachePostBack || !$this->getPage()->getIsPostBack()))
8138
+			if($this->_duration > 0 && ($this->_cachePostBack || !$this->getPage()->getIsPostBack()))
8139 8139
 			{
8140 8140
 				if($this->_cacheModuleID!=='')
8141 8141
 				{
8142 8142
 					$this->_cache=$this->getApplication()->getModule($this->_cacheModuleID);
8143 8143
 					if(!($this->_cache instanceof ICache))
8144
-						throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID);
8144
+						throw new TConfigurationException('outputcache_cachemoduleid_invalid', $this->_cacheModuleID);
8145 8145
 				}
8146 8146
 				else
8147 8147
 					$this->_cache=$this->getApplication()->getCache();
@@ -8152,14 +8152,14 @@  discard block
 block discarded – undo
8152 8152
 					if(is_array($data))
8153 8153
 					{
8154 8154
 						$param=new TOutputCacheCheckDependencyEventParameter;
8155
-						$param->setCacheTime(isset($data[3])?$data[3]:0);
8155
+						$param->setCacheTime(isset($data[3]) ? $data[3] : 0);
8156 8156
 						$this->onCheckDependency($param);
8157 8157
 						$this->_dataCached=$param->getIsValid();
8158 8158
 					}
8159 8159
 					else
8160 8160
 						$this->_dataCached=false;
8161 8161
 					if($this->_dataCached)
8162
-						list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data;
8162
+						list($this->_contents, $this->_state, $this->_actions, $this->_cacheTime)=$data;
8163 8163
 				}
8164 8164
 			}
8165 8165
 		}
@@ -8199,11 +8199,11 @@  discard block
 block discarded – undo
8199 8199
 		foreach($this->_actions as $action)
8200 8200
 		{
8201 8201
 			if($action[0]==='Page.ClientScript')
8202
-				call_user_func_array(array($cs,$action[1]),$action[2]);
8202
+				call_user_func_array(array($cs, $action[1]), $action[2]);
8203 8203
 			else if($action[0]==='Page')
8204
-				call_user_func_array(array($page,$action[1]),$action[2]);
8204
+				call_user_func_array(array($page, $action[1]), $action[2]);
8205 8205
 			else
8206
-				call_user_func_array(array($this->getSubProperty($action[0]),$action[1]),$action[2]);
8206
+				call_user_func_array(array($this->getSubProperty($action[0]), $action[1]), $action[2]);
8207 8207
 		}
8208 8208
 	}
8209 8209
 	protected function preRenderRecursive()
@@ -8218,10 +8218,10 @@  discard block
 block discarded – undo
8218 8218
 		else
8219 8219
 			parent::preRenderRecursive();
8220 8220
 	}
8221
-	protected function loadStateRecursive(&$state,$needViewState=true)
8221
+	protected function loadStateRecursive(&$state, $needViewState=true)
8222 8222
 	{
8223 8223
 		$st=unserialize($state);
8224
-		parent::loadStateRecursive($st,$needViewState);
8224
+		parent::loadStateRecursive($st, $needViewState);
8225 8225
 	}
8226 8226
 	protected function &saveStateRecursive($needViewState=true)
8227 8227
 	{
@@ -8234,9 +8234,9 @@  discard block
 block discarded – undo
8234 8234
 			return $this->_state;
8235 8235
 		}
8236 8236
 	}
8237
-	public function registerAction($context,$funcName,$funcParams)
8237
+	public function registerAction($context, $funcName, $funcParams)
8238 8238
 	{
8239
-		$this->_actions[]=array($context,$funcName,$funcParams);
8239
+		$this->_actions[]=array($context, $funcName, $funcParams);
8240 8240
 	}
8241 8241
 	public function getCacheKey()
8242 8242
 	{
@@ -8253,7 +8253,7 @@  discard block
 block discarded – undo
8253 8253
 		{
8254 8254
 			$params=array();
8255 8255
 			$request=$this->getRequest();
8256
-			foreach(explode(',',$this->_varyByParam) as $name)
8256
+			foreach(explode(',', $this->_varyByParam) as $name)
8257 8257
 			{
8258 8258
 				$name=trim($name);
8259 8259
 				$params[$name]=$request->itemAt($name);
@@ -8299,8 +8299,8 @@  discard block
 block discarded – undo
8299 8299
 	}
8300 8300
 	public function setDuration($value)
8301 8301
 	{
8302
-		if(($value=TPropertyValue::ensureInteger($value))<0)
8303
-			throw new TInvalidDataValueException('outputcache_duration_invalid',get_class($this));
8302
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
8303
+			throw new TInvalidDataValueException('outputcache_duration_invalid', get_class($this));
8304 8304
 		$this->_duration=$value;
8305 8305
 	}
8306 8306
 	public function getVaryByParam()
@@ -8329,11 +8329,11 @@  discard block
 block discarded – undo
8329 8329
 	}
8330 8330
 	public function onCheckDependency($param)
8331 8331
 	{
8332
-		$this->raiseEvent('OnCheckDependency',$this,$param);
8332
+		$this->raiseEvent('OnCheckDependency', $this, $param);
8333 8333
 	}
8334 8334
 	public function onCalculateKey($param)
8335 8335
 	{
8336
-		$this->raiseEvent('OnCalculateKey',$this,$param);
8336
+		$this->raiseEvent('OnCalculateKey', $this, $param);
8337 8337
 	}
8338 8338
 	public function render($writer)
8339 8339
 	{
@@ -8341,16 +8341,16 @@  discard block
 block discarded – undo
8341 8341
 			$writer->write($this->_contents);
8342 8342
 		else if($this->_cacheAvailable)
8343 8343
 		{
8344
-			$textwriter = new TTextWriter();
8345
-			$multiwriter = new TOutputCacheTextWriterMulti(array($writer->getWriter(),$textwriter));
8346
-			$htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $multiwriter);
8344
+			$textwriter=new TTextWriter();
8345
+			$multiwriter=new TOutputCacheTextWriterMulti(array($writer->getWriter(), $textwriter));
8346
+			$htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $multiwriter);
8347 8347
 			$stack=$this->getPage()->getCachingStack();
8348 8348
 			$stack->push($this);
8349 8349
 			parent::render($htmlWriter);
8350 8350
 			$stack->pop();
8351 8351
 			$content=$textwriter->flush();
8352
-			$data=array($content,$this->_state,$this->_actions,time());
8353
-			$this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency());
8352
+			$data=array($content, $this->_state, $this->_actions, time());
8353
+			$this->_cache->set($this->getCacheKey(), $data, $this->getDuration(), $this->getCacheDependency());
8354 8354
 		}
8355 8355
 		else
8356 8356
 			parent::render($writer);
@@ -8394,7 +8394,7 @@  discard block
 block discarded – undo
8394 8394
 	protected $_writers;
8395 8395
 	public function __construct(Array $writers)
8396 8396
 	{
8397
-				$this->_writers = $writers;
8397
+				$this->_writers=$writers;
8398 8398
 	}
8399 8399
 	public function write($s)
8400 8400
 	{
@@ -8404,7 +8404,7 @@  discard block
 block discarded – undo
8404 8404
 	public function flush()
8405 8405
 	{
8406 8406
 		foreach($this->_writers as $writer)
8407
-			$s = $writer->flush();
8407
+			$s=$writer->flush();
8408 8408
 		return $s;
8409 8409
 	}
8410 8410
 }
@@ -8427,19 +8427,19 @@  discard block
 block discarded – undo
8427 8427
 		if(($fileName=$this->getLocalizedTemplate($fileName))!==null)
8428 8428
 		{
8429 8429
 			if(($cache=$this->getApplication()->getCache())===null)
8430
-				return new TTemplate(file_get_contents($fileName),dirname($fileName),$fileName);
8430
+				return new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName);
8431 8431
 			else
8432 8432
 			{
8433 8433
 				$array=$cache->get(self::TEMPLATE_CACHE_PREFIX.$fileName);
8434 8434
 				if(is_array($array))
8435 8435
 				{
8436
-					list($template,$timestamps)=$array;
8436
+					list($template, $timestamps)=$array;
8437 8437
 					if($this->getApplication()->getMode()===TApplicationMode::Performance)
8438 8438
 						return $template;
8439 8439
 					$cacheValid=true;
8440 8440
 					foreach($timestamps as $tplFile=>$timestamp)
8441 8441
 					{
8442
-						if(!is_file($tplFile) || filemtime($tplFile)>$timestamp)
8442
+						if(!is_file($tplFile) || filemtime($tplFile) > $timestamp)
8443 8443
 						{
8444 8444
 							$cacheValid=false;
8445 8445
 							break;
@@ -8448,13 +8448,13 @@  discard block
 block discarded – undo
8448 8448
 					if($cacheValid)
8449 8449
 						return $template;
8450 8450
 				}
8451
-				$template=new TTemplate(file_get_contents($fileName),dirname($fileName),$fileName);
8451
+				$template=new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName);
8452 8452
 				$includedFiles=$template->getIncludedFiles();
8453 8453
 				$timestamps=array();
8454 8454
 				$timestamps[$fileName]=filemtime($fileName);
8455 8455
 				foreach($includedFiles as $includedFile)
8456 8456
 					$timestamps[$includedFile]=filemtime($includedFile);
8457
-				$cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName,array($template,$timestamps));
8457
+				$cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName, array($template, $timestamps));
8458 8458
 				return $template;
8459 8459
 			}
8460 8460
 		}
@@ -8464,7 +8464,7 @@  discard block
 block discarded – undo
8464 8464
 	protected function getLocalizedTemplate($filename)
8465 8465
 	{
8466 8466
 		if(($app=$this->getApplication()->getGlobalization(false))===null)
8467
-			return is_file($filename)?$filename:null;
8467
+			return is_file($filename) ? $filename : null;
8468 8468
 		foreach($app->getLocalizedResource($filename) as $file)
8469 8469
 		{
8470 8470
 			if(($file=realpath($file))!==false && is_file($file))
@@ -8494,7 +8494,7 @@  discard block
 block discarded – undo
8494 8494
 	private $_includedFiles=array();
8495 8495
 	private $_includeAtLine=array();
8496 8496
 	private $_includeLines=array();
8497
-	public function __construct($template,$contextPath,$tplFile=null,$startingLine=0,$sourceTemplate=true)
8497
+	public function __construct($template, $contextPath, $tplFile=null, $startingLine=0, $sourceTemplate=true)
8498 8498
 	{
8499 8499
 		$this->_sourceTemplate=$sourceTemplate;
8500 8500
 		$this->_contextPath=$contextPath;
@@ -8503,7 +8503,7 @@  discard block
 block discarded – undo
8503 8503
 		$this->_content=$template;
8504 8504
 		$this->_hashCode=md5($template);
8505 8505
 		$this->parse($template);
8506
-		$this->_content=null; 	}
8506
+		$this->_content=null; }
8507 8507
 	public function getTemplateFile()
8508 8508
 	{
8509 8509
 		return $this->_tplFile;
@@ -8528,7 +8528,7 @@  discard block
 block discarded – undo
8528 8528
 	{
8529 8529
 		return $this->_tpl;
8530 8530
 	}
8531
-	public function instantiateIn($tplControl,$parentControl=null)
8531
+	public function instantiateIn($tplControl, $parentControl=null)
8532 8532
 	{
8533 8533
 		$this->_tplControl=$tplControl;
8534 8534
 		if($parentControl===null)
@@ -8545,7 +8545,7 @@  discard block
 block discarded – undo
8545 8545
 				$parent=$controls[$object[0]];
8546 8546
 			else
8547 8547
 				continue;
8548
-			if(isset($object[2]))				{
8548
+			if(isset($object[2])) {
8549 8549
 				$component=Prado::createComponent($object[1]);
8550 8550
 				$properties=&$object[2];
8551 8551
 				if($component instanceof TControl)
@@ -8557,7 +8557,7 @@  discard block
 block discarded – undo
8557 8557
 					{
8558 8558
 						if(is_array($properties['id']))
8559 8559
 							$properties['id']=$component->evaluateExpression($properties['id'][1]);
8560
-						$tplControl->registerObject($properties['id'],$component);
8560
+						$tplControl->registerObject($properties['id'], $component);
8561 8561
 					}
8562 8562
 					if(isset($properties['skinid']))
8563 8563
 					{
@@ -8570,7 +8570,7 @@  discard block
 block discarded – undo
8570 8570
 					$component->trackViewState(false);
8571 8571
 					$component->applyStyleSheetSkin($page);
8572 8572
 					foreach($properties as $name=>$value)
8573
-						$this->configureControl($component,$name,$value);
8573
+						$this->configureControl($component, $name, $value);
8574 8574
 					$component->trackViewState(true);
8575 8575
 					if($parent===$parentControl)
8576 8576
 						$directChildren[]=$component;
@@ -8586,12 +8586,12 @@  discard block
 block discarded – undo
8586 8586
 					{
8587 8587
 						if(is_array($properties['id']))
8588 8588
 							$properties['id']=$component->evaluateExpression($properties['id'][1]);
8589
-						$tplControl->registerObject($properties['id'],$component);
8589
+						$tplControl->registerObject($properties['id'], $component);
8590 8590
 						if(!$component->hasProperty('id'))
8591 8591
 							unset($properties['id']);
8592 8592
 					}
8593 8593
 					foreach($properties as $name=>$value)
8594
-						$this->configureComponent($component,$name,$value);
8594
+						$this->configureComponent($component, $name, $value);
8595 8595
 					if($parent===$parentControl)
8596 8596
 						$directChildren[]=$component;
8597 8597
 					else
@@ -8626,36 +8626,36 @@  discard block
 block discarded – undo
8626 8626
 				$parentControl->addParsedObject($control);
8627 8627
 		}
8628 8628
 	}
8629
-	protected function configureControl($control,$name,$value)
8629
+	protected function configureControl($control, $name, $value)
8630 8630
 	{
8631
-		if(strncasecmp($name,'on',2)===0)					$this->configureEvent($control,$name,$value,$control);
8632
-		else if(($pos=strrpos($name,'.'))===false)				$this->configureProperty($control,$name,$value);
8633
-		else				$this->configureSubProperty($control,$name,$value);
8631
+		if(strncasecmp($name, 'on', 2)===0)					$this->configureEvent($control, $name, $value, $control);
8632
+		else if(($pos=strrpos($name, '.'))===false)				$this->configureProperty($control, $name, $value);
8633
+		else				$this->configureSubProperty($control, $name, $value);
8634 8634
 	}
8635
-	protected function configureComponent($component,$name,$value)
8635
+	protected function configureComponent($component, $name, $value)
8636 8636
 	{
8637
-		if(strpos($name,'.')===false)				$this->configureProperty($component,$name,$value);
8638
-		else				$this->configureSubProperty($component,$name,$value);
8637
+		if(strpos($name, '.')===false)				$this->configureProperty($component, $name, $value);
8638
+		else				$this->configureSubProperty($component, $name, $value);
8639 8639
 	}
8640
-	protected function configureEvent($control,$name,$value,$contextControl)
8640
+	protected function configureEvent($control, $name, $value, $contextControl)
8641 8641
 	{
8642
-		if(strpos($value,'.')===false)
8643
-			$control->attachEventHandler($name,array($contextControl,'TemplateControl.'.$value));
8642
+		if(strpos($value, '.')===false)
8643
+			$control->attachEventHandler($name, array($contextControl, 'TemplateControl.'.$value));
8644 8644
 		else
8645
-			$control->attachEventHandler($name,array($contextControl,$value));
8645
+			$control->attachEventHandler($name, array($contextControl, $value));
8646 8646
 	}
8647
-	protected function configureProperty($component,$name,$value)
8647
+	protected function configureProperty($component, $name, $value)
8648 8648
 	{
8649 8649
 		if(is_array($value))
8650 8650
 		{
8651 8651
 			switch($value[0])
8652 8652
 			{
8653 8653
 				case self::CONFIG_DATABIND:
8654
-					$component->bindProperty($name,$value[1]);
8654
+					$component->bindProperty($name, $value[1]);
8655 8655
 					break;
8656 8656
 				case self::CONFIG_EXPRESSION:
8657 8657
 					if($component instanceof TControl)
8658
-						$component->autoBindProperty($name,$value[1]);
8658
+						$component->autoBindProperty($name, $value[1]);
8659 8659
 					else
8660 8660
 					{
8661 8661
 						$setter='set'.$name;
@@ -8677,55 +8677,55 @@  discard block
 block discarded – undo
8677 8677
 					$setter='set'.$name;
8678 8678
 					$component->$setter(Prado::localize($value[1]));
8679 8679
 					break;
8680
-				default:						throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
8680
+				default:						throw new TConfigurationException('template_tag_unexpected', $name, $value[1]);
8681 8681
 					break;
8682 8682
 			}
8683 8683
 		}
8684 8684
 		else
8685 8685
 		{
8686
-			if (substr($name,0,2)=='js')
8687
-				if ($value and !($value instanceof TJavaScriptLiteral))
8688
-					$value = new TJavaScriptLiteral($value);
8686
+			if(substr($name, 0, 2)=='js')
8687
+				if($value and !($value instanceof TJavaScriptLiteral))
8688
+					$value=new TJavaScriptLiteral($value);
8689 8689
 			$setter='set'.$name;
8690 8690
 			$component->$setter($value);
8691 8691
 		}
8692 8692
 	}
8693
-	protected function configureSubProperty($component,$name,$value)
8693
+	protected function configureSubProperty($component, $name, $value)
8694 8694
 	{
8695 8695
 		if(is_array($value))
8696 8696
 		{
8697 8697
 			switch($value[0])
8698 8698
 			{
8699
-				case self::CONFIG_DATABIND:							$component->bindProperty($name,$value[1]);
8699
+				case self::CONFIG_DATABIND:							$component->bindProperty($name, $value[1]);
8700 8700
 					break;
8701 8701
 				case self::CONFIG_EXPRESSION:							if($component instanceof TControl)
8702
-						$component->autoBindProperty($name,$value[1]);
8702
+						$component->autoBindProperty($name, $value[1]);
8703 8703
 					else
8704
-						$component->setSubProperty($name,$this->_tplControl->evaluateExpression($value[1]));
8704
+						$component->setSubProperty($name, $this->_tplControl->evaluateExpression($value[1]));
8705 8705
 					break;
8706 8706
 				case self::CONFIG_TEMPLATE:
8707
-					$component->setSubProperty($name,$value[1]);
8707
+					$component->setSubProperty($name, $value[1]);
8708 8708
 					break;
8709 8709
 				case self::CONFIG_ASSET:							$url=$this->publishFilePath($this->_contextPath.DIRECTORY_SEPARATOR.$value[1]);
8710
-					$component->setSubProperty($name,$url);
8710
+					$component->setSubProperty($name, $url);
8711 8711
 					break;
8712
-				case self::CONFIG_PARAMETER:							$component->setSubProperty($name,$this->getApplication()->getParameters()->itemAt($value[1]));
8712
+				case self::CONFIG_PARAMETER:							$component->setSubProperty($name, $this->getApplication()->getParameters()->itemAt($value[1]));
8713 8713
 					break;
8714 8714
 				case self::CONFIG_LOCALIZATION:
8715
-					$component->setSubProperty($name,Prado::localize($value[1]));
8715
+					$component->setSubProperty($name, Prado::localize($value[1]));
8716 8716
 					break;
8717
-				default:						throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
8717
+				default:						throw new TConfigurationException('template_tag_unexpected', $name, $value[1]);
8718 8718
 					break;
8719 8719
 			}
8720 8720
 		}
8721 8721
 		else
8722
-			$component->setSubProperty($name,$value);
8722
+			$component->setSubProperty($name, $value);
8723 8723
 	}
8724 8724
 	protected function parse($input)
8725 8725
 	{
8726 8726
 		$input=$this->preprocess($input);
8727 8727
 		$tpl=&$this->_tpl;
8728
-		$n=preg_match_all(self::REGEX_RULES,$input,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
8728
+		$n=preg_match_all(self::REGEX_RULES, $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
8729 8729
 		$expectPropEnd=false;
8730 8730
 		$textStart=0;
8731 8731
 				$stack=array();
@@ -8735,171 +8735,171 @@  discard block
 block discarded – undo
8735 8735
 		$this->_directive=null;
8736 8736
 		try
8737 8737
 		{
8738
-			for($i=0;$i<$n;++$i)
8738
+			for($i=0; $i < $n; ++$i)
8739 8739
 			{
8740 8740
 				$match=&$matches[$i];
8741 8741
 				$str=$match[0][0];
8742 8742
 				$matchStart=$match[0][1];
8743
-				$matchEnd=$matchStart+strlen($str)-1;
8744
-				if(strpos($str,'<com:')===0)					{
8743
+				$matchEnd=$matchStart + strlen($str) - 1;
8744
+				if(strpos($str, '<com:')===0) {
8745 8745
 					if($expectPropEnd)
8746 8746
 						continue;
8747
-					if($matchStart>$textStart)
8748
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8749
-					$textStart=$matchEnd+1;
8747
+					if($matchStart > $textStart)
8748
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8749
+					$textStart=$matchEnd + 1;
8750 8750
 					$type=$match[1][0];
8751
-					$attributes=$this->parseAttributes($match[2][0],$match[2][1]);
8752
-					$this->validateAttributes($type,$attributes);
8753
-					$tpl[$c++]=array($container,$type,$attributes);
8754
-					if($str[strlen($str)-2]!=='/')  					{
8755
-						$stack[] = $type;
8756
-						$container=$c-1;
8751
+					$attributes=$this->parseAttributes($match[2][0], $match[2][1]);
8752
+					$this->validateAttributes($type, $attributes);
8753
+					$tpl[$c++]=array($container, $type, $attributes);
8754
+					if($str[strlen($str) - 2]!=='/') {
8755
+						$stack[]=$type;
8756
+						$container=$c - 1;
8757 8757
 					}
8758 8758
 				}
8759
-				else if(strpos($str,'</com:')===0)					{
8759
+				else if(strpos($str, '</com:')===0) {
8760 8760
 					if($expectPropEnd)
8761 8761
 						continue;
8762
-					if($matchStart>$textStart)
8763
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8764
-					$textStart=$matchEnd+1;
8762
+					if($matchStart > $textStart)
8763
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8764
+					$textStart=$matchEnd + 1;
8765 8765
 					$type=$match[1][0];
8766 8766
 					if(empty($stack))
8767
-						throw new TConfigurationException('template_closingtag_unexpected',"</com:$type>");
8767
+						throw new TConfigurationException('template_closingtag_unexpected', "</com:$type>");
8768 8768
 					$name=array_pop($stack);
8769 8769
 					if($name!==$type)
8770 8770
 					{
8771
-						$tag=$name[0]==='@' ? '</prop:'.substr($name,1).'>' : "</com:$name>";
8772
-						throw new TConfigurationException('template_closingtag_expected',$tag);
8771
+						$tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>";
8772
+						throw new TConfigurationException('template_closingtag_expected', $tag);
8773 8773
 					}
8774 8774
 					$container=$tpl[$container][0];
8775 8775
 				}
8776
-				else if(strpos($str,'<%@')===0)					{
8776
+				else if(strpos($str, '<%@')===0) {
8777 8777
 					if($expectPropEnd)
8778 8778
 						continue;
8779
-					if($matchStart>$textStart)
8780
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8781
-					$textStart=$matchEnd+1;
8779
+					if($matchStart > $textStart)
8780
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8781
+					$textStart=$matchEnd + 1;
8782 8782
 					if(isset($tpl[0]) || $this->_directive!==null)
8783 8783
 						throw new TConfigurationException('template_directive_nonunique');
8784
-					$this->_directive=$this->parseAttributes($match[4][0],$match[4][1]);
8784
+					$this->_directive=$this->parseAttributes($match[4][0], $match[4][1]);
8785 8785
 				}
8786
-				else if(strpos($str,'<%')===0)					{
8786
+				else if(strpos($str, '<%')===0) {
8787 8787
 					if($expectPropEnd)
8788 8788
 						continue;
8789
-					if($matchStart>$textStart)
8790
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8791
-					$textStart=$matchEnd+1;
8789
+					if($matchStart > $textStart)
8790
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8791
+					$textStart=$matchEnd + 1;
8792 8792
 					$literal=trim($match[5][0]);
8793
-					if($str[2]==='=')							$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,$literal));
8794
-					else if($str[2]==='%')  						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_STATEMENTS,$literal));
8793
+					if($str[2]==='=')							$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, $literal));
8794
+					else if($str[2]==='%')  						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_STATEMENTS, $literal));
8795 8795
 					else if($str[2]==='#')
8796
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_DATABINDING,$literal));
8796
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_DATABINDING, $literal));
8797 8797
 					else if($str[2]==='$')
8798
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"\$this->getApplication()->getParameters()->itemAt('$literal')"));
8798
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "\$this->getApplication()->getParameters()->itemAt('$literal')"));
8799 8799
 					else if($str[2]==='~')
8800
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"\$this->publishFilePath('$this->_contextPath/$literal')"));
8800
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "\$this->publishFilePath('$this->_contextPath/$literal')"));
8801 8801
 					else if($str[2]==='/')
8802
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"));
8802
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"));
8803 8803
 					else if($str[2]==='[')
8804 8804
 					{
8805
-						$literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\"));
8806
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')"));
8805
+						$literal=strtr(trim(substr($literal, 0, strlen($literal) - 1)), array("'"=>"\'", "\\"=>"\\\\"));
8806
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "Prado::localize('$literal')"));
8807 8807
 					}
8808 8808
 				}
8809
-				else if(strpos($str,'<prop:')===0)					{
8810
-					if(strrpos($str,'/>')===strlen($str)-2)  					{
8809
+				else if(strpos($str, '<prop:')===0) {
8810
+					if(strrpos($str, '/>')===strlen($str) - 2) {
8811 8811
 						if($expectPropEnd)
8812 8812
 							continue;
8813
-						if($matchStart>$textStart)
8814
-							$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8815
-						$textStart=$matchEnd+1;
8813
+						if($matchStart > $textStart)
8814
+							$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8815
+						$textStart=$matchEnd + 1;
8816 8816
 						$prop=strtolower($match[6][0]);
8817
-						$attrs=$this->parseAttributes($match[7][0],$match[7][1]);
8817
+						$attrs=$this->parseAttributes($match[7][0], $match[7][1]);
8818 8818
 						$attributes=array();
8819 8819
 						foreach($attrs as $name=>$value)
8820 8820
 							$attributes[$prop.'.'.$name]=$value;
8821 8821
 						$type=$tpl[$container][1];
8822
-						$this->validateAttributes($type,$attributes);
8822
+						$this->validateAttributes($type, $attributes);
8823 8823
 						foreach($attributes as $name=>$value)
8824 8824
 						{
8825 8825
 							if(isset($tpl[$container][2][$name]))
8826
-								throw new TConfigurationException('template_property_duplicated',$name);
8826
+								throw new TConfigurationException('template_property_duplicated', $name);
8827 8827
 							$tpl[$container][2][$name]=$value;
8828 8828
 						}
8829 8829
 					}
8830
-					else  					{
8830
+					else {
8831 8831
 						$prop=strtolower($match[3][0]);
8832
-						$stack[] = '@'.$prop;
8832
+						$stack[]='@'.$prop;
8833 8833
 						if(!$expectPropEnd)
8834 8834
 						{
8835
-							if($matchStart>$textStart)
8836
-								$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8837
-							$textStart=$matchEnd+1;
8835
+							if($matchStart > $textStart)
8836
+								$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8837
+							$textStart=$matchEnd + 1;
8838 8838
 							$expectPropEnd=true;
8839 8839
 						}
8840 8840
 					}
8841 8841
 				}
8842
-				else if(strpos($str,'</prop:')===0)					{
8842
+				else if(strpos($str, '</prop:')===0) {
8843 8843
 					$prop=strtolower($match[3][0]);
8844 8844
 					if(empty($stack))
8845
-						throw new TConfigurationException('template_closingtag_unexpected',"</prop:$prop>");
8845
+						throw new TConfigurationException('template_closingtag_unexpected', "</prop:$prop>");
8846 8846
 					$name=array_pop($stack);
8847 8847
 					if($name!=='@'.$prop)
8848 8848
 					{
8849
-						$tag=$name[0]==='@' ? '</prop:'.substr($name,1).'>' : "</com:$name>";
8850
-						throw new TConfigurationException('template_closingtag_expected',$tag);
8849
+						$tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>";
8850
+						throw new TConfigurationException('template_closingtag_expected', $tag);
8851 8851
 					}
8852
-					if(($last=count($stack))<1 || $stack[$last-1][0]!=='@')
8852
+					if(($last=count($stack)) < 1 || $stack[$last - 1][0]!=='@')
8853 8853
 					{
8854
-						if($matchStart>$textStart)
8854
+						if($matchStart > $textStart)
8855 8855
 						{
8856
-							$value=substr($input,$textStart,$matchStart-$textStart);
8857
-							if(substr($prop,-8,8)==='template')
8858
-								$value=$this->parseTemplateProperty($value,$textStart);
8856
+							$value=substr($input, $textStart, $matchStart - $textStart);
8857
+							if(substr($prop, -8, 8)==='template')
8858
+								$value=$this->parseTemplateProperty($value, $textStart);
8859 8859
 							else
8860 8860
 								$value=$this->parseAttribute($value);
8861
-							if($container>=0)
8861
+							if($container >= 0)
8862 8862
 							{
8863 8863
 								$type=$tpl[$container][1];
8864
-								$this->validateAttributes($type,array($prop=>$value));
8864
+								$this->validateAttributes($type, array($prop=>$value));
8865 8865
 								if(isset($tpl[$container][2][$prop]))
8866
-									throw new TConfigurationException('template_property_duplicated',$prop);
8866
+									throw new TConfigurationException('template_property_duplicated', $prop);
8867 8867
 								$tpl[$container][2][$prop]=$value;
8868 8868
 							}
8869 8869
 							else									$this->_directive[$prop]=$value;
8870
-							$textStart=$matchEnd+1;
8870
+							$textStart=$matchEnd + 1;
8871 8871
 						}
8872 8872
 						$expectPropEnd=false;
8873 8873
 					}
8874 8874
 				}
8875
-				else if(strpos($str,'<!--')===0)					{
8875
+				else if(strpos($str, '<!--')===0) {
8876 8876
 					if($expectPropEnd)
8877 8877
 						throw new TConfigurationException('template_comments_forbidden');
8878
-					if($matchStart>$textStart)
8879
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8880
-					$textStart=$matchEnd+1;
8878
+					if($matchStart > $textStart)
8879
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8880
+					$textStart=$matchEnd + 1;
8881 8881
 				}
8882 8882
 				else
8883
-					throw new TConfigurationException('template_matching_unexpected',$match);
8883
+					throw new TConfigurationException('template_matching_unexpected', $match);
8884 8884
 			}
8885 8885
 			if(!empty($stack))
8886 8886
 			{
8887 8887
 				$name=array_pop($stack);
8888
-				$tag=$name[0]==='@' ? '</prop:'.substr($name,1).'>' : "</com:$name>";
8889
-				throw new TConfigurationException('template_closingtag_expected',$tag);
8888
+				$tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>";
8889
+				throw new TConfigurationException('template_closingtag_expected', $tag);
8890 8890
 			}
8891
-			if($textStart<strlen($input))
8892
-				$tpl[$c++]=array($container,substr($input,$textStart));
8891
+			if($textStart < strlen($input))
8892
+				$tpl[$c++]=array($container, substr($input, $textStart));
8893 8893
 		}
8894 8894
 		catch(Exception $e)
8895 8895
 		{
8896 8896
 			if(($e instanceof TException) && ($e instanceof TTemplateException))
8897 8897
 				throw $e;
8898 8898
 			if($matchEnd===0)
8899
-				$line=$this->_startingLine+1;
8899
+				$line=$this->_startingLine + 1;
8900 8900
 			else
8901
-				$line=$this->_startingLine+count(explode("\n",substr($input,0,$matchEnd+1)));
8902
-			$this->handleException($e,$line,$input);
8901
+				$line=$this->_startingLine + count(explode("\n", substr($input, 0, $matchEnd + 1)));
8902
+			$this->handleException($e, $line, $input);
8903 8903
 		}
8904 8904
 		if($this->_directive===null)
8905 8905
 			$this->_directive=array();
@@ -8913,9 +8913,9 @@  discard block
 block discarded – undo
8913 8913
 				if($parent!==null)
8914 8914
 				{
8915 8915
 					if(count($merged[1])===1 && is_string($merged[1][0]))
8916
-						$objects[$id-1]=array($merged[0],$merged[1][0]);
8916
+						$objects[$id - 1]=array($merged[0], $merged[1][0]);
8917 8917
 					else
8918
-						$objects[$id-1]=array($merged[0],new TCompositeLiteral($merged[1]));
8918
+						$objects[$id - 1]=array($merged[0], new TCompositeLiteral($merged[1]));
8919 8919
 				}
8920 8920
 				if(isset($object[2]))
8921 8921
 				{
@@ -8925,7 +8925,7 @@  discard block
 block discarded – undo
8925 8925
 				else
8926 8926
 				{
8927 8927
 					$parent=$object[0];
8928
-					$merged=array($parent,array($object[1]));
8928
+					$merged=array($parent, array($object[1]));
8929 8929
 				}
8930 8930
 			}
8931 8931
 			else
@@ -8934,57 +8934,57 @@  discard block
 block discarded – undo
8934 8934
 		if($parent!==null)
8935 8935
 		{
8936 8936
 			if(count($merged[1])===1 && is_string($merged[1][0]))
8937
-				$objects[$id]=array($merged[0],$merged[1][0]);
8937
+				$objects[$id]=array($merged[0], $merged[1][0]);
8938 8938
 			else
8939
-				$objects[$id]=array($merged[0],new TCompositeLiteral($merged[1]));
8939
+				$objects[$id]=array($merged[0], new TCompositeLiteral($merged[1]));
8940 8940
 		}
8941 8941
 		$tpl=$objects;
8942 8942
 		return $objects;
8943 8943
 	}
8944
-	protected function parseAttributes($str,$offset)
8944
+	protected function parseAttributes($str, $offset)
8945 8945
 	{
8946 8946
 		if($str==='')
8947 8947
 			return array();
8948 8948
 		$pattern='/([\w\.\-]+)\s*=\s*(\'.*?\'|".*?"|<%.*?%>)/msS';
8949 8949
 		$attributes=array();
8950
-		$n=preg_match_all($pattern,$str,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
8951
-		for($i=0;$i<$n;++$i)
8950
+		$n=preg_match_all($pattern, $str, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
8951
+		for($i=0; $i < $n; ++$i)
8952 8952
 		{
8953 8953
 			$match=&$matches[$i];
8954 8954
 			$name=strtolower($match[1][0]);
8955 8955
 			if(isset($attributes[$name]))
8956
-				throw new TConfigurationException('template_property_duplicated',$name);
8956
+				throw new TConfigurationException('template_property_duplicated', $name);
8957 8957
 			$value=$match[2][0];
8958
-			if(substr($name,-8,8)==='template')
8958
+			if(substr($name, -8, 8)==='template')
8959 8959
 			{
8960 8960
 				if($value[0]==='\'' || $value[0]==='"')
8961
-					$attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1);
8961
+					$attributes[$name]=$this->parseTemplateProperty(substr($value, 1, strlen($value) - 2), $match[2][1] + 1);
8962 8962
 				else
8963
-					$attributes[$name]=$this->parseTemplateProperty($value,$match[2][1]);
8963
+					$attributes[$name]=$this->parseTemplateProperty($value, $match[2][1]);
8964 8964
 			}
8965 8965
 			else
8966 8966
 			{
8967 8967
 				if($value[0]==='\'' || $value[0]==='"')
8968
-					$attributes[$name]=$this->parseAttribute(substr($value,1,strlen($value)-2));
8968
+					$attributes[$name]=$this->parseAttribute(substr($value, 1, strlen($value) - 2));
8969 8969
 				else
8970 8970
 					$attributes[$name]=$this->parseAttribute($value);
8971 8971
 			}
8972 8972
 		}
8973 8973
 		return $attributes;
8974 8974
 	}
8975
-	protected function parseTemplateProperty($content,$offset)
8975
+	protected function parseTemplateProperty($content, $offset)
8976 8976
 	{
8977
-		$line=$this->_startingLine+count(explode("\n",substr($this->_content,0,$offset)))-1;
8978
-		return array(self::CONFIG_TEMPLATE,new TTemplate($content,$this->_contextPath,$this->_tplFile,$line,false));
8977
+		$line=$this->_startingLine + count(explode("\n", substr($this->_content, 0, $offset))) - 1;
8978
+		return array(self::CONFIG_TEMPLATE, new TTemplate($content, $this->_contextPath, $this->_tplFile, $line, false));
8979 8979
 	}
8980 8980
 	protected function parseAttribute($value)
8981 8981
 	{
8982
-		if(($n=preg_match_all('/<%[#=].*?%>/msS',$value,$matches,PREG_OFFSET_CAPTURE))>0)
8982
+		if(($n=preg_match_all('/<%[#=].*?%>/msS', $value, $matches, PREG_OFFSET_CAPTURE)) > 0)
8983 8983
 		{
8984 8984
 			$isDataBind=false;
8985 8985
 			$textStart=0;
8986 8986
 			$expr='';
8987
-			for($i=0;$i<$n;++$i)
8987
+			for($i=0; $i < $n; ++$i)
8988 8988
 			{
8989 8989
 				$match=$matches[0][$i];
8990 8990
 				$token=$match[0];
@@ -8992,133 +8992,133 @@  discard block
 block discarded – undo
8992 8992
 				$length=strlen($token);
8993 8993
 				if($token[2]==='#')
8994 8994
 					$isDataBind=true;
8995
-				if($offset>$textStart)
8996
-					$expr.=".'".strtr(substr($value,$textStart,$offset-$textStart),array("'"=>"\\'","\\"=>"\\\\"))."'";
8997
-				$expr.='.('.substr($token,3,$length-5).')';
8998
-				$textStart=$offset+$length;
8995
+				if($offset > $textStart)
8996
+					$expr.=".'".strtr(substr($value, $textStart, $offset - $textStart), array("'"=>"\\'", "\\"=>"\\\\"))."'";
8997
+				$expr.='.('.substr($token, 3, $length - 5).')';
8998
+				$textStart=$offset + $length;
8999 8999
 			}
9000 9000
 			$length=strlen($value);
9001
-			if($length>$textStart)
9002
-				$expr.=".'".strtr(substr($value,$textStart,$length-$textStart),array("'"=>"\\'","\\"=>"\\\\"))."'";
9001
+			if($length > $textStart)
9002
+				$expr.=".'".strtr(substr($value, $textStart, $length - $textStart), array("'"=>"\\'", "\\"=>"\\\\"))."'";
9003 9003
 			if($isDataBind)
9004
-				return array(self::CONFIG_DATABIND,ltrim($expr,'.'));
9004
+				return array(self::CONFIG_DATABIND, ltrim($expr, '.'));
9005 9005
 			else
9006
-				return array(self::CONFIG_EXPRESSION,ltrim($expr,'.'));
9006
+				return array(self::CONFIG_EXPRESSION, ltrim($expr, '.'));
9007 9007
 		}
9008
-		else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value)
9008
+		else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0]===$value)
9009 9009
 		{
9010 9010
 			$value=$matches[1];
9011 9011
 			if($value[2]==='~')
9012
-				return array(self::CONFIG_ASSET,trim(substr($value,3,strlen($value)-5)));
9012
+				return array(self::CONFIG_ASSET, trim(substr($value, 3, strlen($value) - 5)));
9013 9013
 			elseif($value[2]==='[')
9014
-				return array(self::CONFIG_LOCALIZATION,trim(substr($value,3,strlen($value)-6)));
9014
+				return array(self::CONFIG_LOCALIZATION, trim(substr($value, 3, strlen($value) - 6)));
9015 9015
 			elseif($value[2]==='$')
9016
-				return array(self::CONFIG_PARAMETER,trim(substr($value,3,strlen($value)-5)));
9016
+				return array(self::CONFIG_PARAMETER, trim(substr($value, 3, strlen($value) - 5)));
9017 9017
 			elseif($value[2]==='/') {
9018
-				$literal = trim(substr($value,3,strlen($value)-5));
9019
-				return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'");
9018
+				$literal=trim(substr($value, 3, strlen($value) - 5));
9019
+				return array(self::CONFIG_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'");
9020 9020
 			}
9021 9021
 		}
9022 9022
 		else
9023 9023
 			return $value;
9024 9024
 	}
9025
-	protected function validateAttributes($type,$attributes)
9025
+	protected function validateAttributes($type, $attributes)
9026 9026
 	{
9027 9027
 		Prado::using($type);
9028
-		if(($pos=strrpos($type,'.'))!==false)
9029
-			$className=substr($type,$pos+1);
9028
+		if(($pos=strrpos($type, '.'))!==false)
9029
+			$className=substr($type, $pos + 1);
9030 9030
 		else
9031 9031
 			$className=$type;
9032 9032
 		$class=new ReflectionClass($className);
9033
-		if(is_subclass_of($className,'TControl') || $className==='TControl')
9033
+		if(is_subclass_of($className, 'TControl') || $className==='TControl')
9034 9034
 		{
9035 9035
 			foreach($attributes as $name=>$att)
9036 9036
 			{
9037
-				if(($pos=strpos($name,'.'))!==false)
9037
+				if(($pos=strpos($name, '.'))!==false)
9038 9038
 				{
9039
-										$subname=substr($name,0,$pos);
9039
+										$subname=substr($name, 0, $pos);
9040 9040
 					if(!$class->hasMethod('get'.$subname))
9041
-						throw new TConfigurationException('template_property_unknown',$type,$subname);
9041
+						throw new TConfigurationException('template_property_unknown', $type, $subname);
9042 9042
 				}
9043
-				else if(strncasecmp($name,'on',2)===0)
9043
+				else if(strncasecmp($name, 'on', 2)===0)
9044 9044
 				{
9045 9045
 										if(!$class->hasMethod($name))
9046
-						throw new TConfigurationException('template_event_unknown',$type,$name);
9046
+						throw new TConfigurationException('template_event_unknown', $type, $name);
9047 9047
 					else if(!is_string($att))
9048
-						throw new TConfigurationException('template_eventhandler_invalid',$type,$name);
9048
+						throw new TConfigurationException('template_eventhandler_invalid', $type, $name);
9049 9049
 				}
9050 9050
 				else
9051 9051
 				{
9052
-										if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) )
9052
+										if(!($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class, 'set'.$name)))
9053 9053
 					{
9054
-						if ($class->hasMethod('get'.$name) || $class->hasMethod('getjs'.$name))
9055
-							throw new TConfigurationException('template_property_readonly',$type,$name);
9054
+						if($class->hasMethod('get'.$name) || $class->hasMethod('getjs'.$name))
9055
+							throw new TConfigurationException('template_property_readonly', $type, $name);
9056 9056
 						else
9057
-							throw new TConfigurationException('template_property_unknown',$type,$name);
9057
+							throw new TConfigurationException('template_property_unknown', $type, $name);
9058 9058
 					}
9059 9059
 					else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION)
9060 9060
 					{
9061
-						if(strcasecmp($name,'id')===0)
9062
-							throw new TConfigurationException('template_controlid_invalid',$type);
9063
-						else if(strcasecmp($name,'skinid')===0)
9064
-							throw new TConfigurationException('template_controlskinid_invalid',$type);
9061
+						if(strcasecmp($name, 'id')===0)
9062
+							throw new TConfigurationException('template_controlid_invalid', $type);
9063
+						else if(strcasecmp($name, 'skinid')===0)
9064
+							throw new TConfigurationException('template_controlskinid_invalid', $type);
9065 9065
 					}
9066 9066
 				}
9067 9067
 			}
9068 9068
 		}
9069
-		else if(is_subclass_of($className,'TComponent') || $className==='TComponent')
9069
+		else if(is_subclass_of($className, 'TComponent') || $className==='TComponent')
9070 9070
 		{
9071 9071
 			foreach($attributes as $name=>$att)
9072 9072
 			{
9073 9073
 				if(is_array($att) && ($att[0]===self::CONFIG_DATABIND))
9074
-					throw new TConfigurationException('template_databind_forbidden',$type,$name);
9075
-				if(($pos=strpos($name,'.'))!==false)
9074
+					throw new TConfigurationException('template_databind_forbidden', $type, $name);
9075
+				if(($pos=strpos($name, '.'))!==false)
9076 9076
 				{
9077
-										$subname=substr($name,0,$pos);
9077
+										$subname=substr($name, 0, $pos);
9078 9078
 					if(!$class->hasMethod('get'.$subname))
9079
-						throw new TConfigurationException('template_property_unknown',$type,$subname);
9079
+						throw new TConfigurationException('template_property_unknown', $type, $subname);
9080 9080
 				}
9081
-				else if(strncasecmp($name,'on',2)===0)
9082
-					throw new TConfigurationException('template_event_forbidden',$type,$name);
9081
+				else if(strncasecmp($name, 'on', 2)===0)
9082
+					throw new TConfigurationException('template_event_forbidden', $type, $name);
9083 9083
 				else
9084 9084
 				{
9085
-										if(strcasecmp($name,'id')!==0 && !($class->hasMethod('set'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)))
9085
+										if(strcasecmp($name, 'id')!==0 && !($class->hasMethod('set'.$name) || $this->isClassBehaviorMethod($class, 'set'.$name)))
9086 9086
 					{
9087 9087
 						if($class->hasMethod('get'.$name))
9088
-							throw new TConfigurationException('template_property_readonly',$type,$name);
9088
+							throw new TConfigurationException('template_property_readonly', $type, $name);
9089 9089
 						else
9090
-							throw new TConfigurationException('template_property_unknown',$type,$name);
9090
+							throw new TConfigurationException('template_property_unknown', $type, $name);
9091 9091
 					}
9092 9092
 				}
9093 9093
 			}
9094 9094
 		}
9095 9095
 		else
9096
-			throw new TConfigurationException('template_component_required',$type);
9096
+			throw new TConfigurationException('template_component_required', $type);
9097 9097
 	}
9098 9098
 	public function getIncludedFiles()
9099 9099
 	{
9100 9100
 		return $this->_includedFiles;
9101 9101
 	}
9102
-	protected function handleException($e,$line,$input=null)
9102
+	protected function handleException($e, $line, $input=null)
9103 9103
 	{
9104 9104
 		$srcFile=$this->_tplFile;
9105
-		if(($n=count($this->_includedFiles))>0) 		{
9106
-			for($i=$n-1;$i>=0;--$i)
9105
+		if(($n=count($this->_includedFiles)) > 0) {
9106
+			for($i=$n - 1; $i >= 0; --$i)
9107 9107
 			{
9108
-				if($this->_includeAtLine[$i]<=$line)
9108
+				if($this->_includeAtLine[$i] <= $line)
9109 9109
 				{
9110
-					if($line<$this->_includeAtLine[$i]+$this->_includeLines[$i])
9110
+					if($line < $this->_includeAtLine[$i] + $this->_includeLines[$i])
9111 9111
 					{
9112
-						$line=$line-$this->_includeAtLine[$i]+1;
9112
+						$line=$line - $this->_includeAtLine[$i] + 1;
9113 9113
 						$srcFile=$this->_includedFiles[$i];
9114 9114
 						break;
9115 9115
 					}
9116 9116
 					else
9117
-						$line=$line-$this->_includeLines[$i]+1;
9117
+						$line=$line - $this->_includeLines[$i] + 1;
9118 9118
 				}
9119 9119
 			}
9120 9120
 		}
9121
-		$exception=new TTemplateException('template_format_invalid',$e->getMessage());
9121
+		$exception=new TTemplateException('template_format_invalid', $e->getMessage());
9122 9122
 		$exception->setLineNumber($line);
9123 9123
 		if(!empty($srcFile))
9124 9124
 			$exception->setTemplateFile($srcFile);
@@ -9128,34 +9128,34 @@  discard block
 block discarded – undo
9128 9128
 	}
9129 9129
 	protected function preprocess($input)
9130 9130
 	{
9131
-		if($n=preg_match_all('/<%include(.*?)%>/',$input,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE))
9131
+		if($n=preg_match_all('/<%include(.*?)%>/', $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
9132 9132
 		{
9133
-			for($i=0;$i<$n;++$i)
9133
+			for($i=0; $i < $n; ++$i)
9134 9134
 			{
9135
-				$filePath=Prado::getPathOfNamespace(trim($matches[$i][1][0]),TTemplateManager::TEMPLATE_FILE_EXT);
9135
+				$filePath=Prado::getPathOfNamespace(trim($matches[$i][1][0]), TTemplateManager::TEMPLATE_FILE_EXT);
9136 9136
 				if($filePath!==null && is_file($filePath))
9137 9137
 					$this->_includedFiles[]=$filePath;
9138 9138
 				else
9139 9139
 				{
9140
-					$errorLine=count(explode("\n",substr($input,0,$matches[$i][0][1]+1)));
9141
-					$this->handleException(new TConfigurationException('template_include_invalid',trim($matches[$i][1][0])),$errorLine,$input);
9140
+					$errorLine=count(explode("\n", substr($input, 0, $matches[$i][0][1] + 1)));
9141
+					$this->handleException(new TConfigurationException('template_include_invalid', trim($matches[$i][1][0])), $errorLine, $input);
9142 9142
 				}
9143 9143
 			}
9144 9144
 			$base=0;
9145
-			for($i=0;$i<$n;++$i)
9145
+			for($i=0; $i < $n; ++$i)
9146 9146
 			{
9147 9147
 				$ext=file_get_contents($this->_includedFiles[$i]);
9148 9148
 				$length=strlen($matches[$i][0][0]);
9149
-				$offset=$base+$matches[$i][0][1];
9150
-				$this->_includeAtLine[$i]=count(explode("\n",substr($input,0,$offset)));
9151
-				$this->_includeLines[$i]=count(explode("\n",$ext));
9152
-				$input=substr_replace($input,$ext,$offset,$length);
9153
-				$base+=strlen($ext)-$length;
9149
+				$offset=$base + $matches[$i][0][1];
9150
+				$this->_includeAtLine[$i]=count(explode("\n", substr($input, 0, $offset)));
9151
+				$this->_includeLines[$i]=count(explode("\n", $ext));
9152
+				$input=substr_replace($input, $ext, $offset, $length);
9153
+				$base+=strlen($ext) - $length;
9154 9154
 			}
9155 9155
 		}
9156 9156
 		return $input;
9157 9157
 	}
9158
-	protected function isClassBehaviorMethod(ReflectionClass $class,$method)
9158
+	protected function isClassBehaviorMethod(ReflectionClass $class, $method)
9159 9159
 	{
9160 9160
 	  $component=new ReflectionClass('TComponent');
9161 9161
 	  $behaviors=$component->getStaticProperties();
@@ -9166,7 +9166,7 @@  discard block
 block discarded – undo
9166 9166
 	    if(strtolower($class->getShortName())!==$name && !$class->isSubclassOf($name)) continue;
9167 9167
 	    foreach($list as $param)
9168 9168
 	    {
9169
-	      if(method_exists($param->getBehavior(),$method))
9169
+	      if(method_exists($param->getBehavior(), $method))
9170 9170
 	        return true;
9171 9171
 	    }
9172 9172
 	  }
@@ -9176,7 +9176,7 @@  discard block
 block discarded – undo
9176 9176
 class TThemeManager extends TModule
9177 9177
 {
9178 9178
 	const DEFAULT_BASEPATH='themes';
9179
-	const DEFAULT_THEMECLASS = 'TTheme';
9179
+	const DEFAULT_THEMECLASS='TTheme';
9180 9180
 	private $_themeClass=self::DEFAULT_THEMECLASS;
9181 9181
 	private $_initialized=false;
9182 9182
 	private $_basePath=null;
@@ -9193,11 +9193,11 @@  discard block
 block discarded – undo
9193 9193
 	public function getTheme($name)
9194 9194
 	{
9195 9195
 		$themePath=$this->getBasePath().DIRECTORY_SEPARATOR.$name;
9196
-		$themeUrl=rtrim($this->getBaseUrl(),'/').'/'.$name;
9196
+		$themeUrl=rtrim($this->getBaseUrl(), '/').'/'.$name;
9197 9197
 		return Prado::createComponent($this->getThemeClass(), $themePath, $themeUrl);
9198 9198
 	}
9199 9199
 	public function setThemeClass($class) {
9200
-		$this->_themeClass = $class===null ? self::DEFAULT_THEMECLASS : (string)$class;
9200
+		$this->_themeClass=$class===null ? self::DEFAULT_THEMECLASS : (string) $class;
9201 9201
 	}
9202 9202
 	public function getThemeClass() {
9203 9203
 		return $this->_themeClass;
@@ -9221,7 +9221,7 @@  discard block
 block discarded – undo
9221 9221
 		{
9222 9222
 			$this->_basePath=dirname($this->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
9223 9223
 			if(($basePath=realpath($this->_basePath))===false || !is_dir($basePath))
9224
-				throw new TConfigurationException('thememanager_basepath_invalid2',$this->_basePath);
9224
+				throw new TConfigurationException('thememanager_basepath_invalid2', $this->_basePath);
9225 9225
 			$this->_basePath=$basePath;
9226 9226
 		}
9227 9227
 		return $this->_basePath;
@@ -9234,7 +9234,7 @@  discard block
 block discarded – undo
9234 9234
 		{
9235 9235
 			$this->_basePath=Prado::getPathOfNamespace($value);
9236 9236
 			if($this->_basePath===null || !is_dir($this->_basePath))
9237
-				throw new TInvalidDataValueException('thememanager_basepath_invalid',$value);
9237
+				throw new TInvalidDataValueException('thememanager_basepath_invalid', $value);
9238 9238
 		}
9239 9239
 	}
9240 9240
 	public function getBaseUrl()
@@ -9243,16 +9243,16 @@  discard block
 block discarded – undo
9243 9243
 		{
9244 9244
 			$appPath=dirname($this->getRequest()->getApplicationFilePath());
9245 9245
 			$basePath=$this->getBasePath();
9246
-			if(strpos($basePath,$appPath)===false)
9246
+			if(strpos($basePath, $appPath)===false)
9247 9247
 				throw new TConfigurationException('thememanager_baseurl_required');
9248
-			$appUrl=rtrim(dirname($this->getRequest()->getApplicationUrl()),'/\\');
9249
-			$this->_baseUrl=$appUrl.strtr(substr($basePath,strlen($appPath)),'\\','/');
9248
+			$appUrl=rtrim(dirname($this->getRequest()->getApplicationUrl()), '/\\');
9249
+			$this->_baseUrl=$appUrl.strtr(substr($basePath, strlen($appPath)), '\\', '/');
9250 9250
 		}
9251 9251
 		return $this->_baseUrl;
9252 9252
 	}
9253 9253
 	public function setBaseUrl($value)
9254 9254
 	{
9255
-		$this->_baseUrl=rtrim($value,'/');
9255
+		$this->_baseUrl=rtrim($value, '/');
9256 9256
 	}
9257 9257
 }
9258 9258
 class TTheme extends TApplicationComponent implements ITheme
@@ -9265,7 +9265,7 @@  discard block
 block discarded – undo
9265 9265
 	private $_name='';
9266 9266
 	private $_cssFiles=array();
9267 9267
 	private $_jsFiles=array();
9268
-	public function __construct($themePath,$themeUrl)
9268
+	public function __construct($themePath, $themeUrl)
9269 9269
 	{
9270 9270
 		$this->_themeUrl=$themeUrl;
9271 9271
 		$this->_themePath=realpath($themePath);
@@ -9276,21 +9276,21 @@  discard block
 block discarded – undo
9276 9276
 			$array=$cache->get(self::THEME_CACHE_PREFIX.$themePath);
9277 9277
 			if(is_array($array))
9278 9278
 			{
9279
-				list($skins,$cssFiles,$jsFiles,$timestamp)=$array;
9279
+				list($skins, $cssFiles, $jsFiles, $timestamp)=$array;
9280 9280
 				if($this->getApplication()->getMode()!==TApplicationMode::Performance)
9281 9281
 				{
9282 9282
 					if(($dir=opendir($themePath))===false)
9283
-						throw new TIOException('theme_path_inexistent',$themePath);
9283
+						throw new TIOException('theme_path_inexistent', $themePath);
9284 9284
 					$cacheValid=true;
9285 9285
 					while(($file=readdir($dir))!==false)
9286 9286
 					{
9287 9287
 						if($file==='.' || $file==='..')
9288 9288
 							continue;
9289
-						else if(basename($file,'.css')!==$file)
9289
+						else if(basename($file, '.css')!==$file)
9290 9290
 							$this->_cssFiles[]=$themeUrl.'/'.$file;
9291
-						else if(basename($file,'.js')!==$file)
9291
+						else if(basename($file, '.js')!==$file)
9292 9292
 							$this->_jsFiles[]=$themeUrl.'/'.$file;
9293
-						else if(basename($file,self::SKIN_FILE_EXT)!==$file && filemtime($themePath.DIRECTORY_SEPARATOR.$file)>$timestamp)
9293
+						else if(basename($file, self::SKIN_FILE_EXT)!==$file && filemtime($themePath.DIRECTORY_SEPARATOR.$file) > $timestamp)
9294 9294
 						{
9295 9295
 							$cacheValid=false;
9296 9296
 							break;
@@ -9315,28 +9315,28 @@  discard block
 block discarded – undo
9315 9315
 			$this->_jsFiles=array();
9316 9316
 			$this->_skins=array();
9317 9317
 			if(($dir=opendir($themePath))===false)
9318
-				throw new TIOException('theme_path_inexistent',$themePath);
9318
+				throw new TIOException('theme_path_inexistent', $themePath);
9319 9319
 			while(($file=readdir($dir))!==false)
9320 9320
 			{
9321 9321
 				if($file==='.' || $file==='..')
9322 9322
 					continue;
9323
-				else if(basename($file,'.css')!==$file)
9323
+				else if(basename($file, '.css')!==$file)
9324 9324
 					$this->_cssFiles[]=$themeUrl.'/'.$file;
9325
-				else if(basename($file,'.js')!==$file)
9325
+				else if(basename($file, '.js')!==$file)
9326 9326
 					$this->_jsFiles[]=$themeUrl.'/'.$file;
9327
-				else if(basename($file,self::SKIN_FILE_EXT)!==$file)
9327
+				else if(basename($file, self::SKIN_FILE_EXT)!==$file)
9328 9328
 				{
9329
-					$template=new TTemplate(file_get_contents($themePath.'/'.$file),$themePath,$themePath.'/'.$file);
9329
+					$template=new TTemplate(file_get_contents($themePath.'/'.$file), $themePath, $themePath.'/'.$file);
9330 9330
 					foreach($template->getItems() as $skin)
9331 9331
 					{
9332 9332
 						if(!isset($skin[2]))  							continue;
9333 9333
 						else if($skin[0]!==-1)
9334
-							throw new TConfigurationException('theme_control_nested',$skin[1],dirname($themePath));
9334
+							throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath));
9335 9335
 						$type=$skin[1];
9336
-						$id=isset($skin[2]['skinid'])?$skin[2]['skinid']:0;
9336
+						$id=isset($skin[2]['skinid']) ? $skin[2]['skinid'] : 0;
9337 9337
 						unset($skin[2]['skinid']);
9338 9338
 						if(isset($this->_skins[$type][$id]))
9339
-							throw new TConfigurationException('theme_skinid_duplicated',$type,$id,dirname($themePath));
9339
+							throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath));
9340 9340
 						$this->_skins[$type][$id]=$skin[2];
9341 9341
 					}
9342 9342
 				}
@@ -9345,7 +9345,7 @@  discard block
 block discarded – undo
9345 9345
 			sort($this->_cssFiles);
9346 9346
 			sort($this->_jsFiles);
9347 9347
 			if($cache!==null)
9348
-				$cache->set(self::THEME_CACHE_PREFIX.$themePath,array($this->_skins,$this->_cssFiles,$this->_jsFiles,time()));
9348
+				$cache->set(self::THEME_CACHE_PREFIX.$themePath, array($this->_skins, $this->_cssFiles, $this->_jsFiles, time()));
9349 9349
 		}
9350 9350
 	}
9351 9351
 	public function getName()
@@ -9354,7 +9354,7 @@  discard block
 block discarded – undo
9354 9354
 	}
9355 9355
 	protected function setName($value)
9356 9356
 	{
9357
-		$this->_name = $value;
9357
+		$this->_name=$value;
9358 9358
 	}
9359 9359
 	public function getBaseUrl()
9360 9360
 	{
@@ -9362,7 +9362,7 @@  discard block
 block discarded – undo
9362 9362
 	}
9363 9363
 	protected function setBaseUrl($value)
9364 9364
 	{
9365
-		$this->_themeUrl=rtrim($value,'/');
9365
+		$this->_themeUrl=rtrim($value, '/');
9366 9366
 	}
9367 9367
 	public function getBasePath()
9368 9368
 	{
@@ -9378,7 +9378,7 @@  discard block
 block discarded – undo
9378 9378
 	}
9379 9379
 	protected function setSkins($value)
9380 9380
 	{
9381
-		$this->_skins = $value;
9381
+		$this->_skins=$value;
9382 9382
 	}
9383 9383
 	public function applySkin($control)
9384 9384
 	{
@@ -9397,28 +9397,28 @@  discard block
 block discarded – undo
9397 9397
 							$value=$this->evaluateExpression($value[1]);
9398 9398
 							break;
9399 9399
 						case TTemplate::CONFIG_ASSET:
9400
-							$value=$this->_themeUrl.'/'.ltrim($value[1],'/');
9400
+							$value=$this->_themeUrl.'/'.ltrim($value[1], '/');
9401 9401
 							break;
9402 9402
 						case TTemplate::CONFIG_DATABIND:
9403
-							$control->bindProperty($name,$value[1]);
9403
+							$control->bindProperty($name, $value[1]);
9404 9404
 							break;
9405 9405
 						case TTemplate::CONFIG_PARAMETER:
9406
-							$control->setSubProperty($name,$this->getApplication()->getParameters()->itemAt($value[1]));
9406
+							$control->setSubProperty($name, $this->getApplication()->getParameters()->itemAt($value[1]));
9407 9407
 							break;
9408 9408
 						case TTemplate::CONFIG_TEMPLATE:
9409
-							$control->setSubProperty($name,$value[1]);
9409
+							$control->setSubProperty($name, $value[1]);
9410 9410
 							break;
9411 9411
 						case TTemplate::CONFIG_LOCALIZATION:
9412
-							$control->setSubProperty($name,Prado::localize($value[1]));
9412
+							$control->setSubProperty($name, Prado::localize($value[1]));
9413 9413
 							break;
9414 9414
 						default:
9415
-							throw new TConfigurationException('theme_tag_unexpected',$name,$value[0]);
9415
+							throw new TConfigurationException('theme_tag_unexpected', $name, $value[0]);
9416 9416
 							break;
9417 9417
 					}
9418 9418
 				}
9419 9419
 				if(!is_array($value))
9420 9420
 				{
9421
-					if(strpos($name,'.')===false)						{
9421
+					if(strpos($name, '.')===false) {
9422 9422
 						if($control->hasProperty($name))
9423 9423
 						{
9424 9424
 							if($control->canSetProperty($name))
@@ -9427,12 +9427,12 @@  discard block
 block discarded – undo
9427 9427
 								$control->$setter($value);
9428 9428
 							}
9429 9429
 							else
9430
-								throw new TConfigurationException('theme_property_readonly',$type,$name);
9430
+								throw new TConfigurationException('theme_property_readonly', $type, $name);
9431 9431
 						}
9432 9432
 						else
9433
-							throw new TConfigurationException('theme_property_undefined',$type,$name);
9433
+							throw new TConfigurationException('theme_property_undefined', $type, $name);
9434 9434
 					}
9435
-					else							$control->setSubProperty($name,$value);
9435
+					else							$control->setSubProperty($name, $value);
9436 9436
 				}
9437 9437
 			}
9438 9438
 			return true;
@@ -9495,15 +9495,15 @@  discard block
 block discarded – undo
9495 9495
 		$pagePath=$this->getRequestedPagePath();
9496 9496
 				foreach($config->getExternalConfigurations() as $filePath=>$params)
9497 9497
 		{
9498
-			list($configPagePath,$condition)=$params;
9498
+			list($configPagePath, $condition)=$params;
9499 9499
 			if($condition!==true)
9500 9500
 				$condition=$this->evaluateExpression($condition);
9501 9501
 			if($condition)
9502 9502
 			{
9503
-				if(($path=Prado::getPathOfNamespace($filePath,Prado::getApplication()->getConfigurationFileExt()))===null || !is_file($path))
9504
-					throw new TConfigurationException('pageservice_includefile_invalid',$filePath);
9503
+				if(($path=Prado::getPathOfNamespace($filePath, Prado::getApplication()->getConfigurationFileExt()))===null || !is_file($path))
9504
+					throw new TConfigurationException('pageservice_includefile_invalid', $filePath);
9505 9505
 				$c=new TPageConfiguration($pagePath);
9506
-				$c->loadFromFile($path,$configPagePath);
9506
+				$c->loadFromFile($path, $configPagePath);
9507 9507
 				$this->applyConfiguration($c);
9508 9508
 			}
9509 9509
 		}
@@ -9525,9 +9525,9 @@  discard block
 block discarded – undo
9525 9525
 			if($config!==null)
9526 9526
 			{
9527 9527
 				if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
9528
-					$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
9528
+					$pageConfig->loadPageConfigurationFromPhp($config, $application->getBasePath(), '');
9529 9529
 				else
9530
-					$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
9530
+					$pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), '');
9531 9531
 			}
9532 9532
 			$pageConfig->loadFromFiles($this->getBasePath());
9533 9533
 		}
@@ -9538,21 +9538,21 @@  discard block
 block discarded – undo
9538 9538
 			$arr=$cache->get(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath);
9539 9539
 			if(is_array($arr))
9540 9540
 			{
9541
-				list($pageConfig,$timestamps)=$arr;
9541
+				list($pageConfig, $timestamps)=$arr;
9542 9542
 				if($application->getMode()!==TApplicationMode::Performance)
9543 9543
 				{
9544 9544
 					foreach($timestamps as $fileName=>$timestamp)
9545 9545
 					{
9546
-						if($fileName===0) 						{
9546
+						if($fileName===0) {
9547 9547
 							$appConfigFile=$application->getConfigurationFile();
9548
-							$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
9549
-							if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0]))
9548
+							$currentTimestamp[0]=$appConfigFile===null ? 0 : @filemtime($appConfigFile);
9549
+							if($currentTimestamp[0] > $timestamp || ($timestamp > 0 && !$currentTimestamp[0]))
9550 9550
 								$configCached=false;
9551 9551
 						}
9552 9552
 						else
9553 9553
 						{
9554 9554
 							$currentTimestamp[$fileName]=@filemtime($fileName);
9555
-							if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName]))
9555
+							if($currentTimestamp[$fileName] > $timestamp || ($timestamp > 0 && !$currentTimestamp[$fileName]))
9556 9556
 								$configCached=false;
9557 9557
 						}
9558 9558
 					}
@@ -9561,9 +9561,9 @@  discard block
 block discarded – undo
9561 9561
 			else
9562 9562
 			{
9563 9563
 				$configCached=false;
9564
-				$paths=explode('.',$pagePath);
9564
+				$paths=explode('.', $pagePath);
9565 9565
 				$configPath=$this->getBasePath();
9566
-				$fileName = $this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
9566
+				$fileName=$this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
9567 9567
 					? self::CONFIG_FILE_PHP
9568 9568
 					: self::CONFIG_FILE_XML;
9569 9569
 				foreach($paths as $path)
@@ -9573,7 +9573,7 @@  discard block
 block discarded – undo
9573 9573
 					$configPath.=DIRECTORY_SEPARATOR.$path;
9574 9574
 				}
9575 9575
 				$appConfigFile=$application->getConfigurationFile();
9576
-				$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
9576
+				$currentTimestamp[0]=$appConfigFile===null ? 0 : @filemtime($appConfigFile);
9577 9577
 			}
9578 9578
 			if(!$configCached)
9579 9579
 			{
@@ -9581,12 +9581,12 @@  discard block
 block discarded – undo
9581 9581
 				if($config!==null)
9582 9582
 				{
9583 9583
 					if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
9584
-						$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
9584
+						$pageConfig->loadPageConfigurationFromPhp($config, $application->getBasePath(), '');
9585 9585
 					else
9586
-						$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
9586
+						$pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), '');
9587 9587
 				}
9588 9588
 				$pageConfig->loadFromFiles($this->getBasePath());
9589
-				$cache->set(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath,array($pageConfig,$currentTimestamp));
9589
+				$cache->set(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath, array($pageConfig, $currentTimestamp));
9590 9590
 			}
9591 9591
 		}
9592 9592
 		return $pageConfig;
@@ -9621,9 +9621,9 @@  discard block
 block discarded – undo
9621 9621
 	{
9622 9622
 		if($this->_pagePath===null)
9623 9623
 		{
9624
-			$this->_pagePath=strtr($this->determineRequestedPagePath(),'/\\','..');
9624
+			$this->_pagePath=strtr($this->determineRequestedPagePath(), '/\\', '..');
9625 9625
 			if(empty($this->_pagePath))
9626
-				throw new THttpException(404,'pageservice_page_required');
9626
+				throw new THttpException(404, 'pageservice_page_required');
9627 9627
 		}
9628 9628
 		return $this->_pagePath;
9629 9629
 	}
@@ -9655,7 +9655,7 @@  discard block
 block discarded – undo
9655 9655
 			{
9656 9656
 				$basePath=$this->getApplication()->getBasePath().DIRECTORY_SEPARATOR.self::FALLBACK_BASEPATH;
9657 9657
 				if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath))
9658
-					throw new TConfigurationException('pageservice_basepath_invalid',$basePath);
9658
+					throw new TConfigurationException('pageservice_basepath_invalid', $basePath);
9659 9659
 			}
9660 9660
 		}
9661 9661
 		return $this->_basePath;
@@ -9665,7 +9665,7 @@  discard block
 block discarded – undo
9665 9665
 		if($this->_initialized)
9666 9666
 			throw new TInvalidOperationException('pageservice_basepath_unchangeable');
9667 9667
 		else if(($path=Prado::getPathOfNamespace($value))===null || !is_dir($path))
9668
-			throw new TConfigurationException('pageservice_basepath_invalid',$value);
9668
+			throw new TConfigurationException('pageservice_basepath_invalid', $value);
9669 9669
 		$this->_basePath=realpath($path);
9670 9670
 	}
9671 9671
 	public function setBasePageClass($value)
@@ -9687,45 +9687,45 @@  discard block
 block discarded – undo
9687 9687
 	public function run()
9688 9688
 	{
9689 9689
 		$this->_page=$this->createPage($this->getRequestedPagePath());
9690
-		$this->runPage($this->_page,$this->_properties);
9690
+		$this->runPage($this->_page, $this->_properties);
9691 9691
 	}
9692 9692
 	protected function createPage($pagePath)
9693 9693
 	{
9694
-		$path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath,'.',DIRECTORY_SEPARATOR);
9694
+		$path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath, '.', DIRECTORY_SEPARATOR);
9695 9695
 		$hasTemplateFile=is_file($path.self::PAGE_FILE_EXT);
9696 9696
 		$hasClassFile=is_file($path.Prado::CLASS_FILE_EXT);
9697 9697
 		if(!$hasTemplateFile && !$hasClassFile)
9698
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
9698
+			throw new THttpException(404, 'pageservice_page_unknown', $pagePath);
9699 9699
 		if($hasClassFile)
9700 9700
 		{
9701 9701
 			$className=basename($path);
9702
-			if(!class_exists($className,false))
9702
+			if(!class_exists($className, false))
9703 9703
 				include_once($path.Prado::CLASS_FILE_EXT);
9704 9704
 		}
9705 9705
 		else
9706 9706
 		{
9707 9707
 			$className=$this->getBasePageClass();
9708 9708
 			Prado::using($className);
9709
-			if(($pos=strrpos($className,'.'))!==false)
9710
-				$className=substr($className,$pos+1);
9709
+			if(($pos=strrpos($className, '.'))!==false)
9710
+				$className=substr($className, $pos + 1);
9711 9711
 		}
9712
- 		if(!class_exists($className,false) || ($className!=='TPage' && !is_subclass_of($className,'TPage')))
9713
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
9712
+ 		if(!class_exists($className, false) || ($className!=='TPage' && !is_subclass_of($className, 'TPage')))
9713
+			throw new THttpException(404, 'pageservice_page_unknown', $pagePath);
9714 9714
 		$page=Prado::createComponent($className);
9715 9715
 		$page->setPagePath($pagePath);
9716 9716
 		if($hasTemplateFile)
9717 9717
 			$page->setTemplate($this->getTemplateManager()->getTemplateByFileName($path.self::PAGE_FILE_EXT));
9718 9718
 		return $page;
9719 9719
 	}
9720
-	protected function runPage($page,$properties)
9720
+	protected function runPage($page, $properties)
9721 9721
 	{
9722 9722
 		foreach($properties as $name=>$value)
9723
-			$page->setSubProperty($name,$value);
9723
+			$page->setSubProperty($name, $value);
9724 9724
 		$page->run($this->getResponse()->createHtmlWriter());
9725 9725
 	}
9726
-	public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true)
9726
+	public function constructUrl($pagePath, $getParams=null, $encodeAmpersand=true, $encodeGetItems=true)
9727 9727
 	{
9728
-		return $this->getRequest()->constructUrl($this->getID(),$pagePath,$getParams,$encodeAmpersand,$encodeGetItems);
9728
+		return $this->getRequest()->constructUrl($this->getID(), $pagePath, $getParams, $encodeAmpersand, $encodeGetItems);
9729 9729
 	}
9730 9730
 }
9731 9731
 class TPageConfiguration extends TComponent
@@ -9757,89 +9757,89 @@  discard block
 block discarded – undo
9757 9757
 	}
9758 9758
 	public function loadFromFiles($basePath)
9759 9759
 	{
9760
-		$paths=explode('.',$this->_pagePath);
9760
+		$paths=explode('.', $this->_pagePath);
9761 9761
 		$page=array_pop($paths);
9762 9762
 		$path=$basePath;
9763 9763
 		$configPagePath='';
9764
-		$fileName = Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
9764
+		$fileName=Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
9765 9765
 			? TPageService::CONFIG_FILE_PHP
9766 9766
 			: TPageService::CONFIG_FILE_XML;
9767 9767
 		foreach($paths as $p)
9768 9768
 		{
9769
-			$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName,$configPagePath);
9769
+			$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName, $configPagePath);
9770 9770
 			$path.=DIRECTORY_SEPARATOR.$p;
9771 9771
 			if($configPagePath==='')
9772 9772
 				$configPagePath=$p;
9773 9773
 			else
9774 9774
 				$configPagePath.='.'.$p;
9775 9775
 		}
9776
-		$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName,$configPagePath);
9776
+		$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName, $configPagePath);
9777 9777
 		$this->_rules=new TAuthorizationRuleCollection($this->_rules);
9778 9778
 	}
9779
-	public function loadFromFile($fname,$configPagePath)
9779
+	public function loadFromFile($fname, $configPagePath)
9780 9780
 	{
9781 9781
 		if(empty($fname) || !is_file($fname))
9782 9782
 			return;
9783 9783
 		if(Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
9784 9784
 		{
9785
-			$fcontent = include $fname;
9786
-			$this->loadFromPhp($fcontent,dirname($fname),$configPagePath);
9785
+			$fcontent=include $fname;
9786
+			$this->loadFromPhp($fcontent, dirname($fname), $configPagePath);
9787 9787
 		}
9788 9788
 		else
9789 9789
 		{
9790 9790
 			$dom=new TXmlDocument;
9791 9791
 			if($dom->loadFromFile($fname))
9792
-				$this->loadFromXml($dom,dirname($fname),$configPagePath);
9792
+				$this->loadFromXml($dom, dirname($fname), $configPagePath);
9793 9793
 			else
9794
-				throw new TConfigurationException('pageserviceconf_file_invalid',$fname);
9794
+				throw new TConfigurationException('pageserviceconf_file_invalid', $fname);
9795 9795
 		}
9796 9796
 	}
9797
-	public function loadFromPhp($config,$configPath,$configPagePath)
9797
+	public function loadFromPhp($config, $configPath, $configPagePath)
9798 9798
 	{
9799
-		$this->loadApplicationConfigurationFromPhp($config,$configPath);
9800
-		$this->loadPageConfigurationFromPhp($config,$configPath,$configPagePath);
9799
+		$this->loadApplicationConfigurationFromPhp($config, $configPath);
9800
+		$this->loadPageConfigurationFromPhp($config, $configPath, $configPagePath);
9801 9801
 	}
9802
-	public function loadFromXml($dom,$configPath,$configPagePath)
9802
+	public function loadFromXml($dom, $configPath, $configPagePath)
9803 9803
 	{
9804
-		$this->loadApplicationConfigurationFromXml($dom,$configPath);
9805
-		$this->loadPageConfigurationFromXml($dom,$configPath,$configPagePath);
9804
+		$this->loadApplicationConfigurationFromXml($dom, $configPath);
9805
+		$this->loadPageConfigurationFromXml($dom, $configPath, $configPagePath);
9806 9806
 	}
9807
-	public function loadApplicationConfigurationFromPhp($config,$configPath)
9807
+	public function loadApplicationConfigurationFromPhp($config, $configPath)
9808 9808
 	{
9809 9809
 		$appConfig=new TApplicationConfiguration;
9810
-		$appConfig->loadFromPhp($config,$configPath);
9810
+		$appConfig->loadFromPhp($config, $configPath);
9811 9811
 		$this->_appConfigs[]=$appConfig;
9812 9812
 	}
9813
-	public function loadApplicationConfigurationFromXml($dom,$configPath)
9813
+	public function loadApplicationConfigurationFromXml($dom, $configPath)
9814 9814
 	{
9815 9815
 		$appConfig=new TApplicationConfiguration;
9816
-		$appConfig->loadFromXml($dom,$configPath);
9816
+		$appConfig->loadFromXml($dom, $configPath);
9817 9817
 		$this->_appConfigs[]=$appConfig;
9818 9818
 	}
9819 9819
 	public function loadPageConfigurationFromPhp($config, $configPath, $configPagePath)
9820 9820
 	{
9821 9821
 				if(isset($config['authorization']) && is_array($config['authorization']))
9822 9822
 		{
9823
-			$rules = array();
9823
+			$rules=array();
9824 9824
 			foreach($config['authorization'] as $authorization)
9825 9825
 			{
9826
-				$patterns=isset($authorization['pages'])?$authorization['pages']:'';
9826
+				$patterns=isset($authorization['pages']) ? $authorization['pages'] : '';
9827 9827
 				$ruleApplies=false;
9828 9828
 				if(empty($patterns) || trim($patterns)==='*') 					$ruleApplies=true;
9829 9829
 				else
9830 9830
 				{
9831
-					foreach(explode(',',$patterns) as $pattern)
9831
+					foreach(explode(',', $patterns) as $pattern)
9832 9832
 					{
9833 9833
 						if(($pattern=trim($pattern))!=='')
9834 9834
 						{
9835 9835
 														if($configPagePath!=='')  								$pattern=$configPagePath.'.'.$pattern;
9836
-							if(strcasecmp($pattern,$this->_pagePath)===0)
9836
+							if(strcasecmp($pattern, $this->_pagePath)===0)
9837 9837
 							{
9838 9838
 								$ruleApplies=true;
9839 9839
 								break;
9840 9840
 							}
9841
-							if($pattern[strlen($pattern)-1]==='*') 							{
9842
-								if(strncasecmp($this->_pagePath,$pattern,strlen($pattern)-1)===0)
9841
+							if($pattern[strlen($pattern) - 1]==='*') {
9842
+								if(strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1)===0)
9843 9843
 								{
9844 9844
 									$ruleApplies=true;
9845 9845
 									break;
@@ -9850,56 +9850,56 @@  discard block
 block discarded – undo
9850 9850
 				}
9851 9851
 				if($ruleApplies)
9852 9852
 				{
9853
-					$action = isset($authorization['action'])?$authorization['action']:'';
9854
-					$users = isset($authorization['users'])?$authorization['users']:'';
9855
-					$roles = isset($authorization['roles'])?$authorization['roles']:'';
9856
-					$verb = isset($authorization['verb'])?$authorization['verb']:'';
9857
-					$ips = isset($authorization['ips'])?$authorization['ips']:'';
9858
-					$rules[]=new TAuthorizationRule($action,$users,$roles,$verb,$ips);
9853
+					$action=isset($authorization['action']) ? $authorization['action'] : '';
9854
+					$users=isset($authorization['users']) ? $authorization['users'] : '';
9855
+					$roles=isset($authorization['roles']) ? $authorization['roles'] : '';
9856
+					$verb=isset($authorization['verb']) ? $authorization['verb'] : '';
9857
+					$ips=isset($authorization['ips']) ? $authorization['ips'] : '';
9858
+					$rules[]=new TAuthorizationRule($action, $users, $roles, $verb, $ips);
9859 9859
 				}
9860 9860
 			}
9861
-			$this->_rules=array_merge($rules,$this->_rules);
9861
+			$this->_rules=array_merge($rules, $this->_rules);
9862 9862
 		}
9863 9863
 				if(isset($config['pages']) && is_array($config['pages']))
9864 9864
 		{
9865 9865
 			if(isset($config['pages']['properties']))
9866 9866
 			{
9867
-				$this->_properties = array_merge($this->_properties, $config['pages']['properties']);
9867
+				$this->_properties=array_merge($this->_properties, $config['pages']['properties']);
9868 9868
 				unset($config['pages']['properties']);
9869 9869
 			}
9870 9870
 			foreach($config['pages'] as $id => $page)
9871 9871
 			{
9872
-				$properties = array();
9872
+				$properties=array();
9873 9873
 				if(isset($page['properties']))
9874 9874
 				{
9875 9875
 					$properties=$page['properties'];
9876 9876
 					unset($page['properties']);
9877 9877
 				}
9878 9878
 				$matching=false;
9879
-				$id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
9880
-				if(strcasecmp($id,$this->_pagePath)===0)
9879
+				$id=($configPagePath==='') ? $id : $configPagePath.'.'.$id;
9880
+				if(strcasecmp($id, $this->_pagePath)===0)
9881 9881
 					$matching=true;
9882
-				else if($id[strlen($id)-1]==='*') 					$matching=strncasecmp($this->_pagePath,$id,strlen($id)-1)===0;
9882
+				else if($id[strlen($id) - 1]==='*') 					$matching=strncasecmp($this->_pagePath, $id, strlen($id) - 1)===0;
9883 9883
 				if($matching)
9884
-					$this->_properties=array_merge($this->_properties,$properties);
9884
+					$this->_properties=array_merge($this->_properties, $properties);
9885 9885
 			}
9886 9886
 		}
9887 9887
 				if(isset($config['includes']) && is_array($config['includes']))
9888 9888
 		{
9889 9889
 			foreach($config['includes'] as $include)
9890 9890
 			{
9891
-				$when = isset($include['when'])?true:false;
9891
+				$when=isset($include['when']) ? true : false;
9892 9892
 				if(!isset($include['file']))
9893 9893
 					throw new TConfigurationException('pageserviceconf_includefile_required');
9894
-				$filePath = $include['file'];
9894
+				$filePath=$include['file'];
9895 9895
 				if(isset($this->_includes[$filePath]))
9896
-					$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
9896
+					$this->_includes[$filePath]=array($configPagePath, '('.$this->_includes[$filePath][1].') || ('.$when.')');
9897 9897
 				else
9898
-					$this->_includes[$filePath]=array($configPagePath,$when);
9898
+					$this->_includes[$filePath]=array($configPagePath, $when);
9899 9899
 			}
9900 9900
 		}
9901 9901
 	}
9902
-	public function loadPageConfigurationFromXml($dom,$configPath,$configPagePath)
9902
+	public function loadPageConfigurationFromXml($dom, $configPath, $configPagePath)
9903 9903
 	{
9904 9904
 				if(($authorizationNode=$dom->getElementByTagName('authorization'))!==null)
9905 9905
 		{
@@ -9911,18 +9911,18 @@  discard block
 block discarded – undo
9911 9911
 				if(empty($patterns) || trim($patterns)==='*') 					$ruleApplies=true;
9912 9912
 				else
9913 9913
 				{
9914
-					foreach(explode(',',$patterns) as $pattern)
9914
+					foreach(explode(',', $patterns) as $pattern)
9915 9915
 					{
9916 9916
 						if(($pattern=trim($pattern))!=='')
9917 9917
 						{
9918 9918
 														if($configPagePath!=='')  								$pattern=$configPagePath.'.'.$pattern;
9919
-							if(strcasecmp($pattern,$this->_pagePath)===0)
9919
+							if(strcasecmp($pattern, $this->_pagePath)===0)
9920 9920
 							{
9921 9921
 								$ruleApplies=true;
9922 9922
 								break;
9923 9923
 							}
9924
-							if($pattern[strlen($pattern)-1]==='*') 							{
9925
-								if(strncasecmp($this->_pagePath,$pattern,strlen($pattern)-1)===0)
9924
+							if($pattern[strlen($pattern) - 1]==='*') {
9925
+								if(strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1)===0)
9926 9926
 								{
9927 9927
 									$ruleApplies=true;
9928 9928
 									break;
@@ -9932,26 +9932,26 @@  discard block
 block discarded – undo
9932 9932
 					}
9933 9933
 				}
9934 9934
 				if($ruleApplies)
9935
-					$rules[]=new TAuthorizationRule($node->getTagName(),$node->getAttribute('users'),$node->getAttribute('roles'),$node->getAttribute('verb'),$node->getAttribute('ips'));
9935
+					$rules[]=new TAuthorizationRule($node->getTagName(), $node->getAttribute('users'), $node->getAttribute('roles'), $node->getAttribute('verb'), $node->getAttribute('ips'));
9936 9936
 			}
9937
-			$this->_rules=array_merge($rules,$this->_rules);
9937
+			$this->_rules=array_merge($rules, $this->_rules);
9938 9938
 		}
9939 9939
 				if(($pagesNode=$dom->getElementByTagName('pages'))!==null)
9940 9940
 		{
9941
-			$this->_properties=array_merge($this->_properties,$pagesNode->getAttributes()->toArray());
9941
+			$this->_properties=array_merge($this->_properties, $pagesNode->getAttributes()->toArray());
9942 9942
 						foreach($pagesNode->getElementsByTagName('page') as $node)
9943 9943
 			{
9944 9944
 				$properties=$node->getAttributes();
9945 9945
 				$id=$properties->remove('id');
9946 9946
 				if(empty($id))
9947
-					throw new TConfigurationException('pageserviceconf_page_invalid',$configPath);
9947
+					throw new TConfigurationException('pageserviceconf_page_invalid', $configPath);
9948 9948
 				$matching=false;
9949
-				$id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
9950
-				if(strcasecmp($id,$this->_pagePath)===0)
9949
+				$id=($configPagePath==='') ? $id : $configPagePath.'.'.$id;
9950
+				if(strcasecmp($id, $this->_pagePath)===0)
9951 9951
 					$matching=true;
9952
-				else if($id[strlen($id)-1]==='*') 					$matching=strncasecmp($this->_pagePath,$id,strlen($id)-1)===0;
9952
+				else if($id[strlen($id) - 1]==='*') 					$matching=strncasecmp($this->_pagePath, $id, strlen($id) - 1)===0;
9953 9953
 				if($matching)
9954
-					$this->_properties=array_merge($this->_properties,$properties->toArray());
9954
+					$this->_properties=array_merge($this->_properties, $properties->toArray());
9955 9955
 			}
9956 9956
 		}
9957 9957
 				foreach($dom->getElementsByTagName('include') as $node)
@@ -9961,9 +9961,9 @@  discard block
 block discarded – undo
9961 9961
 			if(($filePath=$node->getAttribute('file'))===null)
9962 9962
 				throw new TConfigurationException('pageserviceconf_includefile_required');
9963 9963
 			if(isset($this->_includes[$filePath]))
9964
-				$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
9964
+				$this->_includes[$filePath]=array($configPagePath, '('.$this->_includes[$filePath][1].') || ('.$when.')');
9965 9965
 			else
9966
-				$this->_includes[$filePath]=array($configPagePath,$when);
9966
+				$this->_includes[$filePath]=array($configPagePath, $when);
9967 9967
 		}
9968 9968
 	}
9969 9969
 }
@@ -9982,9 +9982,9 @@  discard block
 block discarded – undo
9982 9982
 		if($this->_basePath===null)
9983 9983
 			$this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
9984 9984
 		if(!is_writable($this->_basePath) || !is_dir($this->_basePath))
9985
-			throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath);
9985
+			throw new TConfigurationException('assetmanager_basepath_invalid', $this->_basePath);
9986 9986
 		if($this->_baseUrl===null)
9987
-			$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()),'/\\').'/'.self::DEFAULT_BASEPATH;
9987
+			$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()), '/\\').'/'.self::DEFAULT_BASEPATH;
9988 9988
 		$application->setAssetManager($this);
9989 9989
 		$this->_initialized=true;
9990 9990
 	}
@@ -10000,7 +10000,7 @@  discard block
 block discarded – undo
10000 10000
 		{
10001 10001
 			$this->_basePath=Prado::getPathOfNamespace($value);
10002 10002
 			if($this->_basePath===null || !is_dir($this->_basePath) || !is_writable($this->_basePath))
10003
-				throw new TInvalidDataValueException('assetmanager_basepath_invalid',$value);
10003
+				throw new TInvalidDataValueException('assetmanager_basepath_invalid', $value);
10004 10004
 		}
10005 10005
 	}
10006 10006
 	public function getBaseUrl()
@@ -10012,21 +10012,21 @@  discard block
 block discarded – undo
10012 10012
 		if($this->_initialized)
10013 10013
 			throw new TInvalidOperationException('assetmanager_baseurl_unchangeable');
10014 10014
 		else
10015
-			$this->_baseUrl=rtrim($value,'/');
10015
+			$this->_baseUrl=rtrim($value, '/');
10016 10016
 	}
10017
-	public function publishFilePath($path,$checkTimestamp=false)
10017
+	public function publishFilePath($path, $checkTimestamp=false)
10018 10018
 	{
10019 10019
 		if(isset($this->_published[$path]))
10020 10020
 			return $this->_published[$path];
10021 10021
 		else if(empty($path) || ($fullpath=realpath($path))===false)
10022
-			throw new TInvalidDataValueException('assetmanager_filepath_invalid',$path);
10022
+			throw new TInvalidDataValueException('assetmanager_filepath_invalid', $path);
10023 10023
 		else if(is_file($fullpath))
10024 10024
 		{
10025 10025
 			$dir=$this->hash(dirname($fullpath));
10026 10026
 			$fileName=basename($fullpath);
10027 10027
 			$dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir;
10028 10028
 			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
10029
-				$this->copyFile($fullpath,$dst);
10029
+				$this->copyFile($fullpath, $dst);
10030 10030
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName;
10031 10031
 		}
10032 10032
 		else
@@ -10034,7 +10034,7 @@  discard block
 block discarded – undo
10034 10034
 			$dir=$this->hash($fullpath);
10035 10035
 			if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
10036 10036
 			{
10037
-				$this->copyDirectory($fullpath,$this->_basePath.DIRECTORY_SEPARATOR.$dir);
10037
+				$this->copyDirectory($fullpath, $this->_basePath.DIRECTORY_SEPARATOR.$dir);
10038 10038
 			}
10039 10039
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir;
10040 10040
 		}
@@ -10045,7 +10045,7 @@  discard block
 block discarded – undo
10045 10045
 	}
10046 10046
 	protected function setPublished($values=array())
10047 10047
 	{
10048
-		$this->_published = $values;
10048
+		$this->_published=$values;
10049 10049
 	}
10050 10050
 	public function getPublishedPath($path)
10051 10051
 	{
@@ -10065,9 +10065,9 @@  discard block
 block discarded – undo
10065 10065
 	}
10066 10066
 	protected function hash($dir)
10067 10067
 	{
10068
-		return sprintf('%x',crc32($dir.Prado::getVersion()));
10068
+		return sprintf('%x', crc32($dir.Prado::getVersion()));
10069 10069
 	}
10070
-	protected function copyFile($src,$dst)
10070
+	protected function copyFile($src, $dst)
10071 10071
 	{
10072 10072
 		if(!is_dir($dst))
10073 10073
 		{
@@ -10075,12 +10075,12 @@  discard block
 block discarded – undo
10075 10075
 			@chmod($dst, PRADO_CHMOD);
10076 10076
 		}
10077 10077
 		$dstFile=$dst.DIRECTORY_SEPARATOR.basename($src);
10078
-		if(@filemtime($dstFile)<@filemtime($src))
10078
+		if(@filemtime($dstFile) < @filemtime($src))
10079 10079
 		{
10080
-			@copy($src,$dstFile);
10080
+			@copy($src, $dstFile);
10081 10081
 		}
10082 10082
 	}
10083
-	public function copyDirectory($src,$dst)
10083
+	public function copyDirectory($src, $dst)
10084 10084
 	{
10085 10085
 		if(!is_dir($dst))
10086 10086
 		{
@@ -10095,14 +10095,14 @@  discard block
 block discarded – undo
10095 10095
 					continue;
10096 10096
 				else if(is_file($src.DIRECTORY_SEPARATOR.$file))
10097 10097
 				{
10098
-					if(@filemtime($dst.DIRECTORY_SEPARATOR.$file)<@filemtime($src.DIRECTORY_SEPARATOR.$file))
10098
+					if(@filemtime($dst.DIRECTORY_SEPARATOR.$file) < @filemtime($src.DIRECTORY_SEPARATOR.$file))
10099 10099
 					{
10100
-						@copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
10100
+						@copy($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file);
10101 10101
 						@chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD);
10102 10102
 					}
10103 10103
 				}
10104 10104
 				else
10105
-					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
10105
+					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file);
10106 10106
 			}
10107 10107
 			closedir($folder);
10108 10108
 		} else {
@@ -10114,7 +10114,7 @@  discard block
 block discarded – undo
10114 10114
 		if(isset($this->_published[$md5sum]))
10115 10115
 			return $this->_published[$md5sum];
10116 10116
 		else if(($fullpath=realpath($md5sum))===false || !is_file($fullpath))
10117
-			throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid',$md5sum);
10117
+			throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid', $md5sum);
10118 10118
 		else
10119 10119
 		{
10120 10120
 			$dir=$this->hash(dirname($fullpath));
@@ -10122,31 +10122,31 @@  discard block
 block discarded – undo
10122 10122
 			$dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir;
10123 10123
 			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
10124 10124
 			{
10125
-				if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName)<@filemtime($fullpath))
10125
+				if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName) < @filemtime($fullpath))
10126 10126
 				{
10127
-					$this->copyFile($fullpath,$dst);
10128
-					$this->deployTarFile($tarfile,$dst);
10127
+					$this->copyFile($fullpath, $dst);
10128
+					$this->deployTarFile($tarfile, $dst);
10129 10129
 				}
10130 10130
 			}
10131 10131
 			return $this->_published[$md5sum]=$this->_baseUrl.'/'.$dir;
10132 10132
 		}
10133 10133
 	}
10134
-	protected function deployTarFile($path,$destination)
10134
+	protected function deployTarFile($path, $destination)
10135 10135
 	{
10136 10136
 		if(($fullpath=realpath($path))===false || !is_file($fullpath))
10137
-			throw new TIOException('assetmanager_tarfile_invalid',$path);
10137
+			throw new TIOException('assetmanager_tarfile_invalid', $path);
10138 10138
 		else
10139 10139
 		{
10140 10140
 			Prado::using('System.IO.TTarFileExtractor');
10141
-			$tar = new TTarFileExtractor($fullpath);
10141
+			$tar=new TTarFileExtractor($fullpath);
10142 10142
 			return $tar->extract($destination);
10143 10143
 		}
10144 10144
 	}
10145 10145
 }
10146 10146
 class TGlobalization extends TModule
10147 10147
 {
10148
-	private $_defaultCharset = 'UTF-8';
10149
-	private $_defaultCulture = 'en';
10148
+	private $_defaultCharset='UTF-8';
10149
+	private $_defaultCulture='en';
10150 10150
 	private $_charset=null;
10151 10151
 	private $_culture=null;
10152 10152
 	private $_translation;
@@ -10160,11 +10160,11 @@  discard block
 block discarded – undo
10160 10160
 		if($config!==null)
10161 10161
 		{
10162 10162
 			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
10163
-				$translation = isset($config['translate'])?$config['translate']:null;
10163
+				$translation=isset($config['translate']) ? $config['translate'] : null;
10164 10164
 			else
10165 10165
 			{
10166
-				$t = $config->getElementByTagName('translation');
10167
-				$translation = ($t)?$t->getAttributes():null;
10166
+				$t=$config->getElementByTagName('translation');
10167
+				$translation=($t) ? $t->getAttributes() : null;
10168 10168
 			}
10169 10169
 			if($translation)
10170 10170
 				$this->setTranslationConfiguration($translation);
@@ -10177,7 +10177,7 @@  discard block
 block discarded – undo
10177 10177
 	}
10178 10178
 	public function setTranslateDefaultCulture($value)
10179 10179
 	{
10180
-		$this->_translateDefaultCulture = TPropertyValue::ensureBoolean($value);
10180
+		$this->_translateDefaultCulture=TPropertyValue::ensureBoolean($value);
10181 10181
 	}
10182 10182
 	public function getDefaultCulture()
10183 10183
 	{
@@ -10185,7 +10185,7 @@  discard block
 block discarded – undo
10185 10185
 	}
10186 10186
 	public function setDefaultCulture($culture)
10187 10187
 	{
10188
-		$this->_defaultCulture = str_replace('-','_',$culture);
10188
+		$this->_defaultCulture=str_replace('-', '_', $culture);
10189 10189
 	}
10190 10190
 	public function getDefaultCharset()
10191 10191
 	{
@@ -10193,7 +10193,7 @@  discard block
 block discarded – undo
10193 10193
 	}
10194 10194
 	public function setDefaultCharset($charset)
10195 10195
 	{
10196
-		$this->_defaultCharset = $charset;
10196
+		$this->_defaultCharset=$charset;
10197 10197
 	}
10198 10198
 	public function getCulture()
10199 10199
 	{
@@ -10201,7 +10201,7 @@  discard block
 block discarded – undo
10201 10201
 	}
10202 10202
 	public function setCulture($culture)
10203 10203
 	{
10204
-		$this->_culture = str_replace('-','_',$culture);
10204
+		$this->_culture=str_replace('-', '_', $culture);
10205 10205
 	}
10206 10206
 	public function getCharset()
10207 10207
 	{
@@ -10209,27 +10209,27 @@  discard block
 block discarded – undo
10209 10209
 	}
10210 10210
 	public function setCharset($charset)
10211 10211
 	{
10212
-		$this->_charset = $charset;
10212
+		$this->_charset=$charset;
10213 10213
 	}
10214 10214
 	public function getTranslationConfiguration()
10215 10215
 	{
10216
-		return (!$this->_translateDefaultCulture && ($this->getDefaultCulture() == $this->getCulture()))
10216
+		return (!$this->_translateDefaultCulture && ($this->getDefaultCulture()==$this->getCulture()))
10217 10217
 			? null
10218 10218
 			: $this->_translation;
10219 10219
 	}
10220 10220
 	protected function setTranslationConfiguration($config)
10221 10221
 	{
10222
-		if($config['type'] == 'XLIFF' || $config['type'] == 'gettext')
10222
+		if($config['type']=='XLIFF' || $config['type']=='gettext')
10223 10223
 		{
10224 10224
 			if($config['source'])
10225 10225
 			{
10226
-				$config['source'] = Prado::getPathOfNamespace($config['source']);
10226
+				$config['source']=Prado::getPathOfNamespace($config['source']);
10227 10227
 				if(!is_dir($config['source']))
10228 10228
 				{
10229 10229
 					if(@mkdir($config['source'])===false)
10230 10230
 					throw new TConfigurationException('globalization_source_path_failed',
10231 10231
 						$config['source']);
10232
-					chmod($config['source'], PRADO_CHMOD); 				}
10232
+					chmod($config['source'], PRADO_CHMOD); }
10233 10233
 			}
10234 10234
 			else
10235 10235
 			{
@@ -10238,15 +10238,15 @@  discard block
 block discarded – undo
10238 10238
 		}
10239 10239
 		if($config['cache'])
10240 10240
 		{
10241
-			$config['cache'] = $this->getApplication()->getRunTimePath().'/i18n';
10241
+			$config['cache']=$this->getApplication()->getRunTimePath().'/i18n';
10242 10242
 			if(!is_dir($config['cache']))
10243 10243
 			{
10244 10244
 				if(@mkdir($config['cache'])===false)
10245 10245
 					throw new TConfigurationException('globalization_cache_path_failed',
10246 10246
 						$config['cache']);
10247
-				chmod($config['cache'], PRADO_CHMOD); 			}
10247
+				chmod($config['cache'], PRADO_CHMOD); }
10248 10248
 		}
10249
-		$this->_translation = $config;
10249
+		$this->_translation=$config;
10250 10250
 	}
10251 10251
 	public function getTranslationCatalogue()
10252 10252
 	{
@@ -10254,28 +10254,28 @@  discard block
 block discarded – undo
10254 10254
 	}
10255 10255
 	public function setTranslationCatalogue($value)
10256 10256
 	{
10257
-		$this->_translation['catalogue'] = $value;
10257
+		$this->_translation['catalogue']=$value;
10258 10258
 	}
10259 10259
 	public function getCultureVariants($culture=null)
10260 10260
 	{
10261
-		if($culture===null) $culture = $this->getCulture();
10262
-		$variants = explode('_', $culture);
10263
-		$result = array();
10261
+		if($culture===null) $culture=$this->getCulture();
10262
+		$variants=explode('_', $culture);
10263
+		$result=array();
10264 10264
 		for(; count($variants) > 0; array_pop($variants))
10265
-			$result[] = implode('_', $variants);
10265
+			$result[]=implode('_', $variants);
10266 10266
 		return $result;
10267 10267
 	}
10268
-	public function getLocalizedResource($file,$culture=null)
10268
+	public function getLocalizedResource($file, $culture=null)
10269 10269
 	{
10270
-		$files = array();
10271
-		$variants = $this->getCultureVariants($culture);
10272
-		$path = pathinfo($file);
10270
+		$files=array();
10271
+		$variants=$this->getCultureVariants($culture);
10272
+		$path=pathinfo($file);
10273 10273
 		foreach($variants as $variant)
10274
-			$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename'];
10275
-		$filename = substr($path['basename'],0,strrpos($path['basename'],'.'));
10274
+			$files[]=$path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename'];
10275
+		$filename=substr($path['basename'], 0, strrpos($path['basename'], '.'));
10276 10276
 		foreach($variants as $variant)
10277
-			$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension'];
10278
-		$files[] = $file;
10277
+			$files[]=$path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension'];
10278
+		$files[]=$file;
10279 10279
 		return $files;
10280 10280
 	}
10281 10281
 }
@@ -10288,10 +10288,10 @@  discard block
 block discarded – undo
10288 10288
 	const PAGE_SERVICE_ID='page';
10289 10289
 	const CONFIG_FILE_XML='application.xml';
10290 10290
 	const CONFIG_FILE_EXT_XML='.xml';
10291
-	const CONFIG_TYPE_XML = 'xml';
10291
+	const CONFIG_TYPE_XML='xml';
10292 10292
 	const CONFIG_FILE_PHP='application.php';
10293 10293
 	const CONFIG_FILE_EXT_PHP='.php';
10294
-	const CONFIG_TYPE_PHP = 'php';
10294
+	const CONFIG_TYPE_PHP='php';
10295 10295
 	const RUNTIME_PATH='runtime';
10296 10296
 	const CONFIGCACHE_FILE='config.cache';
10297 10297
 	const GLOBAL_FILE='global.cache';
@@ -10339,8 +10339,8 @@  discard block
 block discarded – undo
10339 10339
 	private $_assetManager;
10340 10340
 	private $_authRules;
10341 10341
 	private $_mode=TApplicationMode::Debug;
10342
-	private $_pageServiceID = self::PAGE_SERVICE_ID;
10343
-	public function __construct($basePath='protected',$cacheConfig=true, $configType=self::CONFIG_TYPE_XML)
10342
+	private $_pageServiceID=self::PAGE_SERVICE_ID;
10343
+	public function __construct($basePath='protected', $cacheConfig=true, $configType=self::CONFIG_TYPE_XML)
10344 10344
 	{
10345 10345
 				Prado::setApplication($this);
10346 10346
 		$this->setConfigurationType($configType);
@@ -10349,13 +10349,13 @@  discard block
 block discarded – undo
10349 10349
 			$this->_cacheFile=$this->_runtimePath.DIRECTORY_SEPARATOR.self::CONFIGCACHE_FILE;
10350 10350
 				$this->_uniqueID=md5($this->_runtimePath);
10351 10351
 		$this->_parameters=new TMap;
10352
-		$this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null));
10353
-		Prado::setPathOfAlias('Application',$this->_basePath);
10352
+		$this->_services=array($this->getPageServiceID()=>array('TPageService', array(), null));
10353
+		Prado::setPathOfAlias('Application', $this->_basePath);
10354 10354
 	}
10355 10355
 	protected function resolvePaths($basePath)
10356 10356
 	{
10357 10357
 				if(empty($basePath) || ($basePath=realpath($basePath))===false)
10358
-			throw new TConfigurationException('application_basepath_invalid',$basePath);
10358
+			throw new TConfigurationException('application_basepath_invalid', $basePath);
10359 10359
 		if(is_dir($basePath) && is_file($basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName()))
10360 10360
 			$configFile=$basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName();
10361 10361
 		else if(is_file($basePath))
@@ -10374,15 +10374,15 @@  discard block
 block discarded – undo
10374 10374
 				if(!is_dir($runtimePath))
10375 10375
 				{
10376 10376
 					if(@mkdir($runtimePath)===false)
10377
-						throw new TConfigurationException('application_runtimepath_failed',$runtimePath);
10378
-					@chmod($runtimePath, PRADO_CHMOD); 				}
10377
+						throw new TConfigurationException('application_runtimepath_failed', $runtimePath);
10378
+					@chmod($runtimePath, PRADO_CHMOD); }
10379 10379
 				$this->setConfigurationFile($configFile);
10380 10380
 			}
10381 10381
 			$this->setBasePath($basePath);
10382 10382
 			$this->setRuntimePath($runtimePath);
10383 10383
 		}
10384 10384
 		else
10385
-			throw new TConfigurationException('application_runtimepath_invalid',$runtimePath);
10385
+			throw new TConfigurationException('application_runtimepath_invalid', $runtimePath);
10386 10386
 	}
10387 10387
 	public function run()
10388 10388
 	{
@@ -10392,10 +10392,10 @@  discard block
 block discarded – undo
10392 10392
 			$n=count(self::$_steps);
10393 10393
 			$this->_step=0;
10394 10394
 			$this->_requestCompleted=false;
10395
-			while($this->_step<$n)
10395
+			while($this->_step < $n)
10396 10396
 			{
10397 10397
 				if($this->_mode===self::STATE_OFF)
10398
-					throw new THttpException(503,'application_unavailable');
10398
+					throw new THttpException(503, 'application_unavailable');
10399 10399
 				if($this->_requestCompleted)
10400 10400
 					break;
10401 10401
 				$method=self::$_steps[$this->_step];
@@ -10417,11 +10417,11 @@  discard block
 block discarded – undo
10417 10417
 	{
10418 10418
 		return $this->_requestCompleted;
10419 10419
 	}
10420
-	public function getGlobalState($key,$defaultValue=null)
10420
+	public function getGlobalState($key, $defaultValue=null)
10421 10421
 	{
10422
-		return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue;
10422
+		return isset($this->_globals[$key]) ? $this->_globals[$key] : $defaultValue;
10423 10423
 	}
10424
-	public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false)
10424
+	public function setGlobalState($key, $value, $defaultValue=null, $forceSave=false)
10425 10425
 	{
10426 10426
 		$this->_stateChanged=true;
10427 10427
 		if($value===$defaultValue)
@@ -10474,7 +10474,7 @@  discard block
 block discarded – undo
10474 10474
 	}
10475 10475
 	public function setMode($value)
10476 10476
 	{
10477
-		$this->_mode=TPropertyValue::ensureEnum($value,'TApplicationMode');
10477
+		$this->_mode=TPropertyValue::ensureEnum($value, 'TApplicationMode');
10478 10478
 	}
10479 10479
 	public function getBasePath()
10480 10480
 	{
@@ -10498,7 +10498,7 @@  discard block
 block discarded – undo
10498 10498
 	}
10499 10499
 	public function setConfigurationType($value)
10500 10500
 	{
10501
-		$this->_configType = $value;
10501
+		$this->_configType=$value;
10502 10502
 	}
10503 10503
 	public function getConfigurationFileExt()
10504 10504
 	{
@@ -10507,10 +10507,10 @@  discard block
 block discarded – undo
10507 10507
 			switch($this->_configType)
10508 10508
 			{
10509 10509
 				case TApplication::CONFIG_TYPE_PHP:
10510
-					$this->_configFileExt = TApplication::CONFIG_FILE_EXT_PHP;
10510
+					$this->_configFileExt=TApplication::CONFIG_FILE_EXT_PHP;
10511 10511
 					break;
10512 10512
 				default:
10513
-					$this->_configFileExt = TApplication::CONFIG_FILE_EXT_XML;
10513
+					$this->_configFileExt=TApplication::CONFIG_FILE_EXT_XML;
10514 10514
 			}
10515 10515
 		}
10516 10516
 		return $this->_configFileExt;
@@ -10518,15 +10518,15 @@  discard block
 block discarded – undo
10518 10518
 	public function getConfigurationFileName()
10519 10519
 	{
10520 10520
 		static $fileName;
10521
-		if($fileName == null)
10521
+		if($fileName==null)
10522 10522
 		{
10523 10523
 			switch($this->_configType)
10524 10524
 			{
10525 10525
 				case TApplication::CONFIG_TYPE_PHP:
10526
-					$fileName = TApplication::CONFIG_FILE_PHP;
10526
+					$fileName=TApplication::CONFIG_FILE_PHP;
10527 10527
 					break;
10528 10528
 				default:
10529
-					$fileName = TApplication::CONFIG_FILE_XML;
10529
+					$fileName=TApplication::CONFIG_FILE_XML;
10530 10530
 			}
10531 10531
 		}
10532 10532
 		return $fileName;
@@ -10550,10 +10550,10 @@  discard block
 block discarded – undo
10550 10550
 	{
10551 10551
 		$this->_service=$value;
10552 10552
 	}
10553
-	public function setModule($id,IModule $module=null)
10553
+	public function setModule($id, IModule $module=null)
10554 10554
 	{
10555 10555
 		if(isset($this->_modules[$id]))
10556
-			throw new TConfigurationException('application_moduleid_duplicated',$id);
10556
+			throw new TConfigurationException('application_moduleid_duplicated', $id);
10557 10557
 		else
10558 10558
 			$this->_modules[$id]=$module;
10559 10559
 	}
@@ -10563,7 +10563,7 @@  discard block
 block discarded – undo
10563 10563
 			return null;
10564 10564
 				if($this->_modules[$id]===null)
10565 10565
 		{
10566
-			$module = $this->internalLoadModule($id, true);
10566
+			$module=$this->internalLoadModule($id, true);
10567 10567
 			$module[0]->init($module[1]);
10568 10568
 		}
10569 10569
 		return $this->_modules[$id];
@@ -10718,38 +10718,38 @@  discard block
 block discarded – undo
10718 10718
 		foreach($initProperties as $name=>$value)
10719 10719
 		{
10720 10720
 			if($name==='lazy') continue;
10721
-			$module->setSubProperty($name,$value);
10721
+			$module->setSubProperty($name, $value);
10722 10722
 		}
10723
-		$this->setModule($id,$module);
10723
+		$this->setModule($id, $module);
10724 10724
 				$this->_lazyModules[$id]=null;
10725
-		return array($module,$configElement);
10725
+		return array($module, $configElement);
10726 10726
 	}
10727
-	public function applyConfiguration($config,$withinService=false)
10727
+	public function applyConfiguration($config, $withinService=false)
10728 10728
 	{
10729 10729
 		if($config->getIsEmpty())
10730 10730
 			return;
10731 10731
 				foreach($config->getAliases() as $alias=>$path)
10732
-			Prado::setPathOfAlias($alias,$path);
10732
+			Prado::setPathOfAlias($alias, $path);
10733 10733
 		foreach($config->getUsings() as $using)
10734 10734
 			Prado::using($using);
10735 10735
 				if(!$withinService)
10736 10736
 		{
10737 10737
 			foreach($config->getProperties() as $name=>$value)
10738
-				$this->setSubProperty($name,$value);
10738
+				$this->setSubProperty($name, $value);
10739 10739
 		}
10740 10740
 		if(empty($this->_services))
10741
-			$this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null));
10741
+			$this->_services=array($this->getPageServiceID()=>array('TPageService', array(), null));
10742 10742
 				foreach($config->getParameters() as $id=>$parameter)
10743 10743
 		{
10744 10744
 			if(is_array($parameter))
10745 10745
 			{
10746 10746
 				$component=Prado::createComponent($parameter[0]);
10747 10747
 				foreach($parameter[1] as $name=>$value)
10748
-					$component->setSubProperty($name,$value);
10749
-				$this->_parameters->add($id,$component);
10748
+					$component->setSubProperty($name, $value);
10749
+				$this->_parameters->add($id, $component);
10750 10750
 			}
10751 10751
 			else
10752
-				$this->_parameters->add($id,$parameter);
10752
+				$this->_parameters->add($id, $parameter);
10753 10753
 		}
10754 10754
 				$modules=array();
10755 10755
 		foreach($config->getModules() as $id=>$moduleConfig)
@@ -10757,7 +10757,7 @@  discard block
 block discarded – undo
10757 10757
 			if(!is_string($id))
10758 10758
 				$id='_module'.count($this->_lazyModules);
10759 10759
 			$this->_lazyModules[$id]=$moduleConfig;
10760
-			if($module = $this->internalLoadModule($id))
10760
+			if($module=$this->internalLoadModule($id))
10761 10761
 				$modules[]=$module;
10762 10762
 		}
10763 10763
 		foreach($modules as $module)
@@ -10770,12 +10770,12 @@  discard block
 block discarded – undo
10770 10770
 				$condition=$this->evaluateExpression($condition);
10771 10771
 			if($condition)
10772 10772
 			{
10773
-				if(($path=Prado::getPathOfNamespace($filePath,$this->getConfigurationFileExt()))===null || !is_file($path))
10774
-					throw new TConfigurationException('application_includefile_invalid',$filePath);
10773
+				if(($path=Prado::getPathOfNamespace($filePath, $this->getConfigurationFileExt()))===null || !is_file($path))
10774
+					throw new TConfigurationException('application_includefile_invalid', $filePath);
10775 10775
 				$cn=$this->getApplicationConfigurationClass();
10776 10776
 				$c=new $cn;
10777 10777
 				$c->loadFromFile($path);
10778
-				$this->applyConfiguration($c,$withinService);
10778
+				$this->applyConfiguration($c, $withinService);
10779 10779
 			}
10780 10780
 		}
10781 10781
 	}
@@ -10783,16 +10783,16 @@  discard block
 block discarded – undo
10783 10783
 	{
10784 10784
 		if($this->_configFile!==null)
10785 10785
 		{
10786
-			if($this->_cacheFile===null || @filemtime($this->_cacheFile)<filemtime($this->_configFile))
10786
+			if($this->_cacheFile===null || @filemtime($this->_cacheFile) < filemtime($this->_configFile))
10787 10787
 			{
10788 10788
 				$config=new TApplicationConfiguration;
10789 10789
 				$config->loadFromFile($this->_configFile);
10790 10790
 				if($this->_cacheFile!==null)
10791
-					file_put_contents($this->_cacheFile,serialize($config),LOCK_EX);
10791
+					file_put_contents($this->_cacheFile, serialize($config), LOCK_EX);
10792 10792
 			}
10793 10793
 			else
10794 10794
 				$config=unserialize(file_get_contents($this->_cacheFile));
10795
-			$this->applyConfiguration($config,false);
10795
+			$this->applyConfiguration($config, false);
10796 10796
 		}
10797 10797
 		if(($serviceID=$this->getRequest()->resolveRequest(array_keys($this->_services)))===null)
10798 10798
 			$serviceID=$this->getPageServiceID();
@@ -10802,68 +10802,68 @@  discard block
 block discarded – undo
10802 10802
 	{
10803 10803
 		if(isset($this->_services[$serviceID]))
10804 10804
 		{
10805
-			list($serviceClass,$initProperties,$configElement)=$this->_services[$serviceID];
10805
+			list($serviceClass, $initProperties, $configElement)=$this->_services[$serviceID];
10806 10806
 			$service=Prado::createComponent($serviceClass);
10807 10807
 			if(!($service instanceof IService))
10808
-				throw new THttpException(500,'application_service_invalid',$serviceClass);
10808
+				throw new THttpException(500, 'application_service_invalid', $serviceClass);
10809 10809
 			if(!$service->getEnabled())
10810
-				throw new THttpException(500,'application_service_unavailable',$serviceClass);
10810
+				throw new THttpException(500, 'application_service_unavailable', $serviceClass);
10811 10811
 			$service->setID($serviceID);
10812 10812
 			$this->setService($service);
10813 10813
 			foreach($initProperties as $name=>$value)
10814
-				$service->setSubProperty($name,$value);
10814
+				$service->setSubProperty($name, $value);
10815 10815
 			if($configElement!==null)
10816 10816
 			{
10817 10817
 				$config=new TApplicationConfiguration;
10818 10818
 				if($this->getConfigurationType()==self::CONFIG_TYPE_PHP)
10819
-					$config->loadFromPhp($configElement,$this->getBasePath());
10819
+					$config->loadFromPhp($configElement, $this->getBasePath());
10820 10820
 				else
10821
-					$config->loadFromXml($configElement,$this->getBasePath());
10822
-				$this->applyConfiguration($config,true);
10821
+					$config->loadFromXml($configElement, $this->getBasePath());
10822
+				$this->applyConfiguration($config, true);
10823 10823
 			}
10824 10824
 			$service->init($configElement);
10825 10825
 		}
10826 10826
 		else
10827
-			throw new THttpException(500,'application_service_unknown',$serviceID);
10827
+			throw new THttpException(500, 'application_service_unknown', $serviceID);
10828 10828
 	}
10829 10829
 	public function onError($param)
10830 10830
 	{
10831
-		Prado::log($param->getMessage(),TLogger::ERROR,'System.TApplication');
10832
-		$this->raiseEvent('OnError',$this,$param);
10833
-		$this->getErrorHandler()->handleError($this,$param);
10831
+		Prado::log($param->getMessage(), TLogger::ERROR, 'System.TApplication');
10832
+		$this->raiseEvent('OnError', $this, $param);
10833
+		$this->getErrorHandler()->handleError($this, $param);
10834 10834
 	}
10835 10835
 	public function onBeginRequest()
10836 10836
 	{
10837
-		$this->raiseEvent('OnBeginRequest',$this,null);
10837
+		$this->raiseEvent('OnBeginRequest', $this, null);
10838 10838
 	}
10839 10839
 	public function onAuthentication()
10840 10840
 	{
10841
-		$this->raiseEvent('OnAuthentication',$this,null);
10841
+		$this->raiseEvent('OnAuthentication', $this, null);
10842 10842
 	}
10843 10843
 	public function onAuthenticationComplete()
10844 10844
 	{
10845
-		$this->raiseEvent('OnAuthenticationComplete',$this,null);
10845
+		$this->raiseEvent('OnAuthenticationComplete', $this, null);
10846 10846
 	}
10847 10847
 	public function onAuthorization()
10848 10848
 	{
10849
-		$this->raiseEvent('OnAuthorization',$this,null);
10849
+		$this->raiseEvent('OnAuthorization', $this, null);
10850 10850
 	}
10851 10851
 	public function onAuthorizationComplete()
10852 10852
 	{
10853
-		$this->raiseEvent('OnAuthorizationComplete',$this,null);
10853
+		$this->raiseEvent('OnAuthorizationComplete', $this, null);
10854 10854
 	}
10855 10855
 	public function onLoadState()
10856 10856
 	{
10857 10857
 		$this->loadGlobals();
10858
-		$this->raiseEvent('OnLoadState',$this,null);
10858
+		$this->raiseEvent('OnLoadState', $this, null);
10859 10859
 	}
10860 10860
 	public function onLoadStateComplete()
10861 10861
 	{
10862
-		$this->raiseEvent('OnLoadStateComplete',$this,null);
10862
+		$this->raiseEvent('OnLoadStateComplete', $this, null);
10863 10863
 	}
10864 10864
 	public function onPreRunService()
10865 10865
 	{
10866
-		$this->raiseEvent('OnPreRunService',$this,null);
10866
+		$this->raiseEvent('OnPreRunService', $this, null);
10867 10867
 	}
10868 10868
 	public function runService()
10869 10869
 	{
@@ -10872,24 +10872,24 @@  discard block
 block discarded – undo
10872 10872
 	}
10873 10873
 	public function onSaveState()
10874 10874
 	{
10875
-		$this->raiseEvent('OnSaveState',$this,null);
10875
+		$this->raiseEvent('OnSaveState', $this, null);
10876 10876
 		$this->saveGlobals();
10877 10877
 	}
10878 10878
 	public function onSaveStateComplete()
10879 10879
 	{
10880
-		$this->raiseEvent('OnSaveStateComplete',$this,null);
10880
+		$this->raiseEvent('OnSaveStateComplete', $this, null);
10881 10881
 	}
10882 10882
 	public function onPreFlushOutput()
10883 10883
 	{
10884
-		$this->raiseEvent('OnPreFlushOutput',$this,null);
10884
+		$this->raiseEvent('OnPreFlushOutput', $this, null);
10885 10885
 	}
10886
-	public function flushOutput($continueBuffering = true)
10886
+	public function flushOutput($continueBuffering=true)
10887 10887
 	{
10888 10888
 		$this->getResponse()->flush($continueBuffering);
10889 10889
 	}
10890 10890
 	public function onEndRequest()
10891 10891
 	{
10892
-		$this->flushOutput(false); 		$this->saveGlobals();  		$this->raiseEvent('OnEndRequest',$this,null);
10892
+		$this->flushOutput(false); $this->saveGlobals(); $this->raiseEvent('OnEndRequest', $this, null);
10893 10893
 	}
10894 10894
 }
10895 10895
 class TApplicationMode extends TEnumerable
@@ -10913,14 +10913,14 @@  discard block
 block discarded – undo
10913 10913
 	{
10914 10914
 		if(Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
10915 10915
 		{
10916
-			$fcontent = include $fname;
10917
-			$this->loadFromPhp($fcontent,dirname($fname));
10916
+			$fcontent=include $fname;
10917
+			$this->loadFromPhp($fcontent, dirname($fname));
10918 10918
 		}
10919 10919
 		else
10920 10920
 		{
10921 10921
 			$dom=new TXmlDocument;
10922 10922
 			$dom->loadFromFile($fname);
10923
-			$this->loadFromXml($dom,dirname($fname));
10923
+			$this->loadFromXml($dom, dirname($fname));
10924 10924
 		}
10925 10925
 	}
10926 10926
 	public function getIsEmpty()
@@ -10935,20 +10935,20 @@  discard block
 block discarded – undo
10935 10935
 			{
10936 10936
 				$this->_properties[$name]=$value;
10937 10937
 			}
10938
-			$this->_empty = false;
10938
+			$this->_empty=false;
10939 10939
 		}
10940 10940
 		if(isset($config['paths']) && is_array($config['paths']))
10941
-			$this->loadPathsPhp($config['paths'],$configPath);
10941
+			$this->loadPathsPhp($config['paths'], $configPath);
10942 10942
 		if(isset($config['modules']) && is_array($config['modules']))
10943
-			$this->loadModulesPhp($config['modules'],$configPath);
10943
+			$this->loadModulesPhp($config['modules'], $configPath);
10944 10944
 		if(isset($config['services']) && is_array($config['services']))
10945
-			$this->loadServicesPhp($config['services'],$configPath);
10945
+			$this->loadServicesPhp($config['services'], $configPath);
10946 10946
 		if(isset($config['parameters']) && is_array($config['parameters']))
10947 10947
 			$this->loadParametersPhp($config['parameters'], $configPath);
10948 10948
 		if(isset($config['includes']) && is_array($config['includes']))
10949
-			$this->loadExternalXml($config['includes'],$configPath);
10949
+			$this->loadExternalXml($config['includes'], $configPath);
10950 10950
 	}
10951
-	public function loadFromXml($dom,$configPath)
10951
+	public function loadFromXml($dom, $configPath)
10952 10952
 	{
10953 10953
 				foreach($dom->getAttributes() as $name=>$value)
10954 10954
 		{
@@ -10960,19 +10960,19 @@  discard block
 block discarded – undo
10960 10960
 			switch($element->getTagName())
10961 10961
 			{
10962 10962
 				case 'paths':
10963
-					$this->loadPathsXml($element,$configPath);
10963
+					$this->loadPathsXml($element, $configPath);
10964 10964
 					break;
10965 10965
 				case 'modules':
10966
-					$this->loadModulesXml($element,$configPath);
10966
+					$this->loadModulesXml($element, $configPath);
10967 10967
 					break;
10968 10968
 				case 'services':
10969
-					$this->loadServicesXml($element,$configPath);
10969
+					$this->loadServicesXml($element, $configPath);
10970 10970
 					break;
10971 10971
 				case 'parameters':
10972
-					$this->loadParametersXml($element,$configPath);
10972
+					$this->loadParametersXml($element, $configPath);
10973 10973
 					break;
10974 10974
 				case 'include':
10975
-					$this->loadExternalXml($element,$configPath);
10975
+					$this->loadExternalXml($element, $configPath);
10976 10976
 					break;
10977 10977
 				default:
10978 10978
 										break;
@@ -10985,14 +10985,14 @@  discard block
 block discarded – undo
10985 10985
 		{
10986 10986
 			foreach($pathsNode['aliases'] as $id=>$path)
10987 10987
 			{
10988
-				$path=str_replace('\\','/',$path);
10989
-				if(preg_match('/^\\/|.:\\/|.:\\\\/',$path))						$p=realpath($path);
10988
+				$path=str_replace('\\', '/', $path);
10989
+				if(preg_match('/^\\/|.:\\/|.:\\\\/', $path))						$p=realpath($path);
10990 10990
 				else
10991 10991
 					$p=realpath($configPath.DIRECTORY_SEPARATOR.$path);
10992 10992
 				if($p===false || !is_dir($p))
10993
-					throw new TConfigurationException('appconfig_aliaspath_invalid',$id,$path);
10993
+					throw new TConfigurationException('appconfig_aliaspath_invalid', $id, $path);
10994 10994
 				if(isset($this->_aliases[$id]))
10995
-					throw new TConfigurationException('appconfig_alias_redefined',$id);
10995
+					throw new TConfigurationException('appconfig_alias_redefined', $id);
10996 10996
 				$this->_aliases[$id]=$p;
10997 10997
 			}
10998 10998
 		}
@@ -11000,11 +11000,11 @@  discard block
 block discarded – undo
11000 11000
 		{
11001 11001
 			foreach($pathsNode['using'] as $namespace)
11002 11002
 			{
11003
-				$this->_usings[] = $namespace;
11003
+				$this->_usings[]=$namespace;
11004 11004
 			}
11005 11005
 		}
11006 11006
 	}
11007
-	protected function loadPathsXml($pathsNode,$configPath)
11007
+	protected function loadPathsXml($pathsNode, $configPath)
11008 11008
 	{
11009 11009
 		foreach($pathsNode->getElements() as $element)
11010 11010
 		{
@@ -11014,14 +11014,14 @@  discard block
 block discarded – undo
11014 11014
 				{
11015 11015
 					if(($id=$element->getAttribute('id'))!==null && ($path=$element->getAttribute('path'))!==null)
11016 11016
 					{
11017
-						$path=str_replace('\\','/',$path);
11018
-						if(preg_match('/^\\/|.:\\/|.:\\\\/',$path))								$p=realpath($path);
11017
+						$path=str_replace('\\', '/', $path);
11018
+						if(preg_match('/^\\/|.:\\/|.:\\\\/', $path))								$p=realpath($path);
11019 11019
 						else
11020 11020
 							$p=realpath($configPath.DIRECTORY_SEPARATOR.$path);
11021 11021
 						if($p===false || !is_dir($p))
11022
-							throw new TConfigurationException('appconfig_aliaspath_invalid',$id,$path);
11022
+							throw new TConfigurationException('appconfig_aliaspath_invalid', $id, $path);
11023 11023
 						if(isset($this->_aliases[$id]))
11024
-							throw new TConfigurationException('appconfig_alias_redefined',$id);
11024
+							throw new TConfigurationException('appconfig_alias_redefined', $id);
11025 11025
 						$this->_aliases[$id]=$p;
11026 11026
 					}
11027 11027
 					else
@@ -11039,7 +11039,7 @@  discard block
 block discarded – undo
11039 11039
 					break;
11040 11040
 				}
11041 11041
 				default:
11042
-					throw new TConfigurationException('appconfig_paths_invalid',$element->getTagName());
11042
+					throw new TConfigurationException('appconfig_paths_invalid', $element->getTagName());
11043 11043
 			}
11044 11044
 		}
11045 11045
 	}
@@ -11048,21 +11048,21 @@  discard block
 block discarded – undo
11048 11048
 		foreach($modulesNode as $id=>$module)
11049 11049
 		{
11050 11050
 			if(!isset($module['class']))
11051
-				throw new TConfigurationException('appconfig_moduletype_required',$id);
11052
-			$type = $module['class'];
11051
+				throw new TConfigurationException('appconfig_moduletype_required', $id);
11052
+			$type=$module['class'];
11053 11053
 			unset($module['class']);
11054
-			$properties = array();
11054
+			$properties=array();
11055 11055
 			if(isset($module['properties']))
11056 11056
 			{
11057
-				$properties = $module['properties'];
11057
+				$properties=$module['properties'];
11058 11058
 				unset($module['properties']);
11059 11059
 			}
11060
-			$properties['id'] = $id;
11061
-			$this->_modules[$id]=array($type,$properties,$module);
11060
+			$properties['id']=$id;
11061
+			$this->_modules[$id]=array($type, $properties, $module);
11062 11062
 			$this->_empty=false;
11063 11063
 		}
11064 11064
 	}
11065
-	protected function loadModulesXml($modulesNode,$configPath)
11065
+	protected function loadModulesXml($modulesNode, $configPath)
11066 11066
 	{
11067 11067
 		foreach($modulesNode->getElements() as $element)
11068 11068
 		{
@@ -11072,33 +11072,33 @@  discard block
 block discarded – undo
11072 11072
 				$id=$properties->itemAt('id');
11073 11073
 				$type=$properties->remove('class');
11074 11074
 				if($type===null)
11075
-					throw new TConfigurationException('appconfig_moduletype_required',$id);
11075
+					throw new TConfigurationException('appconfig_moduletype_required', $id);
11076 11076
 				$element->setParent(null);
11077 11077
 				if($id===null)
11078
-					$this->_modules[]=array($type,$properties->toArray(),$element);
11078
+					$this->_modules[]=array($type, $properties->toArray(), $element);
11079 11079
 				else
11080
-					$this->_modules[$id]=array($type,$properties->toArray(),$element);
11080
+					$this->_modules[$id]=array($type, $properties->toArray(), $element);
11081 11081
 				$this->_empty=false;
11082 11082
 			}
11083 11083
 			else
11084
-				throw new TConfigurationException('appconfig_modules_invalid',$element->getTagName());
11084
+				throw new TConfigurationException('appconfig_modules_invalid', $element->getTagName());
11085 11085
 		}
11086 11086
 	}
11087
-	protected function loadServicesPhp($servicesNode,$configPath)
11087
+	protected function loadServicesPhp($servicesNode, $configPath)
11088 11088
 	{
11089 11089
 		foreach($servicesNode as $id => $service)
11090 11090
 		{
11091 11091
 			if(!isset($service['class']))
11092 11092
 				throw new TConfigurationException('appconfig_servicetype_required');
11093
-			$type = $service['class'];
11094
-			$properties = isset($service['properties']) ? $service['properties'] : array();
11093
+			$type=$service['class'];
11094
+			$properties=isset($service['properties']) ? $service['properties'] : array();
11095 11095
 			unset($service['properties']);
11096
-			$properties['id'] = $id;
11097
-			$this->_services[$id] = array($type,$properties,$service);
11098
-			$this->_empty = false;
11096
+			$properties['id']=$id;
11097
+			$this->_services[$id]=array($type, $properties, $service);
11098
+			$this->_empty=false;
11099 11099
 		}
11100 11100
 	}
11101
-	protected function loadServicesXml($servicesNode,$configPath)
11101
+	protected function loadServicesXml($servicesNode, $configPath)
11102 11102
 	{
11103 11103
 		foreach($servicesNode->getElements() as $element)
11104 11104
 		{
@@ -11108,16 +11108,16 @@  discard block
 block discarded – undo
11108 11108
 				if(($id=$properties->itemAt('id'))===null)
11109 11109
 					throw new TConfigurationException('appconfig_serviceid_required');
11110 11110
 				if(($type=$properties->remove('class'))===null)
11111
-					throw new TConfigurationException('appconfig_servicetype_required',$id);
11111
+					throw new TConfigurationException('appconfig_servicetype_required', $id);
11112 11112
 				$element->setParent(null);
11113
-				$this->_services[$id]=array($type,$properties->toArray(),$element);
11113
+				$this->_services[$id]=array($type, $properties->toArray(), $element);
11114 11114
 				$this->_empty=false;
11115 11115
 			}
11116 11116
 			else
11117
-				throw new TConfigurationException('appconfig_services_invalid',$element->getTagName());
11117
+				throw new TConfigurationException('appconfig_services_invalid', $element->getTagName());
11118 11118
 		}
11119 11119
 	}
11120
-	protected function loadParametersPhp($parametersNode,$configPath)
11120
+	protected function loadParametersPhp($parametersNode, $configPath)
11121 11121
 	{
11122 11122
 		foreach($parametersNode as $id => $parameter)
11123 11123
 		{
@@ -11125,20 +11125,20 @@  discard block
 block discarded – undo
11125 11125
 			{
11126 11126
 				if(isset($parameter['class']))
11127 11127
 				{
11128
-					$type = $parameter['class'];
11128
+					$type=$parameter['class'];
11129 11129
 					unset($parameter['class']);
11130
-					$properties = isset($service['properties']) ? $service['properties'] : array();
11131
-					$properties['id'] = $id;
11132
-					$this->_parameters[$id] = array($type,$properties);
11130
+					$properties=isset($service['properties']) ? $service['properties'] : array();
11131
+					$properties['id']=$id;
11132
+					$this->_parameters[$id]=array($type, $properties);
11133 11133
 				}
11134 11134
 			}
11135 11135
 			else
11136 11136
 			{
11137
-				$this->_parameters[$id] = $parameter;
11137
+				$this->_parameters[$id]=$parameter;
11138 11138
 			}
11139 11139
 		}
11140 11140
 	}
11141
-	protected function loadParametersXml($parametersNode,$configPath)
11141
+	protected function loadParametersXml($parametersNode, $configPath)
11142 11142
 	{
11143 11143
 		foreach($parametersNode->getElements() as $element)
11144 11144
 		{
@@ -11155,21 +11155,21 @@  discard block
 block discarded – undo
11155 11155
 						$this->_parameters[$id]=$value;
11156 11156
 				}
11157 11157
 				else
11158
-					$this->_parameters[$id]=array($type,$properties->toArray());
11158
+					$this->_parameters[$id]=array($type, $properties->toArray());
11159 11159
 				$this->_empty=false;
11160 11160
 			}
11161 11161
 			else
11162
-				throw new TConfigurationException('appconfig_parameters_invalid',$element->getTagName());
11162
+				throw new TConfigurationException('appconfig_parameters_invalid', $element->getTagName());
11163 11163
 		}
11164 11164
 	}
11165
-	protected function loadExternalPhp($includeNode,$configPath)
11165
+	protected function loadExternalPhp($includeNode, $configPath)
11166 11166
 	{
11167 11167
 		foreach($includeNode as $include)
11168 11168
 		{
11169
-			$when = isset($include['when'])?true:false;
11169
+			$when=isset($include['when']) ? true : false;
11170 11170
 			if(!isset($include['file']))
11171 11171
 				throw new TConfigurationException('appconfig_includefile_required');
11172
-			$filePath = $include['file'];
11172
+			$filePath=$include['file'];
11173 11173
 			if(isset($this->_includes[$filePath]))
11174 11174
 				$this->_includes[$filePath]='('.$this->_includes[$filePath].') || ('.$when.')';
11175 11175
 			else
@@ -11177,7 +11177,7 @@  discard block
 block discarded – undo
11177 11177
 			$this->_empty=false;
11178 11178
 		}
11179 11179
 	}
11180
-	protected function loadExternalXml($includeNode,$configPath)
11180
+	protected function loadExternalXml($includeNode, $configPath)
11181 11181
 	{
11182 11182
 		if(($when=$includeNode->getAttribute('when'))===null)
11183 11183
 			$when=true;
@@ -11250,12 +11250,12 @@  discard block
 block discarded – undo
11250 11250
 			if($cache->get(self::CACHE_NAME)===$content)
11251 11251
 				$saveFile=false;
11252 11252
 			else
11253
-				$cache->set(self::CACHE_NAME,$content);
11253
+				$cache->set(self::CACHE_NAME, $content);
11254 11254
 		}
11255 11255
 		if($saveFile)
11256 11256
 		{
11257 11257
 			$fileName=$this->getStateFilePath();
11258
-			file_put_contents($fileName,$content,LOCK_EX);
11258
+			file_put_contents($fileName, $content, LOCK_EX);
11259 11259
 		}
11260 11260
 	}
11261 11261
 }
Please login to merge, or discard this patch.
Braces   +169 added lines, -333 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 		}
@@ -126,8 +124,7 @@  discard block
 block discarded – undo
126 124
 					return $component;
127 125
 				break;
128 126
 			}
129
-		}
130
-		else
127
+		} else
131 128
 			return new $type;
132 129
 	}
133 130
 	public static function using($namespace,$checkClassExistence=true)
@@ -138,31 +135,27 @@  discard block
 block discarded – undo
138 135
 			try
139 136
 			{
140 137
 				include_once($namespace.self::CLASS_FILE_EXT);
141
-			}
142
-			catch(Exception $e)
138
+			} catch(Exception $e)
143 139
 			{
144 140
 				if($checkClassExistence && !class_exists($namespace,false))
145 141
 					throw new TInvalidOperationException('prado_component_unknown',$namespace,$e->getMessage());
146 142
 				else
147 143
 					throw $e;
148 144
 			}
149
-		}
150
-		else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null)
145
+		} else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null)
151 146
 		{
152 147
 			$className=substr($namespace,$pos+1);
153 148
 			if($className==='*')  			{
154 149
 				self::$_usings[$namespace]=$path;
155 150
 				set_include_path(get_include_path().PATH_SEPARATOR.$path);
156
-			}
157
-			else  			{
151
+			} else  			{
158 152
 				self::$_usings[$namespace]=$path;
159 153
 				if(!$checkClassExistence || !class_exists($className,false))
160 154
 				{
161 155
 					try
162 156
 					{
163 157
 						include_once($path);
164
-					}
165
-					catch(Exception $e)
158
+					} catch(Exception $e)
166 159
 					{
167 160
 						if($checkClassExistence && !class_exists($className,false))
168 161
 							throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage());
@@ -171,8 +164,7 @@  discard block
 block discarded – undo
171 164
 					}
172 165
 				}
173 166
 			}
174
-		}
175
-		else
167
+		} else
176 168
 			throw new TInvalidDataValueException('prado_using_invalid',$namespace);
177 169
 	}
178 170
 	public static function getPathOfNamespace($namespace, $ext='')
@@ -208,8 +200,7 @@  discard block
 block discarded – undo
208 200
 				self::$_aliases[$alias]=$rp;
209 201
 			else
210 202
 				throw new TInvalidDataValueException('prado_aliasname_invalid',$alias);
211
-		}
212
-		else
203
+		} else
213 204
 			throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path);
214 205
 	}
215 206
 	public static function fatalError($msg)
@@ -246,8 +237,7 @@  discard block
 block discarded – undo
246 237
 							echo "'". substr($str, 0, 70) . "...'";
247 238
 						else
248 239
 							echo "'" . $str . "'";
249
-					}
250
-					else if (is_int($item) || is_float($item))
240
+					} else if (is_int($item) || is_float($item))
251 241
 						echo $item;
252 242
 					else if (is_object($item))
253 243
 						echo get_class($item);
@@ -316,8 +306,7 @@  discard block
 block discarded – undo
316 306
 			if(isset($trace[0]['file']) && isset($trace[0]['line']))
317 307
 				$msg.=" (line {$trace[0]['line']}, {$trace[0]['file']})";
318 308
 			$level=TLogger::DEBUG;
319
-		}
320
-		else
309
+		} else
321 310
 			$level=TLogger::INFO;
322 311
 		self::log($msg,$level,$category,$ctl);
323 312
 	}
@@ -622,8 +611,7 @@  discard block
 block discarded – undo
622 611
 			echo "<body><h1>Recursive Error</h1>\n";
623 612
 			echo "<pre>".$exception->__toString()."</pre>\n";
624 613
 			echo "</body></html>";
625
-		}
626
-		else
614
+		} else
627 615
 		{
628 616
 			error_log("Error happened while processing an existing error:\n".$exception->__toString());
629 617
 			header('HTTP/1.0 500 Internal Error');
@@ -645,15 +633,13 @@  discard block
 block discarded – undo
645 633
 			if($fileName==='')
646 634
 				$fileName='---embedded template---';
647 635
 			$errorLine=$exception->getLineNumber();
648
-		}
649
-		else
636
+		} else
650 637
 		{
651 638
 			if(($trace=$this->getExactTrace($exception))!==null)
652 639
 			{
653 640
 				$fileName=$trace['file'];
654 641
 				$errorLine=$trace['line'];
655
-			}
656
-			else
642
+			} else
657 643
 			{
658 644
 				$fileName=$exception->getFile();
659 645
 				$errorLine=$exception->getLine();
@@ -712,8 +698,7 @@  discard block
 block discarded – undo
712 698
 				$result=$trace[0];
713 699
 			elseif(isset($trace[1]))
714 700
 				$result=$trace[1];
715
-		}
716
-		else if($exception instanceof TInvalidOperationException)
701
+		} else if($exception instanceof TInvalidOperationException)
717 702
 		{
718 703
 						if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null)
719 704
 				$result=$this->getPropertyAccessTrace($trace,'__set');
@@ -745,8 +730,7 @@  discard block
 block discarded – undo
745 730
 			{
746 731
 				$line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
747 732
 				$source.="<div class=\"error\">".$line."</div>";
748
-			}
749
-			else
733
+			} else
750 734
 				$source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
751 735
 		}
752 736
 		return $source;
@@ -810,11 +794,9 @@  discard block
 block discarded – undo
810 794
 			{
811 795
 				array_splice($this->_d,$index,0,array($item));
812 796
 				$this->_c++;
813
-			}
814
-			else
797
+			} else
815 798
 				throw new TInvalidDataValueException('list_index_invalid',$index);
816
-		}
817
-		else
799
+		} else
818 800
 			throw new TInvalidOperationException('list_readonly',get_class($this));
819 801
 	}
820 802
 	public function remove($item)
@@ -825,11 +807,9 @@  discard block
 block discarded – undo
825 807
 			{
826 808
 				$this->removeAt($index);
827 809
 				return $index;
828
-			}
829
-			else
810
+			} else
830 811
 				throw new TInvalidDataValueException('list_item_inexistent');
831
-		}
832
-		else
812
+		} else
833 813
 			throw new TInvalidOperationException('list_readonly',get_class($this));
834 814
 	}
835 815
 	public function removeAt($index)
@@ -847,11 +827,9 @@  discard block
 block discarded – undo
847 827
 					array_splice($this->_d,$index,1);
848 828
 					return $item;
849 829
 				}
850
-			}
851
-			else
830
+			} else
852 831
 				throw new TInvalidDataValueException('list_index_invalid',$index);
853
-		}
854
-		else
832
+		} else
855 833
 			throw new TInvalidOperationException('list_readonly',get_class($this));
856 834
 	}
857 835
 	public function clear()
@@ -878,8 +856,7 @@  discard block
 block discarded – undo
878 856
 				throw new TInvalidDataValueException('list_item_inexistent');
879 857
 			$this->insertAt($index, $item);
880 858
 			return $index;
881
-		}
882
-		else
859
+		} else
883 860
 			throw new TInvalidOperationException('list_readonly',get_class($this));
884 861
 	}
885 862
 	public function insertAfter($baseitem, $item)
@@ -890,8 +867,7 @@  discard block
 block discarded – undo
890 867
 				throw new TInvalidDataValueException('list_item_inexistent');
891 868
 			$this->insertAt($index + 1, $item);
892 869
 			return $index + 1;
893
-		}
894
-		else
870
+		} else
895 871
 			throw new TInvalidOperationException('list_readonly',get_class($this));
896 872
 	}
897 873
 	public function toArray()
@@ -906,8 +882,7 @@  discard block
 block discarded – undo
906 882
 				$this->clear();
907 883
 			foreach($data as $item)
908 884
 				$this->add($item);
909
-		}
910
-		else if($data!==null)
885
+		} else if($data!==null)
911 886
 			throw new TInvalidDataTypeException('list_data_not_iterable');
912 887
 	}
913 888
 	public function mergeWith($data)
@@ -916,8 +891,7 @@  discard block
 block discarded – undo
916 891
 		{
917 892
 			foreach($data as $item)
918 893
 				$this->add($item);
919
-		}
920
-		else if($data!==null)
894
+		} else if($data!==null)
921 895
 			throw new TInvalidDataTypeException('list_data_not_iterable');
922 896
 	}
923 897
 	public function offsetExists($offset)
@@ -1131,8 +1105,7 @@  discard block
 block discarded – undo
1131 1105
 			{
1132 1106
 				if(($this->_recursiveLevel<0 || $level<$this->_recursiveLevel) && $this->validateDirectory($path))
1133 1107
 					$timestamps=array_merge($this->generateTimestamps($path,$level+1));
1134
-			}
1135
-			else if($this->validateFile($path))
1108
+			} else if($this->validateFile($path))
1136 1109
 				$timestamps[$path]=filemtime($path);
1137 1110
 		}
1138 1111
 		closedir($dir);
@@ -1393,8 +1366,7 @@  discard block
 block discarded – undo
1393 1366
 			}
1394 1367
 			$this->removeAtIndexInPriority($p[1],$p[0]);
1395 1368
 			return $p[2];
1396
-		}
1397
-		else
1369
+		} else
1398 1370
 			throw new TInvalidDataValueException('list_item_inexistent');
1399 1371
 	}
1400 1372
 	public function removeAt($index)
@@ -1552,13 +1524,11 @@  discard block
 block discarded – undo
1552 1524
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
1553 1525
 					$this->insertAtIndexInPriority($item,false,$priority);
1554 1526
 			}
1555
-		}
1556
-		else if(is_array($data)||$data instanceof Traversable)
1527
+		} else if(is_array($data)||$data instanceof Traversable)
1557 1528
 		{
1558 1529
 			foreach($data as $priority=>$item)
1559 1530
 				$this->add($item);
1560
-		}
1561
-		else if($data!==null)
1531
+		} else if($data!==null)
1562 1532
 			throw new TInvalidDataTypeException('map_data_not_iterable');
1563 1533
 	}
1564 1534
 	public function offsetExists($offset)
@@ -1649,11 +1619,9 @@  discard block
 block discarded – undo
1649 1619
 				$value=$this->_d[$key];
1650 1620
 				unset($this->_d[$key]);
1651 1621
 				return $value;
1652
-			}
1653
-			else
1622
+			} else
1654 1623
 				return null;
1655
-		}
1656
-		else
1624
+		} else
1657 1625
 			throw new TInvalidOperationException('map_readonly',get_class($this));
1658 1626
 	}
1659 1627
 	public function clear()
@@ -1677,8 +1645,7 @@  discard block
 block discarded – undo
1677 1645
 				$this->clear();
1678 1646
 			foreach($data as $key=>$value)
1679 1647
 				$this->add($key,$value);
1680
-		}
1681
-		else if($data!==null)
1648
+		} else if($data!==null)
1682 1649
 			throw new TInvalidDataTypeException('map_data_not_iterable');
1683 1650
 	}
1684 1651
 	public function mergeWith($data)
@@ -1687,8 +1654,7 @@  discard block
 block discarded – undo
1687 1654
 		{
1688 1655
 			foreach($data as $key=>$value)
1689 1656
 				$this->add($key,$value);
1690
-		}
1691
-		else if($data!==null)
1657
+		} else if($data!==null)
1692 1658
 			throw new TInvalidDataTypeException('map_data_not_iterable');
1693 1659
 	}
1694 1660
 	public function offsetExists($offset)
@@ -1862,13 +1828,11 @@  discard block
 block discarded – undo
1862 1828
 			if(!isset($this->_d[$priority])) {
1863 1829
 				$this->_d[$priority]=array($key=>$value);
1864 1830
 				$this->_o=false;
1865
-			}
1866
-			else
1831
+			} else
1867 1832
 				$this->_d[$priority][$key]=$value;
1868 1833
 			$this->_c++;
1869 1834
 			$this->_fd=null;
1870
-		}
1871
-		else
1835
+		} else
1872 1836
 			throw new TInvalidOperationException('map_readonly',get_class($this));
1873 1837
 		return $priority;
1874 1838
 	}
@@ -1896,8 +1860,7 @@  discard block
 block discarded – undo
1896 1860
 						return $value;
1897 1861
 					}
1898 1862
 				return null;
1899
-			}
1900
-			else
1863
+			} else
1901 1864
 			{
1902 1865
 				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1903 1866
 				if(isset($this->_d[$priority])&&(isset($this->_d[$priority][$key])||array_key_exists($key,$this->_d[$priority])))
@@ -1911,12 +1874,10 @@  discard block
 block discarded – undo
1911 1874
 					}
1912 1875
 					$this->_fd=null;
1913 1876
 					return $value;
1914
-				}
1915
-				else
1877
+				} else
1916 1878
 					return null;
1917 1879
 			}
1918
-		}
1919
-		else
1880
+		} else
1920 1881
 			throw new TInvalidOperationException('map_readonly',get_class($this));
1921 1882
 	}
1922 1883
 	public function clear()
@@ -1969,15 +1930,13 @@  discard block
 block discarded – undo
1969 1930
 					$this->add($key,$value,$priority);
1970 1931
 				}
1971 1932
 			}
1972
-		}
1973
-		else if(is_array($data)||$data instanceof Traversable)
1933
+		} else if(is_array($data)||$data instanceof Traversable)
1974 1934
 		{
1975 1935
 			if($this->getCount()>0)
1976 1936
 				$this->clear();
1977 1937
 			foreach($data as $key=>$value)
1978 1938
 				$this->add($key,$value);
1979
-		}
1980
-		else if($data!==null)
1939
+		} else if($data!==null)
1981 1940
 			throw new TInvalidDataTypeException('map_data_not_iterable');
1982 1941
 	}
1983 1942
 	public function mergeWith($data)
@@ -1989,13 +1948,11 @@  discard block
 block discarded – undo
1989 1948
 				foreach($data->itemsAtPriority($priority) as $key => $value)
1990 1949
 					$this->add($key,$value,$priority);
1991 1950
 			}
1992
-		}
1993
-		else if(is_array($data)||$data instanceof Traversable)
1951
+		} else if(is_array($data)||$data instanceof Traversable)
1994 1952
 		{
1995 1953
 			foreach($data as $key=>$value)
1996 1954
 				$this->add($key,$value);
1997
-		}
1998
-		else if($data!==null)
1955
+		} else if($data!==null)
1999 1956
 			throw new TInvalidDataTypeException('map_data_not_iterable');
2000 1957
 	}
2001 1958
 	public function offsetExists($offset)
@@ -2038,8 +1995,7 @@  discard block
 block discarded – undo
2038 1995
 				$this->_d[]=$item;
2039 1996
 				++$this->_c;
2040 1997
 			}
2041
-		}
2042
-		else if($data!==null)
1998
+		} else if($data!==null)
2043 1999
 			throw new TInvalidDataTypeException('stack_data_not_iterable');
2044 2000
 	}
2045 2001
 	public function clear()
@@ -2224,13 +2180,11 @@  discard block
 block discarded – undo
2224 2180
 				$str.=$element->toString($indent+1)."\n";
2225 2181
 			$str.=$prefix."</{$this->_tagName}>";
2226 2182
 			return $str;
2227
-		}
2228
-		else if(($value=$this->getValue())!=='')
2183
+		} else if(($value=$this->getValue())!=='')
2229 2184
 		{
2230 2185
 			$value=$this->xmlEncode($value);
2231 2186
 			return $prefix."<{$this->_tagName}$attr>$value</{$this->_tagName}>";
2232
-		}
2233
-		else
2187
+		} else
2234 2188
 			return $prefix."<{$this->_tagName}$attr />";
2235 2189
 	}
2236 2190
 	public function __toString()
@@ -2327,8 +2281,7 @@  discard block
 block discarded – undo
2327 2281
 		{
2328 2282
 			fwrite($fw,$this->saveToString());
2329 2283
 			fclose($fw);
2330
-		}
2331
-		else
2284
+		} else
2332 2285
 			throw new TIOException('xmldocument_file_write_failed',$file);
2333 2286
 	}
2334 2287
 	public function saveToString()
@@ -2374,8 +2327,7 @@  discard block
 block discarded – undo
2374 2327
 			if($item->getParent()!==null)
2375 2328
 				$item->getParent()->getElements()->remove($item);
2376 2329
 			$item->setParent($this->_o);
2377
-		}
2378
-		else
2330
+		} else
2379 2331
 			throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required');
2380 2332
 	}
2381 2333
 	public function removeAt($index)
@@ -2419,8 +2371,7 @@  discard block
 block discarded – undo
2419 2371
 				{
2420 2372
 					$this->_everyone=true;
2421 2373
 					break;
2422
-				}
2423
-				else if($user==='?')
2374
+				} else if($user==='?')
2424 2375
 					$this->_guest=true;
2425 2376
 				else if($user==='@')
2426 2377
 					$this->_authenticated=true;
@@ -2530,8 +2481,7 @@  discard block
 block discarded – undo
2530 2481
 					return ($decision>0);
2531 2482
 			}
2532 2483
 			return true;
2533
-		}
2534
-		else
2484
+		} else
2535 2485
 			return false;
2536 2486
 	}
2537 2487
 	public function insertAt($index,$item)
@@ -2661,8 +2611,7 @@  discard block
 block discarded – undo
2661 2611
 			if($module===false)
2662 2612
 				throw new TNotSupportedException('securitymanager_mcryptextension_initfailed');
2663 2613
 			return $module;
2664
-		}
2665
-		else
2614
+		} else
2666 2615
 			throw new TNotSupportedException('securitymanager_mcryptextension_required');
2667 2616
 	}
2668 2617
 	public function hashData($data)
@@ -2802,8 +2751,7 @@  discard block
 block discarded – undo
2802 2751
 					}
2803 2752
 				}
2804 2753
 				return '{'.$results.'}';
2805
-			}
2806
-			else
2754
+			} else
2807 2755
 			{
2808 2756
 				foreach($value as $v)
2809 2757
 				{
@@ -2816,8 +2764,7 @@  discard block
 block discarded – undo
2816 2764
 				}
2817 2765
 				return '['.$results.']';
2818 2766
 			}
2819
-		}
2820
-		else if(is_integer($value))
2767
+		} else if(is_integer($value))
2821 2768
 			return "$value";
2822 2769
 		else if(is_float($value))
2823 2770
 		{
@@ -2837,8 +2784,7 @@  discard block
 block discarded – undo
2837 2784
 						return str_replace($locale['decimal_point'], '.', "$value");
2838 2785
 					break;
2839 2786
 			}
2840
-		}
2841
-		else if(is_object($value))
2787
+		} else if(is_object($value))
2842 2788
 			if ($value instanceof TJavaScriptLiteral)
2843 2789
 				return $value->toJavaScriptLiteral();
2844 2790
 			else
@@ -2925,12 +2871,10 @@  discard block
 block discarded – undo
2925 2871
 						$name=urlencode($name.'[]');
2926 2872
 						foreach($value as $v)
2927 2873
 							$url.=$amp.$name.'='.urlencode($v);
2928
-					}
2929
-					else
2874
+					} else
2930 2875
 						$url.=$amp.urlencode($name).'='.urlencode($value);
2931 2876
 				}
2932
-			}
2933
-			else
2877
+			} else
2934 2878
 			{
2935 2879
 				foreach($getItems as $name=>$value)
2936 2880
 				{
@@ -2938,8 +2882,7 @@  discard block
 block discarded – undo
2938 2882
 					{
2939 2883
 						foreach($value as $v)
2940 2884
 							$url.=$amp.$name.'[]='.$v;
2941
-					}
2942
-					else
2885
+					} else
2943 2886
 						$url.=$amp.$name.'='.$value;
2944 2887
 				}
2945 2888
 			}
@@ -2977,14 +2920,12 @@  discard block
 block discarded – undo
2977 2920
 							$getVariables[substr($name,0,$pos)][]=$value;
2978 2921
 						else
2979 2922
 							$getVariables[$name]=$value;
2980
-					}
2981
-					else
2923
+					} else
2982 2924
 						$getVariables[$path]='';
2983 2925
 				}
2984 2926
 			}
2985 2927
 			return $getVariables;
2986
-		}
2987
-		else
2928
+		} else
2988 2929
 			return array();
2989 2930
 	}
2990 2931
 }
@@ -3068,8 +3009,7 @@  discard block
 block discarded – undo
3068 3009
 				$port=$_SERVER['SERVER_PORT'];
3069 3010
 				if(($port!=80 && !$secure) || ($port!=443 && $secure))
3070 3011
 					$url.=':'.$port;
3071
-			}
3072
-			else
3012
+			} else
3073 3013
 				$url.=$_SERVER['HTTP_HOST'];
3074 3014
 			$url.=$this->getRequestUri();
3075 3015
 			$this->_url=new TUri($url);
@@ -3139,8 +3079,7 @@  discard block
 block discarded – undo
3139 3079
 				{
3140 3080
 					$this->_urlManager=new TUrlManager;
3141 3081
 					$this->_urlManager->init(null);
3142
-				}
3143
-				else
3082
+				} else
3144 3083
 				{
3145 3084
 					$this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID);
3146 3085
 					if($this->_urlManager===null)
@@ -3205,8 +3144,7 @@  discard block
 block discarded – undo
3205 3144
 		static $result;
3206 3145
 		if($result === null && function_exists('apache_request_headers')) {
3207 3146
 			$result = apache_request_headers();
3208
-		}
3209
-		elseif($result === null) {
3147
+		} elseif($result === null) {
3210 3148
 			$result = array();
3211 3149
 			foreach($_SERVER as $key=>$value) {
3212 3150
 				if(strncasecmp($key, 'HTTP_', 5) !== 0) continue;
@@ -3261,8 +3199,7 @@  discard block
 block discarded – undo
3261 3199
 		try
3262 3200
 		{
3263 3201
 			return get_browser();
3264
-		}
3265
-		catch(TPhpErrorException $e)
3202
+		} catch(TPhpErrorException $e)
3266 3203
 		{
3267 3204
 			throw new TConfigurationException('httprequest_browscap_required');
3268 3205
 		}
@@ -3316,8 +3253,7 @@  discard block
 block discarded – undo
3316 3253
 					if(($value=$sm->validateData($value))!==false)
3317 3254
 						$this->_cookies->add(new THttpCookie($key,$value));
3318 3255
 				}
3319
-			}
3320
-			else
3256
+			} else
3321 3257
 			{
3322 3258
 				foreach($_COOKIE as $key=>$value)
3323 3259
 					$this->_cookies->add(new THttpCookie($key,$value));
@@ -3420,8 +3356,7 @@  discard block
 block discarded – undo
3420 3356
 			$value=$this->_items[$key];
3421 3357
 			unset($this->_items[$key]);
3422 3358
 			return $value;
3423
-		}
3424
-		else
3359
+		} else
3425 3360
 			return null;
3426 3361
 	}
3427 3362
 	public function clear()
@@ -3468,8 +3403,7 @@  discard block
 block discarded – undo
3468 3403
 			parent::insertAt($index,$item);
3469 3404
 			if($this->_o instanceof THttpResponse)
3470 3405
 				$this->_o->addCookie($item);
3471
-		}
3472
-		else
3406
+		} else
3473 3407
 			throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required');
3474 3408
 	}
3475 3409
 	public function removeAt($index)
@@ -3599,8 +3533,7 @@  discard block
 block discarded – undo
3599 3533
 			$this->_query=isset($ret['query'])?$ret['query']:'';
3600 3534
 			$this->_fragment=isset($ret['fragment'])?$ret['fragment']:'';
3601 3535
 			$this->_uri=$uri;
3602
-		}
3603
-		else
3536
+		} else
3604 3537
 		{
3605 3538
 			throw new TInvalidDataValueException('uri_format_invalid',$uri);
3606 3539
 		}
@@ -3772,7 +3705,7 @@  discard block
 block discarded – undo
3772 3705
 		$status=TPropertyValue::ensureInteger($status);
3773 3706
 		if(isset(self::$HTTP_STATUS_CODES[$status])) {
3774 3707
 			$this->_reason=self::$HTTP_STATUS_CODES[$status];
3775
-		}else{
3708
+		} else{
3776 3709
 			if($reason===null || $reason==='') {
3777 3710
 				throw new TInvalidDataValueException("response_status_reason_missing");
3778 3711
 			}
@@ -3836,8 +3769,7 @@  discard block
 block discarded – undo
3836 3769
 		{
3837 3770
 			foreach($headers as $h)
3838 3771
 				header($h);
3839
-		}
3840
-		else
3772
+		} else
3841 3773
 		{
3842 3774
 			header('Pragma: public');
3843 3775
 			header('Expires: 0');
@@ -3900,13 +3832,11 @@  discard block
 block discarded – undo
3900 3832
 				{
3901 3833
 					$this->_bufferOutput = false;
3902 3834
 					ob_end_flush();
3903
-				}
3904
-				else
3835
+				} else
3905 3836
 					ob_flush();
3906 3837
 				flush();
3907 3838
 			}
3908
-		}
3909
-		else
3839
+		} else
3910 3840
 			flush();
3911 3841
 	}
3912 3842
 	protected function ensureHttpHeaderSent()
@@ -3992,8 +3922,7 @@  discard block
 block discarded – undo
3992 3922
 				$cookie->getSecure(),
3993 3923
 				$cookie->getHttpOnly()
3994 3924
 			);
3995
-		}
3996
-		else {
3925
+		} else {
3997 3926
 			setcookie(
3998 3927
 				$cookie->getName(),
3999 3928
 				$cookie->getValue(),
@@ -4173,13 +4102,11 @@  discard block
 block discarded – undo
4173 4102
       {
4174 4103
 				ini_set('session.use_cookies','0');
4175 4104
 			  ini_set('session.use_only_cookies','0');
4176
-      }
4177
-			else if($value===THttpSessionCookieMode::Allow)
4105
+      } else if($value===THttpSessionCookieMode::Allow)
4178 4106
 			{
4179 4107
 				ini_set('session.use_cookies','1');
4180 4108
 				ini_set('session.use_only_cookies','0');
4181
-			}
4182
-			else
4109
+			} else
4183 4110
 			{
4184 4111
 				ini_set('session.use_cookies','1');
4185 4112
 				ini_set('session.use_only_cookies','1');
@@ -4213,8 +4140,7 @@  discard block
 block discarded – undo
4213 4140
 			{
4214 4141
 				ini_set('session.gc_probability',$value);
4215 4142
 				ini_set('session.gc_divisor','100');
4216
-			}
4217
-			else
4143
+			} else
4218 4144
 				throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value);
4219 4145
 		}
4220 4146
 	}
@@ -4300,8 +4226,7 @@  discard block
 block discarded – undo
4300 4226
 			$value=$_SESSION[$key];
4301 4227
 			unset($_SESSION[$key]);
4302 4228
 			return $value;
4303
-		}
4304
-		else
4229
+		} else
4305 4230
 			return null;
4306 4231
 	}
4307 4232
 	public function clear()
@@ -4617,10 +4542,8 @@  discard block
 block discarded – undo
4617 4542
 					return $this->_id;
4618 4543
 				else
4619 4544
 					return ($this->_uid=$prefix.self::ID_SEPARATOR.$this->_id);
4620
-			}
4621
-			else					return $this->_id;
4622
-		}
4623
-		else
4545
+			} else					return $this->_id;
4546
+		} else
4624 4547
 			return $this->_uid;
4625 4548
 	}
4626 4549
 	public function focus()
@@ -4696,8 +4619,7 @@  discard block
 block discarded – undo
4696 4619
 				if(!$control->getVisible(false))
4697 4620
 					return false;
4698 4621
 			return true;
4699
-		}
4700
-		else
4622
+		} else
4701 4623
 			return $this->getViewState('Visible',true);
4702 4624
 	}
4703 4625
 	public function setVisible($value)
@@ -4712,8 +4634,7 @@  discard block
 block discarded – undo
4712 4634
 				if(!$control->getViewState('Enabled',true))
4713 4635
 					return false;
4714 4636
 			return true;
4715
-		}
4716
-		else
4637
+		} else
4717 4638
 			return $this->getViewState('Enabled',true);
4718 4639
 	}
4719 4640
 	public function setEnabled($value)
@@ -4771,8 +4692,7 @@  discard block
 block discarded – undo
4771 4692
 				if($control->_flags & self::IS_DISABLE_VIEWSTATE)
4772 4693
 					return false;
4773 4694
 			return true;
4774
-		}
4775
-		else
4695
+		} else
4776 4696
 			return !($this->_flags & self::IS_DISABLE_VIEWSTATE);
4777 4697
 	}
4778 4698
 	public function setEnableViewState($value)
@@ -4810,8 +4730,7 @@  discard block
 block discarded – undo
4810 4730
 			if(is_object($this->_tempState[$key]) && $this->_trackViewState)
4811 4731
 				$this->_viewState[$key]=$this->_tempState[$key];
4812 4732
 			return $this->_tempState[$key];
4813
-		}
4814
-		else
4733
+		} else
4815 4734
 			return $defaultValue;
4816 4735
 	}
4817 4736
 	public function setViewState($key,$value,$defaultValue=null)
@@ -4823,8 +4742,7 @@  discard block
 block discarded – undo
4823 4742
 				unset($this->_viewState[$key]);
4824 4743
 			else
4825 4744
 				$this->_viewState[$key]=$value;
4826
-		}
4827
-		else
4745
+		} else
4828 4746
 		{
4829 4747
 			unset($this->_viewState[$key]);
4830 4748
 			if($value===$defaultValue)
@@ -4913,8 +4831,7 @@  discard block
 block discarded – undo
4913 4831
 					$this->createChildControls();
4914 4832
 				$this->_flags &= ~self::IS_CREATING_CHILD;
4915 4833
 				$this->_flags |= self::IS_CHILD_CREATED;
4916
-			}
4917
-			catch(Exception $e)
4834
+			} catch(Exception $e)
4918 4835
 			{
4919 4836
 				$this->_flags &= ~self::IS_CREATING_CHILD;
4920 4837
 				$this->_flags |= self::IS_CHILD_CREATED;
@@ -5038,8 +4955,9 @@  discard block
 block discarded – undo
5038 4955
 	final protected function isDescendentOf($ancestor)
5039 4956
 	{
5040 4957
 		$control=$this;
5041
-		while($control!==$ancestor && $control->_parent)
5042
-			$control=$control->_parent;
4958
+		while($control!==$ancestor && $control->_parent) {
4959
+					$control=$control->_parent;
4960
+		}
5043 4961
 		return $control===$ancestor;
5044 4962
 	}
5045 4963
 	public function addedControl($control)
@@ -5067,8 +4985,7 @@  discard block
 block discarded – undo
5067 4985
 				{
5068 4986
 					$state=$this->_rf[self::RF_CHILD_STATE][$control->_id];
5069 4987
 					unset($this->_rf[self::RF_CHILD_STATE][$control->_id]);
5070
-				}
5071
-				else
4988
+				} else
5072 4989
 					$state=null;
5073 4990
 				$control->loadStateRecursive($state,!($this->_flags & self::IS_DISABLE_VIEWSTATE));
5074 4991
 				if($this->_stage>=self::CS_LOADED)
@@ -5301,8 +5218,7 @@  discard block
 block discarded – undo
5301 5218
 			{
5302 5219
 				$this->_rf[self::RF_CONTROLSTATE]=&$state[1];
5303 5220
 				unset($state[1]);
5304
-			}
5305
-			else
5221
+			} else
5306 5222
 				unset($this->_rf[self::RF_CONTROLSTATE]);
5307 5223
 			if($needViewState)
5308 5224
 			{
@@ -5366,8 +5282,7 @@  discard block
 block discarded – undo
5366 5282
 		{
5367 5283
 			$page->applyControlStyleSheet($this);
5368 5284
 			$this->_flags |= self::IS_STYLESHEET_APPLIED;
5369
-		}
5370
-		else if($this->_flags & self::IS_STYLESHEET_APPLIED)
5285
+		} else if($this->_flags & self::IS_STYLESHEET_APPLIED)
5371 5286
 			throw new TInvalidOperationException('control_stylesheet_applied',get_class($this));
5372 5287
 	}
5373 5288
 	private function clearCachedUniqueID($recursive)
@@ -5430,8 +5345,7 @@  discard block
 block discarded – undo
5430 5345
 		{
5431 5346
 			parent::insertAt($index,$item);
5432 5347
 			$this->_o->addedControl($item);
5433
-		}
5434
-		else if(is_string($item) || ($item instanceof IRenderable))
5348
+		} else if(is_string($item) || ($item instanceof IRenderable))
5435 5349
 			parent::insertAt($index,$item);
5436 5350
 		else
5437 5351
 			throw new TInvalidDataTypeException('controlcollection_control_required');
@@ -5591,8 +5505,7 @@  discard block
 block discarded – undo
5591 5505
 				else if($item[0]===self::TYPE_DATABINDING)
5592 5506
 					$this->_bindings[$id]=$item[1];
5593 5507
 				$this->_items[$id]='';
5594
-			}
5595
-			else
5508
+			} else
5596 5509
 				$this->_items[$id]=$item;
5597 5510
 		}
5598 5511
 	}
@@ -6739,8 +6652,7 @@  discard block
 block discarded – undo
6739 6652
 			if(!isset(self::$_template[$class]))
6740 6653
 				self::$_template[$class]=$this->loadTemplate();
6741 6654
 			return self::$_template[$class];
6742
-		}
6743
-		else
6655
+		} else
6744 6656
 			return $this->_localTemplate;
6745 6657
 	}
6746 6658
 	public function setTemplate($value)
@@ -6814,8 +6726,7 @@  discard block
 block discarded – undo
6814 6726
 			$controls=$placeholder->getParent()->getControls();
6815 6727
 			$loc=$controls->remove($placeholder);
6816 6728
 			$controls->insertAt($loc,$content);
6817
-		}
6818
-		else
6729
+		} else
6819 6730
 			throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id);
6820 6731
 	}
6821 6732
 	protected function initRecursive($namingContainer=null)
@@ -6832,8 +6743,7 @@  discard block
 block discarded – undo
6832 6743
 			$master->ensureChildControls();
6833 6744
 			foreach($this->_contents as $id=>$content)
6834 6745
 				$master->injectContent($id,$content);
6835
-		}
6836
-		else if(!empty($this->_contents))
6746
+		} else if(!empty($this->_contents))
6837 6747
 			throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this));
6838 6748
 		parent::initRecursive($namingContainer);
6839 6749
 	}
@@ -6853,8 +6763,7 @@  discard block
 block discarded – undo
6853 6763
                                                 $control->Checked = (boolean) $arObj->{$key};
6854 6764
                                         elseif ($control instanceof TDatePicker)
6855 6765
                                                 $control->Date = $arObj->{$key};
6856
-                                }
6857
-                                else
6766
+                                } else
6858 6767
                                 {
6859 6768
                                         foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
6860 6769
                                         {
@@ -6876,8 +6785,7 @@  discard block
 block discarded – undo
6876 6785
                                         }
6877 6786
                                         break;
6878 6787
                                 }
6879
-                        } 
6880
-                        catch (Exception $ex)
6788
+                        } catch (Exception $ex)
6881 6789
                         {
6882 6790
                                 if ($throwExceptions)
6883 6791
                                         throw $ex;
@@ -6900,8 +6808,7 @@  discard block
 block discarded – undo
6900 6808
                                         $arObj->{$key} = $control->Checked;
6901 6809
                                 elseif ($control instanceof TDatePicker)
6902 6810
                                         $arObj->{$key} = $control->Date;
6903
-                        } 
6904
-                        catch (Exception $ex)
6811
+                        } catch (Exception $ex)
6905 6812
                         {
6906 6813
                                 if ($throwExceptions)
6907 6814
                                         throw $ex;
@@ -6952,8 +6859,7 @@  discard block
 block discarded – undo
6952 6859
  			$page->endFormRender($writer);
6953 6860
 			$cs->renderScriptFilesEnd($writer);
6954 6861
 			$cs->renderEndScripts($writer);
6955
-		}
6956
-		else
6862
+		} else
6957 6863
 		{
6958 6864
 			$cs->renderHiddenFieldsBegin($writer);
6959 6865
 			$page->beginFormRender($writer);
@@ -7111,8 +7017,7 @@  discard block
 block discarded – undo
7111 7017
 				$base = $dir;
7112 7018
 			}
7113 7019
 			return array($assets->getPublishedPath($base), $assets->publishFilePath($base));
7114
-		}
7115
-		else
7020
+		} else
7116 7021
 		{
7117 7022
 			return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base);
7118 7023
 		}
@@ -7400,8 +7305,7 @@  discard block
 block discarded – undo
7400 7305
 			{
7401 7306
 				foreach($value as $v)
7402 7307
 					$str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n";
7403
-			}
7404
-			else
7308
+			} else
7405 7309
 			{
7406 7310
 				$str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n";
7407 7311
 			}
@@ -7510,8 +7414,7 @@  discard block
 block discarded – undo
7510 7414
 				$this->processCallbackRequest($writer);
7511 7415
 			else
7512 7416
 				$this->processPostBackRequest($writer);
7513
-		}
7514
-		else
7417
+		} else
7515 7418
 			$this->processNormalRequest($writer);
7516 7419
 		$this->_writer = null;
7517 7420
 	}
@@ -7657,8 +7560,7 @@  discard block
 block discarded – undo
7657 7560
 			{
7658 7561
 				foreach($this->_validators as $validator)
7659 7562
 					$validator->validate();
7660
-			}
7661
-			else
7563
+			} else
7662 7564
 			{
7663 7565
 				foreach($this->_validators as $validator)
7664 7566
 				{
@@ -7679,8 +7581,7 @@  discard block
 block discarded – undo
7679 7581
 						return false;
7680 7582
 			}
7681 7583
 			return true;
7682
-		}
7683
-		else
7584
+		} else
7684 7585
 			throw new TInvalidOperationException('page_isvalid_unknown');
7685 7586
 	}
7686 7587
 	public function getTheme()
@@ -7865,14 +7766,12 @@  discard block
 block discarded – undo
7865 7766
 				{
7866 7767
 					if($control->loadPostData($key,$postData))
7867 7768
 						$this->_controlsPostDataChanged[]=$control;
7868
-				}
7869
-				else if($control instanceof IPostBackEventHandler &&
7769
+				} else if($control instanceof IPostBackEventHandler &&
7870 7770
 					empty($this->_postData[self::FIELD_POSTBACK_TARGET]))
7871 7771
 				{
7872 7772
 					$this->_postData->add(self::FIELD_POSTBACK_TARGET,$key);  				}
7873 7773
 				unset($this->_controlsRequiringPostData[$key]);
7874
-			}
7875
-			else if($beforeLoad)
7774
+			} else if($beforeLoad)
7876 7775
 				$this->_restPostData->add($key,$value);
7877 7776
 		}
7878 7777
 		foreach($this->_controlsRequiringPostData as $key=>$value)
@@ -7883,8 +7782,7 @@  discard block
 block discarded – undo
7883 7782
 				{
7884 7783
 					if($control->loadPostData($key,$this->_postData))
7885 7784
 						$this->_controlsPostDataChanged[]=$control;
7886
-				}
7887
-				else
7785
+				} else
7888 7786
 					throw new TInvalidDataValueException('page_postbackcontrol_invalid',$key);
7889 7787
 				unset($this->_controlsRequiringPostData[$key]);
7890 7788
 			}
@@ -7933,8 +7831,7 @@  discard block
 block discarded – undo
7933 7831
 			else
7934 7832
 				$focus=$this->_focus;
7935 7833
 			$this->getClientScript()->registerFocusControl($focus);
7936
-		}
7937
-		else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null)
7834
+		} else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null)
7938 7835
 			$this->getClientScript()->registerFocusControl($lastFocus);
7939 7836
 		$this->_inFormRender=false;
7940 7837
 	}
@@ -8100,8 +7997,7 @@  discard block
 block discarded – undo
8100 7997
 			{
8101 7998
 				if(($str=$sm->validateData($str))!==false)
8102 7999
 					return unserialize($str);
8103
-			}
8104
-			else
8000
+			} else
8105 8001
 				return unserialize($str);
8106 8002
 		}
8107 8003
 		return null;
@@ -8142,8 +8038,7 @@  discard block
 block discarded – undo
8142 8038
 					$this->_cache=$this->getApplication()->getModule($this->_cacheModuleID);
8143 8039
 					if(!($this->_cache instanceof ICache))
8144 8040
 						throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID);
8145
-				}
8146
-				else
8041
+				} else
8147 8042
 					$this->_cache=$this->getApplication()->getCache();
8148 8043
 				if($this->_cache!==null)
8149 8044
 				{
@@ -8155,8 +8050,7 @@  discard block
 block discarded – undo
8155 8050
 						$param->setCacheTime(isset($data[3])?$data[3]:0);
8156 8051
 						$this->onCheckDependency($param);
8157 8052
 						$this->_dataCached=$param->getIsValid();
8158
-					}
8159
-					else
8053
+					} else
8160 8054
 						$this->_dataCached=false;
8161 8055
 					if($this->_dataCached)
8162 8056
 						list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data;
@@ -8172,8 +8066,7 @@  discard block
 block discarded – undo
8172 8066
 			$stack->push($this);
8173 8067
 			parent::initRecursive($namingContainer);
8174 8068
 			$stack->pop();
8175
-		}
8176
-		else
8069
+		} else
8177 8070
 			parent::initRecursive($namingContainer);
8178 8071
 	}
8179 8072
 	protected function loadRecursive()
@@ -8184,8 +8077,7 @@  discard block
 block discarded – undo
8184 8077
 			$stack->push($this);
8185 8078
 			parent::loadRecursive();
8186 8079
 			$stack->pop();
8187
-		}
8188
-		else
8080
+		} else
8189 8081
 		{
8190 8082
 			if($this->_dataCached)
8191 8083
 				$this->performActions();
@@ -8214,8 +8106,7 @@  discard block
 block discarded – undo
8214 8106
 			$stack->push($this);
8215 8107
 			parent::preRenderRecursive();
8216 8108
 			$stack->pop();
8217
-		}
8218
-		else
8109
+		} else
8219 8110
 			parent::preRenderRecursive();
8220 8111
 	}
8221 8112
 	protected function loadStateRecursive(&$state,$needViewState=true)
@@ -8351,8 +8242,7 @@  discard block
 block discarded – undo
8351 8242
 			$content=$textwriter->flush();
8352 8243
 			$data=array($content,$this->_state,$this->_actions,time());
8353 8244
 			$this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency());
8354
-		}
8355
-		else
8245
+		} else
8356 8246
 			parent::render($writer);
8357 8247
 	}
8358 8248
 }
@@ -8457,8 +8347,7 @@  discard block
 block discarded – undo
8457 8347
 				$cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName,array($template,$timestamps));
8458 8348
 				return $template;
8459 8349
 			}
8460
-		}
8461
-		else
8350
+		} else
8462 8351
 			return null;
8463 8352
 	}
8464 8353
 	protected function getLocalizedTemplate($filename)
@@ -8578,8 +8467,7 @@  discard block
 block discarded – undo
8578 8467
 						$component->createdOnTemplate($parent);
8579 8468
 					if($component->getAllowChildControls())
8580 8469
 						$controls[$key]=$component;
8581
-				}
8582
-				else if($component instanceof TComponent)
8470
+				} else if($component instanceof TComponent)
8583 8471
 				{
8584 8472
 					$controls[$key]=$component;
8585 8473
 					if(isset($properties['id']))
@@ -8597,8 +8485,7 @@  discard block
 block discarded – undo
8597 8485
 					else
8598 8486
 						$component->createdOnTemplate($parent);
8599 8487
 				}
8600
-			}
8601
-			else
8488
+			} else
8602 8489
 			{
8603 8490
 				if($object[1] instanceof TCompositeLiteral)
8604 8491
 				{
@@ -8608,8 +8495,7 @@  discard block
 block discarded – undo
8608 8495
 						$directChildren[]=$o;
8609 8496
 					else
8610 8497
 						$parent->addParsedObject($o);
8611
-				}
8612
-				else
8498
+				} else
8613 8499
 				{
8614 8500
 					if($parent===$parentControl)
8615 8501
 						$directChildren[]=$object[1];
@@ -8680,8 +8566,7 @@  discard block
 block discarded – undo
8680 8566
 				default:						throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
8681 8567
 					break;
8682 8568
 			}
8683
-		}
8684
-		else
8569
+		} else
8685 8570
 		{
8686 8571
 			if (substr($name,0,2)=='js')
8687 8572
 				if ($value and !($value instanceof TJavaScriptLiteral))
@@ -8717,8 +8602,7 @@  discard block
 block discarded – undo
8717 8602
 				default:						throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
8718 8603
 					break;
8719 8604
 			}
8720
-		}
8721
-		else
8605
+		} else
8722 8606
 			$component->setSubProperty($name,$value);
8723 8607
 	}
8724 8608
 	protected function parse($input)
@@ -8755,8 +8639,7 @@  discard block
 block discarded – undo
8755 8639
 						$stack[] = $type;
8756 8640
 						$container=$c-1;
8757 8641
 					}
8758
-				}
8759
-				else if(strpos($str,'</com:')===0)					{
8642
+				} else if(strpos($str,'</com:')===0)					{
8760 8643
 					if($expectPropEnd)
8761 8644
 						continue;
8762 8645
 					if($matchStart>$textStart)
@@ -8772,8 +8655,7 @@  discard block
 block discarded – undo
8772 8655
 						throw new TConfigurationException('template_closingtag_expected',$tag);
8773 8656
 					}
8774 8657
 					$container=$tpl[$container][0];
8775
-				}
8776
-				else if(strpos($str,'<%@')===0)					{
8658
+				} else if(strpos($str,'<%@')===0)					{
8777 8659
 					if($expectPropEnd)
8778 8660
 						continue;
8779 8661
 					if($matchStart>$textStart)
@@ -8782,8 +8664,7 @@  discard block
 block discarded – undo
8782 8664
 					if(isset($tpl[0]) || $this->_directive!==null)
8783 8665
 						throw new TConfigurationException('template_directive_nonunique');
8784 8666
 					$this->_directive=$this->parseAttributes($match[4][0],$match[4][1]);
8785
-				}
8786
-				else if(strpos($str,'<%')===0)					{
8667
+				} else if(strpos($str,'<%')===0)					{
8787 8668
 					if($expectPropEnd)
8788 8669
 						continue;
8789 8670
 					if($matchStart>$textStart)
@@ -8805,8 +8686,7 @@  discard block
 block discarded – undo
8805 8686
 						$literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\"));
8806 8687
 						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')"));
8807 8688
 					}
8808
-				}
8809
-				else if(strpos($str,'<prop:')===0)					{
8689
+				} else if(strpos($str,'<prop:')===0)					{
8810 8690
 					if(strrpos($str,'/>')===strlen($str)-2)  					{
8811 8691
 						if($expectPropEnd)
8812 8692
 							continue;
@@ -8826,8 +8706,7 @@  discard block
 block discarded – undo
8826 8706
 								throw new TConfigurationException('template_property_duplicated',$name);
8827 8707
 							$tpl[$container][2][$name]=$value;
8828 8708
 						}
8829
-					}
8830
-					else  					{
8709
+					} else  					{
8831 8710
 						$prop=strtolower($match[3][0]);
8832 8711
 						$stack[] = '@'.$prop;
8833 8712
 						if(!$expectPropEnd)
@@ -8838,8 +8717,7 @@  discard block
 block discarded – undo
8838 8717
 							$expectPropEnd=true;
8839 8718
 						}
8840 8719
 					}
8841
-				}
8842
-				else if(strpos($str,'</prop:')===0)					{
8720
+				} else if(strpos($str,'</prop:')===0)					{
8843 8721
 					$prop=strtolower($match[3][0]);
8844 8722
 					if(empty($stack))
8845 8723
 						throw new TConfigurationException('template_closingtag_unexpected',"</prop:$prop>");
@@ -8865,21 +8743,18 @@  discard block
 block discarded – undo
8865 8743
 								if(isset($tpl[$container][2][$prop]))
8866 8744
 									throw new TConfigurationException('template_property_duplicated',$prop);
8867 8745
 								$tpl[$container][2][$prop]=$value;
8868
-							}
8869
-							else									$this->_directive[$prop]=$value;
8746
+							} else									$this->_directive[$prop]=$value;
8870 8747
 							$textStart=$matchEnd+1;
8871 8748
 						}
8872 8749
 						$expectPropEnd=false;
8873 8750
 					}
8874
-				}
8875
-				else if(strpos($str,'<!--')===0)					{
8751
+				} else if(strpos($str,'<!--')===0)					{
8876 8752
 					if($expectPropEnd)
8877 8753
 						throw new TConfigurationException('template_comments_forbidden');
8878 8754
 					if($matchStart>$textStart)
8879 8755
 						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8880 8756
 					$textStart=$matchEnd+1;
8881
-				}
8882
-				else
8757
+				} else
8883 8758
 					throw new TConfigurationException('template_matching_unexpected',$match);
8884 8759
 			}
8885 8760
 			if(!empty($stack))
@@ -8890,8 +8765,7 @@  discard block
 block discarded – undo
8890 8765
 			}
8891 8766
 			if($textStart<strlen($input))
8892 8767
 				$tpl[$c++]=array($container,substr($input,$textStart));
8893
-		}
8894
-		catch(Exception $e)
8768
+		} catch(Exception $e)
8895 8769
 		{
8896 8770
 			if(($e instanceof TException) && ($e instanceof TTemplateException))
8897 8771
 				throw $e;
@@ -8921,14 +8795,12 @@  discard block
 block discarded – undo
8921 8795
 				{
8922 8796
 					$parent=null;
8923 8797
 					$objects[$id]=$object;
8924
-				}
8925
-				else
8798
+				} else
8926 8799
 				{
8927 8800
 					$parent=$object[0];
8928 8801
 					$merged=array($parent,array($object[1]));
8929 8802
 				}
8930
-			}
8931
-			else
8803
+			} else
8932 8804
 				$merged[1][]=$object[1];
8933 8805
 		}
8934 8806
 		if($parent!==null)
@@ -8961,8 +8833,7 @@  discard block
 block discarded – undo
8961 8833
 					$attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1);
8962 8834
 				else
8963 8835
 					$attributes[$name]=$this->parseTemplateProperty($value,$match[2][1]);
8964
-			}
8965
-			else
8836
+			} else
8966 8837
 			{
8967 8838
 				if($value[0]==='\'' || $value[0]==='"')
8968 8839
 					$attributes[$name]=$this->parseAttribute(substr($value,1,strlen($value)-2));
@@ -9004,8 +8875,7 @@  discard block
 block discarded – undo
9004 8875
 				return array(self::CONFIG_DATABIND,ltrim($expr,'.'));
9005 8876
 			else
9006 8877
 				return array(self::CONFIG_EXPRESSION,ltrim($expr,'.'));
9007
-		}
9008
-		else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value)
8878
+		} else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value)
9009 8879
 		{
9010 8880
 			$value=$matches[1];
9011 8881
 			if($value[2]==='~')
@@ -9018,8 +8888,7 @@  discard block
 block discarded – undo
9018 8888
 				$literal = trim(substr($value,3,strlen($value)-5));
9019 8889
 				return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'");
9020 8890
 			}
9021
-		}
9022
-		else
8891
+		} else
9023 8892
 			return $value;
9024 8893
 	}
9025 8894
 	protected function validateAttributes($type,$attributes)
@@ -9039,15 +8908,13 @@  discard block
 block discarded – undo
9039 8908
 										$subname=substr($name,0,$pos);
9040 8909
 					if(!$class->hasMethod('get'.$subname))
9041 8910
 						throw new TConfigurationException('template_property_unknown',$type,$subname);
9042
-				}
9043
-				else if(strncasecmp($name,'on',2)===0)
8911
+				} else if(strncasecmp($name,'on',2)===0)
9044 8912
 				{
9045 8913
 										if(!$class->hasMethod($name))
9046 8914
 						throw new TConfigurationException('template_event_unknown',$type,$name);
9047 8915
 					else if(!is_string($att))
9048 8916
 						throw new TConfigurationException('template_eventhandler_invalid',$type,$name);
9049
-				}
9050
-				else
8917
+				} else
9051 8918
 				{
9052 8919
 										if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) )
9053 8920
 					{
@@ -9055,8 +8922,7 @@  discard block
 block discarded – undo
9055 8922
 							throw new TConfigurationException('template_property_readonly',$type,$name);
9056 8923
 						else
9057 8924
 							throw new TConfigurationException('template_property_unknown',$type,$name);
9058
-					}
9059
-					else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION)
8925
+					} else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION)
9060 8926
 					{
9061 8927
 						if(strcasecmp($name,'id')===0)
9062 8928
 							throw new TConfigurationException('template_controlid_invalid',$type);
@@ -9065,8 +8931,7 @@  discard block
 block discarded – undo
9065 8931
 					}
9066 8932
 				}
9067 8933
 			}
9068
-		}
9069
-		else if(is_subclass_of($className,'TComponent') || $className==='TComponent')
8934
+		} else if(is_subclass_of($className,'TComponent') || $className==='TComponent')
9070 8935
 		{
9071 8936
 			foreach($attributes as $name=>$att)
9072 8937
 			{
@@ -9077,8 +8942,7 @@  discard block
 block discarded – undo
9077 8942
 										$subname=substr($name,0,$pos);
9078 8943
 					if(!$class->hasMethod('get'.$subname))
9079 8944
 						throw new TConfigurationException('template_property_unknown',$type,$subname);
9080
-				}
9081
-				else if(strncasecmp($name,'on',2)===0)
8945
+				} else if(strncasecmp($name,'on',2)===0)
9082 8946
 					throw new TConfigurationException('template_event_forbidden',$type,$name);
9083 8947
 				else
9084 8948
 				{
@@ -9091,8 +8955,7 @@  discard block
 block discarded – undo
9091 8955
 					}
9092 8956
 				}
9093 8957
 			}
9094
-		}
9095
-		else
8958
+		} else
9096 8959
 			throw new TConfigurationException('template_component_required',$type);
9097 8960
 	}
9098 8961
 	public function getIncludedFiles()
@@ -9112,8 +8975,7 @@  discard block
 block discarded – undo
9112 8975
 						$line=$line-$this->_includeAtLine[$i]+1;
9113 8976
 						$srcFile=$this->_includedFiles[$i];
9114 8977
 						break;
9115
-					}
9116
-					else
8978
+					} else
9117 8979
 						$line=$line-$this->_includeLines[$i]+1;
9118 8980
 				}
9119 8981
 			}
@@ -9299,8 +9161,7 @@  discard block
 block discarded – undo
9299 9161
 					closedir($dir);
9300 9162
 					if($cacheValid)
9301 9163
 						$this->_skins=$skins;
9302
-				}
9303
-				else
9164
+				} else
9304 9165
 				{
9305 9166
 					$cacheValid=true;
9306 9167
 					$this->_cssFiles=$cssFiles;
@@ -9425,19 +9286,15 @@  discard block
 block discarded – undo
9425 9286
 							{
9426 9287
 								$setter='set'.$name;
9427 9288
 								$control->$setter($value);
9428
-							}
9429
-							else
9289
+							} else
9430 9290
 								throw new TConfigurationException('theme_property_readonly',$type,$name);
9431
-						}
9432
-						else
9291
+						} else
9433 9292
 							throw new TConfigurationException('theme_property_undefined',$type,$name);
9434
-					}
9435
-					else							$control->setSubProperty($name,$value);
9293
+					} else							$control->setSubProperty($name,$value);
9436 9294
 				}
9437 9295
 			}
9438 9296
 			return true;
9439
-		}
9440
-		else
9297
+		} else
9441 9298
 			return false;
9442 9299
 	}
9443 9300
 	public function getStyleSheetFiles()
@@ -9530,8 +9387,7 @@  discard block
 block discarded – undo
9530 9387
 					$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
9531 9388
 			}
9532 9389
 			$pageConfig->loadFromFiles($this->getBasePath());
9533
-		}
9534
-		else
9390
+		} else
9535 9391
 		{
9536 9392
 			$configCached=true;
9537 9393
 			$currentTimestamp=array();
@@ -9548,8 +9404,7 @@  discard block
 block discarded – undo
9548 9404
 							$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
9549 9405
 							if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0]))
9550 9406
 								$configCached=false;
9551
-						}
9552
-						else
9407
+						} else
9553 9408
 						{
9554 9409
 							$currentTimestamp[$fileName]=@filemtime($fileName);
9555 9410
 							if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName]))
@@ -9557,8 +9412,7 @@  discard block
 block discarded – undo
9557 9412
 						}
9558 9413
 					}
9559 9414
 				}
9560
-			}
9561
-			else
9415
+			} else
9562 9416
 			{
9563 9417
 				$configCached=false;
9564 9418
 				$paths=explode('.',$pagePath);
@@ -9701,8 +9555,7 @@  discard block
 block discarded – undo
9701 9555
 			$className=basename($path);
9702 9556
 			if(!class_exists($className,false))
9703 9557
 				include_once($path.Prado::CLASS_FILE_EXT);
9704
-		}
9705
-		else
9558
+		} else
9706 9559
 		{
9707 9560
 			$className=$this->getBasePageClass();
9708 9561
 			Prado::using($className);
@@ -9784,8 +9637,7 @@  discard block
 block discarded – undo
9784 9637
 		{
9785 9638
 			$fcontent = include $fname;
9786 9639
 			$this->loadFromPhp($fcontent,dirname($fname),$configPagePath);
9787
-		}
9788
-		else
9640
+		} else
9789 9641
 		{
9790 9642
 			$dom=new TXmlDocument;
9791 9643
 			if($dom->loadFromFile($fname))
@@ -10028,8 +9880,7 @@  discard block
 block discarded – undo
10028 9880
 			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
10029 9881
 				$this->copyFile($fullpath,$dst);
10030 9882
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName;
10031
-		}
10032
-		else
9883
+		} else
10033 9884
 		{
10034 9885
 			$dir=$this->hash($fullpath);
10035 9886
 			if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
@@ -10100,8 +9951,7 @@  discard block
 block discarded – undo
10100 9951
 						@copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
10101 9952
 						@chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD);
10102 9953
 					}
10103
-				}
10104
-				else
9954
+				} else
10105 9955
 					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
10106 9956
 			}
10107 9957
 			closedir($folder);
@@ -10230,8 +10080,7 @@  discard block
 block discarded – undo
10230 10080
 					throw new TConfigurationException('globalization_source_path_failed',
10231 10081
 						$config['source']);
10232 10082
 					chmod($config['source'], PRADO_CHMOD); 				}
10233
-			}
10234
-			else
10083
+			} else
10235 10084
 			{
10236 10085
 				throw new TConfigurationException("invalid source dir '{$config['source']}'");
10237 10086
 			}
@@ -10362,8 +10211,7 @@  discard block
 block discarded – undo
10362 10211
 		{
10363 10212
 			$configFile=$basePath;
10364 10213
 			$basePath=dirname($configFile);
10365
-		}
10366
-		else
10214
+		} else
10367 10215
 			$configFile=null;
10368 10216
 				$runtimePath=$basePath.DIRECTORY_SEPARATOR.self::RUNTIME_PATH;
10369 10217
 		if(is_writable($runtimePath))
@@ -10380,8 +10228,7 @@  discard block
 block discarded – undo
10380 10228
 			}
10381 10229
 			$this->setBasePath($basePath);
10382 10230
 			$this->setRuntimePath($runtimePath);
10383
-		}
10384
-		else
10231
+		} else
10385 10232
 			throw new TConfigurationException('application_runtimepath_invalid',$runtimePath);
10386 10233
 	}
10387 10234
 	public function run()
@@ -10402,8 +10249,7 @@  discard block
 block discarded – undo
10402 10249
 				$this->$method();
10403 10250
 				$this->_step++;
10404 10251
 			}
10405
-		}
10406
-		catch(Exception $e)
10252
+		} catch(Exception $e)
10407 10253
 		{
10408 10254
 			$this->onError($e);
10409 10255
 		}
@@ -10747,8 +10593,7 @@  discard block
 block discarded – undo
10747 10593
 				foreach($parameter[1] as $name=>$value)
10748 10594
 					$component->setSubProperty($name,$value);
10749 10595
 				$this->_parameters->add($id,$component);
10750
-			}
10751
-			else
10596
+			} else
10752 10597
 				$this->_parameters->add($id,$parameter);
10753 10598
 		}
10754 10599
 				$modules=array();
@@ -10789,8 +10634,7 @@  discard block
 block discarded – undo
10789 10634
 				$config->loadFromFile($this->_configFile);
10790 10635
 				if($this->_cacheFile!==null)
10791 10636
 					file_put_contents($this->_cacheFile,serialize($config),LOCK_EX);
10792
-			}
10793
-			else
10637
+			} else
10794 10638
 				$config=unserialize(file_get_contents($this->_cacheFile));
10795 10639
 			$this->applyConfiguration($config,false);
10796 10640
 		}
@@ -10822,8 +10666,7 @@  discard block
 block discarded – undo
10822 10666
 				$this->applyConfiguration($config,true);
10823 10667
 			}
10824 10668
 			$service->init($configElement);
10825
-		}
10826
-		else
10669
+		} else
10827 10670
 			throw new THttpException(500,'application_service_unknown',$serviceID);
10828 10671
 	}
10829 10672
 	public function onError($param)
@@ -10915,8 +10758,7 @@  discard block
 block discarded – undo
10915 10758
 		{
10916 10759
 			$fcontent = include $fname;
10917 10760
 			$this->loadFromPhp($fcontent,dirname($fname));
10918
-		}
10919
-		else
10761
+		} else
10920 10762
 		{
10921 10763
 			$dom=new TXmlDocument;
10922 10764
 			$dom->loadFromFile($fname);
@@ -11023,8 +10865,7 @@  discard block
 block discarded – undo
11023 10865
 						if(isset($this->_aliases[$id]))
11024 10866
 							throw new TConfigurationException('appconfig_alias_redefined',$id);
11025 10867
 						$this->_aliases[$id]=$p;
11026
-					}
11027
-					else
10868
+					} else
11028 10869
 						throw new TConfigurationException('appconfig_alias_invalid');
11029 10870
 					$this->_empty=false;
11030 10871
 					break;
@@ -11079,8 +10920,7 @@  discard block
 block discarded – undo
11079 10920
 				else
11080 10921
 					$this->_modules[$id]=array($type,$properties->toArray(),$element);
11081 10922
 				$this->_empty=false;
11082
-			}
11083
-			else
10923
+			} else
11084 10924
 				throw new TConfigurationException('appconfig_modules_invalid',$element->getTagName());
11085 10925
 		}
11086 10926
 	}
@@ -11112,8 +10952,7 @@  discard block
 block discarded – undo
11112 10952
 				$element->setParent(null);
11113 10953
 				$this->_services[$id]=array($type,$properties->toArray(),$element);
11114 10954
 				$this->_empty=false;
11115
-			}
11116
-			else
10955
+			} else
11117 10956
 				throw new TConfigurationException('appconfig_services_invalid',$element->getTagName());
11118 10957
 		}
11119 10958
 	}
@@ -11131,8 +10970,7 @@  discard block
 block discarded – undo
11131 10970
 					$properties['id'] = $id;
11132 10971
 					$this->_parameters[$id] = array($type,$properties);
11133 10972
 				}
11134
-			}
11135
-			else
10973
+			} else
11136 10974
 			{
11137 10975
 				$this->_parameters[$id] = $parameter;
11138 10976
 			}
@@ -11153,12 +10991,10 @@  discard block
 block discarded – undo
11153 10991
 						$this->_parameters[$id]=$element;
11154 10992
 					else
11155 10993
 						$this->_parameters[$id]=$value;
11156
-				}
11157
-				else
10994
+				} else
11158 10995
 					$this->_parameters[$id]=array($type,$properties->toArray());
11159 10996
 				$this->_empty=false;
11160
-			}
11161
-			else
10997
+			} else
11162 10998
 				throw new TConfigurationException('appconfig_parameters_invalid',$element->getTagName());
11163 10999
 		}
11164 11000
 	}
Please login to merge, or discard this patch.