Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Web/UI/WebControls/TCaptcha.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	public function setTokenImageTheme($value)
94 94
 	{
95 95
 		$value = TPropertyValue::ensureInteger($value);
96
-		if($value >= 0 && $value <= 63)
96
+		if ($value >= 0 && $value <= 63)
97 97
 			$this->setViewState('TokenImageTheme', $value, 0);
98 98
 		else
99 99
 			throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	public function setTokenFontSize($value)
117 117
 	{
118 118
 		$value = TPropertyValue::ensureInteger($value);
119
-		if($value >= 20 && $value <= 100)
119
+		if ($value >= 20 && $value <= 100)
120 120
 			$this->setViewState('TokenFontSize', $value, 30);
121 121
 		else
122 122
 			throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	public function setMinTokenLength($value)
137 137
 	{
138 138
 		$length = TPropertyValue::ensureInteger($value);
139
-		if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH)
139
+		if ($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH)
140 140
 			$this->setViewState('MinTokenLength', $length, 4);
141 141
 		else
142 142
 			throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	public function setMaxTokenLength($value)
157 157
 	{
158 158
 		$length = TPropertyValue::ensureInteger($value);
159
-		if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH)
159
+		if ($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH)
160 160
 			$this->setViewState('MaxTokenLength', $length, 6);
161 161
 		else
162 162
 			throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	public function setTokenAlphabet($value)
193 193
 	{
194
-		if(strlen($value) < 2)
194
+		if (strlen($value) < 2)
195 195
 			throw new TConfigurationException('captcha_tokenalphabet_invalid');
196 196
 		$this->setViewState('TokenAlphabet', $value, '234578adefhijmnrtABDEFGHJLMNRT');
197 197
 	}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function getIsTokenExpired()
251 251
 	{
252
-		if(($expiry = $this->getTokenExpiry()) > 0 && ($start = $this->getViewState('TokenGenerated', 0)) > 0)
252
+		if (($expiry = $this->getTokenExpiry()) > 0 && ($start = $this->getViewState('TokenGenerated', 0)) > 0)
253 253
 			return $expiry + $start < time();
254 254
 		else
255 255
 			return false;
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function getPublicKey()
262 262
 	{
263
-		if(($publicKey = $this->getViewState('PublicKey', '')) === '')
263
+		if (($publicKey = $this->getViewState('PublicKey', '')) === '')
264 264
 		{
265 265
 			$publicKey = $this->generateRandomKey();
266 266
 			$this->setPublicKey($publicKey);
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	protected function getTokenLength()
291 291
 	{
292
-		if(($tokenLength = $this->getViewState('TokenLength')) === null)
292
+		if (($tokenLength = $this->getViewState('TokenLength')) === null)
293 293
 		{
294 294
 			$minLength = $this->getMinTokenLength();
295 295
 			$maxLength = $this->getMaxTokenLength();
296
-			if($minLength > $maxLength)
296
+			if ($minLength > $maxLength)
297 297
 				$tokenLength = rand($maxLength, $minLength);
298
-			elseif($minLength < $maxLength)
298
+			elseif ($minLength < $maxLength)
299 299
 				$tokenLength = rand($minLength, $maxLength);
300 300
 			else
301 301
 				$tokenLength = $minLength;
@@ -309,12 +309,12 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	public function getPrivateKey()
311 311
 	{
312
-		if($this->_privateKey === null)
312
+		if ($this->_privateKey === null)
313 313
 		{
314 314
 			$fileName = $this->generatePrivateKeyFile();
315 315
 			$content = file_get_contents($fileName);
316 316
 			$matches = [];
317
-			if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0)
317
+			if (preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0)
318 318
 				$this->_privateKey = $matches[1];
319 319
 			else
320 320
 				throw new TConfigurationException('captcha_privatekey_unknown');
@@ -330,17 +330,17 @@  discard block
 block discarded – undo
330 330
 	public function validate($input)
331 331
 	{
332 332
 		$number = $this->getViewState('TestNumber', 0);
333
-		if(!$this->_validated)
333
+		if (!$this->_validated)
334 334
 		{
335 335
 			$this->setViewState('TestNumber', ++$number);
336 336
 			$this->_validated = true;
337 337
 		}
338
-		if($this->getIsTokenExpired() || (($limit = $this->getTestLimit()) > 0 && $number > $limit))
338
+		if ($this->getIsTokenExpired() || (($limit = $this->getTestLimit()) > 0 && $number > $limit))
339 339
 		{
340 340
 			$this->regenerateToken();
341 341
 			return false;
342 342
 		}
343
-		return ($this->getToken() === ($this->getCaseSensitive()?$input:strtoupper($input)));
343
+		return ($this->getToken() === ($this->getCaseSensitive() ? $input : strtoupper($input)));
344 344
 	}
345 345
 
346 346
 	/**
@@ -364,14 +364,14 @@  discard block
 block discarded – undo
364 364
 	public function onPreRender($param)
365 365
 	{
366 366
 		parent::onPreRender($param);
367
-		if(!self::checkRequirements())
367
+		if (!self::checkRequirements())
368 368
 			throw new TConfigurationException('captcha_imagettftext_required');
369
-		if(!$this->getViewState('TokenGenerated', 0))
369
+		if (!$this->getViewState('TokenGenerated', 0))
370 370
 		{
371 371
 			$manager = $this->getApplication()->getAssetManager();
372 372
 			$manager->publishFilePath($this->getFontFile());
373 373
 			$url = $manager->publishFilePath($this->getCaptchaScriptFile());
374
-			$url .= '?options=' . urlencode($this->getTokenImageOptions());
374
+			$url .= '?options='.urlencode($this->getTokenImageOptions());
375 375
 			$this->setImageUrl($url);
376 376
 
377 377
 			$this->setViewState('TokenGenerated', time());
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	protected function getTokenImageOptions()
385 385
 	{
386
-		$privateKey = $this->getPrivateKey();  // call this method to ensure private key is generated
386
+		$privateKey = $this->getPrivateKey(); // call this method to ensure private key is generated
387 387
 		$token = $this->getToken();
388 388
 		$options = [];
389 389
 		$options['publicKey'] = $this->getPublicKey();
@@ -392,14 +392,14 @@  discard block
 block discarded – undo
392 392
 		$options['alphabet'] = $this->getTokenAlphabet();
393 393
 		$options['fontSize'] = $this->getTokenFontSize();
394 394
 		$options['theme'] = $this->getTokenImageTheme();
395
-		if(($randomSeed = $this->getViewState('RandomSeed', 0)) === 0)
395
+		if (($randomSeed = $this->getViewState('RandomSeed', 0)) === 0)
396 396
 		{
397
-			$randomSeed = (int)(microtime(true) * 1000000);
397
+			$randomSeed = (int) (microtime(true) * 1000000);
398 398
 			$this->setViewState('RandomSeed', $randomSeed);
399 399
 		}
400
-		$options['randomSeed'] = $this->getChangingTokenBackground()?0:$randomSeed;
400
+		$options['randomSeed'] = $this->getChangingTokenBackground() ? 0 : $randomSeed;
401 401
 		$str = serialize($options);
402
-		return base64_encode(md5($privateKey . $str) . $str);
402
+		return base64_encode(md5($privateKey.$str).$str);
403 403
 	}
404 404
 
405 405
 	/**
@@ -407,12 +407,12 @@  discard block
 block discarded – undo
407 407
 	 */
408 408
 	protected function getCaptchaScriptFile()
409 409
 	{
410
-		return dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'captcha.php';
410
+		return dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'captcha.php';
411 411
 	}
412 412
 
413 413
 	protected function getFontFile()
414 414
 	{
415
-		return dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'verase.ttf';
415
+		return dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'verase.ttf';
416 416
 	}
417 417
 
418 418
 	/**
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
 	{
424 424
 		$captchaScript = $this->getCaptchaScriptFile();
425 425
 		$path = dirname($this->getApplication()->getAssetManager()->getPublishedPath($captchaScript));
426
-		$fileName = $path . DIRECTORY_SEPARATOR . 'captcha_key.php';
427
-		if(!is_file($fileName))
426
+		$fileName = $path.DIRECTORY_SEPARATOR.'captcha_key.php';
427
+		if (!is_file($fileName))
428 428
 		{
429 429
 			@mkdir($path);
430 430
 			$key = $this->generateRandomKey();
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	 */
442 442
 	protected function generateRandomKey()
443 443
 	{
444
-		return md5(rand() . rand() . rand() . rand());
444
+		return md5(rand().rand().rand().rand());
445 445
 	}
446 446
 
447 447
 	/**
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 */
455 455
 	protected function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive)
456 456
 	{
457
-		$token = substr($this->hash2string(md5($publicKey . $privateKey), $alphabet) . $this->hash2string(md5($privateKey . $publicKey), $alphabet), 0, $tokenLength);
458
-		return $caseSensitive?$token:strtoupper($token);
457
+		$token = substr($this->hash2string(md5($publicKey.$privateKey), $alphabet).$this->hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength);
458
+		return $caseSensitive ? $token : strtoupper($token);
459 459
 	}
460 460
 
461 461
 	/**
@@ -466,15 +466,15 @@  discard block
 block discarded – undo
466 466
 	 */
467 467
 	protected function hash2string($hex, $alphabet = '')
468 468
 	{
469
-		if(strlen($alphabet) < 2)
469
+		if (strlen($alphabet) < 2)
470 470
 			$alphabet = '234578adefhijmnrtABDEFGHJLMNQRT';
471 471
 		$hexLength = strlen($hex);
472 472
 		$base = strlen($alphabet);
473 473
 		$result = '';
474
-		for($i = 0;$i < $hexLength;$i += 6)
474
+		for ($i = 0; $i < $hexLength; $i += 6)
475 475
 		{
476 476
 			$number = hexdec(substr($hex, $i, 6));
477
-			while($number)
477
+			while ($number)
478 478
 			{
479 479
 				$result .= $alphabet[$number % $base];
480 480
 				$number = floor($number / $base);
Please login to merge, or discard this patch.
Braces   +46 added lines, -36 removed lines patch added patch discarded remove patch
@@ -93,10 +93,11 @@  discard block
 block discarded – undo
93 93
 	public function setTokenImageTheme($value)
94 94
 	{
95 95
 		$value = TPropertyValue::ensureInteger($value);
96
-		if($value >= 0 && $value <= 63)
97
-			$this->setViewState('TokenImageTheme', $value, 0);
98
-		else
99
-			throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63);
96
+		if($value >= 0 && $value <= 63) {
97
+					$this->setViewState('TokenImageTheme', $value, 0);
98
+		} else {
99
+					throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63);
100
+		}
100 101
 	}
101 102
 
102 103
 	/**
@@ -116,10 +117,11 @@  discard block
 block discarded – undo
116 117
 	public function setTokenFontSize($value)
117 118
 	{
118 119
 		$value = TPropertyValue::ensureInteger($value);
119
-		if($value >= 20 && $value <= 100)
120
-			$this->setViewState('TokenFontSize', $value, 30);
121
-		else
122
-			throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100);
120
+		if($value >= 20 && $value <= 100) {
121
+					$this->setViewState('TokenFontSize', $value, 30);
122
+		} else {
123
+					throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100);
124
+		}
123 125
 	}
124 126
 
125 127
 	/**
@@ -136,10 +138,11 @@  discard block
 block discarded – undo
136 138
 	public function setMinTokenLength($value)
137 139
 	{
138 140
 		$length = TPropertyValue::ensureInteger($value);
139
-		if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH)
140
-			$this->setViewState('MinTokenLength', $length, 4);
141
-		else
142
-			throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH);
141
+		if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) {
142
+					$this->setViewState('MinTokenLength', $length, 4);
143
+		} else {
144
+					throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH);
145
+		}
143 146
 	}
144 147
 
145 148
 	/**
@@ -156,10 +159,11 @@  discard block
 block discarded – undo
156 159
 	public function setMaxTokenLength($value)
157 160
 	{
158 161
 		$length = TPropertyValue::ensureInteger($value);
159
-		if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH)
160
-			$this->setViewState('MaxTokenLength', $length, 6);
161
-		else
162
-			throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH);
162
+		if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) {
163
+					$this->setViewState('MaxTokenLength', $length, 6);
164
+		} else {
165
+					throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH);
166
+		}
163 167
 	}
164 168
 
165 169
 	/**
@@ -191,8 +195,9 @@  discard block
 block discarded – undo
191 195
 	 */
192 196
 	public function setTokenAlphabet($value)
193 197
 	{
194
-		if(strlen($value) < 2)
195
-			throw new TConfigurationException('captcha_tokenalphabet_invalid');
198
+		if(strlen($value) < 2) {
199
+					throw new TConfigurationException('captcha_tokenalphabet_invalid');
200
+		}
196 201
 		$this->setViewState('TokenAlphabet', $value, '234578adefhijmnrtABDEFGHJLMNRT');
197 202
 	}
198 203
 
@@ -249,10 +254,11 @@  discard block
 block discarded – undo
249 254
 	 */
250 255
 	public function getIsTokenExpired()
251 256
 	{
252
-		if(($expiry = $this->getTokenExpiry()) > 0 && ($start = $this->getViewState('TokenGenerated', 0)) > 0)
253
-			return $expiry + $start < time();
254
-		else
255
-			return false;
257
+		if(($expiry = $this->getTokenExpiry()) > 0 && ($start = $this->getViewState('TokenGenerated', 0)) > 0) {
258
+					return $expiry + $start < time();
259
+		} else {
260
+					return false;
261
+		}
256 262
 	}
257 263
 
258 264
 	/**
@@ -293,12 +299,13 @@  discard block
 block discarded – undo
293 299
 		{
294 300
 			$minLength = $this->getMinTokenLength();
295 301
 			$maxLength = $this->getMaxTokenLength();
296
-			if($minLength > $maxLength)
297
-				$tokenLength = rand($maxLength, $minLength);
298
-			elseif($minLength < $maxLength)
299
-				$tokenLength = rand($minLength, $maxLength);
300
-			else
301
-				$tokenLength = $minLength;
302
+			if($minLength > $maxLength) {
303
+							$tokenLength = rand($maxLength, $minLength);
304
+			} elseif($minLength < $maxLength) {
305
+							$tokenLength = rand($minLength, $maxLength);
306
+			} else {
307
+							$tokenLength = $minLength;
308
+			}
302 309
 			$this->setViewState('TokenLength', $tokenLength);
303 310
 		}
304 311
 		return $tokenLength;
@@ -314,10 +321,11 @@  discard block
 block discarded – undo
314 321
 			$fileName = $this->generatePrivateKeyFile();
315 322
 			$content = file_get_contents($fileName);
316 323
 			$matches = [];
317
-			if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0)
318
-				$this->_privateKey = $matches[1];
319
-			else
320
-				throw new TConfigurationException('captcha_privatekey_unknown');
324
+			if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0) {
325
+							$this->_privateKey = $matches[1];
326
+			} else {
327
+							throw new TConfigurationException('captcha_privatekey_unknown');
328
+			}
321 329
 		}
322 330
 		return $this->_privateKey;
323 331
 	}
@@ -364,8 +372,9 @@  discard block
 block discarded – undo
364 372
 	public function onPreRender($param)
365 373
 	{
366 374
 		parent::onPreRender($param);
367
-		if(!self::checkRequirements())
368
-			throw new TConfigurationException('captcha_imagettftext_required');
375
+		if(!self::checkRequirements()) {
376
+					throw new TConfigurationException('captcha_imagettftext_required');
377
+		}
369 378
 		if(!$this->getViewState('TokenGenerated', 0))
370 379
 		{
371 380
 			$manager = $this->getApplication()->getAssetManager();
@@ -466,8 +475,9 @@  discard block
 block discarded – undo
466 475
 	 */
467 476
 	protected function hash2string($hex, $alphabet = '')
468 477
 	{
469
-		if(strlen($alphabet) < 2)
470
-			$alphabet = '234578adefhijmnrtABDEFGHJLMNQRT';
478
+		if(strlen($alphabet) < 2) {
479
+					$alphabet = '234578adefhijmnrtABDEFGHJLMNQRT';
480
+		}
471 481
 		$hexLength = strlen($hex);
472 482
 		$base = strlen($alphabet);
473 483
 		$result = '';
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TTextBox.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	protected function getTagName()
83 83
 	{
84
-		return ($this->getTextMode() === 'MultiLine')?'textarea':'input';
84
+		return ($this->getTextMode() === 'MultiLine') ? 'textarea' : 'input';
85 85
 	}
86 86
 
87 87
 	/**
@@ -109,22 +109,22 @@  discard block
 block discarded – undo
109 109
 	{
110 110
 		$page = $this->getPage();
111 111
 		$page->ensureRenderInForm($this);
112
-		if(($uid = $this->getUniqueID()) !== '')
112
+		if (($uid = $this->getUniqueID()) !== '')
113 113
 			$writer->addAttribute('name', $uid);
114
-		if(($textMode = $this->getTextMode()) === TTextBoxMode::MultiLine)
114
+		if (($textMode = $this->getTextMode()) === TTextBoxMode::MultiLine)
115 115
 		{
116
-			if(($rows = $this->getRows()) <= 0)
116
+			if (($rows = $this->getRows()) <= 0)
117 117
 				$rows = self::DEFAULT_ROWS;
118
-			if(($cols = $this->getColumns()) <= 0)
118
+			if (($cols = $this->getColumns()) <= 0)
119 119
 				$cols = self::DEFAULT_COLUMNS;
120 120
 			$writer->addAttribute('rows', "$rows");
121 121
 			$writer->addAttribute('cols', "$cols");
122
-			if(!$this->getWrap())
122
+			if (!$this->getWrap())
123 123
 				$writer->addAttribute('wrap', 'off');
124 124
 		}
125 125
 		else
126 126
 		{
127
-			switch($textMode)
127
+			switch ($textMode)
128 128
 			{
129 129
 				case TTextBoxMode::Password:
130 130
 					$writer->addAttribute('type', 'password');
@@ -174,40 +174,40 @@  discard block
 block discarded – undo
174 174
 					break;
175 175
 			}
176 176
 
177
-			if(($text = $this->getText()) !== '' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword()))
177
+			if (($text = $this->getText()) !== '' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword()))
178 178
 				$writer->addAttribute('value', $text);
179 179
 
180
-			if(($act = $this->getAutoCompleteType()) !== 'None')
180
+			if (($act = $this->getAutoCompleteType()) !== 'None')
181 181
 			{
182
-				if($act === 'Disabled')
182
+				if ($act === 'Disabled')
183 183
 					$writer->addAttribute('autocomplete', 'off');
184
-				elseif($act === 'Search')
184
+				elseif ($act === 'Search')
185 185
 					$writer->addAttribute('vcard_name', 'search');
186
-				elseif($act === 'HomeCountryRegion')
186
+				elseif ($act === 'HomeCountryRegion')
187 187
 					$writer->addAttribute('vcard_name', 'HomeCountry');
188
-				elseif($act === 'BusinessCountryRegion')
188
+				elseif ($act === 'BusinessCountryRegion')
189 189
 					$writer->addAttribute('vcard_name', 'BusinessCountry');
190 190
 				else
191 191
 				{
192
-					if(strpos($act, 'Business') === 0)
193
-						$act = 'Business' . '.' . substr($act, 8);
194
-					elseif(strpos($act, 'Home') === 0)
195
-						$act = 'Home' . '.' . substr($act, 4);
196
-					$writer->addAttribute('vcard_name', 'vCard.' . $act);
192
+					if (strpos($act, 'Business') === 0)
193
+						$act = 'Business'.'.'.substr($act, 8);
194
+					elseif (strpos($act, 'Home') === 0)
195
+						$act = 'Home'.'.'.substr($act, 4);
196
+					$writer->addAttribute('vcard_name', 'vCard.'.$act);
197 197
 				}
198 198
 			}
199 199
 
200
-			if(($cols = $this->getColumns()) > 0)
200
+			if (($cols = $this->getColumns()) > 0)
201 201
 				$writer->addAttribute('size', "$cols");
202
-			if(($maxLength = $this->getMaxLength()) > 0)
202
+			if (($maxLength = $this->getMaxLength()) > 0)
203 203
 				$writer->addAttribute('maxlength', "$maxLength");
204 204
 		}
205
-		if($this->getReadOnly())
205
+		if ($this->getReadOnly())
206 206
 			$writer->addAttribute('readonly', 'readonly');
207 207
 		$isEnabled = $this->getEnabled(true);
208
-		if(!$isEnabled && $this->getEnabled())  // in this case parent will not render 'disabled'
208
+		if (!$isEnabled && $this->getEnabled())  // in this case parent will not render 'disabled'
209 209
 			$writer->addAttribute('disabled', 'disabled');
210
-		if($isEnabled
210
+		if ($isEnabled
211 211
 			&& $this->getEnableClientScript()
212 212
 			&& ($this->getAutoPostBack() || $textMode === TTextBoxMode::SingleLine)
213 213
 			&& $page->getClientSupportsJavaScript())
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	public function loadPostData($key, $values)
263 263
 	{
264 264
 		$value = $values[$key];
265
-		if($this->getAutoTrim())
265
+		if ($this->getAutoTrim())
266 266
 			$value = trim($value);
267
-		if(!$this->getReadOnly() && $this->getText() !== $value)
267
+		if (!$this->getReadOnly() && $this->getText() !== $value)
268 268
 		{
269 269
 			$this->setText($value);
270 270
 			return $this->_dataChanged = true;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	public function raisePostDataChangedEvent()
334 334
 	{
335
-		if($this->getAutoPostBack() && $this->getCausesValidation())
335
+		if ($this->getAutoPostBack() && $this->getCausesValidation())
336 336
 			$this->getPage()->validate($this->getValidationGroup());
337 337
 		$this->onTextChanged(null);
338 338
 	}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	 */
344 344
 	public function renderContents($writer)
345 345
 	{
346
-		if($this->getTextMode() === 'MultiLine')
346
+		if ($this->getTextMode() === 'MultiLine')
347 347
 			$writer->write(THttpUtility::htmlEncode($this->getText()));
348 348
 	}
349 349
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	public function renderBeginTag($writer)
356 356
 	{
357 357
 		parent::renderBeginTag($writer);
358
-		if($this->getTextMode() === 'MultiLine')
358
+		if ($this->getTextMode() === 'MultiLine')
359 359
 			$writer->write("\n");
360 360
 	}
361 361
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 */
563 563
 	public function getSafeText()
564 564
 	{
565
-		if($this->_safeText === null)
565
+		if ($this->_safeText === null)
566 566
 			$this->_safeText = $this->getSafeTextParser()->purify($this->getText());
567 567
 		return $this->_safeText;
568 568
 	}
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 	 */
573 573
 	protected function getSafeTextParser()
574 574
 	{
575
-		if(!self::$_safeTextParser)
575
+		if (!self::$_safeTextParser)
576 576
 			self::$_safeTextParser = new \HTMLPurifier($this->getConfig());
577 577
 		return self::$_safeTextParser;
578 578
 	}
Please login to merge, or discard this patch.
Braces   +62 added lines, -46 removed lines patch added patch discarded remove patch
@@ -109,20 +109,23 @@  discard block
 block discarded – undo
109 109
 	{
110 110
 		$page = $this->getPage();
111 111
 		$page->ensureRenderInForm($this);
112
-		if(($uid = $this->getUniqueID()) !== '')
113
-			$writer->addAttribute('name', $uid);
112
+		if(($uid = $this->getUniqueID()) !== '') {
113
+					$writer->addAttribute('name', $uid);
114
+		}
114 115
 		if(($textMode = $this->getTextMode()) === TTextBoxMode::MultiLine)
115 116
 		{
116
-			if(($rows = $this->getRows()) <= 0)
117
-				$rows = self::DEFAULT_ROWS;
118
-			if(($cols = $this->getColumns()) <= 0)
119
-				$cols = self::DEFAULT_COLUMNS;
117
+			if(($rows = $this->getRows()) <= 0) {
118
+							$rows = self::DEFAULT_ROWS;
119
+			}
120
+			if(($cols = $this->getColumns()) <= 0) {
121
+							$cols = self::DEFAULT_COLUMNS;
122
+			}
120 123
 			$writer->addAttribute('rows', "$rows");
121 124
 			$writer->addAttribute('cols', "$cols");
122
-			if(!$this->getWrap())
123
-				$writer->addAttribute('wrap', 'off');
124
-		}
125
-		else
125
+			if(!$this->getWrap()) {
126
+							$writer->addAttribute('wrap', 'off');
127
+			}
128
+		} else
126 129
 		{
127 130
 			switch($textMode)
128 131
 			{
@@ -174,39 +177,46 @@  discard block
 block discarded – undo
174 177
 					break;
175 178
 			}
176 179
 
177
-			if(($text = $this->getText()) !== '' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword()))
178
-				$writer->addAttribute('value', $text);
180
+			if(($text = $this->getText()) !== '' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) {
181
+							$writer->addAttribute('value', $text);
182
+			}
179 183
 
180 184
 			if(($act = $this->getAutoCompleteType()) !== 'None')
181 185
 			{
182
-				if($act === 'Disabled')
183
-					$writer->addAttribute('autocomplete', 'off');
184
-				elseif($act === 'Search')
185
-					$writer->addAttribute('vcard_name', 'search');
186
-				elseif($act === 'HomeCountryRegion')
187
-					$writer->addAttribute('vcard_name', 'HomeCountry');
188
-				elseif($act === 'BusinessCountryRegion')
189
-					$writer->addAttribute('vcard_name', 'BusinessCountry');
190
-				else
186
+				if($act === 'Disabled') {
187
+									$writer->addAttribute('autocomplete', 'off');
188
+				} elseif($act === 'Search') {
189
+									$writer->addAttribute('vcard_name', 'search');
190
+				} elseif($act === 'HomeCountryRegion') {
191
+									$writer->addAttribute('vcard_name', 'HomeCountry');
192
+				} elseif($act === 'BusinessCountryRegion') {
193
+									$writer->addAttribute('vcard_name', 'BusinessCountry');
194
+				} else
191 195
 				{
192
-					if(strpos($act, 'Business') === 0)
193
-						$act = 'Business' . '.' . substr($act, 8);
194
-					elseif(strpos($act, 'Home') === 0)
195
-						$act = 'Home' . '.' . substr($act, 4);
196
+					if(strpos($act, 'Business') === 0) {
197
+											$act = 'Business' . '.' . substr($act, 8);
198
+					} elseif(strpos($act, 'Home') === 0) {
199
+											$act = 'Home' . '.' . substr($act, 4);
200
+					}
196 201
 					$writer->addAttribute('vcard_name', 'vCard.' . $act);
197 202
 				}
198 203
 			}
199 204
 
200
-			if(($cols = $this->getColumns()) > 0)
201
-				$writer->addAttribute('size', "$cols");
202
-			if(($maxLength = $this->getMaxLength()) > 0)
203
-				$writer->addAttribute('maxlength', "$maxLength");
205
+			if(($cols = $this->getColumns()) > 0) {
206
+							$writer->addAttribute('size', "$cols");
207
+			}
208
+			if(($maxLength = $this->getMaxLength()) > 0) {
209
+							$writer->addAttribute('maxlength', "$maxLength");
210
+			}
211
+		}
212
+		if($this->getReadOnly()) {
213
+					$writer->addAttribute('readonly', 'readonly');
204 214
 		}
205
-		if($this->getReadOnly())
206
-			$writer->addAttribute('readonly', 'readonly');
207 215
 		$isEnabled = $this->getEnabled(true);
208
-		if(!$isEnabled && $this->getEnabled())  // in this case parent will not render 'disabled'
216
+		if(!$isEnabled && $this->getEnabled()) {
217
+			// in this case parent will not render 'disabled'
209 218
 			$writer->addAttribute('disabled', 'disabled');
219
+		}
210 220
 		if($isEnabled
211 221
 			&& $this->getEnableClientScript()
212 222
 			&& ($this->getAutoPostBack() || $textMode === TTextBoxMode::SingleLine)
@@ -262,15 +272,16 @@  discard block
 block discarded – undo
262 272
 	public function loadPostData($key, $values)
263 273
 	{
264 274
 		$value = $values[$key];
265
-		if($this->getAutoTrim())
266
-			$value = trim($value);
275
+		if($this->getAutoTrim()) {
276
+					$value = trim($value);
277
+		}
267 278
 		if(!$this->getReadOnly() && $this->getText() !== $value)
268 279
 		{
269 280
 			$this->setText($value);
270 281
 			return $this->_dataChanged = true;
282
+		} else {
283
+					return false;
271 284
 		}
272
-		else
273
-			return false;
274 285
 	}
275 286
 
276 287
 	/**
@@ -332,8 +343,9 @@  discard block
 block discarded – undo
332 343
 	 */
333 344
 	public function raisePostDataChangedEvent()
334 345
 	{
335
-		if($this->getAutoPostBack() && $this->getCausesValidation())
336
-			$this->getPage()->validate($this->getValidationGroup());
346
+		if($this->getAutoPostBack() && $this->getCausesValidation()) {
347
+					$this->getPage()->validate($this->getValidationGroup());
348
+		}
337 349
 		$this->onTextChanged(null);
338 350
 	}
339 351
 
@@ -343,8 +355,9 @@  discard block
 block discarded – undo
343 355
 	 */
344 356
 	public function renderContents($writer)
345 357
 	{
346
-		if($this->getTextMode() === 'MultiLine')
347
-			$writer->write(THttpUtility::htmlEncode($this->getText()));
358
+		if($this->getTextMode() === 'MultiLine') {
359
+					$writer->write(THttpUtility::htmlEncode($this->getText()));
360
+		}
348 361
 	}
349 362
 
350 363
 	/**
@@ -355,8 +368,9 @@  discard block
 block discarded – undo
355 368
 	public function renderBeginTag($writer)
356 369
 	{
357 370
 		parent::renderBeginTag($writer);
358
-		if($this->getTextMode() === 'MultiLine')
359
-			$writer->write("\n");
371
+		if($this->getTextMode() === 'MultiLine') {
372
+					$writer->write("\n");
373
+		}
360 374
 	}
361 375
 
362 376
 	/**
@@ -562,8 +576,9 @@  discard block
 block discarded – undo
562 576
 	 */
563 577
 	public function getSafeText()
564 578
 	{
565
-		if($this->_safeText === null)
566
-			$this->_safeText = $this->getSafeTextParser()->purify($this->getText());
579
+		if($this->_safeText === null) {
580
+					$this->_safeText = $this->getSafeTextParser()->purify($this->getText());
581
+		}
567 582
 		return $this->_safeText;
568 583
 	}
569 584
 
@@ -572,8 +587,9 @@  discard block
 block discarded – undo
572 587
 	 */
573 588
 	protected function getSafeTextParser()
574 589
 	{
575
-		if(!self::$_safeTextParser)
576
-			self::$_safeTextParser = new \HTMLPurifier($this->getConfig());
590
+		if(!self::$_safeTextParser) {
591
+					self::$_safeTextParser = new \HTMLPurifier($this->getConfig());
592
+		}
577 593
 		return self::$_safeTextParser;
578 594
 	}
579 595
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TClientScript.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 		parent::onPreRender($param);
112 112
 		$scripts = preg_split('/,|\s+/', $this->getPradoScripts());
113 113
 		$cs = $this->getPage()->getClientScript();
114
-		foreach($scripts as $script)
114
+		foreach ($scripts as $script)
115 115
 		{
116
-			if(($script = trim($script)) !== '')
116
+			if (($script = trim($script)) !== '')
117 117
 				$cs->registerPradoScript($script);
118 118
 		}
119 119
 	}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	protected function renderCustomScriptFile($writer)
140 140
 	{
141
-		if(($scriptUrl = $this->getScriptUrl()) !== '')
141
+		if (($scriptUrl = $this->getScriptUrl()) !== '')
142 142
 			$writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n");
143 143
 	}
144 144
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	protected function renderCustomScript($writer)
150 150
 	{
151
-		if($this->getHasControls())
151
+		if ($this->getHasControls())
152 152
 		{
153 153
 			$writer->write("<script type=\"text/javascript\">\n/*<![CDATA[*/\n");
154 154
 			$this->renderChildren($writer);
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -113,8 +113,9 @@  discard block
 block discarded – undo
113 113
 		$cs = $this->getPage()->getClientScript();
114 114
 		foreach($scripts as $script)
115 115
 		{
116
-			if(($script = trim($script)) !== '')
117
-				$cs->registerPradoScript($script);
116
+			if(($script = trim($script)) !== '') {
117
+							$cs->registerPradoScript($script);
118
+			}
118 119
 		}
119 120
 	}
120 121
 
@@ -126,8 +127,9 @@  discard block
 block discarded – undo
126 127
 	 */
127 128
 	public function render($writer)
128 129
 	{
129
-		if ($this->getFlushScriptFiles())
130
-			$this->getPage()->getClientScript()->flushScriptFiles($writer, $this);
130
+		if ($this->getFlushScriptFiles()) {
131
+					$this->getPage()->getClientScript()->flushScriptFiles($writer, $this);
132
+		}
131 133
 		$this->renderCustomScriptFile($writer);
132 134
 		$this->renderCustomScript($writer);
133 135
 	}
@@ -138,8 +140,9 @@  discard block
 block discarded – undo
138 140
 	 */
139 141
 	protected function renderCustomScriptFile($writer)
140 142
 	{
141
-		if(($scriptUrl = $this->getScriptUrl()) !== '')
142
-			$writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n");
143
+		if(($scriptUrl = $this->getScriptUrl()) !== '') {
144
+					$writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n");
145
+		}
143 146
 	}
144 147
 
145 148
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TTextProcessor.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function addParsedObject($object)
49 49
 	{
50
-		if(is_string($object))
50
+		if (is_string($object))
51 51
 			$object = html_entity_decode($object, ENT_QUOTES, 'UTF-8');
52 52
 		parent::addParsedObject($object);
53 53
 	}
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function renderContents($writer)
78 78
 	{
79
-		if(($text = $this->getText()) === '' && $this->getHasControls())
79
+		if (($text = $this->getText()) === '' && $this->getHasControls())
80 80
 		{
81 81
 			$htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
82 82
 			parent::renderContents($htmlWriter);
83 83
 			$text = $htmlWriter->flush();
84 84
 		}
85
-		if($text !== '')
85
+		if ($text !== '')
86 86
 			$writer->write($this->processText($text));
87 87
 	}
88 88
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function addParsedObject($object)
49 49
 	{
50
-		if(is_string($object))
51
-			$object = html_entity_decode($object, ENT_QUOTES, 'UTF-8');
50
+		if(is_string($object)) {
51
+					$object = html_entity_decode($object, ENT_QUOTES, 'UTF-8');
52
+		}
52 53
 		parent::addParsedObject($object);
53 54
 	}
54 55
 
@@ -82,8 +83,9 @@  discard block
 block discarded – undo
82 83
 			parent::renderContents($htmlWriter);
83 84
 			$text = $htmlWriter->flush();
84 85
 		}
85
-		if($text !== '')
86
-			$writer->write($this->processText($text));
86
+		if($text !== '') {
87
+					$writer->write($this->processText($text));
88
+		}
87 89
 	}
88 90
 
89 91
 }
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TBulletedList.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function raisePostBackEvent($param)
62 62
 	{
63
-		if($this->getCausesValidation())
63
+		if ($this->getCausesValidation())
64 64
 			$this->getPage()->validate($this->getValidationGroup());
65
-		$this->onClick(new TBulletedListEventParameter((int)$param));
65
+		$this->onClick(new TBulletedListEventParameter((int) $param));
66 66
 	}
67 67
 
68 68
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	protected function getTagName()
72 72
 	{
73
-		switch($this->getBulletStyle())
73
+		switch ($this->getBulletStyle())
74 74
 		{
75 75
 			case TBulletStyle::Numbered:
76 76
 			case TBulletStyle::LowerAlpha:
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	protected function addAttributesToRender($writer)
101 101
 	{
102 102
 		$needStart = false;
103
-		switch($this->getBulletStyle())
103
+		switch ($this->getBulletStyle())
104 104
 		{
105 105
 			case TBulletStyle::None:
106 106
 				$writer->addStyleAttribute('list-style-type', 'none');
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				$writer->addStyleAttribute('list-style-image', "url($url)");
141 141
 				break;
142 142
 		}
143
-		if($needStart && ($start = $this->getFirstBulletNumber()) != 1)
143
+		if ($needStart && ($start = $this->getFirstBulletNumber()) != 1)
144 144
 			$writer->addAttribute('start', "$start");
145 145
 		parent::addAttributesToRender($writer);
146 146
 	}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function render($writer)
251 251
 	{
252
-		if($this->getHasItems())
252
+		if ($this->getHasItems())
253 253
 			parent::render($writer);
254 254
 	}
255 255
 
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 		$this->_isEnabled = $this->getEnabled(true);
263 263
 		$this->_postBackOptions = $this->getPostBackOptions();
264 264
 		$writer->writeLine();
265
-		foreach($this->getItems() as $index => $item)
265
+		foreach ($this->getItems() as $index => $item)
266 266
 		{
267
-			if($item->getHasAttributes())
267
+			if ($item->getHasAttributes())
268 268
 				$writer->addAttributes($item->getAttributes());
269 269
 			$writer->renderBeginTag('li');
270 270
 			$this->renderBulletText($writer, $item, $index);
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	protected function renderBulletText($writer, $item, $index)
283 283
 	{
284
-		switch($this->getDisplayMode())
284
+		switch ($this->getDisplayMode())
285 285
 		{
286 286
 			case TBulletedListDisplayMode::Text:
287 287
 				$this->renderTextItem($writer, $item, $index);
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
 	protected function renderTextItem($writer, $item, $index)
299 299
 	{
300
-		if($item->getEnabled())
300
+		if ($item->getEnabled())
301 301
 			$writer->write(THttpUtility::htmlEncode($item->getText()));
302 302
 		else
303 303
 		{
@@ -310,15 +310,15 @@  discard block
 block discarded – undo
310 310
 
311 311
 	protected function renderHyperLinkItem($writer, $item, $index)
312 312
 	{
313
-		if(!$this->_isEnabled || !$item->getEnabled())
313
+		if (!$this->_isEnabled || !$item->getEnabled())
314 314
 			$writer->addAttribute('disabled', 'disabled');
315 315
 		else
316 316
 		{
317 317
 			$writer->addAttribute('href', $item->getValue());
318
-			if(($target = $this->getTarget()) !== '')
318
+			if (($target = $this->getTarget()) !== '')
319 319
 				$writer->addAttribute('target', $target);
320 320
 		}
321
-		if(($accesskey = $this->getAccessKey()) !== '')
321
+		if (($accesskey = $this->getAccessKey()) !== '')
322 322
 			$writer->addAttribute('accesskey', $accesskey);
323 323
 		$writer->renderBeginTag('a');
324 324
 		$writer->write(THttpUtility::htmlEncode($item->getText()));
@@ -327,17 +327,17 @@  discard block
 block discarded – undo
327 327
 
328 328
 	protected function renderLinkButtonItem($writer, $item, $index)
329 329
 	{
330
-		if(!$this->_isEnabled || !$item->getEnabled())
330
+		if (!$this->_isEnabled || !$item->getEnabled())
331 331
 			$writer->addAttribute('disabled', 'disabled');
332 332
 		else
333 333
 		{
334 334
 			$this->_currentRenderItemIndex = $index;
335
-			$writer->addAttribute('id', $this->getClientID() . $index);
336
-			$writer->addAttribute('href', "javascript:;//" . $this->getClientID() . $index);
335
+			$writer->addAttribute('id', $this->getClientID().$index);
336
+			$writer->addAttribute('href', "javascript:;//".$this->getClientID().$index);
337 337
 			$cs = $this->getPage()->getClientScript();
338 338
 			$cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions());
339 339
 		}
340
-		if(($accesskey = $this->getAccessKey()) !== '')
340
+		if (($accesskey = $this->getAccessKey()) !== '')
341 341
 			$writer->addAttribute('accesskey', $accesskey);
342 342
 		$writer->renderBeginTag('a');
343 343
 		$writer->write(THttpUtility::htmlEncode($item->getText()));
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		$options['CausesValidation'] = $this->getCausesValidation();
354 354
 		$options['EventTarget'] = $this->getUniqueID();
355 355
 		$options['EventParameter'] = $this->_currentRenderItemIndex;
356
-		$options['ID'] = $this->getClientID() . $this->_currentRenderItemIndex;
356
+		$options['ID'] = $this->getClientID().$this->_currentRenderItemIndex;
357 357
 		$options['StopEvent'] = true;
358 358
 		return $options;
359 359
 	}
Please login to merge, or discard this patch.
Braces   +30 added lines, -23 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public function raisePostBackEvent($param)
62 62
 	{
63
-		if($this->getCausesValidation())
64
-			$this->getPage()->validate($this->getValidationGroup());
63
+		if($this->getCausesValidation()) {
64
+					$this->getPage()->validate($this->getValidationGroup());
65
+		}
65 66
 		$this->onClick(new TBulletedListEventParameter((int)$param));
66 67
 	}
67 68
 
@@ -140,8 +141,9 @@  discard block
 block discarded – undo
140 141
 				$writer->addStyleAttribute('list-style-image', "url($url)");
141 142
 				break;
142 143
 		}
143
-		if($needStart && ($start = $this->getFirstBulletNumber()) != 1)
144
-			$writer->addAttribute('start', "$start");
144
+		if($needStart && ($start = $this->getFirstBulletNumber()) != 1) {
145
+					$writer->addAttribute('start', "$start");
146
+		}
145 147
 		parent::addAttributesToRender($writer);
146 148
 	}
147 149
 
@@ -249,8 +251,9 @@  discard block
 block discarded – undo
249 251
 	 */
250 252
 	public function render($writer)
251 253
 	{
252
-		if($this->getHasItems())
253
-			parent::render($writer);
254
+		if($this->getHasItems()) {
255
+					parent::render($writer);
256
+		}
254 257
 	}
255 258
 
256 259
 	/**
@@ -264,8 +267,9 @@  discard block
 block discarded – undo
264 267
 		$writer->writeLine();
265 268
 		foreach($this->getItems() as $index => $item)
266 269
 		{
267
-			if($item->getHasAttributes())
268
-				$writer->addAttributes($item->getAttributes());
270
+			if($item->getHasAttributes()) {
271
+							$writer->addAttributes($item->getAttributes());
272
+			}
269 273
 			$writer->renderBeginTag('li');
270 274
 			$this->renderBulletText($writer, $item, $index);
271 275
 			$writer->renderEndTag();
@@ -297,9 +301,9 @@  discard block
 block discarded – undo
297 301
 
298 302
 	protected function renderTextItem($writer, $item, $index)
299 303
 	{
300
-		if($item->getEnabled())
301
-			$writer->write(THttpUtility::htmlEncode($item->getText()));
302
-		else
304
+		if($item->getEnabled()) {
305
+					$writer->write(THttpUtility::htmlEncode($item->getText()));
306
+		} else
303 307
 		{
304 308
 			$writer->addAttribute('disabled', 'disabled');
305 309
 			$writer->renderBeginTag('span');
@@ -310,16 +314,18 @@  discard block
 block discarded – undo
310 314
 
311 315
 	protected function renderHyperLinkItem($writer, $item, $index)
312 316
 	{
313
-		if(!$this->_isEnabled || !$item->getEnabled())
314
-			$writer->addAttribute('disabled', 'disabled');
315
-		else
317
+		if(!$this->_isEnabled || !$item->getEnabled()) {
318
+					$writer->addAttribute('disabled', 'disabled');
319
+		} else
316 320
 		{
317 321
 			$writer->addAttribute('href', $item->getValue());
318
-			if(($target = $this->getTarget()) !== '')
319
-				$writer->addAttribute('target', $target);
322
+			if(($target = $this->getTarget()) !== '') {
323
+							$writer->addAttribute('target', $target);
324
+			}
325
+		}
326
+		if(($accesskey = $this->getAccessKey()) !== '') {
327
+					$writer->addAttribute('accesskey', $accesskey);
320 328
 		}
321
-		if(($accesskey = $this->getAccessKey()) !== '')
322
-			$writer->addAttribute('accesskey', $accesskey);
323 329
 		$writer->renderBeginTag('a');
324 330
 		$writer->write(THttpUtility::htmlEncode($item->getText()));
325 331
 		$writer->renderEndTag();
@@ -327,9 +333,9 @@  discard block
 block discarded – undo
327 333
 
328 334
 	protected function renderLinkButtonItem($writer, $item, $index)
329 335
 	{
330
-		if(!$this->_isEnabled || !$item->getEnabled())
331
-			$writer->addAttribute('disabled', 'disabled');
332
-		else
336
+		if(!$this->_isEnabled || !$item->getEnabled()) {
337
+					$writer->addAttribute('disabled', 'disabled');
338
+		} else
333 339
 		{
334 340
 			$this->_currentRenderItemIndex = $index;
335 341
 			$writer->addAttribute('id', $this->getClientID() . $index);
@@ -337,8 +343,9 @@  discard block
 block discarded – undo
337 343
 			$cs = $this->getPage()->getClientScript();
338 344
 			$cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions());
339 345
 		}
340
-		if(($accesskey = $this->getAccessKey()) !== '')
341
-			$writer->addAttribute('accesskey', $accesskey);
346
+		if(($accesskey = $this->getAccessKey()) !== '') {
347
+					$writer->addAttribute('accesskey', $accesskey);
348
+		}
342 349
 		$writer->renderBeginTag('a');
343 350
 		$writer->write(THttpUtility::htmlEncode($item->getText()));
344 351
 		$writer->renderEndTag();
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TColorPicker.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function getClientSide()
134 134
 	{
135
-		if($this->_clientSide === null)
135
+		if ($this->_clientSide === null)
136 136
 			$this->_clientSide = $this->createClientSide();
137 137
 		return $this->_clientSide;
138 138
 	}
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 		$options = parent::getPostBackOptions();
155 155
 		$options['ClassName'] = $this->getCssClass();
156 156
 		$options['ShowColorPicker'] = $this->getShowColorPicker();
157
-		if($options['ShowColorPicker'])
157
+		if ($options['ShowColorPicker'])
158 158
 		{
159 159
 			$mode = $this->getMode();
160
-			if($mode == TColorPickerMode::Full) $options['Mode'] = $mode;
161
-			elseif($mode == TColorPickerMode::Simple) $options['Palette'] = 'Tiny';
160
+			if ($mode == TColorPickerMode::Full) $options['Mode'] = $mode;
161
+			elseif ($mode == TColorPickerMode::Simple) $options['Palette'] = 'Tiny';
162 162
 			$options['OKButtonText'] = $this->getOKButtonText();
163 163
 			$options['CancelButtonText'] = $this->getCancelButtonText();
164 164
 		}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	protected function getAssetUrl($file = '')
174 174
 	{
175 175
 		$base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
176
-		return $base . '/' . self::SCRIPT_PATH . '/' . $file;
176
+		return $base.'/'.self::SCRIPT_PATH.'/'.$file;
177 177
 	}
178 178
 
179 179
 	/**
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 	protected function publishColorPickerAssets()
192 192
 	{
193 193
 		$cs = $this->getPage()->getClientScript();
194
-		$key = "prado:" . get_class($this);
194
+		$key = "prado:".get_class($this);
195 195
 		$imgs['button.gif'] = $this->getAssetUrl('button.gif');
196 196
 		$imgs['background.png'] = $this->getAssetUrl('background.png');
197 197
 		$options = TJavaScript::encode($imgs);
198 198
 		$code = "Prado.WebUI.TColorPicker.UIImages = {$options};";
199 199
 		$cs->registerEndScript($key, $code);
200 200
 		$cs->registerPradoScript("colorpicker");
201
-		$url = $this->getAssetUrl($this->getColorPickerStyle() . '.css');
202
-		if(!$cs->isStyleSheetFileRegistered($url))
201
+		$url = $this->getAssetUrl($this->getColorPickerStyle().'.css');
202
+		if (!$cs->isStyleSheetFileRegistered($url))
203 203
 			$cs->registerStyleSheetFile($url, $url);
204 204
 	}
205 205
 
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
 		$writer->addAttribute('class', 'TColorPicker_button');
218 218
 		$writer->renderBeginTag('span');
219 219
 
220
-		$writer->addAttribute('id', $this->getClientID() . '_button');
220
+		$writer->addAttribute('id', $this->getClientID().'_button');
221 221
 		$writer->addAttribute('src', $this->getAssetUrl('button.gif'));
222
-		if($color !== '')
222
+		if ($color !== '')
223 223
 			$writer->addAttribute('style', "background-color:{$color};");
224 224
 		$writer->addAttribute('width', '20');
225 225
 		$writer->addAttribute('height', '20');
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -132,8 +132,9 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function getClientSide()
134 134
 	{
135
-		if($this->_clientSide === null)
136
-			$this->_clientSide = $this->createClientSide();
135
+		if($this->_clientSide === null) {
136
+					$this->_clientSide = $this->createClientSide();
137
+		}
137 138
 		return $this->_clientSide;
138 139
 	}
139 140
 
@@ -157,8 +158,11 @@  discard block
 block discarded – undo
157 158
 		if($options['ShowColorPicker'])
158 159
 		{
159 160
 			$mode = $this->getMode();
160
-			if($mode == TColorPickerMode::Full) $options['Mode'] = $mode;
161
-			elseif($mode == TColorPickerMode::Simple) $options['Palette'] = 'Tiny';
161
+			if($mode == TColorPickerMode::Full) {
162
+				$options['Mode'] = $mode;
163
+			} elseif($mode == TColorPickerMode::Simple) {
164
+				$options['Palette'] = 'Tiny';
165
+			}
162 166
 			$options['OKButtonText'] = $this->getOKButtonText();
163 167
 			$options['CancelButtonText'] = $this->getCancelButtonText();
164 168
 		}
@@ -199,8 +203,9 @@  discard block
 block discarded – undo
199 203
 		$cs->registerEndScript($key, $code);
200 204
 		$cs->registerPradoScript("colorpicker");
201 205
 		$url = $this->getAssetUrl($this->getColorPickerStyle() . '.css');
202
-		if(!$cs->isStyleSheetFileRegistered($url))
203
-			$cs->registerStyleSheetFile($url, $url);
206
+		if(!$cs->isStyleSheetFileRegistered($url)) {
207
+					$cs->registerStyleSheetFile($url, $url);
208
+		}
204 209
 	}
205 210
 
206 211
 	/**
@@ -219,8 +224,9 @@  discard block
 block discarded – undo
219 224
 
220 225
 		$writer->addAttribute('id', $this->getClientID() . '_button');
221 226
 		$writer->addAttribute('src', $this->getAssetUrl('button.gif'));
222
-		if($color !== '')
223
-			$writer->addAttribute('style', "background-color:{$color};");
227
+		if($color !== '') {
228
+					$writer->addAttribute('style', "background-color:{$color};");
229
+		}
224 230
 		$writer->addAttribute('width', '20');
225 231
 		$writer->addAttribute('height', '20');
226 232
 		$writer->addAttribute('alt', '');
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TFileUploadItem.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -134,11 +134,11 @@
 block discarded – undo
134 134
    */
135 135
   public function saveAs($fileName, $deleteTempFile = true)
136 136
   {
137
-	if($this->_errorCode === UPLOAD_ERR_OK)
137
+	if ($this->_errorCode === UPLOAD_ERR_OK)
138 138
 	{
139
-	  if($deleteTempFile)
139
+	  if ($deleteTempFile)
140 140
 		return move_uploaded_file($this->_localName, $fileName);
141
-	  elseif(is_uploaded_file($this->_localName))
141
+	  elseif (is_uploaded_file($this->_localName))
142 142
 		return file_put_contents($fileName, file_get_contents($this->_localName)) !== false;
143 143
 	  else
144 144
 		return false;
Please login to merge, or discard this patch.
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -136,15 +136,16 @@
 block discarded – undo
136 136
   {
137 137
 	if($this->_errorCode === UPLOAD_ERR_OK)
138 138
 	{
139
-	  if($deleteTempFile)
140
-		return move_uploaded_file($this->_localName, $fileName);
141
-	  elseif(is_uploaded_file($this->_localName))
142
-		return file_put_contents($fileName, file_get_contents($this->_localName)) !== false;
143
-	  else
144
-		return false;
139
+	  if($deleteTempFile) {
140
+	  		return move_uploaded_file($this->_localName, $fileName);
141
+	  } elseif(is_uploaded_file($this->_localName)) {
142
+	  		return file_put_contents($fileName, file_get_contents($this->_localName)) !== false;
143
+	  } else {
144
+	  		return false;
145
+	  }
146
+	} else {
147
+		  return false;
145 148
 	}
146
-	else
147
-	  return false;
148 149
   }
149 150
 
150 151
   /**
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDropDownList.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function loadPostData($key, $values)
77 77
 	{
78
-		if(!$this->getEnabled(true))
78
+		if (!$this->getEnabled(true))
79 79
 			return false;
80 80
 		$this->ensureDataBound();
81
-		$selection = isset($values[$key])?$values[$key]:null;
82
-		if($selection !== null)
81
+		$selection = isset($values[$key]) ? $values[$key] : null;
82
+		if ($selection !== null)
83 83
 		{
84 84
 			$index = $this->getItems()->findIndexByValue($selection, false);
85
-			if($this->getSelectedIndex() !== $index)
85
+			if ($this->getSelectedIndex() !== $index)
86 86
 			{
87 87
 				$this->setSelectedIndex($index);
88 88
 				return $this->_dataChanged = true;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function raisePostDataChangedEvent()
102 102
 	{
103
-		if($this->getAutoPostBack() && $this->getCausesValidation())
103
+		if ($this->getAutoPostBack() && $this->getCausesValidation())
104 104
 			$this->getPage()->validate($this->getValidationGroup());
105 105
 		$this->onSelectedIndexChanged(null);
106 106
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,8 +75,9 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function loadPostData($key, $values)
77 77
 	{
78
-		if(!$this->getEnabled(true))
79
-			return false;
78
+		if(!$this->getEnabled(true)) {
79
+					return false;
80
+		}
80 81
 		$this->ensureDataBound();
81 82
 		$selection = isset($values[$key])?$values[$key]:null;
82 83
 		if($selection !== null)
@@ -100,8 +101,9 @@  discard block
 block discarded – undo
100 101
 	 */
101 102
 	public function raisePostDataChangedEvent()
102 103
 	{
103
-		if($this->getAutoPostBack() && $this->getCausesValidation())
104
-			$this->getPage()->validate($this->getValidationGroup());
104
+		if($this->getAutoPostBack() && $this->getCausesValidation()) {
105
+					$this->getPage()->validate($this->getValidationGroup());
106
+		}
105 107
 		$this->onSelectedIndexChanged(null);
106 108
 	}
107 109
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/THtmlArea.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	 */
312 312
 	protected function addAttributesToRender($writer)
313 313
 	{
314
-		if($this->getEnableVisualEdit() && $this->getEnabled(true))
314
+		if ($this->getEnableVisualEdit() && $this->getEnabled(true))
315 315
 		{
316 316
 			$writer->addAttribute('id', $this->getClientID());
317 317
 			$this->registerEditorClientScript($writer);
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
 		$options = TJavaScript::encode($options, true, true);
360 360
 		$script = "new {$this->getClientClassName()}($options)";
361
-		$scripts->registerEndScript('prado:THtmlArea' . $this->ClientID, $script);
361
+		$scripts->registerEndScript('prado:THtmlArea'.$this->ClientID, $script);
362 362
 	}
363 363
 
364 364
 	/**
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	protected function getScriptUrl()
368 368
 	{
369
-		return $this->getScriptDeploymentPath() . '/tiny_mce/tiny_mce.js';
369
+		return $this->getScriptDeploymentPath().'/tiny_mce/tiny_mce.js';
370 370
 	}
371 371
 
372 372
 	/**
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	{
378 378
 		$tarfile = Prado::getPathOfNamespace('Vendor.pradosoft.prado-tinymce3.tiny_mce', '.tar');
379 379
 		$md5sum = Prado::getPathOfNamespace('Vendor.pradosoft.prado-tinymce3.tiny_mce', '.md5');
380
-		if($tarfile === null || $md5sum === null)
380
+		if ($tarfile === null || $md5sum === null)
381 381
 			throw new TConfigurationException('htmlarea_tarfile_invalid');
382 382
 		$url = $this->getApplication()->getAssetManager()->publishTarFile($tarfile, $md5sum);
383 383
 		$this->copyCustomPlugins($url);
@@ -386,12 +386,12 @@  discard block
 block discarded – undo
386 386
 
387 387
 	protected function copyCustomPlugins($url)
388 388
 	{
389
-		if($plugins = $this->getCustomPluginPath())
389
+		if ($plugins = $this->getCustomPluginPath())
390 390
 		{
391 391
 			$assets = $this->getApplication()->getAssetManager();
392 392
 			$path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins);
393
-			$dest = $assets->getBasePath() . '/' . basename($url) . '/tiny_mce/plugins/' . basename($path);
394
-			if(!is_dir($dest) || $this->getApplication()->getMode() !== TApplicationMode::Performance)
393
+			$dest = $assets->getBasePath().'/'.basename($url).'/tiny_mce/plugins/'.basename($path);
394
+			if (!is_dir($dest) || $this->getApplication()->getMode() !== TApplicationMode::Performance)
395 395
 				$assets->copyDirectory($path, $dest);
396 396
 		}
397 397
 	}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 		$options['theme_advanced_toolbar_align'] = 'left';
419 419
 		$options['theme_advanced_path_location'] = 'bottom';
420 420
 		$options['extended_valid_elements'] = 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]';
421
-		if($this->getReadOnly())
421
+		if ($this->getReadOnly())
422 422
 			$options['readonly'] = true;
423 423
 
424 424
 		$options = array_merge($options, $this->parseEditorOptions($this->getOptions()));
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 	{
434 434
 		$options = [];
435 435
 		$substrings = preg_split('/,\s*\n|\n/', trim($string));
436
-		foreach($substrings as $bits)
436
+		foreach ($substrings as $bits)
437 437
 		{
438 438
 			$option = explode(":", $bits, 2);
439 439
 
440
-			if(count($option) == 2)
440
+			if (count($option) == 2)
441 441
 			{
442 442
 				$value = trim(trim($option[1]), "'\"");
443 443
 				if (($s = strtolower($value)) === 'false')
@@ -456,15 +456,15 @@  discard block
 block discarded – undo
456 456
 	protected function getLanguageSuffix($culture)
457 457
 	{
458 458
 		$app = $this->getApplication()->getGlobalization();
459
-		if(empty($culture) && ($app !== null))
459
+		if (empty($culture) && ($app !== null))
460 460
 			$culture = $app->getCulture();
461 461
 		$variants = [];
462
-		if($app !== null)
462
+		if ($app !== null)
463 463
 			$variants = $app->getCultureVariants($culture);
464 464
 
465
-		foreach($variants as $variant)
465
+		foreach ($variants as $variant)
466 466
 		{
467
-			if(isset(self::$_langs[$variant]))
467
+			if (isset(self::$_langs[$variant]))
468 468
 				return self::$_langs[$variant];
469 469
 		}
470 470
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -377,8 +377,9 @@  discard block
 block discarded – undo
377 377
 	{
378 378
 		$tarfile = Prado::getPathOfNamespace('Vendor.pradosoft.prado-tinymce3.tiny_mce', '.tar');
379 379
 		$md5sum = Prado::getPathOfNamespace('Vendor.pradosoft.prado-tinymce3.tiny_mce', '.md5');
380
-		if($tarfile === null || $md5sum === null)
381
-			throw new TConfigurationException('htmlarea_tarfile_invalid');
380
+		if($tarfile === null || $md5sum === null) {
381
+					throw new TConfigurationException('htmlarea_tarfile_invalid');
382
+		}
382 383
 		$url = $this->getApplication()->getAssetManager()->publishTarFile($tarfile, $md5sum);
383 384
 		$this->copyCustomPlugins($url);
384 385
 		return $url;
@@ -391,8 +392,9 @@  discard block
 block discarded – undo
391 392
 			$assets = $this->getApplication()->getAssetManager();
392 393
 			$path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins);
393 394
 			$dest = $assets->getBasePath() . '/' . basename($url) . '/tiny_mce/plugins/' . basename($path);
394
-			if(!is_dir($dest) || $this->getApplication()->getMode() !== TApplicationMode::Performance)
395
-				$assets->copyDirectory($path, $dest);
395
+			if(!is_dir($dest) || $this->getApplication()->getMode() !== TApplicationMode::Performance) {
396
+							$assets->copyDirectory($path, $dest);
397
+			}
396 398
 		}
397 399
 	}
398 400
 
@@ -418,8 +420,9 @@  discard block
 block discarded – undo
418 420
 		$options['theme_advanced_toolbar_align'] = 'left';
419 421
 		$options['theme_advanced_path_location'] = 'bottom';
420 422
 		$options['extended_valid_elements'] = 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]';
421
-		if($this->getReadOnly())
422
-			$options['readonly'] = true;
423
+		if($this->getReadOnly()) {
424
+					$options['readonly'] = true;
425
+		}
423 426
 
424 427
 		$options = array_merge($options, $this->parseEditorOptions($this->getOptions()));
425 428
 		return $options;
@@ -440,10 +443,11 @@  discard block
 block discarded – undo
440 443
 			if(count($option) == 2)
441 444
 			{
442 445
 				$value = trim(trim($option[1]), "'\"");
443
-				if (($s = strtolower($value)) === 'false')
444
-					$value = false;
445
-				elseif ($s === 'true')
446
-					$value = true;
446
+				if (($s = strtolower($value)) === 'false') {
447
+									$value = false;
448
+				} elseif ($s === 'true') {
449
+									$value = true;
450
+				}
447 451
 				$options[trim($option[0])] = $value;
448 452
 			}
449 453
 		}
@@ -456,16 +460,19 @@  discard block
 block discarded – undo
456 460
 	protected function getLanguageSuffix($culture)
457 461
 	{
458 462
 		$app = $this->getApplication()->getGlobalization();
459
-		if(empty($culture) && ($app !== null))
460
-			$culture = $app->getCulture();
463
+		if(empty($culture) && ($app !== null)) {
464
+					$culture = $app->getCulture();
465
+		}
461 466
 		$variants = [];
462
-		if($app !== null)
463
-			$variants = $app->getCultureVariants($culture);
467
+		if($app !== null) {
468
+					$variants = $app->getCultureVariants($culture);
469
+		}
464 470
 
465 471
 		foreach($variants as $variant)
466 472
 		{
467
-			if(isset(self::$_langs[$variant]))
468
-				return self::$_langs[$variant];
473
+			if(isset(self::$_langs[$variant])) {
474
+							return self::$_langs[$variant];
475
+			}
469 476
 		}
470 477
 
471 478
 		return 'en';
Please login to merge, or discard this patch.