Completed
Push — autoload ( 7f2c9b...4808d1 )
by Fabio
42:25 queued 32:40
created
framework/pradolite.php 2 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.
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.
framework/PradoBase.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
 if(!defined('PRADO_DIR'))
19 19
 	define('PRADO_DIR',dirname(__FILE__));
20 20
 /**
21
- * Defines the default permission for writable directories and files
22
- */
21
+	 * Defines the default permission for writable directories and files
22
+	 */
23 23
 if(!defined('PRADO_CHMOD'))
24 24
 	define('PRADO_CHMOD',0777);
25 25
 
Please login to merge, or discard this patch.
framework/Collections/TMap.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TMap, TMapIterator classes
4
- *
5
- * @author Qiang Xue <[email protected]>
6
- * @link https://github.com/pradosoft/prado
7
- * @copyright Copyright &copy; 2005-2016 The PRADO Group
8
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
- * @package System.Collections
10
- */
3
+	 * TMap, TMapIterator classes
4
+	 *
5
+	 * @author Qiang Xue <[email protected]>
6
+	 * @link https://github.com/pradosoft/prado
7
+	 * @copyright Copyright &copy; 2005-2016 The PRADO Group
8
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
+	 * @package System.Collections
10
+	 */
11 11
 
12 12
 /**
13 13
  * TMap class
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDataGridPagerStyle.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TDataGridPagerStyle class file.
4
- *
5
- * @author Qiang Xue <[email protected]>
6
- * @link https://github.com/pradosoft/prado
7
- * @copyright Copyright &copy; 2005-2016 The PRADO Group
8
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
- * @package System.Web.UI.WebControls
10
- */
3
+	 * TDataGridPagerStyle class file.
4
+	 *
5
+	 * @author Qiang Xue <[email protected]>
6
+	 * @link https://github.com/pradosoft/prado
7
+	 * @copyright Copyright &copy; 2005-2016 The PRADO Group
8
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
+	 * @package System.Web.UI.WebControls
10
+	 */
11 11
 
12 12
 Prado::using('System.Web.UI.WebControls.TDataGrid');
13 13
 
Please login to merge, or discard this patch.
framework/I18N/core/TCache_Lite.php 1 patch
Indentation   +567 added lines, -567 removed lines patch added patch discarded remove patch
@@ -46,575 +46,575 @@
 block discarded – undo
46 46
 class TCache_Lite
47 47
 {
48 48
 
49
-    // --- Private properties ---
50
-
51
-    /**
52
-    * Directory where to put the cache files
53
-    * (make sure to add a trailing slash)
54
-    *
55
-    * @var string $_cacheDir
56
-    */
57
-    protected $_cacheDir = '/tmp/';
58
-
59
-    /**
60
-    * Enable / disable caching
61
-    *
62
-    * (can be very usefull for the debug of cached scripts)
63
-    *
64
-    * @var boolean $_caching
65
-    */
66
-    protected $_caching = true;
67
-
68
-    /**
69
-    * Cache lifetime (in seconds)
70
-    *
71
-    * @var int $_lifeTime
72
-    */
73
-    protected $_lifeTime = 3600;
74
-
75
-    /**
76
-    * Enable / disable fileLocking
77
-    *
78
-    * (can avoid cache corruption under bad circumstances)
79
-    *
80
-    * @var boolean $_fileLocking
81
-    */
82
-    protected $_fileLocking = true;
83
-
84
-    /**
85
-    * Timestamp of the last valid cache
86
-    *
87
-    * @var int $_refreshTime
88
-    */
89
-    protected $_refreshTime;
90
-
91
-    /**
92
-    * File name (with path)
93
-    *
94
-    * @var string $_file
95
-    */
96
-    protected $_file;
97
-
98
-    /**
99
-    * Enable / disable write control (the cache is read just after writing
100
-    * to detect corrupt entries)
101
-    *
102
-    * Enable write control will lightly slow the cache writing but not the
103
-    * cache reading. Write control can detect some corrupt cache files but
104
-    * maybe it's not a perfect control
105
-    *
106
-    * @var boolean $_writeControl
107
-    */
108
-    protected $_writeControl = true;
109
-
110
-    /**
111
-    * Enable / disable read control
112
-    *
113
-    * If enabled, a control key is embeded in cache file and this key is
114
-    * compared with the one calculated after the reading.
115
-    *
116
-    * @var boolean $_writeControl
117
-    */
118
-    protected $_readControl = true;
119
-
120
-    /**
121
-    * Type of read control (only if read control is enabled)
122
-    *
123
-    * Available values are :
124
-    * 'md5' for a md5 hash control (best but slowest)
125
-    * 'crc32' for a crc32 hash control (lightly less safe but faster,
126
-    * better choice)
127
-    * 'strlen' for a length only test (fastest)
128
-    *
129
-    * @var boolean $_readControlType
130
-    */
131
-    protected $_readControlType = 'crc32';
132
-
133
-    /**
134
-    * Current cache id
135
-    *
136
-    * @var string $_id
137
-    */
138
-    protected $_id;
139
-
140
-    /**
141
-    * Current cache group
142
-    *
143
-    * @var string $_group
144
-    */
145
-    protected $_group;
146
-
147
-    /**
148
-    * Enable / Disable "Memory Caching"
149
-    *
150
-    * NB : There is no lifetime for memory caching !
151
-    *
152
-    * @var boolean $_memoryCaching
153
-    */
154
-    protected $_memoryCaching = false;
155
-
156
-    /**
157
-    * Enable / Disable "Only Memory Caching"
158
-    * (be carefull, memory caching is "beta quality")
159
-    *
160
-    * @var boolean $_onlyMemoryCaching
161
-    */
162
-    protected $_onlyMemoryCaching = false;
163
-
164
-    /**
165
-    * Memory caching array
166
-    *
167
-    * @var array $_memoryCachingArray
168
-    */
169
-    protected $_memoryCachingArray = array();
170
-
171
-    /**
172
-    * Memory caching counter
173
-    *
174
-    * @var int $memoryCachingCounter
175
-    */
176
-    protected $_memoryCachingCounter = 0;
177
-
178
-    /**
179
-    * Memory caching limit
180
-    *
181
-    * @var int $memoryCachingLimit
182
-    */
183
-    protected $_memoryCachingLimit = 1000;
184
-
185
-    /**
186
-    * File Name protection
187
-    *
188
-    * if set to true, you can use any cache id or group name
189
-    * if set to false, it can be faster but cache ids and group names
190
-    * will be used directly in cache file names so be carefull with
191
-    * special characters...
192
-    *
193
-    * @var boolean $fileNameProtection
194
-    */
195
-    protected $_fileNameProtection = true;
196
-
197
-    /**
198
-    * Enable / disable automatic serialization
199
-    *
200
-    * it can be used to save directly datas which aren't strings
201
-    * (but it's slower)
202
-    *
203
-    * @var boolean $_serialize
204
-    */
205
-    protected $_automaticSerialization = false;
206
-
207
-    // --- Public methods ---
208
-
209
-    /**
210
-    * Constructor
211
-    *
212
-    * $options is an assoc. Available options are :
213
-    * $options = array(
214
-    * 'cacheDir' => directory where to put the cache files (string),
215
-    * 'caching' => enable / disable caching (boolean),
216
-    * 'lifeTime' => cache lifetime in seconds (int),
217
-    * 'fileLocking' => enable / disable fileLocking (boolean),
218
-    * 'writeControl' => enable / disable write control (boolean),
219
-    * 'readControl' => enable / disable read control (boolean),
220
-    * 'readControlType' => type of read control 'crc32', 'md5', 'strlen',
221
-    * 'memoryCaching' => enable / disable memory caching (boolean),
222
-    * 'onlyMemoryCaching' => enable / disable only memory caching (boolean),
223
-    * 'memoryCachingLimit' => max nbr of records in memory caching (int),
224
-    * 'fileNameProtection' => enable / disable file name protection (boolean),
225
-    * 'automaticSerialization' => enable / disable serialization (boolean)
226
-    * );
227
-    *
228
-    * @param array $options options
229
-    * @access public
230
-    */
231
-    function __construct($options = array(null))
232
-    {
233
-        $availableOptions = array(	'automaticSerialization',
234
-        							'fileNameProtection',
235
-        							'memoryCaching',
236
-        							'onlyMemoryCaching',
237
-        							'memoryCachingLimit',
238
-        							'cacheDir',
239
-        							'caching',
240
-        							'lifeTime',
241
-        							'fileLocking',
242
-        							'writeControl',
243
-        							'readControl',
244
-        							'readControlType');
245
-        foreach($options as $key => $value) {
246
-            if(in_array($key, $availableOptions)) {
247
-                $property = '_'.$key;
248
-                $this->$property = $value;
249
-            }
250
-        }
251
-        $this->_refreshTime = time() - $this->_lifeTime;
49
+	// --- Private properties ---
50
+
51
+	/**
52
+	 * Directory where to put the cache files
53
+	 * (make sure to add a trailing slash)
54
+	 *
55
+	 * @var string $_cacheDir
56
+	 */
57
+	protected $_cacheDir = '/tmp/';
58
+
59
+	/**
60
+	 * Enable / disable caching
61
+	 *
62
+	 * (can be very usefull for the debug of cached scripts)
63
+	 *
64
+	 * @var boolean $_caching
65
+	 */
66
+	protected $_caching = true;
67
+
68
+	/**
69
+	 * Cache lifetime (in seconds)
70
+	 *
71
+	 * @var int $_lifeTime
72
+	 */
73
+	protected $_lifeTime = 3600;
74
+
75
+	/**
76
+	 * Enable / disable fileLocking
77
+	 *
78
+	 * (can avoid cache corruption under bad circumstances)
79
+	 *
80
+	 * @var boolean $_fileLocking
81
+	 */
82
+	protected $_fileLocking = true;
83
+
84
+	/**
85
+	 * Timestamp of the last valid cache
86
+	 *
87
+	 * @var int $_refreshTime
88
+	 */
89
+	protected $_refreshTime;
90
+
91
+	/**
92
+	 * File name (with path)
93
+	 *
94
+	 * @var string $_file
95
+	 */
96
+	protected $_file;
97
+
98
+	/**
99
+	 * Enable / disable write control (the cache is read just after writing
100
+	 * to detect corrupt entries)
101
+	 *
102
+	 * Enable write control will lightly slow the cache writing but not the
103
+	 * cache reading. Write control can detect some corrupt cache files but
104
+	 * maybe it's not a perfect control
105
+	 *
106
+	 * @var boolean $_writeControl
107
+	 */
108
+	protected $_writeControl = true;
109
+
110
+	/**
111
+	 * Enable / disable read control
112
+	 *
113
+	 * If enabled, a control key is embeded in cache file and this key is
114
+	 * compared with the one calculated after the reading.
115
+	 *
116
+	 * @var boolean $_writeControl
117
+	 */
118
+	protected $_readControl = true;
119
+
120
+	/**
121
+	 * Type of read control (only if read control is enabled)
122
+	 *
123
+	 * Available values are :
124
+	 * 'md5' for a md5 hash control (best but slowest)
125
+	 * 'crc32' for a crc32 hash control (lightly less safe but faster,
126
+	 * better choice)
127
+	 * 'strlen' for a length only test (fastest)
128
+	 *
129
+	 * @var boolean $_readControlType
130
+	 */
131
+	protected $_readControlType = 'crc32';
132
+
133
+	/**
134
+	 * Current cache id
135
+	 *
136
+	 * @var string $_id
137
+	 */
138
+	protected $_id;
139
+
140
+	/**
141
+	 * Current cache group
142
+	 *
143
+	 * @var string $_group
144
+	 */
145
+	protected $_group;
146
+
147
+	/**
148
+	 * Enable / Disable "Memory Caching"
149
+	 *
150
+	 * NB : There is no lifetime for memory caching !
151
+	 *
152
+	 * @var boolean $_memoryCaching
153
+	 */
154
+	protected $_memoryCaching = false;
155
+
156
+	/**
157
+	 * Enable / Disable "Only Memory Caching"
158
+	 * (be carefull, memory caching is "beta quality")
159
+	 *
160
+	 * @var boolean $_onlyMemoryCaching
161
+	 */
162
+	protected $_onlyMemoryCaching = false;
163
+
164
+	/**
165
+	 * Memory caching array
166
+	 *
167
+	 * @var array $_memoryCachingArray
168
+	 */
169
+	protected $_memoryCachingArray = array();
170
+
171
+	/**
172
+	 * Memory caching counter
173
+	 *
174
+	 * @var int $memoryCachingCounter
175
+	 */
176
+	protected $_memoryCachingCounter = 0;
177
+
178
+	/**
179
+	 * Memory caching limit
180
+	 *
181
+	 * @var int $memoryCachingLimit
182
+	 */
183
+	protected $_memoryCachingLimit = 1000;
184
+
185
+	/**
186
+	 * File Name protection
187
+	 *
188
+	 * if set to true, you can use any cache id or group name
189
+	 * if set to false, it can be faster but cache ids and group names
190
+	 * will be used directly in cache file names so be carefull with
191
+	 * special characters...
192
+	 *
193
+	 * @var boolean $fileNameProtection
194
+	 */
195
+	protected $_fileNameProtection = true;
196
+
197
+	/**
198
+	 * Enable / disable automatic serialization
199
+	 *
200
+	 * it can be used to save directly datas which aren't strings
201
+	 * (but it's slower)
202
+	 *
203
+	 * @var boolean $_serialize
204
+	 */
205
+	protected $_automaticSerialization = false;
206
+
207
+	// --- Public methods ---
208
+
209
+	/**
210
+	 * Constructor
211
+	 *
212
+	 * $options is an assoc. Available options are :
213
+	 * $options = array(
214
+	 * 'cacheDir' => directory where to put the cache files (string),
215
+	 * 'caching' => enable / disable caching (boolean),
216
+	 * 'lifeTime' => cache lifetime in seconds (int),
217
+	 * 'fileLocking' => enable / disable fileLocking (boolean),
218
+	 * 'writeControl' => enable / disable write control (boolean),
219
+	 * 'readControl' => enable / disable read control (boolean),
220
+	 * 'readControlType' => type of read control 'crc32', 'md5', 'strlen',
221
+	 * 'memoryCaching' => enable / disable memory caching (boolean),
222
+	 * 'onlyMemoryCaching' => enable / disable only memory caching (boolean),
223
+	 * 'memoryCachingLimit' => max nbr of records in memory caching (int),
224
+	 * 'fileNameProtection' => enable / disable file name protection (boolean),
225
+	 * 'automaticSerialization' => enable / disable serialization (boolean)
226
+	 * );
227
+	 *
228
+	 * @param array $options options
229
+	 * @access public
230
+	 */
231
+	function __construct($options = array(null))
232
+	{
233
+		$availableOptions = array(	'automaticSerialization',
234
+									'fileNameProtection',
235
+									'memoryCaching',
236
+									'onlyMemoryCaching',
237
+									'memoryCachingLimit',
238
+									'cacheDir',
239
+									'caching',
240
+									'lifeTime',
241
+									'fileLocking',
242
+									'writeControl',
243
+									'readControl',
244
+									'readControlType');
245
+		foreach($options as $key => $value) {
246
+			if(in_array($key, $availableOptions)) {
247
+				$property = '_'.$key;
248
+				$this->$property = $value;
249
+			}
250
+		}
251
+		$this->_refreshTime = time() - $this->_lifeTime;
252 252
 	}
253 253
 
254
-    /**
255
-    * Test if a cache is available and (if yes) return it
256
-    *
257
-    * @param string $id cache id
258
-    * @param string $group name of the cache group
259
-    * @param boolean $doNotTestCacheValidity if set to true, the cache
260
-    * validity won't be tested
261
-    * @return string data of the cache (or false if no cache available)
262
-    * @access public
263
-    */
264
-    function get($id, $group = 'default', $doNotTestCacheValidity = false)
265
-    {
266
-        $this->_id = $id;
267
-        $this->_group = $group;
268
-        $data = false;
269
-        if ($this->_caching) {
270
-            $this->_setFileName($id, $group);
271
-            if ($this->_memoryCaching) {
272
-                if (isset($this->_memoryCachingArray[$this->_file])) {
273
-                    if ($this->_automaticSerialization) {
274
-                        return unserialize(
275
-                        			$this->_memoryCachingArray[$this->_file]);
276
-                    } else {
277
-                        return $this->_memoryCachingArray[$this->_file];
278
-                    }
279
-                } else {
280
-                    if ($this->_onlyMemoryCaching) {
281
-                        return false;
282
-                    }
283
-                }
284
-            }
285
-            if ($doNotTestCacheValidity) {
286
-                if (file_exists($this->_file)) {
287
-                    $data = $this->_read();
288
-                }
289
-            } else {
290
-                if (@filemtime($this->_file) > $this->_refreshTime) {
291
-                    $data = $this->_read();
292
-                }
293
-            }
294
-            if (($data) and ($this->_memoryCaching)) {
295
-                $this->_memoryCacheAdd($this->_file, $data);
296
-            }
297
-            if ($this->_automaticSerialization && is_string($data)) {
298
-                $data = unserialize($data);
299
-            }
300
-            return $data;
301
-        }
302
-        return false;
303
-    }
304
-
305
-    /**
306
-    * Save some data in a cache file
307
-    *
308
-    * @param string $data data to put in cache (can be another type than strings
309
-    * if automaticSerialization is on)
310
-    * @param string $id cache id
311
-    * @param string $group name of the cache group
312
-    * @return boolean true if no problem
313
-    * @access public
314
-    */
315
-    function save($data, $id = null, $group = 'default')
316
-    {
317
-        if ($this->_caching) {
318
-            if ($this->_automaticSerialization) {
319
-                $data = serialize($data);
320
-            }
321
-            if (isset($id)) {
322
-                $this->_setFileName($id, $group);
323
-            }
324
-            if ($this->_memoryCaching) {
325
-                $this->_memoryCacheAdd($this->_file, $data);
326
-                if ($this->_onlyMemoryCaching) {
327
-                    return true;
328
-                }
329
-            }
330
-            if ($this->_writeControl) {
331
-                if (!$this->_writeAndControl($data)) {
332
-                    @touch($this->_file, time() - 2*abs($this->_lifeTime));
333
-                    return false;
334
-                } else {
335
-                    return true;
336
-                }
337
-            } else {
338
-                return $this->_write($data);
339
-            }
340
-        }
341
-        return false;
342
-    }
343
-
344
-    /**
345
-    * Remove a cache file
346
-    *
347
-    * @param string $id cache id
348
-    * @param string $group name of the cache group
349
-    * @return boolean true if no problem
350
-    * @access public
351
-    */
352
-    function remove($id, $group = 'default')
353
-    {
354
-        $this->_setFileName($id, $group);
355
-        if (!@unlink($this->_file)) {
356
-            $this->raiseError('TCache_Lite : Unable to remove cache !', -3);
357
-            return false;
358
-        }
359
-        return true;
360
-    }
361
-
362
-    /**
363
-    * Clean the cache
364
-    *
365
-    * if no group is specified all cache files will be destroyed
366
-    * else only cache files of the specified group will be destroyed
367
-    *
368
-    * @param string $group name of the cache group
369
-    * @return boolean true if no problem
370
-    * @access public
371
-    */
372
-    function clean($group = false)
373
-    {
374
-        if ($this->_fileNameProtection) {
375
-            $motif = ($group) ? 'cache_'.md5($group).'_' : 'cache_';
376
-        } else {
377
-            $motif = ($group) ? 'cache_'.$group.'_' : 'cache_';
378
-        }
379
-        if ($this->_memoryCaching) {
380
-            while (list($key, $value) = each($this->_memoryCaching)) {
381
-                if (strpos($key, $motif, 0)) {
382
-                    unset($this->_memoryCaching[$key]);
383
-                    $this->_memoryCachingCounter =
384
-                    		$this->_memoryCachingCounter - 1;
385
-                }
386
-            }
387
-            if ($this->_onlyMemoryCaching) {
388
-                return true;
389
-            }
390
-        }
391
-        if (!($dh = opendir($this->_cacheDir))) {
392
-            $this->raiseError('TCache_Lite : Unable to open cache directory !');
393
-            return false;
394
-        }
395
-        while ($file = readdir($dh)) {
396
-            if (($file != '.') && ($file != '..')) {
397
-                $file = $this->_cacheDir . $file;
398
-                if (is_file($file)) {
399
-                    if (strpos($file, $motif, 0)) {
400
-                        if (!@unlink($file)) {
401
-             $this->raiseError('Cache_Lite : Unable to remove cache !', -3);
402
-                            return false;
403
-                        }
404
-                    }
405
-                }
406
-            }
407
-        }
408
-        return true;
409
-    }
410
-
411
-	    /**
412
-    * Set a new life time
413
-    *
414
-    * @param int $newLifeTime new life time (in seconds)
415
-    * @access public
416
-    */
417
-    function setLifeTime($newLifeTime)
418
-    {
419
-        $this->_lifeTime = $newLifeTime;
420
-        $this->_refreshTime = time() - $newLifeTime;
421
-    }
422
-
423
-    /**
424
-    *
425
-    * @access public
426
-    */
427
-    function saveMemoryCachingState($id, $group = 'default')
428
-    {
429
-        if ($this->_caching) {
430
-            $array = array(
431
-                'counter' => $this->_memoryCachingCounter,
432
-                'array' => $this->_memoryCachingState
433
-            );
434
-            $data = serialize($array);
435
-            $this->save($data, $id, $group);
436
-        }
437
-    }
438
-
439
-    /**
440
-    *
441
-    * @access public
442
-    */
443
-    function getMemoryCachingState($id, $group = 'default',
444
-    								$doNotTestCacheValidity = false)
445
-    {
446
-        if ($this->_caching) {
447
-            if ($data = $this->get($id, $group, $doNotTestCacheValidity))
448
-            {
449
-                $array = unserialize($data);
450
-                $this->_memoryCachingCounter = $array['counter'];
451
-                $this->_memoryCachingArray = $array['array'];
452
-            }
453
-        }
454
-    }
455
-
456
-    /**
457
-    * Return the cache last modification time
458
-    *
459
-    * BE CAREFUL : THIS METHOD IS FOR HACKING ONLY !
460
-    *
461
-    * @return int last modification time
462
-    */
463
-    function lastModified() {
464
-        return filemtime($this->cache->_file);
465
-    }
466
-
467
-    /**
468
-    * Trigger a PEAR error
469
-    *
470
-    * To improve performances, the PEAR.php file is included dynamically.
471
-    * The file is so included only when an error is triggered. So, in most
472
-    * cases, the file isn't included and perfs are much better.
473
-    *
474
-    * @param string $msg error message
475
-    * @param int $code error code
476
-    * @access public
477
-    */
478
-    function raiseError($msg, $code)
479
-    {
480
-       throw new Exception($msg);
481
-    }
482
-
483
-    // --- Private methods ---
484
-
485
-    /**
486
-    *
487
-    * @access private
488
-    */
489
-    function _memoryCacheAdd($id, $data)
490
-    {
491
-        $this->_memoryCachingArray[$this->_file] = $data;
492
-        if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
493
-            list($key, $value) = each($this->_memoryCachingArray);
494
-            unset($this->_memoryCachingArray[$key]);
495
-        } else {
496
-            $this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
497
-        }
498
-    }
499
-
500
-    /**
501
-    * Make a file name (with path)
502
-    *
503
-    * @param string $id cache id
504
-    * @param string $group name of the group
505
-    * @access private
506
-    */
507
-    function _setFileName($id, $group)
508
-    {
509
-        if ($this->_fileNameProtection) {
510
-            $this->_file = ($this->_cacheDir.'cache_'.md5($group).'_'
511
-            						.md5($id));
512
-        } else {
513
-            $this->_file = $this->_cacheDir.'cache_'.$group.'_'.$id;
514
-        }
515
-    }
516
-
517
-    function getCacheFile()
518
-    {
519
-    	return $this->_file;
520
-    }
521
-
522
-    /**
523
-    * Read the cache file and return the content
524
-    *
525
-    * @return string content of the cache file
526
-    * @access private
527
-    */
528
-    function _read()
529
-    {
530
-        $fp = @fopen($this->_file, "rb");
531
-        if ($this->_fileLocking) @flock($fp, LOCK_SH);
532
-        if ($fp) {
533
-        	// because the filesize can be cached by PHP itself...
534
-            clearstatcache();
535
-            $length = @filesize($this->_file);
536
-            if ($this->_readControl) {
537
-                $hashControl = @fread($fp, 32);
538
-                $length = $length - 32;
539
-            }
540
-            $data = @fread($fp, $length);
541
-            if ($this->_fileLocking) @flock($fp, LOCK_UN);
542
-            @fclose($fp);
543
-            if ($this->_readControl) {
544
-                $hashData = $this->_hash($data, $this->_readControlType);
545
-                if ($hashData != $hashControl) {
546
-                    @touch($this->_file, time() - 2*abs($this->_lifeTime));
547
-                    return false;
548
-                }
549
-            }
550
-            return $data;
551
-        }
552
-        $this->raiseError('Cache_Lite : Unable to read cache !', -2);
553
-        return false;
554
-    }
555
-
556
-    /**
557
-    * Write the given data in the cache file
558
-    *
559
-    * @param string $data data to put in cache
560
-    * @return boolean true if ok
561
-    * @access private
562
-    */
563
-    function _write($data)
564
-    {
565
-        $fp = @fopen($this->_file, "wb");
566
-        if ($fp) {
567
-            if ($this->_fileLocking) @flock($fp, LOCK_EX);
568
-            if ($this->_readControl) {
569
-                @fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
570
-            }
571
-            $len = strlen($data);
572
-            @fwrite($fp, $data, $len);
573
-            if ($this->_fileLocking) @flock($fp, LOCK_UN);
574
-            @fclose($fp);
575
-            return true;
576
-        }
577
-        $this->raiseError('Cache_Lite : Unable to write cache !', -1);
578
-        return false;
579
-    }
580
-
581
-    /**
582
-    * Write the given data in the cache file and control it just after to avoid
583
-    * corrupted cache entries
584
-    *
585
-    * @param string $data data to put in cache
586
-    * @return boolean true if the test is ok
587
-    * @access private
588
-    */
589
-    function _writeAndControl($data)
590
-    {
591
-        $this->_write($data);
592
-        $dataRead = $this->_read($data);
593
-        return ($dataRead==$data);
594
-    }
595
-
596
-    /**
597
-    * Make a control key with the string containing datas
598
-    *
599
-    * @param string $data data
600
-    * @param string $controlType type of control 'md5', 'crc32' or 'strlen'
601
-    * @return string control key
602
-    * @access private
603
-    */
604
-    function _hash($data, $controlType)
605
-    {
606
-        switch ($controlType) {
607
-        case 'md5':
608
-            return md5($data);
609
-        case 'crc32':
610
-            return sprintf('% 32d', crc32($data));
611
-        case 'strlen':
612
-            return sprintf('% 32d', strlen($data));
613
-        default:
614
-            $this->raiseError('Unknown controlType ! '.
615
-            '(available values are only \'md5\', \'crc32\', \'strlen\')', -5);
616
-        }
617
-    }
254
+	/**
255
+	 * Test if a cache is available and (if yes) return it
256
+	 *
257
+	 * @param string $id cache id
258
+	 * @param string $group name of the cache group
259
+	 * @param boolean $doNotTestCacheValidity if set to true, the cache
260
+	 * validity won't be tested
261
+	 * @return string data of the cache (or false if no cache available)
262
+	 * @access public
263
+	 */
264
+	function get($id, $group = 'default', $doNotTestCacheValidity = false)
265
+	{
266
+		$this->_id = $id;
267
+		$this->_group = $group;
268
+		$data = false;
269
+		if ($this->_caching) {
270
+			$this->_setFileName($id, $group);
271
+			if ($this->_memoryCaching) {
272
+				if (isset($this->_memoryCachingArray[$this->_file])) {
273
+					if ($this->_automaticSerialization) {
274
+						return unserialize(
275
+									$this->_memoryCachingArray[$this->_file]);
276
+					} else {
277
+						return $this->_memoryCachingArray[$this->_file];
278
+					}
279
+				} else {
280
+					if ($this->_onlyMemoryCaching) {
281
+						return false;
282
+					}
283
+				}
284
+			}
285
+			if ($doNotTestCacheValidity) {
286
+				if (file_exists($this->_file)) {
287
+					$data = $this->_read();
288
+				}
289
+			} else {
290
+				if (@filemtime($this->_file) > $this->_refreshTime) {
291
+					$data = $this->_read();
292
+				}
293
+			}
294
+			if (($data) and ($this->_memoryCaching)) {
295
+				$this->_memoryCacheAdd($this->_file, $data);
296
+			}
297
+			if ($this->_automaticSerialization && is_string($data)) {
298
+				$data = unserialize($data);
299
+			}
300
+			return $data;
301
+		}
302
+		return false;
303
+	}
304
+
305
+	/**
306
+	 * Save some data in a cache file
307
+	 *
308
+	 * @param string $data data to put in cache (can be another type than strings
309
+	 * if automaticSerialization is on)
310
+	 * @param string $id cache id
311
+	 * @param string $group name of the cache group
312
+	 * @return boolean true if no problem
313
+	 * @access public
314
+	 */
315
+	function save($data, $id = null, $group = 'default')
316
+	{
317
+		if ($this->_caching) {
318
+			if ($this->_automaticSerialization) {
319
+				$data = serialize($data);
320
+			}
321
+			if (isset($id)) {
322
+				$this->_setFileName($id, $group);
323
+			}
324
+			if ($this->_memoryCaching) {
325
+				$this->_memoryCacheAdd($this->_file, $data);
326
+				if ($this->_onlyMemoryCaching) {
327
+					return true;
328
+				}
329
+			}
330
+			if ($this->_writeControl) {
331
+				if (!$this->_writeAndControl($data)) {
332
+					@touch($this->_file, time() - 2*abs($this->_lifeTime));
333
+					return false;
334
+				} else {
335
+					return true;
336
+				}
337
+			} else {
338
+				return $this->_write($data);
339
+			}
340
+		}
341
+		return false;
342
+	}
343
+
344
+	/**
345
+	 * Remove a cache file
346
+	 *
347
+	 * @param string $id cache id
348
+	 * @param string $group name of the cache group
349
+	 * @return boolean true if no problem
350
+	 * @access public
351
+	 */
352
+	function remove($id, $group = 'default')
353
+	{
354
+		$this->_setFileName($id, $group);
355
+		if (!@unlink($this->_file)) {
356
+			$this->raiseError('TCache_Lite : Unable to remove cache !', -3);
357
+			return false;
358
+		}
359
+		return true;
360
+	}
361
+
362
+	/**
363
+	 * Clean the cache
364
+	 *
365
+	 * if no group is specified all cache files will be destroyed
366
+	 * else only cache files of the specified group will be destroyed
367
+	 *
368
+	 * @param string $group name of the cache group
369
+	 * @return boolean true if no problem
370
+	 * @access public
371
+	 */
372
+	function clean($group = false)
373
+	{
374
+		if ($this->_fileNameProtection) {
375
+			$motif = ($group) ? 'cache_'.md5($group).'_' : 'cache_';
376
+		} else {
377
+			$motif = ($group) ? 'cache_'.$group.'_' : 'cache_';
378
+		}
379
+		if ($this->_memoryCaching) {
380
+			while (list($key, $value) = each($this->_memoryCaching)) {
381
+				if (strpos($key, $motif, 0)) {
382
+					unset($this->_memoryCaching[$key]);
383
+					$this->_memoryCachingCounter =
384
+							$this->_memoryCachingCounter - 1;
385
+				}
386
+			}
387
+			if ($this->_onlyMemoryCaching) {
388
+				return true;
389
+			}
390
+		}
391
+		if (!($dh = opendir($this->_cacheDir))) {
392
+			$this->raiseError('TCache_Lite : Unable to open cache directory !');
393
+			return false;
394
+		}
395
+		while ($file = readdir($dh)) {
396
+			if (($file != '.') && ($file != '..')) {
397
+				$file = $this->_cacheDir . $file;
398
+				if (is_file($file)) {
399
+					if (strpos($file, $motif, 0)) {
400
+						if (!@unlink($file)) {
401
+			 $this->raiseError('Cache_Lite : Unable to remove cache !', -3);
402
+							return false;
403
+						}
404
+					}
405
+				}
406
+			}
407
+		}
408
+		return true;
409
+	}
410
+
411
+		/**
412
+		 * Set a new life time
413
+		 *
414
+		 * @param int $newLifeTime new life time (in seconds)
415
+		 * @access public
416
+		 */
417
+	function setLifeTime($newLifeTime)
418
+	{
419
+		$this->_lifeTime = $newLifeTime;
420
+		$this->_refreshTime = time() - $newLifeTime;
421
+	}
422
+
423
+	/**
424
+	 *
425
+	 * @access public
426
+	 */
427
+	function saveMemoryCachingState($id, $group = 'default')
428
+	{
429
+		if ($this->_caching) {
430
+			$array = array(
431
+				'counter' => $this->_memoryCachingCounter,
432
+				'array' => $this->_memoryCachingState
433
+			);
434
+			$data = serialize($array);
435
+			$this->save($data, $id, $group);
436
+		}
437
+	}
438
+
439
+	/**
440
+	 *
441
+	 * @access public
442
+	 */
443
+	function getMemoryCachingState($id, $group = 'default',
444
+									$doNotTestCacheValidity = false)
445
+	{
446
+		if ($this->_caching) {
447
+			if ($data = $this->get($id, $group, $doNotTestCacheValidity))
448
+			{
449
+				$array = unserialize($data);
450
+				$this->_memoryCachingCounter = $array['counter'];
451
+				$this->_memoryCachingArray = $array['array'];
452
+			}
453
+		}
454
+	}
455
+
456
+	/**
457
+	 * Return the cache last modification time
458
+	 *
459
+	 * BE CAREFUL : THIS METHOD IS FOR HACKING ONLY !
460
+	 *
461
+	 * @return int last modification time
462
+	 */
463
+	function lastModified() {
464
+		return filemtime($this->cache->_file);
465
+	}
466
+
467
+	/**
468
+	 * Trigger a PEAR error
469
+	 *
470
+	 * To improve performances, the PEAR.php file is included dynamically.
471
+	 * The file is so included only when an error is triggered. So, in most
472
+	 * cases, the file isn't included and perfs are much better.
473
+	 *
474
+	 * @param string $msg error message
475
+	 * @param int $code error code
476
+	 * @access public
477
+	 */
478
+	function raiseError($msg, $code)
479
+	{
480
+	   throw new Exception($msg);
481
+	}
482
+
483
+	// --- Private methods ---
484
+
485
+	/**
486
+	 *
487
+	 * @access private
488
+	 */
489
+	function _memoryCacheAdd($id, $data)
490
+	{
491
+		$this->_memoryCachingArray[$this->_file] = $data;
492
+		if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
493
+			list($key, $value) = each($this->_memoryCachingArray);
494
+			unset($this->_memoryCachingArray[$key]);
495
+		} else {
496
+			$this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
497
+		}
498
+	}
499
+
500
+	/**
501
+	 * Make a file name (with path)
502
+	 *
503
+	 * @param string $id cache id
504
+	 * @param string $group name of the group
505
+	 * @access private
506
+	 */
507
+	function _setFileName($id, $group)
508
+	{
509
+		if ($this->_fileNameProtection) {
510
+			$this->_file = ($this->_cacheDir.'cache_'.md5($group).'_'
511
+									.md5($id));
512
+		} else {
513
+			$this->_file = $this->_cacheDir.'cache_'.$group.'_'.$id;
514
+		}
515
+	}
516
+
517
+	function getCacheFile()
518
+	{
519
+		return $this->_file;
520
+	}
521
+
522
+	/**
523
+	 * Read the cache file and return the content
524
+	 *
525
+	 * @return string content of the cache file
526
+	 * @access private
527
+	 */
528
+	function _read()
529
+	{
530
+		$fp = @fopen($this->_file, "rb");
531
+		if ($this->_fileLocking) @flock($fp, LOCK_SH);
532
+		if ($fp) {
533
+			// because the filesize can be cached by PHP itself...
534
+			clearstatcache();
535
+			$length = @filesize($this->_file);
536
+			if ($this->_readControl) {
537
+				$hashControl = @fread($fp, 32);
538
+				$length = $length - 32;
539
+			}
540
+			$data = @fread($fp, $length);
541
+			if ($this->_fileLocking) @flock($fp, LOCK_UN);
542
+			@fclose($fp);
543
+			if ($this->_readControl) {
544
+				$hashData = $this->_hash($data, $this->_readControlType);
545
+				if ($hashData != $hashControl) {
546
+					@touch($this->_file, time() - 2*abs($this->_lifeTime));
547
+					return false;
548
+				}
549
+			}
550
+			return $data;
551
+		}
552
+		$this->raiseError('Cache_Lite : Unable to read cache !', -2);
553
+		return false;
554
+	}
555
+
556
+	/**
557
+	 * Write the given data in the cache file
558
+	 *
559
+	 * @param string $data data to put in cache
560
+	 * @return boolean true if ok
561
+	 * @access private
562
+	 */
563
+	function _write($data)
564
+	{
565
+		$fp = @fopen($this->_file, "wb");
566
+		if ($fp) {
567
+			if ($this->_fileLocking) @flock($fp, LOCK_EX);
568
+			if ($this->_readControl) {
569
+				@fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
570
+			}
571
+			$len = strlen($data);
572
+			@fwrite($fp, $data, $len);
573
+			if ($this->_fileLocking) @flock($fp, LOCK_UN);
574
+			@fclose($fp);
575
+			return true;
576
+		}
577
+		$this->raiseError('Cache_Lite : Unable to write cache !', -1);
578
+		return false;
579
+	}
580
+
581
+	/**
582
+	 * Write the given data in the cache file and control it just after to avoid
583
+	 * corrupted cache entries
584
+	 *
585
+	 * @param string $data data to put in cache
586
+	 * @return boolean true if the test is ok
587
+	 * @access private
588
+	 */
589
+	function _writeAndControl($data)
590
+	{
591
+		$this->_write($data);
592
+		$dataRead = $this->_read($data);
593
+		return ($dataRead==$data);
594
+	}
595
+
596
+	/**
597
+	 * Make a control key with the string containing datas
598
+	 *
599
+	 * @param string $data data
600
+	 * @param string $controlType type of control 'md5', 'crc32' or 'strlen'
601
+	 * @return string control key
602
+	 * @access private
603
+	 */
604
+	function _hash($data, $controlType)
605
+	{
606
+		switch ($controlType) {
607
+		case 'md5':
608
+			return md5($data);
609
+		case 'crc32':
610
+			return sprintf('% 32d', crc32($data));
611
+		case 'strlen':
612
+			return sprintf('% 32d', strlen($data));
613
+		default:
614
+			$this->raiseError('Unknown controlType ! '.
615
+			'(available values are only \'md5\', \'crc32\', \'strlen\')', -5);
616
+		}
617
+	}
618 618
 
619 619
 }
620 620
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TStyleSheet.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TStyleSheet class file.
4
- *
5
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6
- * @link https://github.com/pradosoft/prado
7
- * @copyright Copyright &copy; 2005-2016 The PRADO Group
8
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
- * @package System.Web.UI.WebControls
10
- */
3
+	 * TStyleSheet class file.
4
+	 *
5
+	 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6
+	 * @link https://github.com/pradosoft/prado
7
+	 * @copyright Copyright &copy; 2005-2016 The PRADO Group
8
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
+	 * @package System.Web.UI.WebControls
10
+	 */
11 11
 
12 12
 /**
13 13
  * TStyleSheet class.
Please login to merge, or discard this patch.