Completed
Push — master ( 51702c...5f6db9 )
by Fabio
13:40
created
framework/pradolite.php 1 patch
Spacing   +1650 added lines, -1650 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 if(!defined('PRADO_DIR'))
15
-	define('PRADO_DIR',dirname(__FILE__));
15
+	define('PRADO_DIR', dirname(__FILE__));
16 16
 if(!defined('PRADO_CHMOD'))
17
-	define('PRADO_CHMOD',0777);
17
+	define('PRADO_CHMOD', 0777);
18 18
 class PradoBase
19 19
 {
20 20
 	const CLASS_FILE_EXT='.php';
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 	private static $_usings=array();
23 23
 	private static $_application=null;
24 24
 	private static $_logger=null;
25
-	protected static $classExists = array();
25
+	protected static $classExists=array();
26 26
 	public static function getVersion()
27 27
 	{
28 28
 		return '3.3.0';
29 29
 	}
30 30
 	public static function initErrorHandlers()
31 31
 	{
32
-		set_error_handler(array('PradoBase','phpErrorHandler'));
33
-		register_shutdown_function(array('PradoBase','phpFatalErrorHandler'));
34
-		set_exception_handler(array('PradoBase','exceptionHandler'));
32
+		set_error_handler(array('PradoBase', 'phpErrorHandler'));
33
+		register_shutdown_function(array('PradoBase', 'phpFatalErrorHandler'));
34
+		set_exception_handler(array('PradoBase', 'exceptionHandler'));
35 35
 		ini_set('display_errors', 0);
36 36
 	}
37 37
 	public static function autoload($className)
@@ -40,36 +40,36 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 	public static function poweredByPrado($logoType=0)
42 42
 	{
43
-		$logoName=$logoType==1?'powered2':'powered';
43
+		$logoName=$logoType==1 ? 'powered2' : 'powered';
44 44
 		if(self::$_application!==null)
45 45
 		{
46 46
 			$am=self::$_application->getAssetManager();
47
-			$url=$am->publishFilePath(self::getPathOfNamespace('System.'.$logoName,'.gif'));
47
+			$url=$am->publishFilePath(self::getPathOfNamespace('System.'.$logoName, '.gif'));
48 48
 		}
49 49
 		else
50 50
 			$url='http://pradosoft.github.io/docs/'.$logoName.'.gif';
51 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>';
52 52
 	}
53
-	public static function phpErrorHandler($errno,$errstr,$errfile,$errline)
53
+	public static function phpErrorHandler($errno, $errstr, $errfile, $errline)
54 54
 	{
55 55
 		if(error_reporting() & $errno)
56
-			throw new TPhpErrorException($errno,$errstr,$errfile,$errline);
56
+			throw new TPhpErrorException($errno, $errstr, $errfile, $errline);
57 57
 	}
58 58
 	public static function phpFatalErrorHandler()
59 59
 	{
60
-		$error = error_get_last();
60
+		$error=error_get_last();
61 61
 		if($error && 
62 62
 			TPhpErrorException::isFatalError($error) &&
63 63
 			error_reporting() & $error['type'])
64 64
 		{
65
-			self::exceptionHandler(new TPhpErrorException($error['type'],$error['message'],$error['file'],$error['line']));
65
+			self::exceptionHandler(new TPhpErrorException($error['type'], $error['message'], $error['file'], $error['line']));
66 66
 		}
67 67
 	}
68 68
 	public static function exceptionHandler($exception)
69 69
 	{
70 70
 		if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null)
71 71
 		{
72
-			$errorHandler->handleError(null,$exception);
72
+			$errorHandler->handleError(null, $exception);
73 73
 		}
74 74
 		else
75 75
 		{
@@ -94,16 +94,16 @@  discard block
 block discarded – undo
94 94
 	public static function createComponent($type)
95 95
 	{
96 96
 		if(!isset(self::$classExists[$type]))
97
-			self::$classExists[$type] = class_exists($type, false);
98
-		if( !isset(self::$_usings[$type]) && !self::$classExists[$type]) {
97
+			self::$classExists[$type]=class_exists($type, false);
98
+		if(!isset(self::$_usings[$type]) && !self::$classExists[$type]) {
99 99
 			self::using($type);
100
-			self::$classExists[$type] = class_exists($type, false);
100
+			self::$classExists[$type]=class_exists($type, false);
101 101
 		}
102
-		if( ($pos = strrpos($type, '.')) !== false)
103
-			$type = substr($type,$pos+1);
104
-		if(($n=func_num_args())>1)
102
+		if(($pos=strrpos($type, '.'))!==false)
103
+			$type=substr($type, $pos + 1);
104
+		if(($n=func_num_args()) > 1)
105 105
 		{
106
-			$args = func_get_args();
106
+			$args=func_get_args();
107 107
 			switch($n) {
108 108
 				case 2:
109 109
 					return new $type($args[1]);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 				break;
120 120
 				default:
121 121
 					$s='$args[1]';
122
-					for($i=2;$i<$n;++$i)
122
+					for($i=2; $i < $n; ++$i)
123 123
 						$s.=",\$args[$i]";
124 124
 					eval("\$component=new $type($s);");
125 125
 					return $component;
@@ -129,33 +129,33 @@  discard block
 block discarded – undo
129 129
 		else
130 130
 			return new $type;
131 131
 	}
132
-	public static function using($namespace,$checkClassExistence=true)
132
+	public static function using($namespace, $checkClassExistence=true)
133 133
 	{
134
-		if(isset(self::$_usings[$namespace]) || class_exists($namespace,false))
134
+		if(isset(self::$_usings[$namespace]) || class_exists($namespace, false))
135 135
 			return;
136
-		if(($pos=strrpos($namespace,'.'))===false)  		{
136
+		if(($pos=strrpos($namespace, '.'))===false) {
137 137
 			try
138 138
 			{
139 139
 				include_once($namespace.self::CLASS_FILE_EXT);
140 140
 			}
141 141
 			catch(Exception $e)
142 142
 			{
143
-				if($checkClassExistence && !class_exists($namespace,false))
144
-					throw new TInvalidOperationException('prado_component_unknown',$namespace,$e->getMessage());
143
+				if($checkClassExistence && !class_exists($namespace, false))
144
+					throw new TInvalidOperationException('prado_component_unknown', $namespace, $e->getMessage());
145 145
 				else
146 146
 					throw $e;
147 147
 			}
148 148
 		}
149
-		else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null)
149
+		else if(($path=self::getPathOfNamespace($namespace, self::CLASS_FILE_EXT))!==null)
150 150
 		{
151
-			$className=substr($namespace,$pos+1);
152
-			if($className==='*')  			{
151
+			$className=substr($namespace, $pos + 1);
152
+			if($className==='*') {
153 153
 				self::$_usings[$namespace]=$path;
154 154
 				set_include_path(get_include_path().PATH_SEPARATOR.$path);
155 155
 			}
156
-			else  			{
156
+			else {
157 157
 				self::$_usings[$namespace]=$path;
158
-				if(!$checkClassExistence || !class_exists($className,false))
158
+				if(!$checkClassExistence || !class_exists($className, false))
159 159
 				{
160 160
 					try
161 161
 					{
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 					}
164 164
 					catch(Exception $e)
165 165
 					{
166
-						if($checkClassExistence && !class_exists($className,false))
167
-							throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage());
166
+						if($checkClassExistence && !class_exists($className, false))
167
+							throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage());
168 168
 						else
169 169
 							throw $e;
170 170
 					}
@@ -172,44 +172,44 @@  discard block
 block discarded – undo
172 172
 			}
173 173
 		}
174 174
 		else
175
-			throw new TInvalidDataValueException('prado_using_invalid',$namespace);
175
+			throw new TInvalidDataValueException('prado_using_invalid', $namespace);
176 176
 	}
177 177
 	public static function getPathOfNamespace($namespace, $ext='')
178 178
 	{
179
-		if(self::CLASS_FILE_EXT === $ext || empty($ext))
179
+		if(self::CLASS_FILE_EXT===$ext || empty($ext))
180 180
 		{
181 181
 			if(isset(self::$_usings[$namespace]))
182 182
 				return self::$_usings[$namespace];
183 183
 			if(isset(self::$_aliases[$namespace]))
184 184
 				return self::$_aliases[$namespace];
185 185
 		}
186
-		$segs = explode('.',$namespace);
187
-		$alias = array_shift($segs);
188
-		if(null !== ($file = array_pop($segs)) && null !== ($root = self::getPathOfAlias($alias)))
189
-			return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR ,$segs),'/\\').(($file === '*') ? '' : DIRECTORY_SEPARATOR.$file.$ext);
186
+		$segs=explode('.', $namespace);
187
+		$alias=array_shift($segs);
188
+		if(null!==($file=array_pop($segs)) && null!==($root=self::getPathOfAlias($alias)))
189
+			return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $segs), '/\\').(($file==='*') ? '' : DIRECTORY_SEPARATOR.$file.$ext);
190 190
 		return null;
191 191
 	}
192 192
 	public static function getPathOfAlias($alias)
193 193
 	{
194
-		return isset(self::$_aliases[$alias])?self::$_aliases[$alias]:null;
194
+		return isset(self::$_aliases[$alias]) ? self::$_aliases[$alias] : null;
195 195
 	}
196 196
 	protected static function getPathAliases()
197 197
 	{
198 198
 		return self::$_aliases;
199 199
 	}
200
-	public static function setPathOfAlias($alias,$path)
200
+	public static function setPathOfAlias($alias, $path)
201 201
 	{
202 202
 		if(isset(self::$_aliases[$alias]) && !defined('PRADO_TEST_RUN'))
203
-			throw new TInvalidOperationException('prado_alias_redefined',$alias);
203
+			throw new TInvalidOperationException('prado_alias_redefined', $alias);
204 204
 		else if(($rp=realpath($path))!==false && is_dir($rp))
205 205
 		{
206
-			if(strpos($alias,'.')===false)
206
+			if(strpos($alias, '.')===false)
207 207
 				self::$_aliases[$alias]=$rp;
208 208
 			else
209
-				throw new TInvalidDataValueException('prado_aliasname_invalid',$alias);
209
+				throw new TInvalidDataValueException('prado_aliasname_invalid', $alias);
210 210
 		}
211 211
 		else
212
-			throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path);
212
+			throw new TInvalidDataValueException('prado_alias_invalid', $alias, $path);
213 213
 	}
214 214
 	public static function fatalError($msg)
215 215
 	{
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
 			if($index==0)  				continue;
227 227
 			echo '#'.$index.' ';
228 228
 			if(isset($t['file']))
229
-				echo basename($t['file']) . ':' . $t['line'];
229
+				echo basename($t['file']).':'.$t['line'];
230 230
 			else
231 231
 				 echo '<PHP inner-code>';
232 232
 			echo ' -- ';
233 233
 			if(isset($t['class']))
234
-				echo $t['class'] . $t['type'];
235
-			echo $t['function'] . '(';
234
+				echo $t['class'].$t['type'];
235
+			echo $t['function'].'(';
236 236
 			if(isset($t['args']) && sizeof($t['args']) > 0)
237 237
 			{
238 238
 				$count=0;
@@ -241,25 +241,25 @@  discard block
 block discarded – undo
241 241
 					if(is_string($item))
242 242
 					{
243 243
 						$str=htmlentities(str_replace("\r\n", "", $item), ENT_QUOTES);
244
-						if (strlen($item) > 70)
245
-							echo "'". substr($str, 0, 70) . "...'";
244
+						if(strlen($item) > 70)
245
+							echo "'".substr($str, 0, 70)."...'";
246 246
 						else
247
-							echo "'" . $str . "'";
247
+							echo "'".$str."'";
248 248
 					}
249
-					else if (is_int($item) || is_float($item))
249
+					else if(is_int($item) || is_float($item))
250 250
 						echo $item;
251
-					else if (is_object($item))
251
+					else if(is_object($item))
252 252
 						echo get_class($item);
253
-					else if (is_array($item))
254
-						echo 'array(' . count($item) . ')';
255
-					else if (is_bool($item))
253
+					else if(is_array($item))
254
+						echo 'array('.count($item).')';
255
+					else if(is_bool($item))
256 256
 						echo $item ? 'true' : 'false';
257
-					else if ($item === null)
257
+					else if($item===null)
258 258
 						echo 'NULL';
259
-					else if (is_resource($item))
259
+					else if(is_resource($item))
260 260
 						echo get_resource_type($item);
261 261
 					$count++;
262
-					if (count($t['args']) > $count)
262
+					if(count($t['args']) > $count)
263 263
 						echo ', ';
264 264
 				}
265 265
 			}
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 			else
279 279
 			{
280 280
 				$languages=array();
281
-				foreach(explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language)
281
+				foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language)
282 282
 				{
283
-					$array=explode(';q=',trim($language));
284
-					$languages[trim($array[0])]=isset($array[1])?(float)$array[1]:1.0;
283
+					$array=explode(';q=', trim($language));
284
+					$languages[trim($array[0])]=isset($array[1]) ? (float) $array[1] : 1.0;
285 285
 				}
286 286
 				arsort($languages);
287 287
 				$languages=array_keys($languages);
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		if($language===null)
298 298
 		{
299 299
 			$langs=Prado::getUserLanguages();
300
-			$lang=explode('-',$langs[0]);
300
+			$lang=explode('-', $langs[0]);
301 301
 			if(empty($lang[0]) || !ctype_alpha($lang[0]))
302 302
 				$language='en';
303 303
 			else
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 		}
306 306
 		return $language;
307 307
 	}
308
-	public static function trace($msg,$category='Uncategorized',$ctl=null)
308
+	public static function trace($msg, $category='Uncategorized', $ctl=null)
309 309
 	{
310 310
 		if(self::$_application && self::$_application->getMode()===TApplicationMode::Performance)
311 311
 			return;
@@ -318,13 +318,13 @@  discard block
 block discarded – undo
318 318
 		}
319 319
 		else
320 320
 			$level=TLogger::INFO;
321
-		self::log($msg,$level,$category,$ctl);
321
+		self::log($msg, $level, $category, $ctl);
322 322
 	}
323
-	public static function log($msg,$level=TLogger::INFO,$category='Uncategorized',$ctl=null)
323
+	public static function log($msg, $level=TLogger::INFO, $category='Uncategorized', $ctl=null)
324 324
 	{
325 325
 		if(self::$_logger===null)
326 326
 			self::$_logger=new TLogger;
327
-		self::$_logger->log($msg,$level,$category,$ctl);
327
+		self::$_logger->log($msg, $level, $category, $ctl);
328 328
 	}
329 329
 	public static function getLogger()
330 330
 	{
@@ -332,40 +332,40 @@  discard block
 block discarded – undo
332 332
 			self::$_logger=new TLogger;
333 333
 		return self::$_logger;
334 334
 	}
335
-	public static function varDump($var,$depth=10,$highlight=false)
335
+	public static function varDump($var, $depth=10, $highlight=false)
336 336
 	{
337 337
 		Prado::using('System.Util.TVarDumper');
338
-		return TVarDumper::dump($var,$depth,$highlight);
338
+		return TVarDumper::dump($var, $depth, $highlight);
339 339
 	}
340 340
 	public static function localize($text, $parameters=array(), $catalogue=null, $charset=null)
341 341
 	{
342 342
 		Prado::using('System.I18N.Translation');
343
-		$app = Prado::getApplication()->getGlobalization(false);
344
-		$params = array();
343
+		$app=Prado::getApplication()->getGlobalization(false);
344
+		$params=array();
345 345
 		foreach($parameters as $key => $value)
346
-			$params['{'.$key.'}'] = $value;
347
-				if($app===null || ($config = $app->getTranslationConfiguration())===null)
346
+			$params['{'.$key.'}']=$value;
347
+				if($app===null || ($config=$app->getTranslationConfiguration())===null)
348 348
 			return strtr($text, $params);
349
-		if ($catalogue===null)
350
-			$catalogue=isset($config['catalogue'])?$config['catalogue']:'messages';
349
+		if($catalogue===null)
350
+			$catalogue=isset($config['catalogue']) ? $config['catalogue'] : 'messages';
351 351
 		Translation::init($catalogue);
352
-				$appCharset = $app===null ? '' : $app->getCharset();
353
-				$defaultCharset = ($app===null) ? 'UTF-8' : $app->getDefaultCharset();
354
-				if(empty($charset)) $charset = $appCharset;
355
-		if(empty($charset)) $charset = $defaultCharset;
356
-		return Translation::formatter($catalogue)->format($text,$params,$catalogue,$charset);
352
+				$appCharset=$app===null ? '' : $app->getCharset();
353
+				$defaultCharset=($app===null) ? 'UTF-8' : $app->getDefaultCharset();
354
+				if(empty($charset)) $charset=$appCharset;
355
+		if(empty($charset)) $charset=$defaultCharset;
356
+		return Translation::formatter($catalogue)->format($text, $params, $catalogue, $charset);
357 357
 	}
358 358
 }
359 359
 PradoBase::using('System.TComponent');
360 360
 PradoBase::using('System.Exceptions.TException');
361 361
 PradoBase::using('System.Util.TLogger');
362
-if(!class_exists('Prado',false))
362
+if(!class_exists('Prado', false))
363 363
 {
364 364
 	class Prado extends PradoBase
365 365
 	{
366 366
 	}
367 367
 }
368
-spl_autoload_register(array('Prado','autoload'));
368
+spl_autoload_register(array('Prado', 'autoload'));
369 369
 Prado::initErrorHandlers();
370 370
 interface IModule
371 371
 {
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 interface ICache
408 408
 {
409 409
 	public function get($id);
410
-	public function set($id,$value,$expire=0,$dependency=null);
411
-	public function add($id,$value,$expire=0,$dependency=null);
410
+	public function set($id, $value, $expire=0, $dependency=null);
411
+	public function add($id, $value, $expire=0, $dependency=null);
412 412
 	public function delete($id);
413 413
 	public function flush();
414 414
 }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 	{
470 470
 		return Prado::getApplication()->getUser();
471 471
 	}
472
-	public function publishAsset($assetPath,$className=null)
472
+	public function publishAsset($assetPath, $className=null)
473 473
 	{
474 474
 		if($className===null)
475 475
 			$className=get_class($this);
@@ -545,9 +545,9 @@  discard block
 block discarded – undo
545 545
 		if(($templatePath=Prado::getPathOfNamespace($value))!==null && is_dir($templatePath))
546 546
 			$this->_templatePath=$templatePath;
547 547
 		else
548
-			throw new TConfigurationException('errorhandler_errortemplatepath_invalid',$value);
548
+			throw new TConfigurationException('errorhandler_errortemplatepath_invalid', $value);
549 549
 	}
550
-	public function handleError($sender,$param)
550
+	public function handleError($sender, $param)
551 551
 	{
552 552
 		static $handling=false;
553 553
 								restore_error_handler();
@@ -562,56 +562,56 @@  discard block
 block discarded – undo
562 562
 			if(!headers_sent())
563 563
 				header('Content-Type: text/html; charset=UTF-8');
564 564
 			if($param instanceof THttpException)
565
-				$this->handleExternalError($param->getStatusCode(),$param);
565
+				$this->handleExternalError($param->getStatusCode(), $param);
566 566
 			else if($this->getApplication()->getMode()===TApplicationMode::Debug)
567 567
 				$this->displayException($param);
568 568
 			else
569
-				$this->handleExternalError(500,$param);
569
+				$this->handleExternalError(500, $param);
570 570
 		}
571 571
 	}
572 572
 	protected static function hideSecurityRelated($value, $exception=null)
573 573
 	{
574
-		$aRpl = array();
575
-		if($exception !== null && $exception instanceof Exception)
574
+		$aRpl=array();
575
+		if($exception!==null && $exception instanceof Exception)
576 576
 		{
577
-			$aTrace = $exception->getTrace();
577
+			$aTrace=$exception->getTrace();
578 578
 			foreach($aTrace as $item)
579 579
 			{
580 580
 				if(isset($item['file']))
581
-					$aRpl[dirname($item['file']) . DIRECTORY_SEPARATOR] = '<hidden>' . DIRECTORY_SEPARATOR;
581
+					$aRpl[dirname($item['file']).DIRECTORY_SEPARATOR]='<hidden>'.DIRECTORY_SEPARATOR;
582 582
 			}
583 583
 		}
584
-		$aRpl[$_SERVER['DOCUMENT_ROOT']] = '${DocumentRoot}';
585
-		$aRpl[str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT'])] = '${DocumentRoot}';
586
-		$aRpl[PRADO_DIR . DIRECTORY_SEPARATOR] = '${PradoFramework}' . DIRECTORY_SEPARATOR;
584
+		$aRpl[$_SERVER['DOCUMENT_ROOT']]='${DocumentRoot}';
585
+		$aRpl[str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT'])]='${DocumentRoot}';
586
+		$aRpl[PRADO_DIR.DIRECTORY_SEPARATOR]='${PradoFramework}'.DIRECTORY_SEPARATOR;
587 587
 		if(isset($aRpl[DIRECTORY_SEPARATOR])) unset($aRpl[DIRECTORY_SEPARATOR]);
588
-		$aRpl = array_reverse($aRpl, true);
588
+		$aRpl=array_reverse($aRpl, true);
589 589
 		return str_replace(array_keys($aRpl), $aRpl, $value);
590 590
 	}
591
-	protected function handleExternalError($statusCode,$exception)
591
+	protected function handleExternalError($statusCode, $exception)
592 592
 	{
593 593
 		if(!($exception instanceof THttpException))
594 594
 			error_log($exception->__toString());
595
-		$content=$this->getErrorTemplate($statusCode,$exception);
596
-		$serverAdmin=isset($_SERVER['SERVER_ADMIN'])?$_SERVER['SERVER_ADMIN']:'';
597
-		$isDebug = $this->getApplication()->getMode()===TApplicationMode::Debug;
598
-		$errorMessage = $exception->getMessage();
595
+		$content=$this->getErrorTemplate($statusCode, $exception);
596
+		$serverAdmin=isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : '';
597
+		$isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug;
598
+		$errorMessage=$exception->getMessage();
599 599
 		if($isDebug)
600 600
 			$version=$_SERVER['SERVER_SOFTWARE'].' <a href="https://github.com/pradosoft/prado">PRADO</a>/'.Prado::getVersion();
601 601
 		else
602 602
 		{
603 603
 			$version='';
604
-			$errorMessage = self::hideSecurityRelated($errorMessage, $exception);
604
+			$errorMessage=self::hideSecurityRelated($errorMessage, $exception);
605 605
 		}
606 606
 		$tokens=array(
607 607
 			'%%StatusCode%%' => "$statusCode",
608 608
 			'%%ErrorMessage%%' => htmlspecialchars($errorMessage),
609 609
 			'%%ServerAdmin%%' => $serverAdmin,
610 610
 			'%%Version%%' => $version,
611
-			'%%Time%%' => @strftime('%Y-%m-%d %H:%M',time())
611
+			'%%Time%%' => @strftime('%Y-%m-%d %H:%M', time())
612 612
 		);
613 613
 		$this->getApplication()->getResponse()->setStatusCode($statusCode, $isDebug ? $exception->getMessage() : null);
614
-		echo strtr($content,$tokens);
614
+		echo strtr($content, $tokens);
615 615
 	}
616 616
 	protected function handleRecursiveError($exception)
617 617
 	{
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 		if($exception instanceof TTemplateException)
640 640
 		{
641 641
 			$fileName=$exception->getTemplateFile();
642
-			$lines=empty($fileName)?explode("\n",$exception->getTemplateSource()):@file($fileName);
643
-			$source=$this->getSourceCode($lines,$exception->getLineNumber());
642
+			$lines=empty($fileName) ? explode("\n", $exception->getTemplateSource()) : @file($fileName);
643
+			$source=$this->getSourceCode($lines, $exception->getLineNumber());
644 644
 			if($fileName==='')
645 645
 				$fileName='---embedded template---';
646 646
 			$errorLine=$exception->getLineNumber();
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 				$fileName=$exception->getFile();
658 658
 				$errorLine=$exception->getLine();
659 659
 			}
660
-			$source=$this->getSourceCode(@file($fileName),$errorLine);
660
+			$source=$this->getSourceCode(@file($fileName), $errorLine);
661 661
 		}
662 662
 		if($this->getApplication()->getMode()===TApplicationMode::Debug)
663 663
 			$version=$_SERVER['SERVER_SOFTWARE'].' <a href="https://github.com/pradosoft/prado">PRADO</a>/'.Prado::getVersion();
@@ -670,10 +670,10 @@  discard block
 block discarded – undo
670 670
 			'%%SourceCode%%' => $source,
671 671
 			'%%StackTrace%%' => htmlspecialchars($exception->getTraceAsString()),
672 672
 			'%%Version%%' => $version,
673
-			'%%Time%%' => @strftime('%Y-%m-%d %H:%M',time())
673
+			'%%Time%%' => @strftime('%Y-%m-%d %H:%M', time())
674 674
 		);
675 675
 		$content=$this->getExceptionTemplate($exception);
676
-		echo strtr($content,$tokens);
676
+		echo strtr($content, $tokens);
677 677
 	}
678 678
 	protected function getExceptionTemplate($exception)
679 679
 	{
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 			die("Unable to open exception template file '$exceptionFile'.");
686 686
 		return $content;
687 687
 	}
688
-	protected function getErrorTemplate($statusCode,$exception)
688
+	protected function getErrorTemplate($statusCode, $exception)
689 689
 	{
690 690
 		$base=$this->getErrorTemplatePath().DIRECTORY_SEPARATOR.self::ERROR_FILE_NAME;
691 691
 		$lang=Prado::getPreferredLanguage();
@@ -714,14 +714,14 @@  discard block
 block discarded – undo
714 714
 		}
715 715
 		else if($exception instanceof TInvalidOperationException)
716 716
 		{
717
-						if(($result=$this->getPropertyAccessTrace($trace,'__get'))===null)
718
-				$result=$this->getPropertyAccessTrace($trace,'__set');
717
+						if(($result=$this->getPropertyAccessTrace($trace, '__get'))===null)
718
+				$result=$this->getPropertyAccessTrace($trace, '__set');
719 719
 		}
720
-		if($result!==null && strpos($result['file'],': eval()\'d code')!==false)
720
+		if($result!==null && strpos($result['file'], ': eval()\'d code')!==false)
721 721
 			return null;
722 722
 		return $result;
723 723
 	}
724
-	private function getPropertyAccessTrace($trace,$pattern)
724
+	private function getPropertyAccessTrace($trace, $pattern)
725 725
 	{
726 726
 		$result=null;
727 727
 		foreach($trace as $t)
@@ -733,35 +733,35 @@  discard block
 block discarded – undo
733 733
 		}
734 734
 		return $result;
735 735
 	}
736
-	private function getSourceCode($lines,$errorLine)
736
+	private function getSourceCode($lines, $errorLine)
737 737
 	{
738
-		$beginLine=$errorLine-self::SOURCE_LINES>=0?$errorLine-self::SOURCE_LINES:0;
739
-		$endLine=$errorLine+self::SOURCE_LINES<=count($lines)?$errorLine+self::SOURCE_LINES:count($lines);
738
+		$beginLine=$errorLine - self::SOURCE_LINES >= 0 ? $errorLine - self::SOURCE_LINES : 0;
739
+		$endLine=$errorLine + self::SOURCE_LINES <= count($lines) ? $errorLine + self::SOURCE_LINES : count($lines);
740 740
 		$source='';
741
-		for($i=$beginLine;$i<$endLine;++$i)
741
+		for($i=$beginLine; $i < $endLine; ++$i)
742 742
 		{
743
-			if($i===$errorLine-1)
743
+			if($i===$errorLine - 1)
744 744
 			{
745
-				$line=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
745
+				$line=htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
746 746
 				$source.="<div class=\"error\">".$line."</div>";
747 747
 			}
748 748
 			else
749
-				$source.=htmlspecialchars(sprintf("%04d: %s",$i+1,str_replace("\t",'    ',$lines[$i])));
749
+				$source.=htmlspecialchars(sprintf("%04d: %s", $i + 1, str_replace("\t", '    ', $lines[$i])));
750 750
 		}
751 751
 		return $source;
752 752
 	}
753 753
 	private function addLink($message)
754 754
 	{
755 755
 		$baseUrl='http://pradosoft.github.io/docs/manual/class-';
756
-		return preg_replace('/\b(T[A-Z]\w+)\b/',"<a href=\"$baseUrl\${1}\" target=\"_blank\">\${1}</a>",$message);
756
+		return preg_replace('/\b(T[A-Z]\w+)\b/', "<a href=\"$baseUrl\${1}\" target=\"_blank\">\${1}</a>", $message);
757 757
 	}
758 758
 }
759
-class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countable
759
+class TList extends TComponent implements IteratorAggregate, ArrayAccess, Countable
760 760
 {
761 761
 	private $_d=array();
762 762
 	private $_c=0;
763 763
 	private $_r=false;
764
-	public function __construct($data=null,$readOnly=false)
764
+	public function __construct($data=null, $readOnly=false)
765 765
 	{
766 766
 		if($data!==null)
767 767
 			$this->copyFrom($data);
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 	}
778 778
 	public function getIterator()
779 779
 	{
780
-		return new ArrayIterator( $this->_d );
780
+		return new ArrayIterator($this->_d);
781 781
 	}
782 782
 	public function count()
783 783
 	{
@@ -789,38 +789,38 @@  discard block
 block discarded – undo
789 789
 	}
790 790
 	public function itemAt($index)
791 791
 	{
792
-		if($index>=0 && $index<$this->_c)
792
+		if($index >= 0 && $index < $this->_c)
793 793
 			return $this->_d[$index];
794 794
 		else
795
-			throw new TInvalidDataValueException('list_index_invalid',$index);
795
+			throw new TInvalidDataValueException('list_index_invalid', $index);
796 796
 	}
797 797
 	public function add($item)
798 798
 	{
799
-		$this->insertAt($this->_c,$item);
800
-		return $this->_c-1;
799
+		$this->insertAt($this->_c, $item);
800
+		return $this->_c - 1;
801 801
 	}
802
-	public function insertAt($index,$item)
802
+	public function insertAt($index, $item)
803 803
 	{
804 804
 		if(!$this->_r)
805 805
 		{
806 806
 			if($index===$this->_c)
807 807
 				$this->_d[$this->_c++]=$item;
808
-			else if($index>=0 && $index<$this->_c)
808
+			else if($index >= 0 && $index < $this->_c)
809 809
 			{
810
-				array_splice($this->_d,$index,0,array($item));
810
+				array_splice($this->_d, $index, 0, array($item));
811 811
 				$this->_c++;
812 812
 			}
813 813
 			else
814
-				throw new TInvalidDataValueException('list_index_invalid',$index);
814
+				throw new TInvalidDataValueException('list_index_invalid', $index);
815 815
 		}
816 816
 		else
817
-			throw new TInvalidOperationException('list_readonly',get_class($this));
817
+			throw new TInvalidOperationException('list_readonly', get_class($this));
818 818
 	}
819 819
 	public function remove($item)
820 820
 	{
821 821
 		if(!$this->_r)
822 822
 		{
823
-			if(($index=$this->indexOf($item))>=0)
823
+			if(($index=$this->indexOf($item)) >= 0)
824 824
 			{
825 825
 				$this->removeAt($index);
826 826
 				return $index;
@@ -829,13 +829,13 @@  discard block
 block discarded – undo
829 829
 				throw new TInvalidDataValueException('list_item_inexistent');
830 830
 		}
831 831
 		else
832
-			throw new TInvalidOperationException('list_readonly',get_class($this));
832
+			throw new TInvalidOperationException('list_readonly', get_class($this));
833 833
 	}
834 834
 	public function removeAt($index)
835 835
 	{
836 836
 		if(!$this->_r)
837 837
 		{
838
-			if($index>=0 && $index<$this->_c)
838
+			if($index >= 0 && $index < $this->_c)
839 839
 			{
840 840
 				$this->_c--;
841 841
 				if($index===$this->_c)
@@ -843,28 +843,28 @@  discard block
 block discarded – undo
843 843
 				else
844 844
 				{
845 845
 					$item=$this->_d[$index];
846
-					array_splice($this->_d,$index,1);
846
+					array_splice($this->_d, $index, 1);
847 847
 					return $item;
848 848
 				}
849 849
 			}
850 850
 			else
851
-				throw new TInvalidDataValueException('list_index_invalid',$index);
851
+				throw new TInvalidDataValueException('list_index_invalid', $index);
852 852
 		}
853 853
 		else
854
-			throw new TInvalidOperationException('list_readonly',get_class($this));
854
+			throw new TInvalidOperationException('list_readonly', get_class($this));
855 855
 	}
856 856
 	public function clear()
857 857
 	{
858
-		for($i=$this->_c-1;$i>=0;--$i)
858
+		for($i=$this->_c - 1; $i >= 0; --$i)
859 859
 			$this->removeAt($i);
860 860
 	}
861 861
 	public function contains($item)
862 862
 	{
863
-		return $this->indexOf($item)>=0;
863
+		return $this->indexOf($item) >= 0;
864 864
 	}
865 865
 	public function indexOf($item)
866 866
 	{
867
-		if(($index=array_search($item,$this->_d,true))===false)
867
+		if(($index=array_search($item, $this->_d, true))===false)
868 868
 			return -1;
869 869
 		else
870 870
 			return $index;
@@ -873,25 +873,25 @@  discard block
 block discarded – undo
873 873
 	{
874 874
 		if(!$this->_r)
875 875
 		{
876
-			if(($index = $this->indexOf($baseitem)) == -1)
876
+			if(($index=$this->indexOf($baseitem))==-1)
877 877
 				throw new TInvalidDataValueException('list_item_inexistent');
878 878
 			$this->insertAt($index, $item);
879 879
 			return $index;
880 880
 		}
881 881
 		else
882
-			throw new TInvalidOperationException('list_readonly',get_class($this));
882
+			throw new TInvalidOperationException('list_readonly', get_class($this));
883 883
 	}
884 884
 	public function insertAfter($baseitem, $item)
885 885
 	{
886 886
 		if(!$this->_r)
887 887
 		{
888
-			if(($index = $this->indexOf($baseitem)) == -1)
888
+			if(($index=$this->indexOf($baseitem))==-1)
889 889
 				throw new TInvalidDataValueException('list_item_inexistent');
890 890
 			$this->insertAt($index + 1, $item);
891 891
 			return $index + 1;
892 892
 		}
893 893
 		else
894
-			throw new TInvalidOperationException('list_readonly',get_class($this));
894
+			throw new TInvalidOperationException('list_readonly', get_class($this));
895 895
 	}
896 896
 	public function toArray()
897 897
 	{
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 	{
902 902
 		if(is_array($data) || ($data instanceof Traversable))
903 903
 		{
904
-			if($this->_c>0)
904
+			if($this->_c > 0)
905 905
 				$this->clear();
906 906
 			foreach($data as $item)
907 907
 				$this->add($item);
@@ -921,20 +921,20 @@  discard block
 block discarded – undo
921 921
 	}
922 922
 	public function offsetExists($offset)
923 923
 	{
924
-		return ($offset>=0 && $offset<$this->_c);
924
+		return ($offset >= 0 && $offset < $this->_c);
925 925
 	}
926 926
 	public function offsetGet($offset)
927 927
 	{
928 928
 		return $this->itemAt($offset);
929 929
 	}
930
-	public function offsetSet($offset,$item)
930
+	public function offsetSet($offset, $item)
931 931
 	{
932 932
 		if($offset===null || $offset===$this->_c)
933
-			$this->insertAt($this->_c,$item);
933
+			$this->insertAt($this->_c, $item);
934 934
 		else
935 935
 		{
936 936
 			$this->removeAt($offset);
937
-			$this->insertAt($offset,$item);
937
+			$this->insertAt($offset, $item);
938 938
 		}
939 939
 	}
940 940
 	public function offsetUnset($offset)
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 			if($this->getApplication()->getCache()===null)
959 959
 				$this->getApplication()->setCache($this);
960 960
 			else
961
-				throw new TConfigurationException('cache_primary_duplicated',get_class($this));
961
+				throw new TConfigurationException('cache_primary_duplicated', get_class($this));
962 962
 		}
963 963
 	}
964 964
 	public function getPrimaryCache()
@@ -992,22 +992,22 @@  discard block
 block discarded – undo
992 992
 		}
993 993
 		return false;
994 994
 	}
995
-	public function set($id,$value,$expire=0,$dependency=null)
995
+	public function set($id, $value, $expire=0, $dependency=null)
996 996
 	{
997
-		if(empty($value) && $expire === 0)
997
+		if(empty($value) && $expire===0)
998 998
 			$this->delete($id);
999 999
 		else
1000 1000
 		{
1001
-			$data=array($value,$dependency);
1002
-			return $this->setValue($this->generateUniqueKey($id),$data,$expire);
1001
+			$data=array($value, $dependency);
1002
+			return $this->setValue($this->generateUniqueKey($id), $data, $expire);
1003 1003
 		}
1004 1004
 	}
1005
-	public function add($id,$value,$expire=0,$dependency=null)
1005
+	public function add($id, $value, $expire=0, $dependency=null)
1006 1006
 	{
1007
-		if(empty($value) && $expire === 0)
1007
+		if(empty($value) && $expire===0)
1008 1008
 			return false;
1009
-		$data=array($value,$dependency);
1010
-		return $this->addValue($this->generateUniqueKey($id),$data,$expire);
1009
+		$data=array($value, $dependency);
1010
+		return $this->addValue($this->generateUniqueKey($id), $data, $expire);
1011 1011
 	}
1012 1012
 	public function delete($id)
1013 1013
 	{
@@ -1018,12 +1018,12 @@  discard block
 block discarded – undo
1018 1018
 		throw new TNotSupportedException('cache_flush_unsupported');
1019 1019
 	}
1020 1020
 	abstract protected function getValue($key);
1021
-	abstract protected function setValue($key,$value,$expire);
1022
-	abstract protected function addValue($key,$value,$expire);
1021
+	abstract protected function setValue($key, $value, $expire);
1022
+	abstract protected function addValue($key, $value, $expire);
1023 1023
 	abstract protected function deleteValue($key);
1024 1024
 	public function offsetExists($id)
1025 1025
 	{
1026
-		return $this->get($id) !== false;
1026
+		return $this->get($id)!==false;
1027 1027
 	}
1028 1028
 	public function offsetGet($id)
1029 1029
 	{
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
 	public function setDirectory($directory)
1085 1085
 	{
1086 1086
 		if(($path=realpath($directory))===false || !is_dir($path))
1087
-			throw new TInvalidDataValueException('directorycachedependency_directory_invalid',$directory);
1087
+			throw new TInvalidDataValueException('directorycachedependency_directory_invalid', $directory);
1088 1088
 		$this->_directory=$path;
1089 1089
 		$this->_timestamps=$this->generateTimestamps($path);
1090 1090
 	}
@@ -1116,10 +1116,10 @@  discard block
 block discarded – undo
1116 1116
 	{
1117 1117
 		return true;
1118 1118
 	}
1119
-	protected function generateTimestamps($directory,$level=0)
1119
+	protected function generateTimestamps($directory, $level=0)
1120 1120
 	{
1121 1121
 		if(($dir=opendir($directory))===false)
1122
-			throw new TIOException('directorycachedependency_directory_invalid',$directory);
1122
+			throw new TIOException('directorycachedependency_directory_invalid', $directory);
1123 1123
 		$timestamps=array();
1124 1124
 		while(($file=readdir($dir))!==false)
1125 1125
 		{
@@ -1128,8 +1128,8 @@  discard block
 block discarded – undo
1128 1128
 				continue;
1129 1129
 			else if(is_dir($path))
1130 1130
 			{
1131
-				if(($this->_recursiveLevel<0 || $level<$this->_recursiveLevel) && $this->validateDirectory($path))
1132
-					$timestamps=array_merge($this->generateTimestamps($path,$level+1));
1131
+				if(($this->_recursiveLevel < 0 || $level < $this->_recursiveLevel) && $this->validateDirectory($path))
1132
+					$timestamps=array_merge($this->generateTimestamps($path, $level + 1));
1133 1133
 			}
1134 1134
 			else if($this->validateFile($path))
1135 1135
 				$timestamps[$path]=filemtime($path);
@@ -1189,10 +1189,10 @@  discard block
 block discarded – undo
1189 1189
 }
1190 1190
 class TCacheDependencyList extends TList
1191 1191
 {
1192
-	public function insertAt($index,$item)
1192
+	public function insertAt($index, $item)
1193 1193
 	{
1194 1194
 		if($item instanceof ICacheDependency)
1195
-			parent::insertAt($index,$item);
1195
+			parent::insertAt($index, $item);
1196 1196
 		else
1197 1197
 			throw new TInvalidDataTypeException('cachedependencylist_cachedependency_required');
1198 1198
 	}
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
 	private $_c=0;
1224 1224
 	private $_dp=10;
1225 1225
 	private $_p=8;
1226
-	public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8)
1226
+	public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8)
1227 1227
 	{
1228 1228
 		parent::__construct();
1229 1229
 		if($data!==null)
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 	{
1245 1245
 		if($priority===null)
1246 1246
 			$priority=$this->getDefaultPriority();
1247
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1247
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1248 1248
 		if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority]))
1249 1249
 			return false;
1250 1250
 		return count($this->_d[$priority]);
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 	}
1256 1256
 	protected function setDefaultPriority($value)
1257 1257
 	{
1258
-		$this->_dp=(string)round(TPropertyValue::ensureFloat($value),$this->_p);
1258
+		$this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p);
1259 1259
 	}
1260 1260
 	public function getPrecision()
1261 1261
 	{
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 	}
1277 1277
 	protected function sortPriorities() {
1278 1278
 		if(!$this->_o) {
1279
-			ksort($this->_d,SORT_NUMERIC);
1279
+			ksort($this->_d, SORT_NUMERIC);
1280 1280
 			$this->_o=true;
1281 1281
 		}
1282 1282
 	}
@@ -1286,111 +1286,111 @@  discard block
 block discarded – undo
1286 1286
 		$this->sortPriorities();
1287 1287
 		$this->_fd=array();
1288 1288
 		foreach($this->_d as $priority => $itemsatpriority)
1289
-			$this->_fd=array_merge($this->_fd,$itemsatpriority);
1289
+			$this->_fd=array_merge($this->_fd, $itemsatpriority);
1290 1290
 		return $this->_fd;
1291 1291
 	}
1292 1292
 	public function itemAt($index)
1293 1293
 	{
1294
-		if($index>=0&&$index<$this->getCount()) {
1294
+		if($index >= 0 && $index < $this->getCount()) {
1295 1295
 			$arr=$this->flattenPriorities();
1296 1296
 			return $arr[$index];
1297 1297
 		} else
1298
-			throw new TInvalidDataValueException('list_index_invalid',$index);
1298
+			throw new TInvalidDataValueException('list_index_invalid', $index);
1299 1299
 	}
1300 1300
 	public function itemsAtPriority($priority=null)
1301 1301
 	{
1302 1302
 		if($priority===null)
1303 1303
 			$priority=$this->getDefaultPriority();
1304
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1305
-		return isset($this->_d[$priority])?$this->_d[$priority]:null;
1304
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1305
+		return isset($this->_d[$priority]) ? $this->_d[$priority] : null;
1306 1306
 	}
1307
-	public function itemAtIndexInPriority($index,$priority=null)
1307
+	public function itemAtIndexInPriority($index, $priority=null)
1308 1308
 	{
1309 1309
 		if($priority===null)
1310 1310
 			$priority=$this->getDefaultPriority();
1311
-		$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
1312
-		return !isset($this->_d[$priority])?false:(
1313
-				isset($this->_d[$priority][$index])?$this->_d[$priority][$index]:false
1311
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1312
+		return !isset($this->_d[$priority]) ? false : (
1313
+				isset($this->_d[$priority][$index]) ? $this->_d[$priority][$index] : false
1314 1314
 			);
1315 1315
 	}
1316
-	public function add($item,$priority=null)
1316
+	public function add($item, $priority=null)
1317 1317
 	{
1318 1318
 		if($this->getReadOnly())
1319
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1320
-		return $this->insertAtIndexInPriority($item,false,$priority,true);
1319
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1320
+		return $this->insertAtIndexInPriority($item, false, $priority, true);
1321 1321
 	}
1322
-	public function insertAt($index,$item)
1322
+	public function insertAt($index, $item)
1323 1323
 	{
1324 1324
 		if($this->getReadOnly())
1325
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1326
-		if(($priority=$this->priorityAt($index,true))!==false)
1327
-			$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
1325
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1326
+		if(($priority=$this->priorityAt($index, true))!==false)
1327
+			$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
1328 1328
 		else
1329
-			throw new TInvalidDataValueException('list_index_invalid',$index);
1329
+			throw new TInvalidDataValueException('list_index_invalid', $index);
1330 1330
 	}
1331
-	public function insertAtIndexInPriority($item,$index=false,$priority=null,$preserveCache=false)
1331
+	public function insertAtIndexInPriority($item, $index=false, $priority=null, $preserveCache=false)
1332 1332
 	{
1333 1333
 		if($this->getReadOnly())
1334
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1334
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1335 1335
 		if($priority===null)
1336 1336
 			$priority=$this->getDefaultPriority();
1337
-		$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
1337
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1338 1338
 		if($preserveCache) {
1339 1339
 			$this->sortPriorities();
1340 1340
 			$cc=0;
1341 1341
 			foreach($this->_d as $prioritykey=>$items)
1342
-				if($prioritykey>=$priority)
1342
+				if($prioritykey >= $priority)
1343 1343
 					break;
1344 1344
 				else
1345 1345
 					$cc+=count($items);
1346
-			if($index===false&&isset($this->_d[$priority])) {
1346
+			if($index===false && isset($this->_d[$priority])) {
1347 1347
 				$c=count($this->_d[$priority]);
1348 1348
 				$c+=$cc;
1349 1349
 				$this->_d[$priority][]=$item;
1350 1350
 			} else if(isset($this->_d[$priority])) {
1351
-				$c=$index+$cc;
1352
-				array_splice($this->_d[$priority],$index,0,array($item));
1351
+				$c=$index + $cc;
1352
+				array_splice($this->_d[$priority], $index, 0, array($item));
1353 1353
 			} else {
1354
-				$c = $cc;
1355
-				$this->_o = false;
1354
+				$c=$cc;
1355
+				$this->_o=false;
1356 1356
 				$this->_d[$priority]=array($item);
1357 1357
 			}
1358
-			if($this->_fd&&is_array($this->_fd)) 				array_splice($this->_fd,$c,0,array($item));
1358
+			if($this->_fd && is_array($this->_fd)) 				array_splice($this->_fd, $c, 0, array($item));
1359 1359
 		} else {
1360 1360
 			$c=null;
1361
-			if($index===false&&isset($this->_d[$priority])) {
1361
+			if($index===false && isset($this->_d[$priority])) {
1362 1362
 				$cc=count($this->_d[$priority]);
1363 1363
 				$this->_d[$priority][]=$item;
1364 1364
 			} else if(isset($this->_d[$priority])) {
1365 1365
 				$cc=$index;
1366
-				array_splice($this->_d[$priority],$index,0,array($item));
1366
+				array_splice($this->_d[$priority], $index, 0, array($item));
1367 1367
 			} else {
1368 1368
 				$cc=0;
1369 1369
 				$this->_o=false;
1370 1370
 				$this->_d[$priority]=array($item);
1371 1371
 			}
1372
-			if($this->_fd&&is_array($this->_fd)&&count($this->_d)==1)
1373
-				array_splice($this->_fd,$cc,0,array($item));
1372
+			if($this->_fd && is_array($this->_fd) && count($this->_d)==1)
1373
+				array_splice($this->_fd, $cc, 0, array($item));
1374 1374
 			else
1375 1375
 				$this->_fd=null;
1376 1376
 		}
1377 1377
 		$this->_c++;
1378 1378
 		return $c;
1379 1379
 	}
1380
-	public function remove($item,$priority=false)
1380
+	public function remove($item, $priority=false)
1381 1381
 	{
1382 1382
 		if($this->getReadOnly())
1383
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1384
-		if(($p=$this->priorityOf($item,true))!==false)
1383
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1384
+		if(($p=$this->priorityOf($item, true))!==false)
1385 1385
 		{
1386 1386
 			if($priority!==false) {
1387 1387
 				if($priority===null)
1388 1388
 					$priority=$this->getDefaultPriority();
1389
-				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1389
+				$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1390 1390
 				if($p[0]!=$priority)
1391 1391
 					throw new TInvalidDataValueException('list_item_inexistent');
1392 1392
 			}
1393
-			$this->removeAtIndexInPriority($p[1],$p[0]);
1393
+			$this->removeAtIndexInPriority($p[1], $p[0]);
1394 1394
 			return $p[2];
1395 1395
 		}
1396 1396
 		else
@@ -1399,21 +1399,21 @@  discard block
 block discarded – undo
1399 1399
 	public function removeAt($index)
1400 1400
 	{
1401 1401
 		if($this->getReadOnly())
1402
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1402
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1403 1403
 		if(($priority=$this->priorityAt($index, true))!==false)
1404
-			return $this->removeAtIndexInPriority($priority[1],$priority[0]);
1405
-		throw new TInvalidDataValueException('list_index_invalid',$index);
1404
+			return $this->removeAtIndexInPriority($priority[1], $priority[0]);
1405
+		throw new TInvalidDataValueException('list_index_invalid', $index);
1406 1406
 	}
1407 1407
 	public function removeAtIndexInPriority($index, $priority=null)
1408 1408
 	{
1409 1409
 		if($this->getReadOnly())
1410
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1410
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1411 1411
 		if($priority===null)
1412 1412
 			$priority=$this->getDefaultPriority();
1413
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1414
-		if(!isset($this->_d[$priority])||$index<0||$index>=count($this->_d[$priority]))
1413
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1414
+		if(!isset($this->_d[$priority]) || $index < 0 || $index >= count($this->_d[$priority]))
1415 1415
 			throw new TInvalidDataValueException('list_item_inexistent');
1416
-				$value=array_splice($this->_d[$priority],$index,1);
1416
+				$value=array_splice($this->_d[$priority], $index, 1);
1417 1417
 		$value=$value[0];
1418 1418
 		if(!count($this->_d[$priority]))
1419 1419
 			unset($this->_d[$priority]);
@@ -1424,71 +1424,71 @@  discard block
 block discarded – undo
1424 1424
 	public function clear()
1425 1425
 	{
1426 1426
 		if($this->getReadOnly())
1427
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1428
-		$d=array_reverse($this->_d,true);
1427
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1428
+		$d=array_reverse($this->_d, true);
1429 1429
 		foreach($this->_d as $priority=>$items) {
1430
-			for($index=count($items)-1;$index>=0;$index--)
1431
-				$this->removeAtIndexInPriority($index,$priority);
1430
+			for($index=count($items) - 1; $index >= 0; $index--)
1431
+				$this->removeAtIndexInPriority($index, $priority);
1432 1432
 			unset($this->_d[$priority]);
1433 1433
 		}
1434 1434
 	}
1435 1435
 	public function contains($item)
1436 1436
 	{
1437
-		return $this->indexOf($item)>=0;
1437
+		return $this->indexOf($item) >= 0;
1438 1438
 	}
1439 1439
 	public function indexOf($item)
1440 1440
 	{
1441
-		if(($index=array_search($item,$this->flattenPriorities(),true))===false)
1441
+		if(($index=array_search($item, $this->flattenPriorities(), true))===false)
1442 1442
 			return -1;
1443 1443
 		else
1444 1444
 			return $index;
1445 1445
 	}
1446
-	public function priorityOf($item,$withindex = false)
1446
+	public function priorityOf($item, $withindex=false)
1447 1447
 	{
1448 1448
 		$this->sortPriorities();
1449
-		$absindex = 0;
1449
+		$absindex=0;
1450 1450
 		foreach($this->_d as $priority=>$items) {
1451
-			if(($index=array_search($item,$items,true))!==false) {
1451
+			if(($index=array_search($item, $items, true))!==false) {
1452 1452
 				$absindex+=$index;
1453
-				return $withindex?array($priority,$index,$absindex,
1454
-						'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
1453
+				return $withindex ? array($priority, $index, $absindex,
1454
+						'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority;
1455 1455
 			} else
1456 1456
 				$absindex+=count($items);
1457 1457
 		}
1458 1458
 		return false;
1459 1459
 	}
1460
-	public function priorityAt($index,$withindex = false)
1460
+	public function priorityAt($index, $withindex=false)
1461 1461
 	{
1462
-		if($index<0||$index>=$this->getCount())
1463
-			throw new TInvalidDataValueException('list_index_invalid',$index);
1462
+		if($index < 0 || $index >= $this->getCount())
1463
+			throw new TInvalidDataValueException('list_index_invalid', $index);
1464 1464
 		$absindex=$index;
1465 1465
 		$this->sortPriorities();
1466 1466
 		foreach($this->_d as $priority=>$items) {
1467
-			if($index>=($c=count($items)))
1467
+			if($index >= ($c=count($items)))
1468 1468
 				$index-=$c;
1469 1469
 			else
1470
-				return $withindex?array($priority,$index,$absindex,
1471
-						'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
1470
+				return $withindex ? array($priority, $index, $absindex,
1471
+						'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority;
1472 1472
 		}
1473 1473
 		return false;
1474 1474
 	}
1475 1475
 	public function insertBefore($indexitem, $item)
1476 1476
 	{
1477 1477
 		if($this->getReadOnly())
1478
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1479
-		if(($priority=$this->priorityOf($indexitem,true))===false)
1478
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1479
+		if(($priority=$this->priorityOf($indexitem, true))===false)
1480 1480
 			throw new TInvalidDataValueException('list_item_inexistent');
1481
-		$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
1481
+		$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
1482 1482
 		return $priority[2];
1483 1483
 	}
1484 1484
 	public function insertAfter($indexitem, $item)
1485 1485
 	{
1486 1486
 		if($this->getReadOnly())
1487
-			throw new TInvalidOperationException('list_readonly',get_class($this));
1488
-		if(($priority=$this->priorityOf($indexitem,true))===false)
1487
+			throw new TInvalidOperationException('list_readonly', get_class($this));
1488
+		if(($priority=$this->priorityOf($indexitem, true))===false)
1489 1489
 			throw new TInvalidDataValueException('list_item_inexistent');
1490
-		$this->insertAtIndexInPriority($item,$priority[1]+1,$priority[0]);
1491
-		return $priority[2]+1;
1490
+		$this->insertAtIndexInPriority($item, $priority[1] + 1, $priority[0]);
1491
+		return $priority[2] + 1;
1492 1492
 	}
1493 1493
 	public function toArray()
1494 1494
 	{
@@ -1499,27 +1499,27 @@  discard block
 block discarded – undo
1499 1499
 		$this->sortPriorities();
1500 1500
 		return $this->_d;
1501 1501
 	}
1502
-	public function toArrayBelowPriority($priority,$inclusive=false)
1502
+	public function toArrayBelowPriority($priority, $inclusive=false)
1503 1503
 	{
1504 1504
 		$this->sortPriorities();
1505 1505
 		$items=array();
1506 1506
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
1507 1507
 		{
1508
-			if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority)
1508
+			if((!$inclusive && $itemspriority >= $priority) || $itemspriority > $priority)
1509 1509
 				break;
1510
-			$items=array_merge($items,$itemsatpriority);
1510
+			$items=array_merge($items, $itemsatpriority);
1511 1511
 		}
1512 1512
 		return $items;
1513 1513
 	}
1514
-	public function toArrayAbovePriority($priority,$inclusive=true)
1514
+	public function toArrayAbovePriority($priority, $inclusive=true)
1515 1515
 	{
1516 1516
 		$this->sortPriorities();
1517 1517
 		$items=array();
1518 1518
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
1519 1519
 		{
1520
-			if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority)
1520
+			if((!$inclusive && $itemspriority <= $priority) || $itemspriority < $priority)
1521 1521
 				continue;
1522
-			$items=array_merge($items,$itemsatpriority);
1522
+			$items=array_merge($items, $itemsatpriority);
1523 1523
 		}
1524 1524
 		return $items;
1525 1525
 	}
@@ -1527,15 +1527,15 @@  discard block
 block discarded – undo
1527 1527
 	{
1528 1528
 		if($data instanceof TPriorityList)
1529 1529
 		{
1530
-			if($this->getCount()>0)
1530
+			if($this->getCount() > 0)
1531 1531
 				$this->clear();
1532 1532
 			foreach($data->getPriorities() as $priority)
1533 1533
 			{
1534 1534
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
1535
-					$this->insertAtIndexInPriority($item,$index,$priority);
1535
+					$this->insertAtIndexInPriority($item, $index, $priority);
1536 1536
 			}
1537
-		} else if(is_array($data)||$data instanceof Traversable) {
1538
-			if($this->getCount()>0)
1537
+		} else if(is_array($data) || $data instanceof Traversable) {
1538
+			if($this->getCount() > 0)
1539 1539
 				$this->clear();
1540 1540
 			foreach($data as $key=>$item)
1541 1541
 				$this->add($item);
@@ -1549,10 +1549,10 @@  discard block
 block discarded – undo
1549 1549
 			foreach($data->getPriorities() as $priority)
1550 1550
 			{
1551 1551
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
1552
-					$this->insertAtIndexInPriority($item,false,$priority);
1552
+					$this->insertAtIndexInPriority($item, false, $priority);
1553 1553
 			}
1554 1554
 		}
1555
-		else if(is_array($data)||$data instanceof Traversable)
1555
+		else if(is_array($data) || $data instanceof Traversable)
1556 1556
 		{
1557 1557
 			foreach($data as $priority=>$item)
1558 1558
 				$this->add($item);
@@ -1562,43 +1562,43 @@  discard block
 block discarded – undo
1562 1562
 	}
1563 1563
 	public function offsetExists($offset)
1564 1564
 	{
1565
-		return ($offset>=0&&$offset<$this->getCount());
1565
+		return ($offset >= 0 && $offset < $this->getCount());
1566 1566
 	}
1567 1567
 	public function offsetGet($offset)
1568 1568
 	{
1569 1569
 		return $this->itemAt($offset);
1570 1570
 	}
1571
-	public function offsetSet($offset,$item)
1571
+	public function offsetSet($offset, $item)
1572 1572
 	{
1573 1573
 		if($offset===null)
1574 1574
 			return $this->add($item);
1575 1575
 		if($offset===$this->getCount()) {
1576
-			$priority=$this->priorityAt($offset-1,true);
1576
+			$priority=$this->priorityAt($offset - 1, true);
1577 1577
 			$priority[1]++;
1578 1578
 		} else {
1579
-			$priority=$this->priorityAt($offset,true);
1580
-			$this->removeAtIndexInPriority($priority[1],$priority[0]);
1579
+			$priority=$this->priorityAt($offset, true);
1580
+			$this->removeAtIndexInPriority($priority[1], $priority[0]);
1581 1581
 		}
1582
-		$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
1582
+		$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
1583 1583
 	}
1584 1584
 	public function offsetUnset($offset)
1585 1585
 	{
1586 1586
 		$this->removeAt($offset);
1587 1587
 	}
1588 1588
 }
1589
-class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable
1589
+class TMap extends TComponent implements IteratorAggregate, ArrayAccess, Countable
1590 1590
 {
1591 1591
 	private $_d=array();
1592 1592
 	private $_r=false;
1593 1593
 	protected function _getZappableSleepProps(&$exprops)
1594 1594
 	{
1595 1595
 		parent::_getZappableSleepProps($exprops);
1596
-		if ($this->_d===array())
1597
-			$exprops[] = "\0TMap\0_d";
1598
-		if ($this->_r===false)
1599
-			$exprops[] = "\0TMap\0_r";
1596
+		if($this->_d===array())
1597
+			$exprops[]="\0TMap\0_d";
1598
+		if($this->_r===false)
1599
+			$exprops[]="\0TMap\0_r";
1600 1600
 	}
1601
-	public function __construct($data=null,$readOnly=false)
1601
+	public function __construct($data=null, $readOnly=false)
1602 1602
 	{
1603 1603
 		if($data!==null)
1604 1604
 			$this->copyFrom($data);
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 	}
1615 1615
 	public function getIterator()
1616 1616
 	{
1617
-		return new ArrayIterator( $this->_d );
1617
+		return new ArrayIterator($this->_d);
1618 1618
 	}
1619 1619
 	public function count()
1620 1620
 	{
@@ -1632,18 +1632,18 @@  discard block
 block discarded – undo
1632 1632
 	{
1633 1633
 		return isset($this->_d[$key]) ? $this->_d[$key] : null;
1634 1634
 	}
1635
-	public function add($key,$value)
1635
+	public function add($key, $value)
1636 1636
 	{
1637 1637
 		if(!$this->_r)
1638 1638
 			$this->_d[$key]=$value;
1639 1639
 		else
1640
-			throw new TInvalidOperationException('map_readonly',get_class($this));
1640
+			throw new TInvalidOperationException('map_readonly', get_class($this));
1641 1641
 	}
1642 1642
 	public function remove($key)
1643 1643
 	{
1644 1644
 		if(!$this->_r)
1645 1645
 		{
1646
-			if(isset($this->_d[$key]) || array_key_exists($key,$this->_d))
1646
+			if(isset($this->_d[$key]) || array_key_exists($key, $this->_d))
1647 1647
 			{
1648 1648
 				$value=$this->_d[$key];
1649 1649
 				unset($this->_d[$key]);
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 				return null;
1654 1654
 		}
1655 1655
 		else
1656
-			throw new TInvalidOperationException('map_readonly',get_class($this));
1656
+			throw new TInvalidOperationException('map_readonly', get_class($this));
1657 1657
 	}
1658 1658
 	public function clear()
1659 1659
 	{
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
 	}
1663 1663
 	public function contains($key)
1664 1664
 	{
1665
-		return isset($this->_d[$key]) || array_key_exists($key,$this->_d);
1665
+		return isset($this->_d[$key]) || array_key_exists($key, $this->_d);
1666 1666
 	}
1667 1667
 	public function toArray()
1668 1668
 	{
@@ -1672,10 +1672,10 @@  discard block
 block discarded – undo
1672 1672
 	{
1673 1673
 		if(is_array($data) || $data instanceof Traversable)
1674 1674
 		{
1675
-			if($this->getCount()>0)
1675
+			if($this->getCount() > 0)
1676 1676
 				$this->clear();
1677 1677
 			foreach($data as $key=>$value)
1678
-				$this->add($key,$value);
1678
+				$this->add($key, $value);
1679 1679
 		}
1680 1680
 		else if($data!==null)
1681 1681
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 		if(is_array($data) || $data instanceof Traversable)
1686 1686
 		{
1687 1687
 			foreach($data as $key=>$value)
1688
-				$this->add($key,$value);
1688
+				$this->add($key, $value);
1689 1689
 		}
1690 1690
 		else if($data!==null)
1691 1691
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -1698,9 +1698,9 @@  discard block
 block discarded – undo
1698 1698
 	{
1699 1699
 		return $this->itemAt($offset);
1700 1700
 	}
1701
-	public function offsetSet($offset,$item)
1701
+	public function offsetSet($offset, $item)
1702 1702
 	{
1703
-		$this->add($offset,$item);
1703
+		$this->add($offset, $item);
1704 1704
 	}
1705 1705
 	public function offsetUnset($offset)
1706 1706
 	{
@@ -1719,7 +1719,7 @@  discard block
 block discarded – undo
1719 1719
 	private $_c=0;
1720 1720
 	private $_dp=10;
1721 1721
 	private $_p=8;
1722
-	public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8)
1722
+	public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8)
1723 1723
 	{
1724 1724
 		if($data!==null)
1725 1725
 			$this->copyFrom($data);
@@ -1741,7 +1741,7 @@  discard block
 block discarded – undo
1741 1741
 	}
1742 1742
 	protected function setDefaultPriority($value)
1743 1743
 	{
1744
-		$this->_dp = (string)round(TPropertyValue::ensureFloat($value), $this->_p);
1744
+		$this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p);
1745 1745
 	}
1746 1746
 	public function getPrecision()
1747 1747
 	{
@@ -1765,9 +1765,9 @@  discard block
 block discarded – undo
1765 1765
 		if(is_array($this->_fd))
1766 1766
 			return $this->_fd;
1767 1767
 		$this->sortPriorities();
1768
-		$this->_fd = array();
1768
+		$this->_fd=array();
1769 1769
 		foreach($this->_d as $priority => $itemsatpriority)
1770
-			$this->_fd = array_merge($this->_fd, $itemsatpriority);
1770
+			$this->_fd=array_merge($this->_fd, $itemsatpriority);
1771 1771
 		return $this->_fd;
1772 1772
 	}
1773 1773
 	public function count()
@@ -1782,8 +1782,8 @@  discard block
 block discarded – undo
1782 1782
 	{
1783 1783
 		if($priority===null)
1784 1784
 			$priority=$this->getDefaultPriority();
1785
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1786
-		if(!isset($this->_d[$priority])||!is_array($this->_d[$priority]))
1785
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1786
+		if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority]))
1787 1787
 			return false;
1788 1788
 		return count($this->_d[$priority]);
1789 1789
 	}
@@ -1796,27 +1796,27 @@  discard block
 block discarded – undo
1796 1796
 	{
1797 1797
 		return array_keys($this->flattenPriorities());
1798 1798
 	}
1799
-	public function itemAt($key,$priority=false)
1799
+	public function itemAt($key, $priority=false)
1800 1800
 	{
1801
-		if($priority===false){
1801
+		if($priority===false) {
1802 1802
 			$map=$this->flattenPriorities();
1803
-			return isset($map[$key])?$map[$key]:null;
1803
+			return isset($map[$key]) ? $map[$key] : null;
1804 1804
 		} else {
1805 1805
 			if($priority===null)
1806 1806
 				$priority=$this->getDefaultPriority();
1807
-			$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1808
-			return (isset($this->_d[$priority])&&isset($this->_d[$priority][$key]))?$this->_d[$priority][$key]:null;
1807
+			$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1808
+			return (isset($this->_d[$priority]) && isset($this->_d[$priority][$key])) ? $this->_d[$priority][$key] : null;
1809 1809
 		}
1810 1810
 	}
1811
-	public function setPriorityAt($key,$priority=null)
1811
+	public function setPriorityAt($key, $priority=null)
1812 1812
 	{
1813 1813
 		if($priority===null)
1814 1814
 			$priority=$this->getDefaultPriority();
1815
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1815
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1816 1816
 		$oldpriority=$this->priorityAt($key);
1817
-		if($oldpriority!==false&&$oldpriority!=$priority) {
1818
-			$value=$this->remove($key,$oldpriority);
1819
-			$this->add($key,$value,$priority);
1817
+		if($oldpriority!==false && $oldpriority!=$priority) {
1818
+			$value=$this->remove($key, $oldpriority);
1819
+			$this->add($key, $value, $priority);
1820 1820
 		}
1821 1821
 		return $oldpriority;
1822 1822
 	}
@@ -1824,14 +1824,14 @@  discard block
 block discarded – undo
1824 1824
 	{
1825 1825
 		if($priority===null)
1826 1826
 			$priority=$this->getDefaultPriority();
1827
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1828
-		return isset($this->_d[$priority])?$this->_d[$priority]:null;
1827
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1828
+		return isset($this->_d[$priority]) ? $this->_d[$priority] : null;
1829 1829
 	}
1830 1830
 	public function priorityOf($item)
1831 1831
 	{
1832 1832
 		$this->sortPriorities();
1833 1833
 		foreach($this->_d as $priority=>$items)
1834
-			if(($index=array_search($item,$items,true))!==false)
1834
+			if(($index=array_search($item, $items, true))!==false)
1835 1835
 				return $priority;
1836 1836
 		return false;
1837 1837
 	}
@@ -1839,19 +1839,19 @@  discard block
 block discarded – undo
1839 1839
 	{
1840 1840
 		$this->sortPriorities();
1841 1841
 		foreach($this->_d as $priority=>$items)
1842
-			if(array_key_exists($key,$items))
1842
+			if(array_key_exists($key, $items))
1843 1843
 				return $priority;
1844 1844
 		return false;
1845 1845
 	}
1846
-	public function add($key,$value,$priority=null)
1846
+	public function add($key, $value, $priority=null)
1847 1847
 	{
1848 1848
 		if($priority===null)
1849 1849
 			$priority=$this->getDefaultPriority();
1850
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1850
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1851 1851
 		if(!$this->_r)
1852 1852
 		{
1853 1853
 			foreach($this->_d as $innerpriority=>$items)
1854
-				if(array_key_exists($key,$items))
1854
+				if(array_key_exists($key, $items))
1855 1855
 				{
1856 1856
 					unset($this->_d[$innerpriority][$key]);
1857 1857
 					$this->_c--;
@@ -1868,10 +1868,10 @@  discard block
 block discarded – undo
1868 1868
 			$this->_fd=null;
1869 1869
 		}
1870 1870
 		else
1871
-			throw new TInvalidOperationException('map_readonly',get_class($this));
1871
+			throw new TInvalidOperationException('map_readonly', get_class($this));
1872 1872
 		return $priority;
1873 1873
 	}
1874
-	public function remove($key,$priority=false)
1874
+	public function remove($key, $priority=false)
1875 1875
 	{
1876 1876
 		if(!$this->_r)
1877 1877
 		{
@@ -1881,7 +1881,7 @@  discard block
 block discarded – undo
1881 1881
 			{
1882 1882
 				$this->sortPriorities();
1883 1883
 				foreach($this->_d as $priority=>$items)
1884
-					if(array_key_exists($key,$items))
1884
+					if(array_key_exists($key, $items))
1885 1885
 					{
1886 1886
 						$value=$this->_d[$priority][$key];
1887 1887
 						unset($this->_d[$priority][$key]);
@@ -1898,8 +1898,8 @@  discard block
 block discarded – undo
1898 1898
 			}
1899 1899
 			else
1900 1900
 			{
1901
-				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
1902
-				if(isset($this->_d[$priority])&&(isset($this->_d[$priority][$key])||array_key_exists($key,$this->_d[$priority])))
1901
+				$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
1902
+				if(isset($this->_d[$priority]) && (isset($this->_d[$priority][$key]) || array_key_exists($key, $this->_d[$priority])))
1903 1903
 				{
1904 1904
 					$value=$this->_d[$priority][$key];
1905 1905
 					unset($this->_d[$priority][$key]);
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
 			}
1917 1917
 		}
1918 1918
 		else
1919
-			throw new TInvalidOperationException('map_readonly',get_class($this));
1919
+			throw new TInvalidOperationException('map_readonly', get_class($this));
1920 1920
 	}
1921 1921
 	public function clear()
1922 1922
 	{
@@ -1927,33 +1927,33 @@  discard block
 block discarded – undo
1927 1927
 	public function contains($key)
1928 1928
 	{
1929 1929
 		$map=$this->flattenPriorities();
1930
-		return isset($map[$key])||array_key_exists($key,$map);
1930
+		return isset($map[$key]) || array_key_exists($key, $map);
1931 1931
 	}
1932 1932
 	public function toArray()
1933 1933
 	{
1934 1934
 		return $this->flattenPriorities();
1935 1935
 	}
1936
-	public function toArrayBelowPriority($priority,$inclusive=false)
1936
+	public function toArrayBelowPriority($priority, $inclusive=false)
1937 1937
 	{
1938 1938
 		$this->sortPriorities();
1939 1939
 		$items=array();
1940 1940
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
1941 1941
 		{
1942
-			if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority)
1942
+			if((!$inclusive && $itemspriority >= $priority) || $itemspriority > $priority)
1943 1943
 				break;
1944
-			$items=array_merge($items,$itemsatpriority);
1944
+			$items=array_merge($items, $itemsatpriority);
1945 1945
 		}
1946 1946
 		return $items;
1947 1947
 	}
1948
-	public function toArrayAbovePriority($priority,$inclusive=true)
1948
+	public function toArrayAbovePriority($priority, $inclusive=true)
1949 1949
 	{
1950 1950
 		$this->sortPriorities();
1951 1951
 		$items=array();
1952 1952
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
1953 1953
 		{
1954
-			if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority)
1954
+			if((!$inclusive && $itemspriority <= $priority) || $itemspriority < $priority)
1955 1955
 				continue;
1956
-			$items=array_merge($items,$itemsatpriority);
1956
+			$items=array_merge($items, $itemsatpriority);
1957 1957
 		}
1958 1958
 		return $items;
1959 1959
 	}
@@ -1961,20 +1961,20 @@  discard block
 block discarded – undo
1961 1961
 	{
1962 1962
 		if($data instanceof TPriorityMap)
1963 1963
 		{
1964
-			if($this->getCount()>0)
1964
+			if($this->getCount() > 0)
1965 1965
 				$this->clear();
1966 1966
 			foreach($data->getPriorities() as $priority) {
1967 1967
 				foreach($data->itemsAtPriority($priority) as $key => $value) {
1968
-					$this->add($key,$value,$priority);
1968
+					$this->add($key, $value, $priority);
1969 1969
 				}
1970 1970
 			}
1971 1971
 		}
1972
-		else if(is_array($data)||$data instanceof Traversable)
1972
+		else if(is_array($data) || $data instanceof Traversable)
1973 1973
 		{
1974
-			if($this->getCount()>0)
1974
+			if($this->getCount() > 0)
1975 1975
 				$this->clear();
1976 1976
 			foreach($data as $key=>$value)
1977
-				$this->add($key,$value);
1977
+				$this->add($key, $value);
1978 1978
 		}
1979 1979
 		else if($data!==null)
1980 1980
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -1986,13 +1986,13 @@  discard block
 block discarded – undo
1986 1986
 			foreach($data->getPriorities() as $priority)
1987 1987
 			{
1988 1988
 				foreach($data->itemsAtPriority($priority) as $key => $value)
1989
-					$this->add($key,$value,$priority);
1989
+					$this->add($key, $value, $priority);
1990 1990
 			}
1991 1991
 		}
1992
-		else if(is_array($data)||$data instanceof Traversable)
1992
+		else if(is_array($data) || $data instanceof Traversable)
1993 1993
 		{
1994 1994
 			foreach($data as $key=>$value)
1995
-				$this->add($key,$value);
1995
+				$this->add($key, $value);
1996 1996
 		}
1997 1997
 		else if($data!==null)
1998 1998
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -2005,16 +2005,16 @@  discard block
 block discarded – undo
2005 2005
 	{
2006 2006
 		return $this->itemAt($offset);
2007 2007
 	}
2008
-	public function offsetSet($offset,$item)
2008
+	public function offsetSet($offset, $item)
2009 2009
 	{
2010
-		$this->add($offset,$item);
2010
+		$this->add($offset, $item);
2011 2011
 	}
2012 2012
 	public function offsetUnset($offset)
2013 2013
 	{
2014 2014
 		$this->remove($offset);
2015 2015
 	}
2016 2016
 }
2017
-class TStack extends TComponent implements IteratorAggregate,Countable
2017
+class TStack extends TComponent implements IteratorAggregate, Countable
2018 2018
 {
2019 2019
 	private $_d=array();
2020 2020
 	private $_c=0;
@@ -2048,14 +2048,14 @@  discard block
 block discarded – undo
2048 2048
 	}
2049 2049
 	public function contains($item)
2050 2050
 	{
2051
-		return array_search($item,$this->_d,true)!==false;
2051
+		return array_search($item, $this->_d, true)!==false;
2052 2052
 	}
2053 2053
 	public function peek()
2054 2054
 	{
2055 2055
 		if($this->_c===0)
2056 2056
 			throw new TInvalidOperationException('stack_empty');
2057 2057
 		else
2058
-			return $this->_d[$this->_c-1];
2058
+			return $this->_d[$this->_c - 1];
2059 2059
 	}
2060 2060
 	public function pop()
2061 2061
 	{
@@ -2070,11 +2070,11 @@  discard block
 block discarded – undo
2070 2070
 	public function push($item)
2071 2071
 	{
2072 2072
 		++$this->_c;
2073
-		$this->_d[] = $item;
2073
+		$this->_d[]=$item;
2074 2074
 	}
2075 2075
 	public function getIterator()
2076 2076
 	{
2077
-		return new ArrayIterator( $this->_d );
2077
+		return new ArrayIterator($this->_d);
2078 2078
 	}
2079 2079
 	public function getCount()
2080 2080
 	{
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
 	}
2115 2115
 	public function valid()
2116 2116
 	{
2117
-		return $this->_i<$this->_c;
2117
+		return $this->_i < $this->_c;
2118 2118
 	}
2119 2119
 }
2120 2120
 class TXmlElement extends TComponent
@@ -2154,11 +2154,11 @@  discard block
 block discarded – undo
2154 2154
 	}
2155 2155
 	public function getHasElement()
2156 2156
 	{
2157
-		return $this->_elements!==null && $this->_elements->getCount()>0;
2157
+		return $this->_elements!==null && $this->_elements->getCount() > 0;
2158 2158
 	}
2159 2159
 	public function getHasAttribute()
2160 2160
 	{
2161
-		return $this->_attributes!==null && $this->_attributes->getCount()>0;
2161
+		return $this->_attributes!==null && $this->_attributes->getCount() > 0;
2162 2162
 	}
2163 2163
 	public function getAttribute($name)
2164 2164
 	{
@@ -2167,9 +2167,9 @@  discard block
 block discarded – undo
2167 2167
 		else
2168 2168
 			return null;
2169 2169
 	}
2170
-	public function setAttribute($name,$value)
2170
+	public function setAttribute($name, $value)
2171 2171
 	{
2172
-		$this->getAttributes()->add($name,TPropertyValue::ensureString($value));
2172
+		$this->getAttributes()->add($name, TPropertyValue::ensureString($value));
2173 2173
 	}
2174 2174
 	public function getElements()
2175 2175
 	{
@@ -2215,12 +2215,12 @@  discard block
 block discarded – undo
2215 2215
 				$attr.=" $name=\"$value\"";
2216 2216
 			}
2217 2217
 		}
2218
-		$prefix=str_repeat(' ',$indent*4);
2218
+		$prefix=str_repeat(' ', $indent * 4);
2219 2219
 		if($this->getHasElement())
2220 2220
 		{
2221 2221
 			$str=$prefix."<{$this->_tagName}$attr>\n";
2222 2222
 			foreach($this->getElements() as $element)
2223
-				$str.=$element->toString($indent+1)."\n";
2223
+				$str.=$element->toString($indent + 1)."\n";
2224 2224
 			$str.=$prefix."</{$this->_tagName}>";
2225 2225
 			return $str;
2226 2226
 		}
@@ -2238,7 +2238,7 @@  discard block
 block discarded – undo
2238 2238
 	}
2239 2239
 	private function xmlEncode($str)
2240 2240
 	{
2241
-		return strtr($str,array(
2241
+		return strtr($str, array(
2242 2242
 			'>'=>'&gt;',
2243 2243
 			'<'=>'&lt;',
2244 2244
 			'&'=>'&amp;',
@@ -2252,7 +2252,7 @@  discard block
 block discarded – undo
2252 2252
 {
2253 2253
 	private $_version;
2254 2254
 	private $_encoding;
2255
-	public function __construct($version='1.0',$encoding='')
2255
+	public function __construct($version='1.0', $encoding='')
2256 2256
 	{
2257 2257
 		parent::__construct('');
2258 2258
 		$this->setVersion($version);
@@ -2279,7 +2279,7 @@  discard block
 block discarded – undo
2279 2279
 		if(($str=@file_get_contents($file))!==false)
2280 2280
 			return $this->loadFromString($str);
2281 2281
 		else
2282
-			throw new TIOException('xmldocument_file_read_failed',$file);
2282
+			throw new TIOException('xmldocument_file_read_failed', $file);
2283 2283
 	}
2284 2284
 	public function loadFromString($string)
2285 2285
 	{
@@ -2296,23 +2296,23 @@  discard block
 block discarded – undo
2296 2296
 		$elements->clear();
2297 2297
 		$attributes->clear();
2298 2298
 		static $bSimpleXml;
2299
-		if($bSimpleXml === null)
2300
-			$bSimpleXml = (boolean)function_exists('simplexml_load_string');
2299
+		if($bSimpleXml===null)
2300
+			$bSimpleXml=(boolean) function_exists('simplexml_load_string');
2301 2301
 		if($bSimpleXml)
2302 2302
 		{
2303
-			$simpleDoc = simplexml_load_string($string);
2304
-			$docNamespaces = $simpleDoc->getDocNamespaces(false);
2305
-			$simpleDoc = null;
2303
+			$simpleDoc=simplexml_load_string($string);
2304
+			$docNamespaces=$simpleDoc->getDocNamespaces(false);
2305
+			$simpleDoc=null;
2306 2306
 			foreach($docNamespaces as $prefix => $uri)
2307 2307
 			{
2308
- 				if($prefix === '')
2308
+ 				if($prefix==='')
2309 2309
    					$attributes->add('xmlns', $uri);
2310 2310
    				else
2311 2311
    					$attributes->add('xmlns:'.$prefix, $uri);
2312 2312
 			}
2313 2313
 		}
2314 2314
 		foreach($element->attributes as $name=>$attr)
2315
-			$attributes->add(($attr->prefix === '' ? '' : $attr->prefix . ':') .$name,$attr->value);
2315
+			$attributes->add(($attr->prefix==='' ? '' : $attr->prefix.':').$name, $attr->value);
2316 2316
 		foreach($element->childNodes as $child)
2317 2317
 		{
2318 2318
 			if($child instanceof DOMElement)
@@ -2322,18 +2322,18 @@  discard block
 block discarded – undo
2322 2322
 	}
2323 2323
 	public function saveToFile($file)
2324 2324
 	{
2325
-		if(($fw=fopen($file,'w'))!==false)
2325
+		if(($fw=fopen($file, 'w'))!==false)
2326 2326
 		{
2327
-			fwrite($fw,$this->saveToString());
2327
+			fwrite($fw, $this->saveToString());
2328 2328
 			fclose($fw);
2329 2329
 		}
2330 2330
 		else
2331
-			throw new TIOException('xmldocument_file_write_failed',$file);
2331
+			throw new TIOException('xmldocument_file_write_failed', $file);
2332 2332
 	}
2333 2333
 	public function saveToString()
2334 2334
 	{
2335
-		$version=empty($this->_version)?' version="1.0"':' version="'.$this->_version.'"';
2336
-		$encoding=empty($this->_encoding)?'':' encoding="'.$this->_encoding.'"';
2335
+		$version=empty($this->_version) ? ' version="1.0"' : ' version="'.$this->_version.'"';
2336
+		$encoding=empty($this->_encoding) ? '' : ' encoding="'.$this->_encoding.'"';
2337 2337
 		return "<?xml{$version}{$encoding}?>\n".$this->toString(0);
2338 2338
 	}
2339 2339
 	public function __toString()
@@ -2345,7 +2345,7 @@  discard block
 block discarded – undo
2345 2345
 		$element=new TXmlElement($node->tagName);
2346 2346
 		$element->setValue($node->nodeValue);
2347 2347
 		foreach($node->attributes as $name=>$attr)
2348
-			$element->getAttributes()->add(($attr->prefix === '' ? '' : $attr->prefix . ':') . $name,$attr->value);
2348
+			$element->getAttributes()->add(($attr->prefix==='' ? '' : $attr->prefix.':').$name, $attr->value);
2349 2349
 		foreach($node->childNodes as $child)
2350 2350
 		{
2351 2351
 			if($child instanceof DOMElement)
@@ -2365,11 +2365,11 @@  discard block
 block discarded – undo
2365 2365
 	{
2366 2366
 		return $this->_o;
2367 2367
 	}
2368
-	public function insertAt($index,$item)
2368
+	public function insertAt($index, $item)
2369 2369
 	{
2370 2370
 		if($item instanceof TXmlElement)
2371 2371
 		{
2372
-			parent::insertAt($index,$item);
2372
+			parent::insertAt($index, $item);
2373 2373
 			if($item->getParent()!==null)
2374 2374
 				$item->getParent()->getElements()->remove($item);
2375 2375
 			$item->setParent($this->_o);
@@ -2395,13 +2395,13 @@  discard block
 block discarded – undo
2395 2395
 	private $_everyone;
2396 2396
 	private $_guest;
2397 2397
 	private $_authenticated;
2398
-	public function __construct($action,$users,$roles,$verb='',$ipRules='')
2398
+	public function __construct($action, $users, $roles, $verb='', $ipRules='')
2399 2399
 	{
2400 2400
 		$action=strtolower(trim($action));
2401 2401
 		if($action==='allow' || $action==='deny')
2402 2402
 			$this->_action=$action;
2403 2403
 		else
2404
-			throw new TInvalidDataValueException('authorizationrule_action_invalid',$action);
2404
+			throw new TInvalidDataValueException('authorizationrule_action_invalid', $action);
2405 2405
 		$this->_users=array();
2406 2406
 		$this->_roles=array();
2407 2407
 		$this->_ipRules=array();
@@ -2410,7 +2410,7 @@  discard block
 block discarded – undo
2410 2410
 		$this->_authenticated=false;
2411 2411
 		if(trim($users)==='')
2412 2412
 			$users='*';
2413
-		foreach(explode(',',$users) as $user)
2413
+		foreach(explode(',', $users) as $user)
2414 2414
 		{
2415 2415
 			if(($user=trim(strtolower($user)))!=='')
2416 2416
 			{
@@ -2429,7 +2429,7 @@  discard block
 block discarded – undo
2429 2429
 		}
2430 2430
 		if(trim($roles)==='')
2431 2431
 			$roles='*';
2432
-		foreach(explode(',',$roles) as $role)
2432
+		foreach(explode(',', $roles) as $role)
2433 2433
 		{
2434 2434
 			if(($role=trim(strtolower($role)))!=='')
2435 2435
 				$this->_roles[]=$role;
@@ -2439,10 +2439,10 @@  discard block
 block discarded – undo
2439 2439
 		if($verb==='*' || $verb==='get' || $verb==='post')
2440 2440
 			$this->_verb=$verb;
2441 2441
 		else
2442
-			throw new TInvalidDataValueException('authorizationrule_verb_invalid',$verb);
2442
+			throw new TInvalidDataValueException('authorizationrule_verb_invalid', $verb);
2443 2443
 		if(trim($ipRules)==='')
2444 2444
 			$ipRules='*';
2445
-		foreach(explode(',',$ipRules) as $ipRule)
2445
+		foreach(explode(',', $ipRules) as $ipRule)
2446 2446
 		{
2447 2447
 			if(($ipRule=trim($ipRule))!=='')
2448 2448
 				$this->_ipRules[]=$ipRule;
@@ -2480,10 +2480,10 @@  discard block
 block discarded – undo
2480 2480
 	{
2481 2481
 		return $this->_authenticated || $this->_everyone;
2482 2482
 	}
2483
-	public function isUserAllowed(IUser $user,$verb,$ip)
2483
+	public function isUserAllowed(IUser $user, $verb, $ip)
2484 2484
 	{
2485 2485
 		if($this->isVerbMatched($verb) && $this->isIpMatched($ip) && $this->isUserMatched($user) && $this->isRoleMatched($user))
2486
-			return ($this->_action==='allow')?1:-1;
2486
+			return ($this->_action==='allow') ? 1 : -1;
2487 2487
 		else
2488 2488
 			return 0;
2489 2489
 	}
@@ -2493,14 +2493,14 @@  discard block
 block discarded – undo
2493 2493
 			return 1;
2494 2494
 		foreach($this->_ipRules as $rule)
2495 2495
 		{
2496
-			if($rule==='*' || $rule===$ip || (($pos=strpos($rule,'*'))!==false && strncmp($ip,$rule,$pos)===0))
2496
+			if($rule==='*' || $rule===$ip || (($pos=strpos($rule, '*'))!==false && strncmp($ip, $rule, $pos)===0))
2497 2497
 				return 1;
2498 2498
 		}
2499 2499
 		return 0;
2500 2500
 	}
2501 2501
 	private function isUserMatched($user)
2502 2502
 	{
2503
-		return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()),$this->_users));
2503
+		return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()), $this->_users));
2504 2504
 	}
2505 2505
 	private function isRoleMatched($user)
2506 2506
 	{
@@ -2513,42 +2513,42 @@  discard block
 block discarded – undo
2513 2513
 	}
2514 2514
 	private function isVerbMatched($verb)
2515 2515
 	{
2516
-		return ($this->_verb==='*' || strcasecmp($verb,$this->_verb)===0);
2516
+		return ($this->_verb==='*' || strcasecmp($verb, $this->_verb)===0);
2517 2517
 	}
2518 2518
 }
2519 2519
 class TAuthorizationRuleCollection extends TList
2520 2520
 {
2521
-	public function isUserAllowed($user,$verb,$ip)
2521
+	public function isUserAllowed($user, $verb, $ip)
2522 2522
 	{
2523 2523
 		if($user instanceof IUser)
2524 2524
 		{
2525 2525
 			$verb=strtolower(trim($verb));
2526 2526
 			foreach($this as $rule)
2527 2527
 			{
2528
-				if(($decision=$rule->isUserAllowed($user,$verb,$ip))!==0)
2529
-					return ($decision>0);
2528
+				if(($decision=$rule->isUserAllowed($user, $verb, $ip))!==0)
2529
+					return ($decision > 0);
2530 2530
 			}
2531 2531
 			return true;
2532 2532
 		}
2533 2533
 		else
2534 2534
 			return false;
2535 2535
 	}
2536
-	public function insertAt($index,$item)
2536
+	public function insertAt($index, $item)
2537 2537
 	{
2538 2538
 		if($item instanceof TAuthorizationRule)
2539
-			parent::insertAt($index,$item);
2539
+			parent::insertAt($index, $item);
2540 2540
 		else
2541 2541
 			throw new TInvalidDataTypeException('authorizationrulecollection_authorizationrule_required');
2542 2542
 	}
2543 2543
 }
2544 2544
 class TSecurityManager extends TModule
2545 2545
 {
2546
-	const STATE_VALIDATION_KEY = 'prado:securitymanager:validationkey';
2547
-	const STATE_ENCRYPTION_KEY = 'prado:securitymanager:encryptionkey';
2548
-	private $_validationKey = null;
2549
-	private $_encryptionKey = null;
2550
-	private $_hashAlgorithm = 'sha1';
2551
-	private $_cryptAlgorithm = 'rijndael-256';
2546
+	const STATE_VALIDATION_KEY='prado:securitymanager:validationkey';
2547
+	const STATE_ENCRYPTION_KEY='prado:securitymanager:encryptionkey';
2548
+	private $_validationKey=null;
2549
+	private $_encryptionKey=null;
2550
+	private $_hashAlgorithm='sha1';
2551
+	private $_cryptAlgorithm='rijndael-256';
2552 2552
 	private $_mbstring;
2553 2553
 	public function init($config)
2554 2554
 	{
@@ -2557,13 +2557,13 @@  discard block
 block discarded – undo
2557 2557
 	}
2558 2558
 	protected function generateRandomKey()
2559 2559
 	{
2560
-		return sprintf('%08x%08x%08x%08x',mt_rand(),mt_rand(),mt_rand(),mt_rand());
2560
+		return sprintf('%08x%08x%08x%08x', mt_rand(), mt_rand(), mt_rand(), mt_rand());
2561 2561
 	}
2562 2562
 	public function getValidationKey()
2563 2563
 	{
2564
-		if(null === $this->_validationKey) {
2565
-			if(null === ($this->_validationKey = $this->getApplication()->getGlobalState(self::STATE_VALIDATION_KEY))) {
2566
-				$this->_validationKey = $this->generateRandomKey();
2564
+		if(null===$this->_validationKey) {
2565
+			if(null===($this->_validationKey=$this->getApplication()->getGlobalState(self::STATE_VALIDATION_KEY))) {
2566
+				$this->_validationKey=$this->generateRandomKey();
2567 2567
 				$this->getApplication()->setGlobalState(self::STATE_VALIDATION_KEY, $this->_validationKey, null, true);
2568 2568
 			}
2569 2569
 		}
@@ -2571,15 +2571,15 @@  discard block
 block discarded – undo
2571 2571
 	}
2572 2572
 	public function setValidationKey($value)
2573 2573
 	{
2574
-		if('' === $value)
2574
+		if(''===$value)
2575 2575
 			throw new TInvalidDataValueException('securitymanager_validationkey_invalid');
2576
-		$this->_validationKey = $value;
2576
+		$this->_validationKey=$value;
2577 2577
 	}
2578 2578
 	public function getEncryptionKey()
2579 2579
 	{
2580
-		if(null === $this->_encryptionKey) {
2581
-			if(null === ($this->_encryptionKey = $this->getApplication()->getGlobalState(self::STATE_ENCRYPTION_KEY))) {
2582
-				$this->_encryptionKey = $this->generateRandomKey();
2580
+		if(null===$this->_encryptionKey) {
2581
+			if(null===($this->_encryptionKey=$this->getApplication()->getGlobalState(self::STATE_ENCRYPTION_KEY))) {
2582
+				$this->_encryptionKey=$this->generateRandomKey();
2583 2583
 				$this->getApplication()->setGlobalState(self::STATE_ENCRYPTION_KEY, $this->_encryptionKey, null, true);
2584 2584
 			}
2585 2585
 		}
@@ -2587,9 +2587,9 @@  discard block
 block discarded – undo
2587 2587
 	}
2588 2588
 	public function setEncryptionKey($value)
2589 2589
 	{
2590
-		if('' === $value)
2590
+		if(''===$value)
2591 2591
 			throw new TInvalidDataValueException('securitymanager_encryptionkey_invalid');
2592
-		$this->_encryptionKey = $value;
2592
+		$this->_encryptionKey=$value;
2593 2593
 	}
2594 2594
 	public function getValidation()
2595 2595
 	{
@@ -2601,11 +2601,11 @@  discard block
 block discarded – undo
2601 2601
 	}
2602 2602
 	public function setValidation($value)
2603 2603
 	{
2604
-		$this->_hashAlgorithm = TPropertyValue::ensureEnum($value, 'TSecurityManagerValidationMode');
2604
+		$this->_hashAlgorithm=TPropertyValue::ensureEnum($value, 'TSecurityManagerValidationMode');
2605 2605
 	}
2606 2606
 	public function setHashAlgorithm($value)
2607 2607
 	{
2608
-		$this->_hashAlgorithm = TPropertyValue::ensureString($value);
2608
+		$this->_hashAlgorithm=TPropertyValue::ensureString($value);
2609 2609
 	}
2610 2610
 	public function getEncryption()
2611 2611
 	{
@@ -2615,7 +2615,7 @@  discard block
 block discarded – undo
2615 2615
 	}
2616 2616
 	public function setEncryption($value)
2617 2617
 	{
2618
-		$this->_cryptAlgorithm = $value;
2618
+		$this->_cryptAlgorithm=$value;
2619 2619
 	}
2620 2620
 	public function getCryptAlgorithm()
2621 2621
 	{
@@ -2623,16 +2623,16 @@  discard block
 block discarded – undo
2623 2623
 	}
2624 2624
 	public function setCryptAlgorithm($value)
2625 2625
 	{
2626
-		$this->_cryptAlgorithm = $value;
2626
+		$this->_cryptAlgorithm=$value;
2627 2627
 	}
2628 2628
 	public function encrypt($data)
2629 2629
 	{
2630 2630
 		$module=$this->openCryptModule();
2631
-		$key = $this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
2631
+		$key=$this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
2632 2632
 		srand();
2633
-		$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($module), MCRYPT_RAND);
2633
+		$iv=mcrypt_create_iv(mcrypt_enc_get_iv_size($module), MCRYPT_RAND);
2634 2634
 		mcrypt_generic_init($module, $key, $iv);
2635
-		$encrypted = $iv.mcrypt_generic($module, $data);
2635
+		$encrypted=$iv.mcrypt_generic($module, $data);
2636 2636
 		mcrypt_generic_deinit($module);
2637 2637
 		mcrypt_module_close($module);
2638 2638
 		return $encrypted;
@@ -2640,11 +2640,11 @@  discard block
 block discarded – undo
2640 2640
 	public function decrypt($data)
2641 2641
 	{
2642 2642
 		$module=$this->openCryptModule();
2643
-		$key = $this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
2644
-		$ivSize = mcrypt_enc_get_iv_size($module);
2645
-		$iv = $this->substr($data, 0, $ivSize);
2643
+		$key=$this->substr(md5($this->getEncryptionKey()), 0, mcrypt_enc_get_key_size($module));
2644
+		$ivSize=mcrypt_enc_get_iv_size($module);
2645
+		$iv=$this->substr($data, 0, $ivSize);
2646 2646
 		mcrypt_generic_init($module, $key, $iv);
2647
-		$decrypted = mdecrypt_generic($module, $this->substr($data, $ivSize, $this->strlen($data)));
2647
+		$decrypted=mdecrypt_generic($module, $this->substr($data, $ivSize, $this->strlen($data)));
2648 2648
 		mcrypt_generic_deinit($module);
2649 2649
 		mcrypt_module_close($module);
2650 2650
 		return $decrypted;
@@ -2654,9 +2654,9 @@  discard block
 block discarded – undo
2654 2654
 		if(extension_loaded('mcrypt'))
2655 2655
 		{
2656 2656
 			if(is_array($this->_cryptAlgorithm))
2657
-				$module=@call_user_func_array('mcrypt_module_open',$this->_cryptAlgorithm);
2657
+				$module=@call_user_func_array('mcrypt_module_open', $this->_cryptAlgorithm);
2658 2658
 			else
2659
-				$module=@mcrypt_module_open($this->_cryptAlgorithm,'', MCRYPT_MODE_CBC,'');
2659
+				$module=@mcrypt_module_open($this->_cryptAlgorithm, '', MCRYPT_MODE_CBC, '');
2660 2660
 			if($module===false)
2661 2661
 				throw new TNotSupportedException('securitymanager_mcryptextension_initfailed');
2662 2662
 			return $module;
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
 	}
2667 2667
 	public function hashData($data)
2668 2668
 	{
2669
-		$hmac = $this->computeHMAC($data);
2669
+		$hmac=$this->computeHMAC($data);
2670 2670
 		return $hmac.$data;
2671 2671
 	}
2672 2672
 	public function validateData($data)
@@ -2674,56 +2674,56 @@  discard block
 block discarded – undo
2674 2674
 		$len=$this->strlen($this->computeHMAC('test'));
2675 2675
 		if($this->strlen($data) < $len)
2676 2676
 			return false;
2677
-		$hmac = $this->substr($data, 0, $len);
2677
+		$hmac=$this->substr($data, 0, $len);
2678 2678
 		$data2=$this->substr($data, $len, $this->strlen($data));
2679
-		return $hmac === $this->computeHMAC($data2) ? $data2 : false;
2679
+		return $hmac===$this->computeHMAC($data2) ? $data2 : false;
2680 2680
 	}
2681 2681
 	protected function computeHMAC($data)
2682 2682
 	{
2683
-		$key = $this->getValidationKey();
2683
+		$key=$this->getValidationKey();
2684 2684
 		if(function_exists('hash_hmac'))
2685 2685
 			return hash_hmac($this->_hashAlgorithm, $data, $key);
2686
-		if(!strcasecmp($this->_hashAlgorithm,'sha1'))
2686
+		if(!strcasecmp($this->_hashAlgorithm, 'sha1'))
2687 2687
 		{
2688
-			$pack = 'H40';
2689
-			$func = 'sha1';
2688
+			$pack='H40';
2689
+			$func='sha1';
2690 2690
 		} else {
2691
-			$pack = 'H32';
2692
-			$func = 'md5';
2691
+			$pack='H32';
2692
+			$func='md5';
2693 2693
 		}
2694
-		$key = str_pad($func($key), 64, chr(0));
2695
-		return $func((str_repeat(chr(0x5C), 64) ^ substr($key, 0, 64)) . pack($pack, $func((str_repeat(chr(0x36), 64) ^ substr($key, 0, 64)) . $data)));
2694
+		$key=str_pad($func($key), 64, chr(0));
2695
+		return $func((str_repeat(chr(0x5C), 64) ^ substr($key, 0, 64)).pack($pack, $func((str_repeat(chr(0x36), 64) ^ substr($key, 0, 64)).$data)));
2696 2696
 	}
2697 2697
 	private function strlen($string)
2698 2698
 	{
2699
-		return $this->_mbstring ? mb_strlen($string,'8bit') : strlen($string);
2699
+		return $this->_mbstring ? mb_strlen($string, '8bit') : strlen($string);
2700 2700
 	}
2701
-	private function substr($string,$start,$length)
2701
+	private function substr($string, $start, $length)
2702 2702
 	{
2703
-		return $this->_mbstring ? mb_substr($string,$start,$length,'8bit') : substr($string,$start,$length);
2703
+		return $this->_mbstring ? mb_substr($string, $start, $length, '8bit') : substr($string, $start, $length);
2704 2704
 	}
2705 2705
 }
2706 2706
 class TSecurityManagerValidationMode extends TEnumerable
2707 2707
 {
2708
-	const MD5 = 'MD5';
2709
-	const SHA1 = 'SHA1';
2708
+	const MD5='MD5';
2709
+	const SHA1='SHA1';
2710 2710
 }
2711 2711
 class THttpUtility
2712 2712
 {
2713
-	private static $_encodeTable=array('<'=>'&lt;','>'=>'&gt;','"'=>'&quot;');
2714
-	private static $_decodeTable=array('&lt;'=>'<','&gt;'=>'>','&quot;'=>'"');
2715
-	private static $_stripTable=array('&lt;'=>'','&gt;'=>'','&quot;'=>'');
2713
+	private static $_encodeTable=array('<'=>'&lt;', '>'=>'&gt;', '"'=>'&quot;');
2714
+	private static $_decodeTable=array('&lt;'=>'<', '&gt;'=>'>', '&quot;'=>'"');
2715
+	private static $_stripTable=array('&lt;'=>'', '&gt;'=>'', '&quot;'=>'');
2716 2716
 	public static function htmlEncode($s)
2717 2717
 	{
2718
-		return strtr($s,self::$_encodeTable);
2718
+		return strtr($s, self::$_encodeTable);
2719 2719
 	}
2720 2720
 	public static function htmlDecode($s)
2721 2721
 	{
2722
-		return strtr($s,self::$_decodeTable);
2722
+		return strtr($s, self::$_decodeTable);
2723 2723
 	}
2724 2724
 	public static function htmlStrip($s)
2725 2725
 	{
2726
-		return strtr($s,self::$_stripTable);
2726
+		return strtr($s, self::$_stripTable);
2727 2727
 	}
2728 2728
 }
2729 2729
 class TJavaScript
@@ -2732,7 +2732,7 @@  discard block
 block discarded – undo
2732 2732
 	{
2733 2733
 		$str='';
2734 2734
 		foreach($files as $file)
2735
-			$str.= self::renderScriptFile($file);
2735
+			$str.=self::renderScriptFile($file);
2736 2736
 		return $str;
2737 2737
 	}
2738 2738
 	public static function renderScriptFile($file)
@@ -2742,14 +2742,14 @@  discard block
 block discarded – undo
2742 2742
 	public static function renderScriptBlocks($scripts)
2743 2743
 	{
2744 2744
 		if(count($scripts))
2745
-			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n",$scripts)."\n/*]]>*/\n</script>\n";
2745
+			return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n", $scripts)."\n/*]]>*/\n</script>\n";
2746 2746
 		else
2747 2747
 			return '';
2748 2748
 	}
2749 2749
 	public static function renderScriptBlocksCallback($scripts)
2750 2750
 	{
2751 2751
 		if(count($scripts))
2752
-			return implode("\n",$scripts)."\n";
2752
+			return implode("\n", $scripts)."\n";
2753 2753
 		else
2754 2754
 			return '';
2755 2755
 	}
@@ -2759,7 +2759,7 @@  discard block
 block discarded – undo
2759 2759
 	}
2760 2760
 	public static function quoteString($js)
2761 2761
 	{
2762
-		return self::jsonEncode($js,JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG);
2762
+		return self::jsonEncode($js, JSON_HEX_QUOT | JSON_HEX_APOS | JSON_HEX_TAG);
2763 2763
 	}
2764 2764
 	public static function quoteJsLiteral($js)
2765 2765
 	{
@@ -2780,16 +2780,16 @@  discard block
 block discarded – undo
2780 2780
 	{
2781 2781
 		return self::isJsLiteral($js);
2782 2782
 	}
2783
-	public static function encode($value,$toMap=true,$encodeEmptyStrings=false)
2783
+	public static function encode($value, $toMap=true, $encodeEmptyStrings=false)
2784 2784
 	{
2785 2785
 		if(is_string($value))
2786 2786
 			return self::quoteString($value);
2787 2787
 		else if(is_bool($value))
2788
-			return $value?'true':'false';
2788
+			return $value ? 'true' : 'false';
2789 2789
 		else if(is_array($value))
2790 2790
 		{
2791 2791
 			$results='';
2792
-			if(($n=count($value))>0 && array_keys($value)!==range(0,$n-1))
2792
+			if(($n=count($value)) > 0 && array_keys($value)!==range(0, $n - 1))
2793 2793
 			{
2794 2794
 				foreach($value as $k=>$v)
2795 2795
 				{
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
 					{
2798 2798
 						if($results!=='')
2799 2799
 							$results.=',';
2800
-						$results.="'$k':".self::encode($v,$toMap,$encodeEmptyStrings);
2800
+						$results.="'$k':".self::encode($v, $toMap, $encodeEmptyStrings);
2801 2801
 					}
2802 2802
 				}
2803 2803
 				return '{'.$results.'}';
@@ -2810,7 +2810,7 @@  discard block
 block discarded – undo
2810 2810
 					{
2811 2811
 						if($results!=='')
2812 2812
 							$results.=',';
2813
-						$results.=self::encode($v,$toMap, $encodeEmptyStrings);
2813
+						$results.=self::encode($v, $toMap, $encodeEmptyStrings);
2814 2814
 					}
2815 2815
 				}
2816 2816
 				return '['.$results.']';
@@ -2838,64 +2838,64 @@  discard block
 block discarded – undo
2838 2838
 			}
2839 2839
 		}
2840 2840
 		else if(is_object($value))
2841
-			if ($value instanceof TJavaScriptLiteral)
2841
+			if($value instanceof TJavaScriptLiteral)
2842 2842
 				return $value->toJavaScriptLiteral();
2843 2843
 			else
2844
-				return self::encode(get_object_vars($value),$toMap);
2844
+				return self::encode(get_object_vars($value), $toMap);
2845 2845
 		else if($value===null)
2846 2846
 			return 'null';
2847 2847
 		else
2848 2848
 			return '';
2849 2849
 	}
2850
-	public static function jsonEncode($value, $options = 0)
2850
+	public static function jsonEncode($value, $options=0)
2851 2851
 	{
2852
-		if (($g=Prado::getApplication()->getGlobalization(false))!==null &&
2852
+		if(($g=Prado::getApplication()->getGlobalization(false))!==null &&
2853 2853
 			strtoupper($enc=$g->getCharset())!='UTF-8') {
2854 2854
 			self::convertToUtf8($value, $enc);
2855 2855
 		}
2856
-		$s = @json_encode($value,$options);
2856
+		$s=@json_encode($value, $options);
2857 2857
 		self::checkJsonError();
2858 2858
 		return $s;
2859 2859
 	}
2860 2860
 	private static function convertToUtf8(&$value, $sourceEncoding) {
2861 2861
 		if(is_string($value))
2862 2862
 			$value=iconv($sourceEncoding, 'UTF-8', $value);
2863
-		else if (is_array($value))
2863
+		else if(is_array($value))
2864 2864
 		{
2865 2865
 			foreach($value as &$element)
2866 2866
 				self::convertToUtf8($element, $sourceEncoding);
2867 2867
 		}
2868 2868
 	}
2869
-	public static function jsonDecode($value, $assoc = false, $depth = 512)
2869
+	public static function jsonDecode($value, $assoc=false, $depth=512)
2870 2870
 	{
2871
-		$s= @json_decode($value, $assoc, $depth);
2871
+		$s=@json_decode($value, $assoc, $depth);
2872 2872
 		self::checkJsonError();
2873 2873
 		return $s;
2874 2874
 	}
2875 2875
 	private static function checkJsonError()
2876 2876
 	{
2877
-		switch ($err = json_last_error())
2877
+		switch($err=json_last_error())
2878 2878
 		{
2879 2879
 			case JSON_ERROR_NONE:
2880 2880
 				return;
2881 2881
 				break;
2882 2882
 			case JSON_ERROR_DEPTH:
2883
-				$msg = 'Maximum stack depth exceeded';
2883
+				$msg='Maximum stack depth exceeded';
2884 2884
 				break;
2885 2885
 			case JSON_ERROR_STATE_MISMATCH:
2886
-				$msg = 'Underflow or the modes mismatch';
2886
+				$msg='Underflow or the modes mismatch';
2887 2887
 				break;
2888 2888
 			case JSON_ERROR_CTRL_CHAR:
2889
-				$msg = 'Unexpected control character found';
2889
+				$msg='Unexpected control character found';
2890 2890
 				break;
2891 2891
 			case JSON_ERROR_SYNTAX:
2892
-				$msg = 'Syntax error, malformed JSON';
2892
+				$msg='Syntax error, malformed JSON';
2893 2893
 				break;
2894 2894
 			case JSON_ERROR_UTF8:
2895
-				$msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
2895
+				$msg='Malformed UTF-8 characters, possibly incorrectly encoded';
2896 2896
 				break;
2897 2897
 			default:
2898
-				$msg = 'Unknown error';
2898
+				$msg='Unknown error';
2899 2899
 				break;
2900 2900
 		}
2901 2901
 		throw new Exception("JSON error ($err): $msg");
@@ -2908,10 +2908,10 @@  discard block
 block discarded – undo
2908 2908
 }
2909 2909
 class TUrlManager extends TModule
2910 2910
 {
2911
-	public function constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems)
2911
+	public function constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems)
2912 2912
 	{
2913 2913
 		$url=$serviceID.'='.urlencode($serviceParam);
2914
-		$amp=$encodeAmpersand?'&amp;':'&';
2914
+		$amp=$encodeAmpersand ? '&amp;' : '&';
2915 2915
 		$request=$this->getRequest();
2916 2916
 		if(is_array($getItems) || $getItems instanceof Traversable)
2917 2917
 		{
@@ -2946,9 +2946,9 @@  discard block
 block discarded – undo
2946 2946
 		switch($request->getUrlFormat())
2947 2947
 		{
2948 2948
 			case THttpRequestUrlFormat::Path:
2949
-				return $request->getApplicationUrl().'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator()));
2949
+				return $request->getApplicationUrl().'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator()));
2950 2950
 			case THttpRequestUrlFormat::HiddenPath:
2951
-				return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator()));
2951
+				return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url, array($amp=>'/', '?'=>'/', '='=>$request->getUrlParamSeparator()));
2952 2952
 			default:
2953 2953
 				return $request->getApplicationUrl().'?'.$url;
2954 2954
 		}
@@ -2956,24 +2956,24 @@  discard block
 block discarded – undo
2956 2956
 	public function parseUrl()
2957 2957
 	{
2958 2958
 		$request=$this->getRequest();
2959
-		$pathInfo=trim($request->getPathInfo(),'/');
2959
+		$pathInfo=trim($request->getPathInfo(), '/');
2960 2960
 		if(($request->getUrlFormat()===THttpRequestUrlFormat::Path ||
2961 2961
 			$request->getUrlFormat()===THttpRequestUrlFormat::HiddenPath) &&
2962 2962
 			$pathInfo!=='')
2963 2963
 		{
2964 2964
 			$separator=$request->getUrlParamSeparator();
2965
-			$paths=explode('/',$pathInfo);
2965
+			$paths=explode('/', $pathInfo);
2966 2966
 			$getVariables=array();
2967 2967
 			foreach($paths as $path)
2968 2968
 			{
2969 2969
 				if(($path=trim($path))!=='')
2970 2970
 				{
2971
-					if(($pos=strpos($path,$separator))!==false)
2971
+					if(($pos=strpos($path, $separator))!==false)
2972 2972
 					{
2973
-						$name=substr($path,0,$pos);
2974
-						$value=substr($path,$pos+1);
2975
-						if(($pos=strpos($name,'[]'))!==false)
2976
-							$getVariables[substr($name,0,$pos)][]=$value;
2973
+						$name=substr($path, 0, $pos);
2974
+						$value=substr($path, $pos + 1);
2975
+						if(($pos=strpos($name, '[]'))!==false)
2976
+							$getVariables[substr($name, 0, $pos)][]=$value;
2977 2977
 						else
2978 2978
 							$getVariables[$name]=$value;
2979 2979
 					}
@@ -2987,10 +2987,10 @@  discard block
 block discarded – undo
2987 2987
 			return array();
2988 2988
 	}
2989 2989
 }
2990
-class THttpRequest extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule
2990
+class THttpRequest extends TApplicationComponent implements IteratorAggregate, ArrayAccess, Countable, IModule
2991 2991
 {
2992
-	const CGIFIX__PATH_INFO		= 1;
2993
-	const CGIFIX__SCRIPT_NAME	= 2;
2992
+	const CGIFIX__PATH_INFO=1;
2993
+	const CGIFIX__SCRIPT_NAME=2;
2994 2994
 	private $_urlManager=null;
2995 2995
 	private $_urlManagerID='';
2996 2996
 	private $_separator=',';
@@ -3029,13 +3029,13 @@  discard block
 block discarded – undo
3029 3029
 		}
3030 3030
 														if(isset($_SERVER['REQUEST_URI']))
3031 3031
 			$this->_requestUri=$_SERVER['REQUEST_URI'];
3032
-		else  			$this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING'])?'':'?'.$_SERVER['QUERY_STRING']);
3033
-		if($this->_cgiFix&self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO']))
3032
+		else  			$this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING']) ? '' : '?'.$_SERVER['QUERY_STRING']);
3033
+		if($this->_cgiFix & self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO']))
3034 3034
 			$this->_pathInfo=substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME']));
3035 3035
 		elseif(isset($_SERVER['PATH_INFO']))
3036 3036
 			$this->_pathInfo=$_SERVER['PATH_INFO'];
3037
-		else if(strpos($_SERVER['PHP_SELF'],$_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME'])
3038
-			$this->_pathInfo=substr($_SERVER['PHP_SELF'],strlen($_SERVER['SCRIPT_NAME']));
3037
+		else if(strpos($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME'])
3038
+			$this->_pathInfo=substr($_SERVER['PHP_SELF'], strlen($_SERVER['SCRIPT_NAME']));
3039 3039
 		else
3040 3040
 			$this->_pathInfo='';
3041 3041
 		if(get_magic_quotes_gpc())
@@ -3053,14 +3053,14 @@  discard block
 block discarded – undo
3053 3053
 	}
3054 3054
 	public function stripSlashes(&$data)
3055 3055
 	{
3056
-		return is_array($data)?array_map(array($this,'stripSlashes'),$data):stripslashes($data);
3056
+		return is_array($data) ? array_map(array($this, 'stripSlashes'), $data) : stripslashes($data);
3057 3057
 	}
3058 3058
 	public function getUrl()
3059 3059
 	{
3060 3060
 		if($this->_url===null)
3061 3061
 		{
3062 3062
 			$secure=$this->getIsSecureConnection();
3063
-			$url=$secure?'https://':'http://';
3063
+			$url=$secure ? 'https://' : 'http://';
3064 3064
 			if(empty($_SERVER['HTTP_HOST']))
3065 3065
 			{
3066 3066
 				$url.=$_SERVER['SERVER_NAME'];
@@ -3077,7 +3077,7 @@  discard block
 block discarded – undo
3077 3077
 	}
3078 3078
 	public function setEnableCache($value)
3079 3079
 	{
3080
-		$this->_enableCache = TPropertyValue::ensureBoolean($value);
3080
+		$this->_enableCache=TPropertyValue::ensureBoolean($value);
3081 3081
 	}
3082 3082
 	public function getEnableCache()
3083 3083
 	{
@@ -3091,15 +3091,15 @@  discard block
 block discarded – undo
3091 3091
 	{
3092 3092
 		if($this->getEnableCache())
3093 3093
 		{
3094
-			$cache = $this->getApplication()->getCache();
3095
-			if($cache !== null)
3094
+			$cache=$this->getApplication()->getCache();
3095
+			if($cache!==null)
3096 3096
 			{
3097
-				$dependencies = null;
3098
-				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
3099
-					if ($manager instanceof TUrlMapping && $fn = $manager->getConfigFile())
3097
+				$dependencies=null;
3098
+				if($this->getApplication()->getMode()!==TApplicationMode::Performance)
3099
+					if($manager instanceof TUrlMapping && $fn=$manager->getConfigFile())
3100 3100
 					{
3101
-						$fn = Prado::getPathOfNamespace($fn,$this->getApplication()->getConfigurationFileExt());
3102
-						$dependencies = new TFileCacheDependency($fn);
3101
+						$fn=Prado::getPathOfNamespace($fn, $this->getApplication()->getConfigurationFileExt());
3102
+						$dependencies=new TFileCacheDependency($fn);
3103 3103
 					}
3104 3104
 				return $cache->set($this->getCacheKey(), $manager, 0, $dependencies);
3105 3105
 			}
@@ -3110,10 +3110,10 @@  discard block
 block discarded – undo
3110 3110
 	{
3111 3111
 		if($this->getEnableCache())
3112 3112
 		{
3113
-			$cache = $this->getApplication()->getCache();
3114
-			if($cache !== null)
3113
+			$cache=$this->getApplication()->getCache();
3114
+			if($cache!==null)
3115 3115
 			{
3116
-				$manager = $cache->get($this->getCacheKey());
3116
+				$manager=$cache->get($this->getCacheKey());
3117 3117
 				if($manager instanceof TUrlManager)
3118 3118
 					return $manager;
3119 3119
 			}
@@ -3132,7 +3132,7 @@  discard block
 block discarded – undo
3132 3132
 	{
3133 3133
 		if($this->_urlManager===null)
3134 3134
 		{
3135
-			if(($this->_urlManager = $this->loadCachedUrlManager())===null)
3135
+			if(($this->_urlManager=$this->loadCachedUrlManager())===null)
3136 3136
 			{
3137 3137
 				if(empty($this->_urlManagerID))
3138 3138
 				{
@@ -3143,9 +3143,9 @@  discard block
 block discarded – undo
3143 3143
 				{
3144 3144
 					$this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID);
3145 3145
 					if($this->_urlManager===null)
3146
-						throw new TConfigurationException('httprequest_urlmanager_inexist',$this->_urlManagerID);
3146
+						throw new TConfigurationException('httprequest_urlmanager_inexist', $this->_urlManagerID);
3147 3147
 					if(!($this->_urlManager instanceof TUrlManager))
3148
-						throw new TConfigurationException('httprequest_urlmanager_invalid',$this->_urlManagerID);
3148
+						throw new TConfigurationException('httprequest_urlmanager_invalid', $this->_urlManagerID);
3149 3149
 				}
3150 3150
 				$this->cacheUrlManager($this->_urlManager);
3151 3151
 			}
@@ -3158,7 +3158,7 @@  discard block
 block discarded – undo
3158 3158
 	}
3159 3159
 	public function setUrlFormat($value)
3160 3160
 	{
3161
-		$this->_urlFormat=TPropertyValue::ensureEnum($value,'THttpRequestUrlFormat');
3161
+		$this->_urlFormat=TPropertyValue::ensureEnum($value, 'THttpRequestUrlFormat');
3162 3162
 	}
3163 3163
 	public function getUrlParamSeparator()
3164 3164
 	{
@@ -3173,19 +3173,19 @@  discard block
 block discarded – undo
3173 3173
 	}
3174 3174
 	public function getRequestType()
3175 3175
 	{
3176
-		return isset($_SERVER['REQUEST_METHOD'])?$_SERVER['REQUEST_METHOD']:null;
3176
+		return isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
3177 3177
 	}
3178
-	public function getContentType($mimetypeOnly = true)
3178
+	public function getContentType($mimetypeOnly=true)
3179 3179
 	{
3180 3180
 		if(!isset($_SERVER['CONTENT_TYPE']))
3181 3181
 			return null;
3182
-		if($mimetypeOnly === true && ($_pos = strpos(';', $_SERVER['CONTENT_TYPE'])) !== false)
3182
+		if($mimetypeOnly===true && ($_pos=strpos(';', $_SERVER['CONTENT_TYPE']))!==false)
3183 3183
 			return substr($_SERVER['CONTENT_TYPE'], 0, $_pos);
3184 3184
 		return $_SERVER['CONTENT_TYPE'];
3185 3185
 	}
3186 3186
 	public function getIsSecureConnection()
3187 3187
 	{
3188
-			return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'],'off');
3188
+			return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'off');
3189 3189
 	}
3190 3190
 	public function getPathInfo()
3191 3191
 	{
@@ -3193,27 +3193,27 @@  discard block
 block discarded – undo
3193 3193
 	}
3194 3194
 	public function getQueryString()
3195 3195
 	{
3196
-		return isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:null;
3196
+		return isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null;
3197 3197
 	}
3198 3198
 	public function getHttpProtocolVersion()
3199 3199
 	{
3200
-		return isset($_SERVER['SERVER_PROTOCOL'])?$_SERVER['SERVER_PROTOCOL']:null;
3200
+		return isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : null;
3201 3201
 	}
3202 3202
 	public function getHeaders($case=null)
3203 3203
 	{
3204 3204
 		static $result;
3205
-		if($result === null && function_exists('apache_request_headers')) {
3206
-			$result = apache_request_headers();
3205
+		if($result===null && function_exists('apache_request_headers')) {
3206
+			$result=apache_request_headers();
3207 3207
 		}
3208
-		elseif($result === null) {
3209
-			$result = array();
3208
+		elseif($result===null) {
3209
+			$result=array();
3210 3210
 			foreach($_SERVER as $key=>$value) {
3211
-				if(strncasecmp($key, 'HTTP_', 5) !== 0) continue;
3212
-					$key = str_replace(' ','-', ucwords(strtolower(str_replace('_',' ', substr($key, 5)))));
3213
-					$result[$key] = $value;
3211
+				if(strncasecmp($key, 'HTTP_', 5)!==0) continue;
3212
+					$key=str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
3213
+					$result[$key]=$value;
3214 3214
 			}
3215 3215
 		}
3216
-		if($case !== null)
3216
+		if($case!==null)
3217 3217
 			return array_change_key_case($result, $case);
3218 3218
 		return $result;
3219 3219
 	}
@@ -3224,36 +3224,36 @@  discard block
 block discarded – undo
3224 3224
 	public function getBaseUrl($forceSecureConnection=null)
3225 3225
 	{
3226 3226
 		$url=$this->getUrl();
3227
-		$scheme=($forceSecureConnection)?"https": (($forceSecureConnection === null)?$url->getScheme():'http');
3227
+		$scheme=($forceSecureConnection) ? "https" : (($forceSecureConnection===null) ? $url->getScheme() : 'http');
3228 3228
 		$host=$url->getHost();
3229
-		if (($port=$url->getPort())) $host.=':'.$port;
3229
+		if(($port=$url->getPort())) $host.=':'.$port;
3230 3230
 		return $scheme.'://'.$host;
3231 3231
 	}
3232 3232
 	public function getApplicationUrl()
3233 3233
 	{
3234
-		if($this->_cgiFix&self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
3234
+		if($this->_cgiFix & self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
3235 3235
 			return $_SERVER['ORIG_SCRIPT_NAME'];
3236
-		return isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:null;
3236
+		return isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : null;
3237 3237
 	}
3238 3238
 	public function getAbsoluteApplicationUrl($forceSecureConnection=null)
3239 3239
 	{
3240
-		return $this->getBaseUrl($forceSecureConnection) . $this->getApplicationUrl();
3240
+		return $this->getBaseUrl($forceSecureConnection).$this->getApplicationUrl();
3241 3241
 	}
3242 3242
 	public function getApplicationFilePath()
3243 3243
 	{
3244
-		return realpath(isset($_SERVER['SCRIPT_FILENAME'])?$_SERVER['SCRIPT_FILENAME']:null);
3244
+		return realpath(isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : null);
3245 3245
 	}
3246 3246
 	public function getServerName()
3247 3247
 	{
3248
-		return isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:null;
3248
+		return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null;
3249 3249
 	}
3250 3250
 	public function getServerPort()
3251 3251
 	{
3252
-		return isset($_SERVER['SERVER_PORT'])?$_SERVER['SERVER_PORT']:null;
3252
+		return isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : null;
3253 3253
 	}
3254 3254
 	public function getUrlReferrer()
3255 3255
 	{
3256
-		return isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:null;
3256
+		return isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
3257 3257
 	}
3258 3258
 	public function getBrowser()
3259 3259
 	{
@@ -3268,19 +3268,19 @@  discard block
 block discarded – undo
3268 3268
 	}
3269 3269
 	public function getUserAgent()
3270 3270
 	{
3271
-		return isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:null;
3271
+		return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
3272 3272
 	}
3273 3273
 	public function getUserHostAddress()
3274 3274
 	{
3275
-		return isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:null;
3275
+		return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
3276 3276
 	}
3277 3277
 	public function getUserHost()
3278 3278
 	{
3279
-		return isset($_SERVER['REMOTE_HOST'])?$_SERVER['REMOTE_HOST']:null;
3279
+		return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : null;
3280 3280
 	}
3281 3281
 	public function getAcceptTypes()
3282 3282
 	{
3283
-				return isset($_SERVER['HTTP_ACCEPT'])?$_SERVER['HTTP_ACCEPT']:null;
3283
+				return isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
3284 3284
 	}
3285 3285
 	public function getUserLanguages()
3286 3286
 	{
@@ -3313,13 +3313,13 @@  discard block
 block discarded – undo
3313 3313
 				foreach($_COOKIE as $key=>$value)
3314 3314
 				{
3315 3315
 					if(($value=$sm->validateData($value))!==false)
3316
-						$this->_cookies->add(new THttpCookie($key,$value));
3316
+						$this->_cookies->add(new THttpCookie($key, $value));
3317 3317
 				}
3318 3318
 			}
3319 3319
 			else
3320 3320
 			{
3321 3321
 				foreach($_COOKIE as $key=>$value)
3322
-					$this->_cookies->add(new THttpCookie($key,$value));
3322
+					$this->_cookies->add(new THttpCookie($key, $value));
3323 3323
 			}
3324 3324
 		}
3325 3325
 		return $this->_cookies;
@@ -3336,13 +3336,13 @@  discard block
 block discarded – undo
3336 3336
 	{
3337 3337
 		return $_ENV;
3338 3338
 	}
3339
-	public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=true,$encodeGetItems=true)
3339
+	public function constructUrl($serviceID, $serviceParam, $getItems=null, $encodeAmpersand=true, $encodeGetItems=true)
3340 3340
 	{
3341
-		if ($this->_cookieOnly===null)
3342
-				$this->_cookieOnly=(int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies');
3343
-		$url=$this->getUrlManagerModule()->constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems);
3344
-		if(defined('SID') && SID != '' && !$this->_cookieOnly)
3345
-			return $url . (strpos($url,'?')===false? '?' : ($encodeAmpersand?'&amp;':'&')) . SID;
3341
+		if($this->_cookieOnly===null)
3342
+				$this->_cookieOnly=(int) ini_get('session.use_cookies') && (int) ini_get('session.use_only_cookies');
3343
+		$url=$this->getUrlManagerModule()->constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems);
3344
+		if(defined('SID') && SID!='' && !$this->_cookieOnly)
3345
+			return $url.(strpos($url, '?')===false ? '?' : ($encodeAmpersand ? '&amp;' : '&')).SID;
3346 3346
 		else
3347 3347
 			return $url;
3348 3348
 	}
@@ -3355,7 +3355,7 @@  discard block
 block discarded – undo
3355 3355
 		$getParams=$this->parseUrl();
3356 3356
 		foreach($getParams as $name=>$value)
3357 3357
 			$_GET[$name]=$value;
3358
-		$this->_items=array_merge($_GET,$_POST);
3358
+		$this->_items=array_merge($_GET, $_POST);
3359 3359
 		$this->_requestResolved=true;
3360 3360
 		foreach($serviceIDs as $serviceID)
3361 3361
 		{
@@ -3408,13 +3408,13 @@  discard block
 block discarded – undo
3408 3408
 	{
3409 3409
 		return isset($this->_items[$key]) ? $this->_items[$key] : null;
3410 3410
 	}
3411
-	public function add($key,$value)
3411
+	public function add($key, $value)
3412 3412
 	{
3413 3413
 		$this->_items[$key]=$value;
3414 3414
 	}
3415 3415
 	public function remove($key)
3416 3416
 	{
3417
-		if(isset($this->_items[$key]) || array_key_exists($key,$this->_items))
3417
+		if(isset($this->_items[$key]) || array_key_exists($key, $this->_items))
3418 3418
 		{
3419 3419
 			$value=$this->_items[$key];
3420 3420
 			unset($this->_items[$key]);
@@ -3430,7 +3430,7 @@  discard block
 block discarded – undo
3430 3430
 	}
3431 3431
 	public function contains($key)
3432 3432
 	{
3433
-		return isset($this->_items[$key]) || array_key_exists($key,$this->_items);
3433
+		return isset($this->_items[$key]) || array_key_exists($key, $this->_items);
3434 3434
 	}
3435 3435
 	public function toArray()
3436 3436
 	{
@@ -3444,9 +3444,9 @@  discard block
 block discarded – undo
3444 3444
 	{
3445 3445
 		return $this->itemAt($offset);
3446 3446
 	}
3447
-	public function offsetSet($offset,$item)
3447
+	public function offsetSet($offset, $item)
3448 3448
 	{
3449
-		$this->add($offset,$item);
3449
+		$this->add($offset, $item);
3450 3450
 	}
3451 3451
 	public function offsetUnset($offset)
3452 3452
 	{
@@ -3460,11 +3460,11 @@  discard block
 block discarded – undo
3460 3460
 	{
3461 3461
 		$this->_o=$owner;
3462 3462
 	}
3463
-	public function insertAt($index,$item)
3463
+	public function insertAt($index, $item)
3464 3464
 	{
3465 3465
 		if($item instanceof THttpCookie)
3466 3466
 		{
3467
-			parent::insertAt($index,$item);
3467
+			parent::insertAt($index, $item);
3468 3468
 			if($this->_o instanceof THttpResponse)
3469 3469
 				$this->_o->addCookie($item);
3470 3470
 		}
@@ -3502,7 +3502,7 @@  discard block
 block discarded – undo
3502 3502
 	private $_path='/';
3503 3503
 	private $_secure=false;
3504 3504
 	private $_httpOnly=false;
3505
-	public function __construct($name,$value)
3505
+	public function __construct($name, $value)
3506 3506
 	{
3507 3507
 		$this->_name=$name;
3508 3508
 		$this->_value=$value;
@@ -3529,7 +3529,7 @@  discard block
 block discarded – undo
3529 3529
 	}
3530 3530
 	public function setHttpOnly($value)
3531 3531
 	{
3532
-		$this->_httpOnly = TPropertyValue::ensureBoolean($value);
3532
+		$this->_httpOnly=TPropertyValue::ensureBoolean($value);
3533 3533
 	}
3534 3534
 	public function getName()
3535 3535
 	{
@@ -3589,19 +3589,19 @@  discard block
 block discarded – undo
3589 3589
 	{
3590 3590
 		if(($ret=@parse_url($uri))!==false)
3591 3591
 		{
3592
-						$this->_scheme=isset($ret['scheme'])?$ret['scheme']:'';
3593
-			$this->_host=isset($ret['host'])?$ret['host']:'';
3594
-			$this->_port=isset($ret['port'])?$ret['port']:'';
3595
-			$this->_user=isset($ret['user'])?$ret['user']:'';
3596
-			$this->_pass=isset($ret['pass'])?$ret['pass']:'';
3597
-			$this->_path=isset($ret['path'])?$ret['path']:'';
3598
-			$this->_query=isset($ret['query'])?$ret['query']:'';
3599
-			$this->_fragment=isset($ret['fragment'])?$ret['fragment']:'';
3592
+						$this->_scheme=isset($ret['scheme']) ? $ret['scheme'] : '';
3593
+			$this->_host=isset($ret['host']) ? $ret['host'] : '';
3594
+			$this->_port=isset($ret['port']) ? $ret['port'] : '';
3595
+			$this->_user=isset($ret['user']) ? $ret['user'] : '';
3596
+			$this->_pass=isset($ret['pass']) ? $ret['pass'] : '';
3597
+			$this->_path=isset($ret['path']) ? $ret['path'] : '';
3598
+			$this->_query=isset($ret['query']) ? $ret['query'] : '';
3599
+			$this->_fragment=isset($ret['fragment']) ? $ret['fragment'] : '';
3600 3600
 			$this->_uri=$uri;
3601 3601
 		}
3602 3602
 		else
3603 3603
 		{
3604
-			throw new TInvalidDataValueException('uri_format_invalid',$uri);
3604
+			throw new TInvalidDataValueException('uri_format_invalid', $uri);
3605 3605
 		}
3606 3606
 	}
3607 3607
 	public function getUri()
@@ -3668,14 +3668,14 @@  discard block
 block discarded – undo
3668 3668
 	}
3669 3669
 	public function createNewHtmlWriter($type, $writer)
3670 3670
 	{
3671
-		return $this->_response->createNewHtmlWriter($type,$writer);
3671
+		return $this->_response->createNewHtmlWriter($type, $writer);
3672 3672
 	}
3673 3673
 }
3674 3674
 class THttpResponse extends TModule implements ITextWriter
3675 3675
 {
3676
-	const DEFAULT_CONTENTTYPE	= 'text/html';
3677
-	const DEFAULT_CHARSET		= 'UTF-8';
3678
-	private static $HTTP_STATUS_CODES = array(
3676
+	const DEFAULT_CONTENTTYPE='text/html';
3677
+	const DEFAULT_CHARSET='UTF-8';
3678
+	private static $HTTP_STATUS_CODES=array(
3679 3679
 		100 => 'Continue', 101 => 'Switching Protocols',
3680 3680
 		200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content',
3681 3681
 		300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect',
@@ -3729,13 +3729,13 @@  discard block
 block discarded – undo
3729 3729
 	}
3730 3730
 	public function setCacheControl($value)
3731 3731
 	{
3732
-		session_cache_limiter(TPropertyValue::ensureEnum($value,array('none','nocache','private','private_no_expire','public')));
3732
+		session_cache_limiter(TPropertyValue::ensureEnum($value, array('none', 'nocache', 'private', 'private_no_expire', 'public')));
3733 3733
 	}
3734 3734
 	public function setContentType($type)
3735 3735
 	{
3736
-		if ($this->_contentTypeHeaderSent)
3736
+		if($this->_contentTypeHeaderSent)
3737 3737
 			throw new Exception('Unable to alter content-type as it has been already sent');
3738
-		$this->_contentType = $type;
3738
+		$this->_contentType=$type;
3739 3739
 	}
3740 3740
 	public function getContentType()
3741 3741
 	{
@@ -3747,7 +3747,7 @@  discard block
 block discarded – undo
3747 3747
 	}
3748 3748
 	public function setCharset($charset)
3749 3749
 	{
3750
-		$this->_charset = (strToLower($charset) === 'false') ? false : (string)$charset;
3750
+		$this->_charset=(strToLower($charset)==='false') ? false : (string) $charset;
3751 3751
 	}
3752 3752
 	public function getBufferOutput()
3753 3753
 	{
@@ -3766,12 +3766,12 @@  discard block
 block discarded – undo
3766 3766
 	}
3767 3767
 	public function setStatusCode($status, $reason=null)
3768 3768
 	{
3769
-		if ($this->_httpHeaderSent)
3769
+		if($this->_httpHeaderSent)
3770 3770
 			throw new Exception('Unable to alter response as HTTP header already sent');
3771 3771
 		$status=TPropertyValue::ensureInteger($status);
3772 3772
 		if(isset(self::$HTTP_STATUS_CODES[$status])) {
3773 3773
 			$this->_reason=self::$HTTP_STATUS_CODES[$status];
3774
-		}else{
3774
+		} else {
3775 3775
 			if($reason===null || $reason==='') {
3776 3776
 				throw new TInvalidDataValueException("response_status_reason_missing");
3777 3777
 			}
@@ -3794,11 +3794,11 @@  discard block
 block discarded – undo
3794 3794
 	}
3795 3795
 	public function write($str)
3796 3796
 	{
3797
-				if (!$this->_bufferOutput and !$this->_httpHeaderSent)
3797
+				if(!$this->_bufferOutput and !$this->_httpHeaderSent)
3798 3798
 			$this->ensureHeadersSent();
3799 3799
 		echo $str;
3800 3800
 	}
3801
-	public function writeFile($fileName,$content=null,$mimeType=null,$headers=null,$forceDownload=true,$clientFileName=null,$fileSize=null)
3801
+	public function writeFile($fileName, $content=null, $mimeType=null, $headers=null, $forceDownload=true, $clientFileName=null, $fileSize=null)
3802 3802
 	{
3803 3803
 		static $defaultMimeTypes=array(
3804 3804
 			'css'=>'text/css',
@@ -3817,9 +3817,9 @@  discard block
 block discarded – undo
3817 3817
 			$mimeType='text/plain';
3818 3818
 			if(function_exists('mime_content_type'))
3819 3819
 				$mimeType=mime_content_type($fileName);
3820
-			else if(($ext=strrchr($fileName,'.'))!==false)
3820
+			else if(($ext=strrchr($fileName, '.'))!==false)
3821 3821
 			{
3822
-				$ext=substr($ext,1);
3822
+				$ext=substr($ext, 1);
3823 3823
 				if(isset($defaultMimeTypes[$ext]))
3824 3824
 					$mimeType=$defaultMimeTypes[$ext];
3825 3825
 			}
@@ -3829,7 +3829,7 @@  discard block
 block discarded – undo
3829 3829
 		else
3830 3830
 			$clientFileName=basename($clientFileName);
3831 3831
 		if($fileSize===null || $fileSize < 0)
3832
-			$fileSize = ($content===null?filesize($fileName):strlen($content));
3832
+			$fileSize=($content===null ? filesize($fileName) : strlen($content));
3833 3833
 		$this->sendHttpHeader();
3834 3834
 		if(is_array($headers))
3835 3835
 		{
@@ -3842,10 +3842,10 @@  discard block
 block discarded – undo
3842 3842
 			header('Expires: 0');
3843 3843
 			header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
3844 3844
 			header("Content-Type: $mimeType");
3845
-			$this->_contentTypeHeaderSent = true;
3845
+			$this->_contentTypeHeaderSent=true;
3846 3846
 		}
3847 3847
 		header('Content-Length: '.$fileSize);
3848
-		header("Content-Disposition: " . ($forceDownload ? 'attachment' : 'inline') . "; filename=\"$clientFileName\"");
3848
+		header("Content-Disposition: ".($forceDownload ? 'attachment' : 'inline')."; filename=\"$clientFileName\"");
3849 3849
 		header('Content-Transfer-Encoding: binary');
3850 3850
 		if($content===null)
3851 3851
 			readfile($fileName);
@@ -3864,10 +3864,10 @@  discard block
 block discarded – undo
3864 3864
 		$this->ensureHeadersSent();
3865 3865
 		if($url[0]==='/')
3866 3866
 			$url=$this->getRequest()->getBaseUrl().$url;
3867
-		if ($this->_status >= 300 && $this->_status < 400)
3868
-						header('Location: '.str_replace('&amp;','&',$url), true, $this->_status);
3867
+		if($this->_status >= 300 && $this->_status < 400)
3868
+						header('Location: '.str_replace('&amp;', '&', $url), true, $this->_status);
3869 3869
 		else
3870
-			header('Location: '.str_replace('&amp;','&',$url));
3870
+			header('Location: '.str_replace('&amp;', '&', $url));
3871 3871
 		if(!$this->getApplication()->getRequestCompleted())
3872 3872
 			$this->getApplication()->onEndRequest();
3873 3873
 		exit();
@@ -3876,7 +3876,7 @@  discard block
 block discarded – undo
3876 3876
 	{
3877 3877
 		$this->redirect($this->getRequest()->getRequestUri());
3878 3878
 	}
3879
-	public function flush($continueBuffering = true)
3879
+	public function flush($continueBuffering=true)
3880 3880
 	{
3881 3881
 		if($this->getHasAdapter())
3882 3882
 			$this->_adapter->flushContent($continueBuffering);
@@ -3888,16 +3888,16 @@  discard block
 block discarded – undo
3888 3888
 		$this->ensureHttpHeaderSent();
3889 3889
 		$this->ensureContentTypeHeaderSent();
3890 3890
 	}
3891
-	public function flushContent($continueBuffering = true)
3891
+	public function flushContent($continueBuffering=true)
3892 3892
 	{
3893 3893
 		$this->ensureHeadersSent();
3894 3894
 		if($this->_bufferOutput)
3895 3895
 		{
3896
-						if (ob_get_length()>0)
3896
+						if(ob_get_length() > 0)
3897 3897
 			{
3898
-				if (!$continueBuffering)
3898
+				if(!$continueBuffering)
3899 3899
 				{
3900
-					$this->_bufferOutput = false;
3900
+					$this->_bufferOutput=false;
3901 3901
 					ob_end_flush();
3902 3902
 				}
3903 3903
 				else
@@ -3910,41 +3910,41 @@  discard block
 block discarded – undo
3910 3910
 	}
3911 3911
 	protected function ensureHttpHeaderSent()
3912 3912
 	{
3913
-		if (!$this->_httpHeaderSent)
3913
+		if(!$this->_httpHeaderSent)
3914 3914
 			$this->sendHttpHeader();
3915 3915
 	}
3916 3916
 	protected function sendHttpHeader()
3917 3917
 	{
3918 3918
 		$protocol=$this->getRequest()->getHttpProtocolVersion();
3919
-		if($this->getRequest()->getHttpProtocolVersion() === null)
3919
+		if($this->getRequest()->getHttpProtocolVersion()===null)
3920 3920
 			$protocol='HTTP/1.1';
3921
-		$phpSapiName = substr(php_sapi_name(), 0, 3);
3922
-		$cgi = $phpSapiName == 'cgi' || $phpSapiName == 'fpm';
3921
+		$phpSapiName=substr(php_sapi_name(), 0, 3);
3922
+		$cgi=$phpSapiName=='cgi' || $phpSapiName=='fpm';
3923 3923
 		header(($cgi ? 'Status:' : $protocol).' '.$this->_status.' '.$this->_reason, true, TPropertyValue::ensureInteger($this->_status));
3924
-		$this->_httpHeaderSent = true;
3924
+		$this->_httpHeaderSent=true;
3925 3925
 	}
3926 3926
 	protected function ensureContentTypeHeaderSent()
3927 3927
 	{
3928
-		if (!$this->_contentTypeHeaderSent)
3928
+		if(!$this->_contentTypeHeaderSent)
3929 3929
 			$this->sendContentTypeHeader();
3930 3930
 	}
3931 3931
 	protected function sendContentTypeHeader()
3932 3932
 	{
3933
-		$contentType=$this->_contentType===null?self::DEFAULT_CONTENTTYPE:$this->_contentType;
3933
+		$contentType=$this->_contentType===null ? self::DEFAULT_CONTENTTYPE : $this->_contentType;
3934 3934
 		$charset=$this->getCharset();
3935
-		if($charset === false) {
3935
+		if($charset===false) {
3936 3936
 			$this->appendHeader('Content-Type: '.$contentType);
3937 3937
 			return;
3938 3938
 		}
3939 3939
 		if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null)
3940 3940
 			$charset=$globalization->getCharset();
3941
-		if($charset==='') $charset = self::DEFAULT_CHARSET;
3941
+		if($charset==='') $charset=self::DEFAULT_CHARSET;
3942 3942
 		$this->appendHeader('Content-Type: '.$contentType.';charset='.$charset);
3943
-		$this->_contentTypeHeaderSent = true;
3943
+		$this->_contentTypeHeaderSent=true;
3944 3944
 	}
3945 3945
 	public function getContents()
3946 3946
 	{
3947
-		return $this->_bufferOutput?ob_get_contents():'';
3947
+		return $this->_bufferOutput ? ob_get_contents() : '';
3948 3948
 	}
3949 3949
 	public function clear()
3950 3950
 	{
@@ -3953,18 +3953,18 @@  discard block
 block discarded – undo
3953 3953
 	}
3954 3954
 	public function getHeaders($case=null)
3955 3955
 	{
3956
-		$result = array();
3957
-		$headers = headers_list();
3956
+		$result=array();
3957
+		$headers=headers_list();
3958 3958
 		foreach($headers as $header) {
3959
-			$tmp = explode(':', $header);
3960
-			$key = trim(array_shift($tmp));
3961
-			$value = trim(implode(':', $tmp));
3959
+			$tmp=explode(':', $header);
3960
+			$key=trim(array_shift($tmp));
3961
+			$value=trim(implode(':', $tmp));
3962 3962
 			if(isset($result[$key]))
3963
-				$result[$key] .= ', ' . $value;
3963
+				$result[$key].=', '.$value;
3964 3964
 			else
3965
-				$result[$key] = $value;
3965
+				$result[$key]=$value;
3966 3966
 		}
3967
-		if($case !== null)
3967
+		if($case!==null)
3968 3968
 			return array_change_key_case($result, $case);
3969 3969
 		return $result;
3970 3970
 	}
@@ -3972,9 +3972,9 @@  discard block
 block discarded – undo
3972 3972
 	{
3973 3973
 		header($value, $replace);
3974 3974
 	}
3975
-	public function appendLog($message,$messageType=0,$destination='',$extraHeaders='')
3975
+	public function appendLog($message, $messageType=0, $destination='', $extraHeaders='')
3976 3976
 	{
3977
-		error_log($message,$messageType,$destination,$extraHeaders);
3977
+		error_log($message, $messageType, $destination, $extraHeaders);
3978 3978
 	}
3979 3979
 	public function addCookie($cookie)
3980 3980
 	{
@@ -4038,7 +4038,7 @@  discard block
 block discarded – undo
4038 4038
 		return Prado::createComponent($type, $writer);
4039 4039
 	}
4040 4040
 }
4041
-class THttpSession extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule
4041
+class THttpSession extends TApplicationComponent implements IteratorAggregate, ArrayAccess, Countable, IModule
4042 4042
 {
4043 4043
 	private $_initialized=false;
4044 4044
 	private $_started=false;
@@ -4067,9 +4067,9 @@  discard block
 block discarded – undo
4067 4067
 		if(!$this->_started)
4068 4068
 		{
4069 4069
 			if($this->_customStorage)
4070
-				session_set_save_handler(array($this,'_open'),array($this,'_close'),array($this,'_read'),array($this,'_write'),array($this,'_destroy'),array($this,'_gc'));
4070
+				session_set_save_handler(array($this, '_open'), array($this, '_close'), array($this, '_read'), array($this, '_write'), array($this, '_destroy'), array($this, '_gc'));
4071 4071
 			if($this->_cookie!==null)
4072
-				session_set_cookie_params($this->_cookie->getExpire(),$this->_cookie->getPath(),$this->_cookie->getDomain(),$this->_cookie->getSecure(),$this->_cookie->getHttpOnly());
4072
+				session_set_cookie_params($this->_cookie->getExpire(), $this->_cookie->getPath(), $this->_cookie->getDomain(), $this->_cookie->getSecure(), $this->_cookie->getHttpOnly());
4073 4073
 			if(ini_get('session.auto_start')!=='1')
4074 4074
 				session_start();
4075 4075
 			$this->_started=true;
@@ -4093,7 +4093,7 @@  discard block
 block discarded – undo
4093 4093
 	}
4094 4094
 	public function regenerate($deleteOld=false)
4095 4095
 	{
4096
-		$old = $this->getSessionID();
4096
+		$old=$this->getSessionID();
4097 4097
 		session_regenerate_id($deleteOld);
4098 4098
 		return $old;
4099 4099
 	}
@@ -4123,7 +4123,7 @@  discard block
 block discarded – undo
4123 4123
 		else if(ctype_alnum($value))
4124 4124
 			session_name($value);
4125 4125
 		else
4126
-			throw new TInvalidDataValueException('httpsession_sessionname_invalid',$value);
4126
+			throw new TInvalidDataValueException('httpsession_sessionname_invalid', $value);
4127 4127
 	}
4128 4128
 	public function getSavePath()
4129 4129
 	{
@@ -4136,7 +4136,7 @@  discard block
 block discarded – undo
4136 4136
 		else if(is_dir($value))
4137 4137
 			session_save_path($value);
4138 4138
 		else
4139
-			throw new TInvalidDataValueException('httpsession_savepath_invalid',$value);
4139
+			throw new TInvalidDataValueException('httpsession_savepath_invalid', $value);
4140 4140
 	}
4141 4141
 	public function getUseCustomStorage()
4142 4142
 	{
@@ -4149,7 +4149,7 @@  discard block
 block discarded – undo
4149 4149
 	public function getCookie()
4150 4150
 	{
4151 4151
 		if($this->_cookie===null)
4152
-			$this->_cookie=new THttpCookie($this->getSessionName(),$this->getSessionID());
4152
+			$this->_cookie=new THttpCookie($this->getSessionName(), $this->getSessionID());
4153 4153
 		return $this->_cookie;
4154 4154
 	}
4155 4155
 	public function getCookieMode()
@@ -4167,21 +4167,21 @@  discard block
 block discarded – undo
4167 4167
 			throw new TInvalidOperationException('httpsession_cookiemode_unchangeable');
4168 4168
 		else
4169 4169
 		{
4170
-			$value=TPropertyValue::ensureEnum($value,'THttpSessionCookieMode');
4170
+			$value=TPropertyValue::ensureEnum($value, 'THttpSessionCookieMode');
4171 4171
 			if($value===THttpSessionCookieMode::None) 
4172 4172
       {
4173
-				ini_set('session.use_cookies','0');
4174
-			  ini_set('session.use_only_cookies','0');
4173
+				ini_set('session.use_cookies', '0');
4174
+			  ini_set('session.use_only_cookies', '0');
4175 4175
       }
4176 4176
 			else if($value===THttpSessionCookieMode::Allow)
4177 4177
 			{
4178
-				ini_set('session.use_cookies','1');
4179
-				ini_set('session.use_only_cookies','0');
4178
+				ini_set('session.use_cookies', '1');
4179
+				ini_set('session.use_only_cookies', '0');
4180 4180
 			}
4181 4181
 			else
4182 4182
 			{
4183
-				ini_set('session.use_cookies','1');
4184
-				ini_set('session.use_only_cookies','1');
4183
+				ini_set('session.use_cookies', '1');
4184
+				ini_set('session.use_only_cookies', '1');
4185 4185
 				ini_set('session.use_trans_sid', 0);
4186 4186
 			}
4187 4187
 		}
@@ -4208,13 +4208,13 @@  discard block
 block discarded – undo
4208 4208
 		else
4209 4209
 		{
4210 4210
 			$value=TPropertyValue::ensureInteger($value);
4211
-			if($value>=0 && $value<=100)
4211
+			if($value >= 0 && $value <= 100)
4212 4212
 			{
4213
-				ini_set('session.gc_probability',$value);
4214
-				ini_set('session.gc_divisor','100');
4213
+				ini_set('session.gc_probability', $value);
4214
+				ini_set('session.gc_divisor', '100');
4215 4215
 			}
4216 4216
 			else
4217
-				throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value);
4217
+				throw new TInvalidDataValueException('httpsession_gcprobability_invalid', $value);
4218 4218
 		}
4219 4219
 	}
4220 4220
 	public function getUseTransparentSessionID()
@@ -4228,9 +4228,9 @@  discard block
 block discarded – undo
4228 4228
 		else
4229 4229
 		{
4230 4230
 			$value=TPropertyValue::ensureBoolean($value);
4231
-			if ($value && $this->getCookieMode()==THttpSessionCookieMode::Only)
4231
+			if($value && $this->getCookieMode()==THttpSessionCookieMode::Only)
4232 4232
 					throw new TInvalidOperationException('httpsession_transid_cookieonly');
4233
-			ini_set('session.use_trans_sid',$value?'1':'0');
4233
+			ini_set('session.use_trans_sid', $value ? '1' : '0');
4234 4234
 		}
4235 4235
 	}
4236 4236
 	public function getTimeout()
@@ -4242,9 +4242,9 @@  discard block
 block discarded – undo
4242 4242
 		if($this->_started)
4243 4243
 			throw new TInvalidOperationException('httpsession_maxlifetime_unchangeable');
4244 4244
 		else
4245
-			ini_set('session.gc_maxlifetime',$value);
4245
+			ini_set('session.gc_maxlifetime', $value);
4246 4246
 	}
4247
-	public function _open($savePath,$sessionName)
4247
+	public function _open($savePath, $sessionName)
4248 4248
 	{
4249 4249
 		return true;
4250 4250
 	}
@@ -4256,7 +4256,7 @@  discard block
 block discarded – undo
4256 4256
 	{
4257 4257
 		return '';
4258 4258
 	}
4259
-	public function _write($id,$data)
4259
+	public function _write($id, $data)
4260 4260
 	{
4261 4261
 		return true;
4262 4262
 	}
@@ -4288,7 +4288,7 @@  discard block
 block discarded – undo
4288 4288
 	{
4289 4289
 		return isset($_SESSION[$key]) ? $_SESSION[$key] : null;
4290 4290
 	}
4291
-	public function add($key,$value)
4291
+	public function add($key, $value)
4292 4292
 	{
4293 4293
 		$_SESSION[$key]=$value;
4294 4294
 	}
@@ -4324,7 +4324,7 @@  discard block
 block discarded – undo
4324 4324
 	{
4325 4325
 		return isset($_SESSION[$offset]) ? $_SESSION[$offset] : null;
4326 4326
 	}
4327
-	public function offsetSet($offset,$item)
4327
+	public function offsetSet($offset, $item)
4328 4328
 	{
4329 4329
 		$_SESSION[$offset]=$item;
4330 4330
 	}
@@ -4351,7 +4351,7 @@  discard block
 block discarded – undo
4351 4351
 	}
4352 4352
 	public function current()
4353 4353
 	{
4354
-		return isset($_SESSION[$this->_key])?$_SESSION[$this->_key]:null;
4354
+		return isset($_SESSION[$this->_key]) ? $_SESSION[$this->_key] : null;
4355 4355
 	}
4356 4356
 	public function next()
4357 4357
 	{
@@ -4379,16 +4379,16 @@  discard block
 block discarded – undo
4379 4379
 	protected function _getZappableSleepProps(&$exprops)
4380 4380
 	{
4381 4381
 		parent::_getZappableSleepProps($exprops);
4382
-		if ($this->_caseSensitive===false)
4383
-			$exprops[] = "\0TAttributeCollection\0_caseSensitive";
4382
+		if($this->_caseSensitive===false)
4383
+			$exprops[]="\0TAttributeCollection\0_caseSensitive";
4384 4384
 	}
4385 4385
 	public function __get($name)
4386 4386
 	{
4387
-		return $this->contains($name)?$this->itemAt($name):parent::__get($name);
4387
+		return $this->contains($name) ? $this->itemAt($name) : parent::__get($name);
4388 4388
 	}
4389
-	public function __set($name,$value)
4389
+	public function __set($name, $value)
4390 4390
 	{
4391
-		$this->add($name,$value);
4391
+		$this->add($name, $value);
4392 4392
 	}
4393 4393
 	public function getCaseSensitive()
4394 4394
 	{
@@ -4400,19 +4400,19 @@  discard block
 block discarded – undo
4400 4400
 	}
4401 4401
 	public function itemAt($key)
4402 4402
 	{
4403
-		return parent::itemAt($this->_caseSensitive?$key:strtolower($key));
4403
+		return parent::itemAt($this->_caseSensitive ? $key : strtolower($key));
4404 4404
 	}
4405
-	public function add($key,$value)
4405
+	public function add($key, $value)
4406 4406
 	{
4407
-		parent::add($this->_caseSensitive?$key:strtolower($key),$value);
4407
+		parent::add($this->_caseSensitive ? $key : strtolower($key), $value);
4408 4408
 	}
4409 4409
 	public function remove($key)
4410 4410
 	{
4411
-		return parent::remove($this->_caseSensitive?$key:strtolower($key));
4411
+		return parent::remove($this->_caseSensitive ? $key : strtolower($key));
4412 4412
 	}
4413 4413
 	public function contains($key)
4414 4414
 	{
4415
-		return parent::contains($this->_caseSensitive?$key:strtolower($key));
4415
+		return parent::contains($this->_caseSensitive ? $key : strtolower($key));
4416 4416
 	}
4417 4417
 	public function hasProperty($name)
4418 4418
 	{
@@ -4440,7 +4440,7 @@  discard block
 block discarded – undo
4440 4440
 	}
4441 4441
 	public function getPage()
4442 4442
 	{
4443
-		return $this->_control?$this->_control->getPage():null;
4443
+		return $this->_control ? $this->_control->getPage() : null;
4444 4444
 	}
4445 4445
 	public function createChildControls()
4446 4446
 	{
@@ -4498,7 +4498,7 @@  discard block
 block discarded – undo
4498 4498
 	const IS_DISABLE_THEMING=0x10;
4499 4499
 	const IS_CHILD_CREATED=0x20;
4500 4500
 	const IS_CREATING_CHILD=0x40;
4501
-	const RF_CONTROLS=0;				const RF_CHILD_STATE=1;				const RF_NAMED_CONTROLS=2;			const RF_NAMED_CONTROLS_ID=3;		const RF_SKIN_ID=4;					const RF_DATA_BINDINGS=5;			const RF_EVENTS=6;					const RF_CONTROLSTATE=7;			const RF_NAMED_OBJECTS=8;			const RF_ADAPTER=9;					const RF_AUTO_BINDINGS=10;		
4501
+	const RF_CONTROLS=0; const RF_CHILD_STATE=1; const RF_NAMED_CONTROLS=2; const RF_NAMED_CONTROLS_ID=3; const RF_SKIN_ID=4; const RF_DATA_BINDINGS=5; const RF_EVENTS=6; const RF_CONTROLSTATE=7; const RF_NAMED_OBJECTS=8; const RF_ADAPTER=9; const RF_AUTO_BINDINGS=10;		
4502 4502
 	private $_id='';
4503 4503
 	private $_uid;
4504 4504
 	private $_parent;
@@ -4524,7 +4524,7 @@  discard block
 block discarded – undo
4524 4524
 	}
4525 4525
 	public function getAdapter()
4526 4526
 	{
4527
-		return isset($this->_rf[self::RF_ADAPTER])?$this->_rf[self::RF_ADAPTER]:null;
4527
+		return isset($this->_rf[self::RF_ADAPTER]) ? $this->_rf[self::RF_ADAPTER] : null;
4528 4528
 	}
4529 4529
 	public function setAdapter(TControlAdapter $adapter)
4530 4530
 	{
@@ -4597,18 +4597,18 @@  discard block
 block discarded – undo
4597 4597
 	}
4598 4598
 	public function setID($id)
4599 4599
 	{
4600
-		if(!preg_match(self::ID_FORMAT,$id))
4601
-			throw new TInvalidDataValueException('control_id_invalid',get_class($this),$id);
4600
+		if(!preg_match(self::ID_FORMAT, $id))
4601
+			throw new TInvalidDataValueException('control_id_invalid', get_class($this), $id);
4602 4602
 		$this->_id=$id;
4603
-		$this->_flags |= self::IS_ID_SET;
4603
+		$this->_flags|=self::IS_ID_SET;
4604 4604
 		$this->clearCachedUniqueID($this instanceof INamingContainer);
4605 4605
 		if($this->_namingContainer)
4606 4606
 			$this->_namingContainer->clearNameTable();
4607 4607
 	}
4608 4608
 	public function getUniqueID()
4609 4609
 	{
4610
-		if($this->_uid==='' || $this->_uid===null)			{
4611
-			$this->_uid='';  			if($namingContainer=$this->getNamingContainer())
4610
+		if($this->_uid==='' || $this->_uid===null) {
4611
+			$this->_uid=''; if($namingContainer=$this->getNamingContainer())
4612 4612
 			{
4613 4613
 				if($this->getPage()===$namingContainer)
4614 4614
 					return ($this->_uid=$this->_id);
@@ -4628,20 +4628,20 @@  discard block
 block discarded – undo
4628 4628
 	}
4629 4629
 	public function getClientID()
4630 4630
 	{
4631
-		return strtr($this->getUniqueID(),self::ID_SEPARATOR,self::CLIENT_ID_SEPARATOR);
4631
+		return strtr($this->getUniqueID(), self::ID_SEPARATOR, self::CLIENT_ID_SEPARATOR);
4632 4632
 	}
4633 4633
 	public static function convertUniqueIdToClientId($uniqueID)
4634 4634
 	{
4635
-		return strtr($uniqueID,self::ID_SEPARATOR,self::CLIENT_ID_SEPARATOR);
4635
+		return strtr($uniqueID, self::ID_SEPARATOR, self::CLIENT_ID_SEPARATOR);
4636 4636
 	}
4637 4637
 	public function getSkinID()
4638 4638
 	{
4639
-		return isset($this->_rf[self::RF_SKIN_ID])?$this->_rf[self::RF_SKIN_ID]:'';
4639
+		return isset($this->_rf[self::RF_SKIN_ID]) ? $this->_rf[self::RF_SKIN_ID] : '';
4640 4640
 	}
4641 4641
 	public function setSkinID($value)
4642 4642
 	{
4643
-		if(($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage>=self::CS_CHILD_INITIALIZED)
4644
-			throw new TInvalidOperationException('control_skinid_unchangeable',get_class($this));
4643
+		if(($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage >= self::CS_CHILD_INITIALIZED)
4644
+			throw new TInvalidOperationException('control_skinid_unchangeable', get_class($this));
4645 4645
 		else
4646 4646
 			$this->_rf[self::RF_SKIN_ID]=$value;
4647 4647
 	}
@@ -4654,28 +4654,28 @@  discard block
 block discarded – undo
4654 4654
 		if($this->_flags & self::IS_DISABLE_THEMING)
4655 4655
 			return false;
4656 4656
 		else
4657
-			return $this->_parent?$this->_parent->getEnableTheming():true;
4657
+			return $this->_parent ? $this->_parent->getEnableTheming() : true;
4658 4658
 	}
4659 4659
 	public function setEnableTheming($value)
4660 4660
 	{
4661
-		if($this->_stage>=self::CS_CHILD_INITIALIZED)
4662
-			throw new TInvalidOperationException('control_enabletheming_unchangeable',get_class($this),$this->getUniqueID());
4661
+		if($this->_stage >= self::CS_CHILD_INITIALIZED)
4662
+			throw new TInvalidOperationException('control_enabletheming_unchangeable', get_class($this), $this->getUniqueID());
4663 4663
 		else if(TPropertyValue::ensureBoolean($value))
4664
-			$this->_flags &= ~self::IS_DISABLE_THEMING;
4664
+			$this->_flags&=~self::IS_DISABLE_THEMING;
4665 4665
 		else
4666
-			$this->_flags |= self::IS_DISABLE_THEMING;
4666
+			$this->_flags|=self::IS_DISABLE_THEMING;
4667 4667
 	}
4668 4668
 	public function getCustomData()
4669 4669
 	{
4670
-		return $this->getViewState('CustomData',null);
4670
+		return $this->getViewState('CustomData', null);
4671 4671
 	}
4672 4672
 	public function setCustomData($value)
4673 4673
 	{
4674
-		$this->setViewState('CustomData',$value,null);
4674
+		$this->setViewState('CustomData', $value, null);
4675 4675
 	}
4676 4676
 	public function getHasControls()
4677 4677
 	{
4678
-		return isset($this->_rf[self::RF_CONTROLS]) && $this->_rf[self::RF_CONTROLS]->getCount()>0;
4678
+		return isset($this->_rf[self::RF_CONTROLS]) && $this->_rf[self::RF_CONTROLS]->getCount() > 0;
4679 4679
 	}
4680 4680
 	public function getControls()
4681 4681
 	{
@@ -4685,79 +4685,79 @@  discard block
 block discarded – undo
4685 4685
 	}
4686 4686
 	protected function createControlCollection()
4687 4687
 	{
4688
-		return $this->getAllowChildControls()?new TControlCollection($this):new TEmptyControlCollection($this);
4688
+		return $this->getAllowChildControls() ? new TControlCollection($this) : new TEmptyControlCollection($this);
4689 4689
 	}
4690 4690
 	public function getVisible($checkParents=true)
4691 4691
 	{
4692 4692
 		if($checkParents)
4693 4693
 		{
4694
-			for($control=$this;$control;$control=$control->_parent)
4694
+			for($control=$this; $control; $control=$control->_parent)
4695 4695
 				if(!$control->getVisible(false))
4696 4696
 					return false;
4697 4697
 			return true;
4698 4698
 		}
4699 4699
 		else
4700
-			return $this->getViewState('Visible',true);
4700
+			return $this->getViewState('Visible', true);
4701 4701
 	}
4702 4702
 	public function setVisible($value)
4703 4703
 	{
4704
-		$this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true);
4704
+		$this->setViewState('Visible', TPropertyValue::ensureBoolean($value), true);
4705 4705
 	}
4706 4706
 	public function getEnabled($checkParents=false)
4707 4707
 	{
4708 4708
 		if($checkParents)
4709 4709
 		{
4710
-			for($control=$this;$control;$control=$control->_parent)
4711
-				if(!$control->getViewState('Enabled',true))
4710
+			for($control=$this; $control; $control=$control->_parent)
4711
+				if(!$control->getViewState('Enabled', true))
4712 4712
 					return false;
4713 4713
 			return true;
4714 4714
 		}
4715 4715
 		else
4716
-			return $this->getViewState('Enabled',true);
4716
+			return $this->getViewState('Enabled', true);
4717 4717
 	}
4718 4718
 	public function setEnabled($value)
4719 4719
 	{
4720
-		$this->setViewState('Enabled',TPropertyValue::ensureBoolean($value),true);
4720
+		$this->setViewState('Enabled', TPropertyValue::ensureBoolean($value), true);
4721 4721
 	}
4722 4722
 	public function getHasAttributes()
4723 4723
 	{
4724
-		if($attributes=$this->getViewState('Attributes',null))
4725
-			return $attributes->getCount()>0;
4724
+		if($attributes=$this->getViewState('Attributes', null))
4725
+			return $attributes->getCount() > 0;
4726 4726
 		else
4727 4727
 			return false;
4728 4728
 	}
4729 4729
 	public function getAttributes()
4730 4730
 	{
4731
-		if($attributes=$this->getViewState('Attributes',null))
4731
+		if($attributes=$this->getViewState('Attributes', null))
4732 4732
 			return $attributes;
4733 4733
 		else
4734 4734
 		{
4735 4735
 			$attributes=new TAttributeCollection;
4736
-			$this->setViewState('Attributes',$attributes,null);
4736
+			$this->setViewState('Attributes', $attributes, null);
4737 4737
 			return $attributes;
4738 4738
 		}
4739 4739
 	}
4740 4740
 	public function hasAttribute($name)
4741 4741
 	{
4742
-		if($attributes=$this->getViewState('Attributes',null))
4742
+		if($attributes=$this->getViewState('Attributes', null))
4743 4743
 			return $attributes->contains($name);
4744 4744
 		else
4745 4745
 			return false;
4746 4746
 	}
4747 4747
 	public function getAttribute($name)
4748 4748
 	{
4749
-		if($attributes=$this->getViewState('Attributes',null))
4749
+		if($attributes=$this->getViewState('Attributes', null))
4750 4750
 			return $attributes->itemAt($name);
4751 4751
 		else
4752 4752
 			return null;
4753 4753
 	}
4754
-	public function setAttribute($name,$value)
4754
+	public function setAttribute($name, $value)
4755 4755
 	{
4756
-		$this->getAttributes()->add($name,$value);
4756
+		$this->getAttributes()->add($name, $value);
4757 4757
 	}
4758 4758
 	public function removeAttribute($name)
4759 4759
 	{
4760
-		if($attributes=$this->getViewState('Attributes',null))
4760
+		if($attributes=$this->getViewState('Attributes', null))
4761 4761
 			return $attributes->remove($name);
4762 4762
 		else
4763 4763
 			return null;
@@ -4766,7 +4766,7 @@  discard block
 block discarded – undo
4766 4766
 	{
4767 4767
 		if($checkParents)
4768 4768
 		{
4769
-			for($control=$this;$control!==null;$control=$control->getParent())
4769
+			for($control=$this; $control!==null; $control=$control->getParent())
4770 4770
 				if($control->_flags & self::IS_DISABLE_VIEWSTATE)
4771 4771
 					return false;
4772 4772
 			return true;
@@ -4777,15 +4777,15 @@  discard block
 block discarded – undo
4777 4777
 	public function setEnableViewState($value)
4778 4778
 	{
4779 4779
 		if(TPropertyValue::ensureBoolean($value))
4780
-			$this->_flags &= ~self::IS_DISABLE_VIEWSTATE;
4780
+			$this->_flags&=~self::IS_DISABLE_VIEWSTATE;
4781 4781
 		else
4782
-			$this->_flags |= self::IS_DISABLE_VIEWSTATE;
4782
+			$this->_flags|=self::IS_DISABLE_VIEWSTATE;
4783 4783
 	}
4784
-	protected function getControlState($key,$defaultValue=null)
4784
+	protected function getControlState($key, $defaultValue=null)
4785 4785
 	{
4786
-		return isset($this->_rf[self::RF_CONTROLSTATE][$key])?$this->_rf[self::RF_CONTROLSTATE][$key]:$defaultValue;
4786
+		return isset($this->_rf[self::RF_CONTROLSTATE][$key]) ? $this->_rf[self::RF_CONTROLSTATE][$key] : $defaultValue;
4787 4787
 	}
4788
-	protected function setControlState($key,$value,$defaultValue=null)
4788
+	protected function setControlState($key, $value, $defaultValue=null)
4789 4789
 	{
4790 4790
 		if($value===$defaultValue)
4791 4791
 			unset($this->_rf[self::RF_CONTROLSTATE][$key]);
@@ -4800,10 +4800,10 @@  discard block
 block discarded – undo
4800 4800
 	{
4801 4801
 		$this->_trackViewState=TPropertyValue::ensureBoolean($enabled);
4802 4802
 	}
4803
-	public function getViewState($key,$defaultValue=null)
4803
+	public function getViewState($key, $defaultValue=null)
4804 4804
 	{
4805 4805
 		if(isset($this->_viewState[$key]))
4806
-			return $this->_viewState[$key]!==null?$this->_viewState[$key]:$defaultValue;
4806
+			return $this->_viewState[$key]!==null ? $this->_viewState[$key] : $defaultValue;
4807 4807
 		else if(isset($this->_tempState[$key]))
4808 4808
 		{
4809 4809
 			if(is_object($this->_tempState[$key]) && $this->_trackViewState)
@@ -4813,7 +4813,7 @@  discard block
 block discarded – undo
4813 4813
 		else
4814 4814
 			return $defaultValue;
4815 4815
 	}
4816
-	public function setViewState($key,$value,$defaultValue=null)
4816
+	public function setViewState($key, $value, $defaultValue=null)
4817 4817
 	{
4818 4818
 		if($this->_trackViewState)
4819 4819
 		{
@@ -4837,7 +4837,7 @@  discard block
 block discarded – undo
4837 4837
 		unset($this->_viewState[$key]);
4838 4838
 		unset($this->_tempState[$key]);
4839 4839
 	}
4840
-	public function bindProperty($name,$expression)
4840
+	public function bindProperty($name, $expression)
4841 4841
 	{
4842 4842
 		$this->_rf[self::RF_DATA_BINDINGS][$name]=$expression;
4843 4843
 	}
@@ -4845,7 +4845,7 @@  discard block
 block discarded – undo
4845 4845
 	{
4846 4846
 		unset($this->_rf[self::RF_DATA_BINDINGS][$name]);
4847 4847
 	}
4848
-	public function autoBindProperty($name,$expression)
4848
+	public function autoBindProperty($name, $expression)
4849 4849
 	{
4850 4850
 		$this->_rf[self::RF_AUTO_BINDINGS][$name]=$expression;
4851 4851
 	}
@@ -4862,7 +4862,7 @@  discard block
 block discarded – undo
4862 4862
 			if(($context=$this->getTemplateControl())===null)
4863 4863
 				$context=$this;
4864 4864
 			foreach($this->_rf[self::RF_DATA_BINDINGS] as $property=>$expression)
4865
-				$this->setSubProperty($property,$context->evaluateExpression($expression));
4865
+				$this->setSubProperty($property, $context->evaluateExpression($expression));
4866 4866
 		}
4867 4867
 	}
4868 4868
 	protected function autoDataBindProperties()
@@ -4872,7 +4872,7 @@  discard block
 block discarded – undo
4872 4872
 			if(($context=$this->getTemplateControl())===null)
4873 4873
 				$context=$this;
4874 4874
 			foreach($this->_rf[self::RF_AUTO_BINDINGS] as $property=>$expression)
4875
-				$this->setSubProperty($property,$context->evaluateExpression($expression));
4875
+				$this->setSubProperty($property, $context->evaluateExpression($expression));
4876 4876
 		}
4877 4877
 	}
4878 4878
 	protected function dataBindChildren()
@@ -4891,12 +4891,12 @@  discard block
 block discarded – undo
4891 4891
 	final protected function setChildControlsCreated($value)
4892 4892
 	{
4893 4893
 		if($value)
4894
-			$this->_flags |= self::IS_CHILD_CREATED;
4894
+			$this->_flags|=self::IS_CHILD_CREATED;
4895 4895
 		else
4896 4896
 		{
4897 4897
 			if($this->getHasControls() && ($this->_flags & self::IS_CHILD_CREATED))
4898 4898
 				$this->getControls()->clear();
4899
-			$this->_flags &= ~self::IS_CHILD_CREATED;
4899
+			$this->_flags&=~self::IS_CHILD_CREATED;
4900 4900
 		}
4901 4901
 	}
4902 4902
 	public function ensureChildControls()
@@ -4905,18 +4905,18 @@  discard block
 block discarded – undo
4905 4905
 		{
4906 4906
 			try
4907 4907
 			{
4908
-				$this->_flags |= self::IS_CREATING_CHILD;
4908
+				$this->_flags|=self::IS_CREATING_CHILD;
4909 4909
 				if(isset($this->_rf[self::RF_ADAPTER]))
4910 4910
 					$this->_rf[self::RF_ADAPTER]->createChildControls();
4911 4911
 				else
4912 4912
 					$this->createChildControls();
4913
-				$this->_flags &= ~self::IS_CREATING_CHILD;
4914
-				$this->_flags |= self::IS_CHILD_CREATED;
4913
+				$this->_flags&=~self::IS_CREATING_CHILD;
4914
+				$this->_flags|=self::IS_CHILD_CREATED;
4915 4915
 			}
4916 4916
 			catch(Exception $e)
4917 4917
 			{
4918
-				$this->_flags &= ~self::IS_CREATING_CHILD;
4919
-				$this->_flags |= self::IS_CHILD_CREATED;
4918
+				$this->_flags&=~self::IS_CREATING_CHILD;
4919
+				$this->_flags|=self::IS_CHILD_CREATED;
4920 4920
 				throw $e;
4921 4921
 			}
4922 4922
 		}
@@ -4926,28 +4926,28 @@  discard block
 block discarded – undo
4926 4926
 	}
4927 4927
 	public function findControl($id)
4928 4928
 	{
4929
-		$id=strtr($id,'.',self::ID_SEPARATOR);
4930
-		$container=($this instanceof INamingContainer)?$this:$this->getNamingContainer();
4929
+		$id=strtr($id, '.', self::ID_SEPARATOR);
4930
+		$container=($this instanceof INamingContainer) ? $this : $this->getNamingContainer();
4931 4931
 		if(!$container || !$container->getHasControls())
4932 4932
 			return null;
4933 4933
 		if(!isset($container->_rf[self::RF_NAMED_CONTROLS]))
4934 4934
 		{
4935 4935
 			$container->_rf[self::RF_NAMED_CONTROLS]=array();
4936
-			$container->fillNameTable($container,$container->_rf[self::RF_CONTROLS]);
4936
+			$container->fillNameTable($container, $container->_rf[self::RF_CONTROLS]);
4937 4937
 		}
4938
-		if(($pos=strpos($id,self::ID_SEPARATOR))===false)
4939
-			return isset($container->_rf[self::RF_NAMED_CONTROLS][$id])?$container->_rf[self::RF_NAMED_CONTROLS][$id]:null;
4938
+		if(($pos=strpos($id, self::ID_SEPARATOR))===false)
4939
+			return isset($container->_rf[self::RF_NAMED_CONTROLS][$id]) ? $container->_rf[self::RF_NAMED_CONTROLS][$id] : null;
4940 4940
 		else
4941 4941
 		{
4942
-			$cid=substr($id,0,$pos);
4943
-			$sid=substr($id,$pos+1);
4942
+			$cid=substr($id, 0, $pos);
4943
+			$sid=substr($id, $pos + 1);
4944 4944
 			if(isset($container->_rf[self::RF_NAMED_CONTROLS][$cid]))
4945 4945
 				return $container->_rf[self::RF_NAMED_CONTROLS][$cid]->findControl($sid);
4946 4946
 			else
4947 4947
 				return null;
4948 4948
 		}
4949 4949
 	}
4950
-	public function findControlsByType($type,$strict=true)
4950
+	public function findControlsByType($type, $strict=true)
4951 4951
 	{
4952 4952
 		$controls=array();
4953 4953
 		if($this->getHasControls())
@@ -4957,7 +4957,7 @@  discard block
 block discarded – undo
4957 4957
 				if(is_object($control) && (get_class($control)===$type || (!$strict && ($control instanceof $type))))
4958 4958
 					$controls[]=$control;
4959 4959
 				if(($control instanceof TControl) && $control->getHasControls())
4960
-					$controls=array_merge($controls,$control->findControlsByType($type,$strict));
4960
+					$controls=array_merge($controls, $control->findControlsByType($type, $strict));
4961 4961
 			}
4962 4962
 		}
4963 4963
 		return $controls;
@@ -4973,7 +4973,7 @@  discard block
 block discarded – undo
4973 4973
 				{
4974 4974
 					if($control->_id===$id)
4975 4975
 						$controls[]=$control;
4976
-					$controls=array_merge($controls,$control->findControlsByID($id));
4976
+					$controls=array_merge($controls, $control->findControlsByID($id));
4977 4977
 				}
4978 4978
 			}
4979 4979
 		}
@@ -4984,10 +4984,10 @@  discard block
 block discarded – undo
4984 4984
 		unset($this->_rf[self::RF_NAMED_CONTROLS_ID]);
4985 4985
 		$this->clearNameTable();
4986 4986
 	}
4987
-	public function registerObject($name,$object)
4987
+	public function registerObject($name, $object)
4988 4988
 	{
4989 4989
 		if(isset($this->_rf[self::RF_NAMED_OBJECTS][$name]))
4990
-			throw new TInvalidOperationException('control_object_reregistered',$name);
4990
+			throw new TInvalidOperationException('control_object_reregistered', $name);
4991 4991
 		$this->_rf[self::RF_NAMED_OBJECTS][$name]=$object;
4992 4992
 	}
4993 4993
 	public function unregisterObject($name)
@@ -5020,7 +5020,7 @@  discard block
 block discarded – undo
5020 5020
 	}
5021 5021
 	public function getRegisteredObject($name)
5022 5022
 	{
5023
-		return isset($this->_rf[self::RF_NAMED_OBJECTS][$name])?$this->_rf[self::RF_NAMED_OBJECTS][$name]:null;
5023
+		return isset($this->_rf[self::RF_NAMED_OBJECTS][$name]) ? $this->_rf[self::RF_NAMED_OBJECTS][$name] : null;
5024 5024
 	}
5025 5025
 	public function getAllowChildControls()
5026 5026
 	{
@@ -5047,7 +5047,7 @@  discard block
 block discarded – undo
5047 5047
 			$control->_parent->getControls()->remove($control);
5048 5048
 		$control->_parent=$this;
5049 5049
 		$control->_page=$this->getPage();
5050
-		$namingContainer=($this instanceof INamingContainer)?$this:$this->_namingContainer;
5050
+		$namingContainer=($this instanceof INamingContainer) ? $this : $this->_namingContainer;
5051 5051
 		if($namingContainer)
5052 5052
 		{
5053 5053
 			$control->_namingContainer=$namingContainer;
@@ -5057,10 +5057,10 @@  discard block
 block discarded – undo
5057 5057
 				$namingContainer->clearNameTable();
5058 5058
 			$control->clearCachedUniqueID($control instanceof INamingContainer);
5059 5059
 		}
5060
-		if($this->_stage>=self::CS_CHILD_INITIALIZED)
5060
+		if($this->_stage >= self::CS_CHILD_INITIALIZED)
5061 5061
 		{
5062 5062
 			$control->initRecursive($namingContainer);
5063
-			if($this->_stage>=self::CS_STATE_LOADED)
5063
+			if($this->_stage >= self::CS_STATE_LOADED)
5064 5064
 			{
5065 5065
 				if(isset($this->_rf[self::RF_CHILD_STATE][$control->_id]))
5066 5066
 				{
@@ -5069,11 +5069,11 @@  discard block
 block discarded – undo
5069 5069
 				}
5070 5070
 				else
5071 5071
 					$state=null;
5072
-				$control->loadStateRecursive($state,!($this->_flags & self::IS_DISABLE_VIEWSTATE));
5073
-				if($this->_stage>=self::CS_LOADED)
5072
+				$control->loadStateRecursive($state, !($this->_flags & self::IS_DISABLE_VIEWSTATE));
5073
+				if($this->_stage >= self::CS_LOADED)
5074 5074
 				{
5075 5075
 					$control->loadRecursive();
5076
-					if($this->_stage>=self::CS_PRERENDERED)
5076
+					if($this->_stage >= self::CS_PRERENDERED)
5077 5077
 						$control->preRenderRecursive();
5078 5078
 				}
5079 5079
 			}
@@ -5114,13 +5114,13 @@  discard block
 block discarded – undo
5114 5114
 				}
5115 5115
 			}
5116 5116
 		}
5117
-		if($this->_stage<self::CS_INITIALIZED)
5117
+		if($this->_stage < self::CS_INITIALIZED)
5118 5118
 		{
5119 5119
 			$this->_stage=self::CS_CHILD_INITIALIZED;
5120 5120
 			if(($page=$this->getPage()) && $this->getEnableTheming() && !($this->_flags & self::IS_SKIN_APPLIED))
5121 5121
 			{
5122 5122
 				$page->applyControlSkin($this);
5123
-				$this->_flags |= self::IS_SKIN_APPLIED;
5123
+				$this->_flags|=self::IS_SKIN_APPLIED;
5124 5124
 			}
5125 5125
 			if(isset($this->_rf[self::RF_ADAPTER]))
5126 5126
 				$this->_rf[self::RF_ADAPTER]->onInit(null);
@@ -5131,7 +5131,7 @@  discard block
 block discarded – undo
5131 5131
 	}
5132 5132
 	protected function loadRecursive()
5133 5133
 	{
5134
-		if($this->_stage<self::CS_LOADED)
5134
+		if($this->_stage < self::CS_LOADED)
5135 5135
 		{
5136 5136
 			if(isset($this->_rf[self::RF_ADAPTER]))
5137 5137
 				$this->_rf[self::RF_ADAPTER]->onLoad(null);
@@ -5146,7 +5146,7 @@  discard block
 block discarded – undo
5146 5146
 					$control->loadRecursive();
5147 5147
 			}
5148 5148
 		}
5149
-		if($this->_stage<self::CS_LOADED)
5149
+		if($this->_stage < self::CS_LOADED)
5150 5150
 			$this->_stage=self::CS_LOADED;
5151 5151
 	}
5152 5152
 	protected function preRenderRecursive()
@@ -5188,73 +5188,73 @@  discard block
 block discarded – undo
5188 5188
 	}
5189 5189
 	public function onInit($param)
5190 5190
 	{
5191
-		$this->raiseEvent('OnInit',$this,$param);
5191
+		$this->raiseEvent('OnInit', $this, $param);
5192 5192
 	}
5193 5193
 	public function onLoad($param)
5194 5194
 	{
5195
-		$this->raiseEvent('OnLoad',$this,$param);
5195
+		$this->raiseEvent('OnLoad', $this, $param);
5196 5196
 	}
5197 5197
 	public function onDataBinding($param)
5198 5198
 	{
5199
-		$this->raiseEvent('OnDataBinding',$this,$param);
5199
+		$this->raiseEvent('OnDataBinding', $this, $param);
5200 5200
 	}
5201 5201
 	public function onUnload($param)
5202 5202
 	{
5203
-		$this->raiseEvent('OnUnload',$this,$param);
5203
+		$this->raiseEvent('OnUnload', $this, $param);
5204 5204
 	}
5205 5205
 	public function onPreRender($param)
5206 5206
 	{
5207
-		$this->raiseEvent('OnPreRender',$this,$param);
5207
+		$this->raiseEvent('OnPreRender', $this, $param);
5208 5208
 	}
5209
-	protected function raiseBubbleEvent($sender,$param)
5209
+	protected function raiseBubbleEvent($sender, $param)
5210 5210
 	{
5211 5211
 		$control=$this;
5212 5212
 		while($control=$control->_parent)
5213 5213
 		{
5214
-			if($control->bubbleEvent($sender,$param))
5214
+			if($control->bubbleEvent($sender, $param))
5215 5215
 				break;
5216 5216
 		}
5217 5217
 	}
5218
-	public function bubbleEvent($sender,$param)
5218
+	public function bubbleEvent($sender, $param)
5219 5219
 	{
5220 5220
 		return false;
5221 5221
 	}
5222
-	public function broadcastEvent($name,$sender,$param)
5222
+	public function broadcastEvent($name, $sender, $param)
5223 5223
 	{
5224
-		$rootControl=(($page=$this->getPage())===null)?$this:$page;
5225
-		$rootControl->broadcastEventInternal($name,$sender,new TBroadcastEventParameter($name,$param));
5224
+		$rootControl=(($page=$this->getPage())===null) ? $this : $page;
5225
+		$rootControl->broadcastEventInternal($name, $sender, new TBroadcastEventParameter($name, $param));
5226 5226
 	}
5227
-	private function broadcastEventInternal($name,$sender,$param)
5227
+	private function broadcastEventInternal($name, $sender, $param)
5228 5228
 	{
5229 5229
 		if($this->hasEvent($name))
5230
-			$this->raiseEvent($name,$sender,$param->getParameter());
5230
+			$this->raiseEvent($name, $sender, $param->getParameter());
5231 5231
 		if($this instanceof IBroadcastEventReceiver)
5232
-			$this->broadcastEventReceived($sender,$param);
5232
+			$this->broadcastEventReceived($sender, $param);
5233 5233
 		if($this->getHasControls())
5234 5234
 		{
5235 5235
 			foreach($this->_rf[self::RF_CONTROLS] as $control)
5236 5236
 			{
5237 5237
 				if($control instanceof TControl)
5238
-					$control->broadcastEventInternal($name,$sender,$param);
5238
+					$control->broadcastEventInternal($name, $sender, $param);
5239 5239
 			}
5240 5240
 		}
5241 5241
 	}
5242
-	protected function traverseChildControls($param,$preCallback=null,$postCallback=null)
5242
+	protected function traverseChildControls($param, $preCallback=null, $postCallback=null)
5243 5243
 	{
5244 5244
 		if($preCallback!==null)
5245
-			call_user_func($preCallback,$this,$param);
5245
+			call_user_func($preCallback, $this, $param);
5246 5246
 		if($this->getHasControls())
5247 5247
 		{
5248 5248
 			foreach($this->_rf[self::RF_CONTROLS] as $control)
5249 5249
 			{
5250 5250
 				if($control instanceof TControl)
5251 5251
 				{
5252
-					$control->traverseChildControls($param,$preCallback,$postCallback);
5252
+					$control->traverseChildControls($param, $preCallback, $postCallback);
5253 5253
 				}
5254 5254
 			}
5255 5255
 		}
5256 5256
 		if($postCallback!==null)
5257
-			call_user_func($postCallback,$this,$param);
5257
+			call_user_func($postCallback, $this, $param);
5258 5258
 	}
5259 5259
 	public function renderControl($writer)
5260 5260
 	{
@@ -5291,7 +5291,7 @@  discard block
 block discarded – undo
5291 5291
 	public function loadState()
5292 5292
 	{
5293 5293
 	}
5294
-	protected function loadStateRecursive(&$state,$needViewState=true)
5294
+	protected function loadStateRecursive(&$state, $needViewState=true)
5295 5295
 	{
5296 5296
 		if(is_array($state))
5297 5297
 		{
@@ -5319,7 +5319,7 @@  discard block
 block discarded – undo
5319 5319
 					{
5320 5320
 						if(isset($state[$control->_id]))
5321 5321
 						{
5322
-							$control->loadStateRecursive($state[$control->_id],$needViewState);
5322
+							$control->loadStateRecursive($state[$control->_id], $needViewState);
5323 5323
 							unset($state[$control->_id]);
5324 5324
 						}
5325 5325
 					}
@@ -5348,7 +5348,7 @@  discard block
 block discarded – undo
5348 5348
 			{
5349 5349
 				if($control instanceof TControl)
5350 5350
 				{
5351
-					if(count($tmp = &$control->saveStateRecursive($needViewState)))
5351
+					if(count($tmp=&$control->saveStateRecursive($needViewState)))
5352 5352
 						$state[$control->_id]=$tmp;
5353 5353
 				}
5354 5354
 			}
@@ -5364,10 +5364,10 @@  discard block
 block discarded – undo
5364 5364
 		if($page && !($this->_flags & self::IS_STYLESHEET_APPLIED))
5365 5365
 		{
5366 5366
 			$page->applyControlStyleSheet($this);
5367
-			$this->_flags |= self::IS_STYLESHEET_APPLIED;
5367
+			$this->_flags|=self::IS_STYLESHEET_APPLIED;
5368 5368
 		}
5369 5369
 		else if($this->_flags & self::IS_STYLESHEET_APPLIED)
5370
-			throw new TInvalidOperationException('control_stylesheet_applied',get_class($this));
5370
+			throw new TInvalidOperationException('control_stylesheet_applied', get_class($this));
5371 5371
 	}
5372 5372
 	private function clearCachedUniqueID($recursive)
5373 5373
 	{
@@ -5381,18 +5381,18 @@  discard block
 block discarded – undo
5381 5381
 	}
5382 5382
 	private function generateAutomaticID()
5383 5383
 	{
5384
-		$this->_flags &= ~self::IS_ID_SET;
5384
+		$this->_flags&=~self::IS_ID_SET;
5385 5385
 		if(!isset($this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]))
5386 5386
 			$this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]=0;
5387 5387
 		$id=$this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]++;
5388
-		$this->_id=self::AUTOMATIC_ID_PREFIX . $id;
5388
+		$this->_id=self::AUTOMATIC_ID_PREFIX.$id;
5389 5389
 		$this->_namingContainer->clearNameTable();
5390 5390
 	}
5391 5391
 	private function clearNameTable()
5392 5392
 	{
5393 5393
 		unset($this->_rf[self::RF_NAMED_CONTROLS]);
5394 5394
 	}
5395
-	private function fillNameTable($container,$controls)
5395
+	private function fillNameTable($container, $controls)
5396 5396
 	{
5397 5397
 		foreach($controls as $control)
5398 5398
 		{
@@ -5401,12 +5401,12 @@  discard block
 block discarded – undo
5401 5401
 				if($control->_id!=='')
5402 5402
 				{
5403 5403
 					if(isset($container->_rf[self::RF_NAMED_CONTROLS][$control->_id]))
5404
-						throw new TInvalidDataValueException('control_id_nonunique',get_class($control),$control->_id);
5404
+						throw new TInvalidDataValueException('control_id_nonunique', get_class($control), $control->_id);
5405 5405
 					else
5406 5406
 						$container->_rf[self::RF_NAMED_CONTROLS][$control->_id]=$control;
5407 5407
 				}
5408 5408
 				if(!($control instanceof INamingContainer) && $control->getHasControls())
5409
-					$this->fillNameTable($container,$control->_rf[self::RF_CONTROLS]);
5409
+					$this->fillNameTable($container, $control->_rf[self::RF_CONTROLS]);
5410 5410
 			}
5411 5411
 		}
5412 5412
 	}
@@ -5414,24 +5414,24 @@  discard block
 block discarded – undo
5414 5414
 class TControlCollection extends TList
5415 5415
 {
5416 5416
 	private $_o;
5417
-	public function __construct(TControl $owner,$readOnly=false)
5417
+	public function __construct(TControl $owner, $readOnly=false)
5418 5418
 	{
5419 5419
 		$this->_o=$owner;
5420
-		parent::__construct(null,$readOnly);
5420
+		parent::__construct(null, $readOnly);
5421 5421
 	}
5422 5422
 	protected function getOwner()
5423 5423
 	{
5424 5424
 		return $this->_o;
5425 5425
 	}
5426
-	public function insertAt($index,$item)
5426
+	public function insertAt($index, $item)
5427 5427
 	{
5428 5428
 		if($item instanceof TControl)
5429 5429
 		{
5430
-			parent::insertAt($index,$item);
5430
+			parent::insertAt($index, $item);
5431 5431
 			$this->_o->addedControl($item);
5432 5432
 		}
5433 5433
 		else if(is_string($item) || ($item instanceof IRenderable))
5434
-			parent::insertAt($index,$item);
5434
+			parent::insertAt($index, $item);
5435 5435
 		else
5436 5436
 			throw new TInvalidDataTypeException('controlcollection_control_required');
5437 5437
 	}
@@ -5453,11 +5453,11 @@  discard block
 block discarded – undo
5453 5453
 {
5454 5454
 	public function __construct(TControl $owner)
5455 5455
 	{
5456
-		parent::__construct($owner,true);
5456
+		parent::__construct($owner, true);
5457 5457
 	}
5458
-	public function insertAt($index,$item)
5458
+	public function insertAt($index, $item)
5459 5459
 	{
5460
-		if(!is_string($item))  			parent::insertAt($index,$item);  	}
5460
+		if(!is_string($item))  			parent::insertAt($index, $item); }
5461 5461
 }
5462 5462
 interface INamingContainer
5463 5463
 {
@@ -5468,7 +5468,7 @@  discard block
 block discarded – undo
5468 5468
 }
5469 5469
 interface IPostBackDataHandler
5470 5470
 {
5471
-	public function loadPostData($key,$values);
5471
+	public function loadPostData($key, $values);
5472 5472
 	public function raisePostDataChangedEvent();
5473 5473
 	public function getDataChanged();
5474 5474
 }
@@ -5488,7 +5488,7 @@  discard block
 block discarded – undo
5488 5488
 }
5489 5489
 interface IBroadcastEventReceiver
5490 5490
 {
5491
-	public function broadcastEventReceived($sender,$param);
5491
+	public function broadcastEventReceived($sender, $param);
5492 5492
 }
5493 5493
 interface ITheme
5494 5494
 {
@@ -5524,7 +5524,7 @@  discard block
 block discarded – undo
5524 5524
 {
5525 5525
 	private $_name;
5526 5526
 	private $_param;
5527
-	public function __construct($name='',$parameter=null)
5527
+	public function __construct($name='', $parameter=null)
5528 5528
 	{
5529 5529
 		$this->_name=$name;
5530 5530
 		$this->_param=$parameter;
@@ -5550,7 +5550,7 @@  discard block
 block discarded – undo
5550 5550
 {
5551 5551
 	private $_name;
5552 5552
 	private $_param;
5553
-	public function __construct($name='',$parameter='')
5553
+	public function __construct($name='', $parameter='')
5554 5554
 	{
5555 5555
 		$this->_name=$name;
5556 5556
 		$this->_param=$parameter;
@@ -5605,7 +5605,7 @@  discard block
 block discarded – undo
5605 5605
 	}
5606 5606
 	public function evaluateDynamicContent()
5607 5607
 	{
5608
-		$context=$this->_container===null?$this:$this->_container;
5608
+		$context=$this->_container===null ? $this : $this->_container;
5609 5609
 		foreach($this->_expressions as $id=>$expression)
5610 5610
 			$this->_items[$id]=$context->evaluateExpression($expression);
5611 5611
 		foreach($this->_statements as $id=>$statement)
@@ -5613,13 +5613,13 @@  discard block
 block discarded – undo
5613 5613
 	}
5614 5614
 	public function dataBind()
5615 5615
 	{
5616
-		$context=$this->_container===null?$this:$this->_container;
5616
+		$context=$this->_container===null ? $this : $this->_container;
5617 5617
 		foreach($this->_bindings as $id=>$binding)
5618 5618
 			$this->_items[$id]=$context->evaluateExpression($binding);
5619 5619
 	}
5620 5620
 	public function render($writer)
5621 5621
 	{
5622
-		$writer->write(implode('',$this->_items));
5622
+		$writer->write(implode('', $this->_items));
5623 5623
 	}
5624 5624
 }
5625 5625
 class TFont extends TComponent
@@ -5642,12 +5642,12 @@  discard block
 block discarded – undo
5642 5642
 	protected function _getZappableSleepProps(&$exprops)
5643 5643
 	{
5644 5644
 		parent::_getZappableSleepProps($exprops);
5645
-		if ($this->_flags===0)
5646
-			$exprops[] = "\0TFont\0_flags";
5647
-		if ($this->_name==='')
5648
-			$exprops[] = "\0TFont\0_name";
5649
-		if ($this->_size==='')
5650
-			$exprops[] = "\0TFont\0_size";
5645
+		if($this->_flags===0)
5646
+			$exprops[]="\0TFont\0_flags";
5647
+		if($this->_name==='')
5648
+			$exprops[]="\0TFont\0_name";
5649
+		if($this->_size==='')
5650
+			$exprops[]="\0TFont\0_size";
5651 5651
 	}
5652 5652
 	public function getBold()
5653 5653
 	{
@@ -5655,11 +5655,11 @@  discard block
 block discarded – undo
5655 5655
 	}
5656 5656
 	public function setBold($value)
5657 5657
 	{
5658
-		$this->_flags |= self::IS_SET_BOLD;
5658
+		$this->_flags|=self::IS_SET_BOLD;
5659 5659
 		if(TPropertyValue::ensureBoolean($value))
5660
-			$this->_flags |= self::IS_BOLD;
5660
+			$this->_flags|=self::IS_BOLD;
5661 5661
 		else
5662
-			$this->_flags &= ~self::IS_BOLD;
5662
+			$this->_flags&=~self::IS_BOLD;
5663 5663
 	}
5664 5664
 	public function getItalic()
5665 5665
 	{
@@ -5667,11 +5667,11 @@  discard block
 block discarded – undo
5667 5667
 	}
5668 5668
 	public function setItalic($value)
5669 5669
 	{
5670
-		$this->_flags |= self::IS_SET_ITALIC;
5670
+		$this->_flags|=self::IS_SET_ITALIC;
5671 5671
 		if(TPropertyValue::ensureBoolean($value))
5672
-			$this->_flags |= self::IS_ITALIC;
5672
+			$this->_flags|=self::IS_ITALIC;
5673 5673
 		else
5674
-			$this->_flags &= ~self::IS_ITALIC;
5674
+			$this->_flags&=~self::IS_ITALIC;
5675 5675
 	}
5676 5676
 	public function getOverline()
5677 5677
 	{
@@ -5679,11 +5679,11 @@  discard block
 block discarded – undo
5679 5679
 	}
5680 5680
 	public function setOverline($value)
5681 5681
 	{
5682
-		$this->_flags |= self::IS_SET_OVERLINE;
5682
+		$this->_flags|=self::IS_SET_OVERLINE;
5683 5683
 		if(TPropertyValue::ensureBoolean($value))
5684
-			$this->_flags |= self::IS_OVERLINE;
5684
+			$this->_flags|=self::IS_OVERLINE;
5685 5685
 		else
5686
-			$this->_flags &= ~self::IS_OVERLINE;
5686
+			$this->_flags&=~self::IS_OVERLINE;
5687 5687
 	}
5688 5688
 	public function getSize()
5689 5689
 	{
@@ -5691,7 +5691,7 @@  discard block
 block discarded – undo
5691 5691
 	}
5692 5692
 	public function setSize($value)
5693 5693
 	{
5694
-		$this->_flags |= self::IS_SET_SIZE;
5694
+		$this->_flags|=self::IS_SET_SIZE;
5695 5695
 		$this->_size=$value;
5696 5696
 	}
5697 5697
 	public function getStrikeout()
@@ -5700,11 +5700,11 @@  discard block
 block discarded – undo
5700 5700
 	}
5701 5701
 	public function setStrikeout($value)
5702 5702
 	{
5703
-		$this->_flags |= self::IS_SET_STRIKEOUT;
5703
+		$this->_flags|=self::IS_SET_STRIKEOUT;
5704 5704
 		if(TPropertyValue::ensureBoolean($value))
5705
-			$this->_flags |= self::IS_STRIKEOUT;
5705
+			$this->_flags|=self::IS_STRIKEOUT;
5706 5706
 		else
5707
-			$this->_flags &= ~self::IS_STRIKEOUT;
5707
+			$this->_flags&=~self::IS_STRIKEOUT;
5708 5708
 	}
5709 5709
 	public function getUnderline()
5710 5710
 	{
@@ -5712,11 +5712,11 @@  discard block
 block discarded – undo
5712 5712
 	}
5713 5713
 	public function setUnderline($value)
5714 5714
 	{
5715
-		$this->_flags |= self::IS_SET_UNDERLINE;
5715
+		$this->_flags|=self::IS_SET_UNDERLINE;
5716 5716
 		if(TPropertyValue::ensureBoolean($value))
5717
-			$this->_flags |= self::IS_UNDERLINE;
5717
+			$this->_flags|=self::IS_UNDERLINE;
5718 5718
 		else
5719
-			$this->_flags &= ~self::IS_UNDERLINE;
5719
+			$this->_flags&=~self::IS_UNDERLINE;
5720 5720
 	}
5721 5721
 	public function getName()
5722 5722
 	{
@@ -5724,7 +5724,7 @@  discard block
 block discarded – undo
5724 5724
 	}
5725 5725
 	public function setName($value)
5726 5726
 	{
5727
-		$this->_flags |= self::IS_SET_NAME;
5727
+		$this->_flags|=self::IS_SET_NAME;
5728 5728
 		$this->_name=$value;
5729 5729
 	}
5730 5730
 	public function getIsEmpty()
@@ -5781,9 +5781,9 @@  discard block
 block discarded – undo
5781 5781
 			return '';
5782 5782
 		$str='';
5783 5783
 		if($this->_flags & self::IS_SET_BOLD)
5784
-			$str.='font-weight:'.(($this->_flags & self::IS_BOLD)?'bold;':'normal;');
5784
+			$str.='font-weight:'.(($this->_flags & self::IS_BOLD) ? 'bold;' : 'normal;');
5785 5785
 		if($this->_flags & self::IS_SET_ITALIC)
5786
-			$str.='font-style:'.(($this->_flags & self::IS_ITALIC)?'italic;':'normal;');
5786
+			$str.='font-style:'.(($this->_flags & self::IS_ITALIC) ? 'italic;' : 'normal;');
5787 5787
 		$textDec='';
5788 5788
 		if($this->_flags & self::IS_UNDERLINE)
5789 5789
 			$textDec.='underline';
@@ -5805,9 +5805,9 @@  discard block
 block discarded – undo
5805 5805
 		if($this->_flags===0)
5806 5806
 			return;
5807 5807
 		if($this->_flags & self::IS_SET_BOLD)
5808
-			$writer->addStyleAttribute('font-weight',(($this->_flags & self::IS_BOLD)?'bold':'normal'));
5808
+			$writer->addStyleAttribute('font-weight', (($this->_flags & self::IS_BOLD) ? 'bold' : 'normal'));
5809 5809
 		if($this->_flags & self::IS_SET_ITALIC)
5810
-			$writer->addStyleAttribute('font-style',(($this->_flags & self::IS_ITALIC)?'italic':'normal'));
5810
+			$writer->addStyleAttribute('font-style', (($this->_flags & self::IS_ITALIC) ? 'italic' : 'normal'));
5811 5811
 		$textDec='';
5812 5812
 		if($this->_flags & self::IS_UNDERLINE)
5813 5813
 			$textDec.='underline';
@@ -5817,11 +5817,11 @@  discard block
 block discarded – undo
5817 5817
 			$textDec.=' line-through';
5818 5818
 		$textDec=ltrim($textDec);
5819 5819
 		if($textDec!=='')
5820
-			$writer->addStyleAttribute('text-decoration',$textDec);
5820
+			$writer->addStyleAttribute('text-decoration', $textDec);
5821 5821
 		if($this->_size!=='')
5822
-			$writer->addStyleAttribute('font-size',$this->_size);
5822
+			$writer->addStyleAttribute('font-size', $this->_size);
5823 5823
 		if($this->_name!=='')
5824
-			$writer->addStyleAttribute('font-family',$this->_name);
5824
+			$writer->addStyleAttribute('font-family', $this->_name);
5825 5825
 	}
5826 5826
 }
5827 5827
 class TStyle extends TComponent
@@ -5834,16 +5834,16 @@  discard block
 block discarded – undo
5834 5834
 	protected function _getZappableSleepProps(&$exprops)
5835 5835
 	{
5836 5836
 		parent::_getZappableSleepProps($exprops);
5837
-		if ($this->_fields===array())
5838
-			$exprops[] = "\0TStyle\0_fields";
5837
+		if($this->_fields===array())
5838
+			$exprops[]="\0TStyle\0_fields";
5839 5839
 		if($this->_font===null)
5840
-			$exprops[] = "\0TStyle\0_font";
5840
+			$exprops[]="\0TStyle\0_font";
5841 5841
 		if($this->_class===null)
5842
-			$exprops[] = "\0TStyle\0_class";
5843
-		if ($this->_customStyle===null)
5844
-			$exprops[] = "\0TStyle\0_customStyle";
5845
-		if ($this->_displayStyle==='Fixed')
5846
-			$exprops[] = "\0TStyle\0_displayStyle";
5842
+			$exprops[]="\0TStyle\0_class";
5843
+		if($this->_customStyle===null)
5844
+			$exprops[]="\0TStyle\0_customStyle";
5845
+		if($this->_displayStyle==='Fixed')
5846
+			$exprops[]="\0TStyle\0_displayStyle";
5847 5847
 	}
5848 5848
 	public function __construct($style=null)
5849 5849
 	{
@@ -5853,11 +5853,11 @@  discard block
 block discarded – undo
5853 5853
 	public function __clone()
5854 5854
 	{
5855 5855
 		if($this->_font!==null)
5856
-			$this->_font = clone($this->_font);
5856
+			$this->_font=clone($this->_font);
5857 5857
 	}
5858 5858
 	public function getBackColor()
5859 5859
 	{
5860
-		return isset($this->_fields['background-color'])?$this->_fields['background-color']:'';
5860
+		return isset($this->_fields['background-color']) ? $this->_fields['background-color'] : '';
5861 5861
 	}
5862 5862
 	public function setBackColor($value)
5863 5863
 	{
@@ -5868,7 +5868,7 @@  discard block
 block discarded – undo
5868 5868
 	}
5869 5869
 	public function getBorderColor()
5870 5870
 	{
5871
-		return isset($this->_fields['border-color'])?$this->_fields['border-color']:'';
5871
+		return isset($this->_fields['border-color']) ? $this->_fields['border-color'] : '';
5872 5872
 	}
5873 5873
 	public function setBorderColor($value)
5874 5874
 	{
@@ -5879,7 +5879,7 @@  discard block
 block discarded – undo
5879 5879
 	}
5880 5880
 	public function getBorderStyle()
5881 5881
 	{
5882
-		return isset($this->_fields['border-style'])?$this->_fields['border-style']:'';
5882
+		return isset($this->_fields['border-style']) ? $this->_fields['border-style'] : '';
5883 5883
 	}
5884 5884
 	public function setBorderStyle($value)
5885 5885
 	{
@@ -5890,7 +5890,7 @@  discard block
 block discarded – undo
5890 5890
 	}
5891 5891
 	public function getBorderWidth()
5892 5892
 	{
5893
-		return isset($this->_fields['border-width'])?$this->_fields['border-width']:'';
5893
+		return isset($this->_fields['border-width']) ? $this->_fields['border-width'] : '';
5894 5894
 	}
5895 5895
 	public function setBorderWidth($value)
5896 5896
 	{
@@ -5901,7 +5901,7 @@  discard block
 block discarded – undo
5901 5901
 	}
5902 5902
 	public function getCssClass()
5903 5903
 	{
5904
-		return $this->_class===null?'':$this->_class;
5904
+		return $this->_class===null ? '' : $this->_class;
5905 5905
 	}
5906 5906
 	public function hasCssClass()
5907 5907
 	{
@@ -5919,23 +5919,23 @@  discard block
 block discarded – undo
5919 5919
 	}
5920 5920
 	public function hasFont()
5921 5921
 	{
5922
-		return $this->_font !== null;
5922
+		return $this->_font!==null;
5923 5923
 	}
5924 5924
 	public function setDisplayStyle($value)
5925 5925
 	{
5926
-		$this->_displayStyle = TPropertyValue::ensureEnum($value, 'TDisplayStyle');
5926
+		$this->_displayStyle=TPropertyValue::ensureEnum($value, 'TDisplayStyle');
5927 5927
 		switch($this->_displayStyle)
5928 5928
 		{
5929 5929
 			case TDisplayStyle::None:
5930
-				$this->_fields['display'] = 'none';
5930
+				$this->_fields['display']='none';
5931 5931
 				break;
5932 5932
 			case TDisplayStyle::Dynamic:
5933
-				$this->_fields['display'] = ''; 				break;
5933
+				$this->_fields['display']=''; break;
5934 5934
 			case TDisplayStyle::Fixed:
5935
-				$this->_fields['visibility'] = 'visible';
5935
+				$this->_fields['visibility']='visible';
5936 5936
 				break;
5937 5937
 			case TDisplayStyle::Hidden:
5938
-				$this->_fields['visibility'] = 'hidden';
5938
+				$this->_fields['visibility']='hidden';
5939 5939
 				break;
5940 5940
 		}
5941 5941
 	}
@@ -5945,7 +5945,7 @@  discard block
 block discarded – undo
5945 5945
 	}
5946 5946
 	public function getForeColor()
5947 5947
 	{
5948
-		return isset($this->_fields['color'])?$this->_fields['color']:'';
5948
+		return isset($this->_fields['color']) ? $this->_fields['color'] : '';
5949 5949
 	}
5950 5950
 	public function setForeColor($value)
5951 5951
 	{
@@ -5956,7 +5956,7 @@  discard block
 block discarded – undo
5956 5956
 	}
5957 5957
 	public function getHeight()
5958 5958
 	{
5959
-		return isset($this->_fields['height'])?$this->_fields['height']:'';
5959
+		return isset($this->_fields['height']) ? $this->_fields['height'] : '';
5960 5960
 	}
5961 5961
 	public function setHeight($value)
5962 5962
 	{
@@ -5967,7 +5967,7 @@  discard block
 block discarded – undo
5967 5967
 	}
5968 5968
 	public function getCustomStyle()
5969 5969
 	{
5970
-		return $this->_customStyle===null?'':$this->_customStyle;
5970
+		return $this->_customStyle===null ? '' : $this->_customStyle;
5971 5971
 	}
5972 5972
 	public function setCustomStyle($value)
5973 5973
 	{
@@ -5975,9 +5975,9 @@  discard block
 block discarded – undo
5975 5975
 	}
5976 5976
 	public function getStyleField($name)
5977 5977
 	{
5978
-		return isset($this->_fields[$name])?$this->_fields[$name]:'';
5978
+		return isset($this->_fields[$name]) ? $this->_fields[$name] : '';
5979 5979
 	}
5980
-	public function setStyleField($name,$value)
5980
+	public function setStyleField($name, $value)
5981 5981
 	{
5982 5982
 		$this->_fields[$name]=$value;
5983 5983
 	}
@@ -5991,7 +5991,7 @@  discard block
 block discarded – undo
5991 5991
 	}
5992 5992
 	public function getWidth()
5993 5993
 	{
5994
-		return isset($this->_fields['width'])?$this->_fields['width']:'';
5994
+		return isset($this->_fields['width']) ? $this->_fields['width'] : '';
5995 5995
 	}
5996 5996
 	public function setWidth($value)
5997 5997
 	{
@@ -6008,7 +6008,7 @@  discard block
 block discarded – undo
6008 6008
 	{
6009 6009
 		if($style instanceof TStyle)
6010 6010
 		{
6011
-			$this->_fields=array_merge($this->_fields,$style->_fields);
6011
+			$this->_fields=array_merge($this->_fields, $style->_fields);
6012 6012
 			if($style->_class!==null)
6013 6013
 				$this->_class=$style->_class;
6014 6014
 			if($style->_customStyle!==null)
@@ -6021,7 +6021,7 @@  discard block
 block discarded – undo
6021 6021
 	{
6022 6022
 		if($style instanceof TStyle)
6023 6023
 		{
6024
-			$this->_fields=array_merge($style->_fields,$this->_fields);
6024
+			$this->_fields=array_merge($style->_fields, $this->_fields);
6025 6025
 			if($this->_class===null)
6026 6026
 				$this->_class=$style->_class;
6027 6027
 			if($this->_customStyle===null)
@@ -6034,18 +6034,18 @@  discard block
 block discarded – undo
6034 6034
 	{
6035 6035
 		if($this->_customStyle!==null)
6036 6036
 		{
6037
-			foreach(explode(';',$this->_customStyle) as $style)
6037
+			foreach(explode(';', $this->_customStyle) as $style)
6038 6038
 			{
6039
-				$arr=explode(':',$style,2);
6039
+				$arr=explode(':', $style, 2);
6040 6040
 				if(isset($arr[1]) && trim($arr[0])!=='')
6041
-					$writer->addStyleAttribute(trim($arr[0]),trim($arr[1]));
6041
+					$writer->addStyleAttribute(trim($arr[0]), trim($arr[1]));
6042 6042
 			}
6043 6043
 		}
6044 6044
 		$writer->addStyleAttributes($this->_fields);
6045 6045
 		if($this->_font!==null)
6046 6046
 			$this->_font->addAttributesToRender($writer);
6047 6047
 		if($this->_class!==null)
6048
-			$writer->addAttribute('class',$this->_class);
6048
+			$writer->addAttribute('class', $this->_class);
6049 6049
 	}
6050 6050
 	public function getStyleFields()
6051 6051
 	{
@@ -6070,18 +6070,18 @@  discard block
 block discarded – undo
6070 6070
 	protected function _getZappableSleepProps(&$exprops)
6071 6071
 	{
6072 6072
 		parent::_getZappableSleepProps($exprops);
6073
-		if ($this->_backImageUrl===null)
6074
-			$exprops[] = "\0TTableStyle\0_backImageUrl";
6075
-		if ($this->_horizontalAlign===null)
6076
-			$exprops[] = "\0TTableStyle\0_horizontalAlign";
6077
-		if ($this->_cellPadding===null)
6078
-			$exprops[] = "\0TTableStyle\0_cellPadding";
6079
-		if ($this->_cellSpacing===null)
6080
-			$exprops[] = "\0TTableStyle\0_cellSpacing";
6081
-		if ($this->_gridLines===null)
6082
-			$exprops[] = "\0TTableStyle\0_gridLines";
6083
-		if ($this->_borderCollapse===null)
6084
-			$exprops[] = "\0TTableStyle\0_borderCollapse";
6073
+		if($this->_backImageUrl===null)
6074
+			$exprops[]="\0TTableStyle\0_backImageUrl";
6075
+		if($this->_horizontalAlign===null)
6076
+			$exprops[]="\0TTableStyle\0_horizontalAlign";
6077
+		if($this->_cellPadding===null)
6078
+			$exprops[]="\0TTableStyle\0_cellPadding";
6079
+		if($this->_cellSpacing===null)
6080
+			$exprops[]="\0TTableStyle\0_cellSpacing";
6081
+		if($this->_gridLines===null)
6082
+			$exprops[]="\0TTableStyle\0_gridLines";
6083
+		if($this->_borderCollapse===null)
6084
+			$exprops[]="\0TTableStyle\0_borderCollapse";
6085 6085
 	}
6086 6086
 	public function reset()
6087 6087
 	{
@@ -6133,26 +6133,26 @@  discard block
 block discarded – undo
6133 6133
 	public function addAttributesToRender($writer)
6134 6134
 	{
6135 6135
 		if(($url=trim($this->getBackImageUrl()))!=='')
6136
-			$writer->addStyleAttribute('background-image','url('.$url.')');
6136
+			$writer->addStyleAttribute('background-image', 'url('.$url.')');
6137 6137
 		if(($horizontalAlign=$this->getHorizontalAlign())!==THorizontalAlign::NotSet)
6138
-			$writer->addStyleAttribute('text-align',strtolower($horizontalAlign));
6139
-		if(($cellPadding=$this->getCellPadding())>=0)
6140
-			$writer->addAttribute('cellpadding',"$cellPadding");
6141
-		if(($cellSpacing=$this->getCellSpacing())>=0)
6142
-			$writer->addAttribute('cellspacing',"$cellSpacing");
6138
+			$writer->addStyleAttribute('text-align', strtolower($horizontalAlign));
6139
+		if(($cellPadding=$this->getCellPadding()) >= 0)
6140
+			$writer->addAttribute('cellpadding', "$cellPadding");
6141
+		if(($cellSpacing=$this->getCellSpacing()) >= 0)
6142
+			$writer->addAttribute('cellspacing', "$cellSpacing");
6143 6143
 		if($this->getBorderCollapse())
6144
-			$writer->addStyleAttribute('border-collapse','collapse');
6144
+			$writer->addStyleAttribute('border-collapse', 'collapse');
6145 6145
 		switch($this->getGridLines())
6146 6146
 		{
6147
-			case TTableGridLines::Horizontal : $writer->addAttribute('rules','rows'); break;
6148
-			case TTableGridLines::Vertical : $writer->addAttribute('rules','cols'); break;
6149
-			case TTableGridLines::Both : $writer->addAttribute('rules','all'); break;
6147
+			case TTableGridLines::Horizontal : $writer->addAttribute('rules', 'rows'); break;
6148
+			case TTableGridLines::Vertical : $writer->addAttribute('rules', 'cols'); break;
6149
+			case TTableGridLines::Both : $writer->addAttribute('rules', 'all'); break;
6150 6150
 		}
6151 6151
 		parent::addAttributesToRender($writer);
6152 6152
 	}
6153 6153
 	public function getBackImageUrl()
6154 6154
 	{
6155
-		return $this->_backImageUrl===null?'':$this->_backImageUrl;
6155
+		return $this->_backImageUrl===null ? '' : $this->_backImageUrl;
6156 6156
 	}
6157 6157
 	public function setBackImageUrl($value)
6158 6158
 	{
@@ -6160,41 +6160,41 @@  discard block
 block discarded – undo
6160 6160
 	}
6161 6161
 	public function getHorizontalAlign()
6162 6162
 	{
6163
-		return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign;
6163
+		return $this->_horizontalAlign===null ? THorizontalAlign::NotSet : $this->_horizontalAlign;
6164 6164
 	}
6165 6165
 	public function setHorizontalAlign($value)
6166 6166
 	{
6167
-		$this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign');
6167
+		$this->_horizontalAlign=TPropertyValue::ensureEnum($value, 'THorizontalAlign');
6168 6168
 	}
6169 6169
 	public function getCellPadding()
6170 6170
 	{
6171
-		return $this->_cellPadding===null?-1:$this->_cellPadding;
6171
+		return $this->_cellPadding===null ?-1 : $this->_cellPadding;
6172 6172
 	}
6173 6173
 	public function setCellPadding($value)
6174 6174
 	{
6175
-		if(($this->_cellPadding=TPropertyValue::ensureInteger($value))<-1)
6175
+		if(($this->_cellPadding=TPropertyValue::ensureInteger($value)) < -1)
6176 6176
 			throw new TInvalidDataValueException('tablestyle_cellpadding_invalid');
6177 6177
 	}
6178 6178
 	public function getCellSpacing()
6179 6179
 	{
6180
-		return $this->_cellSpacing===null?-1:$this->_cellSpacing;
6180
+		return $this->_cellSpacing===null ?-1 : $this->_cellSpacing;
6181 6181
 	}
6182 6182
 	public function setCellSpacing($value)
6183 6183
 	{
6184
-		if(($this->_cellSpacing=TPropertyValue::ensureInteger($value))<-1)
6184
+		if(($this->_cellSpacing=TPropertyValue::ensureInteger($value)) < -1)
6185 6185
 			throw new TInvalidDataValueException('tablestyle_cellspacing_invalid');
6186 6186
 	}
6187 6187
 	public function getGridLines()
6188 6188
 	{
6189
-		return $this->_gridLines===null?TTableGridLines::None:$this->_gridLines;
6189
+		return $this->_gridLines===null ? TTableGridLines::None : $this->_gridLines;
6190 6190
 	}
6191 6191
 	public function setGridLines($value)
6192 6192
 	{
6193
-		$this->_gridLines=TPropertyValue::ensureEnum($value,'TTableGridLines');
6193
+		$this->_gridLines=TPropertyValue::ensureEnum($value, 'TTableGridLines');
6194 6194
 	}
6195 6195
 	public function getBorderCollapse()
6196 6196
 	{
6197
-		return $this->_borderCollapse===null?false:$this->_borderCollapse;
6197
+		return $this->_borderCollapse===null ? false : $this->_borderCollapse;
6198 6198
 	}
6199 6199
 	public function setBorderCollapse($value)
6200 6200
 	{
@@ -6209,12 +6209,12 @@  discard block
 block discarded – undo
6209 6209
 	protected function _getZappableSleepProps(&$exprops)
6210 6210
 	{
6211 6211
 		parent::_getZappableSleepProps($exprops);
6212
-		if ($this->_horizontalAlign===null)
6213
-			$exprops[] = "\0TTableItemStyle\0_horizontalAlign";
6214
-		if ($this->_verticalAlign===null)
6215
-			$exprops[] = "\0TTableItemStyle\0_verticalAlign";
6216
-		if ($this->_wrap===null)
6217
-			$exprops[] = "\0TTableItemStyle\0_wrap";
6212
+		if($this->_horizontalAlign===null)
6213
+			$exprops[]="\0TTableItemStyle\0_horizontalAlign";
6214
+		if($this->_verticalAlign===null)
6215
+			$exprops[]="\0TTableItemStyle\0_verticalAlign";
6216
+		if($this->_wrap===null)
6217
+			$exprops[]="\0TTableItemStyle\0_wrap";
6218 6218
 	}
6219 6219
 	public function reset()
6220 6220
 	{
@@ -6252,32 +6252,32 @@  discard block
 block discarded – undo
6252 6252
 	public function addAttributesToRender($writer)
6253 6253
 	{
6254 6254
 		if(!$this->getWrap())
6255
-			$writer->addStyleAttribute('white-space','nowrap');
6255
+			$writer->addStyleAttribute('white-space', 'nowrap');
6256 6256
 		if(($horizontalAlign=$this->getHorizontalAlign())!==THorizontalAlign::NotSet)
6257
-			$writer->addAttribute('align',strtolower($horizontalAlign));
6257
+			$writer->addAttribute('align', strtolower($horizontalAlign));
6258 6258
 		if(($verticalAlign=$this->getVerticalAlign())!==TVerticalAlign::NotSet)
6259
-			$writer->addAttribute('valign',strtolower($verticalAlign));
6259
+			$writer->addAttribute('valign', strtolower($verticalAlign));
6260 6260
 		parent::addAttributesToRender($writer);
6261 6261
 	}
6262 6262
 	public function getHorizontalAlign()
6263 6263
 	{
6264
-		return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign;
6264
+		return $this->_horizontalAlign===null ? THorizontalAlign::NotSet : $this->_horizontalAlign;
6265 6265
 	}
6266 6266
 	public function setHorizontalAlign($value)
6267 6267
 	{
6268
-		$this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign');
6268
+		$this->_horizontalAlign=TPropertyValue::ensureEnum($value, 'THorizontalAlign');
6269 6269
 	}
6270 6270
 	public function getVerticalAlign()
6271 6271
 	{
6272
-		return $this->_verticalAlign===null?TVerticalAlign::NotSet:$this->_verticalAlign;
6272
+		return $this->_verticalAlign===null ? TVerticalAlign::NotSet : $this->_verticalAlign;
6273 6273
 	}
6274 6274
 	public function setVerticalAlign($value)
6275 6275
 	{
6276
-		$this->_verticalAlign=TPropertyValue::ensureEnum($value,'TVerticalAlign');
6276
+		$this->_verticalAlign=TPropertyValue::ensureEnum($value, 'TVerticalAlign');
6277 6277
 	}
6278 6278
 	public function getWrap()
6279 6279
 	{
6280
-		return $this->_wrap===null?true:$this->_wrap;
6280
+		return $this->_wrap===null ? true : $this->_wrap;
6281 6281
 	}
6282 6282
 	public function setWrap($value)
6283 6283
 	{
@@ -6329,21 +6329,21 @@  discard block
 block discarded – undo
6329 6329
 }
6330 6330
 class TWebControlDecorator extends TComponent {
6331 6331
 	private $_internalonly;
6332
-	private $_usestate = false;
6332
+	private $_usestate=false;
6333 6333
 	private $_control;
6334 6334
 	private $_outercontrol;
6335 6335
 	private $_addedTemplateDecoration=false;
6336
-	private $_pretagtext = '';
6337
-	private $_precontentstext = '';
6338
-	private $_postcontentstext = '';
6339
-	private $_posttagtext = '';
6336
+	private $_pretagtext='';
6337
+	private $_precontentstext='';
6338
+	private $_postcontentstext='';
6339
+	private $_posttagtext='';
6340 6340
 	private $_pretagtemplate;
6341 6341
 	private $_precontentstemplate;
6342 6342
 	private $_postcontentstemplate;
6343 6343
 	private $_posttagtemplate;
6344
-	public function __construct($control, $onlyinternal = false) {
6345
-		$this->_control = $control;
6346
-		$this->_internalonly = $onlyinternal;
6344
+	public function __construct($control, $onlyinternal=false) {
6345
+		$this->_control=$control;
6346
+		$this->_internalonly=$onlyinternal;
6347 6347
 	}
6348 6348
 	public function getUseState()
6349 6349
 	{
@@ -6351,91 +6351,91 @@  discard block
 block discarded – undo
6351 6351
 	}
6352 6352
 	public function setUseState($value)
6353 6353
 	{
6354
-		$this->_usestate = TPropertyValue::ensureBoolean($value);
6354
+		$this->_usestate=TPropertyValue::ensureBoolean($value);
6355 6355
 	}
6356 6356
 	public function getPreTagText() {
6357 6357
 		return $this->_pretagtext;
6358 6358
 	}
6359 6359
 	public function setPreTagText($value) {
6360 6360
 		if(!$this->_internalonly && !$this->_control->getIsSkinApplied())
6361
-			$this->_pretagtext = TPropertyValue::ensureString($value);
6361
+			$this->_pretagtext=TPropertyValue::ensureString($value);
6362 6362
 	}
6363 6363
 	public function getPreContentsText() {
6364 6364
 		return $this->_precontentstext;
6365 6365
 	}
6366 6366
 	public function setPreContentsText($value) {
6367 6367
 		if(!$this->_control->getIsSkinApplied())
6368
-			$this->_precontentstext = TPropertyValue::ensureString($value);
6368
+			$this->_precontentstext=TPropertyValue::ensureString($value);
6369 6369
 	}
6370 6370
 	public function getPostContentsText() {
6371 6371
 		return $this->_postcontentstext;
6372 6372
 	}
6373 6373
 	public function setPostContentsText($value) {
6374 6374
 		if(!$this->_control->getIsSkinApplied())
6375
-			$this->_postcontentstext = TPropertyValue::ensureString($value);
6375
+			$this->_postcontentstext=TPropertyValue::ensureString($value);
6376 6376
 	}
6377 6377
 	public function getPostTagText() {
6378 6378
 		return $this->_posttagtext;
6379 6379
 	}
6380 6380
 	public function setPostTagText($value) {
6381 6381
 		if(!$this->_internalonly && !$this->_control->getIsSkinApplied())
6382
-			$this->_posttagtext = TPropertyValue::ensureString($value);
6382
+			$this->_posttagtext=TPropertyValue::ensureString($value);
6383 6383
 	}
6384 6384
 	public function getPreTagTemplate() {
6385 6385
 		return $this->_pretagtemplate;
6386 6386
 	}
6387 6387
 	public function setPreTagTemplate($value) {
6388 6388
 		if(!$this->_internalonly && !$this->_control->getIsSkinApplied())
6389
-			$this->_pretagtemplate = $value;
6389
+			$this->_pretagtemplate=$value;
6390 6390
 	}
6391 6391
 	public function getPreContentsTemplate() {
6392 6392
 		return $this->_precontentstemplate;
6393 6393
 	}
6394 6394
 	public function setPreContentsTemplate($value) {
6395 6395
 		if(!$this->_control->getIsSkinApplied())
6396
-			$this->_precontentstemplate = $value;
6396
+			$this->_precontentstemplate=$value;
6397 6397
 	}
6398 6398
 	public function getPostContentsTemplate() {
6399 6399
 		return $this->_postcontentstemplate;
6400 6400
 	}
6401 6401
 	public function setPostContentsTemplate($value) {
6402 6402
 		if(!$this->_control->getIsSkinApplied())
6403
-			$this->_postcontentstemplate = $value;
6403
+			$this->_postcontentstemplate=$value;
6404 6404
 	}
6405 6405
 	public function getPostTagTemplate() {
6406 6406
 		return $this->_posttagtemplate;
6407 6407
 	}
6408 6408
 	public function setPostTagTemplate($value) {
6409 6409
 		if(!$this->_internalonly && !$this->_control->getIsSkinApplied())
6410
-			$this->_posttagtemplate = $value;
6410
+			$this->_posttagtemplate=$value;
6411 6411
 	}
6412
-	public function instantiate($outercontrol = null) {
6412
+	public function instantiate($outercontrol=null) {
6413 6413
 		if($this->getPreTagTemplate() || $this->getPreContentsTemplate() ||
6414 6414
 			$this->getPostContentsTemplate() || $this->getPostTagTemplate()) {
6415
-			$this->_outercontrol = $outercontrol;
6415
+			$this->_outercontrol=$outercontrol;
6416 6416
 			if($this->getUseState())
6417 6417
 				$this->ensureTemplateDecoration();
6418 6418
 			else
6419
-				$this->_control->getPage()->onSaveStateComplete[] = array($this, 'ensureTemplateDecoration');
6419
+				$this->_control->getPage()->onSaveStateComplete[]=array($this, 'ensureTemplateDecoration');
6420 6420
 		}
6421 6421
 	}
6422 6422
 	public function ensureTemplateDecoration($sender=null, $param=null) {
6423
-		$control = $this->_control;
6424
-		$outercontrol = $this->_outercontrol;
6425
-		if($outercontrol === null)
6426
-			$outercontrol = $control;
6423
+		$control=$this->_control;
6424
+		$outercontrol=$this->_outercontrol;
6425
+		if($outercontrol===null)
6426
+			$outercontrol=$control;
6427 6427
 		if($this->_addedTemplateDecoration)
6428 6428
 			return $this->_addedTemplateDecoration;
6429
-		$this->_addedTemplateDecoration = true;
6429
+		$this->_addedTemplateDecoration=true;
6430 6430
 		if($this->getPreContentsTemplate())
6431 6431
 		{
6432
-			$precontents = Prado::createComponent('TCompositeControl');
6432
+			$precontents=Prado::createComponent('TCompositeControl');
6433 6433
 			$this->getPreContentsTemplate()->instantiateIn($precontents);
6434 6434
 			$control->getControls()->insertAt(0, $precontents);
6435 6435
 		}
6436 6436
 		if($this->getPostContentsTemplate())
6437 6437
 		{
6438
-			$postcontents = Prado::createComponent('TCompositeControl');
6438
+			$postcontents=Prado::createComponent('TCompositeControl');
6439 6439
 			$this->getPostContentsTemplate()->instantiateIn($postcontents);
6440 6440
 			$control->getControls()->add($postcontents);
6441 6441
 		}
@@ -6443,13 +6443,13 @@  discard block
 block discarded – undo
6443 6443
 			return $this->_addedTemplateDecoration;
6444 6444
 		if($this->getPreTagTemplate())
6445 6445
 		{
6446
-			$pretag = Prado::createComponent('TCompositeControl');
6446
+			$pretag=Prado::createComponent('TCompositeControl');
6447 6447
 			$this->getPreTagTemplate()->instantiateIn($pretag);
6448 6448
 			$outercontrol->getParent()->getControls()->insertBefore($outercontrol, $pretag);
6449 6449
 		}
6450 6450
 		if($this->getPostTagTemplate())
6451 6451
 		{
6452
-			$posttag = Prado::createComponent('TCompositeControl');
6452
+			$posttag=Prado::createComponent('TCompositeControl');
6453 6453
 			$this->getPostTagTemplate()->instantiateIn($posttag);
6454 6454
 			$outercontrol->getParent()->getControls()->insertAfter($outercontrol, $posttag);
6455 6455
 		}
@@ -6474,7 +6474,7 @@  discard block
 block discarded – undo
6474 6474
 	protected $_decorator;
6475 6475
 	public function setEnsureId($value)
6476 6476
 	{
6477
-		$this->_ensureid |= TPropertyValue::ensureBoolean($value);
6477
+		$this->_ensureid|=TPropertyValue::ensureBoolean($value);
6478 6478
 	}
6479 6479
 	public function getEnsureId()
6480 6480
 	{
@@ -6483,7 +6483,7 @@  discard block
 block discarded – undo
6483 6483
 	public function getDecorator($create=true)
6484 6484
 	{
6485 6485
 		if($create && !$this->_decorator)
6486
-			$this->_decorator = Prado::createComponent('TWebControlDecorator', $this);
6486
+			$this->_decorator=Prado::createComponent('TWebControlDecorator', $this);
6487 6487
 		return $this->_decorator;
6488 6488
 	}
6489 6489
 	public function copyBaseAttributes(TWebControl $control)
@@ -6498,17 +6498,17 @@  discard block
 block discarded – undo
6498 6498
 	}
6499 6499
 	public function getAccessKey()
6500 6500
 	{
6501
-		return $this->getViewState('AccessKey','');
6501
+		return $this->getViewState('AccessKey', '');
6502 6502
 	}
6503 6503
 	public function setAccessKey($value)
6504 6504
 	{
6505
-		if(strlen($value)>1)
6506
-			throw new TInvalidDataValueException('webcontrol_accesskey_invalid',get_class($this),$value);
6507
-		$this->setViewState('AccessKey',$value,'');
6505
+		if(strlen($value) > 1)
6506
+			throw new TInvalidDataValueException('webcontrol_accesskey_invalid', get_class($this), $value);
6507
+		$this->setViewState('AccessKey', $value, '');
6508 6508
 	}
6509 6509
 	public function getBackColor()
6510 6510
 	{
6511
-		if($style=$this->getViewState('Style',null))
6511
+		if($style=$this->getViewState('Style', null))
6512 6512
 			return $style->getBackColor();
6513 6513
 		else
6514 6514
 			return '';
@@ -6519,7 +6519,7 @@  discard block
 block discarded – undo
6519 6519
 	}
6520 6520
 	public function getBorderColor()
6521 6521
 	{
6522
-		if($style=$this->getViewState('Style',null))
6522
+		if($style=$this->getViewState('Style', null))
6523 6523
 			return $style->getBorderColor();
6524 6524
 		else
6525 6525
 			return '';
@@ -6530,7 +6530,7 @@  discard block
 block discarded – undo
6530 6530
 	}
6531 6531
 	public function getBorderStyle()
6532 6532
 	{
6533
-		if($style=$this->getViewState('Style',null))
6533
+		if($style=$this->getViewState('Style', null))
6534 6534
 			return $style->getBorderStyle();
6535 6535
 		else
6536 6536
 			return '';
@@ -6541,7 +6541,7 @@  discard block
 block discarded – undo
6541 6541
 	}
6542 6542
 	public function getBorderWidth()
6543 6543
 	{
6544
-		if($style=$this->getViewState('Style',null))
6544
+		if($style=$this->getViewState('Style', null))
6545 6545
 			return $style->getBorderWidth();
6546 6546
 		else
6547 6547
 			return '';
@@ -6556,7 +6556,7 @@  discard block
 block discarded – undo
6556 6556
 	}
6557 6557
 	public function getForeColor()
6558 6558
 	{
6559
-		if($style=$this->getViewState('Style',null))
6559
+		if($style=$this->getViewState('Style', null))
6560 6560
 			return $style->getForeColor();
6561 6561
 		else
6562 6562
 			return '';
@@ -6567,7 +6567,7 @@  discard block
 block discarded – undo
6567 6567
 	}
6568 6568
 	public function getHeight()
6569 6569
 	{
6570
-		if($style=$this->getViewState('Style',null))
6570
+		if($style=$this->getViewState('Style', null))
6571 6571
 			return $style->getHeight();
6572 6572
 		else
6573 6573
 			return '';
@@ -6586,7 +6586,7 @@  discard block
 block discarded – undo
6586 6586
 	}
6587 6587
 	public function getCssClass()
6588 6588
 	{
6589
-		if($style=$this->getViewState('Style',null))
6589
+		if($style=$this->getViewState('Style', null))
6590 6590
 			return $style->getCssClass();
6591 6591
 		else
6592 6592
 			return '';
@@ -6597,7 +6597,7 @@  discard block
 block discarded – undo
6597 6597
 	}
6598 6598
 	public function getHasStyle()
6599 6599
 	{
6600
-		return $this->getViewState('Style',null)!==null;
6600
+		return $this->getViewState('Style', null)!==null;
6601 6601
 	}
6602 6602
 	protected function createStyle()
6603 6603
 	{
@@ -6605,12 +6605,12 @@  discard block
 block discarded – undo
6605 6605
 	}
6606 6606
 	public function getStyle()
6607 6607
 	{
6608
-		if($style=$this->getViewState('Style',null))
6608
+		if($style=$this->getViewState('Style', null))
6609 6609
 			return $style;
6610 6610
 		else
6611 6611
 		{
6612 6612
 			$style=$this->createStyle();
6613
-			$this->setViewState('Style',$style,null);
6613
+			$this->setViewState('Style', $style, null);
6614 6614
 			return $style;
6615 6615
 		}
6616 6616
 	}
@@ -6619,7 +6619,7 @@  discard block
 block discarded – undo
6619 6619
 		if(is_string($value))
6620 6620
 			$this->getStyle()->setCustomStyle($value);
6621 6621
 		else
6622
-			throw new TInvalidDataValueException('webcontrol_style_invalid',get_class($this));
6622
+			throw new TInvalidDataValueException('webcontrol_style_invalid', get_class($this));
6623 6623
 	}
6624 6624
 	public function clearStyle()
6625 6625
 	{
@@ -6627,11 +6627,11 @@  discard block
 block discarded – undo
6627 6627
 	}
6628 6628
 	public function getTabIndex()
6629 6629
 	{
6630
-		return $this->getViewState('TabIndex',0);
6630
+		return $this->getViewState('TabIndex', 0);
6631 6631
 	}
6632 6632
 	public function setTabIndex($value)
6633 6633
 	{
6634
-		$this->setViewState('TabIndex',TPropertyValue::ensureInteger($value),0);
6634
+		$this->setViewState('TabIndex', TPropertyValue::ensureInteger($value), 0);
6635 6635
 	}
6636 6636
 	protected function getTagName()
6637 6637
 	{
@@ -6639,15 +6639,15 @@  discard block
 block discarded – undo
6639 6639
 	}
6640 6640
 	public function getToolTip()
6641 6641
 	{
6642
-		return $this->getViewState('ToolTip','');
6642
+		return $this->getViewState('ToolTip', '');
6643 6643
 	}
6644 6644
 	public function setToolTip($value)
6645 6645
 	{
6646
-		$this->setViewState('ToolTip',$value,'');
6646
+		$this->setViewState('ToolTip', $value, '');
6647 6647
 	}
6648 6648
 	public function getWidth()
6649 6649
 	{
6650
-		if($style=$this->getViewState('Style',null))
6650
+		if($style=$this->getViewState('Style', null))
6651 6651
 			return $style->getWidth();
6652 6652
 		else
6653 6653
 			return '';
@@ -6657,28 +6657,28 @@  discard block
 block discarded – undo
6657 6657
 		$this->getStyle()->setWidth($value);
6658 6658
 	}
6659 6659
 	public function onPreRender($param) {
6660
-		if($decorator = $this->getDecorator(false))
6660
+		if($decorator=$this->getDecorator(false))
6661 6661
 			$decorator->instantiate();
6662 6662
 		parent::onPreRender($param);
6663 6663
 	}
6664 6664
 	protected function addAttributesToRender($writer)
6665 6665
 	{
6666 6666
 		if($this->getID()!=='' || $this->getEnsureId())
6667
-			$writer->addAttribute('id',$this->getClientID());
6667
+			$writer->addAttribute('id', $this->getClientID());
6668 6668
 		if(($accessKey=$this->getAccessKey())!=='')
6669
-			$writer->addAttribute('accesskey',$accessKey);
6669
+			$writer->addAttribute('accesskey', $accessKey);
6670 6670
 		if(!$this->getEnabled())
6671
-			$writer->addAttribute('disabled','disabled');
6672
-		if(($tabIndex=$this->getTabIndex())>0)
6673
-			$writer->addAttribute('tabindex',"$tabIndex");
6671
+			$writer->addAttribute('disabled', 'disabled');
6672
+		if(($tabIndex=$this->getTabIndex()) > 0)
6673
+			$writer->addAttribute('tabindex', "$tabIndex");
6674 6674
 		if(($toolTip=$this->getToolTip())!=='')
6675
-			$writer->addAttribute('title',$toolTip);
6676
-		if($style=$this->getViewState('Style',null))
6675
+			$writer->addAttribute('title', $toolTip);
6676
+		if($style=$this->getViewState('Style', null))
6677 6677
 			$style->addAttributesToRender($writer);
6678 6678
 		if($this->getHasAttributes())
6679 6679
 		{
6680 6680
 			foreach($this->getAttributes() as $name=>$value)
6681
-				$writer->addAttribute($name,$value);
6681
+				$writer->addAttribute($name, $value);
6682 6682
 		}
6683 6683
 	}
6684 6684
 	public function render($writer)
@@ -6689,7 +6689,7 @@  discard block
 block discarded – undo
6689 6689
 	}
6690 6690
 	public function renderBeginTag($writer)
6691 6691
 	{
6692
-		if($decorator = $this->getDecorator(false)) {
6692
+		if($decorator=$this->getDecorator(false)) {
6693 6693
 			$decorator->renderPreTagText($writer);
6694 6694
 			$this->addAttributesToRender($writer);
6695 6695
 			$writer->renderBeginTag($this->getTagName());
@@ -6705,7 +6705,7 @@  discard block
 block discarded – undo
6705 6705
 	}
6706 6706
 	public function renderEndTag($writer)
6707 6707
 	{
6708
-		if($decorator = $this->getDecorator(false)) {
6708
+		if($decorator=$this->getDecorator(false)) {
6709 6709
 			$decorator->renderPostContentsText($writer);
6710 6710
 			$writer->renderEndTag();
6711 6711
 			$decorator->renderPostTagText($writer);
@@ -6772,24 +6772,24 @@  discard block
 block discarded – undo
6772 6772
 			foreach($tpl->getDirective() as $name=>$value)
6773 6773
 			{
6774 6774
 				if(is_string($value))
6775
-					$this->setSubProperty($name,$value);
6775
+					$this->setSubProperty($name, $value);
6776 6776
 				else
6777
-					throw new TConfigurationException('templatecontrol_directive_invalid',get_class($this),$name);
6777
+					throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name);
6778 6778
 			}
6779 6779
 			$tpl->instantiateIn($this);
6780 6780
 		}
6781 6781
 	}
6782
-	public function registerContent($id,TContent $object)
6782
+	public function registerContent($id, TContent $object)
6783 6783
 	{
6784 6784
 		if(isset($this->_contents[$id]))
6785
-			throw new TConfigurationException('templatecontrol_contentid_duplicated',$id);
6785
+			throw new TConfigurationException('templatecontrol_contentid_duplicated', $id);
6786 6786
 		else
6787 6787
 			$this->_contents[$id]=$object;
6788 6788
 	}
6789
-	public function registerContentPlaceHolder($id,TContentPlaceHolder $object)
6789
+	public function registerContentPlaceHolder($id, TContentPlaceHolder $object)
6790 6790
 	{
6791 6791
 		if(isset($this->_placeholders[$id]))
6792
-			throw new TConfigurationException('templatecontrol_placeholderid_duplicated',$id);
6792
+			throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id);
6793 6793
 		else
6794 6794
 			$this->_placeholders[$id]=$object;
6795 6795
 	}
@@ -6805,17 +6805,17 @@  discard block
 block discarded – undo
6805 6805
 	{
6806 6806
 		return $this->_master;
6807 6807
 	}
6808
-	public function injectContent($id,$content)
6808
+	public function injectContent($id, $content)
6809 6809
 	{
6810 6810
 		if(isset($this->_placeholders[$id]))
6811 6811
 		{
6812 6812
 			$placeholder=$this->_placeholders[$id];
6813 6813
 			$controls=$placeholder->getParent()->getControls();
6814 6814
 			$loc=$controls->remove($placeholder);
6815
-			$controls->insertAt($loc,$content);
6815
+			$controls->insertAt($loc, $content);
6816 6816
 		}
6817 6817
 		else
6818
-			throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id);
6818
+			throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id);
6819 6819
 	}
6820 6820
 	protected function initRecursive($namingContainer=null)
6821 6821
 	{
@@ -6830,44 +6830,44 @@  discard block
 block discarded – undo
6830 6830
 			$this->getControls()->add($master);
6831 6831
 			$master->ensureChildControls();
6832 6832
 			foreach($this->_contents as $id=>$content)
6833
-				$master->injectContent($id,$content);
6833
+				$master->injectContent($id, $content);
6834 6834
 		}
6835 6835
 		else if(!empty($this->_contents))
6836
-			throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this));
6836
+			throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this));
6837 6837
 		parent::initRecursive($namingContainer);
6838 6838
 	}
6839
-        public function tryToUpdateView($arObj, $throwExceptions = false)
6839
+        public function tryToUpdateView($arObj, $throwExceptions=false)
6840 6840
         {
6841
-                $objAttrs = get_class_vars(get_class($arObj));
6842
-                foreach (array_keys($objAttrs) as $key)
6841
+                $objAttrs=get_class_vars(get_class($arObj));
6842
+                foreach(array_keys($objAttrs) as $key)
6843 6843
                 {
6844 6844
                         try
6845 6845
                         {
6846
-                                if ($key != "RELATIONS")
6846
+                                if($key!="RELATIONS")
6847 6847
                                 {
6848
-                                        $control = $this->{$key};
6849
-                                        if ($control instanceof TTextBox)
6850
-                                                $control->Text = $arObj->{$key};
6851
-                                        elseif ($control instanceof TCheckBox)
6852
-                                                $control->Checked = (boolean) $arObj->{$key};
6853
-                                        elseif ($control instanceof TDatePicker)
6854
-                                                $control->Date = $arObj->{$key};
6848
+                                        $control=$this->{$key};
6849
+                                        if($control instanceof TTextBox)
6850
+                                                $control->Text=$arObj->{$key};
6851
+                                        elseif($control instanceof TCheckBox)
6852
+                                                $control->Checked=(boolean) $arObj->{$key};
6853
+                                        elseif($control instanceof TDatePicker)
6854
+                                                $control->Date=$arObj->{$key};
6855 6855
                                 }
6856 6856
                                 else
6857 6857
                                 {
6858
-                                        foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
6858
+                                        foreach($objAttrs["RELATIONS"] as $relKey => $relValues)
6859 6859
                                         {
6860
-                                                $relControl = $this->{$relKey};
6861
-                                                switch ($relValues[0])
6860
+                                                $relControl=$this->{$relKey};
6861
+                                                switch($relValues[0])
6862 6862
                                                 {
6863 6863
                                                         case TActiveRecord::BELONGS_TO:
6864 6864
                                                         case TActiveRecord::HAS_ONE:
6865
-                                                                $relControl->Text = $arObj->{$relKey};
6865
+                                                                $relControl->Text=$arObj->{$relKey};
6866 6866
                                                                 break;
6867 6867
                                                         case TActiveRecord::HAS_MANY:
6868
-                                                                if ($relControl instanceof TListControl)
6868
+                                                                if($relControl instanceof TListControl)
6869 6869
                                                                 {
6870
-                                                                        $relControl->DataSource = $arObj->{$relKey};
6870
+                                                                        $relControl->DataSource=$arObj->{$relKey};
6871 6871
                                                                         $relControl->dataBind();
6872 6872
                                                                 }
6873 6873
                                                                 break;
@@ -6876,33 +6876,33 @@  discard block
 block discarded – undo
6876 6876
                                         break;
6877 6877
                                 }
6878 6878
                         } 
6879
-                        catch (Exception $ex)
6879
+                        catch(Exception $ex)
6880 6880
                         {
6881
-                                if ($throwExceptions)
6881
+                                if($throwExceptions)
6882 6882
                                         throw $ex;
6883 6883
                         }
6884 6884
                 }
6885 6885
         }
6886
-        public function tryToUpdateAR($arObj, $throwExceptions = false)
6886
+        public function tryToUpdateAR($arObj, $throwExceptions=false)
6887 6887
         {
6888
-                $objAttrs = get_class_vars(get_class($arObj));
6889
-                foreach (array_keys($objAttrs) as $key)
6888
+                $objAttrs=get_class_vars(get_class($arObj));
6889
+                foreach(array_keys($objAttrs) as $key)
6890 6890
                 {
6891 6891
                         try
6892 6892
                         {
6893
-                                if ($key == "RELATIONS")
6893
+                                if($key=="RELATIONS")
6894 6894
                                         break;
6895
-                                $control = $this->{$key};
6896
-                                if ($control instanceof TTextBox)
6897
-                                        $arObj->{$key} = $control->Text;
6898
-                                elseif ($control instanceof TCheckBox)
6899
-                                        $arObj->{$key} = $control->Checked;
6900
-                                elseif ($control instanceof TDatePicker)
6901
-                                        $arObj->{$key} = $control->Date;
6895
+                                $control=$this->{$key};
6896
+                                if($control instanceof TTextBox)
6897
+                                        $arObj->{$key}=$control->Text;
6898
+                                elseif($control instanceof TCheckBox)
6899
+                                        $arObj->{$key}=$control->Checked;
6900
+                                elseif($control instanceof TDatePicker)
6901
+                                        $arObj->{$key}=$control->Date;
6902 6902
                         } 
6903
-                        catch (Exception $ex)
6903
+                        catch(Exception $ex)
6904 6904
                         {
6905
-                                if ($throwExceptions)
6905
+                                if($throwExceptions)
6906 6906
                                         throw $ex;
6907 6907
                         }
6908 6908
                 }
@@ -6917,12 +6917,12 @@  discard block
 block discarded – undo
6917 6917
 	}
6918 6918
 	protected function addAttributesToRender($writer)
6919 6919
 	{
6920
-		$writer->addAttribute('id',$this->getClientID());
6921
-		$writer->addAttribute('method',$this->getMethod());
6920
+		$writer->addAttribute('id', $this->getClientID());
6921
+		$writer->addAttribute('method', $this->getMethod());
6922 6922
 		$uri=$this->getRequest()->getRequestURI();
6923
-		$writer->addAttribute('action',str_replace('&','&amp;',str_replace('&amp;','&',$uri)));
6923
+		$writer->addAttribute('action', str_replace('&', '&amp;', str_replace('&amp;', '&', $uri)));
6924 6924
 		if(($enctype=$this->getEnctype())!=='')
6925
-			$writer->addAttribute('enctype',$enctype);
6925
+			$writer->addAttribute('enctype', $enctype);
6926 6926
 		$attributes=$this->getAttributes();
6927 6927
 		$attributes->remove('action');
6928 6928
 		$writer->addAttributes($attributes);
@@ -6931,7 +6931,7 @@  discard block
 block discarded – undo
6931 6931
 			if(($button=$this->findControl($butt))!==null)
6932 6932
 				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
6933 6933
 			else
6934
-				throw new TInvalidDataValueException('form_defaultbutton_invalid',$butt);
6934
+				throw new TInvalidDataValueException('form_defaultbutton_invalid', $butt);
6935 6935
 		}
6936 6936
 	}
6937 6937
 	public function render($writer)
@@ -6964,27 +6964,27 @@  discard block
 block discarded – undo
6964 6964
 	}
6965 6965
 	public function getDefaultButton()
6966 6966
 	{
6967
-		return $this->getViewState('DefaultButton','');
6967
+		return $this->getViewState('DefaultButton', '');
6968 6968
 	}
6969 6969
 	public function setDefaultButton($value)
6970 6970
 	{
6971
-		$this->setViewState('DefaultButton',$value,'');
6971
+		$this->setViewState('DefaultButton', $value, '');
6972 6972
 	}
6973 6973
 	public function getMethod()
6974 6974
 	{
6975
-		return $this->getViewState('Method','post');
6975
+		return $this->getViewState('Method', 'post');
6976 6976
 	}
6977 6977
 	public function setMethod($value)
6978 6978
 	{
6979
-		$this->setViewState('Method',TPropertyValue::ensureEnum($value,'post','get'),'post');
6979
+		$this->setViewState('Method', TPropertyValue::ensureEnum($value, 'post', 'get'), 'post');
6980 6980
 	}
6981 6981
 	public function getEnctype()
6982 6982
 	{
6983
-		return $this->getViewState('Enctype','');
6983
+		return $this->getViewState('Enctype', '');
6984 6984
 	}
6985 6985
 	public function setEnctype($value)
6986 6986
 	{
6987
-		$this->setViewState('Enctype',$value,'');
6987
+		$this->setViewState('Enctype', $value, '');
6988 6988
 	}
6989 6989
 	public function getName()
6990 6990
 	{
@@ -7036,43 +7036,43 @@  discard block
 block discarded – undo
7036 7036
 	{
7037 7037
 		$this->registerPradoScriptInternal($name);
7038 7038
 		$params=func_get_args();
7039
-		$this->_page->registerCachingAction('Page.ClientScript','registerPradoScript',$params);
7039
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerPradoScript', $params);
7040 7040
 	}
7041 7041
 	protected function registerPradoScriptInternal($name)
7042 7042
 	{
7043 7043
 				if(!isset($this->_registeredPradoScripts[$name]))
7044 7044
 		{
7045
-			if(self::$_pradoScripts === null)
7045
+			if(self::$_pradoScripts===null)
7046 7046
 			{
7047
-				$packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::PACKAGES_FILE;
7048
-				list($packages,$deps)= include($packageFile);
7049
-				self::$_pradoScripts = $deps;
7050
-				self::$_pradoPackages = $packages;
7047
+				$packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::PACKAGES_FILE;
7048
+				list($packages, $deps)=include($packageFile);
7049
+				self::$_pradoScripts=$deps;
7050
+				self::$_pradoPackages=$packages;
7051 7051
 			}
7052
-			if (isset(self::$_pradoScripts[$name]))
7052
+			if(isset(self::$_pradoScripts[$name]))
7053 7053
 				$this->_registeredPradoScripts[$name]=true;
7054 7054
 			else
7055
-				throw new TInvalidOperationException('csmanager_pradoscript_invalid',$name);
7055
+				throw new TInvalidOperationException('csmanager_pradoscript_invalid', $name);
7056 7056
 			if(($packages=array_keys($this->_registeredPradoScripts))!==array())
7057 7057
 			{
7058
-				$base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7059
-				list($path,$baseUrl)=$this->getPackagePathUrl($base);
7058
+				$base=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7059
+				list($path, $baseUrl)=$this->getPackagePathUrl($base);
7060 7060
 				$packagesUrl=array();
7061 7061
 				$isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug;
7062
-				foreach ($packages as $p)
7062
+				foreach($packages as $p)
7063 7063
 				{
7064
-					foreach (self::$_pradoScripts[$p] as $dep)
7064
+					foreach(self::$_pradoScripts[$p] as $dep)
7065 7065
 					{
7066
-						foreach (self::$_pradoPackages[$dep] as $script)
7067
-						if (!isset($this->_expandedPradoScripts[$script]))
7066
+						foreach(self::$_pradoPackages[$dep] as $script)
7067
+						if(!isset($this->_expandedPradoScripts[$script]))
7068 7068
 						{
7069
-							$this->_expandedPradoScripts[$script] = true;
7069
+							$this->_expandedPradoScripts[$script]=true;
7070 7070
 							if($isDebug)
7071 7071
 							{
7072
-								if (!in_array($url=$baseUrl.'/'.$script,$packagesUrl))
7072
+								if(!in_array($url=$baseUrl.'/'.$script, $packagesUrl))
7073 7073
 									$packagesUrl[]=$url;
7074 7074
 							} else {
7075
-								if (!in_array($url=$baseUrl.'/min/'.$script,$packagesUrl))
7075
+								if(!in_array($url=$baseUrl.'/min/'.$script, $packagesUrl))
7076 7076
 								{
7077 7077
 									if(!is_file($filePath=$path.'/min/'.$script))
7078 7078
 									{
@@ -7089,47 +7089,47 @@  discard block
 block discarded – undo
7089 7089
 					}
7090 7090
 				}
7091 7091
 				foreach($packagesUrl as $url)
7092
-					$this->registerScriptFile($url,$url);
7092
+					$this->registerScriptFile($url, $url);
7093 7093
 			}
7094 7094
 		}
7095 7095
 	}
7096 7096
 	public function getPradoScriptAssetUrl()
7097 7097
 	{
7098
-		$base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7099
-		$assets = Prado::getApplication()->getAssetManager();
7098
+		$base=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7099
+		$assets=Prado::getApplication()->getAssetManager();
7100 7100
 		return $assets->getPublishedUrl($base);
7101 7101
 	}
7102 7102
 	public function getScriptUrls()
7103 7103
 	{
7104
-		$scripts = array_values($this->_headScriptFiles);
7105
-		$scripts = array_merge($scripts, array_values($this->_scriptFiles));
7106
-		$scripts = array_unique($scripts);
7104
+		$scripts=array_values($this->_headScriptFiles);
7105
+		$scripts=array_merge($scripts, array_values($this->_scriptFiles));
7106
+		$scripts=array_unique($scripts);
7107 7107
 		return $scripts;
7108 7108
 	}
7109 7109
 	protected function getPackagePathUrl($base)
7110 7110
 	{
7111
-		$assets = Prado::getApplication()->getAssetManager();
7111
+		$assets=Prado::getApplication()->getAssetManager();
7112 7112
 		if(strpos($base, $assets->getBaseUrl())===false)
7113 7113
 		{
7114
-			if(($dir = Prado::getPathOfNameSpace($base)) !== null) {
7115
-				$base = $dir;
7114
+			if(($dir=Prado::getPathOfNameSpace($base))!==null) {
7115
+				$base=$dir;
7116 7116
 			}
7117 7117
 			return array($assets->getPublishedPath($base), $assets->publishFilePath($base));
7118 7118
 		}
7119 7119
 		else
7120 7120
 		{
7121
-			return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base);
7121
+			return array($assets->getBasePath().str_replace($assets->getBaseUrl(), '', $base), $base);
7122 7122
 		}
7123 7123
 	}
7124 7124
 	public function getCallbackReference(ICallbackEventHandler $callbackHandler, $options=null)
7125 7125
 	{
7126
-		$options = !is_array($options) ? array() : $options;
7127
-		$class = new ReflectionClass($callbackHandler);
7128
-		$clientSide = $callbackHandler->getActiveControl()->getClientSide();
7129
-		$options = array_merge($options, $clientSide->getOptions()->toArray());
7130
-		$optionString = TJavaScript::encode($options);
7126
+		$options=!is_array($options) ? array() : $options;
7127
+		$class=new ReflectionClass($callbackHandler);
7128
+		$clientSide=$callbackHandler->getActiveControl()->getClientSide();
7129
+		$options=array_merge($options, $clientSide->getOptions()->toArray());
7130
+		$optionString=TJavaScript::encode($options);
7131 7131
 		$this->registerPradoScriptInternal('ajax');
7132
-		$id = $callbackHandler->getUniqueID();
7132
+		$id=$callbackHandler->getUniqueID();
7133 7133
 		return "new Prado.CallbackRequest('{$id}',{$optionString})";
7134 7134
 	}
7135 7135
 	public function registerCallbackControl($class, $options)
@@ -7139,11 +7139,11 @@  discard block
 block discarded – undo
7139 7139
 		$this->_endScripts[sprintf('%08X', crc32($code))]=$code;
7140 7140
 		$this->registerPradoScriptInternal('ajax');
7141 7141
 		$params=func_get_args();
7142
-		$this->_page->registerCachingAction('Page.ClientScript','registerCallbackControl',$params);
7142
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerCallbackControl', $params);
7143 7143
 	}
7144
-	public function registerPostBackControl($class,$options)
7144
+	public function registerPostBackControl($class, $options)
7145 7145
 	{
7146
-		if($class === null) {
7146
+		if($class===null) {
7147 7147
 			return;
7148 7148
 		}
7149 7149
 		if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null)
@@ -7153,11 +7153,11 @@  discard block
 block discarded – undo
7153 7153
 		$this->_endScripts[sprintf('%08X', crc32($code))]=$code;
7154 7154
 		$this->registerPradoScriptInternal('prado');
7155 7155
 		$params=func_get_args();
7156
-		$this->_page->registerCachingAction('Page.ClientScript','registerPostBackControl',$params);
7156
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerPostBackControl', $params);
7157 7157
 	}
7158 7158
 	public function registerDefaultButton($panel, $button)
7159 7159
 	{
7160
-		$panelID=is_string($panel)?$panel:$panel->getUniqueID();
7160
+		$panelID=is_string($panel) ? $panel : $panel->getUniqueID();
7161 7161
 		if(is_string($button))
7162 7162
 			$buttonID=$button;
7163 7163
 		else
@@ -7165,20 +7165,20 @@  discard block
 block discarded – undo
7165 7165
 			$button->setIsDefaultButton(true);
7166 7166
 			$buttonID=$button->getUniqueID();
7167 7167
 		}
7168
-		$options = TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID));
7169
-		$code = "new Prado.WebUI.DefaultButton($options);";
7168
+		$options=TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID));
7169
+		$code="new Prado.WebUI.DefaultButton($options);";
7170 7170
 		$this->_endScripts['prado:'.$panelID]=$code;
7171 7171
 		$this->registerPradoScriptInternal('prado');
7172
-		$params=array($panelID,$buttonID);
7173
-		$this->_page->registerCachingAction('Page.ClientScript','registerDefaultButton',$params);
7172
+		$params=array($panelID, $buttonID);
7173
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerDefaultButton', $params);
7174 7174
 	}
7175 7175
 	protected function getDefaultButtonOptions($panelID, $buttonID)
7176 7176
 	{
7177
-		$options['ID'] = TControl::convertUniqueIdToClientId($panelID);
7178
-		$options['Panel'] = TControl::convertUniqueIdToClientId($panelID);
7179
-		$options['Target'] = TControl::convertUniqueIdToClientId($buttonID);
7180
-		$options['EventTarget'] = $buttonID;
7181
-		$options['Event'] = 'click';
7177
+		$options['ID']=TControl::convertUniqueIdToClientId($panelID);
7178
+		$options['Panel']=TControl::convertUniqueIdToClientId($panelID);
7179
+		$options['Target']=TControl::convertUniqueIdToClientId($buttonID);
7180
+		$options['EventTarget']=$buttonID;
7181
+		$options['Event']='click';
7182 7182
 		return $options;
7183 7183
 	}
7184 7184
 	public function registerFocusControl($target)
@@ -7186,126 +7186,126 @@  discard block
 block discarded – undo
7186 7186
 		$this->registerPradoScriptInternal('jquery');
7187 7187
 		if($target instanceof TControl)
7188 7188
 			$target=$target->getClientID();
7189
-		$this->_endScripts['prado:focus'] = 'jQuery(\'#'.$target.'\').focus();';
7189
+		$this->_endScripts['prado:focus']='jQuery(\'#'.$target.'\').focus();';
7190 7190
 		$params=func_get_args();
7191
-		$this->_page->registerCachingAction('Page.ClientScript','registerFocusControl',$params);
7191
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerFocusControl', $params);
7192 7192
 	}
7193 7193
 	public function registerPradoStyle($name)
7194 7194
 	{
7195 7195
 		$this->registerPradoStyleInternal($name);
7196 7196
 		$params=func_get_args();
7197
-		$this->_page->registerCachingAction('Page.ClientScript','registerPradoStyle',$params);
7197
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerPradoStyle', $params);
7198 7198
 	}
7199 7199
 	protected function registerPradoStyleInternal($name)
7200 7200
 	{
7201 7201
 				if(!isset($this->_registeredPradoStyles[$name]))
7202 7202
 		{
7203
-			$base = $this->getPradoScriptAssetUrl();
7204
-			if(self::$_pradoStyles === null)
7203
+			$base=$this->getPradoScriptAssetUrl();
7204
+			if(self::$_pradoStyles===null)
7205 7205
 			{
7206
-				$packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE;
7207
-				list($packages,$deps)= include($packageFile);
7208
-				self::$_pradoStyles = $deps;
7209
-				self::$_pradoStylePackages = $packages;
7206
+				$packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE;
7207
+				list($packages, $deps)=include($packageFile);
7208
+				self::$_pradoStyles=$deps;
7209
+				self::$_pradoStylePackages=$packages;
7210 7210
 			}
7211
-			if (isset(self::$_pradoStyles[$name]))
7211
+			if(isset(self::$_pradoStyles[$name]))
7212 7212
 				$this->_registeredPradoStyles[$name]=true;
7213 7213
 			else
7214
-				throw new TInvalidOperationException('csmanager_pradostyle_invalid',$name);
7214
+				throw new TInvalidOperationException('csmanager_pradostyle_invalid', $name);
7215 7215
 			if(($packages=array_keys($this->_registeredPradoStyles))!==array())
7216 7216
 			{
7217
-				$base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7218
-				list($path,$baseUrl)=$this->getPackagePathUrl($base);
7217
+				$base=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH;
7218
+				list($path, $baseUrl)=$this->getPackagePathUrl($base);
7219 7219
 				$packagesUrl=array();
7220 7220
 				$isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug;
7221
-				foreach ($packages as $p)
7221
+				foreach($packages as $p)
7222 7222
 				{
7223
-					foreach (self::$_pradoStyles[$p] as $dep)
7223
+					foreach(self::$_pradoStyles[$p] as $dep)
7224 7224
 					{
7225
-						foreach (self::$_pradoStylePackages[$dep] as $style)
7226
-						if (!isset($this->_expandedPradoStyles[$style]))
7225
+						foreach(self::$_pradoStylePackages[$dep] as $style)
7226
+						if(!isset($this->_expandedPradoStyles[$style]))
7227 7227
 						{
7228
-							$this->_expandedPradoStyles[$style] = true;
7229
-														if (!in_array($url=$baseUrl.'/'.$style,$packagesUrl))
7228
+							$this->_expandedPradoStyles[$style]=true;
7229
+														if(!in_array($url=$baseUrl.'/'.$style, $packagesUrl))
7230 7230
 								$packagesUrl[]=$url;
7231 7231
 						}
7232 7232
 					}
7233 7233
 				}
7234 7234
 				foreach($packagesUrl as $url)
7235
-					$this->registerStyleSheetFile($url,$url);
7235
+					$this->registerStyleSheetFile($url, $url);
7236 7236
 			}
7237 7237
 		}
7238 7238
 	}
7239
-	public function registerStyleSheetFile($key,$url,$media='')
7239
+	public function registerStyleSheetFile($key, $url, $media='')
7240 7240
 	{
7241 7241
 		if($media==='')
7242 7242
 			$this->_styleSheetFiles[$key]=$url;
7243 7243
 		else
7244
-			$this->_styleSheetFiles[$key]=array($url,$media);
7244
+			$this->_styleSheetFiles[$key]=array($url, $media);
7245 7245
 		$params=func_get_args();
7246
-		$this->_page->registerCachingAction('Page.ClientScript','registerStyleSheetFile',$params);
7246
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheetFile', $params);
7247 7247
 	}
7248
-	public function registerStyleSheet($key,$css,$media='')
7248
+	public function registerStyleSheet($key, $css, $media='')
7249 7249
 	{
7250 7250
 		$this->_styleSheets[$key]=$css;
7251 7251
 		$params=func_get_args();
7252
-		$this->_page->registerCachingAction('Page.ClientScript','registerStyleSheet',$params);
7252
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheet', $params);
7253 7253
 	}
7254 7254
 	public function getStyleSheetUrls()
7255 7255
 	{
7256
-		$stylesheets = array_values(
7256
+		$stylesheets=array_values(
7257 7257
 			array_map(function($e) {
7258 7258
 				return is_array($e) ? $e[0] : $e;
7259 7259
 			}, $this->_styleSheetFiles)
7260 7260
 		);
7261 7261
 		foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url)
7262
-			if (substr($url,strlen($url)-4)=='.css')
7263
-				$stylesheets[] = $url;
7264
-		$stylesheets = array_unique($stylesheets);
7262
+			if(substr($url, strlen($url) - 4)=='.css')
7263
+				$stylesheets[]=$url;
7264
+		$stylesheets=array_unique($stylesheets);
7265 7265
 		return $stylesheets;
7266 7266
 	}
7267 7267
 	public function getStyleSheetCodes()
7268 7268
 	{
7269 7269
 		return array_unique(array_values($this->_styleSheets));
7270 7270
 	}
7271
-	public function registerHeadScriptFile($key,$url)
7271
+	public function registerHeadScriptFile($key, $url)
7272 7272
 	{
7273 7273
 		$this->checkIfNotInRender();
7274 7274
 		$this->_headScriptFiles[$key]=$url;
7275 7275
 		$params=func_get_args();
7276
-		$this->_page->registerCachingAction('Page.ClientScript','registerHeadScriptFile',$params);
7276
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScriptFile', $params);
7277 7277
 	}
7278
-	public function registerHeadScript($key,$script)
7278
+	public function registerHeadScript($key, $script)
7279 7279
 	{
7280 7280
 		$this->checkIfNotInRender();
7281 7281
 		$this->_headScripts[$key]=$script;
7282 7282
 		$params=func_get_args();
7283
-		$this->_page->registerCachingAction('Page.ClientScript','registerHeadScript',$params);
7283
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScript', $params);
7284 7284
 	}
7285 7285
 	public function registerScriptFile($key, $url)
7286 7286
 	{
7287 7287
 		$this->_scriptFiles[$key]=$url;
7288 7288
 		$params=func_get_args();
7289
-		$this->_page->registerCachingAction('Page.ClientScript','registerScriptFile',$params);
7289
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerScriptFile', $params);
7290 7290
 	}
7291
-	public function registerBeginScript($key,$script)
7291
+	public function registerBeginScript($key, $script)
7292 7292
 	{
7293 7293
 		$this->checkIfNotInRender();
7294 7294
 		$this->_beginScripts[$key]=$script;
7295 7295
 		$params=func_get_args();
7296
-		$this->_page->registerCachingAction('Page.ClientScript','registerBeginScript',$params);
7296
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerBeginScript', $params);
7297 7297
 	}
7298
-	public function registerEndScript($key,$script)
7298
+	public function registerEndScript($key, $script)
7299 7299
 	{
7300 7300
 		$this->_endScripts[$key]=$script;
7301 7301
 		$params=func_get_args();
7302
-		$this->_page->registerCachingAction('Page.ClientScript','registerEndScript',$params);
7302
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerEndScript', $params);
7303 7303
 	}
7304
-	public function registerHiddenField($name,$value)
7304
+	public function registerHiddenField($name, $value)
7305 7305
 	{
7306 7306
 		$this->_hiddenFields[$name]=$value;
7307 7307
 		$params=func_get_args();
7308
-		$this->_page->registerCachingAction('Page.ClientScript','registerHiddenField',$params);
7308
+		$this->_page->registerCachingAction('Page.ClientScript', 'registerHiddenField', $params);
7309 7309
 	}
7310 7310
 	public function isStyleSheetFileRegistered($key)
7311 7311
 	{
@@ -7362,11 +7362,11 @@  discard block
 block discarded – undo
7362 7362
 	public function renderStyleSheets($writer)
7363 7363
 	{
7364 7364
 		if(count($this->_styleSheets))
7365
-			$writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n",$this->_styleSheets)."\n/*]]>*/\n</style>\n");
7365
+			$writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n", $this->_styleSheets)."\n/*]]>*/\n</style>\n");
7366 7366
 	}
7367 7367
 	public function renderHeadScriptFiles($writer)
7368 7368
 	{
7369
-		$this->renderScriptFiles($writer,$this->_headScriptFiles);
7369
+		$this->renderScriptFiles($writer, $this->_headScriptFiles);
7370 7370
 	}
7371 7371
 	public function renderHeadScripts($writer)
7372 7372
 	{
@@ -7382,9 +7382,9 @@  discard block
 block discarded – undo
7382 7382
 	}
7383 7383
 	public function markScriptFileAsRendered($url)
7384 7384
 	{
7385
-		$this->_renderedScriptFiles[$url] = $url;
7385
+		$this->_renderedScriptFiles[$url]=$url;
7386 7386
 		$params=func_get_args();
7387
-		$this->_page->registerCachingAction('Page.ClientScript','markScriptFileAsRendered',$params);
7387
+		$this->_page->registerCachingAction('Page.ClientScript', 'markScriptFileAsRendered', $params);
7388 7388
 	}
7389 7389
 	protected function renderScriptFiles($writer, Array $scripts)
7390 7390
 	{
@@ -7402,8 +7402,8 @@  discard block
 block discarded – undo
7402 7402
 	{
7403 7403
 		if(!empty($this->_scriptFiles))
7404 7404
 		{
7405
-			$addedScripts = array_diff($this->_scriptFiles,$this->getRenderedScriptFiles());
7406
-			$this->renderScriptFiles($writer,$addedScripts);
7405
+			$addedScripts=array_diff($this->_scriptFiles, $this->getRenderedScriptFiles());
7406
+			$this->renderScriptFiles($writer, $addedScripts);
7407 7407
 		}
7408 7408
 	}
7409 7409
 	public function renderBeginScripts($writer)
@@ -7424,11 +7424,11 @@  discard block
 block discarded – undo
7424 7424
 	}
7425 7425
 	public function renderHiddenFieldsBegin($writer)
7426 7426
 	{
7427
-		$this->renderHiddenFieldsInt($writer,true);
7427
+		$this->renderHiddenFieldsInt($writer, true);
7428 7428
 	}
7429 7429
 	public function renderHiddenFieldsEnd($writer)
7430 7430
 	{
7431
-		$this->renderHiddenFieldsInt($writer,false);
7431
+		$this->renderHiddenFieldsInt($writer, false);
7432 7432
 	}
7433 7433
 	public function flushScriptFiles($writer, $control=null)
7434 7434
 	{
@@ -7440,12 +7440,12 @@  discard block
 block discarded – undo
7440 7440
 	}
7441 7441
 	protected function renderHiddenFieldsInt($writer, $initial)
7442 7442
  	{
7443
-		if ($initial) $this->_renderedHiddenFields = array();
7443
+		if($initial) $this->_renderedHiddenFields=array();
7444 7444
 		$str='';
7445 7445
 		foreach($this->_hiddenFields as $name=>$value)
7446 7446
 		{
7447
-			if (in_array($name,$this->_renderedHiddenFields)) continue;
7448
-			$id=strtr($name,':','_');
7447
+			if(in_array($name, $this->_renderedHiddenFields)) continue;
7448
+			$id=strtr($name, ':', '_');
7449 7449
 			if(is_array($value))
7450 7450
 			{
7451 7451
 				foreach($value as $v)
@@ -7455,7 +7455,7 @@  discard block
 block discarded – undo
7455 7455
 			{
7456 7456
 				$str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n";
7457 7457
 			}
7458
-			$this->_renderedHiddenFields[] = $name;
7458
+			$this->_renderedHiddenFields[]=$name;
7459 7459
 		}
7460 7460
 		if($str!=='')
7461 7461
 			$writer->write("<div style=\"visibility:hidden;\">\n".$str."</div>\n");
@@ -7466,7 +7466,7 @@  discard block
 block discarded – undo
7466 7466
 	}
7467 7467
 	protected function checkIfNotInRender()
7468 7468
 	{
7469
-		if ($form = $this->_page->InFormRender)
7469
+		if($form=$this->_page->InFormRender)
7470 7470
 			throw new Exception('Operation invalid when page is already rendering');
7471 7471
 	}
7472 7472
 }
@@ -7476,12 +7476,12 @@  discard block
 block discarded – undo
7476 7476
 	protected function setFunction($name, $code)
7477 7477
 	{
7478 7478
 		if(!TJavaScript::isJsLiteral($code))
7479
-			$code = TJavaScript::quoteJsLiteral($this->ensureFunction($code));
7479
+			$code=TJavaScript::quoteJsLiteral($this->ensureFunction($code));
7480 7480
 		$this->setOption($name, $code);
7481 7481
 	}
7482 7482
 	protected function getOption($name)
7483 7483
 	{
7484
-		if ($this->_options)
7484
+		if($this->_options)
7485 7485
 			return $this->_options->itemAt($name);
7486 7486
 		else
7487 7487
 			return null;
@@ -7492,8 +7492,8 @@  discard block
 block discarded – undo
7492 7492
 	}
7493 7493
 	public function getOptions()
7494 7494
 	{
7495
-		if (!$this->_options)
7496
-			$this->_options = Prado::createComponent('System.Collections.TMap');
7495
+		if(!$this->_options)
7496
+			$this->_options=Prado::createComponent('System.Collections.TMap');
7497 7497
 		return $this->_options;
7498 7498
 	}
7499 7499
 	protected function ensureFunction($javascript)
@@ -7552,7 +7552,7 @@  discard block
 block discarded – undo
7552 7552
 	}
7553 7553
 	public function run($writer)
7554 7554
 	{
7555
-		$this->_writer = $writer;
7555
+		$this->_writer=$writer;
7556 7556
 		$this->determinePostBackMode();
7557 7557
 		if($this->getIsPostBack())
7558 7558
 		{
@@ -7563,7 +7563,7 @@  discard block
 block discarded – undo
7563 7563
 		}
7564 7564
 		else
7565 7565
 			$this->processNormalRequest($writer);
7566
-		$this->_writer = null;
7566
+		$this->_writer=null;
7567 7567
 	}
7568 7568
 	protected function processNormalRequest($writer)
7569 7569
 	{
@@ -7587,10 +7587,10 @@  discard block
 block discarded – undo
7587 7587
 		$this->onInitComplete(null);
7588 7588
 		$this->_restPostData=new TMap;
7589 7589
 		$this->loadPageState();
7590
-		$this->processPostData($this->_postData,true);
7590
+		$this->processPostData($this->_postData, true);
7591 7591
 		$this->onPreLoad(null);
7592 7592
 		$this->loadRecursive();
7593
-		$this->processPostData($this->_restPostData,false);
7593
+		$this->processPostData($this->_restPostData, false);
7594 7594
 		$this->raiseChangedEvents();
7595 7595
 		$this->raisePostBackEvent();
7596 7596
 		$this->onLoadComplete(null);
@@ -7609,7 +7609,7 @@  discard block
 block discarded – undo
7609 7609
 				$data[$k]=self::decodeUTF8($v, $enc);
7610 7610
 			return $data;
7611 7611
 		} elseif(is_string($data)) {
7612
-			return iconv('UTF-8',$enc.'//IGNORE',$data);
7612
+			return iconv('UTF-8', $enc.'//IGNORE', $data);
7613 7613
 		} else {
7614 7614
 			return $data;
7615 7615
 		}
@@ -7619,22 +7619,22 @@  discard block
 block discarded – undo
7619 7619
 		Prado::using('System.Web.UI.ActiveControls.TActivePageAdapter');
7620 7620
 		Prado::using('System.Web.UI.JuiControls.TJuiControlOptions');
7621 7621
 		$this->setAdapter(new TActivePageAdapter($this));
7622
-        $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER);
7622
+        $callbackEventParameter=$this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER);
7623 7623
         if(strlen($callbackEventParameter) > 0)
7624
-            $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter);
7625
-                if (($g=$this->getApplication()->getGlobalization(false))!==null &&
7624
+            $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string) $callbackEventParameter);
7625
+                if(($g=$this->getApplication()->getGlobalization(false))!==null &&
7626 7626
             strtoupper($enc=$g->getCharset())!='UTF-8')
7627
-                foreach ($this->_postData as $k=>$v)
7627
+                foreach($this->_postData as $k=>$v)
7628 7628
                 	$this->_postData[$k]=self::decodeUTF8($v, $enc);
7629 7629
 		$this->onPreInit(null);
7630 7630
 		$this->initRecursive();
7631 7631
 		$this->onInitComplete(null);
7632 7632
 		$this->_restPostData=new TMap;
7633 7633
 		$this->loadPageState();
7634
-		$this->processPostData($this->_postData,true);
7634
+		$this->processPostData($this->_postData, true);
7635 7635
 		$this->onPreLoad(null);
7636 7636
 		$this->loadRecursive();
7637
-		$this->processPostData($this->_restPostData,false);
7637
+		$this->processPostData($this->_restPostData, false);
7638 7638
 		$this->raiseChangedEvents();
7639 7639
 		$this->getAdapter()->processCallbackEvent($writer);
7640 7640
 		$this->onLoadComplete(null);
@@ -7647,7 +7647,7 @@  discard block
 block discarded – undo
7647 7647
 	}
7648 7648
 	public function getCallbackClient()
7649 7649
 	{
7650
-		if($this->getAdapter() !== null)
7650
+		if($this->getAdapter()!==null)
7651 7651
 			return $this->getAdapter()->getCallbackClientHandler();
7652 7652
 		else
7653 7653
 			return new TCallbackClientScript();
@@ -7687,7 +7687,7 @@  discard block
 block discarded – undo
7687 7687
 	{
7688 7688
 		if(!$this->_validators)
7689 7689
 			$this->_validators=new TList;
7690
-		if(empty($validationGroup) === true)
7690
+		if(empty($validationGroup)===true)
7691 7691
 			return $this->_validators;
7692 7692
 		else
7693 7693
 		{
@@ -7741,7 +7741,7 @@  discard block
 block discarded – undo
7741 7741
 	}
7742 7742
 	public function setTheme($value)
7743 7743
 	{
7744
-		$this->_theme=empty($value)?null:$value;
7744
+		$this->_theme=empty($value) ? null : $value;
7745 7745
 	}
7746 7746
 	public function getStyleSheetTheme()
7747 7747
 	{
@@ -7751,7 +7751,7 @@  discard block
 block discarded – undo
7751 7751
 	}
7752 7752
 	public function setStyleSheetTheme($value)
7753 7753
 	{
7754
-		$this->_styleSheet=empty($value)?null:$value;
7754
+		$this->_styleSheet=empty($value) ? null : $value;
7755 7755
 	}
7756 7756
 	public function applyControlSkin($control)
7757 7757
 	{
@@ -7766,66 +7766,66 @@  discard block
 block discarded – undo
7766 7766
 	public function getClientScript()
7767 7767
 	{
7768 7768
 		if(!$this->_clientScript) {
7769
-			$className = $classPath = $this->getService()->getClientScriptManagerClass();
7769
+			$className=$classPath=$this->getService()->getClientScriptManagerClass();
7770 7770
 			Prado::using($className);
7771
-			if(($pos=strrpos($className,'.'))!==false)
7772
-				$className=substr($className,$pos+1);
7773
- 			if(!class_exists($className,false) || ($className!=='TClientScriptManager' && !is_subclass_of($className,'TClientScriptManager')))
7774
-				throw new THttpException(404,'page_csmanagerclass_invalid',$classPath);
7771
+			if(($pos=strrpos($className, '.'))!==false)
7772
+				$className=substr($className, $pos + 1);
7773
+ 			if(!class_exists($className, false) || ($className!=='TClientScriptManager' && !is_subclass_of($className, 'TClientScriptManager')))
7774
+				throw new THttpException(404, 'page_csmanagerclass_invalid', $classPath);
7775 7775
 			$this->_clientScript=new $className($this);
7776 7776
 		}
7777 7777
 		return $this->_clientScript;
7778 7778
 	}
7779 7779
 	public function onPreInit($param)
7780 7780
 	{
7781
-		$this->raiseEvent('OnPreInit',$this,$param);
7781
+		$this->raiseEvent('OnPreInit', $this, $param);
7782 7782
 	}
7783 7783
 	public function onInitComplete($param)
7784 7784
 	{
7785
-		$this->raiseEvent('OnInitComplete',$this,$param);
7785
+		$this->raiseEvent('OnInitComplete', $this, $param);
7786 7786
 	}
7787 7787
 	public function onPreLoad($param)
7788 7788
 	{
7789
-		$this->raiseEvent('OnPreLoad',$this,$param);
7789
+		$this->raiseEvent('OnPreLoad', $this, $param);
7790 7790
 	}
7791 7791
 	public function onLoadComplete($param)
7792 7792
 	{
7793
-		$this->raiseEvent('OnLoadComplete',$this,$param);
7793
+		$this->raiseEvent('OnLoadComplete', $this, $param);
7794 7794
 	}
7795 7795
 	public function onPreRenderComplete($param)
7796 7796
 	{
7797
-		$this->raiseEvent('OnPreRenderComplete',$this,$param);
7797
+		$this->raiseEvent('OnPreRenderComplete', $this, $param);
7798 7798
 		$cs=$this->getClientScript();
7799 7799
 		$theme=$this->getTheme();
7800 7800
 		if($theme instanceof ITheme)
7801 7801
 		{
7802 7802
 			foreach($theme->getStyleSheetFiles() as $url)
7803
-				$cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
7803
+				$cs->registerStyleSheetFile($url, $url, $this->getCssMediaType($url));
7804 7804
 			foreach($theme->getJavaScriptFiles() as $url)
7805
-				$cs->registerHeadScriptFile($url,$url);
7805
+				$cs->registerHeadScriptFile($url, $url);
7806 7806
 		}
7807 7807
 		$styleSheet=$this->getStyleSheetTheme();
7808 7808
 		if($styleSheet instanceof ITheme)
7809 7809
 		{
7810 7810
 			foreach($styleSheet->getStyleSheetFiles() as $url)
7811
-				$cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url));
7811
+				$cs->registerStyleSheetFile($url, $url, $this->getCssMediaType($url));
7812 7812
 			foreach($styleSheet->getJavaScriptFiles() as $url)
7813
-				$cs->registerHeadScriptFile($url,$url);
7813
+				$cs->registerHeadScriptFile($url, $url);
7814 7814
 		}
7815 7815
 		if($cs->getRequiresHead() && $this->getHead()===null)
7816 7816
 			throw new TConfigurationException('page_head_required');
7817 7817
 	}
7818 7818
 	private function getCssMediaType($url)
7819 7819
 	{
7820
-		$segs=explode('.',basename($url));
7820
+		$segs=explode('.', basename($url));
7821 7821
 		if(isset($segs[2]))
7822
-			return $segs[count($segs)-2];
7822
+			return $segs[count($segs) - 2];
7823 7823
 		else
7824 7824
 			return '';
7825 7825
 	}
7826 7826
 	public function onSaveStateComplete($param)
7827 7827
 	{
7828
-		$this->raiseEvent('OnSaveStateComplete',$this,$param);
7828
+		$this->raiseEvent('OnSaveStateComplete', $this, $param);
7829 7829
 	}
7830 7830
 	private function determinePostBackMode()
7831 7831
 	{
@@ -7844,17 +7844,17 @@  discard block
 block discarded – undo
7844 7844
 	public function saveState()
7845 7845
 	{
7846 7846
 		parent::saveState();
7847
-		$this->setViewState('ControlsRequiringPostBack',$this->_controlsRegisteredForPostData,array());
7847
+		$this->setViewState('ControlsRequiringPostBack', $this->_controlsRegisteredForPostData, array());
7848 7848
 	}
7849 7849
 	public function loadState()
7850 7850
 	{
7851 7851
 		parent::loadState();
7852
-		$this->_controlsRequiringPostData=$this->getViewState('ControlsRequiringPostBack',array());
7852
+		$this->_controlsRequiringPostData=$this->getViewState('ControlsRequiringPostBack', array());
7853 7853
 	}
7854 7854
 	protected function loadPageState()
7855 7855
 	{
7856 7856
 		$state=$this->getStatePersister()->load();
7857
-		$this->loadStateRecursive($state,$this->getEnableViewState());
7857
+		$this->loadStateRecursive($state, $this->getEnableViewState());
7858 7858
 	}
7859 7859
 	protected function savePageState()
7860 7860
 	{
@@ -7867,11 +7867,11 @@  discard block
 block discarded – undo
7867 7867
 	}
7868 7868
 	public function registerRequiresPostData($control)
7869 7869
 	{
7870
-		$id=is_string($control)?$control:$control->getUniqueID();
7870
+		$id=is_string($control) ? $control : $control->getUniqueID();
7871 7871
 		$this->_controlsRegisteredForPostData[$id]=true;
7872 7872
 		$params=func_get_args();
7873 7873
 		foreach($this->getCachingStack() as $item)
7874
-			$item->registerAction('Page','registerRequiresPostData',array($id));
7874
+			$item->registerAction('Page', 'registerRequiresPostData', array($id));
7875 7875
 	}
7876 7876
 	public function getPostBackEventTarget()
7877 7877
 	{
@@ -7900,7 +7900,7 @@  discard block
 block discarded – undo
7900 7900
 	{
7901 7901
 		$this->_postBackEventParameter=$value;
7902 7902
 	}
7903
-	protected function processPostData($postData,$beforeLoad)
7903
+	protected function processPostData($postData, $beforeLoad)
7904 7904
 	{
7905 7905
 		$this->_isLoadingPostData=true;
7906 7906
 		if($beforeLoad)
@@ -7913,17 +7913,17 @@  discard block
 block discarded – undo
7913 7913
 			{
7914 7914
 				if($control instanceof IPostBackDataHandler)
7915 7915
 				{
7916
-					if($control->loadPostData($key,$postData))
7916
+					if($control->loadPostData($key, $postData))
7917 7917
 						$this->_controlsPostDataChanged[]=$control;
7918 7918
 				}
7919 7919
 				else if($control instanceof IPostBackEventHandler &&
7920 7920
 					empty($this->_postData[self::FIELD_POSTBACK_TARGET]))
7921 7921
 				{
7922
-					$this->_postData->add(self::FIELD_POSTBACK_TARGET,$key);  				}
7922
+					$this->_postData->add(self::FIELD_POSTBACK_TARGET, $key); }
7923 7923
 				unset($this->_controlsRequiringPostData[$key]);
7924 7924
 			}
7925 7925
 			else if($beforeLoad)
7926
-				$this->_restPostData->add($key,$value);
7926
+				$this->_restPostData->add($key, $value);
7927 7927
 		}
7928 7928
 		foreach($this->_controlsRequiringPostData as $key=>$value)
7929 7929
 		{
@@ -7931,11 +7931,11 @@  discard block
 block discarded – undo
7931 7931
 			{
7932 7932
 				if($control instanceof IPostBackDataHandler)
7933 7933
 				{
7934
-					if($control->loadPostData($key,$this->_postData))
7934
+					if($control->loadPostData($key, $this->_postData))
7935 7935
 						$this->_controlsPostDataChanged[]=$control;
7936 7936
 				}
7937 7937
 				else
7938
-					throw new TInvalidDataValueException('page_postbackcontrol_invalid',$key);
7938
+					throw new TInvalidDataValueException('page_postbackcontrol_invalid', $key);
7939 7939
 				unset($this->_controlsRequiringPostData[$key]);
7940 7940
 			}
7941 7941
 		}
@@ -7964,14 +7964,14 @@  discard block
 block discarded – undo
7964 7964
 	public function ensureRenderInForm($control)
7965 7965
 	{
7966 7966
 		if(!$this->getIsCallback() && !$this->_inFormRender)
7967
-			throw new TConfigurationException('page_control_outofform',get_class($control), $control ? $control->getUniqueID() : null);
7967
+			throw new TConfigurationException('page_control_outofform', get_class($control), $control ? $control->getUniqueID() : null);
7968 7968
 	}
7969 7969
 	public function beginFormRender($writer)
7970 7970
 	{
7971 7971
 		if($this->_formRendered)
7972 7972
 			throw new TConfigurationException('page_form_duplicated');
7973 7973
 		$this->_formRendered=true;
7974
-		$this->getClientScript()->registerHiddenField(self::FIELD_PAGESTATE,$this->getClientState());
7974
+		$this->getClientScript()->registerHiddenField(self::FIELD_PAGESTATE, $this->getClientState());
7975 7975
 		$this->_inFormRender=true;
7976 7976
 	}
7977 7977
 	public function endFormRender($writer)
@@ -8092,12 +8092,12 @@  discard block
 block discarded – undo
8092 8092
 	{
8093 8093
 		$this->_pagePath=$value;
8094 8094
 	}
8095
-	public function registerCachingAction($context,$funcName,$funcParams)
8095
+	public function registerCachingAction($context, $funcName, $funcParams)
8096 8096
 	{
8097 8097
 		if($this->_cachingStack)
8098 8098
 		{
8099 8099
 			foreach($this->_cachingStack as $cache)
8100
-				$cache->registerAction($context,$funcName,$funcParams);
8100
+				$cache->registerAction($context, $funcName, $funcParams);
8101 8101
 		}
8102 8102
 	}
8103 8103
 	public function getCachingStack()
@@ -8108,7 +8108,7 @@  discard block
 block discarded – undo
8108 8108
 	}
8109 8109
 	public function flushWriter()
8110 8110
 	{
8111
-		if ($this->_writer)
8111
+		if($this->_writer)
8112 8112
 			$this->Response->write($this->_writer->flush());
8113 8113
 	}
8114 8114
 }
@@ -8121,7 +8121,7 @@  discard block
 block discarded – undo
8121 8121
 }
8122 8122
 class TPageStateFormatter
8123 8123
 {
8124
-	public static function serialize($page,$data)
8124
+	public static function serialize($page, $data)
8125 8125
 	{
8126 8126
 		$sm=$page->getApplication()->getSecurityManager();
8127 8127
 		if($page->getEnableStateValidation())
@@ -8134,7 +8134,7 @@  discard block
 block discarded – undo
8134 8134
 			$str=$sm->encrypt($str);
8135 8135
 		return base64_encode($str);
8136 8136
 	}
8137
-	public static function unserialize($page,$data)
8137
+	public static function unserialize($page, $data)
8138 8138
 	{
8139 8139
 		$str=base64_decode($data);
8140 8140
 		if($str==='')
@@ -8185,13 +8185,13 @@  discard block
 block discarded – undo
8185 8185
 		if(!$this->_cacheChecked)
8186 8186
 		{
8187 8187
 			$this->_cacheChecked=true;
8188
-			if($this->_duration>0 && ($this->_cachePostBack || !$this->getPage()->getIsPostBack()))
8188
+			if($this->_duration > 0 && ($this->_cachePostBack || !$this->getPage()->getIsPostBack()))
8189 8189
 			{
8190 8190
 				if($this->_cacheModuleID!=='')
8191 8191
 				{
8192 8192
 					$this->_cache=$this->getApplication()->getModule($this->_cacheModuleID);
8193 8193
 					if(!($this->_cache instanceof ICache))
8194
-						throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID);
8194
+						throw new TConfigurationException('outputcache_cachemoduleid_invalid', $this->_cacheModuleID);
8195 8195
 				}
8196 8196
 				else
8197 8197
 					$this->_cache=$this->getApplication()->getCache();
@@ -8202,14 +8202,14 @@  discard block
 block discarded – undo
8202 8202
 					if(is_array($data))
8203 8203
 					{
8204 8204
 						$param=new TOutputCacheCheckDependencyEventParameter;
8205
-						$param->setCacheTime(isset($data[3])?$data[3]:0);
8205
+						$param->setCacheTime(isset($data[3]) ? $data[3] : 0);
8206 8206
 						$this->onCheckDependency($param);
8207 8207
 						$this->_dataCached=$param->getIsValid();
8208 8208
 					}
8209 8209
 					else
8210 8210
 						$this->_dataCached=false;
8211 8211
 					if($this->_dataCached)
8212
-						list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data;
8212
+						list($this->_contents, $this->_state, $this->_actions, $this->_cacheTime)=$data;
8213 8213
 				}
8214 8214
 			}
8215 8215
 		}
@@ -8249,11 +8249,11 @@  discard block
 block discarded – undo
8249 8249
 		foreach($this->_actions as $action)
8250 8250
 		{
8251 8251
 			if($action[0]==='Page.ClientScript')
8252
-				call_user_func_array(array($cs,$action[1]),$action[2]);
8252
+				call_user_func_array(array($cs, $action[1]), $action[2]);
8253 8253
 			else if($action[0]==='Page')
8254
-				call_user_func_array(array($page,$action[1]),$action[2]);
8254
+				call_user_func_array(array($page, $action[1]), $action[2]);
8255 8255
 			else
8256
-				call_user_func_array(array($this->getSubProperty($action[0]),$action[1]),$action[2]);
8256
+				call_user_func_array(array($this->getSubProperty($action[0]), $action[1]), $action[2]);
8257 8257
 		}
8258 8258
 	}
8259 8259
 	protected function preRenderRecursive()
@@ -8268,10 +8268,10 @@  discard block
 block discarded – undo
8268 8268
 		else
8269 8269
 			parent::preRenderRecursive();
8270 8270
 	}
8271
-	protected function loadStateRecursive(&$state,$needViewState=true)
8271
+	protected function loadStateRecursive(&$state, $needViewState=true)
8272 8272
 	{
8273 8273
 		$st=unserialize($state);
8274
-		parent::loadStateRecursive($st,$needViewState);
8274
+		parent::loadStateRecursive($st, $needViewState);
8275 8275
 	}
8276 8276
 	protected function &saveStateRecursive($needViewState=true)
8277 8277
 	{
@@ -8284,9 +8284,9 @@  discard block
 block discarded – undo
8284 8284
 			return $this->_state;
8285 8285
 		}
8286 8286
 	}
8287
-	public function registerAction($context,$funcName,$funcParams)
8287
+	public function registerAction($context, $funcName, $funcParams)
8288 8288
 	{
8289
-		$this->_actions[]=array($context,$funcName,$funcParams);
8289
+		$this->_actions[]=array($context, $funcName, $funcParams);
8290 8290
 	}
8291 8291
 	public function getCacheKey()
8292 8292
 	{
@@ -8303,7 +8303,7 @@  discard block
 block discarded – undo
8303 8303
 		{
8304 8304
 			$params=array();
8305 8305
 			$request=$this->getRequest();
8306
-			foreach(explode(',',$this->_varyByParam) as $name)
8306
+			foreach(explode(',', $this->_varyByParam) as $name)
8307 8307
 			{
8308 8308
 				$name=trim($name);
8309 8309
 				$params[$name]=$request->itemAt($name);
@@ -8349,8 +8349,8 @@  discard block
 block discarded – undo
8349 8349
 	}
8350 8350
 	public function setDuration($value)
8351 8351
 	{
8352
-		if(($value=TPropertyValue::ensureInteger($value))<0)
8353
-			throw new TInvalidDataValueException('outputcache_duration_invalid',get_class($this));
8352
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
8353
+			throw new TInvalidDataValueException('outputcache_duration_invalid', get_class($this));
8354 8354
 		$this->_duration=$value;
8355 8355
 	}
8356 8356
 	public function getVaryByParam()
@@ -8379,11 +8379,11 @@  discard block
 block discarded – undo
8379 8379
 	}
8380 8380
 	public function onCheckDependency($param)
8381 8381
 	{
8382
-		$this->raiseEvent('OnCheckDependency',$this,$param);
8382
+		$this->raiseEvent('OnCheckDependency', $this, $param);
8383 8383
 	}
8384 8384
 	public function onCalculateKey($param)
8385 8385
 	{
8386
-		$this->raiseEvent('OnCalculateKey',$this,$param);
8386
+		$this->raiseEvent('OnCalculateKey', $this, $param);
8387 8387
 	}
8388 8388
 	public function render($writer)
8389 8389
 	{
@@ -8391,16 +8391,16 @@  discard block
 block discarded – undo
8391 8391
 			$writer->write($this->_contents);
8392 8392
 		else if($this->_cacheAvailable)
8393 8393
 		{
8394
-			$textwriter = new TTextWriter();
8395
-			$multiwriter = new TOutputCacheTextWriterMulti(array($writer->getWriter(),$textwriter));
8396
-			$htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $multiwriter);
8394
+			$textwriter=new TTextWriter();
8395
+			$multiwriter=new TOutputCacheTextWriterMulti(array($writer->getWriter(), $textwriter));
8396
+			$htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $multiwriter);
8397 8397
 			$stack=$this->getPage()->getCachingStack();
8398 8398
 			$stack->push($this);
8399 8399
 			parent::render($htmlWriter);
8400 8400
 			$stack->pop();
8401 8401
 			$content=$textwriter->flush();
8402
-			$data=array($content,$this->_state,$this->_actions,time());
8403
-			$this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency());
8402
+			$data=array($content, $this->_state, $this->_actions, time());
8403
+			$this->_cache->set($this->getCacheKey(), $data, $this->getDuration(), $this->getCacheDependency());
8404 8404
 		}
8405 8405
 		else
8406 8406
 			parent::render($writer);
@@ -8444,7 +8444,7 @@  discard block
 block discarded – undo
8444 8444
 	protected $_writers;
8445 8445
 	public function __construct(Array $writers)
8446 8446
 	{
8447
-				$this->_writers = $writers;
8447
+				$this->_writers=$writers;
8448 8448
 	}
8449 8449
 	public function write($s)
8450 8450
 	{
@@ -8454,7 +8454,7 @@  discard block
 block discarded – undo
8454 8454
 	public function flush()
8455 8455
 	{
8456 8456
 		foreach($this->_writers as $writer)
8457
-			$s = $writer->flush();
8457
+			$s=$writer->flush();
8458 8458
 		return $s;
8459 8459
 	}
8460 8460
 }
@@ -8477,19 +8477,19 @@  discard block
 block discarded – undo
8477 8477
 		if(($fileName=$this->getLocalizedTemplate($fileName))!==null)
8478 8478
 		{
8479 8479
 			if(($cache=$this->getApplication()->getCache())===null)
8480
-				return new TTemplate(file_get_contents($fileName),dirname($fileName),$fileName);
8480
+				return new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName);
8481 8481
 			else
8482 8482
 			{
8483 8483
 				$array=$cache->get(self::TEMPLATE_CACHE_PREFIX.$fileName);
8484 8484
 				if(is_array($array))
8485 8485
 				{
8486
-					list($template,$timestamps)=$array;
8486
+					list($template, $timestamps)=$array;
8487 8487
 					if($this->getApplication()->getMode()===TApplicationMode::Performance)
8488 8488
 						return $template;
8489 8489
 					$cacheValid=true;
8490 8490
 					foreach($timestamps as $tplFile=>$timestamp)
8491 8491
 					{
8492
-						if(!is_file($tplFile) || filemtime($tplFile)>$timestamp)
8492
+						if(!is_file($tplFile) || filemtime($tplFile) > $timestamp)
8493 8493
 						{
8494 8494
 							$cacheValid=false;
8495 8495
 							break;
@@ -8498,13 +8498,13 @@  discard block
 block discarded – undo
8498 8498
 					if($cacheValid)
8499 8499
 						return $template;
8500 8500
 				}
8501
-				$template=new TTemplate(file_get_contents($fileName),dirname($fileName),$fileName);
8501
+				$template=new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName);
8502 8502
 				$includedFiles=$template->getIncludedFiles();
8503 8503
 				$timestamps=array();
8504 8504
 				$timestamps[$fileName]=filemtime($fileName);
8505 8505
 				foreach($includedFiles as $includedFile)
8506 8506
 					$timestamps[$includedFile]=filemtime($includedFile);
8507
-				$cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName,array($template,$timestamps));
8507
+				$cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName, array($template, $timestamps));
8508 8508
 				return $template;
8509 8509
 			}
8510 8510
 		}
@@ -8514,7 +8514,7 @@  discard block
 block discarded – undo
8514 8514
 	protected function getLocalizedTemplate($filename)
8515 8515
 	{
8516 8516
 		if(($app=$this->getApplication()->getGlobalization(false))===null)
8517
-			return is_file($filename)?$filename:null;
8517
+			return is_file($filename) ? $filename : null;
8518 8518
 		foreach($app->getLocalizedResource($filename) as $file)
8519 8519
 		{
8520 8520
 			if(($file=realpath($file))!==false && is_file($file))
@@ -8544,7 +8544,7 @@  discard block
 block discarded – undo
8544 8544
 	private $_includedFiles=array();
8545 8545
 	private $_includeAtLine=array();
8546 8546
 	private $_includeLines=array();
8547
-	public function __construct($template,$contextPath,$tplFile=null,$startingLine=0,$sourceTemplate=true)
8547
+	public function __construct($template, $contextPath, $tplFile=null, $startingLine=0, $sourceTemplate=true)
8548 8548
 	{
8549 8549
 		$this->_sourceTemplate=$sourceTemplate;
8550 8550
 		$this->_contextPath=$contextPath;
@@ -8553,7 +8553,7 @@  discard block
 block discarded – undo
8553 8553
 		$this->_content=$template;
8554 8554
 		$this->_hashCode=md5($template);
8555 8555
 		$this->parse($template);
8556
-		$this->_content=null; 	}
8556
+		$this->_content=null; }
8557 8557
 	public function getTemplateFile()
8558 8558
 	{
8559 8559
 		return $this->_tplFile;
@@ -8578,7 +8578,7 @@  discard block
 block discarded – undo
8578 8578
 	{
8579 8579
 		return $this->_tpl;
8580 8580
 	}
8581
-	public function instantiateIn($tplControl,$parentControl=null)
8581
+	public function instantiateIn($tplControl, $parentControl=null)
8582 8582
 	{
8583 8583
 		$this->_tplControl=$tplControl;
8584 8584
 		if($parentControl===null)
@@ -8595,7 +8595,7 @@  discard block
 block discarded – undo
8595 8595
 				$parent=$controls[$object[0]];
8596 8596
 			else
8597 8597
 				continue;
8598
-			if(isset($object[2]))				{
8598
+			if(isset($object[2])) {
8599 8599
 				$component=Prado::createComponent($object[1]);
8600 8600
 				$properties=&$object[2];
8601 8601
 				if($component instanceof TControl)
@@ -8607,7 +8607,7 @@  discard block
 block discarded – undo
8607 8607
 					{
8608 8608
 						if(is_array($properties['id']))
8609 8609
 							$properties['id']=$component->evaluateExpression($properties['id'][1]);
8610
-						$tplControl->registerObject($properties['id'],$component);
8610
+						$tplControl->registerObject($properties['id'], $component);
8611 8611
 					}
8612 8612
 					if(isset($properties['skinid']))
8613 8613
 					{
@@ -8620,7 +8620,7 @@  discard block
 block discarded – undo
8620 8620
 					$component->trackViewState(false);
8621 8621
 					$component->applyStyleSheetSkin($page);
8622 8622
 					foreach($properties as $name=>$value)
8623
-						$this->configureControl($component,$name,$value);
8623
+						$this->configureControl($component, $name, $value);
8624 8624
 					$component->trackViewState(true);
8625 8625
 					if($parent===$parentControl)
8626 8626
 						$directChildren[]=$component;
@@ -8636,12 +8636,12 @@  discard block
 block discarded – undo
8636 8636
 					{
8637 8637
 						if(is_array($properties['id']))
8638 8638
 							$properties['id']=$component->evaluateExpression($properties['id'][1]);
8639
-						$tplControl->registerObject($properties['id'],$component);
8639
+						$tplControl->registerObject($properties['id'], $component);
8640 8640
 						if(!$component->hasProperty('id'))
8641 8641
 							unset($properties['id']);
8642 8642
 					}
8643 8643
 					foreach($properties as $name=>$value)
8644
-						$this->configureComponent($component,$name,$value);
8644
+						$this->configureComponent($component, $name, $value);
8645 8645
 					if($parent===$parentControl)
8646 8646
 						$directChildren[]=$component;
8647 8647
 					else
@@ -8676,36 +8676,36 @@  discard block
 block discarded – undo
8676 8676
 				$parentControl->addParsedObject($control);
8677 8677
 		}
8678 8678
 	}
8679
-	protected function configureControl($control,$name,$value)
8679
+	protected function configureControl($control, $name, $value)
8680 8680
 	{
8681
-		if(strncasecmp($name,'on',2)===0)					$this->configureEvent($control,$name,$value,$control);
8682
-		else if(($pos=strrpos($name,'.'))===false)				$this->configureProperty($control,$name,$value);
8683
-		else				$this->configureSubProperty($control,$name,$value);
8681
+		if(strncasecmp($name, 'on', 2)===0)					$this->configureEvent($control, $name, $value, $control);
8682
+		else if(($pos=strrpos($name, '.'))===false)				$this->configureProperty($control, $name, $value);
8683
+		else				$this->configureSubProperty($control, $name, $value);
8684 8684
 	}
8685
-	protected function configureComponent($component,$name,$value)
8685
+	protected function configureComponent($component, $name, $value)
8686 8686
 	{
8687
-		if(strpos($name,'.')===false)				$this->configureProperty($component,$name,$value);
8688
-		else				$this->configureSubProperty($component,$name,$value);
8687
+		if(strpos($name, '.')===false)				$this->configureProperty($component, $name, $value);
8688
+		else				$this->configureSubProperty($component, $name, $value);
8689 8689
 	}
8690
-	protected function configureEvent($control,$name,$value,$contextControl)
8690
+	protected function configureEvent($control, $name, $value, $contextControl)
8691 8691
 	{
8692
-		if(strpos($value,'.')===false)
8693
-			$control->attachEventHandler($name,array($contextControl,'TemplateControl.'.$value));
8692
+		if(strpos($value, '.')===false)
8693
+			$control->attachEventHandler($name, array($contextControl, 'TemplateControl.'.$value));
8694 8694
 		else
8695
-			$control->attachEventHandler($name,array($contextControl,$value));
8695
+			$control->attachEventHandler($name, array($contextControl, $value));
8696 8696
 	}
8697
-	protected function configureProperty($component,$name,$value)
8697
+	protected function configureProperty($component, $name, $value)
8698 8698
 	{
8699 8699
 		if(is_array($value))
8700 8700
 		{
8701 8701
 			switch($value[0])
8702 8702
 			{
8703 8703
 				case self::CONFIG_DATABIND:
8704
-					$component->bindProperty($name,$value[1]);
8704
+					$component->bindProperty($name, $value[1]);
8705 8705
 					break;
8706 8706
 				case self::CONFIG_EXPRESSION:
8707 8707
 					if($component instanceof TControl)
8708
-						$component->autoBindProperty($name,$value[1]);
8708
+						$component->autoBindProperty($name, $value[1]);
8709 8709
 					else
8710 8710
 					{
8711 8711
 						$setter='set'.$name;
@@ -8727,55 +8727,55 @@  discard block
 block discarded – undo
8727 8727
 					$setter='set'.$name;
8728 8728
 					$component->$setter(Prado::localize($value[1]));
8729 8729
 					break;
8730
-				default:						throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
8730
+				default:						throw new TConfigurationException('template_tag_unexpected', $name, $value[1]);
8731 8731
 					break;
8732 8732
 			}
8733 8733
 		}
8734 8734
 		else
8735 8735
 		{
8736
-			if (substr($name,0,2)=='js')
8737
-				if ($value and !($value instanceof TJavaScriptLiteral))
8738
-					$value = new TJavaScriptLiteral($value);
8736
+			if(substr($name, 0, 2)=='js')
8737
+				if($value and !($value instanceof TJavaScriptLiteral))
8738
+					$value=new TJavaScriptLiteral($value);
8739 8739
 			$setter='set'.$name;
8740 8740
 			$component->$setter($value);
8741 8741
 		}
8742 8742
 	}
8743
-	protected function configureSubProperty($component,$name,$value)
8743
+	protected function configureSubProperty($component, $name, $value)
8744 8744
 	{
8745 8745
 		if(is_array($value))
8746 8746
 		{
8747 8747
 			switch($value[0])
8748 8748
 			{
8749
-				case self::CONFIG_DATABIND:							$component->bindProperty($name,$value[1]);
8749
+				case self::CONFIG_DATABIND:							$component->bindProperty($name, $value[1]);
8750 8750
 					break;
8751 8751
 				case self::CONFIG_EXPRESSION:							if($component instanceof TControl)
8752
-						$component->autoBindProperty($name,$value[1]);
8752
+						$component->autoBindProperty($name, $value[1]);
8753 8753
 					else
8754
-						$component->setSubProperty($name,$this->_tplControl->evaluateExpression($value[1]));
8754
+						$component->setSubProperty($name, $this->_tplControl->evaluateExpression($value[1]));
8755 8755
 					break;
8756 8756
 				case self::CONFIG_TEMPLATE:
8757
-					$component->setSubProperty($name,$value[1]);
8757
+					$component->setSubProperty($name, $value[1]);
8758 8758
 					break;
8759 8759
 				case self::CONFIG_ASSET:							$url=$this->publishFilePath($this->_contextPath.DIRECTORY_SEPARATOR.$value[1]);
8760
-					$component->setSubProperty($name,$url);
8760
+					$component->setSubProperty($name, $url);
8761 8761
 					break;
8762
-				case self::CONFIG_PARAMETER:							$component->setSubProperty($name,$this->getApplication()->getParameters()->itemAt($value[1]));
8762
+				case self::CONFIG_PARAMETER:							$component->setSubProperty($name, $this->getApplication()->getParameters()->itemAt($value[1]));
8763 8763
 					break;
8764 8764
 				case self::CONFIG_LOCALIZATION:
8765
-					$component->setSubProperty($name,Prado::localize($value[1]));
8765
+					$component->setSubProperty($name, Prado::localize($value[1]));
8766 8766
 					break;
8767
-				default:						throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
8767
+				default:						throw new TConfigurationException('template_tag_unexpected', $name, $value[1]);
8768 8768
 					break;
8769 8769
 			}
8770 8770
 		}
8771 8771
 		else
8772
-			$component->setSubProperty($name,$value);
8772
+			$component->setSubProperty($name, $value);
8773 8773
 	}
8774 8774
 	protected function parse($input)
8775 8775
 	{
8776 8776
 		$input=$this->preprocess($input);
8777 8777
 		$tpl=&$this->_tpl;
8778
-		$n=preg_match_all(self::REGEX_RULES,$input,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
8778
+		$n=preg_match_all(self::REGEX_RULES, $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
8779 8779
 		$expectPropEnd=false;
8780 8780
 		$textStart=0;
8781 8781
 				$stack=array();
@@ -8785,171 +8785,171 @@  discard block
 block discarded – undo
8785 8785
 		$this->_directive=null;
8786 8786
 		try
8787 8787
 		{
8788
-			for($i=0;$i<$n;++$i)
8788
+			for($i=0; $i < $n; ++$i)
8789 8789
 			{
8790 8790
 				$match=&$matches[$i];
8791 8791
 				$str=$match[0][0];
8792 8792
 				$matchStart=$match[0][1];
8793
-				$matchEnd=$matchStart+strlen($str)-1;
8794
-				if(strpos($str,'<com:')===0)					{
8793
+				$matchEnd=$matchStart + strlen($str) - 1;
8794
+				if(strpos($str, '<com:')===0) {
8795 8795
 					if($expectPropEnd)
8796 8796
 						continue;
8797
-					if($matchStart>$textStart)
8798
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8799
-					$textStart=$matchEnd+1;
8797
+					if($matchStart > $textStart)
8798
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8799
+					$textStart=$matchEnd + 1;
8800 8800
 					$type=$match[1][0];
8801
-					$attributes=$this->parseAttributes($match[2][0],$match[2][1]);
8802
-					$this->validateAttributes($type,$attributes);
8803
-					$tpl[$c++]=array($container,$type,$attributes);
8804
-					if($str[strlen($str)-2]!=='/')  					{
8805
-						$stack[] = $type;
8806
-						$container=$c-1;
8801
+					$attributes=$this->parseAttributes($match[2][0], $match[2][1]);
8802
+					$this->validateAttributes($type, $attributes);
8803
+					$tpl[$c++]=array($container, $type, $attributes);
8804
+					if($str[strlen($str) - 2]!=='/') {
8805
+						$stack[]=$type;
8806
+						$container=$c - 1;
8807 8807
 					}
8808 8808
 				}
8809
-				else if(strpos($str,'</com:')===0)					{
8809
+				else if(strpos($str, '</com:')===0) {
8810 8810
 					if($expectPropEnd)
8811 8811
 						continue;
8812
-					if($matchStart>$textStart)
8813
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8814
-					$textStart=$matchEnd+1;
8812
+					if($matchStart > $textStart)
8813
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8814
+					$textStart=$matchEnd + 1;
8815 8815
 					$type=$match[1][0];
8816 8816
 					if(empty($stack))
8817
-						throw new TConfigurationException('template_closingtag_unexpected',"</com:$type>");
8817
+						throw new TConfigurationException('template_closingtag_unexpected', "</com:$type>");
8818 8818
 					$name=array_pop($stack);
8819 8819
 					if($name!==$type)
8820 8820
 					{
8821
-						$tag=$name[0]==='@' ? '</prop:'.substr($name,1).'>' : "</com:$name>";
8822
-						throw new TConfigurationException('template_closingtag_expected',$tag);
8821
+						$tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>";
8822
+						throw new TConfigurationException('template_closingtag_expected', $tag);
8823 8823
 					}
8824 8824
 					$container=$tpl[$container][0];
8825 8825
 				}
8826
-				else if(strpos($str,'<%@')===0)					{
8826
+				else if(strpos($str, '<%@')===0) {
8827 8827
 					if($expectPropEnd)
8828 8828
 						continue;
8829
-					if($matchStart>$textStart)
8830
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8831
-					$textStart=$matchEnd+1;
8829
+					if($matchStart > $textStart)
8830
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8831
+					$textStart=$matchEnd + 1;
8832 8832
 					if(isset($tpl[0]) || $this->_directive!==null)
8833 8833
 						throw new TConfigurationException('template_directive_nonunique');
8834
-					$this->_directive=$this->parseAttributes($match[4][0],$match[4][1]);
8834
+					$this->_directive=$this->parseAttributes($match[4][0], $match[4][1]);
8835 8835
 				}
8836
-				else if(strpos($str,'<%')===0)					{
8836
+				else if(strpos($str, '<%')===0) {
8837 8837
 					if($expectPropEnd)
8838 8838
 						continue;
8839
-					if($matchStart>$textStart)
8840
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8841
-					$textStart=$matchEnd+1;
8839
+					if($matchStart > $textStart)
8840
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8841
+					$textStart=$matchEnd + 1;
8842 8842
 					$literal=trim($match[5][0]);
8843
-					if($str[2]==='=')							$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,$literal));
8844
-					else if($str[2]==='%')  						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_STATEMENTS,$literal));
8843
+					if($str[2]==='=')							$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, $literal));
8844
+					else if($str[2]==='%')  						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_STATEMENTS, $literal));
8845 8845
 					else if($str[2]==='#')
8846
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_DATABINDING,$literal));
8846
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_DATABINDING, $literal));
8847 8847
 					else if($str[2]==='$')
8848
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"\$this->getApplication()->getParameters()->itemAt('$literal')"));
8848
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "\$this->getApplication()->getParameters()->itemAt('$literal')"));
8849 8849
 					else if($str[2]==='~')
8850
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"\$this->publishFilePath('$this->_contextPath/$literal')"));
8850
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "\$this->publishFilePath('$this->_contextPath/$literal')"));
8851 8851
 					else if($str[2]==='/')
8852
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"));
8852
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"));
8853 8853
 					else if($str[2]==='[')
8854 8854
 					{
8855
-						$literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\"));
8856
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')"));
8855
+						$literal=strtr(trim(substr($literal, 0, strlen($literal) - 1)), array("'"=>"\'", "\\"=>"\\\\"));
8856
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "Prado::localize('$literal')"));
8857 8857
 					}
8858 8858
 				}
8859
-				else if(strpos($str,'<prop:')===0)					{
8860
-					if(strrpos($str,'/>')===strlen($str)-2)  					{
8859
+				else if(strpos($str, '<prop:')===0) {
8860
+					if(strrpos($str, '/>')===strlen($str) - 2) {
8861 8861
 						if($expectPropEnd)
8862 8862
 							continue;
8863
-						if($matchStart>$textStart)
8864
-							$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8865
-						$textStart=$matchEnd+1;
8863
+						if($matchStart > $textStart)
8864
+							$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8865
+						$textStart=$matchEnd + 1;
8866 8866
 						$prop=strtolower($match[6][0]);
8867
-						$attrs=$this->parseAttributes($match[7][0],$match[7][1]);
8867
+						$attrs=$this->parseAttributes($match[7][0], $match[7][1]);
8868 8868
 						$attributes=array();
8869 8869
 						foreach($attrs as $name=>$value)
8870 8870
 							$attributes[$prop.'.'.$name]=$value;
8871 8871
 						$type=$tpl[$container][1];
8872
-						$this->validateAttributes($type,$attributes);
8872
+						$this->validateAttributes($type, $attributes);
8873 8873
 						foreach($attributes as $name=>$value)
8874 8874
 						{
8875 8875
 							if(isset($tpl[$container][2][$name]))
8876
-								throw new TConfigurationException('template_property_duplicated',$name);
8876
+								throw new TConfigurationException('template_property_duplicated', $name);
8877 8877
 							$tpl[$container][2][$name]=$value;
8878 8878
 						}
8879 8879
 					}
8880
-					else  					{
8880
+					else {
8881 8881
 						$prop=strtolower($match[3][0]);
8882
-						$stack[] = '@'.$prop;
8882
+						$stack[]='@'.$prop;
8883 8883
 						if(!$expectPropEnd)
8884 8884
 						{
8885
-							if($matchStart>$textStart)
8886
-								$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8887
-							$textStart=$matchEnd+1;
8885
+							if($matchStart > $textStart)
8886
+								$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8887
+							$textStart=$matchEnd + 1;
8888 8888
 							$expectPropEnd=true;
8889 8889
 						}
8890 8890
 					}
8891 8891
 				}
8892
-				else if(strpos($str,'</prop:')===0)					{
8892
+				else if(strpos($str, '</prop:')===0) {
8893 8893
 					$prop=strtolower($match[3][0]);
8894 8894
 					if(empty($stack))
8895
-						throw new TConfigurationException('template_closingtag_unexpected',"</prop:$prop>");
8895
+						throw new TConfigurationException('template_closingtag_unexpected', "</prop:$prop>");
8896 8896
 					$name=array_pop($stack);
8897 8897
 					if($name!=='@'.$prop)
8898 8898
 					{
8899
-						$tag=$name[0]==='@' ? '</prop:'.substr($name,1).'>' : "</com:$name>";
8900
-						throw new TConfigurationException('template_closingtag_expected',$tag);
8899
+						$tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>";
8900
+						throw new TConfigurationException('template_closingtag_expected', $tag);
8901 8901
 					}
8902
-					if(($last=count($stack))<1 || $stack[$last-1][0]!=='@')
8902
+					if(($last=count($stack)) < 1 || $stack[$last - 1][0]!=='@')
8903 8903
 					{
8904
-						if($matchStart>$textStart)
8904
+						if($matchStart > $textStart)
8905 8905
 						{
8906
-							$value=substr($input,$textStart,$matchStart-$textStart);
8907
-							if(substr($prop,-8,8)==='template')
8908
-								$value=$this->parseTemplateProperty($value,$textStart);
8906
+							$value=substr($input, $textStart, $matchStart - $textStart);
8907
+							if(substr($prop, -8, 8)==='template')
8908
+								$value=$this->parseTemplateProperty($value, $textStart);
8909 8909
 							else
8910 8910
 								$value=$this->parseAttribute($value);
8911
-							if($container>=0)
8911
+							if($container >= 0)
8912 8912
 							{
8913 8913
 								$type=$tpl[$container][1];
8914
-								$this->validateAttributes($type,array($prop=>$value));
8914
+								$this->validateAttributes($type, array($prop=>$value));
8915 8915
 								if(isset($tpl[$container][2][$prop]))
8916
-									throw new TConfigurationException('template_property_duplicated',$prop);
8916
+									throw new TConfigurationException('template_property_duplicated', $prop);
8917 8917
 								$tpl[$container][2][$prop]=$value;
8918 8918
 							}
8919 8919
 							else									$this->_directive[$prop]=$value;
8920
-							$textStart=$matchEnd+1;
8920
+							$textStart=$matchEnd + 1;
8921 8921
 						}
8922 8922
 						$expectPropEnd=false;
8923 8923
 					}
8924 8924
 				}
8925
-				else if(strpos($str,'<!--')===0)					{
8925
+				else if(strpos($str, '<!--')===0) {
8926 8926
 					if($expectPropEnd)
8927 8927
 						throw new TConfigurationException('template_comments_forbidden');
8928
-					if($matchStart>$textStart)
8929
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
8930
-					$textStart=$matchEnd+1;
8928
+					if($matchStart > $textStart)
8929
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
8930
+					$textStart=$matchEnd + 1;
8931 8931
 				}
8932 8932
 				else
8933
-					throw new TConfigurationException('template_matching_unexpected',$match);
8933
+					throw new TConfigurationException('template_matching_unexpected', $match);
8934 8934
 			}
8935 8935
 			if(!empty($stack))
8936 8936
 			{
8937 8937
 				$name=array_pop($stack);
8938
-				$tag=$name[0]==='@' ? '</prop:'.substr($name,1).'>' : "</com:$name>";
8939
-				throw new TConfigurationException('template_closingtag_expected',$tag);
8938
+				$tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>";
8939
+				throw new TConfigurationException('template_closingtag_expected', $tag);
8940 8940
 			}
8941
-			if($textStart<strlen($input))
8942
-				$tpl[$c++]=array($container,substr($input,$textStart));
8941
+			if($textStart < strlen($input))
8942
+				$tpl[$c++]=array($container, substr($input, $textStart));
8943 8943
 		}
8944 8944
 		catch(Exception $e)
8945 8945
 		{
8946 8946
 			if(($e instanceof TException) && ($e instanceof TTemplateException))
8947 8947
 				throw $e;
8948 8948
 			if($matchEnd===0)
8949
-				$line=$this->_startingLine+1;
8949
+				$line=$this->_startingLine + 1;
8950 8950
 			else
8951
-				$line=$this->_startingLine+count(explode("\n",substr($input,0,$matchEnd+1)));
8952
-			$this->handleException($e,$line,$input);
8951
+				$line=$this->_startingLine + count(explode("\n", substr($input, 0, $matchEnd + 1)));
8952
+			$this->handleException($e, $line, $input);
8953 8953
 		}
8954 8954
 		if($this->_directive===null)
8955 8955
 			$this->_directive=array();
@@ -8963,9 +8963,9 @@  discard block
 block discarded – undo
8963 8963
 				if($parent!==null)
8964 8964
 				{
8965 8965
 					if(count($merged[1])===1 && is_string($merged[1][0]))
8966
-						$objects[$id-1]=array($merged[0],$merged[1][0]);
8966
+						$objects[$id - 1]=array($merged[0], $merged[1][0]);
8967 8967
 					else
8968
-						$objects[$id-1]=array($merged[0],new TCompositeLiteral($merged[1]));
8968
+						$objects[$id - 1]=array($merged[0], new TCompositeLiteral($merged[1]));
8969 8969
 				}
8970 8970
 				if(isset($object[2]))
8971 8971
 				{
@@ -8975,7 +8975,7 @@  discard block
 block discarded – undo
8975 8975
 				else
8976 8976
 				{
8977 8977
 					$parent=$object[0];
8978
-					$merged=array($parent,array($object[1]));
8978
+					$merged=array($parent, array($object[1]));
8979 8979
 				}
8980 8980
 			}
8981 8981
 			else
@@ -8984,57 +8984,57 @@  discard block
 block discarded – undo
8984 8984
 		if($parent!==null)
8985 8985
 		{
8986 8986
 			if(count($merged[1])===1 && is_string($merged[1][0]))
8987
-				$objects[$id]=array($merged[0],$merged[1][0]);
8987
+				$objects[$id]=array($merged[0], $merged[1][0]);
8988 8988
 			else
8989
-				$objects[$id]=array($merged[0],new TCompositeLiteral($merged[1]));
8989
+				$objects[$id]=array($merged[0], new TCompositeLiteral($merged[1]));
8990 8990
 		}
8991 8991
 		$tpl=$objects;
8992 8992
 		return $objects;
8993 8993
 	}
8994
-	protected function parseAttributes($str,$offset)
8994
+	protected function parseAttributes($str, $offset)
8995 8995
 	{
8996 8996
 		if($str==='')
8997 8997
 			return array();
8998 8998
 		$pattern='/([\w\.\-]+)\s*=\s*(\'.*?\'|".*?"|<%.*?%>)/msS';
8999 8999
 		$attributes=array();
9000
-		$n=preg_match_all($pattern,$str,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
9001
-		for($i=0;$i<$n;++$i)
9000
+		$n=preg_match_all($pattern, $str, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
9001
+		for($i=0; $i < $n; ++$i)
9002 9002
 		{
9003 9003
 			$match=&$matches[$i];
9004 9004
 			$name=strtolower($match[1][0]);
9005 9005
 			if(isset($attributes[$name]))
9006
-				throw new TConfigurationException('template_property_duplicated',$name);
9006
+				throw new TConfigurationException('template_property_duplicated', $name);
9007 9007
 			$value=$match[2][0];
9008
-			if(substr($name,-8,8)==='template')
9008
+			if(substr($name, -8, 8)==='template')
9009 9009
 			{
9010 9010
 				if($value[0]==='\'' || $value[0]==='"')
9011
-					$attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1);
9011
+					$attributes[$name]=$this->parseTemplateProperty(substr($value, 1, strlen($value) - 2), $match[2][1] + 1);
9012 9012
 				else
9013
-					$attributes[$name]=$this->parseTemplateProperty($value,$match[2][1]);
9013
+					$attributes[$name]=$this->parseTemplateProperty($value, $match[2][1]);
9014 9014
 			}
9015 9015
 			else
9016 9016
 			{
9017 9017
 				if($value[0]==='\'' || $value[0]==='"')
9018
-					$attributes[$name]=$this->parseAttribute(substr($value,1,strlen($value)-2));
9018
+					$attributes[$name]=$this->parseAttribute(substr($value, 1, strlen($value) - 2));
9019 9019
 				else
9020 9020
 					$attributes[$name]=$this->parseAttribute($value);
9021 9021
 			}
9022 9022
 		}
9023 9023
 		return $attributes;
9024 9024
 	}
9025
-	protected function parseTemplateProperty($content,$offset)
9025
+	protected function parseTemplateProperty($content, $offset)
9026 9026
 	{
9027
-		$line=$this->_startingLine+count(explode("\n",substr($this->_content,0,$offset)))-1;
9028
-		return array(self::CONFIG_TEMPLATE,new TTemplate($content,$this->_contextPath,$this->_tplFile,$line,false));
9027
+		$line=$this->_startingLine + count(explode("\n", substr($this->_content, 0, $offset))) - 1;
9028
+		return array(self::CONFIG_TEMPLATE, new TTemplate($content, $this->_contextPath, $this->_tplFile, $line, false));
9029 9029
 	}
9030 9030
 	protected function parseAttribute($value)
9031 9031
 	{
9032
-		if(($n=preg_match_all('/<%[#=].*?%>/msS',$value,$matches,PREG_OFFSET_CAPTURE))>0)
9032
+		if(($n=preg_match_all('/<%[#=].*?%>/msS', $value, $matches, PREG_OFFSET_CAPTURE)) > 0)
9033 9033
 		{
9034 9034
 			$isDataBind=false;
9035 9035
 			$textStart=0;
9036 9036
 			$expr='';
9037
-			for($i=0;$i<$n;++$i)
9037
+			for($i=0; $i < $n; ++$i)
9038 9038
 			{
9039 9039
 				$match=$matches[0][$i];
9040 9040
 				$token=$match[0];
@@ -9042,133 +9042,133 @@  discard block
 block discarded – undo
9042 9042
 				$length=strlen($token);
9043 9043
 				if($token[2]==='#')
9044 9044
 					$isDataBind=true;
9045
-				if($offset>$textStart)
9046
-					$expr.=".'".strtr(substr($value,$textStart,$offset-$textStart),array("'"=>"\\'","\\"=>"\\\\"))."'";
9047
-				$expr.='.('.substr($token,3,$length-5).')';
9048
-				$textStart=$offset+$length;
9045
+				if($offset > $textStart)
9046
+					$expr.=".'".strtr(substr($value, $textStart, $offset - $textStart), array("'"=>"\\'", "\\"=>"\\\\"))."'";
9047
+				$expr.='.('.substr($token, 3, $length - 5).')';
9048
+				$textStart=$offset + $length;
9049 9049
 			}
9050 9050
 			$length=strlen($value);
9051
-			if($length>$textStart)
9052
-				$expr.=".'".strtr(substr($value,$textStart,$length-$textStart),array("'"=>"\\'","\\"=>"\\\\"))."'";
9051
+			if($length > $textStart)
9052
+				$expr.=".'".strtr(substr($value, $textStart, $length - $textStart), array("'"=>"\\'", "\\"=>"\\\\"))."'";
9053 9053
 			if($isDataBind)
9054
-				return array(self::CONFIG_DATABIND,ltrim($expr,'.'));
9054
+				return array(self::CONFIG_DATABIND, ltrim($expr, '.'));
9055 9055
 			else
9056
-				return array(self::CONFIG_EXPRESSION,ltrim($expr,'.'));
9056
+				return array(self::CONFIG_EXPRESSION, ltrim($expr, '.'));
9057 9057
 		}
9058
-		else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value)
9058
+		else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0]===$value)
9059 9059
 		{
9060 9060
 			$value=$matches[1];
9061 9061
 			if($value[2]==='~')
9062
-				return array(self::CONFIG_ASSET,trim(substr($value,3,strlen($value)-5)));
9062
+				return array(self::CONFIG_ASSET, trim(substr($value, 3, strlen($value) - 5)));
9063 9063
 			elseif($value[2]==='[')
9064
-				return array(self::CONFIG_LOCALIZATION,trim(substr($value,3,strlen($value)-6)));
9064
+				return array(self::CONFIG_LOCALIZATION, trim(substr($value, 3, strlen($value) - 6)));
9065 9065
 			elseif($value[2]==='$')
9066
-				return array(self::CONFIG_PARAMETER,trim(substr($value,3,strlen($value)-5)));
9066
+				return array(self::CONFIG_PARAMETER, trim(substr($value, 3, strlen($value) - 5)));
9067 9067
 			elseif($value[2]==='/') {
9068
-				$literal = trim(substr($value,3,strlen($value)-5));
9069
-				return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'");
9068
+				$literal=trim(substr($value, 3, strlen($value) - 5));
9069
+				return array(self::CONFIG_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'");
9070 9070
 			}
9071 9071
 		}
9072 9072
 		else
9073 9073
 			return $value;
9074 9074
 	}
9075
-	protected function validateAttributes($type,$attributes)
9075
+	protected function validateAttributes($type, $attributes)
9076 9076
 	{
9077 9077
 		Prado::using($type);
9078
-		if(($pos=strrpos($type,'.'))!==false)
9079
-			$className=substr($type,$pos+1);
9078
+		if(($pos=strrpos($type, '.'))!==false)
9079
+			$className=substr($type, $pos + 1);
9080 9080
 		else
9081 9081
 			$className=$type;
9082 9082
 		$class=new ReflectionClass($className);
9083
-		if(is_subclass_of($className,'TControl') || $className==='TControl')
9083
+		if(is_subclass_of($className, 'TControl') || $className==='TControl')
9084 9084
 		{
9085 9085
 			foreach($attributes as $name=>$att)
9086 9086
 			{
9087
-				if(($pos=strpos($name,'.'))!==false)
9087
+				if(($pos=strpos($name, '.'))!==false)
9088 9088
 				{
9089
-										$subname=substr($name,0,$pos);
9089
+										$subname=substr($name, 0, $pos);
9090 9090
 					if(!$class->hasMethod('get'.$subname))
9091
-						throw new TConfigurationException('template_property_unknown',$type,$subname);
9091
+						throw new TConfigurationException('template_property_unknown', $type, $subname);
9092 9092
 				}
9093
-				else if(strncasecmp($name,'on',2)===0)
9093
+				else if(strncasecmp($name, 'on', 2)===0)
9094 9094
 				{
9095 9095
 										if(!$class->hasMethod($name))
9096
-						throw new TConfigurationException('template_event_unknown',$type,$name);
9096
+						throw new TConfigurationException('template_event_unknown', $type, $name);
9097 9097
 					else if(!is_string($att))
9098
-						throw new TConfigurationException('template_eventhandler_invalid',$type,$name);
9098
+						throw new TConfigurationException('template_eventhandler_invalid', $type, $name);
9099 9099
 				}
9100 9100
 				else
9101 9101
 				{
9102
-										if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) )
9102
+										if(!($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class, 'set'.$name)))
9103 9103
 					{
9104
-						if ($class->hasMethod('get'.$name) || $class->hasMethod('getjs'.$name))
9105
-							throw new TConfigurationException('template_property_readonly',$type,$name);
9104
+						if($class->hasMethod('get'.$name) || $class->hasMethod('getjs'.$name))
9105
+							throw new TConfigurationException('template_property_readonly', $type, $name);
9106 9106
 						else
9107
-							throw new TConfigurationException('template_property_unknown',$type,$name);
9107
+							throw new TConfigurationException('template_property_unknown', $type, $name);
9108 9108
 					}
9109 9109
 					else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION)
9110 9110
 					{
9111
-						if(strcasecmp($name,'id')===0)
9112
-							throw new TConfigurationException('template_controlid_invalid',$type);
9113
-						else if(strcasecmp($name,'skinid')===0)
9114
-							throw new TConfigurationException('template_controlskinid_invalid',$type);
9111
+						if(strcasecmp($name, 'id')===0)
9112
+							throw new TConfigurationException('template_controlid_invalid', $type);
9113
+						else if(strcasecmp($name, 'skinid')===0)
9114
+							throw new TConfigurationException('template_controlskinid_invalid', $type);
9115 9115
 					}
9116 9116
 				}
9117 9117
 			}
9118 9118
 		}
9119
-		else if(is_subclass_of($className,'TComponent') || $className==='TComponent')
9119
+		else if(is_subclass_of($className, 'TComponent') || $className==='TComponent')
9120 9120
 		{
9121 9121
 			foreach($attributes as $name=>$att)
9122 9122
 			{
9123 9123
 				if(is_array($att) && ($att[0]===self::CONFIG_DATABIND))
9124
-					throw new TConfigurationException('template_databind_forbidden',$type,$name);
9125
-				if(($pos=strpos($name,'.'))!==false)
9124
+					throw new TConfigurationException('template_databind_forbidden', $type, $name);
9125
+				if(($pos=strpos($name, '.'))!==false)
9126 9126
 				{
9127
-										$subname=substr($name,0,$pos);
9127
+										$subname=substr($name, 0, $pos);
9128 9128
 					if(!$class->hasMethod('get'.$subname))
9129
-						throw new TConfigurationException('template_property_unknown',$type,$subname);
9129
+						throw new TConfigurationException('template_property_unknown', $type, $subname);
9130 9130
 				}
9131
-				else if(strncasecmp($name,'on',2)===0)
9132
-					throw new TConfigurationException('template_event_forbidden',$type,$name);
9131
+				else if(strncasecmp($name, 'on', 2)===0)
9132
+					throw new TConfigurationException('template_event_forbidden', $type, $name);
9133 9133
 				else
9134 9134
 				{
9135
-										if(strcasecmp($name,'id')!==0 && !($class->hasMethod('set'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)))
9135
+										if(strcasecmp($name, 'id')!==0 && !($class->hasMethod('set'.$name) || $this->isClassBehaviorMethod($class, 'set'.$name)))
9136 9136
 					{
9137 9137
 						if($class->hasMethod('get'.$name))
9138
-							throw new TConfigurationException('template_property_readonly',$type,$name);
9138
+							throw new TConfigurationException('template_property_readonly', $type, $name);
9139 9139
 						else
9140
-							throw new TConfigurationException('template_property_unknown',$type,$name);
9140
+							throw new TConfigurationException('template_property_unknown', $type, $name);
9141 9141
 					}
9142 9142
 				}
9143 9143
 			}
9144 9144
 		}
9145 9145
 		else
9146
-			throw new TConfigurationException('template_component_required',$type);
9146
+			throw new TConfigurationException('template_component_required', $type);
9147 9147
 	}
9148 9148
 	public function getIncludedFiles()
9149 9149
 	{
9150 9150
 		return $this->_includedFiles;
9151 9151
 	}
9152
-	protected function handleException($e,$line,$input=null)
9152
+	protected function handleException($e, $line, $input=null)
9153 9153
 	{
9154 9154
 		$srcFile=$this->_tplFile;
9155
-		if(($n=count($this->_includedFiles))>0) 		{
9156
-			for($i=$n-1;$i>=0;--$i)
9155
+		if(($n=count($this->_includedFiles)) > 0) {
9156
+			for($i=$n - 1; $i >= 0; --$i)
9157 9157
 			{
9158
-				if($this->_includeAtLine[$i]<=$line)
9158
+				if($this->_includeAtLine[$i] <= $line)
9159 9159
 				{
9160
-					if($line<$this->_includeAtLine[$i]+$this->_includeLines[$i])
9160
+					if($line < $this->_includeAtLine[$i] + $this->_includeLines[$i])
9161 9161
 					{
9162
-						$line=$line-$this->_includeAtLine[$i]+1;
9162
+						$line=$line - $this->_includeAtLine[$i] + 1;
9163 9163
 						$srcFile=$this->_includedFiles[$i];
9164 9164
 						break;
9165 9165
 					}
9166 9166
 					else
9167
-						$line=$line-$this->_includeLines[$i]+1;
9167
+						$line=$line - $this->_includeLines[$i] + 1;
9168 9168
 				}
9169 9169
 			}
9170 9170
 		}
9171
-		$exception=new TTemplateException('template_format_invalid',$e->getMessage());
9171
+		$exception=new TTemplateException('template_format_invalid', $e->getMessage());
9172 9172
 		$exception->setLineNumber($line);
9173 9173
 		if(!empty($srcFile))
9174 9174
 			$exception->setTemplateFile($srcFile);
@@ -9178,34 +9178,34 @@  discard block
 block discarded – undo
9178 9178
 	}
9179 9179
 	protected function preprocess($input)
9180 9180
 	{
9181
-		if($n=preg_match_all('/<%include(.*?)%>/',$input,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE))
9181
+		if($n=preg_match_all('/<%include(.*?)%>/', $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
9182 9182
 		{
9183
-			for($i=0;$i<$n;++$i)
9183
+			for($i=0; $i < $n; ++$i)
9184 9184
 			{
9185
-				$filePath=Prado::getPathOfNamespace(trim($matches[$i][1][0]),TTemplateManager::TEMPLATE_FILE_EXT);
9185
+				$filePath=Prado::getPathOfNamespace(trim($matches[$i][1][0]), TTemplateManager::TEMPLATE_FILE_EXT);
9186 9186
 				if($filePath!==null && is_file($filePath))
9187 9187
 					$this->_includedFiles[]=$filePath;
9188 9188
 				else
9189 9189
 				{
9190
-					$errorLine=count(explode("\n",substr($input,0,$matches[$i][0][1]+1)));
9191
-					$this->handleException(new TConfigurationException('template_include_invalid',trim($matches[$i][1][0])),$errorLine,$input);
9190
+					$errorLine=count(explode("\n", substr($input, 0, $matches[$i][0][1] + 1)));
9191
+					$this->handleException(new TConfigurationException('template_include_invalid', trim($matches[$i][1][0])), $errorLine, $input);
9192 9192
 				}
9193 9193
 			}
9194 9194
 			$base=0;
9195
-			for($i=0;$i<$n;++$i)
9195
+			for($i=0; $i < $n; ++$i)
9196 9196
 			{
9197 9197
 				$ext=file_get_contents($this->_includedFiles[$i]);
9198 9198
 				$length=strlen($matches[$i][0][0]);
9199
-				$offset=$base+$matches[$i][0][1];
9200
-				$this->_includeAtLine[$i]=count(explode("\n",substr($input,0,$offset)));
9201
-				$this->_includeLines[$i]=count(explode("\n",$ext));
9202
-				$input=substr_replace($input,$ext,$offset,$length);
9203
-				$base+=strlen($ext)-$length;
9199
+				$offset=$base + $matches[$i][0][1];
9200
+				$this->_includeAtLine[$i]=count(explode("\n", substr($input, 0, $offset)));
9201
+				$this->_includeLines[$i]=count(explode("\n", $ext));
9202
+				$input=substr_replace($input, $ext, $offset, $length);
9203
+				$base+=strlen($ext) - $length;
9204 9204
 			}
9205 9205
 		}
9206 9206
 		return $input;
9207 9207
 	}
9208
-	protected function isClassBehaviorMethod(ReflectionClass $class,$method)
9208
+	protected function isClassBehaviorMethod(ReflectionClass $class, $method)
9209 9209
 	{
9210 9210
 	  $component=new ReflectionClass('TComponent');
9211 9211
 	  $behaviors=$component->getStaticProperties();
@@ -9216,7 +9216,7 @@  discard block
 block discarded – undo
9216 9216
 	    if(strtolower($class->getShortName())!==$name && !$class->isSubclassOf($name)) continue;
9217 9217
 	    foreach($list as $param)
9218 9218
 	    {
9219
-	      if(method_exists($param->getBehavior(),$method))
9219
+	      if(method_exists($param->getBehavior(), $method))
9220 9220
 	        return true;
9221 9221
 	    }
9222 9222
 	  }
@@ -9226,7 +9226,7 @@  discard block
 block discarded – undo
9226 9226
 class TThemeManager extends TModule
9227 9227
 {
9228 9228
 	const DEFAULT_BASEPATH='themes';
9229
-	const DEFAULT_THEMECLASS = 'TTheme';
9229
+	const DEFAULT_THEMECLASS='TTheme';
9230 9230
 	private $_themeClass=self::DEFAULT_THEMECLASS;
9231 9231
 	private $_initialized=false;
9232 9232
 	private $_basePath=null;
@@ -9243,11 +9243,11 @@  discard block
 block discarded – undo
9243 9243
 	public function getTheme($name)
9244 9244
 	{
9245 9245
 		$themePath=$this->getBasePath().DIRECTORY_SEPARATOR.$name;
9246
-		$themeUrl=rtrim($this->getBaseUrl(),'/').'/'.$name;
9246
+		$themeUrl=rtrim($this->getBaseUrl(), '/').'/'.$name;
9247 9247
 		return Prado::createComponent($this->getThemeClass(), $themePath, $themeUrl);
9248 9248
 	}
9249 9249
 	public function setThemeClass($class) {
9250
-		$this->_themeClass = $class===null ? self::DEFAULT_THEMECLASS : (string)$class;
9250
+		$this->_themeClass=$class===null ? self::DEFAULT_THEMECLASS : (string) $class;
9251 9251
 	}
9252 9252
 	public function getThemeClass() {
9253 9253
 		return $this->_themeClass;
@@ -9271,7 +9271,7 @@  discard block
 block discarded – undo
9271 9271
 		{
9272 9272
 			$this->_basePath=dirname($this->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
9273 9273
 			if(($basePath=realpath($this->_basePath))===false || !is_dir($basePath))
9274
-				throw new TConfigurationException('thememanager_basepath_invalid2',$this->_basePath);
9274
+				throw new TConfigurationException('thememanager_basepath_invalid2', $this->_basePath);
9275 9275
 			$this->_basePath=$basePath;
9276 9276
 		}
9277 9277
 		return $this->_basePath;
@@ -9284,7 +9284,7 @@  discard block
 block discarded – undo
9284 9284
 		{
9285 9285
 			$this->_basePath=Prado::getPathOfNamespace($value);
9286 9286
 			if($this->_basePath===null || !is_dir($this->_basePath))
9287
-				throw new TInvalidDataValueException('thememanager_basepath_invalid',$value);
9287
+				throw new TInvalidDataValueException('thememanager_basepath_invalid', $value);
9288 9288
 		}
9289 9289
 	}
9290 9290
 	public function getBaseUrl()
@@ -9293,16 +9293,16 @@  discard block
 block discarded – undo
9293 9293
 		{
9294 9294
 			$appPath=dirname($this->getRequest()->getApplicationFilePath());
9295 9295
 			$basePath=$this->getBasePath();
9296
-			if(strpos($basePath,$appPath)===false)
9296
+			if(strpos($basePath, $appPath)===false)
9297 9297
 				throw new TConfigurationException('thememanager_baseurl_required');
9298
-			$appUrl=rtrim(dirname($this->getRequest()->getApplicationUrl()),'/\\');
9299
-			$this->_baseUrl=$appUrl.strtr(substr($basePath,strlen($appPath)),'\\','/');
9298
+			$appUrl=rtrim(dirname($this->getRequest()->getApplicationUrl()), '/\\');
9299
+			$this->_baseUrl=$appUrl.strtr(substr($basePath, strlen($appPath)), '\\', '/');
9300 9300
 		}
9301 9301
 		return $this->_baseUrl;
9302 9302
 	}
9303 9303
 	public function setBaseUrl($value)
9304 9304
 	{
9305
-		$this->_baseUrl=rtrim($value,'/');
9305
+		$this->_baseUrl=rtrim($value, '/');
9306 9306
 	}
9307 9307
 }
9308 9308
 class TTheme extends TApplicationComponent implements ITheme
@@ -9315,7 +9315,7 @@  discard block
 block discarded – undo
9315 9315
 	private $_name='';
9316 9316
 	private $_cssFiles=array();
9317 9317
 	private $_jsFiles=array();
9318
-	public function __construct($themePath,$themeUrl)
9318
+	public function __construct($themePath, $themeUrl)
9319 9319
 	{
9320 9320
 		$this->_themeUrl=$themeUrl;
9321 9321
 		$this->_themePath=realpath($themePath);
@@ -9326,21 +9326,21 @@  discard block
 block discarded – undo
9326 9326
 			$array=$cache->get(self::THEME_CACHE_PREFIX.$themePath);
9327 9327
 			if(is_array($array))
9328 9328
 			{
9329
-				list($skins,$cssFiles,$jsFiles,$timestamp)=$array;
9329
+				list($skins, $cssFiles, $jsFiles, $timestamp)=$array;
9330 9330
 				if($this->getApplication()->getMode()!==TApplicationMode::Performance)
9331 9331
 				{
9332 9332
 					if(($dir=opendir($themePath))===false)
9333
-						throw new TIOException('theme_path_inexistent',$themePath);
9333
+						throw new TIOException('theme_path_inexistent', $themePath);
9334 9334
 					$cacheValid=true;
9335 9335
 					while(($file=readdir($dir))!==false)
9336 9336
 					{
9337 9337
 						if($file==='.' || $file==='..')
9338 9338
 							continue;
9339
-						else if(basename($file,'.css')!==$file)
9339
+						else if(basename($file, '.css')!==$file)
9340 9340
 							$this->_cssFiles[]=$themeUrl.'/'.$file;
9341
-						else if(basename($file,'.js')!==$file)
9341
+						else if(basename($file, '.js')!==$file)
9342 9342
 							$this->_jsFiles[]=$themeUrl.'/'.$file;
9343
-						else if(basename($file,self::SKIN_FILE_EXT)!==$file && filemtime($themePath.DIRECTORY_SEPARATOR.$file)>$timestamp)
9343
+						else if(basename($file, self::SKIN_FILE_EXT)!==$file && filemtime($themePath.DIRECTORY_SEPARATOR.$file) > $timestamp)
9344 9344
 						{
9345 9345
 							$cacheValid=false;
9346 9346
 							break;
@@ -9365,28 +9365,28 @@  discard block
 block discarded – undo
9365 9365
 			$this->_jsFiles=array();
9366 9366
 			$this->_skins=array();
9367 9367
 			if(($dir=opendir($themePath))===false)
9368
-				throw new TIOException('theme_path_inexistent',$themePath);
9368
+				throw new TIOException('theme_path_inexistent', $themePath);
9369 9369
 			while(($file=readdir($dir))!==false)
9370 9370
 			{
9371 9371
 				if($file==='.' || $file==='..')
9372 9372
 					continue;
9373
-				else if(basename($file,'.css')!==$file)
9373
+				else if(basename($file, '.css')!==$file)
9374 9374
 					$this->_cssFiles[]=$themeUrl.'/'.$file;
9375
-				else if(basename($file,'.js')!==$file)
9375
+				else if(basename($file, '.js')!==$file)
9376 9376
 					$this->_jsFiles[]=$themeUrl.'/'.$file;
9377
-				else if(basename($file,self::SKIN_FILE_EXT)!==$file)
9377
+				else if(basename($file, self::SKIN_FILE_EXT)!==$file)
9378 9378
 				{
9379
-					$template=new TTemplate(file_get_contents($themePath.'/'.$file),$themePath,$themePath.'/'.$file);
9379
+					$template=new TTemplate(file_get_contents($themePath.'/'.$file), $themePath, $themePath.'/'.$file);
9380 9380
 					foreach($template->getItems() as $skin)
9381 9381
 					{
9382 9382
 						if(!isset($skin[2]))  							continue;
9383 9383
 						else if($skin[0]!==-1)
9384
-							throw new TConfigurationException('theme_control_nested',$skin[1],dirname($themePath));
9384
+							throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath));
9385 9385
 						$type=$skin[1];
9386
-						$id=isset($skin[2]['skinid'])?$skin[2]['skinid']:0;
9386
+						$id=isset($skin[2]['skinid']) ? $skin[2]['skinid'] : 0;
9387 9387
 						unset($skin[2]['skinid']);
9388 9388
 						if(isset($this->_skins[$type][$id]))
9389
-							throw new TConfigurationException('theme_skinid_duplicated',$type,$id,dirname($themePath));
9389
+							throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath));
9390 9390
 						$this->_skins[$type][$id]=$skin[2];
9391 9391
 					}
9392 9392
 				}
@@ -9395,7 +9395,7 @@  discard block
 block discarded – undo
9395 9395
 			sort($this->_cssFiles);
9396 9396
 			sort($this->_jsFiles);
9397 9397
 			if($cache!==null)
9398
-				$cache->set(self::THEME_CACHE_PREFIX.$themePath,array($this->_skins,$this->_cssFiles,$this->_jsFiles,time()));
9398
+				$cache->set(self::THEME_CACHE_PREFIX.$themePath, array($this->_skins, $this->_cssFiles, $this->_jsFiles, time()));
9399 9399
 		}
9400 9400
 	}
9401 9401
 	public function getName()
@@ -9404,7 +9404,7 @@  discard block
 block discarded – undo
9404 9404
 	}
9405 9405
 	protected function setName($value)
9406 9406
 	{
9407
-		$this->_name = $value;
9407
+		$this->_name=$value;
9408 9408
 	}
9409 9409
 	public function getBaseUrl()
9410 9410
 	{
@@ -9412,7 +9412,7 @@  discard block
 block discarded – undo
9412 9412
 	}
9413 9413
 	protected function setBaseUrl($value)
9414 9414
 	{
9415
-		$this->_themeUrl=rtrim($value,'/');
9415
+		$this->_themeUrl=rtrim($value, '/');
9416 9416
 	}
9417 9417
 	public function getBasePath()
9418 9418
 	{
@@ -9428,7 +9428,7 @@  discard block
 block discarded – undo
9428 9428
 	}
9429 9429
 	protected function setSkins($value)
9430 9430
 	{
9431
-		$this->_skins = $value;
9431
+		$this->_skins=$value;
9432 9432
 	}
9433 9433
 	public function applySkin($control)
9434 9434
 	{
@@ -9447,28 +9447,28 @@  discard block
 block discarded – undo
9447 9447
 							$value=$this->evaluateExpression($value[1]);
9448 9448
 							break;
9449 9449
 						case TTemplate::CONFIG_ASSET:
9450
-							$value=$this->_themeUrl.'/'.ltrim($value[1],'/');
9450
+							$value=$this->_themeUrl.'/'.ltrim($value[1], '/');
9451 9451
 							break;
9452 9452
 						case TTemplate::CONFIG_DATABIND:
9453
-							$control->bindProperty($name,$value[1]);
9453
+							$control->bindProperty($name, $value[1]);
9454 9454
 							break;
9455 9455
 						case TTemplate::CONFIG_PARAMETER:
9456
-							$control->setSubProperty($name,$this->getApplication()->getParameters()->itemAt($value[1]));
9456
+							$control->setSubProperty($name, $this->getApplication()->getParameters()->itemAt($value[1]));
9457 9457
 							break;
9458 9458
 						case TTemplate::CONFIG_TEMPLATE:
9459
-							$control->setSubProperty($name,$value[1]);
9459
+							$control->setSubProperty($name, $value[1]);
9460 9460
 							break;
9461 9461
 						case TTemplate::CONFIG_LOCALIZATION:
9462
-							$control->setSubProperty($name,Prado::localize($value[1]));
9462
+							$control->setSubProperty($name, Prado::localize($value[1]));
9463 9463
 							break;
9464 9464
 						default:
9465
-							throw new TConfigurationException('theme_tag_unexpected',$name,$value[0]);
9465
+							throw new TConfigurationException('theme_tag_unexpected', $name, $value[0]);
9466 9466
 							break;
9467 9467
 					}
9468 9468
 				}
9469 9469
 				if(!is_array($value))
9470 9470
 				{
9471
-					if(strpos($name,'.')===false)						{
9471
+					if(strpos($name, '.')===false) {
9472 9472
 						if($control->hasProperty($name))
9473 9473
 						{
9474 9474
 							if($control->canSetProperty($name))
@@ -9477,12 +9477,12 @@  discard block
 block discarded – undo
9477 9477
 								$control->$setter($value);
9478 9478
 							}
9479 9479
 							else
9480
-								throw new TConfigurationException('theme_property_readonly',$type,$name);
9480
+								throw new TConfigurationException('theme_property_readonly', $type, $name);
9481 9481
 						}
9482 9482
 						else
9483
-							throw new TConfigurationException('theme_property_undefined',$type,$name);
9483
+							throw new TConfigurationException('theme_property_undefined', $type, $name);
9484 9484
 					}
9485
-					else							$control->setSubProperty($name,$value);
9485
+					else							$control->setSubProperty($name, $value);
9486 9486
 				}
9487 9487
 			}
9488 9488
 			return true;
@@ -9545,15 +9545,15 @@  discard block
 block discarded – undo
9545 9545
 		$pagePath=$this->getRequestedPagePath();
9546 9546
 				foreach($config->getExternalConfigurations() as $filePath=>$params)
9547 9547
 		{
9548
-			list($configPagePath,$condition)=$params;
9548
+			list($configPagePath, $condition)=$params;
9549 9549
 			if($condition!==true)
9550 9550
 				$condition=$this->evaluateExpression($condition);
9551 9551
 			if($condition)
9552 9552
 			{
9553
-				if(($path=Prado::getPathOfNamespace($filePath,Prado::getApplication()->getConfigurationFileExt()))===null || !is_file($path))
9554
-					throw new TConfigurationException('pageservice_includefile_invalid',$filePath);
9553
+				if(($path=Prado::getPathOfNamespace($filePath, Prado::getApplication()->getConfigurationFileExt()))===null || !is_file($path))
9554
+					throw new TConfigurationException('pageservice_includefile_invalid', $filePath);
9555 9555
 				$c=new TPageConfiguration($pagePath);
9556
-				$c->loadFromFile($path,$configPagePath);
9556
+				$c->loadFromFile($path, $configPagePath);
9557 9557
 				$this->applyConfiguration($c);
9558 9558
 			}
9559 9559
 		}
@@ -9575,9 +9575,9 @@  discard block
 block discarded – undo
9575 9575
 			if($config!==null)
9576 9576
 			{
9577 9577
 				if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
9578
-					$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
9578
+					$pageConfig->loadPageConfigurationFromPhp($config, $application->getBasePath(), '');
9579 9579
 				else
9580
-					$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
9580
+					$pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), '');
9581 9581
 			}
9582 9582
 			$pageConfig->loadFromFiles($this->getBasePath());
9583 9583
 		}
@@ -9588,21 +9588,21 @@  discard block
 block discarded – undo
9588 9588
 			$arr=$cache->get(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath);
9589 9589
 			if(is_array($arr))
9590 9590
 			{
9591
-				list($pageConfig,$timestamps)=$arr;
9591
+				list($pageConfig, $timestamps)=$arr;
9592 9592
 				if($application->getMode()!==TApplicationMode::Performance)
9593 9593
 				{
9594 9594
 					foreach($timestamps as $fileName=>$timestamp)
9595 9595
 					{
9596
-						if($fileName===0) 						{
9596
+						if($fileName===0) {
9597 9597
 							$appConfigFile=$application->getConfigurationFile();
9598
-							$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
9599
-							if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0]))
9598
+							$currentTimestamp[0]=$appConfigFile===null ? 0 : @filemtime($appConfigFile);
9599
+							if($currentTimestamp[0] > $timestamp || ($timestamp > 0 && !$currentTimestamp[0]))
9600 9600
 								$configCached=false;
9601 9601
 						}
9602 9602
 						else
9603 9603
 						{
9604 9604
 							$currentTimestamp[$fileName]=@filemtime($fileName);
9605
-							if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName]))
9605
+							if($currentTimestamp[$fileName] > $timestamp || ($timestamp > 0 && !$currentTimestamp[$fileName]))
9606 9606
 								$configCached=false;
9607 9607
 						}
9608 9608
 					}
@@ -9611,9 +9611,9 @@  discard block
 block discarded – undo
9611 9611
 			else
9612 9612
 			{
9613 9613
 				$configCached=false;
9614
-				$paths=explode('.',$pagePath);
9614
+				$paths=explode('.', $pagePath);
9615 9615
 				$configPath=$this->getBasePath();
9616
-				$fileName = $this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
9616
+				$fileName=$this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
9617 9617
 					? self::CONFIG_FILE_PHP
9618 9618
 					: self::CONFIG_FILE_XML;
9619 9619
 				foreach($paths as $path)
@@ -9623,7 +9623,7 @@  discard block
 block discarded – undo
9623 9623
 					$configPath.=DIRECTORY_SEPARATOR.$path;
9624 9624
 				}
9625 9625
 				$appConfigFile=$application->getConfigurationFile();
9626
-				$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
9626
+				$currentTimestamp[0]=$appConfigFile===null ? 0 : @filemtime($appConfigFile);
9627 9627
 			}
9628 9628
 			if(!$configCached)
9629 9629
 			{
@@ -9631,12 +9631,12 @@  discard block
 block discarded – undo
9631 9631
 				if($config!==null)
9632 9632
 				{
9633 9633
 					if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
9634
-						$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
9634
+						$pageConfig->loadPageConfigurationFromPhp($config, $application->getBasePath(), '');
9635 9635
 					else
9636
-						$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
9636
+						$pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), '');
9637 9637
 				}
9638 9638
 				$pageConfig->loadFromFiles($this->getBasePath());
9639
-				$cache->set(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath,array($pageConfig,$currentTimestamp));
9639
+				$cache->set(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath, array($pageConfig, $currentTimestamp));
9640 9640
 			}
9641 9641
 		}
9642 9642
 		return $pageConfig;
@@ -9671,9 +9671,9 @@  discard block
 block discarded – undo
9671 9671
 	{
9672 9672
 		if($this->_pagePath===null)
9673 9673
 		{
9674
-			$this->_pagePath=strtr($this->determineRequestedPagePath(),'/\\','..');
9674
+			$this->_pagePath=strtr($this->determineRequestedPagePath(), '/\\', '..');
9675 9675
 			if(empty($this->_pagePath))
9676
-				throw new THttpException(404,'pageservice_page_required');
9676
+				throw new THttpException(404, 'pageservice_page_required');
9677 9677
 		}
9678 9678
 		return $this->_pagePath;
9679 9679
 	}
@@ -9705,7 +9705,7 @@  discard block
 block discarded – undo
9705 9705
 			{
9706 9706
 				$basePath=$this->getApplication()->getBasePath().DIRECTORY_SEPARATOR.self::FALLBACK_BASEPATH;
9707 9707
 				if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath))
9708
-					throw new TConfigurationException('pageservice_basepath_invalid',$basePath);
9708
+					throw new TConfigurationException('pageservice_basepath_invalid', $basePath);
9709 9709
 			}
9710 9710
 		}
9711 9711
 		return $this->_basePath;
@@ -9715,7 +9715,7 @@  discard block
 block discarded – undo
9715 9715
 		if($this->_initialized)
9716 9716
 			throw new TInvalidOperationException('pageservice_basepath_unchangeable');
9717 9717
 		else if(($path=Prado::getPathOfNamespace($value))===null || !is_dir($path))
9718
-			throw new TConfigurationException('pageservice_basepath_invalid',$value);
9718
+			throw new TConfigurationException('pageservice_basepath_invalid', $value);
9719 9719
 		$this->_basePath=realpath($path);
9720 9720
 	}
9721 9721
 	public function setBasePageClass($value)
@@ -9737,45 +9737,45 @@  discard block
 block discarded – undo
9737 9737
 	public function run()
9738 9738
 	{
9739 9739
 		$this->_page=$this->createPage($this->getRequestedPagePath());
9740
-		$this->runPage($this->_page,$this->_properties);
9740
+		$this->runPage($this->_page, $this->_properties);
9741 9741
 	}
9742 9742
 	protected function createPage($pagePath)
9743 9743
 	{
9744
-		$path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath,'.',DIRECTORY_SEPARATOR);
9744
+		$path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath, '.', DIRECTORY_SEPARATOR);
9745 9745
 		$hasTemplateFile=is_file($path.self::PAGE_FILE_EXT);
9746 9746
 		$hasClassFile=is_file($path.Prado::CLASS_FILE_EXT);
9747 9747
 		if(!$hasTemplateFile && !$hasClassFile)
9748
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
9748
+			throw new THttpException(404, 'pageservice_page_unknown', $pagePath);
9749 9749
 		if($hasClassFile)
9750 9750
 		{
9751 9751
 			$className=basename($path);
9752
-			if(!class_exists($className,false))
9752
+			if(!class_exists($className, false))
9753 9753
 				include_once($path.Prado::CLASS_FILE_EXT);
9754 9754
 		}
9755 9755
 		else
9756 9756
 		{
9757 9757
 			$className=$this->getBasePageClass();
9758 9758
 			Prado::using($className);
9759
-			if(($pos=strrpos($className,'.'))!==false)
9760
-				$className=substr($className,$pos+1);
9759
+			if(($pos=strrpos($className, '.'))!==false)
9760
+				$className=substr($className, $pos + 1);
9761 9761
 		}
9762
- 		if(!class_exists($className,false) || ($className!=='TPage' && !is_subclass_of($className,'TPage')))
9763
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
9762
+ 		if(!class_exists($className, false) || ($className!=='TPage' && !is_subclass_of($className, 'TPage')))
9763
+			throw new THttpException(404, 'pageservice_page_unknown', $pagePath);
9764 9764
 		$page=Prado::createComponent($className);
9765 9765
 		$page->setPagePath($pagePath);
9766 9766
 		if($hasTemplateFile)
9767 9767
 			$page->setTemplate($this->getTemplateManager()->getTemplateByFileName($path.self::PAGE_FILE_EXT));
9768 9768
 		return $page;
9769 9769
 	}
9770
-	protected function runPage($page,$properties)
9770
+	protected function runPage($page, $properties)
9771 9771
 	{
9772 9772
 		foreach($properties as $name=>$value)
9773
-			$page->setSubProperty($name,$value);
9773
+			$page->setSubProperty($name, $value);
9774 9774
 		$page->run($this->getResponse()->createHtmlWriter());
9775 9775
 	}
9776
-	public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true)
9776
+	public function constructUrl($pagePath, $getParams=null, $encodeAmpersand=true, $encodeGetItems=true)
9777 9777
 	{
9778
-		return $this->getRequest()->constructUrl($this->getID(),$pagePath,$getParams,$encodeAmpersand,$encodeGetItems);
9778
+		return $this->getRequest()->constructUrl($this->getID(), $pagePath, $getParams, $encodeAmpersand, $encodeGetItems);
9779 9779
 	}
9780 9780
 }
9781 9781
 class TPageConfiguration extends TComponent
@@ -9807,89 +9807,89 @@  discard block
 block discarded – undo
9807 9807
 	}
9808 9808
 	public function loadFromFiles($basePath)
9809 9809
 	{
9810
-		$paths=explode('.',$this->_pagePath);
9810
+		$paths=explode('.', $this->_pagePath);
9811 9811
 		$page=array_pop($paths);
9812 9812
 		$path=$basePath;
9813 9813
 		$configPagePath='';
9814
-		$fileName = Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
9814
+		$fileName=Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
9815 9815
 			? TPageService::CONFIG_FILE_PHP
9816 9816
 			: TPageService::CONFIG_FILE_XML;
9817 9817
 		foreach($paths as $p)
9818 9818
 		{
9819
-			$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName,$configPagePath);
9819
+			$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName, $configPagePath);
9820 9820
 			$path.=DIRECTORY_SEPARATOR.$p;
9821 9821
 			if($configPagePath==='')
9822 9822
 				$configPagePath=$p;
9823 9823
 			else
9824 9824
 				$configPagePath.='.'.$p;
9825 9825
 		}
9826
-		$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName,$configPagePath);
9826
+		$this->loadFromFile($path.DIRECTORY_SEPARATOR.$fileName, $configPagePath);
9827 9827
 		$this->_rules=new TAuthorizationRuleCollection($this->_rules);
9828 9828
 	}
9829
-	public function loadFromFile($fname,$configPagePath)
9829
+	public function loadFromFile($fname, $configPagePath)
9830 9830
 	{
9831 9831
 		if(empty($fname) || !is_file($fname))
9832 9832
 			return;
9833 9833
 		if(Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
9834 9834
 		{
9835
-			$fcontent = include $fname;
9836
-			$this->loadFromPhp($fcontent,dirname($fname),$configPagePath);
9835
+			$fcontent=include $fname;
9836
+			$this->loadFromPhp($fcontent, dirname($fname), $configPagePath);
9837 9837
 		}
9838 9838
 		else
9839 9839
 		{
9840 9840
 			$dom=new TXmlDocument;
9841 9841
 			if($dom->loadFromFile($fname))
9842
-				$this->loadFromXml($dom,dirname($fname),$configPagePath);
9842
+				$this->loadFromXml($dom, dirname($fname), $configPagePath);
9843 9843
 			else
9844
-				throw new TConfigurationException('pageserviceconf_file_invalid',$fname);
9844
+				throw new TConfigurationException('pageserviceconf_file_invalid', $fname);
9845 9845
 		}
9846 9846
 	}
9847
-	public function loadFromPhp($config,$configPath,$configPagePath)
9847
+	public function loadFromPhp($config, $configPath, $configPagePath)
9848 9848
 	{
9849
-		$this->loadApplicationConfigurationFromPhp($config,$configPath);
9850
-		$this->loadPageConfigurationFromPhp($config,$configPath,$configPagePath);
9849
+		$this->loadApplicationConfigurationFromPhp($config, $configPath);
9850
+		$this->loadPageConfigurationFromPhp($config, $configPath, $configPagePath);
9851 9851
 	}
9852
-	public function loadFromXml($dom,$configPath,$configPagePath)
9852
+	public function loadFromXml($dom, $configPath, $configPagePath)
9853 9853
 	{
9854
-		$this->loadApplicationConfigurationFromXml($dom,$configPath);
9855
-		$this->loadPageConfigurationFromXml($dom,$configPath,$configPagePath);
9854
+		$this->loadApplicationConfigurationFromXml($dom, $configPath);
9855
+		$this->loadPageConfigurationFromXml($dom, $configPath, $configPagePath);
9856 9856
 	}
9857
-	public function loadApplicationConfigurationFromPhp($config,$configPath)
9857
+	public function loadApplicationConfigurationFromPhp($config, $configPath)
9858 9858
 	{
9859 9859
 		$appConfig=new TApplicationConfiguration;
9860
-		$appConfig->loadFromPhp($config,$configPath);
9860
+		$appConfig->loadFromPhp($config, $configPath);
9861 9861
 		$this->_appConfigs[]=$appConfig;
9862 9862
 	}
9863
-	public function loadApplicationConfigurationFromXml($dom,$configPath)
9863
+	public function loadApplicationConfigurationFromXml($dom, $configPath)
9864 9864
 	{
9865 9865
 		$appConfig=new TApplicationConfiguration;
9866
-		$appConfig->loadFromXml($dom,$configPath);
9866
+		$appConfig->loadFromXml($dom, $configPath);
9867 9867
 		$this->_appConfigs[]=$appConfig;
9868 9868
 	}
9869 9869
 	public function loadPageConfigurationFromPhp($config, $configPath, $configPagePath)
9870 9870
 	{
9871 9871
 				if(isset($config['authorization']) && is_array($config['authorization']))
9872 9872
 		{
9873
-			$rules = array();
9873
+			$rules=array();
9874 9874
 			foreach($config['authorization'] as $authorization)
9875 9875
 			{
9876
-				$patterns=isset($authorization['pages'])?$authorization['pages']:'';
9876
+				$patterns=isset($authorization['pages']) ? $authorization['pages'] : '';
9877 9877
 				$ruleApplies=false;
9878 9878
 				if(empty($patterns) || trim($patterns)==='*') 					$ruleApplies=true;
9879 9879
 				else
9880 9880
 				{
9881
-					foreach(explode(',',$patterns) as $pattern)
9881
+					foreach(explode(',', $patterns) as $pattern)
9882 9882
 					{
9883 9883
 						if(($pattern=trim($pattern))!=='')
9884 9884
 						{
9885 9885
 														if($configPagePath!=='')  								$pattern=$configPagePath.'.'.$pattern;
9886
-							if(strcasecmp($pattern,$this->_pagePath)===0)
9886
+							if(strcasecmp($pattern, $this->_pagePath)===0)
9887 9887
 							{
9888 9888
 								$ruleApplies=true;
9889 9889
 								break;
9890 9890
 							}
9891
-							if($pattern[strlen($pattern)-1]==='*') 							{
9892
-								if(strncasecmp($this->_pagePath,$pattern,strlen($pattern)-1)===0)
9891
+							if($pattern[strlen($pattern) - 1]==='*') {
9892
+								if(strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1)===0)
9893 9893
 								{
9894 9894
 									$ruleApplies=true;
9895 9895
 									break;
@@ -9900,56 +9900,56 @@  discard block
 block discarded – undo
9900 9900
 				}
9901 9901
 				if($ruleApplies)
9902 9902
 				{
9903
-					$action = isset($authorization['action'])?$authorization['action']:'';
9904
-					$users = isset($authorization['users'])?$authorization['users']:'';
9905
-					$roles = isset($authorization['roles'])?$authorization['roles']:'';
9906
-					$verb = isset($authorization['verb'])?$authorization['verb']:'';
9907
-					$ips = isset($authorization['ips'])?$authorization['ips']:'';
9908
-					$rules[]=new TAuthorizationRule($action,$users,$roles,$verb,$ips);
9903
+					$action=isset($authorization['action']) ? $authorization['action'] : '';
9904
+					$users=isset($authorization['users']) ? $authorization['users'] : '';
9905
+					$roles=isset($authorization['roles']) ? $authorization['roles'] : '';
9906
+					$verb=isset($authorization['verb']) ? $authorization['verb'] : '';
9907
+					$ips=isset($authorization['ips']) ? $authorization['ips'] : '';
9908
+					$rules[]=new TAuthorizationRule($action, $users, $roles, $verb, $ips);
9909 9909
 				}
9910 9910
 			}
9911
-			$this->_rules=array_merge($rules,$this->_rules);
9911
+			$this->_rules=array_merge($rules, $this->_rules);
9912 9912
 		}
9913 9913
 				if(isset($config['pages']) && is_array($config['pages']))
9914 9914
 		{
9915 9915
 			if(isset($config['pages']['properties']))
9916 9916
 			{
9917
-				$this->_properties = array_merge($this->_properties, $config['pages']['properties']);
9917
+				$this->_properties=array_merge($this->_properties, $config['pages']['properties']);
9918 9918
 				unset($config['pages']['properties']);
9919 9919
 			}
9920 9920
 			foreach($config['pages'] as $id => $page)
9921 9921
 			{
9922
-				$properties = array();
9922
+				$properties=array();
9923 9923
 				if(isset($page['properties']))
9924 9924
 				{
9925 9925
 					$properties=$page['properties'];
9926 9926
 					unset($page['properties']);
9927 9927
 				}
9928 9928
 				$matching=false;
9929
-				$id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
9930
-				if(strcasecmp($id,$this->_pagePath)===0)
9929
+				$id=($configPagePath==='') ? $id : $configPagePath.'.'.$id;
9930
+				if(strcasecmp($id, $this->_pagePath)===0)
9931 9931
 					$matching=true;
9932
-				else if($id[strlen($id)-1]==='*') 					$matching=strncasecmp($this->_pagePath,$id,strlen($id)-1)===0;
9932
+				else if($id[strlen($id) - 1]==='*') 					$matching=strncasecmp($this->_pagePath, $id, strlen($id) - 1)===0;
9933 9933
 				if($matching)
9934
-					$this->_properties=array_merge($this->_properties,$properties);
9934
+					$this->_properties=array_merge($this->_properties, $properties);
9935 9935
 			}
9936 9936
 		}
9937 9937
 				if(isset($config['includes']) && is_array($config['includes']))
9938 9938
 		{
9939 9939
 			foreach($config['includes'] as $include)
9940 9940
 			{
9941
-				$when = isset($include['when'])?true:false;
9941
+				$when=isset($include['when']) ? true : false;
9942 9942
 				if(!isset($include['file']))
9943 9943
 					throw new TConfigurationException('pageserviceconf_includefile_required');
9944
-				$filePath = $include['file'];
9944
+				$filePath=$include['file'];
9945 9945
 				if(isset($this->_includes[$filePath]))
9946
-					$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
9946
+					$this->_includes[$filePath]=array($configPagePath, '('.$this->_includes[$filePath][1].') || ('.$when.')');
9947 9947
 				else
9948
-					$this->_includes[$filePath]=array($configPagePath,$when);
9948
+					$this->_includes[$filePath]=array($configPagePath, $when);
9949 9949
 			}
9950 9950
 		}
9951 9951
 	}
9952
-	public function loadPageConfigurationFromXml($dom,$configPath,$configPagePath)
9952
+	public function loadPageConfigurationFromXml($dom, $configPath, $configPagePath)
9953 9953
 	{
9954 9954
 				if(($authorizationNode=$dom->getElementByTagName('authorization'))!==null)
9955 9955
 		{
@@ -9961,18 +9961,18 @@  discard block
 block discarded – undo
9961 9961
 				if(empty($patterns) || trim($patterns)==='*') 					$ruleApplies=true;
9962 9962
 				else
9963 9963
 				{
9964
-					foreach(explode(',',$patterns) as $pattern)
9964
+					foreach(explode(',', $patterns) as $pattern)
9965 9965
 					{
9966 9966
 						if(($pattern=trim($pattern))!=='')
9967 9967
 						{
9968 9968
 														if($configPagePath!=='')  								$pattern=$configPagePath.'.'.$pattern;
9969
-							if(strcasecmp($pattern,$this->_pagePath)===0)
9969
+							if(strcasecmp($pattern, $this->_pagePath)===0)
9970 9970
 							{
9971 9971
 								$ruleApplies=true;
9972 9972
 								break;
9973 9973
 							}
9974
-							if($pattern[strlen($pattern)-1]==='*') 							{
9975
-								if(strncasecmp($this->_pagePath,$pattern,strlen($pattern)-1)===0)
9974
+							if($pattern[strlen($pattern) - 1]==='*') {
9975
+								if(strncasecmp($this->_pagePath, $pattern, strlen($pattern) - 1)===0)
9976 9976
 								{
9977 9977
 									$ruleApplies=true;
9978 9978
 									break;
@@ -9982,26 +9982,26 @@  discard block
 block discarded – undo
9982 9982
 					}
9983 9983
 				}
9984 9984
 				if($ruleApplies)
9985
-					$rules[]=new TAuthorizationRule($node->getTagName(),$node->getAttribute('users'),$node->getAttribute('roles'),$node->getAttribute('verb'),$node->getAttribute('ips'));
9985
+					$rules[]=new TAuthorizationRule($node->getTagName(), $node->getAttribute('users'), $node->getAttribute('roles'), $node->getAttribute('verb'), $node->getAttribute('ips'));
9986 9986
 			}
9987
-			$this->_rules=array_merge($rules,$this->_rules);
9987
+			$this->_rules=array_merge($rules, $this->_rules);
9988 9988
 		}
9989 9989
 				if(($pagesNode=$dom->getElementByTagName('pages'))!==null)
9990 9990
 		{
9991
-			$this->_properties=array_merge($this->_properties,$pagesNode->getAttributes()->toArray());
9991
+			$this->_properties=array_merge($this->_properties, $pagesNode->getAttributes()->toArray());
9992 9992
 						foreach($pagesNode->getElementsByTagName('page') as $node)
9993 9993
 			{
9994 9994
 				$properties=$node->getAttributes();
9995 9995
 				$id=$properties->remove('id');
9996 9996
 				if(empty($id))
9997
-					throw new TConfigurationException('pageserviceconf_page_invalid',$configPath);
9997
+					throw new TConfigurationException('pageserviceconf_page_invalid', $configPath);
9998 9998
 				$matching=false;
9999
-				$id=($configPagePath==='')?$id:$configPagePath.'.'.$id;
10000
-				if(strcasecmp($id,$this->_pagePath)===0)
9999
+				$id=($configPagePath==='') ? $id : $configPagePath.'.'.$id;
10000
+				if(strcasecmp($id, $this->_pagePath)===0)
10001 10001
 					$matching=true;
10002
-				else if($id[strlen($id)-1]==='*') 					$matching=strncasecmp($this->_pagePath,$id,strlen($id)-1)===0;
10002
+				else if($id[strlen($id) - 1]==='*') 					$matching=strncasecmp($this->_pagePath, $id, strlen($id) - 1)===0;
10003 10003
 				if($matching)
10004
-					$this->_properties=array_merge($this->_properties,$properties->toArray());
10004
+					$this->_properties=array_merge($this->_properties, $properties->toArray());
10005 10005
 			}
10006 10006
 		}
10007 10007
 				foreach($dom->getElementsByTagName('include') as $node)
@@ -10011,9 +10011,9 @@  discard block
 block discarded – undo
10011 10011
 			if(($filePath=$node->getAttribute('file'))===null)
10012 10012
 				throw new TConfigurationException('pageserviceconf_includefile_required');
10013 10013
 			if(isset($this->_includes[$filePath]))
10014
-				$this->_includes[$filePath]=array($configPagePath,'('.$this->_includes[$filePath][1].') || ('.$when.')');
10014
+				$this->_includes[$filePath]=array($configPagePath, '('.$this->_includes[$filePath][1].') || ('.$when.')');
10015 10015
 			else
10016
-				$this->_includes[$filePath]=array($configPagePath,$when);
10016
+				$this->_includes[$filePath]=array($configPagePath, $when);
10017 10017
 		}
10018 10018
 	}
10019 10019
 }
@@ -10032,9 +10032,9 @@  discard block
 block discarded – undo
10032 10032
 		if($this->_basePath===null)
10033 10033
 			$this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
10034 10034
 		if(!is_writable($this->_basePath) || !is_dir($this->_basePath))
10035
-			throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath);
10035
+			throw new TConfigurationException('assetmanager_basepath_invalid', $this->_basePath);
10036 10036
 		if($this->_baseUrl===null)
10037
-			$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()),'/\\').'/'.self::DEFAULT_BASEPATH;
10037
+			$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()), '/\\').'/'.self::DEFAULT_BASEPATH;
10038 10038
 		$application->setAssetManager($this);
10039 10039
 		$this->_initialized=true;
10040 10040
 	}
@@ -10050,7 +10050,7 @@  discard block
 block discarded – undo
10050 10050
 		{
10051 10051
 			$this->_basePath=Prado::getPathOfNamespace($value);
10052 10052
 			if($this->_basePath===null || !is_dir($this->_basePath) || !is_writable($this->_basePath))
10053
-				throw new TInvalidDataValueException('assetmanager_basepath_invalid',$value);
10053
+				throw new TInvalidDataValueException('assetmanager_basepath_invalid', $value);
10054 10054
 		}
10055 10055
 	}
10056 10056
 	public function getBaseUrl()
@@ -10062,21 +10062,21 @@  discard block
 block discarded – undo
10062 10062
 		if($this->_initialized)
10063 10063
 			throw new TInvalidOperationException('assetmanager_baseurl_unchangeable');
10064 10064
 		else
10065
-			$this->_baseUrl=rtrim($value,'/');
10065
+			$this->_baseUrl=rtrim($value, '/');
10066 10066
 	}
10067
-	public function publishFilePath($path,$checkTimestamp=false)
10067
+	public function publishFilePath($path, $checkTimestamp=false)
10068 10068
 	{
10069 10069
 		if(isset($this->_published[$path]))
10070 10070
 			return $this->_published[$path];
10071 10071
 		else if(empty($path) || ($fullpath=realpath($path))===false)
10072
-			throw new TInvalidDataValueException('assetmanager_filepath_invalid',$path);
10072
+			throw new TInvalidDataValueException('assetmanager_filepath_invalid', $path);
10073 10073
 		else if(is_file($fullpath))
10074 10074
 		{
10075 10075
 			$dir=$this->hash(dirname($fullpath));
10076 10076
 			$fileName=basename($fullpath);
10077 10077
 			$dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir;
10078 10078
 			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
10079
-				$this->copyFile($fullpath,$dst);
10079
+				$this->copyFile($fullpath, $dst);
10080 10080
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName;
10081 10081
 		}
10082 10082
 		else
@@ -10084,7 +10084,7 @@  discard block
 block discarded – undo
10084 10084
 			$dir=$this->hash($fullpath);
10085 10085
 			if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
10086 10086
 			{
10087
-				$this->copyDirectory($fullpath,$this->_basePath.DIRECTORY_SEPARATOR.$dir);
10087
+				$this->copyDirectory($fullpath, $this->_basePath.DIRECTORY_SEPARATOR.$dir);
10088 10088
 			}
10089 10089
 			return $this->_published[$path]=$this->_baseUrl.'/'.$dir;
10090 10090
 		}
@@ -10095,7 +10095,7 @@  discard block
 block discarded – undo
10095 10095
 	}
10096 10096
 	protected function setPublished($values=array())
10097 10097
 	{
10098
-		$this->_published = $values;
10098
+		$this->_published=$values;
10099 10099
 	}
10100 10100
 	public function getPublishedPath($path)
10101 10101
 	{
@@ -10115,9 +10115,9 @@  discard block
 block discarded – undo
10115 10115
 	}
10116 10116
 	protected function hash($dir)
10117 10117
 	{
10118
-		return sprintf('%x',crc32($dir.Prado::getVersion()));
10118
+		return sprintf('%x', crc32($dir.Prado::getVersion()));
10119 10119
 	}
10120
-	protected function copyFile($src,$dst)
10120
+	protected function copyFile($src, $dst)
10121 10121
 	{
10122 10122
 		if(!is_dir($dst))
10123 10123
 		{
@@ -10125,12 +10125,12 @@  discard block
 block discarded – undo
10125 10125
 			@chmod($dst, PRADO_CHMOD);
10126 10126
 		}
10127 10127
 		$dstFile=$dst.DIRECTORY_SEPARATOR.basename($src);
10128
-		if(@filemtime($dstFile)<@filemtime($src))
10128
+		if(@filemtime($dstFile) < @filemtime($src))
10129 10129
 		{
10130
-			@copy($src,$dstFile);
10130
+			@copy($src, $dstFile);
10131 10131
 		}
10132 10132
 	}
10133
-	public function copyDirectory($src,$dst)
10133
+	public function copyDirectory($src, $dst)
10134 10134
 	{
10135 10135
 		if(!is_dir($dst))
10136 10136
 		{
@@ -10145,14 +10145,14 @@  discard block
 block discarded – undo
10145 10145
 					continue;
10146 10146
 				else if(is_file($src.DIRECTORY_SEPARATOR.$file))
10147 10147
 				{
10148
-					if(@filemtime($dst.DIRECTORY_SEPARATOR.$file)<@filemtime($src.DIRECTORY_SEPARATOR.$file))
10148
+					if(@filemtime($dst.DIRECTORY_SEPARATOR.$file) < @filemtime($src.DIRECTORY_SEPARATOR.$file))
10149 10149
 					{
10150
-						@copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
10150
+						@copy($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file);
10151 10151
 						@chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD);
10152 10152
 					}
10153 10153
 				}
10154 10154
 				else
10155
-					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
10155
+					$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file);
10156 10156
 			}
10157 10157
 			closedir($folder);
10158 10158
 		} else {
@@ -10164,7 +10164,7 @@  discard block
 block discarded – undo
10164 10164
 		if(isset($this->_published[$md5sum]))
10165 10165
 			return $this->_published[$md5sum];
10166 10166
 		else if(($fullpath=realpath($md5sum))===false || !is_file($fullpath))
10167
-			throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid',$md5sum);
10167
+			throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid', $md5sum);
10168 10168
 		else
10169 10169
 		{
10170 10170
 			$dir=$this->hash(dirname($fullpath));
@@ -10172,31 +10172,31 @@  discard block
 block discarded – undo
10172 10172
 			$dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir;
10173 10173
 			if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance)
10174 10174
 			{
10175
-				if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName)<@filemtime($fullpath))
10175
+				if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName) < @filemtime($fullpath))
10176 10176
 				{
10177
-					$this->copyFile($fullpath,$dst);
10178
-					$this->deployTarFile($tarfile,$dst);
10177
+					$this->copyFile($fullpath, $dst);
10178
+					$this->deployTarFile($tarfile, $dst);
10179 10179
 				}
10180 10180
 			}
10181 10181
 			return $this->_published[$md5sum]=$this->_baseUrl.'/'.$dir;
10182 10182
 		}
10183 10183
 	}
10184
-	protected function deployTarFile($path,$destination)
10184
+	protected function deployTarFile($path, $destination)
10185 10185
 	{
10186 10186
 		if(($fullpath=realpath($path))===false || !is_file($fullpath))
10187
-			throw new TIOException('assetmanager_tarfile_invalid',$path);
10187
+			throw new TIOException('assetmanager_tarfile_invalid', $path);
10188 10188
 		else
10189 10189
 		{
10190 10190
 			Prado::using('System.IO.TTarFileExtractor');
10191
-			$tar = new TTarFileExtractor($fullpath);
10191
+			$tar=new TTarFileExtractor($fullpath);
10192 10192
 			return $tar->extract($destination);
10193 10193
 		}
10194 10194
 	}
10195 10195
 }
10196 10196
 class TGlobalization extends TModule
10197 10197
 {
10198
-	private $_defaultCharset = 'UTF-8';
10199
-	private $_defaultCulture = 'en';
10198
+	private $_defaultCharset='UTF-8';
10199
+	private $_defaultCulture='en';
10200 10200
 	private $_charset=null;
10201 10201
 	private $_culture=null;
10202 10202
 	private $_translation;
@@ -10210,11 +10210,11 @@  discard block
 block discarded – undo
10210 10210
 		if($config!==null)
10211 10211
 		{
10212 10212
 			if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
10213
-				$translation = isset($config['translate'])?$config['translate']:null;
10213
+				$translation=isset($config['translate']) ? $config['translate'] : null;
10214 10214
 			else
10215 10215
 			{
10216
-				$t = $config->getElementByTagName('translation');
10217
-				$translation = ($t)?$t->getAttributes():null;
10216
+				$t=$config->getElementByTagName('translation');
10217
+				$translation=($t) ? $t->getAttributes() : null;
10218 10218
 			}
10219 10219
 			if($translation)
10220 10220
 				$this->setTranslationConfiguration($translation);
@@ -10227,7 +10227,7 @@  discard block
 block discarded – undo
10227 10227
 	}
10228 10228
 	public function setTranslateDefaultCulture($value)
10229 10229
 	{
10230
-		$this->_translateDefaultCulture = TPropertyValue::ensureBoolean($value);
10230
+		$this->_translateDefaultCulture=TPropertyValue::ensureBoolean($value);
10231 10231
 	}
10232 10232
 	public function getDefaultCulture()
10233 10233
 	{
@@ -10235,7 +10235,7 @@  discard block
 block discarded – undo
10235 10235
 	}
10236 10236
 	public function setDefaultCulture($culture)
10237 10237
 	{
10238
-		$this->_defaultCulture = str_replace('-','_',$culture);
10238
+		$this->_defaultCulture=str_replace('-', '_', $culture);
10239 10239
 	}
10240 10240
 	public function getDefaultCharset()
10241 10241
 	{
@@ -10243,7 +10243,7 @@  discard block
 block discarded – undo
10243 10243
 	}
10244 10244
 	public function setDefaultCharset($charset)
10245 10245
 	{
10246
-		$this->_defaultCharset = $charset;
10246
+		$this->_defaultCharset=$charset;
10247 10247
 	}
10248 10248
 	public function getCulture()
10249 10249
 	{
@@ -10251,7 +10251,7 @@  discard block
 block discarded – undo
10251 10251
 	}
10252 10252
 	public function setCulture($culture)
10253 10253
 	{
10254
-		$this->_culture = str_replace('-','_',$culture);
10254
+		$this->_culture=str_replace('-', '_', $culture);
10255 10255
 	}
10256 10256
 	public function getCharset()
10257 10257
 	{
@@ -10259,27 +10259,27 @@  discard block
 block discarded – undo
10259 10259
 	}
10260 10260
 	public function setCharset($charset)
10261 10261
 	{
10262
-		$this->_charset = $charset;
10262
+		$this->_charset=$charset;
10263 10263
 	}
10264 10264
 	public function getTranslationConfiguration()
10265 10265
 	{
10266
-		return (!$this->_translateDefaultCulture && ($this->getDefaultCulture() == $this->getCulture()))
10266
+		return (!$this->_translateDefaultCulture && ($this->getDefaultCulture()==$this->getCulture()))
10267 10267
 			? null
10268 10268
 			: $this->_translation;
10269 10269
 	}
10270 10270
 	protected function setTranslationConfiguration($config)
10271 10271
 	{
10272
-		if($config['type'] == 'XLIFF' || $config['type'] == 'gettext')
10272
+		if($config['type']=='XLIFF' || $config['type']=='gettext')
10273 10273
 		{
10274 10274
 			if($config['source'])
10275 10275
 			{
10276
-				$config['source'] = Prado::getPathOfNamespace($config['source']);
10276
+				$config['source']=Prado::getPathOfNamespace($config['source']);
10277 10277
 				if(!is_dir($config['source']))
10278 10278
 				{
10279 10279
 					if(@mkdir($config['source'])===false)
10280 10280
 					throw new TConfigurationException('globalization_source_path_failed',
10281 10281
 						$config['source']);
10282
-					chmod($config['source'], PRADO_CHMOD); 				}
10282
+					chmod($config['source'], PRADO_CHMOD); }
10283 10283
 			}
10284 10284
 			else
10285 10285
 			{
@@ -10288,15 +10288,15 @@  discard block
 block discarded – undo
10288 10288
 		}
10289 10289
 		if($config['cache'])
10290 10290
 		{
10291
-			$config['cache'] = $this->getApplication()->getRunTimePath().'/i18n';
10291
+			$config['cache']=$this->getApplication()->getRunTimePath().'/i18n';
10292 10292
 			if(!is_dir($config['cache']))
10293 10293
 			{
10294 10294
 				if(@mkdir($config['cache'])===false)
10295 10295
 					throw new TConfigurationException('globalization_cache_path_failed',
10296 10296
 						$config['cache']);
10297
-				chmod($config['cache'], PRADO_CHMOD); 			}
10297
+				chmod($config['cache'], PRADO_CHMOD); }
10298 10298
 		}
10299
-		$this->_translation = $config;
10299
+		$this->_translation=$config;
10300 10300
 	}
10301 10301
 	public function getTranslationCatalogue()
10302 10302
 	{
@@ -10304,28 +10304,28 @@  discard block
 block discarded – undo
10304 10304
 	}
10305 10305
 	public function setTranslationCatalogue($value)
10306 10306
 	{
10307
-		$this->_translation['catalogue'] = $value;
10307
+		$this->_translation['catalogue']=$value;
10308 10308
 	}
10309 10309
 	public function getCultureVariants($culture=null)
10310 10310
 	{
10311
-		if($culture===null) $culture = $this->getCulture();
10312
-		$variants = explode('_', $culture);
10313
-		$result = array();
10311
+		if($culture===null) $culture=$this->getCulture();
10312
+		$variants=explode('_', $culture);
10313
+		$result=array();
10314 10314
 		for(; count($variants) > 0; array_pop($variants))
10315
-			$result[] = implode('_', $variants);
10315
+			$result[]=implode('_', $variants);
10316 10316
 		return $result;
10317 10317
 	}
10318
-	public function getLocalizedResource($file,$culture=null)
10318
+	public function getLocalizedResource($file, $culture=null)
10319 10319
 	{
10320
-		$files = array();
10321
-		$variants = $this->getCultureVariants($culture);
10322
-		$path = pathinfo($file);
10320
+		$files=array();
10321
+		$variants=$this->getCultureVariants($culture);
10322
+		$path=pathinfo($file);
10323 10323
 		foreach($variants as $variant)
10324
-			$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename'];
10325
-		$filename = substr($path['basename'],0,strrpos($path['basename'],'.'));
10324
+			$files[]=$path['dirname'].DIRECTORY_SEPARATOR.$variant.DIRECTORY_SEPARATOR.$path['basename'];
10325
+		$filename=substr($path['basename'], 0, strrpos($path['basename'], '.'));
10326 10326
 		foreach($variants as $variant)
10327
-			$files[] = $path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension'];
10328
-		$files[] = $file;
10327
+			$files[]=$path['dirname'].DIRECTORY_SEPARATOR.$filename.'.'.$variant.'.'.$path['extension'];
10328
+		$files[]=$file;
10329 10329
 		return $files;
10330 10330
 	}
10331 10331
 }
@@ -10338,10 +10338,10 @@  discard block
 block discarded – undo
10338 10338
 	const PAGE_SERVICE_ID='page';
10339 10339
 	const CONFIG_FILE_XML='application.xml';
10340 10340
 	const CONFIG_FILE_EXT_XML='.xml';
10341
-	const CONFIG_TYPE_XML = 'xml';
10341
+	const CONFIG_TYPE_XML='xml';
10342 10342
 	const CONFIG_FILE_PHP='application.php';
10343 10343
 	const CONFIG_FILE_EXT_PHP='.php';
10344
-	const CONFIG_TYPE_PHP = 'php';
10344
+	const CONFIG_TYPE_PHP='php';
10345 10345
 	const RUNTIME_PATH='runtime';
10346 10346
 	const CONFIGCACHE_FILE='config.cache';
10347 10347
 	const GLOBAL_FILE='global.cache';
@@ -10389,8 +10389,8 @@  discard block
 block discarded – undo
10389 10389
 	private $_assetManager;
10390 10390
 	private $_authRules;
10391 10391
 	private $_mode=TApplicationMode::Debug;
10392
-	private $_pageServiceID = self::PAGE_SERVICE_ID;
10393
-	public function __construct($basePath='protected',$cacheConfig=true, $configType=self::CONFIG_TYPE_XML)
10392
+	private $_pageServiceID=self::PAGE_SERVICE_ID;
10393
+	public function __construct($basePath='protected', $cacheConfig=true, $configType=self::CONFIG_TYPE_XML)
10394 10394
 	{
10395 10395
 				Prado::setApplication($this);
10396 10396
 		$this->setConfigurationType($configType);
@@ -10399,13 +10399,13 @@  discard block
 block discarded – undo
10399 10399
 			$this->_cacheFile=$this->_runtimePath.DIRECTORY_SEPARATOR.self::CONFIGCACHE_FILE;
10400 10400
 				$this->_uniqueID=md5($this->_runtimePath);
10401 10401
 		$this->_parameters=new TMap;
10402
-		$this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null));
10403
-		Prado::setPathOfAlias('Application',$this->_basePath);
10402
+		$this->_services=array($this->getPageServiceID()=>array('TPageService', array(), null));
10403
+		Prado::setPathOfAlias('Application', $this->_basePath);
10404 10404
 	}
10405 10405
 	protected function resolvePaths($basePath)
10406 10406
 	{
10407 10407
 				if(empty($basePath) || ($basePath=realpath($basePath))===false)
10408
-			throw new TConfigurationException('application_basepath_invalid',$basePath);
10408
+			throw new TConfigurationException('application_basepath_invalid', $basePath);
10409 10409
 		if(is_dir($basePath) && is_file($basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName()))
10410 10410
 			$configFile=$basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName();
10411 10411
 		else if(is_file($basePath))
@@ -10424,15 +10424,15 @@  discard block
 block discarded – undo
10424 10424
 				if(!is_dir($runtimePath))
10425 10425
 				{
10426 10426
 					if(@mkdir($runtimePath)===false)
10427
-						throw new TConfigurationException('application_runtimepath_failed',$runtimePath);
10428
-					@chmod($runtimePath, PRADO_CHMOD); 				}
10427
+						throw new TConfigurationException('application_runtimepath_failed', $runtimePath);
10428
+					@chmod($runtimePath, PRADO_CHMOD); }
10429 10429
 				$this->setConfigurationFile($configFile);
10430 10430
 			}
10431 10431
 			$this->setBasePath($basePath);
10432 10432
 			$this->setRuntimePath($runtimePath);
10433 10433
 		}
10434 10434
 		else
10435
-			throw new TConfigurationException('application_runtimepath_invalid',$runtimePath);
10435
+			throw new TConfigurationException('application_runtimepath_invalid', $runtimePath);
10436 10436
 	}
10437 10437
 	public function run()
10438 10438
 	{
@@ -10442,10 +10442,10 @@  discard block
 block discarded – undo
10442 10442
 			$n=count(self::$_steps);
10443 10443
 			$this->_step=0;
10444 10444
 			$this->_requestCompleted=false;
10445
-			while($this->_step<$n)
10445
+			while($this->_step < $n)
10446 10446
 			{
10447 10447
 				if($this->_mode===self::STATE_OFF)
10448
-					throw new THttpException(503,'application_unavailable');
10448
+					throw new THttpException(503, 'application_unavailable');
10449 10449
 				if($this->_requestCompleted)
10450 10450
 					break;
10451 10451
 				$method=self::$_steps[$this->_step];
@@ -10467,11 +10467,11 @@  discard block
 block discarded – undo
10467 10467
 	{
10468 10468
 		return $this->_requestCompleted;
10469 10469
 	}
10470
-	public function getGlobalState($key,$defaultValue=null)
10470
+	public function getGlobalState($key, $defaultValue=null)
10471 10471
 	{
10472
-		return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue;
10472
+		return isset($this->_globals[$key]) ? $this->_globals[$key] : $defaultValue;
10473 10473
 	}
10474
-	public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false)
10474
+	public function setGlobalState($key, $value, $defaultValue=null, $forceSave=false)
10475 10475
 	{
10476 10476
 		$this->_stateChanged=true;
10477 10477
 		if($value===$defaultValue)
@@ -10524,7 +10524,7 @@  discard block
 block discarded – undo
10524 10524
 	}
10525 10525
 	public function setMode($value)
10526 10526
 	{
10527
-		$this->_mode=TPropertyValue::ensureEnum($value,'TApplicationMode');
10527
+		$this->_mode=TPropertyValue::ensureEnum($value, 'TApplicationMode');
10528 10528
 	}
10529 10529
 	public function getBasePath()
10530 10530
 	{
@@ -10548,7 +10548,7 @@  discard block
 block discarded – undo
10548 10548
 	}
10549 10549
 	public function setConfigurationType($value)
10550 10550
 	{
10551
-		$this->_configType = $value;
10551
+		$this->_configType=$value;
10552 10552
 	}
10553 10553
 	public function getConfigurationFileExt()
10554 10554
 	{
@@ -10557,10 +10557,10 @@  discard block
 block discarded – undo
10557 10557
 			switch($this->_configType)
10558 10558
 			{
10559 10559
 				case TApplication::CONFIG_TYPE_PHP:
10560
-					$this->_configFileExt = TApplication::CONFIG_FILE_EXT_PHP;
10560
+					$this->_configFileExt=TApplication::CONFIG_FILE_EXT_PHP;
10561 10561
 					break;
10562 10562
 				default:
10563
-					$this->_configFileExt = TApplication::CONFIG_FILE_EXT_XML;
10563
+					$this->_configFileExt=TApplication::CONFIG_FILE_EXT_XML;
10564 10564
 			}
10565 10565
 		}
10566 10566
 		return $this->_configFileExt;
@@ -10568,15 +10568,15 @@  discard block
 block discarded – undo
10568 10568
 	public function getConfigurationFileName()
10569 10569
 	{
10570 10570
 		static $fileName;
10571
-		if($fileName == null)
10571
+		if($fileName==null)
10572 10572
 		{
10573 10573
 			switch($this->_configType)
10574 10574
 			{
10575 10575
 				case TApplication::CONFIG_TYPE_PHP:
10576
-					$fileName = TApplication::CONFIG_FILE_PHP;
10576
+					$fileName=TApplication::CONFIG_FILE_PHP;
10577 10577
 					break;
10578 10578
 				default:
10579
-					$fileName = TApplication::CONFIG_FILE_XML;
10579
+					$fileName=TApplication::CONFIG_FILE_XML;
10580 10580
 			}
10581 10581
 		}
10582 10582
 		return $fileName;
@@ -10600,10 +10600,10 @@  discard block
 block discarded – undo
10600 10600
 	{
10601 10601
 		$this->_service=$value;
10602 10602
 	}
10603
-	public function setModule($id,IModule $module=null)
10603
+	public function setModule($id, IModule $module=null)
10604 10604
 	{
10605 10605
 		if(isset($this->_modules[$id]))
10606
-			throw new TConfigurationException('application_moduleid_duplicated',$id);
10606
+			throw new TConfigurationException('application_moduleid_duplicated', $id);
10607 10607
 		else
10608 10608
 			$this->_modules[$id]=$module;
10609 10609
 	}
@@ -10613,7 +10613,7 @@  discard block
 block discarded – undo
10613 10613
 			return null;
10614 10614
 				if($this->_modules[$id]===null)
10615 10615
 		{
10616
-			$module = $this->internalLoadModule($id, true);
10616
+			$module=$this->internalLoadModule($id, true);
10617 10617
 			$module[0]->init($module[1]);
10618 10618
 		}
10619 10619
 		return $this->_modules[$id];
@@ -10768,38 +10768,38 @@  discard block
 block discarded – undo
10768 10768
 		foreach($initProperties as $name=>$value)
10769 10769
 		{
10770 10770
 			if($name==='lazy') continue;
10771
-			$module->setSubProperty($name,$value);
10771
+			$module->setSubProperty($name, $value);
10772 10772
 		}
10773
-		$this->setModule($id,$module);
10773
+		$this->setModule($id, $module);
10774 10774
 				$this->_lazyModules[$id]=null;
10775
-		return array($module,$configElement);
10775
+		return array($module, $configElement);
10776 10776
 	}
10777
-	public function applyConfiguration($config,$withinService=false)
10777
+	public function applyConfiguration($config, $withinService=false)
10778 10778
 	{
10779 10779
 		if($config->getIsEmpty())
10780 10780
 			return;
10781 10781
 				foreach($config->getAliases() as $alias=>$path)
10782
-			Prado::setPathOfAlias($alias,$path);
10782
+			Prado::setPathOfAlias($alias, $path);
10783 10783
 		foreach($config->getUsings() as $using)
10784 10784
 			Prado::using($using);
10785 10785
 				if(!$withinService)
10786 10786
 		{
10787 10787
 			foreach($config->getProperties() as $name=>$value)
10788
-				$this->setSubProperty($name,$value);
10788
+				$this->setSubProperty($name, $value);
10789 10789
 		}
10790 10790
 		if(empty($this->_services))
10791
-			$this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null));
10791
+			$this->_services=array($this->getPageServiceID()=>array('TPageService', array(), null));
10792 10792
 				foreach($config->getParameters() as $id=>$parameter)
10793 10793
 		{
10794 10794
 			if(is_array($parameter))
10795 10795
 			{
10796 10796
 				$component=Prado::createComponent($parameter[0]);
10797 10797
 				foreach($parameter[1] as $name=>$value)
10798
-					$component->setSubProperty($name,$value);
10799
-				$this->_parameters->add($id,$component);
10798
+					$component->setSubProperty($name, $value);
10799
+				$this->_parameters->add($id, $component);
10800 10800
 			}
10801 10801
 			else
10802
-				$this->_parameters->add($id,$parameter);
10802
+				$this->_parameters->add($id, $parameter);
10803 10803
 		}
10804 10804
 				$modules=array();
10805 10805
 		foreach($config->getModules() as $id=>$moduleConfig)
@@ -10807,7 +10807,7 @@  discard block
 block discarded – undo
10807 10807
 			if(!is_string($id))
10808 10808
 				$id='_module'.count($this->_lazyModules);
10809 10809
 			$this->_lazyModules[$id]=$moduleConfig;
10810
-			if($module = $this->internalLoadModule($id))
10810
+			if($module=$this->internalLoadModule($id))
10811 10811
 				$modules[]=$module;
10812 10812
 		}
10813 10813
 		foreach($modules as $module)
@@ -10820,12 +10820,12 @@  discard block
 block discarded – undo
10820 10820
 				$condition=$this->evaluateExpression($condition);
10821 10821
 			if($condition)
10822 10822
 			{
10823
-				if(($path=Prado::getPathOfNamespace($filePath,$this->getConfigurationFileExt()))===null || !is_file($path))
10824
-					throw new TConfigurationException('application_includefile_invalid',$filePath);
10823
+				if(($path=Prado::getPathOfNamespace($filePath, $this->getConfigurationFileExt()))===null || !is_file($path))
10824
+					throw new TConfigurationException('application_includefile_invalid', $filePath);
10825 10825
 				$cn=$this->getApplicationConfigurationClass();
10826 10826
 				$c=new $cn;
10827 10827
 				$c->loadFromFile($path);
10828
-				$this->applyConfiguration($c,$withinService);
10828
+				$this->applyConfiguration($c, $withinService);
10829 10829
 			}
10830 10830
 		}
10831 10831
 	}
@@ -10833,16 +10833,16 @@  discard block
 block discarded – undo
10833 10833
 	{
10834 10834
 		if($this->_configFile!==null)
10835 10835
 		{
10836
-			if($this->_cacheFile===null || @filemtime($this->_cacheFile)<filemtime($this->_configFile))
10836
+			if($this->_cacheFile===null || @filemtime($this->_cacheFile) < filemtime($this->_configFile))
10837 10837
 			{
10838 10838
 				$config=new TApplicationConfiguration;
10839 10839
 				$config->loadFromFile($this->_configFile);
10840 10840
 				if($this->_cacheFile!==null)
10841
-					file_put_contents($this->_cacheFile,serialize($config),LOCK_EX);
10841
+					file_put_contents($this->_cacheFile, serialize($config), LOCK_EX);
10842 10842
 			}
10843 10843
 			else
10844 10844
 				$config=unserialize(file_get_contents($this->_cacheFile));
10845
-			$this->applyConfiguration($config,false);
10845
+			$this->applyConfiguration($config, false);
10846 10846
 		}
10847 10847
 		if(($serviceID=$this->getRequest()->resolveRequest(array_keys($this->_services)))===null)
10848 10848
 			$serviceID=$this->getPageServiceID();
@@ -10852,68 +10852,68 @@  discard block
 block discarded – undo
10852 10852
 	{
10853 10853
 		if(isset($this->_services[$serviceID]))
10854 10854
 		{
10855
-			list($serviceClass,$initProperties,$configElement)=$this->_services[$serviceID];
10855
+			list($serviceClass, $initProperties, $configElement)=$this->_services[$serviceID];
10856 10856
 			$service=Prado::createComponent($serviceClass);
10857 10857
 			if(!($service instanceof IService))
10858
-				throw new THttpException(500,'application_service_invalid',$serviceClass);
10858
+				throw new THttpException(500, 'application_service_invalid', $serviceClass);
10859 10859
 			if(!$service->getEnabled())
10860
-				throw new THttpException(500,'application_service_unavailable',$serviceClass);
10860
+				throw new THttpException(500, 'application_service_unavailable', $serviceClass);
10861 10861
 			$service->setID($serviceID);
10862 10862
 			$this->setService($service);
10863 10863
 			foreach($initProperties as $name=>$value)
10864
-				$service->setSubProperty($name,$value);
10864
+				$service->setSubProperty($name, $value);
10865 10865
 			if($configElement!==null)
10866 10866
 			{
10867 10867
 				$config=new TApplicationConfiguration;
10868 10868
 				if($this->getConfigurationType()==self::CONFIG_TYPE_PHP)
10869
-					$config->loadFromPhp($configElement,$this->getBasePath());
10869
+					$config->loadFromPhp($configElement, $this->getBasePath());
10870 10870
 				else
10871
-					$config->loadFromXml($configElement,$this->getBasePath());
10872
-				$this->applyConfiguration($config,true);
10871
+					$config->loadFromXml($configElement, $this->getBasePath());
10872
+				$this->applyConfiguration($config, true);
10873 10873
 			}
10874 10874
 			$service->init($configElement);
10875 10875
 		}
10876 10876
 		else
10877
-			throw new THttpException(500,'application_service_unknown',$serviceID);
10877
+			throw new THttpException(500, 'application_service_unknown', $serviceID);
10878 10878
 	}
10879 10879
 	public function onError($param)
10880 10880
 	{
10881
-		Prado::log($param->getMessage(),TLogger::ERROR,'System.TApplication');
10882
-		$this->raiseEvent('OnError',$this,$param);
10883
-		$this->getErrorHandler()->handleError($this,$param);
10881
+		Prado::log($param->getMessage(), TLogger::ERROR, 'System.TApplication');
10882
+		$this->raiseEvent('OnError', $this, $param);
10883
+		$this->getErrorHandler()->handleError($this, $param);
10884 10884
 	}
10885 10885
 	public function onBeginRequest()
10886 10886
 	{
10887
-		$this->raiseEvent('OnBeginRequest',$this,null);
10887
+		$this->raiseEvent('OnBeginRequest', $this, null);
10888 10888
 	}
10889 10889
 	public function onAuthentication()
10890 10890
 	{
10891
-		$this->raiseEvent('OnAuthentication',$this,null);
10891
+		$this->raiseEvent('OnAuthentication', $this, null);
10892 10892
 	}
10893 10893
 	public function onAuthenticationComplete()
10894 10894
 	{
10895
-		$this->raiseEvent('OnAuthenticationComplete',$this,null);
10895
+		$this->raiseEvent('OnAuthenticationComplete', $this, null);
10896 10896
 	}
10897 10897
 	public function onAuthorization()
10898 10898
 	{
10899
-		$this->raiseEvent('OnAuthorization',$this,null);
10899
+		$this->raiseEvent('OnAuthorization', $this, null);
10900 10900
 	}
10901 10901
 	public function onAuthorizationComplete()
10902 10902
 	{
10903
-		$this->raiseEvent('OnAuthorizationComplete',$this,null);
10903
+		$this->raiseEvent('OnAuthorizationComplete', $this, null);
10904 10904
 	}
10905 10905
 	public function onLoadState()
10906 10906
 	{
10907 10907
 		$this->loadGlobals();
10908
-		$this->raiseEvent('OnLoadState',$this,null);
10908
+		$this->raiseEvent('OnLoadState', $this, null);
10909 10909
 	}
10910 10910
 	public function onLoadStateComplete()
10911 10911
 	{
10912
-		$this->raiseEvent('OnLoadStateComplete',$this,null);
10912
+		$this->raiseEvent('OnLoadStateComplete', $this, null);
10913 10913
 	}
10914 10914
 	public function onPreRunService()
10915 10915
 	{
10916
-		$this->raiseEvent('OnPreRunService',$this,null);
10916
+		$this->raiseEvent('OnPreRunService', $this, null);
10917 10917
 	}
10918 10918
 	public function runService()
10919 10919
 	{
@@ -10922,24 +10922,24 @@  discard block
 block discarded – undo
10922 10922
 	}
10923 10923
 	public function onSaveState()
10924 10924
 	{
10925
-		$this->raiseEvent('OnSaveState',$this,null);
10925
+		$this->raiseEvent('OnSaveState', $this, null);
10926 10926
 		$this->saveGlobals();
10927 10927
 	}
10928 10928
 	public function onSaveStateComplete()
10929 10929
 	{
10930
-		$this->raiseEvent('OnSaveStateComplete',$this,null);
10930
+		$this->raiseEvent('OnSaveStateComplete', $this, null);
10931 10931
 	}
10932 10932
 	public function onPreFlushOutput()
10933 10933
 	{
10934
-		$this->raiseEvent('OnPreFlushOutput',$this,null);
10934
+		$this->raiseEvent('OnPreFlushOutput', $this, null);
10935 10935
 	}
10936
-	public function flushOutput($continueBuffering = true)
10936
+	public function flushOutput($continueBuffering=true)
10937 10937
 	{
10938 10938
 		$this->getResponse()->flush($continueBuffering);
10939 10939
 	}
10940 10940
 	public function onEndRequest()
10941 10941
 	{
10942
-		$this->flushOutput(false); 		$this->saveGlobals();  		$this->raiseEvent('OnEndRequest',$this,null);
10942
+		$this->flushOutput(false); $this->saveGlobals(); $this->raiseEvent('OnEndRequest', $this, null);
10943 10943
 	}
10944 10944
 }
10945 10945
 class TApplicationMode extends TEnumerable
@@ -10963,14 +10963,14 @@  discard block
 block discarded – undo
10963 10963
 	{
10964 10964
 		if(Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
10965 10965
 		{
10966
-			$fcontent = include $fname;
10967
-			$this->loadFromPhp($fcontent,dirname($fname));
10966
+			$fcontent=include $fname;
10967
+			$this->loadFromPhp($fcontent, dirname($fname));
10968 10968
 		}
10969 10969
 		else
10970 10970
 		{
10971 10971
 			$dom=new TXmlDocument;
10972 10972
 			$dom->loadFromFile($fname);
10973
-			$this->loadFromXml($dom,dirname($fname));
10973
+			$this->loadFromXml($dom, dirname($fname));
10974 10974
 		}
10975 10975
 	}
10976 10976
 	public function getIsEmpty()
@@ -10985,20 +10985,20 @@  discard block
 block discarded – undo
10985 10985
 			{
10986 10986
 				$this->_properties[$name]=$value;
10987 10987
 			}
10988
-			$this->_empty = false;
10988
+			$this->_empty=false;
10989 10989
 		}
10990 10990
 		if(isset($config['paths']) && is_array($config['paths']))
10991
-			$this->loadPathsPhp($config['paths'],$configPath);
10991
+			$this->loadPathsPhp($config['paths'], $configPath);
10992 10992
 		if(isset($config['modules']) && is_array($config['modules']))
10993
-			$this->loadModulesPhp($config['modules'],$configPath);
10993
+			$this->loadModulesPhp($config['modules'], $configPath);
10994 10994
 		if(isset($config['services']) && is_array($config['services']))
10995
-			$this->loadServicesPhp($config['services'],$configPath);
10995
+			$this->loadServicesPhp($config['services'], $configPath);
10996 10996
 		if(isset($config['parameters']) && is_array($config['parameters']))
10997 10997
 			$this->loadParametersPhp($config['parameters'], $configPath);
10998 10998
 		if(isset($config['includes']) && is_array($config['includes']))
10999
-			$this->loadExternalXml($config['includes'],$configPath);
10999
+			$this->loadExternalXml($config['includes'], $configPath);
11000 11000
 	}
11001
-	public function loadFromXml($dom,$configPath)
11001
+	public function loadFromXml($dom, $configPath)
11002 11002
 	{
11003 11003
 				foreach($dom->getAttributes() as $name=>$value)
11004 11004
 		{
@@ -11010,19 +11010,19 @@  discard block
 block discarded – undo
11010 11010
 			switch($element->getTagName())
11011 11011
 			{
11012 11012
 				case 'paths':
11013
-					$this->loadPathsXml($element,$configPath);
11013
+					$this->loadPathsXml($element, $configPath);
11014 11014
 					break;
11015 11015
 				case 'modules':
11016
-					$this->loadModulesXml($element,$configPath);
11016
+					$this->loadModulesXml($element, $configPath);
11017 11017
 					break;
11018 11018
 				case 'services':
11019
-					$this->loadServicesXml($element,$configPath);
11019
+					$this->loadServicesXml($element, $configPath);
11020 11020
 					break;
11021 11021
 				case 'parameters':
11022
-					$this->loadParametersXml($element,$configPath);
11022
+					$this->loadParametersXml($element, $configPath);
11023 11023
 					break;
11024 11024
 				case 'include':
11025
-					$this->loadExternalXml($element,$configPath);
11025
+					$this->loadExternalXml($element, $configPath);
11026 11026
 					break;
11027 11027
 				default:
11028 11028
 										break;
@@ -11035,14 +11035,14 @@  discard block
 block discarded – undo
11035 11035
 		{
11036 11036
 			foreach($pathsNode['aliases'] as $id=>$path)
11037 11037
 			{
11038
-				$path=str_replace('\\','/',$path);
11039
-				if(preg_match('/^\\/|.:\\/|.:\\\\/',$path))						$p=realpath($path);
11038
+				$path=str_replace('\\', '/', $path);
11039
+				if(preg_match('/^\\/|.:\\/|.:\\\\/', $path))						$p=realpath($path);
11040 11040
 				else
11041 11041
 					$p=realpath($configPath.DIRECTORY_SEPARATOR.$path);
11042 11042
 				if($p===false || !is_dir($p))
11043
-					throw new TConfigurationException('appconfig_aliaspath_invalid',$id,$path);
11043
+					throw new TConfigurationException('appconfig_aliaspath_invalid', $id, $path);
11044 11044
 				if(isset($this->_aliases[$id]))
11045
-					throw new TConfigurationException('appconfig_alias_redefined',$id);
11045
+					throw new TConfigurationException('appconfig_alias_redefined', $id);
11046 11046
 				$this->_aliases[$id]=$p;
11047 11047
 			}
11048 11048
 		}
@@ -11050,11 +11050,11 @@  discard block
 block discarded – undo
11050 11050
 		{
11051 11051
 			foreach($pathsNode['using'] as $namespace)
11052 11052
 			{
11053
-				$this->_usings[] = $namespace;
11053
+				$this->_usings[]=$namespace;
11054 11054
 			}
11055 11055
 		}
11056 11056
 	}
11057
-	protected function loadPathsXml($pathsNode,$configPath)
11057
+	protected function loadPathsXml($pathsNode, $configPath)
11058 11058
 	{
11059 11059
 		foreach($pathsNode->getElements() as $element)
11060 11060
 		{
@@ -11064,14 +11064,14 @@  discard block
 block discarded – undo
11064 11064
 				{
11065 11065
 					if(($id=$element->getAttribute('id'))!==null && ($path=$element->getAttribute('path'))!==null)
11066 11066
 					{
11067
-						$path=str_replace('\\','/',$path);
11068
-						if(preg_match('/^\\/|.:\\/|.:\\\\/',$path))								$p=realpath($path);
11067
+						$path=str_replace('\\', '/', $path);
11068
+						if(preg_match('/^\\/|.:\\/|.:\\\\/', $path))								$p=realpath($path);
11069 11069
 						else
11070 11070
 							$p=realpath($configPath.DIRECTORY_SEPARATOR.$path);
11071 11071
 						if($p===false || !is_dir($p))
11072
-							throw new TConfigurationException('appconfig_aliaspath_invalid',$id,$path);
11072
+							throw new TConfigurationException('appconfig_aliaspath_invalid', $id, $path);
11073 11073
 						if(isset($this->_aliases[$id]))
11074
-							throw new TConfigurationException('appconfig_alias_redefined',$id);
11074
+							throw new TConfigurationException('appconfig_alias_redefined', $id);
11075 11075
 						$this->_aliases[$id]=$p;
11076 11076
 					}
11077 11077
 					else
@@ -11089,7 +11089,7 @@  discard block
 block discarded – undo
11089 11089
 					break;
11090 11090
 				}
11091 11091
 				default:
11092
-					throw new TConfigurationException('appconfig_paths_invalid',$element->getTagName());
11092
+					throw new TConfigurationException('appconfig_paths_invalid', $element->getTagName());
11093 11093
 			}
11094 11094
 		}
11095 11095
 	}
@@ -11098,21 +11098,21 @@  discard block
 block discarded – undo
11098 11098
 		foreach($modulesNode as $id=>$module)
11099 11099
 		{
11100 11100
 			if(!isset($module['class']))
11101
-				throw new TConfigurationException('appconfig_moduletype_required',$id);
11102
-			$type = $module['class'];
11101
+				throw new TConfigurationException('appconfig_moduletype_required', $id);
11102
+			$type=$module['class'];
11103 11103
 			unset($module['class']);
11104
-			$properties = array();
11104
+			$properties=array();
11105 11105
 			if(isset($module['properties']))
11106 11106
 			{
11107
-				$properties = $module['properties'];
11107
+				$properties=$module['properties'];
11108 11108
 				unset($module['properties']);
11109 11109
 			}
11110
-			$properties['id'] = $id;
11111
-			$this->_modules[$id]=array($type,$properties,$module);
11110
+			$properties['id']=$id;
11111
+			$this->_modules[$id]=array($type, $properties, $module);
11112 11112
 			$this->_empty=false;
11113 11113
 		}
11114 11114
 	}
11115
-	protected function loadModulesXml($modulesNode,$configPath)
11115
+	protected function loadModulesXml($modulesNode, $configPath)
11116 11116
 	{
11117 11117
 		foreach($modulesNode->getElements() as $element)
11118 11118
 		{
@@ -11122,33 +11122,33 @@  discard block
 block discarded – undo
11122 11122
 				$id=$properties->itemAt('id');
11123 11123
 				$type=$properties->remove('class');
11124 11124
 				if($type===null)
11125
-					throw new TConfigurationException('appconfig_moduletype_required',$id);
11125
+					throw new TConfigurationException('appconfig_moduletype_required', $id);
11126 11126
 				$element->setParent(null);
11127 11127
 				if($id===null)
11128
-					$this->_modules[]=array($type,$properties->toArray(),$element);
11128
+					$this->_modules[]=array($type, $properties->toArray(), $element);
11129 11129
 				else
11130
-					$this->_modules[$id]=array($type,$properties->toArray(),$element);
11130
+					$this->_modules[$id]=array($type, $properties->toArray(), $element);
11131 11131
 				$this->_empty=false;
11132 11132
 			}
11133 11133
 			else
11134
-				throw new TConfigurationException('appconfig_modules_invalid',$element->getTagName());
11134
+				throw new TConfigurationException('appconfig_modules_invalid', $element->getTagName());
11135 11135
 		}
11136 11136
 	}
11137
-	protected function loadServicesPhp($servicesNode,$configPath)
11137
+	protected function loadServicesPhp($servicesNode, $configPath)
11138 11138
 	{
11139 11139
 		foreach($servicesNode as $id => $service)
11140 11140
 		{
11141 11141
 			if(!isset($service['class']))
11142 11142
 				throw new TConfigurationException('appconfig_servicetype_required');
11143
-			$type = $service['class'];
11144
-			$properties = isset($service['properties']) ? $service['properties'] : array();
11143
+			$type=$service['class'];
11144
+			$properties=isset($service['properties']) ? $service['properties'] : array();
11145 11145
 			unset($service['properties']);
11146
-			$properties['id'] = $id;
11147
-			$this->_services[$id] = array($type,$properties,$service);
11148
-			$this->_empty = false;
11146
+			$properties['id']=$id;
11147
+			$this->_services[$id]=array($type, $properties, $service);
11148
+			$this->_empty=false;
11149 11149
 		}
11150 11150
 	}
11151
-	protected function loadServicesXml($servicesNode,$configPath)
11151
+	protected function loadServicesXml($servicesNode, $configPath)
11152 11152
 	{
11153 11153
 		foreach($servicesNode->getElements() as $element)
11154 11154
 		{
@@ -11158,16 +11158,16 @@  discard block
 block discarded – undo
11158 11158
 				if(($id=$properties->itemAt('id'))===null)
11159 11159
 					throw new TConfigurationException('appconfig_serviceid_required');
11160 11160
 				if(($type=$properties->remove('class'))===null)
11161
-					throw new TConfigurationException('appconfig_servicetype_required',$id);
11161
+					throw new TConfigurationException('appconfig_servicetype_required', $id);
11162 11162
 				$element->setParent(null);
11163
-				$this->_services[$id]=array($type,$properties->toArray(),$element);
11163
+				$this->_services[$id]=array($type, $properties->toArray(), $element);
11164 11164
 				$this->_empty=false;
11165 11165
 			}
11166 11166
 			else
11167
-				throw new TConfigurationException('appconfig_services_invalid',$element->getTagName());
11167
+				throw new TConfigurationException('appconfig_services_invalid', $element->getTagName());
11168 11168
 		}
11169 11169
 	}
11170
-	protected function loadParametersPhp($parametersNode,$configPath)
11170
+	protected function loadParametersPhp($parametersNode, $configPath)
11171 11171
 	{
11172 11172
 		foreach($parametersNode as $id => $parameter)
11173 11173
 		{
@@ -11175,20 +11175,20 @@  discard block
 block discarded – undo
11175 11175
 			{
11176 11176
 				if(isset($parameter['class']))
11177 11177
 				{
11178
-					$type = $parameter['class'];
11178
+					$type=$parameter['class'];
11179 11179
 					unset($parameter['class']);
11180
-					$properties = isset($service['properties']) ? $service['properties'] : array();
11181
-					$properties['id'] = $id;
11182
-					$this->_parameters[$id] = array($type,$properties);
11180
+					$properties=isset($service['properties']) ? $service['properties'] : array();
11181
+					$properties['id']=$id;
11182
+					$this->_parameters[$id]=array($type, $properties);
11183 11183
 				}
11184 11184
 			}
11185 11185
 			else
11186 11186
 			{
11187
-				$this->_parameters[$id] = $parameter;
11187
+				$this->_parameters[$id]=$parameter;
11188 11188
 			}
11189 11189
 		}
11190 11190
 	}
11191
-	protected function loadParametersXml($parametersNode,$configPath)
11191
+	protected function loadParametersXml($parametersNode, $configPath)
11192 11192
 	{
11193 11193
 		foreach($parametersNode->getElements() as $element)
11194 11194
 		{
@@ -11205,21 +11205,21 @@  discard block
 block discarded – undo
11205 11205
 						$this->_parameters[$id]=$value;
11206 11206
 				}
11207 11207
 				else
11208
-					$this->_parameters[$id]=array($type,$properties->toArray());
11208
+					$this->_parameters[$id]=array($type, $properties->toArray());
11209 11209
 				$this->_empty=false;
11210 11210
 			}
11211 11211
 			else
11212
-				throw new TConfigurationException('appconfig_parameters_invalid',$element->getTagName());
11212
+				throw new TConfigurationException('appconfig_parameters_invalid', $element->getTagName());
11213 11213
 		}
11214 11214
 	}
11215
-	protected function loadExternalPhp($includeNode,$configPath)
11215
+	protected function loadExternalPhp($includeNode, $configPath)
11216 11216
 	{
11217 11217
 		foreach($includeNode as $include)
11218 11218
 		{
11219
-			$when = isset($include['when'])?true:false;
11219
+			$when=isset($include['when']) ? true : false;
11220 11220
 			if(!isset($include['file']))
11221 11221
 				throw new TConfigurationException('appconfig_includefile_required');
11222
-			$filePath = $include['file'];
11222
+			$filePath=$include['file'];
11223 11223
 			if(isset($this->_includes[$filePath]))
11224 11224
 				$this->_includes[$filePath]='('.$this->_includes[$filePath].') || ('.$when.')';
11225 11225
 			else
@@ -11227,7 +11227,7 @@  discard block
 block discarded – undo
11227 11227
 			$this->_empty=false;
11228 11228
 		}
11229 11229
 	}
11230
-	protected function loadExternalXml($includeNode,$configPath)
11230
+	protected function loadExternalXml($includeNode, $configPath)
11231 11231
 	{
11232 11232
 		if(($when=$includeNode->getAttribute('when'))===null)
11233 11233
 			$when=true;
@@ -11300,12 +11300,12 @@  discard block
 block discarded – undo
11300 11300
 			if($cache->get(self::CACHE_NAME)===$content)
11301 11301
 				$saveFile=false;
11302 11302
 			else
11303
-				$cache->set(self::CACHE_NAME,$content);
11303
+				$cache->set(self::CACHE_NAME, $content);
11304 11304
 		}
11305 11305
 		if($saveFile)
11306 11306
 		{
11307 11307
 			$fileName=$this->getStateFilePath();
11308
-			file_put_contents($fileName,$content,LOCK_EX);
11308
+			file_put_contents($fileName, $content, LOCK_EX);
11309 11309
 		}
11310 11310
 	}
11311 11311
 }
Please login to merge, or discard this patch.