@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function getIsValid() |
253 | 253 | { |
254 | - return $this->_isValid; |
|
254 | + return $this->_isValid; |
|
255 | 255 | } |
256 | 256 | /** |
257 | 257 | * @param bool wether this control is valid. |
258 | 258 | */ |
259 | 259 | public function setIsValid($value) |
260 | 260 | { |
261 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
261 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | |
330 | 330 | /** |
331 | 331 | * @return boolean a value indicating whether an automatic postback to the server |
332 | - * will occur whenever the user modifies the text in the TTextBox control and |
|
333 | - * then tabs out of the component. Defaults to false. |
|
332 | + * will occur whenever the user modifies the text in the TTextBox control and |
|
333 | + * then tabs out of the component. Defaults to false. |
|
334 | 334 | */ |
335 | 335 | public function getAutoPostBack() |
336 | 336 | { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function getTagName() |
82 | 82 | { |
83 | - return ($this->getTextMode()==='MultiLine')?'textarea':'input'; |
|
83 | + return ($this->getTextMode()==='MultiLine') ? 'textarea' : 'input'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function getEnableClientScript() |
90 | 90 | { |
91 | - return $this->getViewState('EnableClientScript',true); |
|
91 | + return $this->getViewState('EnableClientScript', true); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function setEnableClientScript($value) |
98 | 98 | { |
99 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
99 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -109,106 +109,106 @@ discard block |
||
109 | 109 | $page=$this->getPage(); |
110 | 110 | $page->ensureRenderInForm($this); |
111 | 111 | if(($uid=$this->getUniqueID())!=='') |
112 | - $writer->addAttribute('name',$uid); |
|
112 | + $writer->addAttribute('name', $uid); |
|
113 | 113 | if(($textMode=$this->getTextMode())===TTextBoxMode::MultiLine) |
114 | 114 | { |
115 | - if(($rows=$this->getRows())<=0) |
|
115 | + if(($rows=$this->getRows()) <= 0) |
|
116 | 116 | $rows=self::DEFAULT_ROWS; |
117 | - if(($cols=$this->getColumns())<=0) |
|
117 | + if(($cols=$this->getColumns()) <= 0) |
|
118 | 118 | $cols=self::DEFAULT_COLUMNS; |
119 | - $writer->addAttribute('rows',"$rows"); |
|
120 | - $writer->addAttribute('cols',"$cols"); |
|
119 | + $writer->addAttribute('rows', "$rows"); |
|
120 | + $writer->addAttribute('cols', "$cols"); |
|
121 | 121 | if(!$this->getWrap()) |
122 | - $writer->addAttribute('wrap','off'); |
|
122 | + $writer->addAttribute('wrap', 'off'); |
|
123 | 123 | } |
124 | 124 | else |
125 | 125 | { |
126 | 126 | switch($textMode) |
127 | 127 | { |
128 | 128 | case TTextBoxMode::Password: |
129 | - $writer->addAttribute('type','password'); |
|
129 | + $writer->addAttribute('type', 'password'); |
|
130 | 130 | break; |
131 | 131 | case TTextBoxMode::Color: |
132 | - $writer->addAttribute('type','color'); |
|
132 | + $writer->addAttribute('type', 'color'); |
|
133 | 133 | break; |
134 | 134 | case TTextBoxMode::Date: |
135 | - $writer->addAttribute('type','date'); |
|
135 | + $writer->addAttribute('type', 'date'); |
|
136 | 136 | break; |
137 | 137 | case TTextBoxMode::Datetime: |
138 | - $writer->addAttribute('type','datetime'); |
|
138 | + $writer->addAttribute('type', 'datetime'); |
|
139 | 139 | break; |
140 | 140 | case TTextBoxMode::DatetimeLocal: |
141 | - $writer->addAttribute('type','datetime-local'); |
|
141 | + $writer->addAttribute('type', 'datetime-local'); |
|
142 | 142 | break; |
143 | 143 | case TTextBoxMode::Email: |
144 | - $writer->addAttribute('type','email'); |
|
144 | + $writer->addAttribute('type', 'email'); |
|
145 | 145 | break; |
146 | 146 | case TTextBoxMode::Month: |
147 | - $writer->addAttribute('type','month'); |
|
147 | + $writer->addAttribute('type', 'month'); |
|
148 | 148 | break; |
149 | 149 | case TTextBoxMode::Number: |
150 | - $writer->addAttribute('type','number'); |
|
150 | + $writer->addAttribute('type', 'number'); |
|
151 | 151 | break; |
152 | 152 | case TTextBoxMode::Range: |
153 | - $writer->addAttribute('type','range'); |
|
153 | + $writer->addAttribute('type', 'range'); |
|
154 | 154 | break; |
155 | 155 | case TTextBoxMode::Search: |
156 | - $writer->addAttribute('type','search'); |
|
156 | + $writer->addAttribute('type', 'search'); |
|
157 | 157 | break; |
158 | 158 | case TTextBoxMode::Tel: |
159 | - $writer->addAttribute('type','tel'); |
|
159 | + $writer->addAttribute('type', 'tel'); |
|
160 | 160 | break; |
161 | 161 | case TTextBoxMode::Time: |
162 | - $writer->addAttribute('type','time'); |
|
162 | + $writer->addAttribute('type', 'time'); |
|
163 | 163 | break; |
164 | 164 | case TTextBoxMode::Url: |
165 | - $writer->addAttribute('type','url'); |
|
165 | + $writer->addAttribute('type', 'url'); |
|
166 | 166 | break; |
167 | 167 | case TTextBoxMode::Week: |
168 | - $writer->addAttribute('type','week'); |
|
168 | + $writer->addAttribute('type', 'week'); |
|
169 | 169 | break; |
170 | 170 | case TTextBoxMode::SingleLine: |
171 | 171 | default: |
172 | - $writer->addAttribute('type','text'); |
|
172 | + $writer->addAttribute('type', 'text'); |
|
173 | 173 | break; |
174 | 174 | } |
175 | 175 | |
176 | - if(($text=$this->getText())!=='' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) |
|
177 | - $writer->addAttribute('value',$text); |
|
176 | + if(($text=$this->getText())!=='' && ($textMode!==TTextBoxMode::Password || $this->getPersistPassword())) |
|
177 | + $writer->addAttribute('value', $text); |
|
178 | 178 | |
179 | 179 | if(($act=$this->getAutoCompleteType())!=='None') |
180 | 180 | { |
181 | 181 | if($act==='Disabled') |
182 | - $writer->addAttribute('autocomplete','off'); |
|
182 | + $writer->addAttribute('autocomplete', 'off'); |
|
183 | 183 | else if($act==='Search') |
184 | - $writer->addAttribute('vcard_name','search'); |
|
184 | + $writer->addAttribute('vcard_name', 'search'); |
|
185 | 185 | else if($act==='HomeCountryRegion') |
186 | - $writer->addAttribute('vcard_name','HomeCountry'); |
|
186 | + $writer->addAttribute('vcard_name', 'HomeCountry'); |
|
187 | 187 | else if($act==='BusinessCountryRegion') |
188 | - $writer->addAttribute('vcard_name','BusinessCountry'); |
|
188 | + $writer->addAttribute('vcard_name', 'BusinessCountry'); |
|
189 | 189 | else |
190 | 190 | { |
191 | - if(strpos($act,'Business')===0) |
|
192 | - $act='Business'.'.'.substr($act,8); |
|
193 | - else if(strpos($act,'Home')===0) |
|
194 | - $act='Home'.'.'.substr($act,4); |
|
195 | - $writer->addAttribute('vcard_name','vCard.'.$act); |
|
191 | + if(strpos($act, 'Business')===0) |
|
192 | + $act='Business'.'.'.substr($act, 8); |
|
193 | + else if(strpos($act, 'Home')===0) |
|
194 | + $act='Home'.'.'.substr($act, 4); |
|
195 | + $writer->addAttribute('vcard_name', 'vCard.'.$act); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | - if(($cols=$this->getColumns())>0) |
|
200 | - $writer->addAttribute('size',"$cols"); |
|
201 | - if(($maxLength=$this->getMaxLength())>0) |
|
202 | - $writer->addAttribute('maxlength',"$maxLength"); |
|
199 | + if(($cols=$this->getColumns()) > 0) |
|
200 | + $writer->addAttribute('size', "$cols"); |
|
201 | + if(($maxLength=$this->getMaxLength()) > 0) |
|
202 | + $writer->addAttribute('maxlength', "$maxLength"); |
|
203 | 203 | } |
204 | 204 | if($this->getReadOnly()) |
205 | - $writer->addAttribute('readonly','readonly'); |
|
205 | + $writer->addAttribute('readonly', 'readonly'); |
|
206 | 206 | $isEnabled=$this->getEnabled(true); |
207 | 207 | if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
208 | - $writer->addAttribute('disabled','disabled'); |
|
208 | + $writer->addAttribute('disabled', 'disabled'); |
|
209 | 209 | if($isEnabled |
210 | 210 | && $this->getEnableClientScript() |
211 | - && ( $this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine) |
|
211 | + && ($this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine) |
|
212 | 212 | && $page->getClientSupportsJavaScript()) |
213 | 213 | { |
214 | 214 | $this->renderClientControlScript($writer); |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function renderClientControlScript($writer) |
223 | 223 | { |
224 | - $writer->addAttribute('id',$this->getClientID()); |
|
225 | - $cs = $this->getPage()->getClientScript(); |
|
226 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
224 | + $writer->addAttribute('id', $this->getClientID()); |
|
225 | + $cs=$this->getPage()->getClientScript(); |
|
226 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | */ |
243 | 243 | protected function getPostBackOptions() |
244 | 244 | { |
245 | - $options['ID'] = $this->getClientID(); |
|
246 | - $options['EventTarget'] = $this->getUniqueID(); |
|
247 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
248 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
249 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
250 | - $options['TextMode'] = $this->getTextMode(); |
|
245 | + $options['ID']=$this->getClientID(); |
|
246 | + $options['EventTarget']=$this->getUniqueID(); |
|
247 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
248 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
249 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
250 | + $options['TextMode']=$this->getTextMode(); |
|
251 | 251 | return $options; |
252 | 252 | } |
253 | 253 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param array the input data collection |
259 | 259 | * @return boolean whether the data of the component has been changed |
260 | 260 | */ |
261 | - public function loadPostData($key,$values) |
|
261 | + public function loadPostData($key, $values) |
|
262 | 262 | { |
263 | 263 | $value=$values[$key]; |
264 | 264 | if($this->getAutoTrim()) |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function onTextChanged($param) |
321 | 321 | { |
322 | - $this->raiseEvent('OnTextChanged',$this,$param); |
|
322 | + $this->raiseEvent('OnTextChanged', $this, $param); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | */ |
364 | 364 | public function getAutoCompleteType() |
365 | 365 | { |
366 | - return $this->getViewState('AutoCompleteType',TTextBoxAutoCompleteType::None); |
|
366 | + return $this->getViewState('AutoCompleteType', TTextBoxAutoCompleteType::None); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function setAutoCompleteType($value) |
374 | 374 | { |
375 | - $this->setViewState('AutoCompleteType',TPropertyValue::ensureEnum($value,'TTextBoxAutoCompleteType'),TTextBoxAutoCompleteType::None); |
|
375 | + $this->setViewState('AutoCompleteType', TPropertyValue::ensureEnum($value, 'TTextBoxAutoCompleteType'), TTextBoxAutoCompleteType::None); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public function getAutoPostBack() |
384 | 384 | { |
385 | - return $this->getViewState('AutoPostBack',false); |
|
385 | + return $this->getViewState('AutoPostBack', false); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | /** |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | */ |
394 | 394 | public function setAutoPostBack($value) |
395 | 395 | { |
396 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false); |
|
396 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public function getAutoTrim() |
403 | 403 | { |
404 | - return $this->getViewState('AutoTrim',false); |
|
404 | + return $this->getViewState('AutoTrim', false); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | */ |
411 | 411 | public function setAutoTrim($value) |
412 | 412 | { |
413 | - $this->setViewState('AutoTrim',TPropertyValue::ensureBoolean($value),false); |
|
413 | + $this->setViewState('AutoTrim', TPropertyValue::ensureBoolean($value), false); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function getCausesValidation() |
420 | 420 | { |
421 | - return $this->getViewState('CausesValidation',true); |
|
421 | + return $this->getViewState('CausesValidation', true); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | */ |
427 | 427 | public function setCausesValidation($value) |
428 | 428 | { |
429 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
429 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | /** |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function getColumns() |
436 | 436 | { |
437 | - return $this->getViewState('Columns',0); |
|
437 | + return $this->getViewState('Columns', 0); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | */ |
444 | 444 | public function setColumns($value) |
445 | 445 | { |
446 | - $this->setViewState('Columns',TPropertyValue::ensureInteger($value),0); |
|
446 | + $this->setViewState('Columns', TPropertyValue::ensureInteger($value), 0); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | */ |
452 | 452 | public function getMaxLength() |
453 | 453 | { |
454 | - return $this->getViewState('MaxLength',0); |
|
454 | + return $this->getViewState('MaxLength', 0); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | /** |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | public function setMaxLength($value) |
462 | 462 | { |
463 | - $this->setViewState('MaxLength',TPropertyValue::ensureInteger($value),0); |
|
463 | + $this->setViewState('MaxLength', TPropertyValue::ensureInteger($value), 0); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function getReadOnly() |
470 | 470 | { |
471 | - return $this->getViewState('ReadOnly',false); |
|
471 | + return $this->getViewState('ReadOnly', false); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | */ |
477 | 477 | public function setReadOnly($value) |
478 | 478 | { |
479 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
479 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | */ |
485 | 485 | public function getRows() |
486 | 486 | { |
487 | - return $this->getViewState('Rows',self::DEFAULT_ROWS); |
|
487 | + return $this->getViewState('Rows', self::DEFAULT_ROWS); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | /** |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | */ |
494 | 494 | public function setRows($value) |
495 | 495 | { |
496 | - $this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS); |
|
496 | + $this->setViewState('Rows', TPropertyValue::ensureInteger($value), self::DEFAULT_ROWS); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | /** |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | */ |
502 | 502 | public function getPersistPassword() |
503 | 503 | { |
504 | - return $this->getViewState('PersistPassword',false); |
|
504 | + return $this->getViewState('PersistPassword', false); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | /** |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | */ |
510 | 510 | public function setPersistPassword($value) |
511 | 511 | { |
512 | - $this->setViewState('PersistPassword',TPropertyValue::ensureBoolean($value),false); |
|
512 | + $this->setViewState('PersistPassword', TPropertyValue::ensureBoolean($value), false); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function getText() |
519 | 519 | { |
520 | - return $this->getViewState('Text',''); |
|
520 | + return $this->getViewState('Text', ''); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function setText($value) |
528 | 528 | { |
529 | - $this->setViewState('Text',TPropertyValue::ensureString($value),''); |
|
530 | - $this->_safeText = null; |
|
529 | + $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
|
530 | + $this->_safeText=null; |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | protected function getSafeTextParser() |
573 | 573 | { |
574 | 574 | if(!self::$_safeTextParser) |
575 | - self::$_safeTextParser= new \HTMLPurifier($this->getConfig()); |
|
575 | + self::$_safeTextParser=new \HTMLPurifier($this->getConfig()); |
|
576 | 576 | return self::$_safeTextParser; |
577 | 577 | } |
578 | 578 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | */ |
582 | 582 | public function getTextMode() |
583 | 583 | { |
584 | - return $this->getViewState('TextMode',TTextBoxMode::SingleLine); |
|
584 | + return $this->getViewState('TextMode', TTextBoxMode::SingleLine); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | */ |
592 | 592 | public function setTextMode($value) |
593 | 593 | { |
594 | - $this->setViewState('TextMode',TPropertyValue::ensureEnum($value,'TTextBoxMode'),TTextBoxMode::SingleLine); |
|
594 | + $this->setViewState('TextMode', TPropertyValue::ensureEnum($value, 'TTextBoxMode'), TTextBoxMode::SingleLine); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | /** |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | */ |
600 | 600 | public function getValidationGroup() |
601 | 601 | { |
602 | - return $this->getViewState('ValidationGroup',''); |
|
602 | + return $this->getViewState('ValidationGroup', ''); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | */ |
608 | 608 | public function setValidationGroup($value) |
609 | 609 | { |
610 | - $this->setViewState('ValidationGroup',$value,''); |
|
610 | + $this->setViewState('ValidationGroup', $value, ''); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | */ |
616 | 616 | public function getWrap() |
617 | 617 | { |
618 | - return $this->getViewState('Wrap',true); |
|
618 | + return $this->getViewState('Wrap', true); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function setWrap($value) |
626 | 626 | { |
627 | - $this->setViewState('Wrap',TPropertyValue::ensureBoolean($value),true); |
|
627 | + $this->setViewState('Wrap', TPropertyValue::ensureBoolean($value), true); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | /** |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | */ |
642 | 642 | public function getConfig() |
643 | 643 | { |
644 | - $config = $this->getViewState('Config', null); |
|
645 | - return ($config === null) ? \HTMLPurifier_Config::createDefault() : $config; |
|
644 | + $config=$this->getViewState('Config', null); |
|
645 | + return ($config===null) ? \HTMLPurifier_Config::createDefault() : $config; |
|
646 | 646 | } |
647 | 647 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | /** |
286 | 286 | * Returns the value to be validated. |
287 | 287 | * This methid is required by \Prado\Web\UI\IValidatable interface. |
288 | - * @return mixed the value of the property to be validated. |
|
288 | + * @return string the value of the property to be validated. |
|
289 | 289 | */ |
290 | 290 | public function getValidationPropertyValue() |
291 | 291 | { |
@@ -390,6 +390,7 @@ discard block |
||
390 | 390 | * An automatic postback to the server will occur whenever the user |
391 | 391 | * modifies the text in the TTextBox control and then tabs out of the component. |
392 | 392 | * @param boolean the value indicating if postback automatically |
393 | + * @param boolean $value |
|
393 | 394 | */ |
394 | 395 | public function setAutoPostBack($value) |
395 | 396 | { |
@@ -473,6 +474,7 @@ discard block |
||
473 | 474 | |
474 | 475 | /** |
475 | 476 | * @param boolean whether the textbox is read only |
477 | + * @param boolean $value |
|
476 | 478 | */ |
477 | 479 | public function setReadOnly($value) |
478 | 480 | { |
@@ -120,8 +120,7 @@ discard block |
||
120 | 120 | $writer->addAttribute('cols',"$cols"); |
121 | 121 | if(!$this->getWrap()) |
122 | 122 | $writer->addAttribute('wrap','off'); |
123 | - } |
|
124 | - else |
|
123 | + } else |
|
125 | 124 | { |
126 | 125 | switch($textMode) |
127 | 126 | { |
@@ -267,8 +266,7 @@ discard block |
||
267 | 266 | { |
268 | 267 | $this->setText($value); |
269 | 268 | return $this->_dataChanged=true; |
270 | - } |
|
271 | - else |
|
269 | + } else |
|
272 | 270 | return false; |
273 | 271 | } |
274 | 272 |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | $font=dirname(__FILE__).DIRECTORY_SEPARATOR.'verase.ttf'; |
101 | 101 | |
102 | 102 | if(function_exists('imagefilter')) |
103 | - imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR); |
|
103 | + imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR); |
|
104 | 104 | |
105 | 105 | $hasShadow=($theme&THEME_SHADOWED_TEXT); |
106 | - for($i=0;$i<$length;$i++) |
|
106 | + for($i=0;$i<$length;$i++) |
|
107 | 107 | { |
108 | - $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
|
109 | - $size=rand($fontWidth-10,$fontWidth); |
|
110 | - $angle=rand(-30,30); |
|
111 | - $x=$padding+$i*$fontWidth; |
|
112 | - $y=rand($fontHeight-15,$fontHeight-10); |
|
113 | - imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]); |
|
114 | - if($hasShadow) |
|
115 | - imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]); |
|
116 | - imagecolordeallocate($image,$color); |
|
117 | - } |
|
108 | + $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
|
109 | + $size=rand($fontWidth-10,$fontWidth); |
|
110 | + $angle=rand(-30,30); |
|
111 | + $x=$padding+$i*$fontWidth; |
|
112 | + $y=rand($fontHeight-15,$fontHeight-10); |
|
113 | + imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]); |
|
114 | + if($hasShadow) |
|
115 | + imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]); |
|
116 | + imagecolordeallocate($image,$color); |
|
117 | + } |
|
118 | 118 | |
119 | 119 | header('Content-Type: image/png'); |
120 | 120 | imagepng($image); |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | { |
159 | 159 | $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
160 | 160 | imagesetpixel($image,$x,$y,$color); |
161 | - imagecolordeallocate($image,$color); |
|
162 | - } |
|
161 | + imagecolordeallocate($image,$color); |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | |
12 | 12 | namespace Prado\Web\UI\WebControls\assets; |
13 | 13 | |
14 | -define('THEME_OPAQUE_BACKGROUND',0x0001); |
|
15 | -define('THEME_NOISY_BACKGROUND',0x0002); |
|
16 | -define('THEME_HAS_GRID',0x0004); |
|
17 | -define('THEME_HAS_SCRIBBLE',0x0008); |
|
18 | -define('THEME_MORPH_BACKGROUND',0x0010); |
|
19 | -define('THEME_SHADOWED_TEXT',0x0020); |
|
14 | +define('THEME_OPAQUE_BACKGROUND', 0x0001); |
|
15 | +define('THEME_NOISY_BACKGROUND', 0x0002); |
|
16 | +define('THEME_HAS_GRID', 0x0004); |
|
17 | +define('THEME_HAS_SCRIBBLE', 0x0008); |
|
18 | +define('THEME_MORPH_BACKGROUND', 0x0010); |
|
19 | +define('THEME_SHADOWED_TEXT', 0x0020); |
|
20 | 20 | |
21 | 21 | require_once(dirname(__FILE__).'/captcha_key.php'); |
22 | 22 | |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | if(isset($_GET['options'])) |
27 | 27 | { |
28 | 28 | $str=base64_decode($_GET['options']); |
29 | - if(strlen($str)>32) |
|
29 | + if(strlen($str) > 32) |
|
30 | 30 | { |
31 | - $hash=substr($str,0,32); |
|
32 | - $str=substr($str,32); |
|
31 | + $hash=substr($str, 0, 32); |
|
32 | + $str=substr($str, 32); |
|
33 | 33 | if(md5($privateKey.$str)===$hash) |
34 | 34 | { |
35 | 35 | $options=unserialize($str); |
@@ -39,83 +39,82 @@ discard block |
||
39 | 39 | $alphabet=$options['alphabet']; |
40 | 40 | $fontSize=$options['fontSize']; |
41 | 41 | $theme=$options['theme']; |
42 | - if(($randomSeed=$options['randomSeed'])>0) |
|
42 | + if(($randomSeed=$options['randomSeed']) > 0) |
|
43 | 43 | srand($randomSeed); |
44 | 44 | else |
45 | - srand((int)(microtime()*1000000)); |
|
46 | - $token=generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive); |
|
45 | + srand((int) (microtime() * 1000000)); |
|
46 | + $token=generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | -displayToken($token,$fontSize,$theme); |
|
51 | +displayToken($token, $fontSize, $theme); |
|
52 | 52 | |
53 | -function generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive) |
|
53 | +function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive) |
|
54 | 54 | { |
55 | - $token=substr(hash2string(md5($publicKey.$privateKey),$alphabet).hash2string(md5($privateKey.$publicKey),$alphabet),0,$tokenLength); |
|
56 | - return $caseSensitive?$token:strtoupper($token); |
|
55 | + $token=substr(hash2string(md5($publicKey.$privateKey), $alphabet).hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength); |
|
56 | + return $caseSensitive ? $token : strtoupper($token); |
|
57 | 57 | } |
58 | 58 | |
59 | -function hash2string($hex,$alphabet) |
|
59 | +function hash2string($hex, $alphabet) |
|
60 | 60 | { |
61 | - if(strlen($alphabet)<2) |
|
61 | + if(strlen($alphabet) < 2) |
|
62 | 62 | $alphabet='234578adefhijmnrtABDEFGHJLMNRT'; |
63 | 63 | $hexLength=strlen($hex); |
64 | 64 | $base=strlen($alphabet); |
65 | 65 | $result=''; |
66 | - for($i=0;$i<$hexLength;$i+=6) |
|
66 | + for($i=0; $i < $hexLength; $i+=6) |
|
67 | 67 | { |
68 | - $number=hexdec(substr($hex,$i,6)); |
|
68 | + $number=hexdec(substr($hex, $i, 6)); |
|
69 | 69 | while($number) |
70 | 70 | { |
71 | - $result.=$alphabet[$number%$base]; |
|
72 | - $number=floor($number/$base); |
|
71 | + $result.=$alphabet[$number % $base]; |
|
72 | + $number=floor($number / $base); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | return $result; |
76 | 76 | } |
77 | 77 | |
78 | -function displayToken($token,$fontSize,$theme) |
|
78 | +function displayToken($token, $fontSize, $theme) |
|
79 | 79 | { |
80 | - if(($fontSize=(int)$fontSize)<22) |
|
80 | + if(($fontSize=(int) $fontSize) < 22) |
|
81 | 81 | $fontSize=22; |
82 | - if($fontSize>100) |
|
82 | + if($fontSize > 100) |
|
83 | 83 | $fontSize=100; |
84 | 84 | $length=strlen($token); |
85 | 85 | $padding=10; |
86 | 86 | $fontWidth=$fontSize; |
87 | - $fontHeight=floor($fontWidth*1.5); |
|
88 | - $width=$fontWidth*$length+$padding*2; |
|
87 | + $fontHeight=floor($fontWidth * 1.5); |
|
88 | + $width=$fontWidth * $length + $padding * 2; |
|
89 | 89 | $height=$fontHeight; |
90 | - $image=imagecreatetruecolor($width,$height); |
|
90 | + $image=imagecreatetruecolor($width, $height); |
|
91 | 91 | |
92 | - addBackground |
|
93 | - ( |
|
92 | + addBackground( |
|
94 | 93 | $image, $width, $height, |
95 | - $theme&THEME_OPAQUE_BACKGROUND, |
|
96 | - $theme&THEME_NOISY_BACKGROUND, |
|
97 | - $theme&THEME_HAS_GRID, |
|
98 | - $theme&THEME_HAS_SCRIBBLE, |
|
99 | - $theme&THEME_MORPH_BACKGROUND |
|
94 | + $theme & THEME_OPAQUE_BACKGROUND, |
|
95 | + $theme & THEME_NOISY_BACKGROUND, |
|
96 | + $theme & THEME_HAS_GRID, |
|
97 | + $theme & THEME_HAS_SCRIBBLE, |
|
98 | + $theme & THEME_MORPH_BACKGROUND |
|
100 | 99 | ); |
101 | 100 | |
102 | 101 | $font=dirname(__FILE__).DIRECTORY_SEPARATOR.'verase.ttf'; |
103 | 102 | |
104 | 103 | if(function_exists('imagefilter')) |
105 | - imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR); |
|
104 | + imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR); |
|
106 | 105 | |
107 | - $hasShadow=($theme&THEME_SHADOWED_TEXT); |
|
108 | - for($i=0;$i<$length;$i++) |
|
106 | + $hasShadow=($theme & THEME_SHADOWED_TEXT); |
|
107 | + for($i=0; $i < $length; $i++) |
|
109 | 108 | { |
110 | - $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
|
111 | - $size=rand($fontWidth-10,$fontWidth); |
|
112 | - $angle=rand(-30,30); |
|
113 | - $x=$padding+$i*$fontWidth; |
|
114 | - $y=rand($fontHeight-15,$fontHeight-10); |
|
115 | - imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]); |
|
109 | + $color=imagecolorallocate($image, rand(150, 220), rand(150, 220), rand(150, 220)); |
|
110 | + $size=rand($fontWidth - 10, $fontWidth); |
|
111 | + $angle=rand(-30, 30); |
|
112 | + $x=$padding + $i * $fontWidth; |
|
113 | + $y=rand($fontHeight - 15, $fontHeight - 10); |
|
114 | + imagettftext($image, $size, $angle, $x, $y, $color, $font, $token[$i]); |
|
116 | 115 | if($hasShadow) |
117 | - imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]); |
|
118 | - imagecolordeallocate($image,$color); |
|
116 | + imagettftext($image, $size, $angle, $x + 2, $y + 2, $color, $font, $token[$i]); |
|
117 | + imagecolordeallocate($image, $color); |
|
119 | 118 | } |
120 | 119 | |
121 | 120 | header('Content-Type: image/png'); |
@@ -123,103 +122,103 @@ discard block |
||
123 | 122 | imagedestroy($image); |
124 | 123 | } |
125 | 124 | |
126 | -function addBackground($image,$width,$height,$opaque,$noisy,$hasGrid,$hasScribble,$morph) |
|
125 | +function addBackground($image, $width, $height, $opaque, $noisy, $hasGrid, $hasScribble, $morph) |
|
127 | 126 | { |
128 | - $background=imagecreatetruecolor($width*2,$height*2); |
|
129 | - $white=imagecolorallocate($background,255,255,255); |
|
130 | - imagefill($background,0,0,$white); |
|
127 | + $background=imagecreatetruecolor($width * 2, $height * 2); |
|
128 | + $white=imagecolorallocate($background, 255, 255, 255); |
|
129 | + imagefill($background, 0, 0, $white); |
|
131 | 130 | |
132 | 131 | if($opaque) |
133 | - imagefill($background,0,0,imagecolorallocate($background,100,100,100)); |
|
132 | + imagefill($background, 0, 0, imagecolorallocate($background, 100, 100, 100)); |
|
134 | 133 | |
135 | 134 | if($noisy) |
136 | - addNoise($background,$width*2,$height*2); |
|
135 | + addNoise($background, $width * 2, $height * 2); |
|
137 | 136 | |
138 | 137 | if($hasGrid) |
139 | - addGrid($background,$width*2,$height*2); |
|
138 | + addGrid($background, $width * 2, $height * 2); |
|
140 | 139 | |
141 | 140 | if($hasScribble) |
142 | - addScribble($background,$width*2,$height*2); |
|
141 | + addScribble($background, $width * 2, $height * 2); |
|
143 | 142 | |
144 | 143 | if($morph) |
145 | - morphImage($background,$width*2,$height*2); |
|
144 | + morphImage($background, $width * 2, $height * 2); |
|
146 | 145 | |
147 | - imagecopy($image,$background,0,0,30,30,$width,$height); |
|
146 | + imagecopy($image, $background, 0, 0, 30, 30, $width, $height); |
|
148 | 147 | |
149 | 148 | if(!$opaque) |
150 | - imagecolortransparent($image,$white); |
|
149 | + imagecolortransparent($image, $white); |
|
151 | 150 | } |
152 | 151 | |
153 | -function addNoise($image,$width,$height) |
|
152 | +function addNoise($image, $width, $height) |
|
154 | 153 | { |
155 | - for($x=0;$x<$width;++$x) |
|
154 | + for($x=0; $x < $width; ++$x) |
|
156 | 155 | { |
157 | - for($y=0;$y<$height;++$y) |
|
156 | + for($y=0; $y < $height; ++$y) |
|
158 | 157 | { |
159 | - if(rand(0,100)<25) |
|
158 | + if(rand(0, 100) < 25) |
|
160 | 159 | { |
161 | - $color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220)); |
|
162 | - imagesetpixel($image,$x,$y,$color); |
|
163 | - imagecolordeallocate($image,$color); |
|
160 | + $color=imagecolorallocate($image, rand(150, 220), rand(150, 220), rand(150, 220)); |
|
161 | + imagesetpixel($image, $x, $y, $color); |
|
162 | + imagecolordeallocate($image, $color); |
|
164 | 163 | } |
165 | 164 | } |
166 | 165 | } |
167 | 166 | } |
168 | 167 | |
169 | -function addGrid($image,$width,$height) |
|
168 | +function addGrid($image, $width, $height) |
|
170 | 169 | { |
171 | - for($i=0;$i<$width;$i+=rand(15,25)) |
|
170 | + for($i=0; $i < $width; $i+=rand(15, 25)) |
|
172 | 171 | { |
173 | - imagesetthickness($image,rand(2,6)); |
|
174 | - $color=imagecolorallocate($image,rand(100,180),rand(100,180),rand(100,180)); |
|
175 | - imageline($image,$i+rand(-10,20),0,$i+rand(-10,20),$height,$color); |
|
176 | - imagecolordeallocate($image,$color); |
|
172 | + imagesetthickness($image, rand(2, 6)); |
|
173 | + $color=imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180)); |
|
174 | + imageline($image, $i + rand(-10, 20), 0, $i + rand(-10, 20), $height, $color); |
|
175 | + imagecolordeallocate($image, $color); |
|
177 | 176 | } |
178 | - for($i=0;$i<$height;$i+=rand(15,25)) |
|
177 | + for($i=0; $i < $height; $i+=rand(15, 25)) |
|
179 | 178 | { |
180 | - imagesetthickness($image,rand(2,6)); |
|
181 | - $color=imagecolorallocate($image,rand(100,180),rand(100,180),rand(100,180)); |
|
182 | - imageline($image,0,$i+rand(-10,20),$width,$i+rand(-10,20),$color); |
|
183 | - imagecolordeallocate($image,$color); |
|
179 | + imagesetthickness($image, rand(2, 6)); |
|
180 | + $color=imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180)); |
|
181 | + imageline($image, 0, $i + rand(-10, 20), $width, $i + rand(-10, 20), $color); |
|
182 | + imagecolordeallocate($image, $color); |
|
184 | 183 | } |
185 | 184 | } |
186 | 185 | |
187 | -function addScribble($image,$width,$height) |
|
186 | +function addScribble($image, $width, $height) |
|
188 | 187 | { |
189 | - for($i=0;$i<8;$i++) |
|
188 | + for($i=0; $i < 8; $i++) |
|
190 | 189 | { |
191 | - $color=imagecolorallocate($image,rand(100,180),rand(100,180),rand(100,180)); |
|
190 | + $color=imagecolorallocate($image, rand(100, 180), rand(100, 180), rand(100, 180)); |
|
192 | 191 | $points=array(); |
193 | - for($j=1;$j<rand(5,10);$j++) |
|
192 | + for($j=1; $j < rand(5, 10); $j++) |
|
194 | 193 | { |
195 | - $points[]=rand(2*(20*($i+1)),2*(50*($i+1))); |
|
196 | - $points[]=rand(30,$height+30); |
|
194 | + $points[]=rand(2 * (20 * ($i + 1)), 2 * (50 * ($i + 1))); |
|
195 | + $points[]=rand(30, $height + 30); |
|
197 | 196 | } |
198 | - imagesetthickness($image,rand(2,6)); |
|
199 | - imagepolygon($image,$points,intval(sizeof($points)/2),$color); |
|
200 | - imagecolordeallocate($image,$color); |
|
197 | + imagesetthickness($image, rand(2, 6)); |
|
198 | + imagepolygon($image, $points, intval(sizeof($points) / 2), $color); |
|
199 | + imagecolordeallocate($image, $color); |
|
201 | 200 | } |
202 | 201 | } |
203 | 202 | |
204 | -function morphImage($image,$width,$height) |
|
203 | +function morphImage($image, $width, $height) |
|
205 | 204 | { |
206 | - $tempImage=imagecreatetruecolor($width,$height); |
|
207 | - $chunk=rand(1,5); |
|
208 | - for($x=$y=0;$x<$width;$x+=$chunk) |
|
205 | + $tempImage=imagecreatetruecolor($width, $height); |
|
206 | + $chunk=rand(1, 5); |
|
207 | + for($x=$y=0; $x < $width; $x+=$chunk) |
|
209 | 208 | { |
210 | - $chunk=rand(1,5); |
|
211 | - $y+=rand(-1,1); |
|
212 | - if($y>=$height) $y=$height-5; |
|
213 | - if($y<0) $y=5; |
|
214 | - imagecopy($tempImage,$image,$x,0,$x,$y,$chunk,$height); |
|
209 | + $chunk=rand(1, 5); |
|
210 | + $y+=rand(-1, 1); |
|
211 | + if($y >= $height) $y=$height - 5; |
|
212 | + if($y < 0) $y=5; |
|
213 | + imagecopy($tempImage, $image, $x, 0, $x, $y, $chunk, $height); |
|
215 | 214 | } |
216 | - for($x=$y=0;$y<$height;$y+=$chunk) |
|
215 | + for($x=$y=0; $y < $height; $y+=$chunk) |
|
217 | 216 | { |
218 | - $chunk=rand(1,5); |
|
219 | - $x+=rand(-1,1); |
|
220 | - if($x>=$width) $x=$width-5; |
|
221 | - if($x<0) $x=5; |
|
222 | - imagecopy($image,$tempImage,$x,$y,0,$y,$width,$chunk); |
|
217 | + $chunk=rand(1, 5); |
|
218 | + $x+=rand(-1, 1); |
|
219 | + if($x >= $width) $x=$width - 5; |
|
220 | + if($x < 0) $x=5; |
|
221 | + imagecopy($image, $tempImage, $x, $y, 0, $y, $width, $chunk); |
|
223 | 222 | } |
224 | 223 | } |
225 | 224 |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | - * Returns the index of the active tab view. |
|
85 | - * Note, this property may not return the correct index. |
|
86 | - * To ensure the correctness, call {@link getActiveView()} first. |
|
84 | + * Returns the index of the active tab view. |
|
85 | + * Note, this property may not return the correct index. |
|
86 | + * To ensure the correctness, call {@link getActiveView()} first. |
|
87 | 87 | * @return integer the zero-based index of the active tab view. If -1, it means no active tab view. Default is 0 (the first view is active). |
88 | 88 | */ |
89 | 89 | public function getActiveViewIndex() |
@@ -100,24 +100,24 @@ discard block |
||
100 | 100 | $this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0); |
101 | 101 | } |
102 | 102 | |
103 | - /** |
|
104 | - * Returns the ID of the active tab view. |
|
105 | - * Note, this property may not return the correct ID. |
|
106 | - * To ensure the correctness, call {@link getActiveView()} first. |
|
107 | - * @return string The ID of the active tab view. Defaults to '', meaning not set. |
|
108 | - */ |
|
109 | - public function getActiveViewID() |
|
110 | - { |
|
103 | + /** |
|
104 | + * Returns the ID of the active tab view. |
|
105 | + * Note, this property may not return the correct ID. |
|
106 | + * To ensure the correctness, call {@link getActiveView()} first. |
|
107 | + * @return string The ID of the active tab view. Defaults to '', meaning not set. |
|
108 | + */ |
|
109 | + public function getActiveViewID() |
|
110 | + { |
|
111 | 111 | return $this->getViewState('ActiveViewID',''); |
112 | - } |
|
112 | + } |
|
113 | 113 | |
114 | - /** |
|
115 | - * @param string The ID of the active tab view. |
|
116 | - */ |
|
117 | - public function setActiveViewID($value) |
|
118 | - { |
|
114 | + /** |
|
115 | + * @param string The ID of the active tab view. |
|
116 | + */ |
|
117 | + public function setActiveViewID($value) |
|
118 | + { |
|
119 | 119 | $this->setViewState('ActiveViewID',$value,''); |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Returns the currently active view. |
@@ -172,63 +172,63 @@ discard block |
||
172 | 172 | throw new TInvalidOperationException('tabpanel_view_inexistent'); |
173 | 173 | } |
174 | 174 | |
175 | - /** |
|
176 | - * @return bool status of automatic tab switch on hover |
|
177 | - */ |
|
178 | - public function getAutoSwitch() |
|
179 | - { |
|
180 | - return TPropertyValue::ensureBoolean($this->getViewState('AutoSwitch')); |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * @param bool whether to enable automatic tab switch on hover |
|
185 | - */ |
|
186 | - public function setAutoSwitch($value) |
|
187 | - { |
|
188 | - $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value)); |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - /** |
|
193 | - * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''. |
|
194 | - */ |
|
195 | - public function getCssUrl() |
|
196 | - { |
|
197 | - return $this->getViewState('CssUrl','default'); |
|
198 | - } |
|
199 | - |
|
200 | - /** |
|
201 | - * @param string URL for the CSS file including all relevant CSS class definitions. |
|
202 | - */ |
|
203 | - public function setCssUrl($value) |
|
204 | - { |
|
205 | - $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * @return string CSS class for the whole tab control div. Defaults to 'tab-panel'. |
|
210 | - */ |
|
211 | - public function getCssClass() |
|
212 | - { |
|
213 | - $cssClass=parent::getCssClass(); |
|
214 | - return $cssClass===''?'tab-panel':$cssClass; |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * @return string CSS class for the currently displayed view div. Defaults to 'tab-view'. |
|
219 | - */ |
|
220 | - public function getViewCssClass() |
|
221 | - { |
|
222 | - return $this->getViewStyle()->getCssClass(); |
|
223 | - } |
|
224 | - |
|
225 | - /** |
|
226 | - * @param string CSS class for the currently displayed view div. |
|
227 | - */ |
|
228 | - public function setViewCssClass($value) |
|
229 | - { |
|
230 | - $this->getViewStyle()->setCssClass($value); |
|
231 | - } |
|
175 | + /** |
|
176 | + * @return bool status of automatic tab switch on hover |
|
177 | + */ |
|
178 | + public function getAutoSwitch() |
|
179 | + { |
|
180 | + return TPropertyValue::ensureBoolean($this->getViewState('AutoSwitch')); |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * @param bool whether to enable automatic tab switch on hover |
|
185 | + */ |
|
186 | + public function setAutoSwitch($value) |
|
187 | + { |
|
188 | + $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value)); |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + /** |
|
193 | + * @return string URL for the CSS file including all relevant CSS class definitions. Defaults to ''. |
|
194 | + */ |
|
195 | + public function getCssUrl() |
|
196 | + { |
|
197 | + return $this->getViewState('CssUrl','default'); |
|
198 | + } |
|
199 | + |
|
200 | + /** |
|
201 | + * @param string URL for the CSS file including all relevant CSS class definitions. |
|
202 | + */ |
|
203 | + public function setCssUrl($value) |
|
204 | + { |
|
205 | + $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * @return string CSS class for the whole tab control div. Defaults to 'tab-panel'. |
|
210 | + */ |
|
211 | + public function getCssClass() |
|
212 | + { |
|
213 | + $cssClass=parent::getCssClass(); |
|
214 | + return $cssClass===''?'tab-panel':$cssClass; |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * @return string CSS class for the currently displayed view div. Defaults to 'tab-view'. |
|
219 | + */ |
|
220 | + public function getViewCssClass() |
|
221 | + { |
|
222 | + return $this->getViewStyle()->getCssClass(); |
|
223 | + } |
|
224 | + |
|
225 | + /** |
|
226 | + * @param string CSS class for the currently displayed view div. |
|
227 | + */ |
|
228 | + public function setViewCssClass($value) |
|
229 | + { |
|
230 | + $this->getViewStyle()->setCssClass($value); |
|
231 | + } |
|
232 | 232 | |
233 | 233 | /** |
234 | 234 | * @return TStyle the style for all the view div |
@@ -244,21 +244,21 @@ discard block |
||
244 | 244 | return $style; |
245 | 245 | } |
246 | 246 | |
247 | - /** |
|
248 | - * @return string CSS class for non-active tabs. Defaults to 'tab-normal'. |
|
249 | - */ |
|
250 | - public function getTabCssClass() |
|
251 | - { |
|
252 | - return $this->getTabStyle()->getCssClass(); |
|
253 | - } |
|
247 | + /** |
|
248 | + * @return string CSS class for non-active tabs. Defaults to 'tab-normal'. |
|
249 | + */ |
|
250 | + public function getTabCssClass() |
|
251 | + { |
|
252 | + return $this->getTabStyle()->getCssClass(); |
|
253 | + } |
|
254 | 254 | |
255 | - /** |
|
256 | - * @param string CSS class for non-active tabs. |
|
257 | - */ |
|
258 | - public function setTabCssClass($value) |
|
259 | - { |
|
260 | - $this->getTabStyle()->setCssClass($value); |
|
261 | - } |
|
255 | + /** |
|
256 | + * @param string CSS class for non-active tabs. |
|
257 | + */ |
|
258 | + public function setTabCssClass($value) |
|
259 | + { |
|
260 | + $this->getTabStyle()->setCssClass($value); |
|
261 | + } |
|
262 | 262 | |
263 | 263 | /** |
264 | 264 | * @return TStyle the style for all the inactive tab div |
@@ -274,21 +274,21 @@ discard block |
||
274 | 274 | return $style; |
275 | 275 | } |
276 | 276 | |
277 | - /** |
|
278 | - * @return string CSS class for the active tab. Defaults to 'tab-active'. |
|
279 | - */ |
|
280 | - public function getActiveTabCssClass() |
|
281 | - { |
|
282 | - return $this->getActiveTabStyle()->getCssClass(); |
|
283 | - } |
|
284 | - |
|
285 | - /** |
|
286 | - * @param string CSS class for the active tab. |
|
287 | - */ |
|
288 | - public function setActiveTabCssClass($value) |
|
289 | - { |
|
290 | - $this->getActiveTabStyle()->setCssClass($value); |
|
291 | - } |
|
277 | + /** |
|
278 | + * @return string CSS class for the active tab. Defaults to 'tab-active'. |
|
279 | + */ |
|
280 | + public function getActiveTabCssClass() |
|
281 | + { |
|
282 | + return $this->getActiveTabStyle()->getCssClass(); |
|
283 | + } |
|
284 | + |
|
285 | + /** |
|
286 | + * @param string CSS class for the active tab. |
|
287 | + */ |
|
288 | + public function setActiveTabCssClass($value) |
|
289 | + { |
|
290 | + $this->getActiveTabStyle()->setCssClass($value); |
|
291 | + } |
|
292 | 292 | |
293 | 293 | /** |
294 | 294 | * @return TStyle the style for the active tab div |
@@ -136,15 +136,13 @@ discard block |
||
136 | 136 | $activeView=$views->itemAt($index); |
137 | 137 | else |
138 | 138 | throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id); |
139 | - } |
|
140 | - else if(($index=$this->getActiveViewIndex())>=0) |
|
139 | + } else if(($index=$this->getActiveViewIndex())>=0) |
|
141 | 140 | { |
142 | 141 | if($index<$views->getCount()) |
143 | 142 | $activeView=$views->itemAt($index); |
144 | 143 | else |
145 | 144 | throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index); |
146 | - } |
|
147 | - else |
|
145 | + } else |
|
148 | 146 | { |
149 | 147 | foreach($views as $index=>$view) |
150 | 148 | { |
@@ -320,8 +318,7 @@ discard block |
||
320 | 318 | $this->setActiveViewIndex($index); |
321 | 319 | $this->setActiveViewID($view->getID(false)); |
322 | 320 | $view->setActive(true); |
323 | - } |
|
324 | - else |
|
321 | + } else |
|
325 | 322 | $v->setActive(false); |
326 | 323 | } |
327 | 324 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function getActiveViewIndex() |
96 | 96 | { |
97 | - return $this->getViewState('ActiveViewIndex',0); |
|
97 | + return $this->getViewState('ActiveViewIndex', 0); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function setActiveViewIndex($value) |
105 | 105 | { |
106 | - $this->setViewState('ActiveViewIndex',TPropertyValue::ensureInteger($value),0); |
|
106 | + $this->setViewState('ActiveViewIndex', TPropertyValue::ensureInteger($value), 0); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function getActiveViewID() |
116 | 116 | { |
117 | - return $this->getViewState('ActiveViewID',''); |
|
117 | + return $this->getViewState('ActiveViewID', ''); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function setActiveViewID($value) |
124 | 124 | { |
125 | - $this->setViewState('ActiveViewID',$value,''); |
|
125 | + $this->setViewState('ActiveViewID', $value, ''); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | $views=$this->getViews(); |
139 | 139 | if(($id=$this->getActiveViewID())!=='') |
140 | 140 | { |
141 | - if(($index=$views->findIndexByID($id))>=0) |
|
141 | + if(($index=$views->findIndexByID($id)) >= 0) |
|
142 | 142 | $activeView=$views->itemAt($index); |
143 | 143 | else |
144 | - throw new TInvalidDataValueException('tabpanel_activeviewid_invalid',$id); |
|
144 | + throw new TInvalidDataValueException('tabpanel_activeviewid_invalid', $id); |
|
145 | 145 | } |
146 | - else if(($index=$this->getActiveViewIndex())>=0) |
|
146 | + else if(($index=$this->getActiveViewIndex()) >= 0) |
|
147 | 147 | { |
148 | - if($index<$views->getCount()) |
|
148 | + if($index < $views->getCount()) |
|
149 | 149 | $activeView=$views->itemAt($index); |
150 | 150 | else |
151 | - throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid',$index); |
|
151 | + throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid', $index); |
|
152 | 152 | } |
153 | 153 | else |
154 | 154 | { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function setActiveView($view) |
174 | 174 | { |
175 | - if($this->getViews()->indexOf($view)>=0) |
|
175 | + if($this->getViews()->indexOf($view) >= 0) |
|
176 | 176 | $this->activateView($view); |
177 | 177 | else |
178 | 178 | throw new TInvalidOperationException('tabpanel_view_inexistent'); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function setAutoSwitch($value) |
193 | 193 | { |
194 | - $this->setViewState('AutoSwitch',TPropertyValue::ensureBoolean($value)); |
|
194 | + $this->setViewState('AutoSwitch', TPropertyValue::ensureBoolean($value)); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function getCssUrl() |
202 | 202 | { |
203 | - return $this->getViewState('CssUrl','default'); |
|
203 | + return $this->getViewState('CssUrl', 'default'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function setCssUrl($value) |
210 | 210 | { |
211 | - $this->setViewState('CssUrl',TPropertyValue::ensureString($value),''); |
|
211 | + $this->setViewState('CssUrl', TPropertyValue::ensureString($value), ''); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function getCssClass() |
218 | 218 | { |
219 | 219 | $cssClass=parent::getCssClass(); |
220 | - return $cssClass===''?'tab-panel':$cssClass; |
|
220 | + return $cssClass==='' ? 'tab-panel' : $cssClass; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function getViewStyle() |
243 | 243 | { |
244 | - if(($style=$this->getViewState('ViewStyle',null))===null) |
|
244 | + if(($style=$this->getViewState('ViewStyle', null))===null) |
|
245 | 245 | { |
246 | 246 | $style=new TStyle; |
247 | 247 | $style->setCssClass('tab-view'); |
248 | - $this->setViewState('ViewStyle',$style,null); |
|
248 | + $this->setViewState('ViewStyle', $style, null); |
|
249 | 249 | } |
250 | 250 | return $style; |
251 | 251 | } |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function getTabStyle() |
273 | 273 | { |
274 | - if(($style=$this->getViewState('TabStyle',null))===null) |
|
274 | + if(($style=$this->getViewState('TabStyle', null))===null) |
|
275 | 275 | { |
276 | 276 | $style=new TStyle; |
277 | 277 | $style->setCssClass('tab-normal'); |
278 | - $this->setViewState('TabStyle',$style,null); |
|
278 | + $this->setViewState('TabStyle', $style, null); |
|
279 | 279 | } |
280 | 280 | return $style; |
281 | 281 | } |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function getActiveTabStyle() |
303 | 303 | { |
304 | - if(($style=$this->getViewState('ActiveTabStyle',null))===null) |
|
304 | + if(($style=$this->getViewState('ActiveTabStyle', null))===null) |
|
305 | 305 | { |
306 | 306 | $style=new TStyle; |
307 | 307 | $style->setCssClass('tab-active'); |
308 | - $this->setViewState('ActiveTabStyle',$style,null); |
|
308 | + $this->setViewState('ActiveTabStyle', $style, null); |
|
309 | 309 | } |
310 | 310 | return $style; |
311 | 311 | } |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | * @param array the input data collection |
340 | 340 | * @return boolean whether the data of the control has been changed |
341 | 341 | */ |
342 | - public function loadPostData($key,$values) |
|
342 | + public function loadPostData($key, $values) |
|
343 | 343 | { |
344 | 344 | if(($index=$values[$this->getClientID().'_1'])!==null) |
345 | 345 | { |
346 | - $index=(int)$index; |
|
346 | + $index=(int) $index; |
|
347 | 347 | $currentIndex=$this->getActiveViewIndex(); |
348 | 348 | if($currentIndex!==$index) |
349 | 349 | { |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | protected function addAttributesToRender($writer) |
385 | 385 | { |
386 | - $writer->addAttribute('id',$this->getClientID()); |
|
386 | + $writer->addAttribute('id', $this->getClientID()); |
|
387 | 387 | $this->setCssClass($this->getCssClass()); |
388 | 388 | parent::addAttributesToRender($writer); |
389 | 389 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | public function onPreRender($param) |
397 | 397 | { |
398 | 398 | parent::onPreRender($param); |
399 | - $this->getActiveView(); // determine the active view |
|
399 | + $this->getActiveView(); // determine the active view |
|
400 | 400 | $this->registerStyleSheet(); |
401 | 401 | |
402 | 402 | $page=$this->getPage(); |
@@ -411,17 +411,17 @@ discard block |
||
411 | 411 | */ |
412 | 412 | protected function registerStyleSheet() |
413 | 413 | { |
414 | - $url = $this->getCssUrl(); |
|
414 | + $url=$this->getCssUrl(); |
|
415 | 415 | |
416 | - if($url === '') { |
|
416 | + if($url==='') { |
|
417 | 417 | return; |
418 | 418 | } |
419 | 419 | |
420 | - if($url === 'default') { |
|
421 | - $url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'tabpanel.css'); |
|
420 | + if($url==='default') { |
|
421 | + $url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'tabpanel.css'); |
|
422 | 422 | } |
423 | 423 | |
424 | - if($url !== '') { |
|
424 | + if($url!=='') { |
|
425 | 425 | $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
426 | 426 | } |
427 | 427 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $code="new $className($options);"; |
440 | 440 | $cs->registerEndScript("prado:$id", $code); |
441 | 441 | // ensure an item is always active and visible |
442 | - $index = $this->getActiveViewIndex(); |
|
442 | + $index=$this->getActiveViewIndex(); |
|
443 | 443 | if(!$this->getViews()->itemAt($index)->Visible) |
444 | 444 | $index=0; |
445 | 445 | $cs->registerHiddenField($id.'_1', $index); |
@@ -460,19 +460,19 @@ discard block |
||
460 | 460 | */ |
461 | 461 | protected function getClientOptions() |
462 | 462 | { |
463 | - $options['ID'] = $this->getClientID(); |
|
464 | - $options['ActiveCssClass'] = $this->getActiveTabCssClass(); |
|
465 | - $options['NormalCssClass'] = $this->getTabCssClass(); |
|
466 | - $viewIDs = array(); |
|
467 | - $viewVis = array(); |
|
463 | + $options['ID']=$this->getClientID(); |
|
464 | + $options['ActiveCssClass']=$this->getActiveTabCssClass(); |
|
465 | + $options['NormalCssClass']=$this->getTabCssClass(); |
|
466 | + $viewIDs=array(); |
|
467 | + $viewVis=array(); |
|
468 | 468 | foreach($this->getViews() as $view) |
469 | 469 | { |
470 | - $viewIDs[] = $view->getClientID(); |
|
471 | - $viewVis[] = $view->getVisible(); |
|
470 | + $viewIDs[]=$view->getClientID(); |
|
471 | + $viewVis[]=$view->getVisible(); |
|
472 | 472 | } |
473 | - $options['Views'] = $viewIDs; |
|
474 | - $options['ViewsVis'] = $viewVis; |
|
475 | - $options['AutoSwitch'] = $this->getAutoSwitch(); |
|
473 | + $options['Views']=$viewIDs; |
|
474 | + $options['ViewsVis']=$viewVis; |
|
475 | + $options['AutoSwitch']=$this->getAutoSwitch(); |
|
476 | 476 | |
477 | 477 | return $options; |
478 | 478 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | public function renderContents($writer) |
508 | 508 | { |
509 | 509 | $views=$this->getViews(); |
510 | - if($views->getCount()>0) |
|
510 | + if($views->getCount() > 0) |
|
511 | 511 | { |
512 | 512 | $writer->writeLine(); |
513 | 513 | // render tab bar |
@@ -32,8 +32,8 @@ |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @return boolean a value indicating whether an automatic postback to the server |
35 | - * will occur whenever the user modifies the text in the TActiveDatePicker control and |
|
36 | - * then tabs out of the component. Defaults to true. |
|
35 | + * will occur whenever the user modifies the text in the TActiveDatePicker control and |
|
36 | + * then tabs out of the component. Defaults to true. |
|
37 | 37 | */ |
38 | 38 | public function getAutoPostBack() |
39 | 39 | { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getAutoPostBack() |
48 | 48 | { |
49 | - return $this->getViewState('AutoPostBack',true); |
|
49 | + return $this->getViewState('AutoPostBack', true); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function setAutoPostBack($value) |
59 | 59 | { |
60 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true); |
|
60 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | */ |
67 | 67 | protected function getDatePickerOptions() |
68 | 68 | { |
69 | - $options = parent::getDatePickerOptions(); |
|
69 | + $options=parent::getDatePickerOptions(); |
|
70 | 70 | $options['CausesValidation']=$this->getCausesValidation(); |
71 | 71 | $options['ValidationGroup']=$this->getValidationGroup(); |
72 | - $options['EventTarget'] = $this->getUniqueID(); |
|
73 | - $options['ShowCalendar'] = $this->getShowCalendar(); |
|
74 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
72 | + $options['EventTarget']=$this->getUniqueID(); |
|
73 | + $options['ShowCalendar']=$this->getShowCalendar(); |
|
74 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
75 | 75 | return $options; |
76 | 76 | } |
77 | 77 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * @return TBaseActiveCallbackControl standard callback control options. |
91 | 91 | */ |
92 | - public function getActiveControl(){ |
|
92 | + public function getActiveControl() { |
|
93 | 93 | return $this->getAdapter()->getBaseActiveControl(); |
94 | 94 | } |
95 | 95 | |
@@ -97,21 +97,21 @@ discard block |
||
97 | 97 | * Client-side Text property can only be updated after the OnLoad stage. |
98 | 98 | * @param string text content for the textbox |
99 | 99 | */ |
100 | - public function setText($value){ |
|
101 | - if(parent::getText() === $value) |
|
100 | + public function setText($value) { |
|
101 | + if(parent::getText()===$value) |
|
102 | 102 | return; |
103 | 103 | |
104 | 104 | parent::setText($value); |
105 | - if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()){ |
|
105 | + if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) { |
|
106 | 106 | $cb=$this->getPage()->getCallbackClient(); |
107 | 107 | $cb->setValue($this, $value); |
108 | - if ($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
108 | + if($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
109 | 109 | { |
110 | - $s = new TDateTimeStamp; |
|
111 | - $date = $s->getDate($this->getTimeStampFromText()); |
|
110 | + $s=new TDateTimeStamp; |
|
111 | + $date=$s->getDate($this->getTimeStampFromText()); |
|
112 | 112 | $id=$this->getClientID(); |
113 | 113 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'day', 'Value', $date['mday'], 'select'); |
114 | - $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon']-1, 'select'); |
|
114 | + $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon'] - 1, 'select'); |
|
115 | 115 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'year', 'Value', $date['year'], 'select'); |
116 | 116 | |
117 | 117 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * This method is mainly used by framework and control developers. |
125 | 125 | * @param TCallbackEventParameter the event parameter |
126 | 126 | */ |
127 | - public function raiseCallbackEvent($param){ |
|
127 | + public function raiseCallbackEvent($param) { |
|
128 | 128 | $this->onCallback($param); |
129 | 129 | } |
130 | 130 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * handler can be invoked. |
136 | 136 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
137 | 137 | */ |
138 | - public function onCallback($param){ |
|
138 | + public function onCallback($param) { |
|
139 | 139 | $this->raiseEvent('OnCallback', $this, $param); |
140 | 140 | } |
141 | 141 | |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | |
146 | 146 | protected function registerCalendarClientScriptPre() |
147 | 147 | { |
148 | - $cs = $this->getPage()->getClientScript(); |
|
148 | + $cs=$this->getPage()->getClientScript(); |
|
149 | 149 | $cs->registerPradoScript("activedatepicker"); |
150 | 150 | } |
151 | 151 | |
152 | 152 | protected function renderClientControlScript($writer) |
153 | 153 | { |
154 | - $cs = $this->getPage()->getClientScript(); |
|
154 | + $cs=$this->getPage()->getClientScript(); |
|
155 | 155 | if(!$cs->isEndScriptRegistered('TDatePicker.spacer')) |
156 | 156 | { |
157 | - $spacer = $this->getAssetUrl('spacer.gif'); |
|
158 | - $code = "Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
157 | + $spacer=$this->getAssetUrl('spacer.gif'); |
|
158 | + $code="Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
159 | 159 | $cs->registerEndScript('TDatePicker.spacer', $code); |
160 | 160 | } |
161 | 161 | |
162 | - $options = TJavaScript::encode($this->getDatePickerOptions()); |
|
163 | - $code = "new Prado.WebUI.TActiveDatePicker($options);"; |
|
162 | + $options=TJavaScript::encode($this->getDatePickerOptions()); |
|
163 | + $code="new Prado.WebUI.TActiveDatePicker($options);"; |
|
164 | 164 | $cs->registerEndScript("prado:".$this->getClientID(), $code); |
165 | 165 | } |
166 | 166 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | class TActiveHiddenField extends THiddenField implements ICallbackEventHandler, IActiveControl |
24 | 24 | { |
25 | - /** |
|
25 | + /** |
|
26 | 26 | * Creates a new callback control, sets the adapter to |
27 | 27 | * TActiveControlAdapter. If you override this class, be sure to set the |
28 | 28 | * adapter appropriately by, for example, by calling this constructor. |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setValue($value) |
57 | 57 | { |
58 | - if(parent::getValue() === $value) |
|
58 | + if(parent::getValue()===$value) |
|
59 | 59 | return; |
60 | 60 | |
61 | 61 | parent::setValue($value); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | protected function addAttributesToRender($writer) |
112 | 112 | { |
113 | 113 | parent::addAttributesToRender($writer); |
114 | - $writer->addAttribute('id',$this->getClientID()); |
|
114 | + $writer->addAttribute('id', $this->getClientID()); |
|
115 | 115 | $this->getActiveControl()->registerCallbackClientScript( |
116 | 116 | $this->getClientClassName(), $this->getPostBackOptions()); |
117 | 117 | } |
@@ -60,8 +60,8 @@ |
||
60 | 60 | * @param THtmlWriter the writer used for the rendering purpose |
61 | 61 | */ |
62 | 62 | protected function addAttributesToRender($writer) { |
63 | - $writer->addAttribute('id',$this->getClientID()); |
|
64 | - parent::addAttributesToRender($writer); |
|
63 | + $writer->addAttribute('id',$this->getClientID()); |
|
64 | + parent::addAttributesToRender($writer); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param THtmlWriter the writer used for the rendering purpose |
65 | 65 | */ |
66 | 66 | protected function addAttributesToRender($writer) { |
67 | - $writer->addAttribute('id',$this->getClientID()); |
|
67 | + $writer->addAttribute('id', $this->getClientID()); |
|
68 | 68 | parent::addAttributesToRender($writer); |
69 | 69 | } |
70 | 70 | |
@@ -81,17 +81,17 @@ discard block |
||
81 | 81 | { |
82 | 82 | parent::render($writer); |
83 | 83 | if($this->getActiveControl()->canUpdateClientSide()) |
84 | - $this->getPage()->getCallbackClient()->replaceContent($this,$writer); |
|
84 | + $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
85 | 85 | } |
86 | 86 | else |
87 | 87 | { |
88 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
89 | - if ($this->getHasControls()) |
|
88 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
89 | + if($this->getHasControls()) |
|
90 | 90 | { |
91 | 91 | // If we update a TActivePanel on callback, |
92 | 92 | // We shouldn't update all childs, because the whole content will be replaced by |
93 | 93 | // the parent |
94 | - foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) |
|
94 | + foreach($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) |
|
95 | 95 | { |
96 | 96 | $control->getActiveControl()->setEnableUpdate(false); |
97 | 97 | } |
@@ -82,8 +82,7 @@ |
||
82 | 82 | parent::render($writer); |
83 | 83 | if($this->getActiveControl()->canUpdateClientSide()) |
84 | 84 | $this->getPage()->getCallbackClient()->replaceContent($this,$writer); |
85 | - } |
|
86 | - else |
|
85 | + } else |
|
87 | 86 | { |
88 | 87 | $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
89 | 88 | if ($this->getHasControls()) |
@@ -116,7 +116,7 @@ |
||
116 | 116 | && $this->getPage()->getClientSupportsJavaScript()) |
117 | 117 | { |
118 | 118 | $this->getActiveControl()->registerCallbackClientScript( |
119 | - $this->getClientClassName(), $this->getPostBackOptions()); |
|
119 | + $this->getClientClassName(), $this->getPostBackOptions()); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 |
@@ -87,7 +87,7 @@ |
||
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Creates a control used for repetition (used as a template). |
90 | - * @return TControl the control to be repeated |
|
90 | + * @return TActiveCheckBoxListItem the control to be repeated |
|
91 | 91 | */ |
92 | 92 | protected function createRepeatedControl() |
93 | 93 | { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * updated later. |
73 | 73 | *@return boolean always true |
74 | 74 | */ |
75 | - protected function getSpanNeeded () |
|
75 | + protected function getSpanNeeded() |
|
76 | 76 | { |
77 | 77 | return true; |
78 | 78 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | protected function createRepeatedControl() |
93 | 93 | { |
94 | - $control = new TActiveCheckBoxListItem; |
|
94 | + $control=new TActiveCheckBoxListItem; |
|
95 | 95 | $control->getAdapter()->setBaseActiveControl($this->getActiveControl()); |
96 | 96 | return $control; |
97 | 97 | } |
@@ -238,90 +238,90 @@ |
||
238 | 238 | parent::initRecursive($namingContainer); |
239 | 239 | } |
240 | 240 | |
241 | - /** |
|
242 | - * Function to update view controls with data in a given AR object. |
|
243 | - * View controls and AR object need to have the same name in IDs and Attrs respectively. |
|
244 | - * @param TActiveRecord $arObj |
|
245 | - * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
246 | - * @author Daniel Sampedro <[email protected]> |
|
247 | - */ |
|
248 | - public function tryToUpdateView($arObj, $throwExceptions = false) |
|
249 | - { |
|
250 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
251 | - foreach (array_keys($objAttrs) as $key) |
|
252 | - { |
|
253 | - try |
|
254 | - { |
|
255 | - if ($key != "RELATIONS") |
|
256 | - { |
|
257 | - $control = $this->{$key}; |
|
258 | - if ($control instanceof TTextBox) |
|
259 | - $control->Text = $arObj->{$key}; |
|
260 | - elseif ($control instanceof TCheckBox) |
|
261 | - $control->Checked = (boolean) $arObj->{$key}; |
|
262 | - elseif ($control instanceof TDatePicker) |
|
263 | - $control->Date = $arObj->{$key}; |
|
264 | - } |
|
265 | - else |
|
266 | - { |
|
267 | - foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
268 | - { |
|
269 | - $relControl = $this->{$relKey}; |
|
270 | - switch ($relValues[0]) |
|
271 | - { |
|
272 | - case TActiveRecord::BELONGS_TO: |
|
273 | - case TActiveRecord::HAS_ONE: |
|
274 | - $relControl->Text = $arObj->{$relKey}; |
|
275 | - break; |
|
276 | - case TActiveRecord::HAS_MANY: |
|
277 | - if ($relControl instanceof TListControl) |
|
278 | - { |
|
279 | - $relControl->DataSource = $arObj->{$relKey}; |
|
280 | - $relControl->dataBind(); |
|
281 | - } |
|
282 | - break; |
|
283 | - } |
|
284 | - } |
|
285 | - break; |
|
286 | - } |
|
287 | - } |
|
288 | - catch (Exception $ex) |
|
289 | - { |
|
290 | - if ($throwExceptions) |
|
291 | - throw $ex; |
|
292 | - } |
|
293 | - } |
|
294 | - } |
|
241 | + /** |
|
242 | + * Function to update view controls with data in a given AR object. |
|
243 | + * View controls and AR object need to have the same name in IDs and Attrs respectively. |
|
244 | + * @param TActiveRecord $arObj |
|
245 | + * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
246 | + * @author Daniel Sampedro <[email protected]> |
|
247 | + */ |
|
248 | + public function tryToUpdateView($arObj, $throwExceptions = false) |
|
249 | + { |
|
250 | + $objAttrs = get_class_vars(get_class($arObj)); |
|
251 | + foreach (array_keys($objAttrs) as $key) |
|
252 | + { |
|
253 | + try |
|
254 | + { |
|
255 | + if ($key != "RELATIONS") |
|
256 | + { |
|
257 | + $control = $this->{$key}; |
|
258 | + if ($control instanceof TTextBox) |
|
259 | + $control->Text = $arObj->{$key}; |
|
260 | + elseif ($control instanceof TCheckBox) |
|
261 | + $control->Checked = (boolean) $arObj->{$key}; |
|
262 | + elseif ($control instanceof TDatePicker) |
|
263 | + $control->Date = $arObj->{$key}; |
|
264 | + } |
|
265 | + else |
|
266 | + { |
|
267 | + foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
268 | + { |
|
269 | + $relControl = $this->{$relKey}; |
|
270 | + switch ($relValues[0]) |
|
271 | + { |
|
272 | + case TActiveRecord::BELONGS_TO: |
|
273 | + case TActiveRecord::HAS_ONE: |
|
274 | + $relControl->Text = $arObj->{$relKey}; |
|
275 | + break; |
|
276 | + case TActiveRecord::HAS_MANY: |
|
277 | + if ($relControl instanceof TListControl) |
|
278 | + { |
|
279 | + $relControl->DataSource = $arObj->{$relKey}; |
|
280 | + $relControl->dataBind(); |
|
281 | + } |
|
282 | + break; |
|
283 | + } |
|
284 | + } |
|
285 | + break; |
|
286 | + } |
|
287 | + } |
|
288 | + catch (Exception $ex) |
|
289 | + { |
|
290 | + if ($throwExceptions) |
|
291 | + throw $ex; |
|
292 | + } |
|
293 | + } |
|
294 | + } |
|
295 | 295 | |
296 | - /** |
|
297 | - * Function to try to update an AR object with data in view controls. |
|
298 | - * @param TActiveRecord $arObj |
|
299 | - * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
300 | - * @author Daniel Sampedro <[email protected]> |
|
301 | - */ |
|
302 | - public function tryToUpdateAR($arObj, $throwExceptions = false) |
|
303 | - { |
|
304 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
305 | - foreach (array_keys($objAttrs) as $key) |
|
306 | - { |
|
307 | - try |
|
308 | - { |
|
309 | - if ($key == "RELATIONS") |
|
310 | - break; |
|
311 | - $control = $this->{$key}; |
|
312 | - if ($control instanceof TTextBox) |
|
313 | - $arObj->{$key} = $control->Text; |
|
314 | - elseif ($control instanceof TCheckBox) |
|
315 | - $arObj->{$key} = $control->Checked; |
|
316 | - elseif ($control instanceof TDatePicker) |
|
317 | - $arObj->{$key} = $control->Date; |
|
318 | - } |
|
319 | - catch (Exception $ex) |
|
320 | - { |
|
321 | - if ($throwExceptions) |
|
322 | - throw $ex; |
|
323 | - } |
|
324 | - } |
|
325 | - } |
|
296 | + /** |
|
297 | + * Function to try to update an AR object with data in view controls. |
|
298 | + * @param TActiveRecord $arObj |
|
299 | + * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
300 | + * @author Daniel Sampedro <[email protected]> |
|
301 | + */ |
|
302 | + public function tryToUpdateAR($arObj, $throwExceptions = false) |
|
303 | + { |
|
304 | + $objAttrs = get_class_vars(get_class($arObj)); |
|
305 | + foreach (array_keys($objAttrs) as $key) |
|
306 | + { |
|
307 | + try |
|
308 | + { |
|
309 | + if ($key == "RELATIONS") |
|
310 | + break; |
|
311 | + $control = $this->{$key}; |
|
312 | + if ($control instanceof TTextBox) |
|
313 | + $arObj->{$key} = $control->Text; |
|
314 | + elseif ($control instanceof TCheckBox) |
|
315 | + $arObj->{$key} = $control->Checked; |
|
316 | + elseif ($control instanceof TDatePicker) |
|
317 | + $arObj->{$key} = $control->Date; |
|
318 | + } |
|
319 | + catch (Exception $ex) |
|
320 | + { |
|
321 | + if ($throwExceptions) |
|
322 | + throw $ex; |
|
323 | + } |
|
324 | + } |
|
325 | + } |
|
326 | 326 | } |
327 | 327 |
@@ -69,8 +69,7 @@ discard block |
||
69 | 69 | if(!isset(self::$_template[$class])) |
70 | 70 | self::$_template[$class]=$this->loadTemplate(); |
71 | 71 | return self::$_template[$class]; |
72 | - } |
|
73 | - else |
|
72 | + } else |
|
74 | 73 | return $this->_localTemplate; |
75 | 74 | } |
76 | 75 | |
@@ -205,8 +204,7 @@ discard block |
||
205 | 204 | $controls=$placeholder->getParent()->getControls(); |
206 | 205 | $loc=$controls->remove($placeholder); |
207 | 206 | $controls->insertAt($loc,$content); |
208 | - } |
|
209 | - else |
|
207 | + } else |
|
210 | 208 | throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id); |
211 | 209 | } |
212 | 210 | |
@@ -232,8 +230,7 @@ discard block |
||
232 | 230 | $master->ensureChildControls(); |
233 | 231 | foreach($this->_contents as $id=>$content) |
234 | 232 | $master->injectContent($id,$content); |
235 | - } |
|
236 | - else if(!empty($this->_contents)) |
|
233 | + } else if(!empty($this->_contents)) |
|
237 | 234 | throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this)); |
238 | 235 | parent::initRecursive($namingContainer); |
239 | 236 | } |
@@ -261,8 +258,7 @@ discard block |
||
261 | 258 | $control->Checked = (boolean) $arObj->{$key}; |
262 | 259 | elseif ($control instanceof TDatePicker) |
263 | 260 | $control->Date = $arObj->{$key}; |
264 | - } |
|
265 | - else |
|
261 | + } else |
|
266 | 262 | { |
267 | 263 | foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
268 | 264 | { |
@@ -284,8 +280,7 @@ discard block |
||
284 | 280 | } |
285 | 281 | break; |
286 | 282 | } |
287 | - } |
|
288 | - catch (Exception $ex) |
|
283 | + } catch (Exception $ex) |
|
289 | 284 | { |
290 | 285 | if ($throwExceptions) |
291 | 286 | throw $ex; |
@@ -315,8 +310,7 @@ discard block |
||
315 | 310 | $arObj->{$key} = $control->Checked; |
316 | 311 | elseif ($control instanceof TDatePicker) |
317 | 312 | $arObj->{$key} = $control->Date; |
318 | - } |
|
319 | - catch (Exception $ex) |
|
313 | + } catch (Exception $ex) |
|
320 | 314 | { |
321 | 315 | if ($throwExceptions) |
322 | 316 | throw $ex; |
@@ -146,6 +146,7 @@ discard block |
||
146 | 146 | * Registers a content control. |
147 | 147 | * @param string ID of the content |
148 | 148 | * @param TContent |
149 | + * @param string $id |
|
149 | 150 | */ |
150 | 151 | public function registerContent($id,TContent $object) |
151 | 152 | { |
@@ -160,6 +161,7 @@ discard block |
||
160 | 161 | * This method should only be used by framework and control developers. |
161 | 162 | * @param string placeholder ID |
162 | 163 | * @param TContentPlaceHolder placeholder control |
164 | + * @param string $id |
|
163 | 165 | */ |
164 | 166 | public function registerContentPlaceHolder($id,TContentPlaceHolder $object) |
165 | 167 | { |
@@ -117,7 +117,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -602,7 +602,7 @@ |
||
602 | 602 | |
603 | 603 | /** |
604 | 604 | * @param string the application configuration type. 'xml' and 'php' are valid values |
605 | - */ |
|
605 | + */ |
|
606 | 606 | public function setConfigurationType($value) |
607 | 607 | { |
608 | 608 | $this->_configType = $value; |
@@ -325,6 +325,7 @@ discard block |
||
325 | 325 | * to determine the application configuration file, |
326 | 326 | * application root path and the runtime path. |
327 | 327 | * @param string the application root path or the application configuration file |
328 | + * @param string $basePath |
|
328 | 329 | * @see setBasePath |
329 | 330 | * @see setRuntimePath |
330 | 331 | * @see setConfigurationFile |
@@ -423,6 +424,7 @@ discard block |
||
423 | 424 | * A global value is one that is persistent across users sessions and requests. |
424 | 425 | * @param string the name of the value to be returned |
425 | 426 | * @param mixed the default value. If $key is not found, $defaultValue will be returned |
427 | + * @param integer $defaultValue |
|
426 | 428 | * @return mixed the global value corresponding to $key |
427 | 429 | */ |
428 | 430 | public function getGlobalState($key,$defaultValue=null) |
@@ -439,6 +441,7 @@ discard block |
||
439 | 441 | * @param mixed the global value to be set |
440 | 442 | * @param mixed the default value. If $key is not found, $defaultValue will be returned |
441 | 443 | * @param boolean wheter to force an immediate GlobalState save. defaults to false |
444 | + * @param string $key |
|
442 | 445 | */ |
443 | 446 | public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false) |
444 | 447 | { |
@@ -553,6 +556,7 @@ discard block |
||
553 | 556 | |
554 | 557 | /** |
555 | 558 | * @param string the directory containing the application configuration file |
559 | + * @param string $value |
|
556 | 560 | */ |
557 | 561 | public function setBasePath($value) |
558 | 562 | { |
@@ -569,6 +573,7 @@ discard block |
||
569 | 573 | |
570 | 574 | /** |
571 | 575 | * @param string the application configuration file (absolute path) |
576 | + * @param string $value |
|
572 | 577 | */ |
573 | 578 | public function setConfigurationFile($value) |
574 | 579 | { |
@@ -585,6 +590,7 @@ discard block |
||
585 | 590 | |
586 | 591 | /** |
587 | 592 | * @param string the application configuration type. 'xml' and 'php' are valid values |
593 | + * @param string $value |
|
588 | 594 | */ |
589 | 595 | public function setConfigurationType($value) |
590 | 596 | { |
@@ -640,6 +646,7 @@ discard block |
||
640 | 646 | |
641 | 647 | /** |
642 | 648 | * @param string the directory storing cache data and application-level persistent data. (absolute path) |
649 | + * @param string $value |
|
643 | 650 | */ |
644 | 651 | public function setRuntimePath($value) |
645 | 652 | { |
@@ -1071,6 +1078,7 @@ discard block |
||
1071 | 1078 | * The service instance will be created. Its properties will be initialized |
1072 | 1079 | * and the configurations will be applied, if any. |
1073 | 1080 | * @param string service ID |
1081 | + * @param string $serviceID |
|
1074 | 1082 | */ |
1075 | 1083 | public function startService($serviceID) |
1076 | 1084 | { |
@@ -1109,6 +1117,7 @@ discard block |
||
1109 | 1117 | * This method is invoked when an exception is raised during the lifecycles |
1110 | 1118 | * of the application. |
1111 | 1119 | * @param mixed event parameter |
1120 | + * @param \Exception $param |
|
1112 | 1121 | */ |
1113 | 1122 | public function onError($param) |
1114 | 1123 | { |
@@ -340,8 +340,7 @@ discard block |
||
340 | 340 | { |
341 | 341 | $configFile=$basePath; |
342 | 342 | $basePath=dirname($configFile); |
343 | - } |
|
344 | - else |
|
343 | + } else |
|
345 | 344 | $configFile=null; |
346 | 345 | |
347 | 346 | // determine runtime path |
@@ -361,8 +360,7 @@ discard block |
||
361 | 360 | } |
362 | 361 | $this->setBasePath($basePath); |
363 | 362 | $this->setRuntimePath($runtimePath); |
364 | - } |
|
365 | - else |
|
363 | + } else |
|
366 | 364 | throw new TConfigurationException('application_runtimepath_invalid',$runtimePath); |
367 | 365 | |
368 | 366 | } |
@@ -391,8 +389,7 @@ discard block |
||
391 | 389 | $this->$method(); |
392 | 390 | $this->_step++; |
393 | 391 | } |
394 | - } |
|
395 | - catch(\Exception $e) |
|
392 | + } catch(\Exception $e) |
|
396 | 393 | { |
397 | 394 | $this->onError($e); |
398 | 395 | } |
@@ -993,8 +990,7 @@ discard block |
||
993 | 990 | foreach($parameter[1] as $name=>$value) |
994 | 991 | $component->setSubProperty($name,$value); |
995 | 992 | $this->_parameters->add($id,$component); |
996 | - } |
|
997 | - else |
|
993 | + } else |
|
998 | 994 | $this->_parameters->add($id,$parameter); |
999 | 995 | } |
1000 | 996 | |
@@ -1053,8 +1049,7 @@ discard block |
||
1053 | 1049 | $config->loadFromFile($this->_configFile); |
1054 | 1050 | if($this->_cacheFile!==null) |
1055 | 1051 | file_put_contents($this->_cacheFile,serialize($config),LOCK_EX); |
1056 | - } |
|
1057 | - else |
|
1052 | + } else |
|
1058 | 1053 | $config=unserialize(file_get_contents($this->_cacheFile)); |
1059 | 1054 | |
1060 | 1055 | $this->applyConfiguration($config,false); |
@@ -1099,8 +1094,7 @@ discard block |
||
1099 | 1094 | } |
1100 | 1095 | |
1101 | 1096 | $service->init($configElement); |
1102 | - } |
|
1103 | - else |
|
1097 | + } else |
|
1104 | 1098 | throw new THttpException(500,'application_service_unknown',$serviceID); |
1105 | 1099 | } |
1106 | 1100 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | /** |
108 | 108 | * Configuration file type, application.xml and config.xml |
109 | 109 | */ |
110 | - const CONFIG_TYPE_XML = 'xml'; |
|
110 | + const CONFIG_TYPE_XML='xml'; |
|
111 | 111 | /** |
112 | 112 | * Application configuration file name |
113 | 113 | */ |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * Configuration file type, application.php and config.php |
121 | 121 | */ |
122 | - const CONFIG_TYPE_PHP = 'php'; |
|
122 | + const CONFIG_TYPE_PHP='php'; |
|
123 | 123 | /** |
124 | 124 | * Runtime directory name |
125 | 125 | */ |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | /** |
273 | 273 | * @var string Customizable page service ID |
274 | 274 | */ |
275 | - private $_pageServiceID = self::PAGE_SERVICE_ID; |
|
275 | + private $_pageServiceID=self::PAGE_SERVICE_ID; |
|
276 | 276 | |
277 | 277 | /** |
278 | 278 | * Constructor. |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @param boolean whether to cache application configuration. Defaults to true. |
293 | 293 | * @throws TConfigurationException if configuration file cannot be read or the runtime path is invalid. |
294 | 294 | */ |
295 | - public function __construct($basePath='protected',$cacheConfig=true, $configType=self::CONFIG_TYPE_XML) |
|
295 | + public function __construct($basePath='protected', $cacheConfig=true, $configType=self::CONFIG_TYPE_XML) |
|
296 | 296 | { |
297 | 297 | // register application as a singleton |
298 | 298 | Prado::setApplication($this); |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | // generates unique ID by hashing the runtime path |
306 | 306 | $this->_uniqueID=md5($this->_runtimePath); |
307 | 307 | $this->_parameters=new \Prado\Collections\TMap; |
308 | - $this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null)); |
|
308 | + $this->_services=array($this->getPageServiceID()=>array('TPageService', array(), null)); |
|
309 | 309 | |
310 | - Prado::setPathOfAlias('Application',$this->_basePath); |
|
310 | + Prado::setPathOfAlias('Application', $this->_basePath); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | { |
325 | 325 | // determine configuration path and file |
326 | 326 | if(empty($basePath) || ($basePath=realpath($basePath))===false) |
327 | - throw new TConfigurationException('application_basepath_invalid',$basePath); |
|
327 | + throw new TConfigurationException('application_basepath_invalid', $basePath); |
|
328 | 328 | if(is_dir($basePath) && is_file($basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName())) |
329 | 329 | $configFile=$basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName(); |
330 | 330 | else if(is_file($basePath)) |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | if(!is_dir($runtimePath)) |
346 | 346 | { |
347 | 347 | if(@mkdir($runtimePath)===false) |
348 | - throw new TConfigurationException('application_runtimepath_failed',$runtimePath); |
|
348 | + throw new TConfigurationException('application_runtimepath_failed', $runtimePath); |
|
349 | 349 | @chmod($runtimePath, PRADO_CHMOD); //make it deletable |
350 | 350 | } |
351 | 351 | $this->setConfigurationFile($configFile); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $this->setRuntimePath($runtimePath); |
355 | 355 | } |
356 | 356 | else |
357 | - throw new TConfigurationException('application_runtimepath_invalid',$runtimePath); |
|
357 | + throw new TConfigurationException('application_runtimepath_invalid', $runtimePath); |
|
358 | 358 | |
359 | 359 | } |
360 | 360 | |
@@ -371,14 +371,14 @@ discard block |
||
371 | 371 | $n=count(self::$_steps); |
372 | 372 | $this->_step=0; |
373 | 373 | $this->_requestCompleted=false; |
374 | - while($this->_step<$n) |
|
374 | + while($this->_step < $n) |
|
375 | 375 | { |
376 | 376 | if($this->_mode===TApplicationMode::Off) |
377 | - throw new THttpException(503,'application_unavailable'); |
|
377 | + throw new THttpException(503, 'application_unavailable'); |
|
378 | 378 | if($this->_requestCompleted) |
379 | 379 | break; |
380 | 380 | $method=self::$_steps[$this->_step]; |
381 | - Prado::trace("Executing $method()",'Prado\TApplication'); |
|
381 | + Prado::trace("Executing $method()", 'Prado\TApplication'); |
|
382 | 382 | $this->$method(); |
383 | 383 | $this->_step++; |
384 | 384 | } |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | * @param mixed the default value. If $key is not found, $defaultValue will be returned |
417 | 417 | * @return mixed the global value corresponding to $key |
418 | 418 | */ |
419 | - public function getGlobalState($key,$defaultValue=null) |
|
419 | + public function getGlobalState($key, $defaultValue=null) |
|
420 | 420 | { |
421 | - return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue; |
|
421 | + return isset($this->_globals[$key]) ? $this->_globals[$key] : $defaultValue; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @param mixed the default value. If $key is not found, $defaultValue will be returned |
432 | 432 | * @param boolean wheter to force an immediate GlobalState save. defaults to false |
433 | 433 | */ |
434 | - public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false) |
|
434 | + public function setGlobalState($key, $value, $defaultValue=null, $forceSave=false) |
|
435 | 435 | { |
436 | 436 | $this->_stateChanged=true; |
437 | 437 | if($value===$defaultValue) |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | */ |
532 | 532 | public function setMode($value) |
533 | 533 | { |
534 | - $this->_mode=TPropertyValue::ensureEnum($value,'\Prado\TApplicationMode'); |
|
534 | + $this->_mode=TPropertyValue::ensureEnum($value, '\Prado\TApplicationMode'); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | /** |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | */ |
580 | 580 | public function setConfigurationType($value) |
581 | 581 | { |
582 | - $this->_configType = $value; |
|
582 | + $this->_configType=$value; |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | /** |
@@ -592,10 +592,10 @@ discard block |
||
592 | 592 | switch($this->_configType) |
593 | 593 | { |
594 | 594 | case TApplication::CONFIG_TYPE_PHP: |
595 | - $this->_configFileExt = TApplication::CONFIG_FILE_EXT_PHP; |
|
595 | + $this->_configFileExt=TApplication::CONFIG_FILE_EXT_PHP; |
|
596 | 596 | break; |
597 | 597 | default: |
598 | - $this->_configFileExt = TApplication::CONFIG_FILE_EXT_XML; |
|
598 | + $this->_configFileExt=TApplication::CONFIG_FILE_EXT_XML; |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | return $this->_configFileExt; |
@@ -607,15 +607,15 @@ discard block |
||
607 | 607 | public function getConfigurationFileName() |
608 | 608 | { |
609 | 609 | static $fileName; |
610 | - if($fileName == null) |
|
610 | + if($fileName==null) |
|
611 | 611 | { |
612 | 612 | switch($this->_configType) |
613 | 613 | { |
614 | 614 | case TApplication::CONFIG_TYPE_PHP: |
615 | - $fileName = TApplication::CONFIG_FILE_PHP; |
|
615 | + $fileName=TApplication::CONFIG_FILE_PHP; |
|
616 | 616 | break; |
617 | 617 | default: |
618 | - $fileName = TApplication::CONFIG_FILE_XML; |
|
618 | + $fileName=TApplication::CONFIG_FILE_XML; |
|
619 | 619 | } |
620 | 620 | } |
621 | 621 | return $fileName; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | public function setModule($id, IModule $module=null) |
667 | 667 | { |
668 | 668 | if(isset($this->_modules[$id])) |
669 | - throw new TConfigurationException('application_moduleid_duplicated',$id); |
|
669 | + throw new TConfigurationException('application_moduleid_duplicated', $id); |
|
670 | 670 | else |
671 | 671 | $this->_modules[$id]=$module; |
672 | 672 | } |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | // force loading of a lazy module |
683 | 683 | if($this->_modules[$id]===null) |
684 | 684 | { |
685 | - $module = $this->internalLoadModule($id, true); |
|
685 | + $module=$this->internalLoadModule($id, true); |
|
686 | 686 | $module[0]->init($module[1]); |
687 | 687 | } |
688 | 688 | |
@@ -931,37 +931,37 @@ discard block |
||
931 | 931 | list($moduleClass, $initProperties, $configElement)=$this->_lazyModules[$id]; |
932 | 932 | if(isset($initProperties['lazy']) && $initProperties['lazy'] && !$force) |
933 | 933 | { |
934 | - Prado::trace("Postponed loading of lazy module $id ({$moduleClass})",'\Prado\TApplication'); |
|
934 | + Prado::trace("Postponed loading of lazy module $id ({$moduleClass})", '\Prado\TApplication'); |
|
935 | 935 | $this->setModule($id, null); |
936 | 936 | return null; |
937 | 937 | } |
938 | 938 | |
939 | - Prado::trace("Loading module $id ({$moduleClass})",'\Prado\TApplication'); |
|
939 | + Prado::trace("Loading module $id ({$moduleClass})", '\Prado\TApplication'); |
|
940 | 940 | $module=Prado::createComponent($moduleClass); |
941 | 941 | foreach($initProperties as $name=>$value) |
942 | 942 | { |
943 | 943 | if($name==='lazy') continue; |
944 | - $module->setSubProperty($name,$value); |
|
944 | + $module->setSubProperty($name, $value); |
|
945 | 945 | } |
946 | - $this->setModule($id,$module); |
|
946 | + $this->setModule($id, $module); |
|
947 | 947 | // keep the key to avoid reuse of the old module id |
948 | 948 | $this->_lazyModules[$id]=null; |
949 | 949 | |
950 | - return array($module,$configElement); |
|
950 | + return array($module, $configElement); |
|
951 | 951 | } |
952 | 952 | /** |
953 | 953 | * Applies an application configuration. |
954 | 954 | * @param TApplicationConfiguration the configuration |
955 | 955 | * @param boolean whether the configuration is specified within a service. |
956 | 956 | */ |
957 | - public function applyConfiguration($config,$withinService=false) |
|
957 | + public function applyConfiguration($config, $withinService=false) |
|
958 | 958 | { |
959 | 959 | if($config->getIsEmpty()) |
960 | 960 | return; |
961 | 961 | |
962 | 962 | // set path aliases and using namespaces |
963 | 963 | foreach($config->getAliases() as $alias=>$path) |
964 | - Prado::setPathOfAlias($alias,$path); |
|
964 | + Prado::setPathOfAlias($alias, $path); |
|
965 | 965 | foreach($config->getUsings() as $using) |
966 | 966 | Prado::using($using); |
967 | 967 | |
@@ -969,11 +969,11 @@ discard block |
||
969 | 969 | if(!$withinService) |
970 | 970 | { |
971 | 971 | foreach($config->getProperties() as $name=>$value) |
972 | - $this->setSubProperty($name,$value); |
|
972 | + $this->setSubProperty($name, $value); |
|
973 | 973 | } |
974 | 974 | |
975 | 975 | if(empty($this->_services)) |
976 | - $this->_services=array($this->getPageServiceID()=>array('Prado\Web\Services\TPageService',array(),null)); |
|
976 | + $this->_services=array($this->getPageServiceID()=>array('Prado\Web\Services\TPageService', array(), null)); |
|
977 | 977 | |
978 | 978 | // load parameters |
979 | 979 | foreach($config->getParameters() as $id=>$parameter) |
@@ -982,11 +982,11 @@ discard block |
||
982 | 982 | { |
983 | 983 | $component=Prado::createComponent($parameter[0]); |
984 | 984 | foreach($parameter[1] as $name=>$value) |
985 | - $component->setSubProperty($name,$value); |
|
986 | - $this->_parameters->add($id,$component); |
|
985 | + $component->setSubProperty($name, $value); |
|
986 | + $this->_parameters->add($id, $component); |
|
987 | 987 | } |
988 | 988 | else |
989 | - $this->_parameters->add($id,$parameter); |
|
989 | + $this->_parameters->add($id, $parameter); |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | // load and init modules specified in app config |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | if(!is_string($id)) |
997 | 997 | $id='_module'.count($this->_lazyModules); |
998 | 998 | $this->_lazyModules[$id]=$moduleConfig; |
999 | - if($module = $this->internalLoadModule($id)) |
|
999 | + if($module=$this->internalLoadModule($id)) |
|
1000 | 1000 | $modules[]=$module; |
1001 | 1001 | } |
1002 | 1002 | foreach($modules as $module) |
@@ -1013,12 +1013,12 @@ discard block |
||
1013 | 1013 | $condition=$this->evaluateExpression($condition); |
1014 | 1014 | if($condition) |
1015 | 1015 | { |
1016 | - if(($path=Prado::getPathOfNamespace($filePath,$this->getConfigurationFileExt()))===null || !is_file($path)) |
|
1017 | - throw new TConfigurationException('application_includefile_invalid',$filePath); |
|
1016 | + if(($path=Prado::getPathOfNamespace($filePath, $this->getConfigurationFileExt()))===null || !is_file($path)) |
|
1017 | + throw new TConfigurationException('application_includefile_invalid', $filePath); |
|
1018 | 1018 | $cn=$this->getApplicationConfigurationClass(); |
1019 | 1019 | $c=new $cn; |
1020 | 1020 | $c->loadFromFile($path); |
1021 | - $this->applyConfiguration($c,$withinService); |
|
1021 | + $this->applyConfiguration($c, $withinService); |
|
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 | } |
@@ -1034,21 +1034,21 @@ discard block |
||
1034 | 1034 | */ |
1035 | 1035 | protected function initApplication() |
1036 | 1036 | { |
1037 | - Prado::trace('Initializing application','Prado\TApplication'); |
|
1037 | + Prado::trace('Initializing application', 'Prado\TApplication'); |
|
1038 | 1038 | |
1039 | 1039 | if($this->_configFile!==null) |
1040 | 1040 | { |
1041 | - if($this->_cacheFile===null || @filemtime($this->_cacheFile)<filemtime($this->_configFile)) |
|
1041 | + if($this->_cacheFile===null || @filemtime($this->_cacheFile) < filemtime($this->_configFile)) |
|
1042 | 1042 | { |
1043 | 1043 | $config=new TApplicationConfiguration; |
1044 | 1044 | $config->loadFromFile($this->_configFile); |
1045 | 1045 | if($this->_cacheFile!==null) |
1046 | - file_put_contents($this->_cacheFile,serialize($config),LOCK_EX); |
|
1046 | + file_put_contents($this->_cacheFile, serialize($config), LOCK_EX); |
|
1047 | 1047 | } |
1048 | 1048 | else |
1049 | 1049 | $config=unserialize(file_get_contents($this->_cacheFile)); |
1050 | 1050 | |
1051 | - $this->applyConfiguration($config,false); |
|
1051 | + $this->applyConfiguration($config, false); |
|
1052 | 1052 | } |
1053 | 1053 | |
1054 | 1054 | if(($serviceID=$this->getRequest()->resolveRequest(array_keys($this->_services)))===null) |
@@ -1067,32 +1067,32 @@ discard block |
||
1067 | 1067 | { |
1068 | 1068 | if(isset($this->_services[$serviceID])) |
1069 | 1069 | { |
1070 | - list($serviceClass,$initProperties,$configElement)=$this->_services[$serviceID]; |
|
1070 | + list($serviceClass, $initProperties, $configElement)=$this->_services[$serviceID]; |
|
1071 | 1071 | $service=Prado::createComponent($serviceClass); |
1072 | 1072 | if(!($service instanceof IService)) |
1073 | - throw new THttpException(500,'application_service_invalid',$serviceClass); |
|
1073 | + throw new THttpException(500, 'application_service_invalid', $serviceClass); |
|
1074 | 1074 | if(!$service->getEnabled()) |
1075 | - throw new THttpException(500,'application_service_unavailable',$serviceClass); |
|
1075 | + throw new THttpException(500, 'application_service_unavailable', $serviceClass); |
|
1076 | 1076 | $service->setID($serviceID); |
1077 | 1077 | $this->setService($service); |
1078 | 1078 | |
1079 | 1079 | foreach($initProperties as $name=>$value) |
1080 | - $service->setSubProperty($name,$value); |
|
1080 | + $service->setSubProperty($name, $value); |
|
1081 | 1081 | |
1082 | 1082 | if($configElement!==null) |
1083 | 1083 | { |
1084 | 1084 | $config=new TApplicationConfiguration; |
1085 | 1085 | if($this->getConfigurationType()==self::CONFIG_TYPE_PHP) |
1086 | - $config->loadFromPhp($configElement,$this->getBasePath()); |
|
1086 | + $config->loadFromPhp($configElement, $this->getBasePath()); |
|
1087 | 1087 | else |
1088 | - $config->loadFromXml($configElement,$this->getBasePath()); |
|
1089 | - $this->applyConfiguration($config,true); |
|
1088 | + $config->loadFromXml($configElement, $this->getBasePath()); |
|
1089 | + $this->applyConfiguration($config, true); |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | $service->init($configElement); |
1093 | 1093 | } |
1094 | 1094 | else |
1095 | - throw new THttpException(500,'application_service_unknown',$serviceID); |
|
1095 | + throw new THttpException(500, 'application_service_unknown', $serviceID); |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | 1098 | /** |
@@ -1103,9 +1103,9 @@ discard block |
||
1103 | 1103 | */ |
1104 | 1104 | public function onError($param) |
1105 | 1105 | { |
1106 | - Prado::log($param->getMessage(),TLogger::ERROR,'Prado\TApplication'); |
|
1107 | - $this->raiseEvent('OnError',$this,$param); |
|
1108 | - $this->getErrorHandler()->handleError($this,$param); |
|
1106 | + Prado::log($param->getMessage(), TLogger::ERROR, 'Prado\TApplication'); |
|
1107 | + $this->raiseEvent('OnError', $this, $param); |
|
1108 | + $this->getErrorHandler()->handleError($this, $param); |
|
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | /** |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | */ |
1118 | 1118 | public function onBeginRequest() |
1119 | 1119 | { |
1120 | - $this->raiseEvent('OnBeginRequest',$this,null); |
|
1120 | + $this->raiseEvent('OnBeginRequest', $this, null); |
|
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | /** |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | */ |
1127 | 1127 | public function onAuthentication() |
1128 | 1128 | { |
1129 | - $this->raiseEvent('OnAuthentication',$this,null); |
|
1129 | + $this->raiseEvent('OnAuthentication', $this, null); |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | /** |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | */ |
1136 | 1136 | public function onAuthenticationComplete() |
1137 | 1137 | { |
1138 | - $this->raiseEvent('OnAuthenticationComplete',$this,null); |
|
1138 | + $this->raiseEvent('OnAuthenticationComplete', $this, null); |
|
1139 | 1139 | } |
1140 | 1140 | |
1141 | 1141 | /** |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | */ |
1145 | 1145 | public function onAuthorization() |
1146 | 1146 | { |
1147 | - $this->raiseEvent('OnAuthorization',$this,null); |
|
1147 | + $this->raiseEvent('OnAuthorization', $this, null); |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | /** |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | public function onAuthorizationComplete() |
1155 | 1155 | { |
1156 | - $this->raiseEvent('OnAuthorizationComplete',$this,null); |
|
1156 | + $this->raiseEvent('OnAuthorizationComplete', $this, null); |
|
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | /** |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | public function onLoadState() |
1164 | 1164 | { |
1165 | 1165 | $this->loadGlobals(); |
1166 | - $this->raiseEvent('OnLoadState',$this,null); |
|
1166 | + $this->raiseEvent('OnLoadState', $this, null); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | /** |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | */ |
1173 | 1173 | public function onLoadStateComplete() |
1174 | 1174 | { |
1175 | - $this->raiseEvent('OnLoadStateComplete',$this,null); |
|
1175 | + $this->raiseEvent('OnLoadStateComplete', $this, null); |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | /** |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | */ |
1182 | 1182 | public function onPreRunService() |
1183 | 1183 | { |
1184 | - $this->raiseEvent('OnPreRunService',$this,null); |
|
1184 | + $this->raiseEvent('OnPreRunService', $this, null); |
|
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | /** |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | */ |
1200 | 1200 | public function onSaveState() |
1201 | 1201 | { |
1202 | - $this->raiseEvent('OnSaveState',$this,null); |
|
1202 | + $this->raiseEvent('OnSaveState', $this, null); |
|
1203 | 1203 | $this->saveGlobals(); |
1204 | 1204 | } |
1205 | 1205 | |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | */ |
1210 | 1210 | public function onSaveStateComplete() |
1211 | 1211 | { |
1212 | - $this->raiseEvent('OnSaveStateComplete',$this,null); |
|
1212 | + $this->raiseEvent('OnSaveStateComplete', $this, null); |
|
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | /** |
@@ -1218,14 +1218,14 @@ discard block |
||
1218 | 1218 | */ |
1219 | 1219 | public function onPreFlushOutput() |
1220 | 1220 | { |
1221 | - $this->raiseEvent('OnPreFlushOutput',$this,null); |
|
1221 | + $this->raiseEvent('OnPreFlushOutput', $this, null); |
|
1222 | 1222 | } |
1223 | 1223 | |
1224 | 1224 | /** |
1225 | 1225 | * Flushes output to client side. |
1226 | 1226 | * @param boolean whether to continue buffering after flush if buffering was active |
1227 | 1227 | */ |
1228 | - public function flushOutput($continueBuffering = true) |
|
1228 | + public function flushOutput($continueBuffering=true) |
|
1229 | 1229 | { |
1230 | 1230 | $this->getResponse()->flush($continueBuffering); |
1231 | 1231 | } |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | public function onEndRequest() |
1238 | 1238 | { |
1239 | 1239 | $this->flushOutput(false); // flush all remaining content in the buffer |
1240 | - $this->saveGlobals(); // save global state |
|
1241 | - $this->raiseEvent('OnEndRequest',$this,null); |
|
1240 | + $this->saveGlobals(); // save global state |
|
1241 | + $this->raiseEvent('OnEndRequest', $this, null); |
|
1242 | 1242 | } |
1243 | 1243 | } |