Completed
Push — namespace2 ( 8a6673...791eac )
by Fabio
08:25
created
framework/Caching/TDbCache.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 	/**
111 111
 	 * @var boolean
112 112
 	 */
113
-	private $_cacheInitialized = false;
113
+	private $_cacheInitialized=false;
114 114
 	/**
115 115
 	 * @var boolean
116 116
 	 */
117
-	private $_createCheck= false;
117
+	private $_createCheck=false;
118 118
 	/**
119 119
 	 * @var boolean whether the cache DB table should be created automatically
120 120
 	 */
@@ -188,20 +188,20 @@  discard block
 block discarded – undo
188 188
 		$db=$this->getDbConnection();
189 189
 		try
190 190
 		{
191
-			$key = 'TDbCache:' . $this->_cacheTable . ':created';
191
+			$key='TDbCache:'.$this->_cacheTable.':created';
192 192
 			if($force)
193
-				$this -> _createCheck = false;
193
+				$this -> _createCheck=false;
194 194
 			else
195
-				$this -> _createCheck = $this -> getApplication() -> getGlobalState($key, 0);
195
+				$this -> _createCheck=$this -> getApplication() -> getGlobalState($key, 0);
196 196
 
197 197
 			if($this->_autoCreate && !$this -> _createCheck) {
198 198
 
199
-				Prado::trace(($force ? 'Force initializing: ' : 'Initializing: ') . $this -> id . ', ' . $this->_cacheTable, '\Prado\Caching\TDbCache');
199
+				Prado::trace(($force ? 'Force initializing: ' : 'Initializing: ').$this -> id.', '.$this->_cacheTable, '\Prado\Caching\TDbCache');
200 200
 
201 201
 				$sql='SELECT 1 FROM '.$this->_cacheTable.' WHERE 0=1';
202 202
 				$db->createCommand($sql)->queryScalar();
203 203
 
204
-				$this -> _createCheck = true;
204
+				$this -> _createCheck=true;
205 205
 				$this -> getApplication() -> setGlobalState($key, time());
206 206
 			}
207 207
 		}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			// DB table not exists
211 211
 			if($this->_autoCreate)
212 212
 			{
213
-				Prado::trace('Autocreate: ' . $this->_cacheTable, '\Prado\Caching\TDbCache');
213
+				Prado::trace('Autocreate: '.$this->_cacheTable, '\Prado\Caching\TDbCache');
214 214
 
215 215
 				$driver=$db->getDriverName();
216 216
 				if($driver==='mysql')
@@ -223,16 +223,16 @@  discard block
 block discarded – undo
223 223
 				$sql='CREATE TABLE '.$this->_cacheTable." (itemkey CHAR(128) PRIMARY KEY, value $blob, expire INTEGER)";
224 224
 				$db->createCommand($sql)->execute();
225 225
 
226
-				$sql='CREATE INDEX IX_expire ON ' . $this->_cacheTable . ' (expire)';
226
+				$sql='CREATE INDEX IX_expire ON '.$this->_cacheTable.' (expire)';
227 227
 				$db->createCommand($sql)->execute();
228 228
 
229
-				$this -> _createCheck = true;
229
+				$this -> _createCheck=true;
230 230
 				$this -> getApplication() -> setGlobalState($key, time());
231 231
 			}
232 232
 			else
233
-				throw new TConfigurationException('db_cachetable_inexistent',$this->_cacheTable);
233
+				throw new TConfigurationException('db_cachetable_inexistent', $this->_cacheTable);
234 234
 		}
235
-		$this->_cacheInitialized = true;
235
+		$this->_cacheInitialized=true;
236 236
 	}
237 237
 
238 238
 	/**
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	public function flushCacheExpired($force=false)
245 245
 	{
246
-		$interval = $this -> getFlushInterval();
247
-		if(!$force && $interval === 0) return;
246
+		$interval=$this -> getFlushInterval();
247
+		if(!$force && $interval===0) return;
248 248
 
249
-		$key	= 'TDbCache:' . $this->_cacheTable . ':flushed';
250
-		$now	= time();
251
-		$next	= $interval + (integer)$this -> getApplication() -> getGlobalState($key, 0);
249
+		$key='TDbCache:'.$this->_cacheTable.':flushed';
250
+		$now=time();
251
+		$next=$interval + (integer) $this -> getApplication() -> getGlobalState($key, 0);
252 252
 
253 253
 		if($force || $next <= $now)
254 254
 		{
255 255
 			if(!$this->_cacheInitialized) $this->initializeCache();
256
-			Prado::trace(($force ? 'Force flush of expired items: ' : 'Flush expired items: ') . $this -> id . ', ' . $this->_cacheTable, '\Prado\Caching\TDbCache');
256
+			Prado::trace(($force ? 'Force flush of expired items: ' : 'Flush expired items: ').$this -> id.', '.$this->_cacheTable, '\Prado\Caching\TDbCache');
257 257
 			$sql='DELETE FROM '.$this->_cacheTable.' WHERE expire<>0 AND expire<'.$now;
258 258
 			$this->getDbConnection()->createCommand($sql)->execute();
259 259
 			$this -> getApplication() -> setGlobalState($key, $now);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	public function setFlushInterval($value)
282 282
 	{
283
-		$this->_flushInterval = (integer) $value;
283
+		$this->_flushInterval=(integer) $value;
284 284
 	}
285 285
 
286 286
 	/**
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			if($config instanceof TDataSourceConfig)
298 298
 				return $config->getDbConnection();
299 299
 			else
300
-				throw new TConfigurationException('dbcache_connectionid_invalid',$this->_connID);
300
+				throw new TConfigurationException('dbcache_connectionid_invalid', $this->_connID);
301 301
 		}
302 302
 		else
303 303
 		{
@@ -484,10 +484,10 @@  discard block
 block discarded – undo
484 484
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
485 485
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
486 486
 	 */
487
-	protected function setValue($key,$value,$expire)
487
+	protected function setValue($key, $value, $expire)
488 488
 	{
489 489
 		$this->deleteValue($key);
490
-		return $this->addValue($key,$value,$expire);
490
+		return $this->addValue($key, $value, $expire);
491 491
 	}
492 492
 
493 493
 	/**
@@ -499,16 +499,16 @@  discard block
 block discarded – undo
499 499
 	 * @param integer the number of seconds in which the cached value will expire. 0 means never expire.
500 500
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
501 501
 	 */
502
-	protected function addValue($key,$value,$expire)
502
+	protected function addValue($key, $value, $expire)
503 503
 	{
504 504
 		if(!$this->_cacheInitialized) $this->initializeCache();
505
-		$expire=($expire<=0)?0:time()+$expire;
505
+		$expire=($expire <= 0) ? 0 : time() + $expire;
506 506
 		$sql="INSERT INTO {$this->_cacheTable} (itemkey,value,expire) VALUES(:key,:value,$expire)";
507 507
 		try
508 508
 		{
509 509
 			$command=$this->getDbConnection()->createCommand($sql);
510
-			$command->bindValue(':key',$key,\PDO::PARAM_STR);
511
-			$command->bindValue(':value',serialize($value),\PDO::PARAM_LOB);
510
+			$command->bindValue(':key', $key, \PDO::PARAM_STR);
511
+			$command->bindValue(':value', serialize($value), \PDO::PARAM_LOB);
512 512
 			$command->execute();
513 513
 			return true;
514 514
 		}
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 		try
540 540
 		{
541 541
 			$command=$this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable} WHERE itemkey=:key");
542
-			$command->bindValue(':key',$key,\PDO::PARAM_STR);
542
+			$command->bindValue(':key', $key, \PDO::PARAM_STR);
543 543
 			$command->execute();
544 544
 			return true;
545 545
 		}
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 		if(!$this->_cacheInitialized) $this->initializeCache();
561 561
 		try
562 562
 		{
563
-			$command = $this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}");
563
+			$command=$this->getDbConnection()->createCommand("DELETE FROM {$this->_cacheTable}");
564 564
 			$command->execute();
565 565
 		}
566 566
 		catch(\Exception $e)
Please login to merge, or discard this patch.
framework/Web/THttpRequest.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
  */
77 77
 class THttpRequest extends \Prado\TApplicationComponent implements \IteratorAggregate, \ArrayAccess, \Countable, \Prado\IModule
78 78
 {
79
-	const CGIFIX__PATH_INFO		= 1;
80
-	const CGIFIX__SCRIPT_NAME	= 2;
79
+	const CGIFIX__PATH_INFO=1;
80
+	const CGIFIX__SCRIPT_NAME=2;
81 81
 	/**
82 82
 	 * @var TUrlManager the URL manager module
83 83
 	 */
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 		if(isset($_SERVER['REQUEST_URI']))
181 181
 			$this->_requestUri=$_SERVER['REQUEST_URI'];
182 182
 		else  // TBD: in this case, SCRIPT_NAME need to be escaped
183
-			$this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING'])?'':'?'.$_SERVER['QUERY_STRING']);
183
+			$this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING']) ? '' : '?'.$_SERVER['QUERY_STRING']);
184 184
 
185
-		if($this->_cgiFix&self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO']))
185
+		if($this->_cgiFix & self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO']))
186 186
 			$this->_pathInfo=substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME']));
187 187
 		elseif(isset($_SERVER['PATH_INFO']))
188 188
 			$this->_pathInfo=$_SERVER['PATH_INFO'];
189
-		else if(strpos($_SERVER['PHP_SELF'],$_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME'])
190
-			$this->_pathInfo=substr($_SERVER['PHP_SELF'],strlen($_SERVER['SCRIPT_NAME']));
189
+		else if(strpos($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME'])
190
+			$this->_pathInfo=substr($_SERVER['PHP_SELF'], strlen($_SERVER['SCRIPT_NAME']));
191 191
 		else
192 192
 			$this->_pathInfo='';
193 193
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	public function stripSlashes(&$data)
216 216
 	{
217
-		return is_array($data)?array_map(array($this,'stripSlashes'),$data):stripslashes($data);
217
+		return is_array($data) ? array_map(array($this, 'stripSlashes'), $data) : stripslashes($data);
218 218
 	}
219 219
 
220 220
 	/**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		if($this->_url===null)
226 226
 		{
227 227
 			$secure=$this->getIsSecureConnection();
228
-			$url=$secure?'https://':'http://';
228
+			$url=$secure ? 'https://' : 'http://';
229 229
 			if(empty($_SERVER['HTTP_HOST']))
230 230
 			{
231 231
 				$url.=$_SERVER['SERVER_NAME'];
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function setEnableCache($value)
250 250
 	{
251
-		$this->_enableCache = TPropertyValue::ensureBoolean($value);
251
+		$this->_enableCache=TPropertyValue::ensureBoolean($value);
252 252
 	}
253 253
 
254 254
 	/**
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
 	{
273 273
 		if($this->getEnableCache())
274 274
 		{
275
-			$cache = $this->getApplication()->getCache();
276
-			if($cache !== null)
275
+			$cache=$this->getApplication()->getCache();
276
+			if($cache!==null)
277 277
 			{
278
-				$dependencies = null;
279
-				if($this->getApplication()->getMode() !== TApplicationMode::Performance)
280
-					if ($manager instanceof TUrlMapping && $fn = $manager->getConfigFile())
278
+				$dependencies=null;
279
+				if($this->getApplication()->getMode()!==TApplicationMode::Performance)
280
+					if($manager instanceof TUrlMapping && $fn=$manager->getConfigFile())
281 281
 					{
282
-						$fn = Prado::getPathOfNamespace($fn,$this->getApplication()->getConfigurationFileExt());
283
-						$dependencies = new TFileCacheDependency($fn);
282
+						$fn=Prado::getPathOfNamespace($fn, $this->getApplication()->getConfigurationFileExt());
283
+						$dependencies=new TFileCacheDependency($fn);
284 284
 					}
285 285
 				return $cache->set($this->getCacheKey(), $manager, 0, $dependencies);
286 286
 			}
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
 	{
297 297
 		if($this->getEnableCache())
298 298
 		{
299
-			$cache = $this->getApplication()->getCache();
300
-			if($cache !== null)
299
+			$cache=$this->getApplication()->getCache();
300
+			if($cache!==null)
301 301
 			{
302
-				$manager = $cache->get($this->getCacheKey());
302
+				$manager=$cache->get($this->getCacheKey());
303 303
 				if($manager instanceof TUrlManager)
304 304
 					return $manager;
305 305
 			}
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	{
336 336
 		if($this->_urlManager===null)
337 337
 		{
338
-			if(($this->_urlManager = $this->loadCachedUrlManager())===null)
338
+			if(($this->_urlManager=$this->loadCachedUrlManager())===null)
339 339
 			{
340 340
 				if(empty($this->_urlManagerID))
341 341
 				{
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 				{
347 347
 					$this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID);
348 348
 					if($this->_urlManager===null)
349
-						throw new TConfigurationException('httprequest_urlmanager_inexist',$this->_urlManagerID);
349
+						throw new TConfigurationException('httprequest_urlmanager_inexist', $this->_urlManagerID);
350 350
 					if(!($this->_urlManager instanceof TUrlManager))
351
-						throw new TConfigurationException('httprequest_urlmanager_invalid',$this->_urlManagerID);
351
+						throw new TConfigurationException('httprequest_urlmanager_invalid', $this->_urlManagerID);
352 352
 				}
353 353
 				$this->cacheUrlManager($this->_urlManager);
354 354
 			}
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 */
375 375
 	public function setUrlFormat($value)
376 376
 	{
377
-		$this->_urlFormat=TPropertyValue::ensureEnum($value,'Prado\\Web\\THttpRequestUrlFormat');
377
+		$this->_urlFormat=TPropertyValue::ensureEnum($value, 'Prado\\Web\\THttpRequestUrlFormat');
378 378
 	}
379 379
 
380 380
 	/**
@@ -402,19 +402,19 @@  discard block
 block discarded – undo
402 402
 	 */
403 403
 	public function getRequestType()
404 404
 	{
405
-		return isset($_SERVER['REQUEST_METHOD'])?$_SERVER['REQUEST_METHOD']:null;
405
+		return isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
406 406
 	}
407 407
 
408 408
 	/**
409 409
 	 * @param boolean $mimetypeOnly whether to return only the mimetype (default: true)
410 410
 	 * @return string content type (e.g. 'application/json' or 'text/html; encoding=gzip') or null if not specified
411 411
 	 */
412
-	public function getContentType($mimetypeOnly = true)
412
+	public function getContentType($mimetypeOnly=true)
413 413
 	{
414 414
 		if(!isset($_SERVER['CONTENT_TYPE']))
415 415
 			return null;
416 416
 
417
-		if($mimetypeOnly === true && ($_pos = strpos(';', $_SERVER['CONTENT_TYPE'])) !== false)
417
+		if($mimetypeOnly===true && ($_pos=strpos(';', $_SERVER['CONTENT_TYPE']))!==false)
418 418
 			return substr($_SERVER['CONTENT_TYPE'], 0, $_pos);
419 419
 
420 420
 		return $_SERVER['CONTENT_TYPE'];
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	public function getIsSecureConnection()
427 427
 	{
428
-			return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'],'off');
428
+			return isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'off');
429 429
 	}
430 430
 
431 431
 	/**
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	 */
442 442
 	public function getQueryString()
443 443
 	{
444
-		return isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:null;
444
+		return isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null;
445 445
 	}
446 446
 
447 447
 	/**
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 	 */
450 450
 	public function getHttpProtocolVersion()
451 451
 	{
452
-		return isset($_SERVER['SERVER_PROTOCOL'])?$_SERVER['SERVER_PROTOCOL']:null;
452
+		return isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : null;
453 453
 	}
454 454
 
455 455
 	/**
@@ -460,19 +460,19 @@  discard block
 block discarded – undo
460 460
 	{
461 461
 		static $result;
462 462
 
463
-		if($result === null && function_exists('apache_request_headers')) {
464
-			$result = apache_request_headers();
463
+		if($result===null && function_exists('apache_request_headers')) {
464
+			$result=apache_request_headers();
465 465
 		}
466
-		elseif($result === null) {
467
-			$result = array();
466
+		elseif($result===null) {
467
+			$result=array();
468 468
 			foreach($_SERVER as $key=>$value) {
469
-				if(strncasecmp($key, 'HTTP_', 5) !== 0) continue;
470
-					$key = str_replace(' ','-', ucwords(strtolower(str_replace('_',' ', substr($key, 5)))));
471
-					$result[$key] = $value;
469
+				if(strncasecmp($key, 'HTTP_', 5)!==0) continue;
470
+					$key=str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
471
+					$result[$key]=$value;
472 472
 			}
473 473
 		}
474 474
 
475
-		if($case !== null)
475
+		if($case!==null)
476 476
 			return array_change_key_case($result, $case);
477 477
 
478 478
 		return $result;
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
 	public function getBaseUrl($forceSecureConnection=null)
497 497
 	{
498 498
 		$url=$this->getUrl();
499
-		$scheme=($forceSecureConnection)?"https": (($forceSecureConnection === null)?$url->getScheme():'http');
499
+		$scheme=($forceSecureConnection) ? "https" : (($forceSecureConnection===null) ? $url->getScheme() : 'http');
500 500
 		$host=$url->getHost();
501
-		if (($port=$url->getPort())) $host.=':'.$port;
501
+		if(($port=$url->getPort())) $host.=':'.$port;
502 502
 		return $scheme.'://'.$host;
503 503
 	}
504 504
 
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
 	 */
508 508
 	public function getApplicationUrl()
509 509
 	{
510
-		if($this->_cgiFix&self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
510
+		if($this->_cgiFix & self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
511 511
 			return $_SERVER['ORIG_SCRIPT_NAME'];
512 512
 
513
-		return isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:null;
513
+		return isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : null;
514 514
 	}
515 515
 
516 516
 	/**
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	 */
523 523
 	public function getAbsoluteApplicationUrl($forceSecureConnection=null)
524 524
 	{
525
-		return $this->getBaseUrl($forceSecureConnection) . $this->getApplicationUrl();
525
+		return $this->getBaseUrl($forceSecureConnection).$this->getApplicationUrl();
526 526
 	}
527 527
 
528 528
 	/**
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	public function getApplicationFilePath()
532 532
 	{
533
-		return realpath(isset($_SERVER['SCRIPT_FILENAME'])?$_SERVER['SCRIPT_FILENAME']:null);
533
+		return realpath(isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : null);
534 534
 	}
535 535
 
536 536
 	/**
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	public function getServerName()
540 540
 	{
541
-		return isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:null;
541
+		return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null;
542 542
 	}
543 543
 
544 544
 	/**
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	 */
547 547
 	public function getServerPort()
548 548
 	{
549
-		return isset($_SERVER['SERVER_PORT'])?$_SERVER['SERVER_PORT']:null;
549
+		return isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : null;
550 550
 	}
551 551
 
552 552
 	/**
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 	 */
555 555
 	public function getUrlReferrer()
556 556
 	{
557
-		return isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:null;
557
+		return isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
558 558
 	}
559 559
 
560 560
 	/**
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	 */
579 579
 	public function getUserAgent()
580 580
 	{
581
-		return isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:null;
581
+		return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
582 582
 	}
583 583
 
584 584
 	/**
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	 */
587 587
 	public function getUserHostAddress()
588 588
 	{
589
-		return isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:null;
589
+		return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null;
590 590
 	}
591 591
 
592 592
 	/**
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 	 */
595 595
 	public function getUserHost()
596 596
 	{
597
-		return isset($_SERVER['REMOTE_HOST'])?$_SERVER['REMOTE_HOST']:null;
597
+		return isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : null;
598 598
 	}
599 599
 
600 600
 	/**
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 	public function getAcceptTypes()
604 604
 	{
605 605
 		// TBD: break it into array??
606
-		return isset($_SERVER['HTTP_ACCEPT'])?$_SERVER['HTTP_ACCEPT']:null;
606
+		return isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
607 607
 	}
608 608
 
609 609
 	/**
@@ -668,13 +668,13 @@  discard block
 block discarded – undo
668 668
 				foreach($_COOKIE as $key=>$value)
669 669
 				{
670 670
 					if(($value=$sm->validateData($value))!==false)
671
-						$this->_cookies->add(new THttpCookie($key,$value));
671
+						$this->_cookies->add(new THttpCookie($key, $value));
672 672
 				}
673 673
 			}
674 674
 			else
675 675
 			{
676 676
 				foreach($_COOKIE as $key=>$value)
677
-					$this->_cookies->add(new THttpCookie($key,$value));
677
+					$this->_cookies->add(new THttpCookie($key, $value));
678 678
 			}
679 679
 		}
680 680
 		return $this->_cookies;
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 	 * @return string URL
722 722
 	 * @see TUrlManager::constructUrl
723 723
 	 */
724
-	public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=true,$encodeGetItems=true)
724
+	public function constructUrl($serviceID, $serviceParam, $getItems=null, $encodeAmpersand=true, $encodeGetItems=true)
725 725
 	{
726
-		if ($this->_cookieOnly===null)
727
-				$this->_cookieOnly=(int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies');
728
-		$url=$this->getUrlManagerModule()->constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems);
729
-		if(defined('SID') && SID != '' && !$this->_cookieOnly)
730
-			return $url . (strpos($url,'?')===false? '?' : ($encodeAmpersand?'&amp;':'&')) . SID;
726
+		if($this->_cookieOnly===null)
727
+				$this->_cookieOnly=(int) ini_get('session.use_cookies') && (int) ini_get('session.use_only_cookies');
728
+		$url=$this->getUrlManagerModule()->constructUrl($serviceID, $serviceParam, $getItems, $encodeAmpersand, $encodeGetItems);
729
+		if(defined('SID') && SID!='' && !$this->_cookieOnly)
730
+			return $url.(strpos($url, '?')===false ? '?' : ($encodeAmpersand ? '&amp;' : '&')).SID;
731 731
 		else
732 732
 			return $url;
733 733
 	}
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 	 */
756 756
 	public function resolveRequest($serviceIDs)
757 757
 	{
758
-		Prado::trace("Resolving request from ".$_SERVER['REMOTE_ADDR'],'Prado\Web\THttpRequest');
758
+		Prado::trace("Resolving request from ".$_SERVER['REMOTE_ADDR'], 'Prado\Web\THttpRequest');
759 759
 		$getParams=$this->parseUrl();
760 760
 		foreach($getParams as $name=>$value)
761 761
 			$_GET[$name]=$value;
762
-		$this->_items=array_merge($_GET,$_POST);
762
+		$this->_items=array_merge($_GET, $_POST);
763 763
 		$this->_requestResolved=true;
764 764
 		foreach($serviceIDs as $serviceID)
765 765
 		{
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 	 * @param mixed key
871 871
 	 * @param mixed value
872 872
 	 */
873
-	public function add($key,$value)
873
+	public function add($key, $value)
874 874
 	{
875 875
 		$this->_items[$key]=$value;
876 876
 	}
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 	 */
884 884
 	public function remove($key)
885 885
 	{
886
-		if(isset($this->_items[$key]) || array_key_exists($key,$this->_items))
886
+		if(isset($this->_items[$key]) || array_key_exists($key, $this->_items))
887 887
 		{
888 888
 			$value=$this->_items[$key];
889 889
 			unset($this->_items[$key]);
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 	 */
909 909
 	public function contains($key)
910 910
 	{
911
-		return isset($this->_items[$key]) || array_key_exists($key,$this->_items);
911
+		return isset($this->_items[$key]) || array_key_exists($key, $this->_items);
912 912
 	}
913 913
 
914 914
 	/**
@@ -947,9 +947,9 @@  discard block
 block discarded – undo
947 947
 	 * @param integer the offset to set element
948 948
 	 * @param mixed the element value
949 949
 	 */
950
-	public function offsetSet($offset,$item)
950
+	public function offsetSet($offset, $item)
951 951
 	{
952
-		$this->add($offset,$item);
952
+		$this->add($offset, $item);
953 953
 	}
954 954
 
955 955
 	/**
Please login to merge, or discard this patch.
framework/Web/Services/TSoapServer.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function setID($id)
63 63
 	{
64
-		if(strrpos($this->_id,'.wsdl')===strlen($this->_id)-5)
65
-			throw new TInvalidDataValueException('soapserver_id_invalid',$id);
64
+		if(strrpos($this->_id, '.wsdl')===strlen($this->_id) - 5)
65
+			throw new TInvalidDataValueException('soapserver_id_invalid', $id);
66 66
 		$this->_id=$id;
67 67
 	}
68 68
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		if(($provider=$this->getProvider())!==null)
75 75
 		{
76 76
 			Prado::using($provider);
77
-			$providerClass=($pos=strrpos($provider,'.'))!==false?substr($provider,$pos+1):$provider;
77
+			$providerClass=($pos=strrpos($provider, '.'))!==false ? substr($provider, $pos + 1) : $provider;
78 78
 			$this->guessMethodCallRequested($providerClass);
79 79
 			$server=$this->createServer();
80 80
 			$server->setClass($providerClass, $this);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		{
88 88
 			$server->handle();
89 89
 		}
90
-		catch (\Exception $e)
90
+		catch(\Exception $e)
91 91
 		{
92 92
 			if($this->getApplication()->getMode()===TApplicationMode::Debug)
93 93
 				$this->fault($e->getMessage(), $e->__toString());
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function fault($title, $details='', $code='SERVER', $actor='', $name='')
108 108
 	{
109
-		Prado::trace('SOAP-Fault '.$code. ' '.$title.' : '.$details, 'Prado\Web\Services\TSoapService');
109
+		Prado::trace('SOAP-Fault '.$code.' '.$title.' : '.$details, 'Prado\Web\Services\TSoapService');
110 110
 		$this->_server->fault($code, $title, $actor, $details, $name);
111 111
 	}
112 112
 
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	protected function guessMethodCallRequested($class)
119 119
 	{
120
-		$namespace = $class.'wsdl';
121
-		$message = file_get_contents("php://input");
122
-		$matches= array();
120
+		$namespace=$class.'wsdl';
121
+		$message=file_get_contents("php://input");
122
+		$matches=array();
123 123
 		if(preg_match('/xmlns:([^=]+)="urn:'.$namespace.'"/', $message, $matches))
124 124
 		{
125 125
 			if(preg_match('/<'.$matches[1].':([a-zA-Z_]+[a-zA-Z0-9_]+)/', $message, $method))
126 126
 			{
127
-				$this->_requestedMethod = $method[1];
127
+				$this->_requestedMethod=$method[1];
128 128
 			}
129 129
 		}
130 130
 	}
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 		if($this->_server===null)
148 148
 		{
149 149
 			if($this->getApplication()->getMode()===TApplicationMode::Debug)
150
-				ini_set("soap.wsdl_cache_enabled",0);
151
-			$this->_server = new \SoapServer($this->getWsdlUri(),$this->getOptions());
150
+				ini_set("soap.wsdl_cache_enabled", 0);
151
+			$this->_server=new \SoapServer($this->getWsdlUri(), $this->getOptions());
152 152
 		}
153 153
 		return $this->_server;
154 154
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		if($this->_wsdlUri==='')
190 190
 		{
191 191
 			$provider=$this->getProvider();
192
-			$providerClass=($pos=strrpos($provider,'.'))!==false?substr($provider,$pos+1):$provider;
192
+			$providerClass=($pos=strrpos($provider, '.'))!==false ? substr($provider, $pos + 1) : $provider;
193 193
 			Prado::using($provider);
194 194
 			if($this->getApplication()->getMode()===TApplicationMode::Performance && ($cache=$this->getApplication()->getCache())!==null)
195 195
 			{
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				if(is_string($wsdl))
198 198
 					return $wsdl;
199 199
 				$wsdl=WsdlGenerator::generate($providerClass, $this->getUri(), $this->getEncoding());
200
-				$cache->set(self::WSDL_CACHE_PREFIX.$providerClass,$wsdl);
200
+				$cache->set(self::WSDL_CACHE_PREFIX.$providerClass, $wsdl);
201 201
 				return $wsdl;
202 202
 			}
203 203
 			else
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	public function getWsdlUri()
216 216
 	{
217 217
 		if($this->_wsdlUri==='')
218
-			return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID().'.wsdl',false);
218
+			return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID().'.wsdl', false);
219 219
 		else
220 220
 			return $this->_wsdlUri;
221 221
 	}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	public function getUri()
235 235
 	{
236 236
 		if($this->_uri==='')
237
-			return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID(),false);
237
+			return $this->getRequest()->getBaseUrl().$this->getService()->constructUrl($this->getID(), false);
238 238
 		else
239 239
 			return $this->_uri;
240 240
 	}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		if($value==='1.1' || $value==='1.2' || $value==='')
281 281
 			$this->_version=$value;
282 282
 		else
283
-			throw new TInvalidDataValueException('soapserver_version_invalid',$value);
283
+			throw new TInvalidDataValueException('soapserver_version_invalid', $value);
284 284
 	}
285 285
 
286 286
 	/**
@@ -344,6 +344,6 @@  discard block
 block discarded – undo
344 344
 	 */
345 345
 	public function setClassMaps($classes)
346 346
 	{
347
-		$this->_classMap = $classes;
347
+		$this->_classMap=$classes;
348 348
 	}
349 349
 }
350 350
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/Services/TSoapService.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 				$this->loadConfig($dom);
128 128
 			}
129 129
 			else
130
-				throw new TConfigurationException('soapservice_configfile_invalid',$this->_configFile);
130
+				throw new TConfigurationException('soapservice_configfile_invalid', $this->_configFile);
131 131
 		}
132 132
 		$this->loadConfig($config);
133 133
 
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
 	protected function resolveRequest()
145 145
 	{
146 146
 		$serverID=$this->getRequest()->getServiceParameter();
147
-		if(($pos=strrpos($serverID,'.wsdl'))===strlen($serverID)-5)
147
+		if(($pos=strrpos($serverID, '.wsdl'))===strlen($serverID) - 5)
148 148
 		{
149
-			$serverID=substr($serverID,0,$pos);
149
+			$serverID=substr($serverID, 0, $pos);
150 150
 			$this->_wsdlRequest=true;
151 151
 		}
152 152
 		else
153 153
 			$this->_wsdlRequest=false;
154 154
 		$this->_serverID=$serverID;
155 155
 		if(!isset($this->_servers[$serverID]))
156
-			throw new THttpException(400,'soapservice_request_invalid',$serverID);
156
+			throw new THttpException(400, 'soapservice_request_invalid', $serverID);
157 157
 	}
158 158
 
159 159
 	/**
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 			{
170 170
 				foreach($config['soap'] as $id => $server)
171 171
 				{
172
-					$properties = isset($server['properties'])?$server['properties']:array();
172
+					$properties=isset($server['properties']) ? $server['properties'] : array();
173 173
 					if(isset($this->_servers[$id]))
174
-						throw new TConfigurationException('soapservice_serverid_duplicated',$id);
174
+						throw new TConfigurationException('soapservice_serverid_duplicated', $id);
175 175
 					$this->_servers[$id]=$properties;
176 176
 				}
177 177
 			}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				if(($id=$properties->remove('id'))===null)
185 185
 					throw new TConfigurationException('soapservice_serverid_required');
186 186
 				if(isset($this->_servers[$id]))
187
-					throw new TConfigurationException('soapservice_serverid_duplicated',$id);
187
+					throw new TConfigurationException('soapservice_serverid_duplicated', $id);
188 188
 				$this->_servers[$id]=$properties;
189 189
 			}
190 190
 		}
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function setConfigFile($value)
207 207
 	{
208
-		if(($this->_configFile=Prado::getPathOfNamespace($value,Prado::getApplication()->getConfigurationFileExt()))===null)
209
-			throw new TConfigurationException('soapservice_configfile_invalid',$value);
208
+		if(($this->_configFile=Prado::getPathOfNamespace($value, Prado::getApplication()->getConfigurationFileExt()))===null)
209
+			throw new TConfigurationException('soapservice_configfile_invalid', $value);
210 210
 	}
211 211
 
212 212
 	/**
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 	 * @param boolean whether to encode the GET parameters (their names and values), defaults to true.
218 218
 	 * @return string URL for the page and GET parameters
219 219
 	 */
220
-	public function constructUrl($serverID,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true)
220
+	public function constructUrl($serverID, $getParams=null, $encodeAmpersand=true, $encodeGetItems=true)
221 221
 	{
222
-		return $this->getRequest()->constructUrl($this->getID(),$serverID,$getParams,$encodeAmpersand,$encodeGetItems);
222
+		return $this->getRequest()->constructUrl($this->getID(), $serverID, $getParams, $encodeAmpersand, $encodeGetItems);
223 223
 	}
224 224
 
225 225
 	/**
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 		if($serverClass===null)
256 256
 			$serverClass=self::DEFAULT_SOAP_SERVER;
257 257
 		Prado::using($serverClass);
258
-		$className=($pos=strrpos($serverClass,'.'))!==false?substr($serverClass,$pos+1):$serverClass;
259
-		if($className!==self::DEFAULT_SOAP_SERVER && !is_subclass_of($className,self::DEFAULT_SOAP_SERVER))
260
-			throw new TConfigurationException('soapservice_server_invalid',$serverClass);
258
+		$className=($pos=strrpos($serverClass, '.'))!==false ? substr($serverClass, $pos + 1) : $serverClass;
259
+		if($className!==self::DEFAULT_SOAP_SERVER && !is_subclass_of($className, self::DEFAULT_SOAP_SERVER))
260
+			throw new TConfigurationException('soapservice_server_invalid', $serverClass);
261 261
 		$server=new $className;
262 262
 		$server->setID($this->_serverID);
263 263
 		foreach($properties as $name=>$value)
264
-			$server->setSubproperty($name,$value);
264
+			$server->setSubproperty($name, $value);
265 265
 		return $server;
266 266
 	}
267 267
 
@@ -273,21 +273,21 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	public function run()
275 275
 	{
276
-		Prado::trace("Running SOAP service",'Prado\Web\Services\TSoapService');
276
+		Prado::trace("Running SOAP service", 'Prado\Web\Services\TSoapService');
277 277
 		$server=$this->createServer();
278 278
 		$this->getResponse()->setContentType('text/xml');
279 279
 		$this->getResponse()->setCharset($server->getEncoding());
280 280
 		if($this->getIsWsdlRequest())
281 281
 		{
282 282
 			// server WSDL file
283
-			Prado::trace("Generating WSDL",'Prado\Web\Services\TSoapService');
283
+			Prado::trace("Generating WSDL", 'Prado\Web\Services\TSoapService');
284 284
 			$this->getResponse()->clear();
285 285
 			$this->getResponse()->write($server->getWsdl());
286 286
 		}
287 287
 		else
288 288
 		{
289 289
 			// provide SOAP service
290
-			Prado::trace("Handling SOAP request",'Prado\Web\Services\TSoapService');
290
+			Prado::trace("Handling SOAP request", 'Prado\Web\Services\TSoapService');
291 291
 			$server->run();
292 292
 		}
293 293
 	}
Please login to merge, or discard this patch.
framework/Web/Services/TPageService.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	/**
105 105
 	 * Prefix of Pages used for instantiating new pages
106 106
 	 */
107
-	const PAGE_NAMESPACE_PREFIX = 'Application\\Pages\\';
107
+	const PAGE_NAMESPACE_PREFIX='Application\\Pages\\';
108 108
 	/**
109 109
 	 * @var string root path of pages
110 110
 	 */
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function init($config)
156 156
 	{
157
-		Prado::trace("Initializing TPageService",'\Prado\Web\Services\TPageService');
157
+		Prado::trace("Initializing TPageService", '\Prado\Web\Services\TPageService');
158 158
 
159 159
 		$pageConfig=$this->loadPageConfig($config);
160 160
 
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
 		// external configurations
193 193
 		foreach($config->getExternalConfigurations() as $filePath=>$params)
194 194
 		{
195
-			list($configPagePath,$condition)=$params;
195
+			list($configPagePath, $condition)=$params;
196 196
 			if($condition!==true)
197 197
 				$condition=$this->evaluateExpression($condition);
198 198
 			if($condition)
199 199
 			{
200
-				if(($path=Prado::getPathOfNamespace($filePath,Prado::getApplication()->getConfigurationFileExt()))===null || !is_file($path))
201
-					throw new TConfigurationException('pageservice_includefile_invalid',$filePath);
200
+				if(($path=Prado::getPathOfNamespace($filePath, Prado::getApplication()->getConfigurationFileExt()))===null || !is_file($path))
201
+					throw new TConfigurationException('pageservice_includefile_invalid', $filePath);
202 202
 				$c=new TPageConfiguration($pagePath);
203
-				$c->loadFromFile($path,$configPagePath);
203
+				$c->loadFromFile($path, $configPagePath);
204 204
 				$this->applyConfiguration($c);
205 205
 			}
206 206
 		}
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 			if($config!==null)
235 235
 			{
236 236
 				if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
237
-					$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
237
+					$pageConfig->loadPageConfigurationFromPhp($config, $application->getBasePath(), '');
238 238
 				else
239
-					$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
239
+					$pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), '');
240 240
 			}
241 241
 			$pageConfig->loadFromFiles($this->getBasePath());
242 242
 		}
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 			$arr=$cache->get(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath);
248 248
 			if(is_array($arr))
249 249
 			{
250
-				list($pageConfig,$timestamps)=$arr;
250
+				list($pageConfig, $timestamps)=$arr;
251 251
 				if($application->getMode()!==TApplicationMode::Performance)
252 252
 				{
253 253
 					foreach($timestamps as $fileName=>$timestamp)
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 						if($fileName===0) // application config file
256 256
 						{
257 257
 							$appConfigFile=$application->getConfigurationFile();
258
-							$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
259
-							if($currentTimestamp[0]>$timestamp || ($timestamp>0 && !$currentTimestamp[0]))
258
+							$currentTimestamp[0]=$appConfigFile===null ? 0 : @filemtime($appConfigFile);
259
+							if($currentTimestamp[0] > $timestamp || ($timestamp > 0 && !$currentTimestamp[0]))
260 260
 								$configCached=false;
261 261
 						}
262 262
 						else
263 263
 						{
264 264
 							$currentTimestamp[$fileName]=@filemtime($fileName);
265
-							if($currentTimestamp[$fileName]>$timestamp || ($timestamp>0 && !$currentTimestamp[$fileName]))
265
+							if($currentTimestamp[$fileName] > $timestamp || ($timestamp > 0 && !$currentTimestamp[$fileName]))
266 266
 								$configCached=false;
267 267
 						}
268 268
 					}
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
 			else
272 272
 			{
273 273
 				$configCached=false;
274
-				$paths=explode('.',$pagePath);
274
+				$paths=explode('.', $pagePath);
275 275
 				$configPath=$this->getBasePath();
276
-				$fileName = $this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
276
+				$fileName=$this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP
277 277
 					? self::CONFIG_FILE_PHP
278 278
 					: self::CONFIG_FILE_XML;
279 279
 				foreach($paths as $path)
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 					$configPath.=DIRECTORY_SEPARATOR.$path;
284 284
 				}
285 285
 				$appConfigFile=$application->getConfigurationFile();
286
-				$currentTimestamp[0]=$appConfigFile===null?0:@filemtime($appConfigFile);
286
+				$currentTimestamp[0]=$appConfigFile===null ? 0 : @filemtime($appConfigFile);
287 287
 			}
288 288
 			if(!$configCached)
289 289
 			{
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
 				if($config!==null)
292 292
 				{
293 293
 					if($application->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
294
-						$pageConfig->loadPageConfigurationFromPhp($config,$application->getBasePath(),'');
294
+						$pageConfig->loadPageConfigurationFromPhp($config, $application->getBasePath(), '');
295 295
 					else
296
-						$pageConfig->loadPageConfigurationFromXml($config,$application->getBasePath(),'');
296
+						$pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), '');
297 297
 				}
298 298
 				$pageConfig->loadFromFiles($this->getBasePath());
299
-				$cache->set(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath,array($pageConfig,$currentTimestamp));
299
+				$cache->set(self::CONFIG_CACHE_PREFIX.$this->getID().$pagePath, array($pageConfig, $currentTimestamp));
300 300
 			}
301 301
 		}
302 302
 		return $pageConfig;
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
 	{
352 352
 		if($this->_pagePath===null)
353 353
 		{
354
-			$this->_pagePath=strtr($this->determineRequestedPagePath(),'/\\','..');
354
+			$this->_pagePath=strtr($this->determineRequestedPagePath(), '/\\', '..');
355 355
 			if(empty($this->_pagePath))
356
-				throw new THttpException(404,'pageservice_page_required');
356
+				throw new THttpException(404, 'pageservice_page_required');
357 357
 		}
358 358
 		return $this->_pagePath;
359 359
 	}
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 			{
407 407
 				$basePath=$this->getApplication()->getBasePath().DIRECTORY_SEPARATOR.self::FALLBACK_BASEPATH;
408 408
 				if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath))
409
-					throw new TConfigurationException('pageservice_basepath_invalid',$basePath);
409
+					throw new TConfigurationException('pageservice_basepath_invalid', $basePath);
410 410
 			}
411 411
 		}
412 412
 		return $this->_basePath;
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		if($this->_initialized)
422 422
 			throw new TInvalidOperationException('pageservice_basepath_unchangeable');
423 423
 		else if(($path=Prado::getPathOfNamespace($value))===null || !is_dir($path))
424
-			throw new TConfigurationException('pageservice_basepath_invalid',$value);
424
+			throw new TConfigurationException('pageservice_basepath_invalid', $value);
425 425
 		$this->_basePath=realpath($path);
426 426
 	}
427 427
 
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
 	 */
471 471
 	public function run()
472 472
 	{
473
-		Prado::trace("Running page service",'Prado\Web\Services\TPageService');
473
+		Prado::trace("Running page service", 'Prado\Web\Services\TPageService');
474 474
 		$this->_page=$this->createPage($this->getRequestedPagePath());
475
-		$this->runPage($this->_page,$this->_properties);
475
+		$this->runPage($this->_page, $this->_properties);
476 476
 	}
477 477
 
478 478
 	/**
@@ -484,34 +484,34 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	protected function createPage($pagePath)
486 486
 	{
487
-		$path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath,'.',DIRECTORY_SEPARATOR);
487
+		$path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath, '.', DIRECTORY_SEPARATOR);
488 488
 		$hasTemplateFile=is_file($path.self::PAGE_FILE_EXT);
489 489
 		$hasClassFile=is_file($path.Prado::CLASS_FILE_EXT);
490 490
 
491 491
 		if(!$hasTemplateFile && !$hasClassFile)
492
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
492
+			throw new THttpException(404, 'pageservice_page_unknown', $pagePath);
493 493
 
494 494
 		if($hasClassFile)
495 495
 		{
496 496
 			$className=basename($path);
497
-			$namespacedClassName = static::PAGE_NAMESPACE_PREFIX .str_replace('.', '\\', $pagePath);
497
+			$namespacedClassName=static::PAGE_NAMESPACE_PREFIX.str_replace('.', '\\', $pagePath);
498 498
 
499
-            if(!class_exists($className,false) && !class_exists($namespacedClassName, false))
499
+            if(!class_exists($className, false) && !class_exists($namespacedClassName, false))
500 500
                 include_once($path.Prado::CLASS_FILE_EXT);
501 501
 
502
-			if(!class_exists($className,false))
503
-				$className = $namespacedClassName;
502
+			if(!class_exists($className, false))
503
+				$className=$namespacedClassName;
504 504
 		}
505 505
 		else
506 506
 		{
507 507
 			$className=$this->getBasePageClass();
508 508
 			Prado::using($className);
509
-			if(($pos=strrpos($className,'.'))!==false)
510
-				$className=substr($className,$pos+1);
509
+			if(($pos=strrpos($className, '.'))!==false)
510
+				$className=substr($className, $pos + 1);
511 511
 		}
512 512
 
513
- 		if(!class_exists($className,false) || ($className!=='TPage' && !is_subclass_of($className,'TPage')))
514
-			throw new THttpException(404,'pageservice_page_unknown',$pagePath);
513
+ 		if(!class_exists($className, false) || ($className!=='TPage' && !is_subclass_of($className, 'TPage')))
514
+			throw new THttpException(404, 'pageservice_page_unknown', $pagePath);
515 515
 
516 516
 		$page=Prado::createComponent($className);
517 517
 		$page->setPagePath($pagePath);
@@ -527,10 +527,10 @@  discard block
 block discarded – undo
527 527
 	 * @param TPage the page instance to be run
528 528
 	 * @param array list of initial page properties
529 529
 	 */
530
-	protected function runPage($page,$properties)
530
+	protected function runPage($page, $properties)
531 531
 	{
532 532
 		foreach($properties as $name=>$value)
533
-			$page->setSubProperty($name,$value);
533
+			$page->setSubProperty($name, $value);
534 534
 		$page->run($this->getResponse()->createHtmlWriter());
535 535
 	}
536 536
 
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 	 * @param boolean whether to encode the GET parameters (their names and values), defaults to true.
543 543
 	 * @return string URL for the page and GET parameters
544 544
 	 */
545
-	public function constructUrl($pagePath,$getParams=null,$encodeAmpersand=true,$encodeGetItems=true)
545
+	public function constructUrl($pagePath, $getParams=null, $encodeAmpersand=true, $encodeGetItems=true)
546 546
 	{
547
-		return $this->getRequest()->constructUrl($this->getID(),$pagePath,$getParams,$encodeAmpersand,$encodeGetItems);
547
+		return $this->getRequest()->constructUrl($this->getID(), $pagePath, $getParams, $encodeAmpersand, $encodeGetItems);
548 548
 	}
549 549
 }
550 550
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/THttpResponse.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  */
66 66
 class THttpResponse extends \Prado\TModule implements \Prado\IO\ITextWriter
67 67
 {
68
-	const DEFAULT_CONTENTTYPE	= 'text/html';
69
-	const DEFAULT_CHARSET		= 'UTF-8';
68
+	const DEFAULT_CONTENTTYPE='text/html';
69
+	const DEFAULT_CHARSET='UTF-8';
70 70
 
71 71
 	/**
72 72
 	 * @var The differents defined status code by RFC 2616 {@link http://www.faqs.org/rfcs/rfc2616}
73 73
 	 */
74
-	private static $HTTP_STATUS_CODES = array(
74
+	private static $HTTP_STATUS_CODES=array(
75 75
 		100 => 'Continue', 101 => 'Switching Protocols',
76 76
 		200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content',
77 77
 		300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect',
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function setCacheControl($value)
204 204
 	{
205
-		session_cache_limiter(TPropertyValue::ensureEnum($value,array('none','nocache','private','private_no_expire','public')));
205
+		session_cache_limiter(TPropertyValue::ensureEnum($value, array('none', 'nocache', 'private', 'private_no_expire', 'public')));
206 206
 	}
207 207
 
208 208
 	/**
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function setContentType($type)
212 212
 	{
213
-		if ($this->_contentTypeHeaderSent)
213
+		if($this->_contentTypeHeaderSent)
214 214
 			throw new \Exception('Unable to alter content-type as it has been already sent');
215
-		$this->_contentType = $type;
215
+		$this->_contentType=$type;
216 216
 	}
217 217
 
218 218
 	/**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	public function setCharset($charset)
238 238
 	{
239
-		$this->_charset = (strToLower($charset) === 'false') ? false : (string)$charset;
239
+		$this->_charset=(strToLower($charset)==='false') ? false : (string) $charset;
240 240
 	}
241 241
 
242 242
 	/**
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public function setStatusCode($status, $reason=null)
279 279
 	{
280
-		if ($this->_httpHeaderSent)
280
+		if($this->_httpHeaderSent)
281 281
 			throw new \Exception('Unable to alter response as HTTP header already sent');
282 282
 		$status=TPropertyValue::ensureInteger($status);
283 283
 		if(isset(self::$HTTP_STATUS_CODES[$status])) {
284 284
 			$this->_reason=self::$HTTP_STATUS_CODES[$status];
285
-		}else{
285
+		} else {
286 286
 			if($reason===null || $reason==='') {
287 287
 				throw new TInvalidDataValueException("response_status_reason_missing");
288 288
 			}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	public function write($str)
321 321
 	{
322 322
 		// when starting output make sure we send the headers first
323
-		if (!$this->_bufferOutput and !$this->_httpHeaderSent)
323
+		if(!$this->_bufferOutput and !$this->_httpHeaderSent)
324 324
 			$this->ensureHeadersSent();
325 325
 		echo $str;
326 326
 	}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 * @param integer size of file or content in bytes if already known. Defaults to 'null' means auto-detect.
338 338
 	 * @throws TInvalidDataValueException if the file cannot be found
339 339
 	 */
340
-	public function writeFile($fileName,$content=null,$mimeType=null,$headers=null,$forceDownload=true,$clientFileName=null,$fileSize=null)
340
+	public function writeFile($fileName, $content=null, $mimeType=null, $headers=null, $forceDownload=true, $clientFileName=null, $fileSize=null)
341 341
 	{
342 342
 		static $defaultMimeTypes=array(
343 343
 			'css'=>'text/css',
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 			$mimeType='text/plain';
358 358
 			if(function_exists('mime_content_type'))
359 359
 				$mimeType=mime_content_type($fileName);
360
-			else if(($ext=strrchr($fileName,'.'))!==false)
360
+			else if(($ext=strrchr($fileName, '.'))!==false)
361 361
 			{
362
-				$ext=substr($ext,1);
362
+				$ext=substr($ext, 1);
363 363
 				if(isset($defaultMimeTypes[$ext]))
364 364
 					$mimeType=$defaultMimeTypes[$ext];
365 365
 			}
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			$clientFileName=basename($clientFileName);
372 372
 
373 373
 		if($fileSize===null || $fileSize < 0)
374
-			$fileSize = ($content===null?filesize($fileName):strlen($content));
374
+			$fileSize=($content===null ? filesize($fileName) : strlen($content));
375 375
 
376 376
 		$this->sendHttpHeader();
377 377
 		if(is_array($headers))
@@ -385,11 +385,11 @@  discard block
 block discarded – undo
385 385
 			header('Expires: 0');
386 386
 			header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
387 387
 			header("Content-Type: $mimeType");
388
-			$this->_contentTypeHeaderSent = true;
388
+			$this->_contentTypeHeaderSent=true;
389 389
 		}
390 390
 
391 391
 		header('Content-Length: '.$fileSize);
392
-		header("Content-Disposition: " . ($forceDownload ? 'attachment' : 'inline') . "; filename=\"$clientFileName\"");
392
+		header("Content-Disposition: ".($forceDownload ? 'attachment' : 'inline')."; filename=\"$clientFileName\"");
393 393
 		header('Content-Transfer-Encoding: binary');
394 394
 		if($content===null)
395 395
 			readfile($fileName);
@@ -429,11 +429,11 @@  discard block
 block discarded – undo
429 429
 
430 430
 		if($url[0]==='/')
431 431
 			$url=$this->getRequest()->getBaseUrl().$url;
432
-		if ($this->_status >= 300 && $this->_status < 400)
432
+		if($this->_status >= 300 && $this->_status < 400)
433 433
 			// The status code has been modified to a valid redirection status, send it
434
-			header('Location: '.str_replace('&amp;','&',$url), true, $this->_status);
434
+			header('Location: '.str_replace('&amp;', '&', $url), true, $this->_status);
435 435
 		else
436
-			header('Location: '.str_replace('&amp;','&',$url));
436
+			header('Location: '.str_replace('&amp;', '&', $url));
437 437
 
438 438
 		if(!$this->getApplication()->getRequestCompleted())
439 439
 			$this->getApplication()->onEndRequest();
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	/**
455 455
 	 * Flush the response contents and headers.
456 456
 	 */
457
-	public function flush($continueBuffering = true)
457
+	public function flush($continueBuffering=true)
458 458
 	{
459 459
 		if($this->getHasAdapter())
460 460
 			$this->_adapter->flushContent($continueBuffering);
@@ -476,18 +476,18 @@  discard block
 block discarded – undo
476 476
 	 * This method is used internally. Please use {@link flush} instead.
477 477
 	 * @param boolean whether to continue buffering after flush if buffering was active
478 478
 	 */
479
-	public function flushContent($continueBuffering = true)
479
+	public function flushContent($continueBuffering=true)
480 480
 	{
481
-		Prado::trace("Flushing output",'Prado\Web\THttpResponse');
481
+		Prado::trace("Flushing output", 'Prado\Web\THttpResponse');
482 482
 		$this->ensureHeadersSent();
483 483
 		if($this->_bufferOutput)
484 484
 		{
485 485
 			// avoid forced send of http headers (ob_flush() does that) if there's no output yet
486
-			if (ob_get_length()>0)
486
+			if(ob_get_length() > 0)
487 487
 			{
488
-				if (!$continueBuffering)
488
+				if(!$continueBuffering)
489 489
 				{
490
-					$this->_bufferOutput = false;
490
+					$this->_bufferOutput=false;
491 491
 					ob_end_flush();
492 492
 				}
493 493
 				else
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 */
505 505
 	protected function ensureHttpHeaderSent()
506 506
 	{
507
-		if (!$this->_httpHeaderSent)
507
+		if(!$this->_httpHeaderSent)
508 508
 			$this->sendHttpHeader();
509 509
 	}
510 510
 
@@ -514,15 +514,15 @@  discard block
 block discarded – undo
514 514
 	protected function sendHttpHeader()
515 515
 	{
516 516
 		$protocol=$this->getRequest()->getHttpProtocolVersion();
517
-		if($this->getRequest()->getHttpProtocolVersion() === null)
517
+		if($this->getRequest()->getHttpProtocolVersion()===null)
518 518
 			$protocol='HTTP/1.1';
519 519
 
520
-		$phpSapiName = substr(php_sapi_name(), 0, 3);
521
-		$cgi = $phpSapiName == 'cgi' || $phpSapiName == 'fpm';
520
+		$phpSapiName=substr(php_sapi_name(), 0, 3);
521
+		$cgi=$phpSapiName=='cgi' || $phpSapiName=='fpm';
522 522
 
523 523
 		header(($cgi ? 'Status:' : $protocol).' '.$this->_status.' '.$this->_reason, true, TPropertyValue::ensureInteger($this->_status));
524 524
 
525
-		$this->_httpHeaderSent = true;
525
+		$this->_httpHeaderSent=true;
526 526
 	}
527 527
 
528 528
 	/**
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	protected function ensureContentTypeHeaderSent()
532 532
 	{
533
-		if (!$this->_contentTypeHeaderSent)
533
+		if(!$this->_contentTypeHeaderSent)
534 534
 			$this->sendContentTypeHeader();
535 535
 	}
536 536
 
@@ -539,9 +539,9 @@  discard block
 block discarded – undo
539 539
 	 */
540 540
 	protected function sendContentTypeHeader()
541 541
 	{
542
-		$contentType=$this->_contentType===null?self::DEFAULT_CONTENTTYPE:$this->_contentType;
542
+		$contentType=$this->_contentType===null ? self::DEFAULT_CONTENTTYPE : $this->_contentType;
543 543
 		$charset=$this->getCharset();
544
-		if($charset === false) {
544
+		if($charset===false) {
545 545
 			$this->appendHeader('Content-Type: '.$contentType);
546 546
 			return;
547 547
 		}
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
 		if($charset==='' && ($globalization=$this->getApplication()->getGlobalization(false))!==null)
550 550
 			$charset=$globalization->getCharset();
551 551
 
552
-		if($charset==='') $charset = self::DEFAULT_CHARSET;
552
+		if($charset==='') $charset=self::DEFAULT_CHARSET;
553 553
 		$this->appendHeader('Content-Type: '.$contentType.';charset='.$charset);
554 554
 
555
-		$this->_contentTypeHeaderSent = true;
555
+		$this->_contentTypeHeaderSent=true;
556 556
 	}
557 557
 
558 558
 	/**
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
 	 */
564 564
 	public function getContents()
565 565
 	{
566
-		Prado::trace("Retrieving output",'Prado\Web\THttpResponse');
567
-		return $this->_bufferOutput?ob_get_contents():'';
566
+		Prado::trace("Retrieving output", 'Prado\Web\THttpResponse');
567
+		return $this->_bufferOutput ? ob_get_contents() : '';
568 568
 	}
569 569
 
570 570
 	/**
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	{
575 575
 		if($this->_bufferOutput)
576 576
 			ob_clean();
577
-		Prado::trace("Clearing output",'Prado\Web\THttpResponse');
577
+		Prado::trace("Clearing output", 'Prado\Web\THttpResponse');
578 578
 	}
579 579
 
580 580
 	/**
@@ -583,19 +583,19 @@  discard block
 block discarded – undo
583 583
 	 */
584 584
 	public function getHeaders($case=null)
585 585
 	{
586
-		$result = array();
587
-		$headers = headers_list();
586
+		$result=array();
587
+		$headers=headers_list();
588 588
 		foreach($headers as $header) {
589
-			$tmp = explode(':', $header);
590
-			$key = trim(array_shift($tmp));
591
-			$value = trim(implode(':', $tmp));
589
+			$tmp=explode(':', $header);
590
+			$key=trim(array_shift($tmp));
591
+			$value=trim(implode(':', $tmp));
592 592
 			if(isset($result[$key]))
593
-				$result[$key] .= ', ' . $value;
593
+				$result[$key].=', '.$value;
594 594
 			else
595
-				$result[$key] = $value;
595
+				$result[$key]=$value;
596 596
 		}
597 597
 
598
-		if($case !== null)
598
+		if($case!==null)
599 599
 			return array_change_key_case($result, $case);
600 600
 
601 601
 		return $result;
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	public function appendHeader($value, $replace=true)
610 610
 	{
611
-		Prado::trace("Sending header '$value'",'Prado\Web\THttpResponse');
611
+		Prado::trace("Sending header '$value'", 'Prado\Web\THttpResponse');
612 612
 		header($value, $replace);
613 613
 	}
614 614
 
@@ -621,9 +621,9 @@  discard block
 block discarded – undo
621 621
 	 * @param string The extra headers. It's used when the message parameter is set to 1. This message type uses the same internal function as mail() does.
622 622
 	 * @see http://us2.php.net/manual/en/function.error-log.php
623 623
 	 */
624
-	public function appendLog($message,$messageType=0,$destination='',$extraHeaders='')
624
+	public function appendLog($message, $messageType=0, $destination='', $extraHeaders='')
625 625
 	{
626
-		error_log($message,$messageType,$destination,$extraHeaders);
626
+		error_log($message, $messageType, $destination, $extraHeaders);
627 627
 	}
628 628
 
629 629
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/TTemplateControl.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	protected function loadTemplate()
119 119
 	{
120
-		Prado::trace("Loading template ".get_class($this),'\Prado\Web\UI\TTemplateControl');
120
+		Prado::trace("Loading template ".get_class($this), '\Prado\Web\UI\TTemplateControl');
121 121
 		$template=$this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this));
122 122
 		return $template;
123 123
 	}
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 			foreach($tpl->getDirective() as $name=>$value)
135 135
 			{
136 136
 				if(is_string($value))
137
-					$this->setSubProperty($name,$value);
137
+					$this->setSubProperty($name, $value);
138 138
 				else
139
-					throw new TConfigurationException('templatecontrol_directive_invalid',get_class($this),$name);
139
+					throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name);
140 140
 			}
141 141
 			$tpl->instantiateIn($this);
142 142
 		}
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	 * @param string ID of the content
148 148
 	 * @param TContent
149 149
 	 */
150
-	public function registerContent($id,TContent $object)
150
+	public function registerContent($id, TContent $object)
151 151
 	{
152 152
 		if(isset($this->_contents[$id]))
153
-			throw new TConfigurationException('templatecontrol_contentid_duplicated',$id);
153
+			throw new TConfigurationException('templatecontrol_contentid_duplicated', $id);
154 154
 		else
155 155
 			$this->_contents[$id]=$object;
156 156
 	}
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 	 * @param string placeholder ID
162 162
 	 * @param TContentPlaceHolder placeholder control
163 163
 	 */
164
-	public function registerContentPlaceHolder($id,TContentPlaceHolder $object)
164
+	public function registerContentPlaceHolder($id, TContentPlaceHolder $object)
165 165
 	{
166 166
 		if(isset($this->_placeholders[$id]))
167
-			throw new TConfigurationException('templatecontrol_placeholderid_duplicated',$id);
167
+			throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id);
168 168
 		else
169 169
 			$this->_placeholders[$id]=$object;
170 170
 	}
@@ -199,17 +199,17 @@  discard block
 block discarded – undo
199 199
 	 * @param string ID of the content control
200 200
 	 * @param TContent the content to be injected
201 201
 	 */
202
-	public function injectContent($id,$content)
202
+	public function injectContent($id, $content)
203 203
 	{
204 204
 		if(isset($this->_placeholders[$id]))
205 205
 		{
206 206
 			$placeholder=$this->_placeholders[$id];
207 207
 			$controls=$placeholder->getParent()->getControls();
208 208
 			$loc=$controls->remove($placeholder);
209
-			$controls->insertAt($loc,$content);
209
+			$controls->insertAt($loc, $content);
210 210
 		}
211 211
 		else
212
-			throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id);
212
+			throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id);
213 213
 	}
214 214
 
215 215
 	/**
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 			$this->getControls()->add($master);
234 234
 			$master->ensureChildControls();
235 235
 			foreach($this->_contents as $id=>$content)
236
-				$master->injectContent($id,$content);
236
+				$master->injectContent($id, $content);
237 237
 		}
238 238
 		else if(!empty($this->_contents))
239
-			throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this));
239
+			throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this));
240 240
 		parent::initRecursive($namingContainer);
241 241
 	}
242 242
         
@@ -247,38 +247,38 @@  discard block
 block discarded – undo
247 247
          * @param Boolean $throwExceptions Wheter or not to throw exceptions
248 248
          * @author Daniel Sampedro <[email protected]>
249 249
          */
250
-        public function tryToUpdateView($arObj, $throwExceptions = false)
250
+        public function tryToUpdateView($arObj, $throwExceptions=false)
251 251
         {
252
-                $objAttrs = get_class_vars(get_class($arObj));
253
-                foreach (array_keys($objAttrs) as $key)
252
+                $objAttrs=get_class_vars(get_class($arObj));
253
+                foreach(array_keys($objAttrs) as $key)
254 254
                 {
255 255
                         try
256 256
                         {
257
-                                if ($key != "RELATIONS")
257
+                                if($key!="RELATIONS")
258 258
                                 {
259
-                                        $control = $this->{$key};
260
-                                        if ($control instanceof TTextBox)
261
-                                                $control->Text = $arObj->{$key};
262
-                                        elseif ($control instanceof TCheckBox)
263
-                                                $control->Checked = (boolean) $arObj->{$key};
264
-                                        elseif ($control instanceof TDatePicker)
265
-                                                $control->Date = $arObj->{$key};
259
+                                        $control=$this->{$key};
260
+                                        if($control instanceof TTextBox)
261
+                                                $control->Text=$arObj->{$key};
262
+                                        elseif($control instanceof TCheckBox)
263
+                                                $control->Checked=(boolean) $arObj->{$key};
264
+                                        elseif($control instanceof TDatePicker)
265
+                                                $control->Date=$arObj->{$key};
266 266
                                 }
267 267
                                 else
268 268
                                 {
269
-                                        foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
269
+                                        foreach($objAttrs["RELATIONS"] as $relKey => $relValues)
270 270
                                         {
271
-                                                $relControl = $this->{$relKey};
272
-                                                switch ($relValues[0])
271
+                                                $relControl=$this->{$relKey};
272
+                                                switch($relValues[0])
273 273
                                                 {
274 274
                                                         case TActiveRecord::BELONGS_TO:
275 275
                                                         case TActiveRecord::HAS_ONE:
276
-                                                                $relControl->Text = $arObj->{$relKey};
276
+                                                                $relControl->Text=$arObj->{$relKey};
277 277
                                                                 break;
278 278
                                                         case TActiveRecord::HAS_MANY:
279
-                                                                if ($relControl instanceof TListControl)
279
+                                                                if($relControl instanceof TListControl)
280 280
                                                                 {
281
-                                                                        $relControl->DataSource = $arObj->{$relKey};
281
+                                                                        $relControl->DataSource=$arObj->{$relKey};
282 282
                                                                         $relControl->dataBind();
283 283
                                                                 }
284 284
                                                                 break;
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
                                         break;
288 288
                                 }
289 289
                         } 
290
-                        catch (Exception $ex)
290
+                        catch(Exception $ex)
291 291
                         {
292
-                                if ($throwExceptions)
292
+                                if($throwExceptions)
293 293
                                         throw $ex;
294 294
                         }
295 295
                 }
@@ -301,26 +301,26 @@  discard block
 block discarded – undo
301 301
          * @param Boolean $throwExceptions Wheter or not to throw exceptions
302 302
          * @author Daniel Sampedro <[email protected]>
303 303
          */
304
-        public function tryToUpdateAR($arObj, $throwExceptions = false)
304
+        public function tryToUpdateAR($arObj, $throwExceptions=false)
305 305
         {
306
-                $objAttrs = get_class_vars(get_class($arObj));
307
-                foreach (array_keys($objAttrs) as $key)
306
+                $objAttrs=get_class_vars(get_class($arObj));
307
+                foreach(array_keys($objAttrs) as $key)
308 308
                 {
309 309
                         try
310 310
                         {
311
-                                if ($key == "RELATIONS")
311
+                                if($key=="RELATIONS")
312 312
                                         break;
313
-                                $control = $this->{$key};
314
-                                if ($control instanceof TTextBox)
315
-                                        $arObj->{$key} = $control->Text;
316
-                                elseif ($control instanceof TCheckBox)
317
-                                        $arObj->{$key} = $control->Checked;
318
-                                elseif ($control instanceof TDatePicker)
319
-                                        $arObj->{$key} = $control->Date;
313
+                                $control=$this->{$key};
314
+                                if($control instanceof TTextBox)
315
+                                        $arObj->{$key}=$control->Text;
316
+                                elseif($control instanceof TCheckBox)
317
+                                        $arObj->{$key}=$control->Checked;
318
+                                elseif($control instanceof TDatePicker)
319
+                                        $arObj->{$key}=$control->Date;
320 320
                         } 
321
-                        catch (Exception $ex)
321
+                        catch(Exception $ex)
322 322
                         {
323
-                                if ($throwExceptions)
323
+                                if($throwExceptions)
324 324
                                         throw $ex;
325 325
                         }
326 326
                 }
Please login to merge, or discard this patch.
framework/Web/UI/JuiControls/TJuiDialog.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function getOptions()
74 74
 	{
75
-		if (($options=$this->getViewState('JuiOptions'))===null)
75
+		if(($options=$this->getViewState('JuiOptions'))===null)
76 76
 		{
77 77
 		  $options=new TJuiControlOptions($this);
78 78
 		  $this->setViewState('JuiOptions', $options);
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function getPostBackOptions()
105 105
 	{
106
-		$options = $this->getOptions()->toArray();
106
+		$options=$this->getOptions()->toArray();
107 107
 		// always make the dialog a child of the form, or its inner inputs won't be collected
108 108
 		if(!isset($options['appendTo']))
109
-			$options['appendTo'] = 'form:first';
109
+			$options['appendTo']='form:first';
110 110
 
111 111
 		foreach($this->getControls() as $control)
112 112
 			if($control instanceof TJuiDialogButton)
113
-				$options['buttons'][] = $control->getPostBackOptions();
113
+				$options['buttons'][]=$control->getPostBackOptions();
114 114
 
115 115
 		return $options;
116 116
 	}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	{
124 124
 		parent::addAttributesToRender($writer);
125 125
 
126
-		$writer->addAttribute('id',$this->getClientID());
126
+		$writer->addAttribute('id', $this->getClientID());
127 127
 		$options=TJavascript::encode($this->getPostBackOptions());
128 128
 		$cs=$this->getPage()->getClientScript();
129 129
 		$code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");";
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * Raises the OnCreate event
145 145
 	 * @param object $params event parameters
146 146
 	 */
147
-	public function onOpen ($params)
147
+	public function onOpen($params)
148 148
 	{
149 149
 		$this->raiseEvent('OnOpen', $this, $params);
150 150
 	}
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 
168 168
 	private function triggerClientMethod($method)
169 169
 	{
170
-		$cs = $this->getPage()->getClientScript();
171
-		$code = "jQuery(document).ready(function() { jQuery('#".$this->getClientId()."').dialog('".$method."'); })";
170
+		$cs=$this->getPage()->getClientScript();
171
+		$code="jQuery(document).ready(function() { jQuery('#".$this->getClientId()."').dialog('".$method."'); })";
172 172
 		$cs->registerEndScript(sprintf('%08X', crc32($code)), $code);
173 173
 	}
174 174
 
Please login to merge, or discard this patch.
framework/Web/UI/JuiControls/TJuiDialogButton.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		return array(
67 67
 			'text' => $this->getText(),
68 68
 			'click' => new TJavaScriptLiteral("function(){new Prado.Callback('".$this->getUniqueID()."', 'onClick');}"
69
-			)) ;
69
+			));
70 70
 	}
71 71
 
72 72
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function getText()
76 76
 	{
77
-		return $this->getViewState('Text','');
77
+		return $this->getViewState('Text', '');
78 78
 	}
79 79
 
80 80
 	/**
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function setText($value)
84 84
 	{
85
-		$this->setViewState('Text',$value,'');
85
+		$this->setViewState('Text', $value, '');
86 86
 	}
87 87
 
88 88
 	/**
89 89
 	 * Raises the OnClick event
90 90
 	 * @param object $params event parameters
91 91
 	 */
92
-	public function onClick ($params)
92
+	public function onClick($params)
93 93
 	{
94 94
 		$this->raiseEvent('OnClick', $this, $params);
95 95
 	}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function raiseCallbackEvent($param)
103 103
 	{
104
-		if($param->CallbackParameter === 'onClick')
104
+		if($param->CallbackParameter==='onClick')
105 105
 			$this->onClick($param);
106 106
 	}
107 107
 
Please login to merge, or discard this patch.