@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function getDataType() |
51 | 51 | { |
52 | - return $this->getViewState('DataType','String'); |
|
52 | + return $this->getViewState('DataType', 'String'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function setDataType($value) |
60 | 60 | { |
61 | - $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TValidationDataType'),TValidationDataType::String); |
|
61 | + $this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TValidationDataType'), TValidationDataType::String); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | switch($this->getDataType()) |
93 | 93 | { |
94 | 94 | case TValidationDataType::Integer: |
95 | - return preg_match('/^[-+]?[0-9]+$/',trim($value)); |
|
95 | + return preg_match('/^[-+]?[0-9]+$/', trim($value)); |
|
96 | 96 | case TValidationDataType::Float: |
97 | - return preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value)); |
|
97 | + return preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value)); |
|
98 | 98 | case TValidationDataType::Date: |
99 | - $dateFormat = $this->getDateFormat(); |
|
99 | + $dateFormat=$this->getDateFormat(); |
|
100 | 100 | if(strlen($dateFormat)) |
101 | 101 | { |
102 | - $formatter = new TSimpleDateFormatter($dateFormat); |
|
102 | + $formatter=new TSimpleDateFormatter($dateFormat); |
|
103 | 103 | return $formatter->isValidDate($value); |
104 | 104 | } |
105 | 105 | else |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | protected function getClientScriptOptions() |
116 | 116 | { |
117 | - $options = parent::getClientScriptOptions(); |
|
117 | + $options=parent::getClientScriptOptions(); |
|
118 | 118 | $options['DataType']=$this->getDataType(); |
119 | 119 | if(($dateFormat=$this->getDateFormat())!=='') |
120 | 120 | $options['DateFormat']=$dateFormat; |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | { |
51 | 51 | $isEnabled=$this->getEnabled(true); |
52 | 52 | if($this->getEnabled() && !$isEnabled) |
53 | - $writer->addAttribute('disabled','disabled'); |
|
53 | + $writer->addAttribute('disabled', 'disabled'); |
|
54 | 54 | parent::addAttributesToRender($writer); |
55 | 55 | if(($url=$this->getNavigateUrl())!=='' && $isEnabled) |
56 | - $writer->addAttribute('href',$url); |
|
56 | + $writer->addAttribute('href', $url); |
|
57 | 57 | if(($target=$this->getTarget())!=='') |
58 | - $writer->addAttribute('target',$target); |
|
58 | + $writer->addAttribute('target', $target); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | protected function createImage($imageUrl) |
89 | 89 | { |
90 | - $image= new TImage; |
|
90 | + $image=new TImage; |
|
91 | 91 | $image->setImageUrl($imageUrl); |
92 | 92 | if(($width=$this->getImageWidth())!=='') |
93 | 93 | $image->setWidth($width); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getText() |
110 | 110 | { |
111 | - return $this->getViewState('Text',''); |
|
111 | + return $this->getViewState('Text', ''); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function setText($value) |
119 | 119 | { |
120 | - $this->setViewState('Text',$value,''); |
|
120 | + $this->setViewState('Text', $value, ''); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function getImageAlign() |
127 | 127 | { |
128 | - return $this->getViewState('ImageAlign',''); |
|
128 | + return $this->getViewState('ImageAlign', ''); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function setImageAlign($value) |
139 | 139 | { |
140 | - $this->setViewState('ImageAlign',$value,''); |
|
140 | + $this->setViewState('ImageAlign', $value, ''); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function getImageHeight() |
147 | 147 | { |
148 | - return $this->getViewState('ImageHeight',''); |
|
148 | + return $this->getViewState('ImageHeight', ''); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function setImageHeight($value) |
156 | 156 | { |
157 | - $this->setViewSTate('ImageHeight',$value,''); |
|
157 | + $this->setViewSTate('ImageHeight', $value, ''); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function getImageUrl() |
164 | 164 | { |
165 | - return $this->getViewState('ImageUrl',''); |
|
165 | + return $this->getViewState('ImageUrl', ''); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function setImageUrl($value) |
173 | 173 | { |
174 | - $this->setViewState('ImageUrl',$value,''); |
|
174 | + $this->setViewState('ImageUrl', $value, ''); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function getImageWidth() |
181 | 181 | { |
182 | - return $this->getViewState('ImageWidth',''); |
|
182 | + return $this->getViewState('ImageWidth', ''); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function setImageWidth($value) |
190 | 190 | { |
191 | - $this->setViewState('ImageWidth',$value,''); |
|
191 | + $this->setViewState('ImageWidth', $value, ''); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function getNavigateUrl() |
198 | 198 | { |
199 | - return $this->getViewState('NavigateUrl',''); |
|
199 | + return $this->getViewState('NavigateUrl', ''); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function setNavigateUrl($value) |
207 | 207 | { |
208 | - $this->setViewState('NavigateUrl',$value,''); |
|
208 | + $this->setViewState('NavigateUrl', $value, ''); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function getTarget() |
241 | 241 | { |
242 | - return $this->getViewState('Target',''); |
|
242 | + return $this->getViewState('Target', ''); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function setTarget($value) |
250 | 250 | { |
251 | - $this->setViewState('Target',$value,''); |
|
251 | + $this->setViewState('Target', $value, ''); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function setEnsureId($value) |
58 | 58 | { |
59 | - $this->_ensureid |= TPropertyValue::ensureBoolean($value); |
|
59 | + $this->_ensureid|=TPropertyValue::ensureBoolean($value); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function getDecorator($create=true) |
74 | 74 | { |
75 | 75 | if($create && !$this->_decorator) |
76 | - $this->_decorator = new TWebControlDecorator($this); |
|
76 | + $this->_decorator=new TWebControlDecorator($this); |
|
77 | 77 | return $this->_decorator; |
78 | 78 | } |
79 | 79 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function getAccessKey() |
101 | 101 | { |
102 | - return $this->getViewState('AccessKey',''); |
|
102 | + return $this->getViewState('AccessKey', ''); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function setAccessKey($value) |
113 | 113 | { |
114 | - if(strlen($value)>1) |
|
115 | - throw new TInvalidDataValueException('webcontrol_accesskey_invalid',get_class($this),$value); |
|
116 | - $this->setViewState('AccessKey',$value,''); |
|
114 | + if(strlen($value) > 1) |
|
115 | + throw new TInvalidDataValueException('webcontrol_accesskey_invalid', get_class($this), $value); |
|
116 | + $this->setViewState('AccessKey', $value, ''); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getBackColor() |
123 | 123 | { |
124 | - if($style=$this->getViewState('Style',null)) |
|
124 | + if($style=$this->getViewState('Style', null)) |
|
125 | 125 | return $style->getBackColor(); |
126 | 126 | else |
127 | 127 | return ''; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function getBorderColor() |
142 | 142 | { |
143 | - if($style=$this->getViewState('Style',null)) |
|
143 | + if($style=$this->getViewState('Style', null)) |
|
144 | 144 | return $style->getBorderColor(); |
145 | 145 | else |
146 | 146 | return ''; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function getBorderStyle() |
161 | 161 | { |
162 | - if($style=$this->getViewState('Style',null)) |
|
162 | + if($style=$this->getViewState('Style', null)) |
|
163 | 163 | return $style->getBorderStyle(); |
164 | 164 | else |
165 | 165 | return ''; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function getBorderWidth() |
180 | 180 | { |
181 | - if($style=$this->getViewState('Style',null)) |
|
181 | + if($style=$this->getViewState('Style', null)) |
|
182 | 182 | return $style->getBorderWidth(); |
183 | 183 | else |
184 | 184 | return ''; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function getForeColor() |
207 | 207 | { |
208 | - if($style=$this->getViewState('Style',null)) |
|
208 | + if($style=$this->getViewState('Style', null)) |
|
209 | 209 | return $style->getForeColor(); |
210 | 210 | else |
211 | 211 | return ''; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function getHeight() |
226 | 226 | { |
227 | - if($style=$this->getViewState('Style',null)) |
|
227 | + if($style=$this->getViewState('Style', null)) |
|
228 | 228 | return $style->getHeight(); |
229 | 229 | else |
230 | 230 | return ''; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function getCssClass() |
261 | 261 | { |
262 | - if($style=$this->getViewState('Style',null)) |
|
262 | + if($style=$this->getViewState('Style', null)) |
|
263 | 263 | return $style->getCssClass(); |
264 | 264 | else |
265 | 265 | return ''; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function getHasStyle() |
280 | 280 | { |
281 | - return $this->getViewState('Style',null)!==null; |
|
281 | + return $this->getViewState('Style', null)!==null; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -296,12 +296,12 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function getStyle() |
298 | 298 | { |
299 | - if($style=$this->getViewState('Style',null)) |
|
299 | + if($style=$this->getViewState('Style', null)) |
|
300 | 300 | return $style; |
301 | 301 | else |
302 | 302 | { |
303 | 303 | $style=$this->createStyle(); |
304 | - $this->setViewState('Style',$style,null); |
|
304 | + $this->setViewState('Style', $style, null); |
|
305 | 305 | return $style; |
306 | 306 | } |
307 | 307 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | if(is_string($value)) |
318 | 318 | $this->getStyle()->setCustomStyle($value); |
319 | 319 | else |
320 | - throw new TInvalidDataValueException('webcontrol_style_invalid',get_class($this)); |
|
320 | + throw new TInvalidDataValueException('webcontrol_style_invalid', get_class($this)); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function getTabIndex() |
335 | 335 | { |
336 | - return $this->getViewState('TabIndex',0); |
|
336 | + return $this->getViewState('TabIndex', 0); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | */ |
344 | 344 | public function setTabIndex($value) |
345 | 345 | { |
346 | - $this->setViewState('TabIndex',TPropertyValue::ensureInteger($value),0); |
|
346 | + $this->setViewState('TabIndex', TPropertyValue::ensureInteger($value), 0); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | /** |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public function getToolTip() |
364 | 364 | { |
365 | - return $this->getViewState('ToolTip',''); |
|
365 | + return $this->getViewState('ToolTip', ''); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function setToolTip($value) |
374 | 374 | { |
375 | - $this->setViewState('ToolTip',$value,''); |
|
375 | + $this->setViewState('ToolTip', $value, ''); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | public function getWidth() |
382 | 382 | { |
383 | - if($style=$this->getViewState('Style',null)) |
|
383 | + if($style=$this->getViewState('Style', null)) |
|
384 | 384 | return $style->getWidth(); |
385 | 385 | else |
386 | 386 | return ''; |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @param TEventParameter event parameter to be passed to the event handlers |
403 | 403 | */ |
404 | 404 | public function onPreRender($param) { |
405 | - if($decorator = $this->getDecorator(false)) |
|
405 | + if($decorator=$this->getDecorator(false)) |
|
406 | 406 | $decorator->instantiate(); |
407 | 407 | |
408 | 408 | parent::onPreRender($param); |
@@ -418,21 +418,21 @@ discard block |
||
418 | 418 | protected function addAttributesToRender($writer) |
419 | 419 | { |
420 | 420 | if($this->getID()!=='' || $this->getEnsureId()) |
421 | - $writer->addAttribute('id',$this->getClientID()); |
|
421 | + $writer->addAttribute('id', $this->getClientID()); |
|
422 | 422 | if(($accessKey=$this->getAccessKey())!=='') |
423 | - $writer->addAttribute('accesskey',$accessKey); |
|
423 | + $writer->addAttribute('accesskey', $accessKey); |
|
424 | 424 | if(!$this->getEnabled()) |
425 | - $writer->addAttribute('disabled','disabled'); |
|
426 | - if(($tabIndex=$this->getTabIndex())>0) |
|
427 | - $writer->addAttribute('tabindex',"$tabIndex"); |
|
425 | + $writer->addAttribute('disabled', 'disabled'); |
|
426 | + if(($tabIndex=$this->getTabIndex()) > 0) |
|
427 | + $writer->addAttribute('tabindex', "$tabIndex"); |
|
428 | 428 | if(($toolTip=$this->getToolTip())!=='') |
429 | - $writer->addAttribute('title',$toolTip); |
|
430 | - if($style=$this->getViewState('Style',null)) |
|
429 | + $writer->addAttribute('title', $toolTip); |
|
430 | + if($style=$this->getViewState('Style', null)) |
|
431 | 431 | $style->addAttributesToRender($writer); |
432 | 432 | if($this->getHasAttributes()) |
433 | 433 | { |
434 | 434 | foreach($this->getAttributes() as $name=>$value) |
435 | - $writer->addAttribute($name,$value); |
|
435 | + $writer->addAttribute($name, $value); |
|
436 | 436 | } |
437 | 437 | } |
438 | 438 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | */ |
459 | 459 | public function renderBeginTag($writer) |
460 | 460 | { |
461 | - if($decorator = $this->getDecorator(false)) { |
|
461 | + if($decorator=$this->getDecorator(false)) { |
|
462 | 462 | $decorator->renderPreTagText($writer); |
463 | 463 | $this->addAttributesToRender($writer); |
464 | 464 | $writer->renderBeginTag($this->getTagName()); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | */ |
487 | 487 | public function renderEndTag($writer) |
488 | 488 | { |
489 | - if($decorator = $this->getDecorator(false)) { |
|
489 | + if($decorator=$this->getDecorator(false)) { |
|
490 | 490 | $decorator->renderPostContentsText($writer); |
491 | 491 | $writer->renderEndTag(); |
492 | 492 | $decorator->renderPostTagText($writer); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | protected function getTagName() |
83 | 83 | { |
84 | - return ($this->getTextMode()==='MultiLine')?'textarea':'input'; |
|
84 | + return ($this->getTextMode()==='MultiLine') ? 'textarea' : 'input'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function getEnableClientScript() |
91 | 91 | { |
92 | - return $this->getViewState('EnableClientScript',true); |
|
92 | + return $this->getViewState('EnableClientScript', true); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function setEnableClientScript($value) |
99 | 99 | { |
100 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
100 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -110,106 +110,106 @@ discard block |
||
110 | 110 | $page=$this->getPage(); |
111 | 111 | $page->ensureRenderInForm($this); |
112 | 112 | if(($uid=$this->getUniqueID())!=='') |
113 | - $writer->addAttribute('name',$uid); |
|
113 | + $writer->addAttribute('name', $uid); |
|
114 | 114 | if(($textMode=$this->getTextMode())===TTextBoxMode::MultiLine) |
115 | 115 | { |
116 | - if(($rows=$this->getRows())<=0) |
|
116 | + if(($rows=$this->getRows()) <= 0) |
|
117 | 117 | $rows=self::DEFAULT_ROWS; |
118 | - if(($cols=$this->getColumns())<=0) |
|
118 | + if(($cols=$this->getColumns()) <= 0) |
|
119 | 119 | $cols=self::DEFAULT_COLUMNS; |
120 | - $writer->addAttribute('rows',"$rows"); |
|
121 | - $writer->addAttribute('cols',"$cols"); |
|
120 | + $writer->addAttribute('rows', "$rows"); |
|
121 | + $writer->addAttribute('cols', "$cols"); |
|
122 | 122 | if(!$this->getWrap()) |
123 | - $writer->addAttribute('wrap','off'); |
|
123 | + $writer->addAttribute('wrap', 'off'); |
|
124 | 124 | } |
125 | 125 | else |
126 | 126 | { |
127 | 127 | switch($textMode) |
128 | 128 | { |
129 | 129 | case TTextBoxMode::Password: |
130 | - $writer->addAttribute('type','password'); |
|
130 | + $writer->addAttribute('type', 'password'); |
|
131 | 131 | break; |
132 | 132 | case TTextBoxMode::Color: |
133 | - $writer->addAttribute('type','color'); |
|
133 | + $writer->addAttribute('type', 'color'); |
|
134 | 134 | break; |
135 | 135 | case TTextBoxMode::Date: |
136 | - $writer->addAttribute('type','date'); |
|
136 | + $writer->addAttribute('type', 'date'); |
|
137 | 137 | break; |
138 | 138 | case TTextBoxMode::Datetime: |
139 | - $writer->addAttribute('type','datetime'); |
|
139 | + $writer->addAttribute('type', 'datetime'); |
|
140 | 140 | break; |
141 | 141 | case TTextBoxMode::DatetimeLocal: |
142 | - $writer->addAttribute('type','datetime-local'); |
|
142 | + $writer->addAttribute('type', 'datetime-local'); |
|
143 | 143 | break; |
144 | 144 | case TTextBoxMode::Email: |
145 | - $writer->addAttribute('type','email'); |
|
145 | + $writer->addAttribute('type', 'email'); |
|
146 | 146 | break; |
147 | 147 | case TTextBoxMode::Month: |
148 | - $writer->addAttribute('type','month'); |
|
148 | + $writer->addAttribute('type', 'month'); |
|
149 | 149 | break; |
150 | 150 | case TTextBoxMode::Number: |
151 | - $writer->addAttribute('type','number'); |
|
151 | + $writer->addAttribute('type', 'number'); |
|
152 | 152 | break; |
153 | 153 | case TTextBoxMode::Range: |
154 | - $writer->addAttribute('type','range'); |
|
154 | + $writer->addAttribute('type', 'range'); |
|
155 | 155 | break; |
156 | 156 | case TTextBoxMode::Search: |
157 | - $writer->addAttribute('type','search'); |
|
157 | + $writer->addAttribute('type', 'search'); |
|
158 | 158 | break; |
159 | 159 | case TTextBoxMode::Tel: |
160 | - $writer->addAttribute('type','tel'); |
|
160 | + $writer->addAttribute('type', 'tel'); |
|
161 | 161 | break; |
162 | 162 | case TTextBoxMode::Time: |
163 | - $writer->addAttribute('type','time'); |
|
163 | + $writer->addAttribute('type', 'time'); |
|
164 | 164 | break; |
165 | 165 | case TTextBoxMode::Url: |
166 | - $writer->addAttribute('type','url'); |
|
166 | + $writer->addAttribute('type', 'url'); |
|
167 | 167 | break; |
168 | 168 | case TTextBoxMode::Week: |
169 | - $writer->addAttribute('type','week'); |
|
169 | + $writer->addAttribute('type', 'week'); |
|
170 | 170 | break; |
171 | 171 | case TTextBoxMode::SingleLine: |
172 | 172 | default: |
173 | - $writer->addAttribute('type','text'); |
|
173 | + $writer->addAttribute('type', 'text'); |
|
174 | 174 | break; |
175 | 175 | } |
176 | 176 | |
177 | - if(($text=$this->getText())!=='' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) |
|
178 | - $writer->addAttribute('value',$text); |
|
177 | + if(($text=$this->getText())!=='' && ($textMode!==TTextBoxMode::Password || $this->getPersistPassword())) |
|
178 | + $writer->addAttribute('value', $text); |
|
179 | 179 | |
180 | 180 | if(($act=$this->getAutoCompleteType())!=='None') |
181 | 181 | { |
182 | 182 | if($act==='Disabled') |
183 | - $writer->addAttribute('autocomplete','off'); |
|
183 | + $writer->addAttribute('autocomplete', 'off'); |
|
184 | 184 | else if($act==='Search') |
185 | - $writer->addAttribute('vcard_name','search'); |
|
185 | + $writer->addAttribute('vcard_name', 'search'); |
|
186 | 186 | else if($act==='HomeCountryRegion') |
187 | - $writer->addAttribute('vcard_name','HomeCountry'); |
|
187 | + $writer->addAttribute('vcard_name', 'HomeCountry'); |
|
188 | 188 | else if($act==='BusinessCountryRegion') |
189 | - $writer->addAttribute('vcard_name','BusinessCountry'); |
|
189 | + $writer->addAttribute('vcard_name', 'BusinessCountry'); |
|
190 | 190 | else |
191 | 191 | { |
192 | - if(strpos($act,'Business')===0) |
|
193 | - $act='Business'.'.'.substr($act,8); |
|
194 | - else if(strpos($act,'Home')===0) |
|
195 | - $act='Home'.'.'.substr($act,4); |
|
196 | - $writer->addAttribute('vcard_name','vCard.'.$act); |
|
192 | + if(strpos($act, 'Business')===0) |
|
193 | + $act='Business'.'.'.substr($act, 8); |
|
194 | + else if(strpos($act, 'Home')===0) |
|
195 | + $act='Home'.'.'.substr($act, 4); |
|
196 | + $writer->addAttribute('vcard_name', 'vCard.'.$act); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if(($cols=$this->getColumns())>0) |
|
201 | - $writer->addAttribute('size',"$cols"); |
|
202 | - if(($maxLength=$this->getMaxLength())>0) |
|
203 | - $writer->addAttribute('maxlength',"$maxLength"); |
|
200 | + if(($cols=$this->getColumns()) > 0) |
|
201 | + $writer->addAttribute('size', "$cols"); |
|
202 | + if(($maxLength=$this->getMaxLength()) > 0) |
|
203 | + $writer->addAttribute('maxlength', "$maxLength"); |
|
204 | 204 | } |
205 | 205 | if($this->getReadOnly()) |
206 | - $writer->addAttribute('readonly','readonly'); |
|
206 | + $writer->addAttribute('readonly', 'readonly'); |
|
207 | 207 | $isEnabled=$this->getEnabled(true); |
208 | 208 | if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
209 | - $writer->addAttribute('disabled','disabled'); |
|
209 | + $writer->addAttribute('disabled', 'disabled'); |
|
210 | 210 | if($isEnabled |
211 | 211 | && $this->getEnableClientScript() |
212 | - && ( $this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine) |
|
212 | + && ($this->getAutoPostBack() || $textMode===TTextBoxMode::SingleLine) |
|
213 | 213 | && $page->getClientSupportsJavaScript()) |
214 | 214 | { |
215 | 215 | $this->renderClientControlScript($writer); |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | */ |
223 | 223 | protected function renderClientControlScript($writer) |
224 | 224 | { |
225 | - $writer->addAttribute('id',$this->getClientID()); |
|
226 | - $cs = $this->getPage()->getClientScript(); |
|
227 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
225 | + $writer->addAttribute('id', $this->getClientID()); |
|
226 | + $cs=$this->getPage()->getClientScript(); |
|
227 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function getPostBackOptions() |
245 | 245 | { |
246 | - $options['ID'] = $this->getClientID(); |
|
247 | - $options['EventTarget'] = $this->getUniqueID(); |
|
248 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
249 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
250 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
251 | - $options['TextMode'] = $this->getTextMode(); |
|
246 | + $options['ID']=$this->getClientID(); |
|
247 | + $options['EventTarget']=$this->getUniqueID(); |
|
248 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
249 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
250 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
251 | + $options['TextMode']=$this->getTextMode(); |
|
252 | 252 | return $options; |
253 | 253 | } |
254 | 254 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @param array the input data collection |
260 | 260 | * @return boolean whether the data of the component has been changed |
261 | 261 | */ |
262 | - public function loadPostData($key,$values) |
|
262 | + public function loadPostData($key, $values) |
|
263 | 263 | { |
264 | 264 | $value=$values[$key]; |
265 | 265 | if($this->getAutoTrim()) |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function onTextChanged($param) |
322 | 322 | { |
323 | - $this->raiseEvent('OnTextChanged',$this,$param); |
|
323 | + $this->raiseEvent('OnTextChanged', $this, $param); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | */ |
365 | 365 | public function getAutoCompleteType() |
366 | 366 | { |
367 | - return $this->getViewState('AutoCompleteType',TTextBoxAutoCompleteType::None); |
|
367 | + return $this->getViewState('AutoCompleteType', TTextBoxAutoCompleteType::None); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function setAutoCompleteType($value) |
375 | 375 | { |
376 | - $this->setViewState('AutoCompleteType',TPropertyValue::ensureEnum($value,'TTextBoxAutoCompleteType'),TTextBoxAutoCompleteType::None); |
|
376 | + $this->setViewState('AutoCompleteType', TPropertyValue::ensureEnum($value, 'TTextBoxAutoCompleteType'), TTextBoxAutoCompleteType::None); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | /** |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | public function getAutoPostBack() |
385 | 385 | { |
386 | - return $this->getViewState('AutoPostBack',false); |
|
386 | + return $this->getViewState('AutoPostBack', false); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | */ |
395 | 395 | public function setAutoPostBack($value) |
396 | 396 | { |
397 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false); |
|
397 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | /** |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function getAutoTrim() |
404 | 404 | { |
405 | - return $this->getViewState('AutoTrim',false); |
|
405 | + return $this->getViewState('AutoTrim', false); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | /** |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | */ |
412 | 412 | public function setAutoTrim($value) |
413 | 413 | { |
414 | - $this->setViewState('AutoTrim',TPropertyValue::ensureBoolean($value),false); |
|
414 | + $this->setViewState('AutoTrim', TPropertyValue::ensureBoolean($value), false); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public function getCausesValidation() |
421 | 421 | { |
422 | - return $this->getViewState('CausesValidation',true); |
|
422 | + return $this->getViewState('CausesValidation', true); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | */ |
428 | 428 | public function setCausesValidation($value) |
429 | 429 | { |
430 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
430 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | */ |
436 | 436 | public function getColumns() |
437 | 437 | { |
438 | - return $this->getViewState('Columns',0); |
|
438 | + return $this->getViewState('Columns', 0); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | /** |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | */ |
445 | 445 | public function setColumns($value) |
446 | 446 | { |
447 | - $this->setViewState('Columns',TPropertyValue::ensureInteger($value),0); |
|
447 | + $this->setViewState('Columns', TPropertyValue::ensureInteger($value), 0); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | public function getMaxLength() |
454 | 454 | { |
455 | - return $this->getViewState('MaxLength',0); |
|
455 | + return $this->getViewState('MaxLength', 0); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | */ |
462 | 462 | public function setMaxLength($value) |
463 | 463 | { |
464 | - $this->setViewState('MaxLength',TPropertyValue::ensureInteger($value),0); |
|
464 | + $this->setViewState('MaxLength', TPropertyValue::ensureInteger($value), 0); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | */ |
470 | 470 | public function getReadOnly() |
471 | 471 | { |
472 | - return $this->getViewState('ReadOnly',false); |
|
472 | + return $this->getViewState('ReadOnly', false); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | /** |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | */ |
478 | 478 | public function setReadOnly($value) |
479 | 479 | { |
480 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
480 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | */ |
486 | 486 | public function getRows() |
487 | 487 | { |
488 | - return $this->getViewState('Rows',self::DEFAULT_ROWS); |
|
488 | + return $this->getViewState('Rows', self::DEFAULT_ROWS); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | /** |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | */ |
495 | 495 | public function setRows($value) |
496 | 496 | { |
497 | - $this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS); |
|
497 | + $this->setViewState('Rows', TPropertyValue::ensureInteger($value), self::DEFAULT_ROWS); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | /** |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | */ |
503 | 503 | public function getPersistPassword() |
504 | 504 | { |
505 | - return $this->getViewState('PersistPassword',false); |
|
505 | + return $this->getViewState('PersistPassword', false); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | */ |
511 | 511 | public function setPersistPassword($value) |
512 | 512 | { |
513 | - $this->setViewState('PersistPassword',TPropertyValue::ensureBoolean($value),false); |
|
513 | + $this->setViewState('PersistPassword', TPropertyValue::ensureBoolean($value), false); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | /** |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | */ |
519 | 519 | public function getText() |
520 | 520 | { |
521 | - return $this->getViewState('Text',''); |
|
521 | + return $this->getViewState('Text', ''); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | /** |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | */ |
528 | 528 | public function setText($value) |
529 | 529 | { |
530 | - $this->setViewState('Text',TPropertyValue::ensureString($value),''); |
|
531 | - $this->_safeText = null; |
|
530 | + $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
|
531 | + $this->_safeText=null; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | /** |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | protected function getSafeTextParser() |
574 | 574 | { |
575 | 575 | if(!self::$_safeTextParser) |
576 | - self::$_safeTextParser= new TSafeHtmlParser; |
|
576 | + self::$_safeTextParser=new TSafeHtmlParser; |
|
577 | 577 | return self::$_safeTextParser; |
578 | 578 | } |
579 | 579 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | */ |
583 | 583 | public function getTextMode() |
584 | 584 | { |
585 | - return $this->getViewState('TextMode',TTextBoxMode::SingleLine); |
|
585 | + return $this->getViewState('TextMode', TTextBoxMode::SingleLine); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | /** |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | */ |
593 | 593 | public function setTextMode($value) |
594 | 594 | { |
595 | - $this->setViewState('TextMode',TPropertyValue::ensureEnum($value,'TTextBoxMode'),TTextBoxMode::SingleLine); |
|
595 | + $this->setViewState('TextMode', TPropertyValue::ensureEnum($value, 'TTextBoxMode'), TTextBoxMode::SingleLine); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | /** |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | */ |
601 | 601 | public function getValidationGroup() |
602 | 602 | { |
603 | - return $this->getViewState('ValidationGroup',''); |
|
603 | + return $this->getViewState('ValidationGroup', ''); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | /** |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | */ |
609 | 609 | public function setValidationGroup($value) |
610 | 610 | { |
611 | - $this->setViewState('ValidationGroup',$value,''); |
|
611 | + $this->setViewState('ValidationGroup', $value, ''); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | /** |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | */ |
617 | 617 | public function getWrap() |
618 | 618 | { |
619 | - return $this->getViewState('Wrap',true); |
|
619 | + return $this->getViewState('Wrap', true); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | /** |
@@ -625,6 +625,6 @@ discard block |
||
625 | 625 | */ |
626 | 626 | public function setWrap($value) |
627 | 627 | { |
628 | - $this->setViewState('Wrap',TPropertyValue::ensureBoolean($value),true); |
|
628 | + $this->setViewState('Wrap', TPropertyValue::ensureBoolean($value), true); |
|
629 | 629 | } |
630 | 630 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getMinValue() |
67 | 67 | { |
68 | - return $this->getViewState('MinValue',''); |
|
68 | + return $this->getViewState('MinValue', ''); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function setMinValue($value) |
76 | 76 | { |
77 | - $this->setViewState('MinValue',TPropertyValue::ensureString($value),''); |
|
77 | + $this->setViewState('MinValue', TPropertyValue::ensureString($value), ''); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function getMaxValue() |
84 | 84 | { |
85 | - return $this->getViewState('MaxValue',''); |
|
85 | + return $this->getViewState('MaxValue', ''); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setMaxValue($value) |
93 | 93 | { |
94 | - $this->setViewState('MaxValue',TPropertyValue::ensureString($value),''); |
|
94 | + $this->setViewState('MaxValue', TPropertyValue::ensureString($value), ''); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function setStrictComparison($value) |
101 | 101 | { |
102 | - $this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value),false); |
|
102 | + $this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value), false); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function getDataType() |
118 | 118 | { |
119 | - return $this->getViewState('DataType',TRangeValidationDataType::String); |
|
119 | + return $this->getViewState('DataType', TRangeValidationDataType::String); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function setDataType($value) |
127 | 127 | { |
128 | - $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TRangeValidationDataType'),TRangeValidationDataType::String); |
|
128 | + $this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TRangeValidationDataType'), TRangeValidationDataType::String); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | $minValue=$this->getMinValue(); |
199 | 199 | $maxValue=$this->getMaxValue(); |
200 | 200 | |
201 | - $valid=preg_match('/^[-+]?[0-9]+$/',trim($value)); |
|
201 | + $valid=preg_match('/^[-+]?[0-9]+$/', trim($value)); |
|
202 | 202 | $value=intval($value); |
203 | 203 | if($minValue!=='') |
204 | 204 | $valid=$valid && $this->isGreaterThan($value, intval($minValue)); |
205 | 205 | if($maxValue!=='') |
206 | - $valid=$valid && $this->isLessThan($value,intval($maxValue)); |
|
206 | + $valid=$valid && $this->isLessThan($value, intval($maxValue)); |
|
207 | 207 | return $valid; |
208 | 208 | } |
209 | 209 | |
210 | - protected function isLessThan($left,$right) |
|
210 | + protected function isLessThan($left, $right) |
|
211 | 211 | { |
212 | 212 | return $this->getStrictComparison() ? $left < $right : $left <= $right; |
213 | 213 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | $minValue=$this->getMinValue(); |
228 | 228 | $maxValue=$this->getMaxValue(); |
229 | 229 | |
230 | - $valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value)); |
|
230 | + $valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value)); |
|
231 | 231 | $value=floatval($value); |
232 | 232 | if($minValue!=='') |
233 | - $valid=$valid && $this->isGreaterThan($value,floatval($minValue)); |
|
233 | + $valid=$valid && $this->isGreaterThan($value, floatval($minValue)); |
|
234 | 234 | if($maxValue!=='') |
235 | - $valid=$valid && $this->isLessThan($value,floatval($maxValue)); |
|
235 | + $valid=$valid && $this->isLessThan($value, floatval($maxValue)); |
|
236 | 236 | return $valid; |
237 | 237 | } |
238 | 238 | |
@@ -249,24 +249,24 @@ discard block |
||
249 | 249 | |
250 | 250 | $valid=true; |
251 | 251 | |
252 | - $dateFormat = $this->getDateFormat(); |
|
252 | + $dateFormat=$this->getDateFormat(); |
|
253 | 253 | if($dateFormat!=='') |
254 | 254 | { |
255 | - $formatter= new TSimpleDateFormatter($dateFormat); |
|
256 | - $value = $formatter->parse($value); |
|
255 | + $formatter=new TSimpleDateFormatter($dateFormat); |
|
256 | + $value=$formatter->parse($value); |
|
257 | 257 | if($minValue!=='') |
258 | - $valid=$valid && $this->isGreaterThan($value,$formatter->parse($minValue)); |
|
258 | + $valid=$valid && $this->isGreaterThan($value, $formatter->parse($minValue)); |
|
259 | 259 | if($maxValue!=='') |
260 | - $valid=$valid && $this->isLessThan($value,$formatter->parse($maxValue)); |
|
260 | + $valid=$valid && $this->isLessThan($value, $formatter->parse($maxValue)); |
|
261 | 261 | return $valid; |
262 | 262 | } |
263 | 263 | else |
264 | 264 | { |
265 | 265 | $value=strtotime($value); |
266 | 266 | if($minValue!=='') |
267 | - $valid=$valid && $this->isGreaterThan($value,strtotime($minValue)); |
|
267 | + $valid=$valid && $this->isGreaterThan($value, strtotime($minValue)); |
|
268 | 268 | if($maxValue!=='') |
269 | - $valid=$valid && $this->isLessThan($value,strtotime($maxValue)); |
|
269 | + $valid=$valid && $this->isLessThan($value, strtotime($maxValue)); |
|
270 | 270 | return $valid; |
271 | 271 | } |
272 | 272 | } |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | |
285 | 285 | $valid=true; |
286 | 286 | if($minValue!=='') |
287 | - $valid=$valid && $this->isGreaterThan(strcmp($value,$minValue),0); |
|
287 | + $valid=$valid && $this->isGreaterThan(strcmp($value, $minValue), 0); |
|
288 | 288 | if($maxValue!=='') |
289 | - $valid=$valid && $this->isLessThan(strcmp($value,$maxValue),0); |
|
289 | + $valid=$valid && $this->isLessThan(strcmp($value, $maxValue), 0); |
|
290 | 290 | return $valid; |
291 | 291 | } |
292 | 292 | |
@@ -300,20 +300,20 @@ discard block |
||
300 | 300 | $maxValue=$this->getMaxValue(); |
301 | 301 | |
302 | 302 | $valid=true; |
303 | - $charset = $this->getCharset(); |
|
303 | + $charset=$this->getCharset(); |
|
304 | 304 | if($charset==='') |
305 | 305 | { |
306 | - $app= $this->getApplication()->getGlobalization(); |
|
307 | - $charset = $app ? $app->getCharset() : null; |
|
306 | + $app=$this->getApplication()->getGlobalization(); |
|
307 | + $charset=$app ? $app->getCharset() : null; |
|
308 | 308 | if(!$charset) |
309 | - $charset = 'UTF-8'; |
|
309 | + $charset='UTF-8'; |
|
310 | 310 | } |
311 | 311 | |
312 | - $length = iconv_strlen($value, $charset); |
|
312 | + $length=iconv_strlen($value, $charset); |
|
313 | 313 | if($minValue!=='') |
314 | - $valid = $valid && $this->isGreaterThan($length,intval($minValue)); |
|
314 | + $valid=$valid && $this->isGreaterThan($length, intval($minValue)); |
|
315 | 315 | if($maxValue!=='') |
316 | - $valid = $valid && $this->isLessThan($length,intval($maxValue)); |
|
316 | + $valid=$valid && $this->isLessThan($length, intval($maxValue)); |
|
317 | 317 | return $valid; |
318 | 318 | } |
319 | 319 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function getButtonType() |
57 | 57 | { |
58 | - return $this->getViewState('ButtonType',TButtonColumnType::LinkButton); |
|
58 | + return $this->getViewState('ButtonType', TButtonColumnType::LinkButton); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function setButtonType($value) |
65 | 65 | { |
66 | - $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TButtonColumnType'),TButtonColumnType::LinkButton); |
|
66 | + $this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TButtonColumnType'), TButtonColumnType::LinkButton); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getEditText() |
73 | 73 | { |
74 | - return $this->getViewState('EditText','Edit'); |
|
74 | + return $this->getViewState('EditText', 'Edit'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function setEditText($value) |
81 | 81 | { |
82 | - $this->setViewState('EditText',$value,'Edit'); |
|
82 | + $this->setViewState('EditText', $value, 'Edit'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function getEditImageUrl() |
89 | 89 | { |
90 | - return $this->getViewState('EditImageUrl',''); |
|
90 | + return $this->getViewState('EditImageUrl', ''); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function setEditImageUrl($value) |
97 | 97 | { |
98 | - $this->setViewState('EditImageUrl',$value,''); |
|
98 | + $this->setViewState('EditImageUrl', $value, ''); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function getUpdateText() |
105 | 105 | { |
106 | - return $this->getViewState('UpdateText','Update'); |
|
106 | + return $this->getViewState('UpdateText', 'Update'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function setUpdateText($value) |
113 | 113 | { |
114 | - $this->setViewState('UpdateText',$value,'Update'); |
|
114 | + $this->setViewState('UpdateText', $value, 'Update'); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function getUpdateImageUrl() |
121 | 121 | { |
122 | - return $this->getViewState('UpdateImageUrl',''); |
|
122 | + return $this->getViewState('UpdateImageUrl', ''); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function setUpdateImageUrl($value) |
129 | 129 | { |
130 | - $this->setViewState('UpdateImageUrl',$value,''); |
|
130 | + $this->setViewState('UpdateImageUrl', $value, ''); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function getCancelText() |
137 | 137 | { |
138 | - return $this->getViewState('CancelText','Cancel'); |
|
138 | + return $this->getViewState('CancelText', 'Cancel'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function setCancelText($value) |
145 | 145 | { |
146 | - $this->setViewState('CancelText',$value,'Cancel'); |
|
146 | + $this->setViewState('CancelText', $value, 'Cancel'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function getCancelImageUrl() |
153 | 153 | { |
154 | - return $this->getViewState('CancelImageUrl',''); |
|
154 | + return $this->getViewState('CancelImageUrl', ''); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function setCancelImageUrl($value) |
161 | 161 | { |
162 | - $this->setViewState('CancelImageUrl',$value,''); |
|
162 | + $this->setViewState('CancelImageUrl', $value, ''); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function getCausesValidation() |
169 | 169 | { |
170 | - return $this->getViewState('CausesValidation',true); |
|
170 | + return $this->getViewState('CausesValidation', true); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function setCausesValidation($value) |
177 | 177 | { |
178 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
178 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function getValidationGroup() |
185 | 185 | { |
186 | - return $this->getViewState('ValidationGroup',''); |
|
186 | + return $this->getViewState('ValidationGroup', ''); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function setValidationGroup($value) |
193 | 193 | { |
194 | - $this->setViewState('ValidationGroup',$value,''); |
|
194 | + $this->setViewState('ValidationGroup', $value, ''); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -203,27 +203,27 @@ discard block |
||
203 | 203 | * @param integer the index to the Columns property that the cell resides in. |
204 | 204 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
205 | 205 | */ |
206 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
206 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
207 | 207 | { |
208 | 208 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem) |
209 | 209 | { |
210 | - $button=$this->createButton('Edit',$this->getEditText(),false,''); |
|
210 | + $button=$this->createButton('Edit', $this->getEditText(), false, ''); |
|
211 | 211 | $cell->getControls()->add($button); |
212 | - $cell->registerObject('EditButton',$button); |
|
212 | + $cell->registerObject('EditButton', $button); |
|
213 | 213 | } |
214 | 214 | else if($itemType===TListItemType::EditItem) |
215 | 215 | { |
216 | 216 | $controls=$cell->getControls(); |
217 | - $button=$this->createButton('Update',$this->getUpdateText(),$this->getCausesValidation(),$this->getValidationGroup()); |
|
217 | + $button=$this->createButton('Update', $this->getUpdateText(), $this->getCausesValidation(), $this->getValidationGroup()); |
|
218 | 218 | $controls->add($button); |
219 | - $cell->registerObject('UpdateButton',$button); |
|
219 | + $cell->registerObject('UpdateButton', $button); |
|
220 | 220 | $controls->add(' '); |
221 | - $button=$this->createButton('Cancel',$this->getCancelText(),false,''); |
|
221 | + $button=$this->createButton('Cancel', $this->getCancelText(), false, ''); |
|
222 | 222 | $controls->add($button); |
223 | - $cell->registerObject('CancelButton',$button); |
|
223 | + $cell->registerObject('CancelButton', $button); |
|
224 | 224 | } |
225 | 225 | else |
226 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
226 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -235,18 +235,18 @@ discard block |
||
235 | 235 | * @param string the validation group that the button belongs to |
236 | 236 | * @return mixed the newly created button. |
237 | 237 | */ |
238 | - protected function createButton($commandName,$text,$causesValidation,$validationGroup) |
|
238 | + protected function createButton($commandName, $text, $causesValidation, $validationGroup) |
|
239 | 239 | { |
240 | 240 | if($this->getButtonType()===TButtonColumnType::LinkButton) |
241 | - $button= new TLinkButton; |
|
241 | + $button=new TLinkButton; |
|
242 | 242 | else if($this->getButtonType()===TButtonColumnType::PushButton) |
243 | - $button= new TButton; |
|
243 | + $button=new TButton; |
|
244 | 244 | else // image buttons |
245 | 245 | { |
246 | - $button= new TImageButton; |
|
247 | - if(strcasecmp($commandName,'Update')===0) |
|
246 | + $button=new TImageButton; |
|
247 | + if(strcasecmp($commandName, 'Update')===0) |
|
248 | 248 | $url=$this->getUpdateImageUrl(); |
249 | - else if(strcasecmp($commandName,'Cancel')===0) |
|
249 | + else if(strcasecmp($commandName, 'Cancel')===0) |
|
250 | 250 | $url=$this->getCancelImageUrl(); |
251 | 251 | else |
252 | 252 | $url=$this->getEditImageUrl(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | case 'datetime': case 'timestamp': |
38 | 38 | return $this->createDateTimeControl($container, $column, $record); |
39 | 39 | default: |
40 | - return $this->createDefaultControl($container,$column, $record); |
|
40 | + return $this->createDefaultControl($container, $column, $record); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | case 'time': |
55 | 55 | return $this->getTimeValue($container, $column, $record); |
56 | 56 | case 'datetime': case 'timestamp': |
57 | - return $this->getDateTimeValue($container,$column, $record); |
|
57 | + return $this->getDateTimeValue($container, $column, $record); |
|
58 | 58 | default: |
59 | - return $this->getDefaultControlValue($container,$column, $record); |
|
59 | + return $this->getDefaultControlValue($container, $column, $record); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | protected function createDateControl($container, $column, $record) |
64 | 64 | { |
65 | - $control = parent::createDateControl($container, $column, $record); |
|
66 | - $value = $this->getRecordPropertyValue($column, $record); |
|
65 | + $control=parent::createDateControl($container, $column, $record); |
|
66 | + $value=$this->getRecordPropertyValue($column, $record); |
|
67 | 67 | if(!empty($value) && preg_match('/timestamp/i', $column->getDbType())) |
68 | 68 | $control->setTimestamp(intval($value)); |
69 | 69 | return $control; |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | |
72 | 72 | protected function createDateTimeControl($container, $column, $record) |
73 | 73 | { |
74 | - $value = $this->getRecordPropertyValue($column, $record); |
|
75 | - $time = parent::createDateTimeControl($container, $column, $record); |
|
74 | + $value=$this->getRecordPropertyValue($column, $record); |
|
75 | + $time=parent::createDateTimeControl($container, $column, $record); |
|
76 | 76 | if(!empty($value) && preg_match('/timestamp/i', $column->getDbType())) |
77 | 77 | { |
78 | - $s = new TDateTimeStamp; |
|
79 | - $date = $s->getDate(intval($value)); |
|
78 | + $s=new TDateTimeStamp; |
|
79 | + $date=$s->getDate(intval($value)); |
|
80 | 80 | $time[1]->setSelectedValue($date['hours']); |
81 | 81 | $time[2]->setSelectedValue($date['minutes']); |
82 | 82 | $time[3]->setSelectedValue($date['seconds']); |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | { |
89 | 89 | if(preg_match('/timestamp/i', $column->getDbType())) |
90 | 90 | { |
91 | - $time = $container->findControl(self::DEFAULT_ID)->getTimestamp(); |
|
92 | - $s = new TDateTimeStamp; |
|
93 | - $date = $s->getDate($time); |
|
94 | - $hour = $container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
95 | - $mins = $container->findControl('scaffold_time_min')->getSelectedValue(); |
|
96 | - $secs = $container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
97 | - return $s->getTimeStamp($hour,$mins,$secs,$date['mon'],$date['mday'],$date['year']); |
|
91 | + $time=$container->findControl(self::DEFAULT_ID)->getTimestamp(); |
|
92 | + $s=new TDateTimeStamp; |
|
93 | + $date=$s->getDate($time); |
|
94 | + $hour=$container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
95 | + $mins=$container->findControl('scaffold_time_min')->getSelectedValue(); |
|
96 | + $secs=$container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
97 | + return $s->getTimeStamp($hour, $mins, $secs, $date['mon'], $date['mday'], $date['year']); |
|
98 | 98 | } |
99 | 99 | else |
100 | 100 | return parent::getDateTimeValue($container, $column, $record); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * Charset, default is 'UTF-8' |
61 | 61 | * @var string |
62 | 62 | */ |
63 | - private $charset = 'UTF-8'; |
|
63 | + private $charset='UTF-8'; |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Constructor, create a new date time formatter. |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function setPattern($pattern) |
88 | 88 | { |
89 | - $this->pattern = $pattern; |
|
89 | + $this->pattern=$pattern; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setCharset($charset) |
104 | 104 | { |
105 | - $this->charset = $charset; |
|
105 | + $this->charset=$charset; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -112,17 +112,17 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function format($value) |
114 | 114 | { |
115 | - $date = $this->getDate($value); |
|
116 | - $bits['yyyy'] = $date['year']; |
|
117 | - $bits['yy'] = substr("{$date['year']}", -2); |
|
115 | + $date=$this->getDate($value); |
|
116 | + $bits['yyyy']=$date['year']; |
|
117 | + $bits['yy']=substr("{$date['year']}", -2); |
|
118 | 118 | |
119 | - $bits['MM'] = str_pad("{$date['mon']}", 2, '0', STR_PAD_LEFT); |
|
120 | - $bits['M'] = $date['mon']; |
|
119 | + $bits['MM']=str_pad("{$date['mon']}", 2, '0', STR_PAD_LEFT); |
|
120 | + $bits['M']=$date['mon']; |
|
121 | 121 | |
122 | - $bits['dd'] = str_pad("{$date['mday']}", 2, '0', STR_PAD_LEFT); |
|
123 | - $bits['d'] = $date['mday']; |
|
122 | + $bits['dd']=str_pad("{$date['mday']}", 2, '0', STR_PAD_LEFT); |
|
123 | + $bits['d']=$date['mday']; |
|
124 | 124 | |
125 | - $pattern = preg_replace('/M{3,4}/', 'MM', $this->pattern); |
|
125 | + $pattern=preg_replace('/M{3,4}/', 'MM', $this->pattern); |
|
126 | 126 | return str_replace(array_keys($bits), $bits, $pattern); |
127 | 127 | } |
128 | 128 | |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | |
160 | 160 | public function getDayMonthYearOrdering() |
161 | 161 | { |
162 | - $ordering = array(); |
|
163 | - if(is_int($day= strpos($this->pattern, 'd'))) |
|
164 | - $ordering['day'] = $day; |
|
165 | - if(is_int($month= strpos($this->pattern, 'M'))) |
|
166 | - $ordering['month'] = $month; |
|
167 | - if(is_int($year= strpos($this->pattern, 'yy'))) |
|
168 | - $ordering['year'] = $year; |
|
162 | + $ordering=array(); |
|
163 | + if(is_int($day=strpos($this->pattern, 'd'))) |
|
164 | + $ordering['day']=$day; |
|
165 | + if(is_int($month=strpos($this->pattern, 'M'))) |
|
166 | + $ordering['month']=$month; |
|
167 | + if(is_int($year=strpos($this->pattern, 'yy'))) |
|
168 | + $ordering['year']=$year; |
|
169 | 169 | asort($ordering); |
170 | 170 | return array_keys($ordering); |
171 | 171 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | private function getDate($value) |
179 | 179 | { |
180 | - $s = new TDateTimeStamp; |
|
180 | + $s=new TDateTimeStamp; |
|
181 | 181 | if(is_numeric($value)) |
182 | 182 | return $s->getDate($value); |
183 | 183 | else |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function isValidDate($value) |
191 | 191 | { |
192 | - if($value === null) { |
|
192 | + if($value===null) { |
|
193 | 193 | return false; |
194 | 194 | } else { |
195 | - return $this->parse($value, false) !== null; |
|
195 | + return $this->parse($value, false)!==null; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return int date time stamp |
203 | 203 | * @throws TInvalidDataValueException if date string is malformed. |
204 | 204 | */ |
205 | - public function parse($value,$defaultToCurrentTime=true) |
|
205 | + public function parse($value, $defaultToCurrentTime=true) |
|
206 | 206 | { |
207 | 207 | if(is_int($value) || is_float($value)) |
208 | 208 | return $value; |
@@ -211,108 +211,108 @@ discard block |
||
211 | 211 | |
212 | 212 | if(empty($this->pattern)) return time(); |
213 | 213 | |
214 | - $date = time(); |
|
214 | + $date=time(); |
|
215 | 215 | |
216 | 216 | if($this->length(trim($value)) < 1) |
217 | 217 | return $defaultToCurrentTime ? $date : null; |
218 | 218 | |
219 | - $pattern = $this->pattern; |
|
219 | + $pattern=$this->pattern; |
|
220 | 220 | |
221 | - $i_val = 0; |
|
222 | - $i_format = 0; |
|
223 | - $pattern_length = $this->length($pattern); |
|
224 | - $c = ''; |
|
221 | + $i_val=0; |
|
222 | + $i_format=0; |
|
223 | + $pattern_length=$this->length($pattern); |
|
224 | + $c=''; |
|
225 | 225 | $token=''; |
226 | 226 | $x=null; $y=null; |
227 | 227 | |
228 | 228 | |
229 | 229 | if($defaultToCurrentTime) |
230 | 230 | { |
231 | - $year = "{$date['year']}"; |
|
232 | - $month = $date['mon']; |
|
233 | - $day = $date['mday']; |
|
231 | + $year="{$date['year']}"; |
|
232 | + $month=$date['mon']; |
|
233 | + $day=$date['mday']; |
|
234 | 234 | } |
235 | 235 | else |
236 | 236 | { |
237 | - $year = null; |
|
238 | - $month = null; |
|
239 | - $day = null; |
|
237 | + $year=null; |
|
238 | + $month=null; |
|
239 | + $day=null; |
|
240 | 240 | } |
241 | 241 | |
242 | - while ($i_format < $pattern_length) |
|
242 | + while($i_format < $pattern_length) |
|
243 | 243 | { |
244 | - $c = $this->charAt($pattern,$i_format); |
|
244 | + $c=$this->charAt($pattern, $i_format); |
|
245 | 245 | $token=''; |
246 | - while ($this->charEqual($pattern, $i_format, $c) |
|
246 | + while($this->charEqual($pattern, $i_format, $c) |
|
247 | 247 | && ($i_format < $pattern_length)) |
248 | 248 | { |
249 | - $token .= $this->charAt($pattern, $i_format++); |
|
249 | + $token.=$this->charAt($pattern, $i_format++); |
|
250 | 250 | } |
251 | 251 | |
252 | - if ($token=='yyyy' || $token=='yy' || $token=='y') |
|
252 | + if($token=='yyyy' || $token=='yy' || $token=='y') |
|
253 | 253 | { |
254 | - if ($token=='yyyy') { $x=4;$y=4; } |
|
255 | - if ($token=='yy') { $x=2;$y=2; } |
|
256 | - if ($token=='y') { $x=2;$y=4; } |
|
257 | - $year = $this->getInteger($value,$i_val,$x,$y); |
|
258 | - if($year === null) |
|
254 | + if($token=='yyyy') { $x=4; $y=4; } |
|
255 | + if($token=='yy') { $x=2; $y=2; } |
|
256 | + if($token=='y') { $x=2; $y=4; } |
|
257 | + $year=$this->getInteger($value, $i_val, $x, $y); |
|
258 | + if($year===null) |
|
259 | 259 | return null; |
260 | 260 | //throw new TInvalidDataValueException('Invalid year', $value); |
261 | - $i_val += strlen($year); |
|
262 | - if(strlen($year) == 2) |
|
261 | + $i_val+=strlen($year); |
|
262 | + if(strlen($year)==2) |
|
263 | 263 | { |
264 | - $iYear = (int)$year; |
|
264 | + $iYear=(int) $year; |
|
265 | 265 | if($iYear > 70) |
266 | - $year = $iYear + 1900; |
|
266 | + $year=$iYear + 1900; |
|
267 | 267 | else |
268 | - $year = $iYear + 2000; |
|
268 | + $year=$iYear + 2000; |
|
269 | 269 | } |
270 | - $year = (int)$year; |
|
270 | + $year=(int) $year; |
|
271 | 271 | } |
272 | 272 | elseif($token=='MM' || $token=='M') |
273 | 273 | { |
274 | - $month=$this->getInteger($value,$i_val, |
|
275 | - $this->length($token),2); |
|
276 | - $iMonth = (int)$month; |
|
277 | - if($month === null || $iMonth < 1 || $iMonth > 12 ) |
|
274 | + $month=$this->getInteger($value, $i_val, |
|
275 | + $this->length($token), 2); |
|
276 | + $iMonth=(int) $month; |
|
277 | + if($month===null || $iMonth < 1 || $iMonth > 12) |
|
278 | 278 | return null; |
279 | 279 | //throw new TInvalidDataValueException('Invalid month', $value); |
280 | - $i_val += strlen($month); |
|
281 | - $month = $iMonth; |
|
280 | + $i_val+=strlen($month); |
|
281 | + $month=$iMonth; |
|
282 | 282 | } |
283 | - elseif ($token=='dd' || $token=='d') |
|
283 | + elseif($token=='dd' || $token=='d') |
|
284 | 284 | { |
285 | - $day = $this->getInteger($value,$i_val, |
|
285 | + $day=$this->getInteger($value, $i_val, |
|
286 | 286 | $this->length($token), 2); |
287 | - $iDay = (int)$day; |
|
288 | - if($day === null || $iDay < 1 || $iDay >31) |
|
287 | + $iDay=(int) $day; |
|
288 | + if($day===null || $iDay < 1 || $iDay > 31) |
|
289 | 289 | return null; |
290 | 290 | //throw new TInvalidDataValueException('Invalid day', $value); |
291 | - $i_val += strlen($day); |
|
292 | - $day = $iDay; |
|
291 | + $i_val+=strlen($day); |
|
292 | + $day=$iDay; |
|
293 | 293 | } |
294 | 294 | else |
295 | 295 | { |
296 | - if($this->substring($value, $i_val, $this->length($token)) != $token) |
|
296 | + if($this->substring($value, $i_val, $this->length($token))!=$token) |
|
297 | 297 | return null; |
298 | 298 | //throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value); |
299 | 299 | else |
300 | - $i_val += $this->length($token); |
|
300 | + $i_val+=$this->length($token); |
|
301 | 301 | } |
302 | 302 | } |
303 | - if ($i_val != $this->length($value)) |
|
303 | + if($i_val!=$this->length($value)) |
|
304 | 304 | return null; |
305 | 305 | //throw new TInvalidDataValueException("Pattern '{$this->pattern}' mismatch", $value); |
306 | - if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null)) |
|
306 | + if(!$defaultToCurrentTime && ($month===null || $day===null || $year===null)) |
|
307 | 307 | return null; |
308 | 308 | else |
309 | 309 | { |
310 | 310 | if(empty($year)) { |
311 | - $year = date('Y'); |
|
311 | + $year=date('Y'); |
|
312 | 312 | } |
313 | - $day = (int)$day <= 0 ? 1 : (int)$day; |
|
314 | - $month = (int)$month <= 0 ? 1 : (int)$month; |
|
315 | - $s = new TDateTimeStamp; |
|
313 | + $day=(int) $day <= 0 ? 1 : (int) $day; |
|
314 | + $month=(int) $month <= 0 ? 1 : (int) $month; |
|
315 | + $s=new TDateTimeStamp; |
|
316 | 316 | return $s->getTimeStamp(0, 0, 0, $month, $day, $year); |
317 | 317 | } |
318 | 318 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | */ |
348 | 348 | private function charEqual($string, $pos, $char) |
349 | 349 | { |
350 | - return $this->charAt($string, $pos) == $char; |
|
350 | + return $this->charAt($string, $pos)==$char; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
@@ -358,15 +358,15 @@ discard block |
||
358 | 358 | * @param int maximum integer length |
359 | 359 | * @return string integer portion of the string, null otherwise |
360 | 360 | */ |
361 | - private function getInteger($str,$i,$minlength,$maxlength) |
|
361 | + private function getInteger($str, $i, $minlength, $maxlength) |
|
362 | 362 | { |
363 | 363 | //match for digits backwards |
364 | - for ($x = $maxlength; $x >= $minlength; $x--) |
|
364 | + for($x=$maxlength; $x >= $minlength; $x--) |
|
365 | 365 | { |
366 | - $token= $this->substring($str, $i,$x); |
|
367 | - if ($this->length($token) < $minlength) |
|
366 | + $token=$this->substring($str, $i, $x); |
|
367 | + if($this->length($token) < $minlength) |
|
368 | 368 | return null; |
369 | - if (preg_match('/^\d+$/', $token)) |
|
369 | + if(preg_match('/^\d+$/', $token)) |
|
370 | 370 | return $token; |
371 | 371 | } |
372 | 372 | return null; |