Completed
Push — prado-3.3 ( f5b914 )
by Fabio
07:15
created
framework/Web/UI/WebControls/TTextBox.php 2 patches
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	protected function getTagName()
76 76
 	{
77
-		return ($this->getTextMode()==='MultiLine')?'textarea':'input';
77
+		return ($this->getTextMode()==='MultiLine') ? 'textarea' : 'input';
78 78
 	}
79 79
 
80 80
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function getEnableClientScript()
84 84
 	{
85
-		return $this->getViewState('EnableClientScript',true);
85
+		return $this->getViewState('EnableClientScript', true);
86 86
 	}
87 87
 
88 88
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function setEnableClientScript($value)
92 92
 	{
93
-		$this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true);
93
+		$this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true);
94 94
 	}
95 95
 
96 96
 	/**
@@ -103,106 +103,106 @@  discard block
 block discarded – undo
103 103
 		$page=$this->getPage();
104 104
 		$page->ensureRenderInForm($this);
105 105
 		if(($uid=$this->getUniqueID())!=='')
106
-			$writer->addAttribute('name',$uid);
106
+			$writer->addAttribute('name', $uid);
107 107
 		if(($textMode=$this->getTextMode())===TTextBoxMode::MultiLine)
108 108
 		{
109
-			if(($rows=$this->getRows())<=0)
109
+			if(($rows=$this->getRows()) <= 0)
110 110
 				$rows=self::DEFAULT_ROWS;
111
-			if(($cols=$this->getColumns())<=0)
111
+			if(($cols=$this->getColumns()) <= 0)
112 112
 				$cols=self::DEFAULT_COLUMNS;
113
-			$writer->addAttribute('rows',"$rows");
114
-			$writer->addAttribute('cols',"$cols");
113
+			$writer->addAttribute('rows', "$rows");
114
+			$writer->addAttribute('cols', "$cols");
115 115
 			if(!$this->getWrap())
116
-				$writer->addAttribute('wrap','off');
116
+				$writer->addAttribute('wrap', 'off');
117 117
 		}
118 118
 		else
119 119
 		{
120 120
 			switch($textMode)
121 121
 			{
122 122
 				case TTextBoxMode::Password:
123
-					$writer->addAttribute('type','password');
123
+					$writer->addAttribute('type', 'password');
124 124
 					break;
125 125
 				case TTextBoxMode::Color:
126
-					$writer->addAttribute('type','color');
126
+					$writer->addAttribute('type', 'color');
127 127
 					break;
128 128
 				case TTextBoxMode::Date:
129
-					$writer->addAttribute('type','date');
129
+					$writer->addAttribute('type', 'date');
130 130
 					break;
131 131
 				case TTextBoxMode::Datetime:
132
-					$writer->addAttribute('type','datetime');
132
+					$writer->addAttribute('type', 'datetime');
133 133
 					break;
134 134
 				case TTextBoxMode::DatetimeLocal:
135
-					$writer->addAttribute('type','datetime-local');
135
+					$writer->addAttribute('type', 'datetime-local');
136 136
 					break;
137 137
 				case TTextBoxMode::Email:
138
-					$writer->addAttribute('type','email');
138
+					$writer->addAttribute('type', 'email');
139 139
 					break;
140 140
 				case TTextBoxMode::Month:
141
-					$writer->addAttribute('type','month');
141
+					$writer->addAttribute('type', 'month');
142 142
 					break;
143 143
 				case TTextBoxMode::Number:
144
-					$writer->addAttribute('type','number');
144
+					$writer->addAttribute('type', 'number');
145 145
 					break;
146 146
 				case TTextBoxMode::Range:
147
-					$writer->addAttribute('type','range');
147
+					$writer->addAttribute('type', 'range');
148 148
 					break;
149 149
 				case TTextBoxMode::Search:
150
-					$writer->addAttribute('type','search');
150
+					$writer->addAttribute('type', 'search');
151 151
 					break;
152 152
 				case TTextBoxMode::Tel:
153
-					$writer->addAttribute('type','tel');
153
+					$writer->addAttribute('type', 'tel');
154 154
 					break;
155 155
 				case TTextBoxMode::Time:
156
-					$writer->addAttribute('type','time');
156
+					$writer->addAttribute('type', 'time');
157 157
 					break;
158 158
 				case TTextBoxMode::Url:
159
-					$writer->addAttribute('type','url');
159
+					$writer->addAttribute('type', 'url');
160 160
 					break;
161 161
 				case TTextBoxMode::Week:
162
-					$writer->addAttribute('type','week');
162
+					$writer->addAttribute('type', 'week');
163 163
 					break;
164 164
 				case TTextBoxMode::SingleLine:
165 165
 				default:
166
-					$writer->addAttribute('type','text');
166
+					$writer->addAttribute('type', 'text');
167 167
 					break;
168 168
 			}
169 169
 
170
-			if(($text=$this->getText())!=='' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword()))
171
-				$writer->addAttribute('value',$text);					
170
+			if(($text=$this->getText())!=='' && ($textMode!==TTextBoxMode::Password || $this->getPersistPassword()))
171
+				$writer->addAttribute('value', $text);					
172 172
 
173 173
 			if(($act=$this->getAutoCompleteType())!=='None')
174 174
 			{
175 175
 				if($act==='Disabled')
176
-					$writer->addAttribute('autocomplete','off');
176
+					$writer->addAttribute('autocomplete', 'off');
177 177
 				else if($act==='Search')
178
-					$writer->addAttribute('vcard_name','search');
178
+					$writer->addAttribute('vcard_name', 'search');
179 179
 				else if($act==='HomeCountryRegion')
180
-					$writer->addAttribute('vcard_name','HomeCountry');
180
+					$writer->addAttribute('vcard_name', 'HomeCountry');
181 181
 				else if($act==='BusinessCountryRegion')
182
-					$writer->addAttribute('vcard_name','BusinessCountry');
182
+					$writer->addAttribute('vcard_name', 'BusinessCountry');
183 183
 				else
184 184
 				{
185
-					if(strpos($act,'Business')===0)
186
-						$act='Business'.'.'.substr($act,8);
187
-					else if(strpos($act,'Home')===0)
188
-						$act='Home'.'.'.substr($act,4);
189
-					$writer->addAttribute('vcard_name','vCard.'.$act);
185
+					if(strpos($act, 'Business')===0)
186
+						$act='Business'.'.'.substr($act, 8);
187
+					else if(strpos($act, 'Home')===0)
188
+						$act='Home'.'.'.substr($act, 4);
189
+					$writer->addAttribute('vcard_name', 'vCard.'.$act);
190 190
 				}
191 191
 			}
192 192
 
193
-			if(($cols=$this->getColumns())>0)
194
-				$writer->addAttribute('size',"$cols");
195
-			if(($maxLength=$this->getMaxLength())>0)
196
-				$writer->addAttribute('maxlength',"$maxLength");
193
+			if(($cols=$this->getColumns()) > 0)
194
+				$writer->addAttribute('size', "$cols");
195
+			if(($maxLength=$this->getMaxLength()) > 0)
196
+				$writer->addAttribute('maxlength', "$maxLength");
197 197
 		}
198 198
 		if($this->getReadOnly())
199
-			$writer->addAttribute('readonly','readonly');
199
+			$writer->addAttribute('readonly', 'readonly');
200 200
 		$isEnabled=$this->getEnabled(true);
201 201
 		if(!$isEnabled && $this->getEnabled())  // in this case parent will not render 'disabled'
202
-			$writer->addAttribute('disabled','disabled');
202
+			$writer->addAttribute('disabled', 'disabled');
203 203
 		if($isEnabled
204 204
 			&& $this->getEnableClientScript()
205
-			&& ( $this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine)
205
+			&& ($this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine)
206 206
 			&& $page->getClientSupportsJavaScript())
207 207
 		{
208 208
 			$this->renderClientControlScript($writer);
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	protected function renderClientControlScript($writer)
217 217
 	{
218
-		$writer->addAttribute('id',$this->getClientID());
219
-		$cs = $this->getPage()->getClientScript();
220
-		$cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions());
218
+		$writer->addAttribute('id', $this->getClientID());
219
+		$cs=$this->getPage()->getClientScript();
220
+		$cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions());
221 221
 	}
222 222
 
223 223
 	/**
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	protected function getPostBackOptions()
238 238
 	{
239
-		$options['ID'] = $this->getClientID();
240
-		$options['EventTarget'] = $this->getUniqueID();
241
-		$options['AutoPostBack'] = $this->getAutoPostBack();
242
-		$options['CausesValidation'] = $this->getCausesValidation();
243
-		$options['ValidationGroup'] = $this->getValidationGroup();
244
-		$options['TextMode'] = $this->getTextMode();
239
+		$options['ID']=$this->getClientID();
240
+		$options['EventTarget']=$this->getUniqueID();
241
+		$options['AutoPostBack']=$this->getAutoPostBack();
242
+		$options['CausesValidation']=$this->getCausesValidation();
243
+		$options['ValidationGroup']=$this->getValidationGroup();
244
+		$options['TextMode']=$this->getTextMode();
245 245
 		return $options;
246 246
 	}
247 247
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param array the input data collection
253 253
 	 * @return boolean whether the data of the component has been changed
254 254
 	 */
255
-	public function loadPostData($key,$values)
255
+	public function loadPostData($key, $values)
256 256
 	{
257 257
 		$value=$values[$key];
258 258
 		if($this->getAutoTrim())
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 */
314 314
 	public function onTextChanged($param)
315 315
 	{
316
-		$this->raiseEvent('OnTextChanged',$this,$param);
316
+		$this->raiseEvent('OnTextChanged', $this, $param);
317 317
 	}
318 318
 
319 319
 	/**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	public function getAutoCompleteType()
359 359
 	{
360
-		return $this->getViewState('AutoCompleteType',TTextBoxAutoCompleteType::None);
360
+		return $this->getViewState('AutoCompleteType', TTextBoxAutoCompleteType::None);
361 361
 	}
362 362
 
363 363
 	/**
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	public function setAutoCompleteType($value)
368 368
 	{
369
-		$this->setViewState('AutoCompleteType',TPropertyValue::ensureEnum($value,'TTextBoxAutoCompleteType'),TTextBoxAutoCompleteType::None);
369
+		$this->setViewState('AutoCompleteType', TPropertyValue::ensureEnum($value, 'TTextBoxAutoCompleteType'), TTextBoxAutoCompleteType::None);
370 370
 	}
371 371
 
372 372
 	/**
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public function getAutoPostBack()
378 378
 	{
379
-		return $this->getViewState('AutoPostBack',false);
379
+		return $this->getViewState('AutoPostBack', false);
380 380
 	}
381 381
 
382 382
 	/**
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	 */
388 388
 	public function setAutoPostBack($value)
389 389
 	{
390
-		$this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false);
390
+		$this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false);
391 391
 	}
392 392
 
393 393
 	/**
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	public function getAutoTrim()
397 397
 	{
398
-		return $this->getViewState('AutoTrim',false);
398
+		return $this->getViewState('AutoTrim', false);
399 399
 	}
400 400
 
401 401
 	/**
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 	 */
405 405
 	public function setAutoTrim($value)
406 406
 	{
407
-		$this->setViewState('AutoTrim',TPropertyValue::ensureBoolean($value),false);
407
+		$this->setViewState('AutoTrim', TPropertyValue::ensureBoolean($value), false);
408 408
 	}
409 409
 
410 410
 	/**
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 */
413 413
 	public function getCausesValidation()
414 414
 	{
415
-		return $this->getViewState('CausesValidation',true);
415
+		return $this->getViewState('CausesValidation', true);
416 416
 	}
417 417
 
418 418
 	/**
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	 */
421 421
 	public function setCausesValidation($value)
422 422
 	{
423
-		$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
423
+		$this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true);
424 424
 	}
425 425
 
426 426
 	/**
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 */
429 429
 	public function getColumns()
430 430
 	{
431
-		return $this->getViewState('Columns',0);
431
+		return $this->getViewState('Columns', 0);
432 432
 	}
433 433
 
434 434
 	/**
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	public function setColumns($value)
439 439
 	{
440
-		$this->setViewState('Columns',TPropertyValue::ensureInteger($value),0);
440
+		$this->setViewState('Columns', TPropertyValue::ensureInteger($value), 0);
441 441
 	}
442 442
 
443 443
 	/**
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	public function getMaxLength()
447 447
 	{
448
-		return $this->getViewState('MaxLength',0);
448
+		return $this->getViewState('MaxLength', 0);
449 449
 	}
450 450
 
451 451
 	/**
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	 */
455 455
 	public function setMaxLength($value)
456 456
 	{
457
-		$this->setViewState('MaxLength',TPropertyValue::ensureInteger($value),0);
457
+		$this->setViewState('MaxLength', TPropertyValue::ensureInteger($value), 0);
458 458
 	}
459 459
 
460 460
 	/**
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 	 */
463 463
 	public function getReadOnly()
464 464
 	{
465
-		return $this->getViewState('ReadOnly',false);
465
+		return $this->getViewState('ReadOnly', false);
466 466
 	}
467 467
 
468 468
 	/**
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 */
471 471
 	public function setReadOnly($value)
472 472
 	{
473
-		$this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
473
+		$this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false);
474 474
 	}
475 475
 
476 476
 	/**
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 	 */
479 479
 	public function getRows()
480 480
 	{
481
-		return $this->getViewState('Rows',self::DEFAULT_ROWS);
481
+		return $this->getViewState('Rows', self::DEFAULT_ROWS);
482 482
 	}
483 483
 
484 484
 	/**
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	 */
488 488
 	public function setRows($value)
489 489
 	{
490
-		$this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS);
490
+		$this->setViewState('Rows', TPropertyValue::ensureInteger($value), self::DEFAULT_ROWS);
491 491
 	}
492 492
 
493 493
 	/**
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 */
496 496
 	public function getPersistPassword()
497 497
 	{
498
-		return $this->getViewState('PersistPassword',false);
498
+		return $this->getViewState('PersistPassword', false);
499 499
 	}
500 500
 
501 501
 	/**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	 */
504 504
 	public function setPersistPassword($value)
505 505
 	{
506
-		$this->setViewState('PersistPassword',TPropertyValue::ensureBoolean($value),false);
506
+		$this->setViewState('PersistPassword', TPropertyValue::ensureBoolean($value), false);
507 507
 	}
508 508
 
509 509
 	/**
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	 */
512 512
 	public function getText()
513 513
 	{
514
-		return $this->getViewState('Text','');
514
+		return $this->getViewState('Text', '');
515 515
 	}
516 516
 
517 517
 	/**
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	public function setText($value)
522 522
 	{
523
-		$this->setViewState('Text',TPropertyValue::ensureString($value),'');
524
-		$this->_safeText = null;
523
+		$this->setViewState('Text', TPropertyValue::ensureString($value), '');
524
+		$this->_safeText=null;
525 525
 	}
526 526
 
527 527
 	/**
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	 */
576 576
 	public function getTextMode()
577 577
 	{
578
-		return $this->getViewState('TextMode',TTextBoxMode::SingleLine);
578
+		return $this->getViewState('TextMode', TTextBoxMode::SingleLine);
579 579
 	}
580 580
 
581 581
 	/**
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	public function setTextMode($value)
587 587
 	{
588
-		$this->setViewState('TextMode',TPropertyValue::ensureEnum($value,'TTextBoxMode'),TTextBoxMode::SingleLine);
588
+		$this->setViewState('TextMode', TPropertyValue::ensureEnum($value, 'TTextBoxMode'), TTextBoxMode::SingleLine);
589 589
 	}
590 590
 
591 591
 	/**
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 	 */
594 594
 	public function getValidationGroup()
595 595
 	{
596
-		return $this->getViewState('ValidationGroup','');
596
+		return $this->getViewState('ValidationGroup', '');
597 597
 	}
598 598
 
599 599
 	/**
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 	 */
602 602
 	public function setValidationGroup($value)
603 603
 	{
604
-		$this->setViewState('ValidationGroup',$value,'');
604
+		$this->setViewState('ValidationGroup', $value, '');
605 605
 	}
606 606
 
607 607
 	/**
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	 */
610 610
 	public function getWrap()
611 611
 	{
612
-		return $this->getViewState('Wrap',true);
612
+		return $this->getViewState('Wrap', true);
613 613
 	}
614 614
 
615 615
 	/**
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 */
619 619
 	public function setWrap($value)
620 620
 	{
621
-		$this->setViewState('Wrap',TPropertyValue::ensureBoolean($value),true);
621
+		$this->setViewState('Wrap', TPropertyValue::ensureBoolean($value), true);
622 622
 	}
623 623
 }
624 624
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -189,8 +189,7 @@  discard block
 block discarded – undo
189 189
 				return file_put_contents($fileName,file_get_contents($this->_localName))!==false;
190 190
 			else
191 191
 				return false;
192
-		}
193
-		else
192
+		} else
194 193
 			return false;
195 194
 	}
196 195
 
@@ -211,8 +210,7 @@  discard block
 block discarded – undo
211 210
 			$this->_errorCode=$_FILES[$key]['error'];
212 211
 			$this->_localName=$_FILES[$key]['tmp_name'];
213 212
 			return $this->_dataChanged=true;
214
-		}
215
-		else
213
+		} else
216 214
 			return false;
217 215
 	}
218 216
 
Please login to merge, or discard this patch.