@@ -43,9 +43,9 @@ |
||
43 | 43 | { |
44 | 44 | $writer->addAttribute('src', $this->getImageUrl()); |
45 | 45 | $writer->addAttribute('alt', $this->getAlternateText()); |
46 | - if(($desc = $this->getDescriptionUrl()) !== '') |
|
46 | + if (($desc = $this->getDescriptionUrl()) !== '') |
|
47 | 47 | $writer->addAttribute('longdesc', $desc); |
48 | - if(($align = $this->getImageAlign()) !== '') |
|
48 | + if (($align = $this->getImageAlign()) !== '') |
|
49 | 49 | $writer->addAttribute('align', $align); |
50 | 50 | parent::addAttributesToRender($writer); |
51 | 51 | } |
@@ -43,10 +43,12 @@ |
||
43 | 43 | { |
44 | 44 | $writer->addAttribute('src', $this->getImageUrl()); |
45 | 45 | $writer->addAttribute('alt', $this->getAlternateText()); |
46 | - if(($desc = $this->getDescriptionUrl()) !== '') |
|
47 | - $writer->addAttribute('longdesc', $desc); |
|
48 | - if(($align = $this->getImageAlign()) !== '') |
|
49 | - $writer->addAttribute('align', $align); |
|
46 | + if(($desc = $this->getDescriptionUrl()) !== '') { |
|
47 | + $writer->addAttribute('longdesc', $desc); |
|
48 | + } |
|
49 | + if(($align = $this->getImageAlign()) !== '') { |
|
50 | + $writer->addAttribute('align', $align); |
|
51 | + } |
|
50 | 52 | parent::addAttributesToRender($writer); |
51 | 53 | } |
52 | 54 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getDecorator($create = true) |
75 | 75 | { |
76 | - if($create && !$this->_decorator) |
|
76 | + if ($create && !$this->_decorator) |
|
77 | 77 | $this->_decorator = new TWebControlDecorator($this); |
78 | 78 | return $this->_decorator; |
79 | 79 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $this->setAccessKey($control->getAccessKey()); |
90 | 90 | $this->setToolTip($control->getToolTip()); |
91 | 91 | $this->setTabIndex($control->getTabIndex()); |
92 | - if(!$control->getEnabled()) |
|
92 | + if (!$control->getEnabled()) |
|
93 | 93 | $this->setEnabled(false); |
94 | - if($control->getHasAttributes()) |
|
94 | + if ($control->getHasAttributes()) |
|
95 | 95 | $this->getAttributes()->copyFrom($control->getAttributes()); |
96 | 96 | } |
97 | 97 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function setAccessKey($value) |
114 | 114 | { |
115 | - if(strlen($value) > 1) |
|
115 | + if (strlen($value) > 1) |
|
116 | 116 | throw new TInvalidDataValueException('webcontrol_accesskey_invalid', get_class($this), $value); |
117 | 117 | $this->setViewState('AccessKey', $value, ''); |
118 | 118 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getBackColor() |
124 | 124 | { |
125 | - if($style = $this->getViewState('Style', null)) |
|
125 | + if ($style = $this->getViewState('Style', null)) |
|
126 | 126 | return $style->getBackColor(); |
127 | 127 | else |
128 | 128 | return ''; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function getBorderColor() |
143 | 143 | { |
144 | - if($style = $this->getViewState('Style', null)) |
|
144 | + if ($style = $this->getViewState('Style', null)) |
|
145 | 145 | return $style->getBorderColor(); |
146 | 146 | else |
147 | 147 | return ''; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function getBorderStyle() |
162 | 162 | { |
163 | - if($style = $this->getViewState('Style', null)) |
|
163 | + if ($style = $this->getViewState('Style', null)) |
|
164 | 164 | return $style->getBorderStyle(); |
165 | 165 | else |
166 | 166 | return ''; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function getBorderWidth() |
181 | 181 | { |
182 | - if($style = $this->getViewState('Style', null)) |
|
182 | + if ($style = $this->getViewState('Style', null)) |
|
183 | 183 | return $style->getBorderWidth(); |
184 | 184 | else |
185 | 185 | return ''; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function getForeColor() |
208 | 208 | { |
209 | - if($style = $this->getViewState('Style', null)) |
|
209 | + if ($style = $this->getViewState('Style', null)) |
|
210 | 210 | return $style->getForeColor(); |
211 | 211 | else |
212 | 212 | return ''; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getHeight() |
227 | 227 | { |
228 | - if($style = $this->getViewState('Style', null)) |
|
228 | + if ($style = $this->getViewState('Style', null)) |
|
229 | 229 | return $style->getHeight(); |
230 | 230 | else |
231 | 231 | return ''; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function getCssClass() |
262 | 262 | { |
263 | - if($style = $this->getViewState('Style', null)) |
|
263 | + if ($style = $this->getViewState('Style', null)) |
|
264 | 264 | return $style->getCssClass(); |
265 | 265 | else |
266 | 266 | return ''; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public function getStyle() |
299 | 299 | { |
300 | - if($style = $this->getViewState('Style', null)) |
|
300 | + if ($style = $this->getViewState('Style', null)) |
|
301 | 301 | return $style; |
302 | 302 | else |
303 | 303 | { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function setStyle($value) |
317 | 317 | { |
318 | - if(is_string($value)) |
|
318 | + if (is_string($value)) |
|
319 | 319 | $this->getStyle()->setCustomStyle($value); |
320 | 320 | else |
321 | 321 | throw new TInvalidDataValueException('webcontrol_style_invalid', get_class($this)); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | */ |
382 | 382 | public function getWidth() |
383 | 383 | { |
384 | - if($style = $this->getViewState('Style', null)) |
|
384 | + if ($style = $this->getViewState('Style', null)) |
|
385 | 385 | return $style->getWidth(); |
386 | 386 | else |
387 | 387 | return ''; |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * @param TEventParameter event parameter to be passed to the event handlers |
404 | 404 | */ |
405 | 405 | public function onPreRender($param) { |
406 | - if($decorator = $this->getDecorator(false)) |
|
406 | + if ($decorator = $this->getDecorator(false)) |
|
407 | 407 | $decorator->instantiate(); |
408 | 408 | |
409 | 409 | parent::onPreRender($param); |
@@ -418,21 +418,21 @@ discard block |
||
418 | 418 | */ |
419 | 419 | protected function addAttributesToRender($writer) |
420 | 420 | { |
421 | - if($this->getID() !== '' || $this->getEnsureId()) |
|
421 | + if ($this->getID() !== '' || $this->getEnsureId()) |
|
422 | 422 | $writer->addAttribute('id', $this->getClientID()); |
423 | - if(($accessKey = $this->getAccessKey()) !== '') |
|
423 | + if (($accessKey = $this->getAccessKey()) !== '') |
|
424 | 424 | $writer->addAttribute('accesskey', $accessKey); |
425 | - if(!$this->getEnabled()) |
|
425 | + if (!$this->getEnabled()) |
|
426 | 426 | $writer->addAttribute('disabled', 'disabled'); |
427 | - if(($tabIndex = $this->getTabIndex()) > 0) |
|
427 | + if (($tabIndex = $this->getTabIndex()) > 0) |
|
428 | 428 | $writer->addAttribute('tabindex', "$tabIndex"); |
429 | - if(($toolTip = $this->getToolTip()) !== '') |
|
429 | + if (($toolTip = $this->getToolTip()) !== '') |
|
430 | 430 | $writer->addAttribute('title', $toolTip); |
431 | - if($style = $this->getViewState('Style', null)) |
|
431 | + if ($style = $this->getViewState('Style', null)) |
|
432 | 432 | $style->addAttributesToRender($writer); |
433 | - if($this->getHasAttributes()) |
|
433 | + if ($this->getHasAttributes()) |
|
434 | 434 | { |
435 | - foreach($this->getAttributes() as $name => $value) |
|
435 | + foreach ($this->getAttributes() as $name => $value) |
|
436 | 436 | $writer->addAttribute($name, $value); |
437 | 437 | } |
438 | 438 | } |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | */ |
460 | 460 | public function renderBeginTag($writer) |
461 | 461 | { |
462 | - if($decorator = $this->getDecorator(false)) { |
|
462 | + if ($decorator = $this->getDecorator(false)) { |
|
463 | 463 | $decorator->renderPreTagText($writer); |
464 | 464 | $this->addAttributesToRender($writer); |
465 | 465 | $writer->renderBeginTag($this->getTagName()); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | */ |
488 | 488 | public function renderEndTag($writer) |
489 | 489 | { |
490 | - if($decorator = $this->getDecorator(false)) { |
|
490 | + if ($decorator = $this->getDecorator(false)) { |
|
491 | 491 | $decorator->renderPostContentsText($writer); |
492 | 492 | $writer->renderEndTag(); |
493 | 493 | $decorator->renderPostTagText($writer); |
@@ -73,8 +73,9 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getDecorator($create = true) |
75 | 75 | { |
76 | - if($create && !$this->_decorator) |
|
77 | - $this->_decorator = new TWebControlDecorator($this); |
|
76 | + if($create && !$this->_decorator) { |
|
77 | + $this->_decorator = new TWebControlDecorator($this); |
|
78 | + } |
|
78 | 79 | return $this->_decorator; |
79 | 80 | } |
80 | 81 | |
@@ -89,10 +90,12 @@ discard block |
||
89 | 90 | $this->setAccessKey($control->getAccessKey()); |
90 | 91 | $this->setToolTip($control->getToolTip()); |
91 | 92 | $this->setTabIndex($control->getTabIndex()); |
92 | - if(!$control->getEnabled()) |
|
93 | - $this->setEnabled(false); |
|
94 | - if($control->getHasAttributes()) |
|
95 | - $this->getAttributes()->copyFrom($control->getAttributes()); |
|
93 | + if(!$control->getEnabled()) { |
|
94 | + $this->setEnabled(false); |
|
95 | + } |
|
96 | + if($control->getHasAttributes()) { |
|
97 | + $this->getAttributes()->copyFrom($control->getAttributes()); |
|
98 | + } |
|
96 | 99 | } |
97 | 100 | |
98 | 101 | /** |
@@ -112,8 +115,9 @@ discard block |
||
112 | 115 | */ |
113 | 116 | public function setAccessKey($value) |
114 | 117 | { |
115 | - if(strlen($value) > 1) |
|
116 | - throw new TInvalidDataValueException('webcontrol_accesskey_invalid', get_class($this), $value); |
|
118 | + if(strlen($value) > 1) { |
|
119 | + throw new TInvalidDataValueException('webcontrol_accesskey_invalid', get_class($this), $value); |
|
120 | + } |
|
117 | 121 | $this->setViewState('AccessKey', $value, ''); |
118 | 122 | } |
119 | 123 | |
@@ -122,10 +126,11 @@ discard block |
||
122 | 126 | */ |
123 | 127 | public function getBackColor() |
124 | 128 | { |
125 | - if($style = $this->getViewState('Style', null)) |
|
126 | - return $style->getBackColor(); |
|
127 | - else |
|
128 | - return ''; |
|
129 | + if($style = $this->getViewState('Style', null)) { |
|
130 | + return $style->getBackColor(); |
|
131 | + } else { |
|
132 | + return ''; |
|
133 | + } |
|
129 | 134 | } |
130 | 135 | |
131 | 136 | /** |
@@ -141,10 +146,11 @@ discard block |
||
141 | 146 | */ |
142 | 147 | public function getBorderColor() |
143 | 148 | { |
144 | - if($style = $this->getViewState('Style', null)) |
|
145 | - return $style->getBorderColor(); |
|
146 | - else |
|
147 | - return ''; |
|
149 | + if($style = $this->getViewState('Style', null)) { |
|
150 | + return $style->getBorderColor(); |
|
151 | + } else { |
|
152 | + return ''; |
|
153 | + } |
|
148 | 154 | } |
149 | 155 | |
150 | 156 | /** |
@@ -160,10 +166,11 @@ discard block |
||
160 | 166 | */ |
161 | 167 | public function getBorderStyle() |
162 | 168 | { |
163 | - if($style = $this->getViewState('Style', null)) |
|
164 | - return $style->getBorderStyle(); |
|
165 | - else |
|
166 | - return ''; |
|
169 | + if($style = $this->getViewState('Style', null)) { |
|
170 | + return $style->getBorderStyle(); |
|
171 | + } else { |
|
172 | + return ''; |
|
173 | + } |
|
167 | 174 | } |
168 | 175 | |
169 | 176 | /** |
@@ -179,10 +186,11 @@ discard block |
||
179 | 186 | */ |
180 | 187 | public function getBorderWidth() |
181 | 188 | { |
182 | - if($style = $this->getViewState('Style', null)) |
|
183 | - return $style->getBorderWidth(); |
|
184 | - else |
|
185 | - return ''; |
|
189 | + if($style = $this->getViewState('Style', null)) { |
|
190 | + return $style->getBorderWidth(); |
|
191 | + } else { |
|
192 | + return ''; |
|
193 | + } |
|
186 | 194 | } |
187 | 195 | |
188 | 196 | /** |
@@ -206,10 +214,11 @@ discard block |
||
206 | 214 | */ |
207 | 215 | public function getForeColor() |
208 | 216 | { |
209 | - if($style = $this->getViewState('Style', null)) |
|
210 | - return $style->getForeColor(); |
|
211 | - else |
|
212 | - return ''; |
|
217 | + if($style = $this->getViewState('Style', null)) { |
|
218 | + return $style->getForeColor(); |
|
219 | + } else { |
|
220 | + return ''; |
|
221 | + } |
|
213 | 222 | } |
214 | 223 | |
215 | 224 | /** |
@@ -225,10 +234,11 @@ discard block |
||
225 | 234 | */ |
226 | 235 | public function getHeight() |
227 | 236 | { |
228 | - if($style = $this->getViewState('Style', null)) |
|
229 | - return $style->getHeight(); |
|
230 | - else |
|
231 | - return ''; |
|
237 | + if($style = $this->getViewState('Style', null)) { |
|
238 | + return $style->getHeight(); |
|
239 | + } else { |
|
240 | + return ''; |
|
241 | + } |
|
232 | 242 | } |
233 | 243 | |
234 | 244 | /** |
@@ -260,10 +270,11 @@ discard block |
||
260 | 270 | */ |
261 | 271 | public function getCssClass() |
262 | 272 | { |
263 | - if($style = $this->getViewState('Style', null)) |
|
264 | - return $style->getCssClass(); |
|
265 | - else |
|
266 | - return ''; |
|
273 | + if($style = $this->getViewState('Style', null)) { |
|
274 | + return $style->getCssClass(); |
|
275 | + } else { |
|
276 | + return ''; |
|
277 | + } |
|
267 | 278 | } |
268 | 279 | |
269 | 280 | /** |
@@ -297,9 +308,9 @@ discard block |
||
297 | 308 | */ |
298 | 309 | public function getStyle() |
299 | 310 | { |
300 | - if($style = $this->getViewState('Style', null)) |
|
301 | - return $style; |
|
302 | - else |
|
311 | + if($style = $this->getViewState('Style', null)) { |
|
312 | + return $style; |
|
313 | + } else |
|
303 | 314 | { |
304 | 315 | $style = $this->createStyle(); |
305 | 316 | $this->setViewState('Style', $style, null); |
@@ -315,10 +326,11 @@ discard block |
||
315 | 326 | */ |
316 | 327 | public function setStyle($value) |
317 | 328 | { |
318 | - if(is_string($value)) |
|
319 | - $this->getStyle()->setCustomStyle($value); |
|
320 | - else |
|
321 | - throw new TInvalidDataValueException('webcontrol_style_invalid', get_class($this)); |
|
329 | + if(is_string($value)) { |
|
330 | + $this->getStyle()->setCustomStyle($value); |
|
331 | + } else { |
|
332 | + throw new TInvalidDataValueException('webcontrol_style_invalid', get_class($this)); |
|
333 | + } |
|
322 | 334 | } |
323 | 335 | |
324 | 336 | /** |
@@ -381,10 +393,11 @@ discard block |
||
381 | 393 | */ |
382 | 394 | public function getWidth() |
383 | 395 | { |
384 | - if($style = $this->getViewState('Style', null)) |
|
385 | - return $style->getWidth(); |
|
386 | - else |
|
387 | - return ''; |
|
396 | + if($style = $this->getViewState('Style', null)) { |
|
397 | + return $style->getWidth(); |
|
398 | + } else { |
|
399 | + return ''; |
|
400 | + } |
|
388 | 401 | } |
389 | 402 | |
390 | 403 | /** |
@@ -403,8 +416,9 @@ discard block |
||
403 | 416 | * @param TEventParameter event parameter to be passed to the event handlers |
404 | 417 | */ |
405 | 418 | public function onPreRender($param) { |
406 | - if($decorator = $this->getDecorator(false)) |
|
407 | - $decorator->instantiate(); |
|
419 | + if($decorator = $this->getDecorator(false)) { |
|
420 | + $decorator->instantiate(); |
|
421 | + } |
|
408 | 422 | |
409 | 423 | parent::onPreRender($param); |
410 | 424 | } |
@@ -418,22 +432,29 @@ discard block |
||
418 | 432 | */ |
419 | 433 | protected function addAttributesToRender($writer) |
420 | 434 | { |
421 | - if($this->getID() !== '' || $this->getEnsureId()) |
|
422 | - $writer->addAttribute('id', $this->getClientID()); |
|
423 | - if(($accessKey = $this->getAccessKey()) !== '') |
|
424 | - $writer->addAttribute('accesskey', $accessKey); |
|
425 | - if(!$this->getEnabled()) |
|
426 | - $writer->addAttribute('disabled', 'disabled'); |
|
427 | - if(($tabIndex = $this->getTabIndex()) > 0) |
|
428 | - $writer->addAttribute('tabindex', "$tabIndex"); |
|
429 | - if(($toolTip = $this->getToolTip()) !== '') |
|
430 | - $writer->addAttribute('title', $toolTip); |
|
431 | - if($style = $this->getViewState('Style', null)) |
|
432 | - $style->addAttributesToRender($writer); |
|
435 | + if($this->getID() !== '' || $this->getEnsureId()) { |
|
436 | + $writer->addAttribute('id', $this->getClientID()); |
|
437 | + } |
|
438 | + if(($accessKey = $this->getAccessKey()) !== '') { |
|
439 | + $writer->addAttribute('accesskey', $accessKey); |
|
440 | + } |
|
441 | + if(!$this->getEnabled()) { |
|
442 | + $writer->addAttribute('disabled', 'disabled'); |
|
443 | + } |
|
444 | + if(($tabIndex = $this->getTabIndex()) > 0) { |
|
445 | + $writer->addAttribute('tabindex', "$tabIndex"); |
|
446 | + } |
|
447 | + if(($toolTip = $this->getToolTip()) !== '') { |
|
448 | + $writer->addAttribute('title', $toolTip); |
|
449 | + } |
|
450 | + if($style = $this->getViewState('Style', null)) { |
|
451 | + $style->addAttributesToRender($writer); |
|
452 | + } |
|
433 | 453 | if($this->getHasAttributes()) |
434 | 454 | { |
435 | - foreach($this->getAttributes() as $name => $value) |
|
436 | - $writer->addAttribute($name, $value); |
|
455 | + foreach($this->getAttributes() as $name => $value) { |
|
456 | + $writer->addAttribute($name, $value); |
|
457 | + } |
|
437 | 458 | } |
438 | 459 | } |
439 | 460 | |
@@ -491,7 +512,8 @@ discard block |
||
491 | 512 | $decorator->renderPostContentsText($writer); |
492 | 513 | $writer->renderEndTag(); |
493 | 514 | $decorator->renderPostTagText($writer); |
494 | - } else |
|
495 | - $writer->renderEndTag($writer); |
|
515 | + } else { |
|
516 | + $writer->renderEndTag($writer); |
|
517 | + } |
|
496 | 518 | } |
497 | 519 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public function setTokenImageTheme($value) |
94 | 94 | { |
95 | 95 | $value = TPropertyValue::ensureInteger($value); |
96 | - if($value >= 0 && $value <= 63) |
|
96 | + if ($value >= 0 && $value <= 63) |
|
97 | 97 | $this->setViewState('TokenImageTheme', $value, 0); |
98 | 98 | else |
99 | 99 | throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public function setTokenFontSize($value) |
117 | 117 | { |
118 | 118 | $value = TPropertyValue::ensureInteger($value); |
119 | - if($value >= 20 && $value <= 100) |
|
119 | + if ($value >= 20 && $value <= 100) |
|
120 | 120 | $this->setViewState('TokenFontSize', $value, 30); |
121 | 121 | else |
122 | 122 | throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function setMinTokenLength($value) |
137 | 137 | { |
138 | 138 | $length = TPropertyValue::ensureInteger($value); |
139 | - if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
139 | + if ($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
140 | 140 | $this->setViewState('MinTokenLength', $length, 4); |
141 | 141 | else |
142 | 142 | throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | public function setMaxTokenLength($value) |
157 | 157 | { |
158 | 158 | $length = TPropertyValue::ensureInteger($value); |
159 | - if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
159 | + if ($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
160 | 160 | $this->setViewState('MaxTokenLength', $length, 6); |
161 | 161 | else |
162 | 162 | throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function setTokenAlphabet($value) |
193 | 193 | { |
194 | - if(strlen($value) < 2) |
|
194 | + if (strlen($value) < 2) |
|
195 | 195 | throw new TConfigurationException('captcha_tokenalphabet_invalid'); |
196 | 196 | $this->setViewState('TokenAlphabet', $value, '234578adefhijmnrtABDEFGHJLMNRT'); |
197 | 197 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function getIsTokenExpired() |
251 | 251 | { |
252 | - if(($expiry = $this->getTokenExpiry()) > 0 && ($start = $this->getViewState('TokenGenerated', 0)) > 0) |
|
252 | + if (($expiry = $this->getTokenExpiry()) > 0 && ($start = $this->getViewState('TokenGenerated', 0)) > 0) |
|
253 | 253 | return $expiry + $start < time(); |
254 | 254 | else |
255 | 255 | return false; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function getPublicKey() |
262 | 262 | { |
263 | - if(($publicKey = $this->getViewState('PublicKey', '')) === '') |
|
263 | + if (($publicKey = $this->getViewState('PublicKey', '')) === '') |
|
264 | 264 | { |
265 | 265 | $publicKey = $this->generateRandomKey(); |
266 | 266 | $this->setPublicKey($publicKey); |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | */ |
290 | 290 | protected function getTokenLength() |
291 | 291 | { |
292 | - if(($tokenLength = $this->getViewState('TokenLength')) === null) |
|
292 | + if (($tokenLength = $this->getViewState('TokenLength')) === null) |
|
293 | 293 | { |
294 | 294 | $minLength = $this->getMinTokenLength(); |
295 | 295 | $maxLength = $this->getMaxTokenLength(); |
296 | - if($minLength > $maxLength) |
|
296 | + if ($minLength > $maxLength) |
|
297 | 297 | $tokenLength = rand($maxLength, $minLength); |
298 | - elseif($minLength < $maxLength) |
|
298 | + elseif ($minLength < $maxLength) |
|
299 | 299 | $tokenLength = rand($minLength, $maxLength); |
300 | 300 | else |
301 | 301 | $tokenLength = $minLength; |
@@ -309,12 +309,12 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function getPrivateKey() |
311 | 311 | { |
312 | - if($this->_privateKey === null) |
|
312 | + if ($this->_privateKey === null) |
|
313 | 313 | { |
314 | 314 | $fileName = $this->generatePrivateKeyFile(); |
315 | 315 | $content = file_get_contents($fileName); |
316 | 316 | $matches = []; |
317 | - if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0) |
|
317 | + if (preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0) |
|
318 | 318 | $this->_privateKey = $matches[1]; |
319 | 319 | else |
320 | 320 | throw new TConfigurationException('captcha_privatekey_unknown'); |
@@ -330,17 +330,17 @@ discard block |
||
330 | 330 | public function validate($input) |
331 | 331 | { |
332 | 332 | $number = $this->getViewState('TestNumber', 0); |
333 | - if(!$this->_validated) |
|
333 | + if (!$this->_validated) |
|
334 | 334 | { |
335 | 335 | $this->setViewState('TestNumber', ++$number); |
336 | 336 | $this->_validated = true; |
337 | 337 | } |
338 | - if($this->getIsTokenExpired() || (($limit = $this->getTestLimit()) > 0 && $number > $limit)) |
|
338 | + if ($this->getIsTokenExpired() || (($limit = $this->getTestLimit()) > 0 && $number > $limit)) |
|
339 | 339 | { |
340 | 340 | $this->regenerateToken(); |
341 | 341 | return false; |
342 | 342 | } |
343 | - return ($this->getToken() === ($this->getCaseSensitive()?$input:strtoupper($input))); |
|
343 | + return ($this->getToken() === ($this->getCaseSensitive() ? $input : strtoupper($input))); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -364,14 +364,14 @@ discard block |
||
364 | 364 | public function onPreRender($param) |
365 | 365 | { |
366 | 366 | parent::onPreRender($param); |
367 | - if(!self::checkRequirements()) |
|
367 | + if (!self::checkRequirements()) |
|
368 | 368 | throw new TConfigurationException('captcha_imagettftext_required'); |
369 | - if(!$this->getViewState('TokenGenerated', 0)) |
|
369 | + if (!$this->getViewState('TokenGenerated', 0)) |
|
370 | 370 | { |
371 | 371 | $manager = $this->getApplication()->getAssetManager(); |
372 | 372 | $manager->publishFilePath($this->getFontFile()); |
373 | 373 | $url = $manager->publishFilePath($this->getCaptchaScriptFile()); |
374 | - $url .= '?options=' . urlencode($this->getTokenImageOptions()); |
|
374 | + $url .= '?options='.urlencode($this->getTokenImageOptions()); |
|
375 | 375 | $this->setImageUrl($url); |
376 | 376 | |
377 | 377 | $this->setViewState('TokenGenerated', time()); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | protected function getTokenImageOptions() |
385 | 385 | { |
386 | - $privateKey = $this->getPrivateKey(); // call this method to ensure private key is generated |
|
386 | + $privateKey = $this->getPrivateKey(); // call this method to ensure private key is generated |
|
387 | 387 | $token = $this->getToken(); |
388 | 388 | $options = []; |
389 | 389 | $options['publicKey'] = $this->getPublicKey(); |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | $options['alphabet'] = $this->getTokenAlphabet(); |
393 | 393 | $options['fontSize'] = $this->getTokenFontSize(); |
394 | 394 | $options['theme'] = $this->getTokenImageTheme(); |
395 | - if(($randomSeed = $this->getViewState('RandomSeed', 0)) === 0) |
|
395 | + if (($randomSeed = $this->getViewState('RandomSeed', 0)) === 0) |
|
396 | 396 | { |
397 | - $randomSeed = (int)(microtime(true) * 1000000); |
|
397 | + $randomSeed = (int) (microtime(true) * 1000000); |
|
398 | 398 | $this->setViewState('RandomSeed', $randomSeed); |
399 | 399 | } |
400 | - $options['randomSeed'] = $this->getChangingTokenBackground()?0:$randomSeed; |
|
400 | + $options['randomSeed'] = $this->getChangingTokenBackground() ? 0 : $randomSeed; |
|
401 | 401 | $str = serialize($options); |
402 | - return base64_encode(md5($privateKey . $str) . $str); |
|
402 | + return base64_encode(md5($privateKey.$str).$str); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | /** |
@@ -407,12 +407,12 @@ discard block |
||
407 | 407 | */ |
408 | 408 | protected function getCaptchaScriptFile() |
409 | 409 | { |
410 | - return dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'captcha.php'; |
|
410 | + return dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'captcha.php'; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | protected function getFontFile() |
414 | 414 | { |
415 | - return dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'verase.ttf'; |
|
415 | + return dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'verase.ttf'; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | { |
424 | 424 | $captchaScript = $this->getCaptchaScriptFile(); |
425 | 425 | $path = dirname($this->getApplication()->getAssetManager()->getPublishedPath($captchaScript)); |
426 | - $fileName = $path . DIRECTORY_SEPARATOR . 'captcha_key.php'; |
|
427 | - if(!is_file($fileName)) |
|
426 | + $fileName = $path.DIRECTORY_SEPARATOR.'captcha_key.php'; |
|
427 | + if (!is_file($fileName)) |
|
428 | 428 | { |
429 | 429 | @mkdir($path); |
430 | 430 | $key = $this->generateRandomKey(); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | protected function generateRandomKey() |
443 | 443 | { |
444 | - return md5(rand() . rand() . rand() . rand()); |
|
444 | + return md5(rand().rand().rand().rand()); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | */ |
455 | 455 | protected function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive) |
456 | 456 | { |
457 | - $token = substr($this->hash2string(md5($publicKey . $privateKey), $alphabet) . $this->hash2string(md5($privateKey . $publicKey), $alphabet), 0, $tokenLength); |
|
458 | - return $caseSensitive?$token:strtoupper($token); |
|
457 | + $token = substr($this->hash2string(md5($publicKey.$privateKey), $alphabet).$this->hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength); |
|
458 | + return $caseSensitive ? $token : strtoupper($token); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -466,15 +466,15 @@ discard block |
||
466 | 466 | */ |
467 | 467 | protected function hash2string($hex, $alphabet = '') |
468 | 468 | { |
469 | - if(strlen($alphabet) < 2) |
|
469 | + if (strlen($alphabet) < 2) |
|
470 | 470 | $alphabet = '234578adefhijmnrtABDEFGHJLMNQRT'; |
471 | 471 | $hexLength = strlen($hex); |
472 | 472 | $base = strlen($alphabet); |
473 | 473 | $result = ''; |
474 | - for($i = 0;$i < $hexLength;$i += 6) |
|
474 | + for ($i = 0; $i < $hexLength; $i += 6) |
|
475 | 475 | { |
476 | 476 | $number = hexdec(substr($hex, $i, 6)); |
477 | - while($number) |
|
477 | + while ($number) |
|
478 | 478 | { |
479 | 479 | $result .= $alphabet[$number % $base]; |
480 | 480 | $number = floor($number / $base); |
@@ -93,10 +93,11 @@ discard block |
||
93 | 93 | public function setTokenImageTheme($value) |
94 | 94 | { |
95 | 95 | $value = TPropertyValue::ensureInteger($value); |
96 | - if($value >= 0 && $value <= 63) |
|
97 | - $this->setViewState('TokenImageTheme', $value, 0); |
|
98 | - else |
|
99 | - throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63); |
|
96 | + if($value >= 0 && $value <= 63) { |
|
97 | + $this->setViewState('TokenImageTheme', $value, 0); |
|
98 | + } else { |
|
99 | + throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63); |
|
100 | + } |
|
100 | 101 | } |
101 | 102 | |
102 | 103 | /** |
@@ -116,10 +117,11 @@ discard block |
||
116 | 117 | public function setTokenFontSize($value) |
117 | 118 | { |
118 | 119 | $value = TPropertyValue::ensureInteger($value); |
119 | - if($value >= 20 && $value <= 100) |
|
120 | - $this->setViewState('TokenFontSize', $value, 30); |
|
121 | - else |
|
122 | - throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100); |
|
120 | + if($value >= 20 && $value <= 100) { |
|
121 | + $this->setViewState('TokenFontSize', $value, 30); |
|
122 | + } else { |
|
123 | + throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100); |
|
124 | + } |
|
123 | 125 | } |
124 | 126 | |
125 | 127 | /** |
@@ -136,10 +138,11 @@ discard block |
||
136 | 138 | public function setMinTokenLength($value) |
137 | 139 | { |
138 | 140 | $length = TPropertyValue::ensureInteger($value); |
139 | - if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
140 | - $this->setViewState('MinTokenLength', $length, 4); |
|
141 | - else |
|
142 | - throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
141 | + if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) { |
|
142 | + $this->setViewState('MinTokenLength', $length, 4); |
|
143 | + } else { |
|
144 | + throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
145 | + } |
|
143 | 146 | } |
144 | 147 | |
145 | 148 | /** |
@@ -156,10 +159,11 @@ discard block |
||
156 | 159 | public function setMaxTokenLength($value) |
157 | 160 | { |
158 | 161 | $length = TPropertyValue::ensureInteger($value); |
159 | - if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
160 | - $this->setViewState('MaxTokenLength', $length, 6); |
|
161 | - else |
|
162 | - throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
162 | + if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) { |
|
163 | + $this->setViewState('MaxTokenLength', $length, 6); |
|
164 | + } else { |
|
165 | + throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
166 | + } |
|
163 | 167 | } |
164 | 168 | |
165 | 169 | /** |
@@ -191,8 +195,9 @@ discard block |
||
191 | 195 | */ |
192 | 196 | public function setTokenAlphabet($value) |
193 | 197 | { |
194 | - if(strlen($value) < 2) |
|
195 | - throw new TConfigurationException('captcha_tokenalphabet_invalid'); |
|
198 | + if(strlen($value) < 2) { |
|
199 | + throw new TConfigurationException('captcha_tokenalphabet_invalid'); |
|
200 | + } |
|
196 | 201 | $this->setViewState('TokenAlphabet', $value, '234578adefhijmnrtABDEFGHJLMNRT'); |
197 | 202 | } |
198 | 203 | |
@@ -249,10 +254,11 @@ discard block |
||
249 | 254 | */ |
250 | 255 | public function getIsTokenExpired() |
251 | 256 | { |
252 | - if(($expiry = $this->getTokenExpiry()) > 0 && ($start = $this->getViewState('TokenGenerated', 0)) > 0) |
|
253 | - return $expiry + $start < time(); |
|
254 | - else |
|
255 | - return false; |
|
257 | + if(($expiry = $this->getTokenExpiry()) > 0 && ($start = $this->getViewState('TokenGenerated', 0)) > 0) { |
|
258 | + return $expiry + $start < time(); |
|
259 | + } else { |
|
260 | + return false; |
|
261 | + } |
|
256 | 262 | } |
257 | 263 | |
258 | 264 | /** |
@@ -293,12 +299,13 @@ discard block |
||
293 | 299 | { |
294 | 300 | $minLength = $this->getMinTokenLength(); |
295 | 301 | $maxLength = $this->getMaxTokenLength(); |
296 | - if($minLength > $maxLength) |
|
297 | - $tokenLength = rand($maxLength, $minLength); |
|
298 | - elseif($minLength < $maxLength) |
|
299 | - $tokenLength = rand($minLength, $maxLength); |
|
300 | - else |
|
301 | - $tokenLength = $minLength; |
|
302 | + if($minLength > $maxLength) { |
|
303 | + $tokenLength = rand($maxLength, $minLength); |
|
304 | + } elseif($minLength < $maxLength) { |
|
305 | + $tokenLength = rand($minLength, $maxLength); |
|
306 | + } else { |
|
307 | + $tokenLength = $minLength; |
|
308 | + } |
|
302 | 309 | $this->setViewState('TokenLength', $tokenLength); |
303 | 310 | } |
304 | 311 | return $tokenLength; |
@@ -314,10 +321,11 @@ discard block |
||
314 | 321 | $fileName = $this->generatePrivateKeyFile(); |
315 | 322 | $content = file_get_contents($fileName); |
316 | 323 | $matches = []; |
317 | - if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0) |
|
318 | - $this->_privateKey = $matches[1]; |
|
319 | - else |
|
320 | - throw new TConfigurationException('captcha_privatekey_unknown'); |
|
324 | + if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0) { |
|
325 | + $this->_privateKey = $matches[1]; |
|
326 | + } else { |
|
327 | + throw new TConfigurationException('captcha_privatekey_unknown'); |
|
328 | + } |
|
321 | 329 | } |
322 | 330 | return $this->_privateKey; |
323 | 331 | } |
@@ -364,8 +372,9 @@ discard block |
||
364 | 372 | public function onPreRender($param) |
365 | 373 | { |
366 | 374 | parent::onPreRender($param); |
367 | - if(!self::checkRequirements()) |
|
368 | - throw new TConfigurationException('captcha_imagettftext_required'); |
|
375 | + if(!self::checkRequirements()) { |
|
376 | + throw new TConfigurationException('captcha_imagettftext_required'); |
|
377 | + } |
|
369 | 378 | if(!$this->getViewState('TokenGenerated', 0)) |
370 | 379 | { |
371 | 380 | $manager = $this->getApplication()->getAssetManager(); |
@@ -466,8 +475,9 @@ discard block |
||
466 | 475 | */ |
467 | 476 | protected function hash2string($hex, $alphabet = '') |
468 | 477 | { |
469 | - if(strlen($alphabet) < 2) |
|
470 | - $alphabet = '234578adefhijmnrtABDEFGHJLMNQRT'; |
|
478 | + if(strlen($alphabet) < 2) { |
|
479 | + $alphabet = '234578adefhijmnrtABDEFGHJLMNQRT'; |
|
480 | + } |
|
471 | 481 | $hexLength = strlen($hex); |
472 | 482 | $base = strlen($alphabet); |
473 | 483 | $result = ''; |
@@ -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 | /** |
@@ -109,22 +109,22 @@ discard block |
||
109 | 109 | { |
110 | 110 | $page = $this->getPage(); |
111 | 111 | $page->ensureRenderInForm($this); |
112 | - if(($uid = $this->getUniqueID()) !== '') |
|
112 | + if (($uid = $this->getUniqueID()) !== '') |
|
113 | 113 | $writer->addAttribute('name', $uid); |
114 | - if(($textMode = $this->getTextMode()) === TTextBoxMode::MultiLine) |
|
114 | + if (($textMode = $this->getTextMode()) === TTextBoxMode::MultiLine) |
|
115 | 115 | { |
116 | - if(($rows = $this->getRows()) <= 0) |
|
116 | + if (($rows = $this->getRows()) <= 0) |
|
117 | 117 | $rows = self::DEFAULT_ROWS; |
118 | - if(($cols = $this->getColumns()) <= 0) |
|
118 | + if (($cols = $this->getColumns()) <= 0) |
|
119 | 119 | $cols = self::DEFAULT_COLUMNS; |
120 | 120 | $writer->addAttribute('rows', "$rows"); |
121 | 121 | $writer->addAttribute('cols', "$cols"); |
122 | - if(!$this->getWrap()) |
|
122 | + if (!$this->getWrap()) |
|
123 | 123 | $writer->addAttribute('wrap', 'off'); |
124 | 124 | } |
125 | 125 | else |
126 | 126 | { |
127 | - switch($textMode) |
|
127 | + switch ($textMode) |
|
128 | 128 | { |
129 | 129 | case TTextBoxMode::Password: |
130 | 130 | $writer->addAttribute('type', 'password'); |
@@ -174,40 +174,40 @@ discard block |
||
174 | 174 | break; |
175 | 175 | } |
176 | 176 | |
177 | - if(($text = $this->getText()) !== '' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) |
|
177 | + if (($text = $this->getText()) !== '' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) |
|
178 | 178 | $writer->addAttribute('value', $text); |
179 | 179 | |
180 | - if(($act = $this->getAutoCompleteType()) !== 'None') |
|
180 | + if (($act = $this->getAutoCompleteType()) !== 'None') |
|
181 | 181 | { |
182 | - if($act === 'Disabled') |
|
182 | + if ($act === 'Disabled') |
|
183 | 183 | $writer->addAttribute('autocomplete', 'off'); |
184 | - elseif($act === 'Search') |
|
184 | + elseif ($act === 'Search') |
|
185 | 185 | $writer->addAttribute('vcard_name', 'search'); |
186 | - elseif($act === 'HomeCountryRegion') |
|
186 | + elseif ($act === 'HomeCountryRegion') |
|
187 | 187 | $writer->addAttribute('vcard_name', 'HomeCountry'); |
188 | - elseif($act === 'BusinessCountryRegion') |
|
188 | + elseif ($act === 'BusinessCountryRegion') |
|
189 | 189 | $writer->addAttribute('vcard_name', 'BusinessCountry'); |
190 | 190 | else |
191 | 191 | { |
192 | - if(strpos($act, 'Business') === 0) |
|
193 | - $act = 'Business' . '.' . substr($act, 8); |
|
194 | - elseif(strpos($act, 'Home') === 0) |
|
195 | - $act = 'Home' . '.' . substr($act, 4); |
|
196 | - $writer->addAttribute('vcard_name', 'vCard.' . $act); |
|
192 | + if (strpos($act, 'Business') === 0) |
|
193 | + $act = 'Business'.'.'.substr($act, 8); |
|
194 | + elseif (strpos($act, 'Home') === 0) |
|
195 | + $act = 'Home'.'.'.substr($act, 4); |
|
196 | + $writer->addAttribute('vcard_name', 'vCard.'.$act); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if(($cols = $this->getColumns()) > 0) |
|
200 | + if (($cols = $this->getColumns()) > 0) |
|
201 | 201 | $writer->addAttribute('size', "$cols"); |
202 | - if(($maxLength = $this->getMaxLength()) > 0) |
|
202 | + if (($maxLength = $this->getMaxLength()) > 0) |
|
203 | 203 | $writer->addAttribute('maxlength', "$maxLength"); |
204 | 204 | } |
205 | - if($this->getReadOnly()) |
|
205 | + if ($this->getReadOnly()) |
|
206 | 206 | $writer->addAttribute('readonly', 'readonly'); |
207 | 207 | $isEnabled = $this->getEnabled(true); |
208 | - if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
|
208 | + if (!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
|
209 | 209 | $writer->addAttribute('disabled', 'disabled'); |
210 | - if($isEnabled |
|
210 | + if ($isEnabled |
|
211 | 211 | && $this->getEnableClientScript() |
212 | 212 | && ($this->getAutoPostBack() || $textMode === TTextBoxMode::SingleLine) |
213 | 213 | && $page->getClientSupportsJavaScript()) |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | public function loadPostData($key, $values) |
263 | 263 | { |
264 | 264 | $value = $values[$key]; |
265 | - if($this->getAutoTrim()) |
|
265 | + if ($this->getAutoTrim()) |
|
266 | 266 | $value = trim($value); |
267 | - if(!$this->getReadOnly() && $this->getText() !== $value) |
|
267 | + if (!$this->getReadOnly() && $this->getText() !== $value) |
|
268 | 268 | { |
269 | 269 | $this->setText($value); |
270 | 270 | return $this->_dataChanged = true; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | public function raisePostDataChangedEvent() |
334 | 334 | { |
335 | - if($this->getAutoPostBack() && $this->getCausesValidation()) |
|
335 | + if ($this->getAutoPostBack() && $this->getCausesValidation()) |
|
336 | 336 | $this->getPage()->validate($this->getValidationGroup()); |
337 | 337 | $this->onTextChanged(null); |
338 | 338 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | */ |
344 | 344 | public function renderContents($writer) |
345 | 345 | { |
346 | - if($this->getTextMode() === 'MultiLine') |
|
346 | + if ($this->getTextMode() === 'MultiLine') |
|
347 | 347 | $writer->write(THttpUtility::htmlEncode($this->getText())); |
348 | 348 | } |
349 | 349 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | public function renderBeginTag($writer) |
356 | 356 | { |
357 | 357 | parent::renderBeginTag($writer); |
358 | - if($this->getTextMode() === 'MultiLine') |
|
358 | + if ($this->getTextMode() === 'MultiLine') |
|
359 | 359 | $writer->write("\n"); |
360 | 360 | } |
361 | 361 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | */ |
563 | 563 | public function getSafeText() |
564 | 564 | { |
565 | - if($this->_safeText === null) |
|
565 | + if ($this->_safeText === null) |
|
566 | 566 | $this->_safeText = $this->getSafeTextParser()->purify($this->getText()); |
567 | 567 | return $this->_safeText; |
568 | 568 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | */ |
573 | 573 | protected function getSafeTextParser() |
574 | 574 | { |
575 | - if(!self::$_safeTextParser) |
|
575 | + if (!self::$_safeTextParser) |
|
576 | 576 | self::$_safeTextParser = new \HTMLPurifier($this->getConfig()); |
577 | 577 | return self::$_safeTextParser; |
578 | 578 | } |
@@ -109,20 +109,23 @@ discard block |
||
109 | 109 | { |
110 | 110 | $page = $this->getPage(); |
111 | 111 | $page->ensureRenderInForm($this); |
112 | - if(($uid = $this->getUniqueID()) !== '') |
|
113 | - $writer->addAttribute('name', $uid); |
|
112 | + if(($uid = $this->getUniqueID()) !== '') { |
|
113 | + $writer->addAttribute('name', $uid); |
|
114 | + } |
|
114 | 115 | if(($textMode = $this->getTextMode()) === TTextBoxMode::MultiLine) |
115 | 116 | { |
116 | - if(($rows = $this->getRows()) <= 0) |
|
117 | - $rows = self::DEFAULT_ROWS; |
|
118 | - if(($cols = $this->getColumns()) <= 0) |
|
119 | - $cols = self::DEFAULT_COLUMNS; |
|
117 | + if(($rows = $this->getRows()) <= 0) { |
|
118 | + $rows = self::DEFAULT_ROWS; |
|
119 | + } |
|
120 | + if(($cols = $this->getColumns()) <= 0) { |
|
121 | + $cols = self::DEFAULT_COLUMNS; |
|
122 | + } |
|
120 | 123 | $writer->addAttribute('rows', "$rows"); |
121 | 124 | $writer->addAttribute('cols', "$cols"); |
122 | - if(!$this->getWrap()) |
|
123 | - $writer->addAttribute('wrap', 'off'); |
|
124 | - } |
|
125 | - else |
|
125 | + if(!$this->getWrap()) { |
|
126 | + $writer->addAttribute('wrap', 'off'); |
|
127 | + } |
|
128 | + } else |
|
126 | 129 | { |
127 | 130 | switch($textMode) |
128 | 131 | { |
@@ -174,39 +177,46 @@ discard block |
||
174 | 177 | break; |
175 | 178 | } |
176 | 179 | |
177 | - if(($text = $this->getText()) !== '' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) |
|
178 | - $writer->addAttribute('value', $text); |
|
180 | + if(($text = $this->getText()) !== '' && ($textMode !== TTextBoxMode::Password || $this->getPersistPassword())) { |
|
181 | + $writer->addAttribute('value', $text); |
|
182 | + } |
|
179 | 183 | |
180 | 184 | if(($act = $this->getAutoCompleteType()) !== 'None') |
181 | 185 | { |
182 | - if($act === 'Disabled') |
|
183 | - $writer->addAttribute('autocomplete', 'off'); |
|
184 | - elseif($act === 'Search') |
|
185 | - $writer->addAttribute('vcard_name', 'search'); |
|
186 | - elseif($act === 'HomeCountryRegion') |
|
187 | - $writer->addAttribute('vcard_name', 'HomeCountry'); |
|
188 | - elseif($act === 'BusinessCountryRegion') |
|
189 | - $writer->addAttribute('vcard_name', 'BusinessCountry'); |
|
190 | - else |
|
186 | + if($act === 'Disabled') { |
|
187 | + $writer->addAttribute('autocomplete', 'off'); |
|
188 | + } elseif($act === 'Search') { |
|
189 | + $writer->addAttribute('vcard_name', 'search'); |
|
190 | + } elseif($act === 'HomeCountryRegion') { |
|
191 | + $writer->addAttribute('vcard_name', 'HomeCountry'); |
|
192 | + } elseif($act === 'BusinessCountryRegion') { |
|
193 | + $writer->addAttribute('vcard_name', 'BusinessCountry'); |
|
194 | + } else |
|
191 | 195 | { |
192 | - if(strpos($act, 'Business') === 0) |
|
193 | - $act = 'Business' . '.' . substr($act, 8); |
|
194 | - elseif(strpos($act, 'Home') === 0) |
|
195 | - $act = 'Home' . '.' . substr($act, 4); |
|
196 | + if(strpos($act, 'Business') === 0) { |
|
197 | + $act = 'Business' . '.' . substr($act, 8); |
|
198 | + } elseif(strpos($act, 'Home') === 0) { |
|
199 | + $act = 'Home' . '.' . substr($act, 4); |
|
200 | + } |
|
196 | 201 | $writer->addAttribute('vcard_name', 'vCard.' . $act); |
197 | 202 | } |
198 | 203 | } |
199 | 204 | |
200 | - if(($cols = $this->getColumns()) > 0) |
|
201 | - $writer->addAttribute('size', "$cols"); |
|
202 | - if(($maxLength = $this->getMaxLength()) > 0) |
|
203 | - $writer->addAttribute('maxlength', "$maxLength"); |
|
205 | + if(($cols = $this->getColumns()) > 0) { |
|
206 | + $writer->addAttribute('size', "$cols"); |
|
207 | + } |
|
208 | + if(($maxLength = $this->getMaxLength()) > 0) { |
|
209 | + $writer->addAttribute('maxlength', "$maxLength"); |
|
210 | + } |
|
211 | + } |
|
212 | + if($this->getReadOnly()) { |
|
213 | + $writer->addAttribute('readonly', 'readonly'); |
|
204 | 214 | } |
205 | - if($this->getReadOnly()) |
|
206 | - $writer->addAttribute('readonly', 'readonly'); |
|
207 | 215 | $isEnabled = $this->getEnabled(true); |
208 | - if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
|
216 | + if(!$isEnabled && $this->getEnabled()) { |
|
217 | + // in this case parent will not render 'disabled' |
|
209 | 218 | $writer->addAttribute('disabled', 'disabled'); |
219 | + } |
|
210 | 220 | if($isEnabled |
211 | 221 | && $this->getEnableClientScript() |
212 | 222 | && ($this->getAutoPostBack() || $textMode === TTextBoxMode::SingleLine) |
@@ -262,15 +272,16 @@ discard block |
||
262 | 272 | public function loadPostData($key, $values) |
263 | 273 | { |
264 | 274 | $value = $values[$key]; |
265 | - if($this->getAutoTrim()) |
|
266 | - $value = trim($value); |
|
275 | + if($this->getAutoTrim()) { |
|
276 | + $value = trim($value); |
|
277 | + } |
|
267 | 278 | if(!$this->getReadOnly() && $this->getText() !== $value) |
268 | 279 | { |
269 | 280 | $this->setText($value); |
270 | 281 | return $this->_dataChanged = true; |
282 | + } else { |
|
283 | + return false; |
|
271 | 284 | } |
272 | - else |
|
273 | - return false; |
|
274 | 285 | } |
275 | 286 | |
276 | 287 | /** |
@@ -332,8 +343,9 @@ discard block |
||
332 | 343 | */ |
333 | 344 | public function raisePostDataChangedEvent() |
334 | 345 | { |
335 | - if($this->getAutoPostBack() && $this->getCausesValidation()) |
|
336 | - $this->getPage()->validate($this->getValidationGroup()); |
|
346 | + if($this->getAutoPostBack() && $this->getCausesValidation()) { |
|
347 | + $this->getPage()->validate($this->getValidationGroup()); |
|
348 | + } |
|
337 | 349 | $this->onTextChanged(null); |
338 | 350 | } |
339 | 351 | |
@@ -343,8 +355,9 @@ discard block |
||
343 | 355 | */ |
344 | 356 | public function renderContents($writer) |
345 | 357 | { |
346 | - if($this->getTextMode() === 'MultiLine') |
|
347 | - $writer->write(THttpUtility::htmlEncode($this->getText())); |
|
358 | + if($this->getTextMode() === 'MultiLine') { |
|
359 | + $writer->write(THttpUtility::htmlEncode($this->getText())); |
|
360 | + } |
|
348 | 361 | } |
349 | 362 | |
350 | 363 | /** |
@@ -355,8 +368,9 @@ discard block |
||
355 | 368 | public function renderBeginTag($writer) |
356 | 369 | { |
357 | 370 | parent::renderBeginTag($writer); |
358 | - if($this->getTextMode() === 'MultiLine') |
|
359 | - $writer->write("\n"); |
|
371 | + if($this->getTextMode() === 'MultiLine') { |
|
372 | + $writer->write("\n"); |
|
373 | + } |
|
360 | 374 | } |
361 | 375 | |
362 | 376 | /** |
@@ -562,8 +576,9 @@ discard block |
||
562 | 576 | */ |
563 | 577 | public function getSafeText() |
564 | 578 | { |
565 | - if($this->_safeText === null) |
|
566 | - $this->_safeText = $this->getSafeTextParser()->purify($this->getText()); |
|
579 | + if($this->_safeText === null) { |
|
580 | + $this->_safeText = $this->getSafeTextParser()->purify($this->getText()); |
|
581 | + } |
|
567 | 582 | return $this->_safeText; |
568 | 583 | } |
569 | 584 | |
@@ -572,8 +587,9 @@ discard block |
||
572 | 587 | */ |
573 | 588 | protected function getSafeTextParser() |
574 | 589 | { |
575 | - if(!self::$_safeTextParser) |
|
576 | - self::$_safeTextParser = new \HTMLPurifier($this->getConfig()); |
|
590 | + if(!self::$_safeTextParser) { |
|
591 | + self::$_safeTextParser = new \HTMLPurifier($this->getConfig()); |
|
592 | + } |
|
577 | 593 | return self::$_safeTextParser; |
578 | 594 | } |
579 | 595 |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | parent::onPreRender($param); |
112 | 112 | $scripts = preg_split('/,|\s+/', $this->getPradoScripts()); |
113 | 113 | $cs = $this->getPage()->getClientScript(); |
114 | - foreach($scripts as $script) |
|
114 | + foreach ($scripts as $script) |
|
115 | 115 | { |
116 | - if(($script = trim($script)) !== '') |
|
116 | + if (($script = trim($script)) !== '') |
|
117 | 117 | $cs->registerPradoScript($script); |
118 | 118 | } |
119 | 119 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function renderCustomScriptFile($writer) |
140 | 140 | { |
141 | - if(($scriptUrl = $this->getScriptUrl()) !== '') |
|
141 | + if (($scriptUrl = $this->getScriptUrl()) !== '') |
|
142 | 142 | $writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n"); |
143 | 143 | } |
144 | 144 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | protected function renderCustomScript($writer) |
150 | 150 | { |
151 | - if($this->getHasControls()) |
|
151 | + if ($this->getHasControls()) |
|
152 | 152 | { |
153 | 153 | $writer->write("<script type=\"text/javascript\">\n/*<![CDATA[*/\n"); |
154 | 154 | $this->renderChildren($writer); |
@@ -113,8 +113,9 @@ discard block |
||
113 | 113 | $cs = $this->getPage()->getClientScript(); |
114 | 114 | foreach($scripts as $script) |
115 | 115 | { |
116 | - if(($script = trim($script)) !== '') |
|
117 | - $cs->registerPradoScript($script); |
|
116 | + if(($script = trim($script)) !== '') { |
|
117 | + $cs->registerPradoScript($script); |
|
118 | + } |
|
118 | 119 | } |
119 | 120 | } |
120 | 121 | |
@@ -126,8 +127,9 @@ discard block |
||
126 | 127 | */ |
127 | 128 | public function render($writer) |
128 | 129 | { |
129 | - if ($this->getFlushScriptFiles()) |
|
130 | - $this->getPage()->getClientScript()->flushScriptFiles($writer, $this); |
|
130 | + if ($this->getFlushScriptFiles()) { |
|
131 | + $this->getPage()->getClientScript()->flushScriptFiles($writer, $this); |
|
132 | + } |
|
131 | 133 | $this->renderCustomScriptFile($writer); |
132 | 134 | $this->renderCustomScript($writer); |
133 | 135 | } |
@@ -138,8 +140,9 @@ discard block |
||
138 | 140 | */ |
139 | 141 | protected function renderCustomScriptFile($writer) |
140 | 142 | { |
141 | - if(($scriptUrl = $this->getScriptUrl()) !== '') |
|
142 | - $writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n"); |
|
143 | + if(($scriptUrl = $this->getScriptUrl()) !== '') { |
|
144 | + $writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n"); |
|
145 | + } |
|
143 | 146 | } |
144 | 147 | |
145 | 148 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function addParsedObject($object) |
49 | 49 | { |
50 | - if(is_string($object)) |
|
50 | + if (is_string($object)) |
|
51 | 51 | $object = html_entity_decode($object, ENT_QUOTES, 'UTF-8'); |
52 | 52 | parent::addParsedObject($object); |
53 | 53 | } |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function renderContents($writer) |
78 | 78 | { |
79 | - if(($text = $this->getText()) === '' && $this->getHasControls()) |
|
79 | + if (($text = $this->getText()) === '' && $this->getHasControls()) |
|
80 | 80 | { |
81 | 81 | $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
82 | 82 | parent::renderContents($htmlWriter); |
83 | 83 | $text = $htmlWriter->flush(); |
84 | 84 | } |
85 | - if($text !== '') |
|
85 | + if ($text !== '') |
|
86 | 86 | $writer->write($this->processText($text)); |
87 | 87 | } |
88 | 88 |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function addParsedObject($object) |
49 | 49 | { |
50 | - if(is_string($object)) |
|
51 | - $object = html_entity_decode($object, ENT_QUOTES, 'UTF-8'); |
|
50 | + if(is_string($object)) { |
|
51 | + $object = html_entity_decode($object, ENT_QUOTES, 'UTF-8'); |
|
52 | + } |
|
52 | 53 | parent::addParsedObject($object); |
53 | 54 | } |
54 | 55 | |
@@ -82,8 +83,9 @@ discard block |
||
82 | 83 | parent::renderContents($htmlWriter); |
83 | 84 | $text = $htmlWriter->flush(); |
84 | 85 | } |
85 | - if($text !== '') |
|
86 | - $writer->write($this->processText($text)); |
|
86 | + if($text !== '') { |
|
87 | + $writer->write($this->processText($text)); |
|
88 | + } |
|
87 | 89 | } |
88 | 90 | |
89 | 91 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public function insertAt($index, $item) |
36 | 36 | { |
37 | - if($item instanceof TTableRow) |
|
37 | + if ($item instanceof TTableRow) |
|
38 | 38 | parent::insertAt($index, $item); |
39 | 39 | else |
40 | 40 | throw new TInvalidDataTypeException('tablerowcollection_tablerow_required'); |
@@ -34,9 +34,10 @@ |
||
34 | 34 | */ |
35 | 35 | public function insertAt($index, $item) |
36 | 36 | { |
37 | - if($item instanceof TTableRow) |
|
38 | - parent::insertAt($index, $item); |
|
39 | - else |
|
40 | - throw new TInvalidDataTypeException('tablerowcollection_tablerow_required'); |
|
37 | + if($item instanceof TTableRow) { |
|
38 | + parent::insertAt($index, $item); |
|
39 | + } else { |
|
40 | + throw new TInvalidDataTypeException('tablerowcollection_tablerow_required'); |
|
41 | + } |
|
41 | 42 | } |
42 | 43 | } |
43 | 44 | \ No newline at end of file |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function raisePostBackEvent($param) |
62 | 62 | { |
63 | - if($this->getCausesValidation()) |
|
63 | + if ($this->getCausesValidation()) |
|
64 | 64 | $this->getPage()->validate($this->getValidationGroup()); |
65 | - $this->onClick(new TBulletedListEventParameter((int)$param)); |
|
65 | + $this->onClick(new TBulletedListEventParameter((int) $param)); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | protected function getTagName() |
72 | 72 | { |
73 | - switch($this->getBulletStyle()) |
|
73 | + switch ($this->getBulletStyle()) |
|
74 | 74 | { |
75 | 75 | case TBulletStyle::Numbered: |
76 | 76 | case TBulletStyle::LowerAlpha: |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | protected function addAttributesToRender($writer) |
101 | 101 | { |
102 | 102 | $needStart = false; |
103 | - switch($this->getBulletStyle()) |
|
103 | + switch ($this->getBulletStyle()) |
|
104 | 104 | { |
105 | 105 | case TBulletStyle::None: |
106 | 106 | $writer->addStyleAttribute('list-style-type', 'none'); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $writer->addStyleAttribute('list-style-image', "url($url)"); |
141 | 141 | break; |
142 | 142 | } |
143 | - if($needStart && ($start = $this->getFirstBulletNumber()) != 1) |
|
143 | + if ($needStart && ($start = $this->getFirstBulletNumber()) != 1) |
|
144 | 144 | $writer->addAttribute('start', "$start"); |
145 | 145 | parent::addAttributesToRender($writer); |
146 | 146 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function render($writer) |
251 | 251 | { |
252 | - if($this->getHasItems()) |
|
252 | + if ($this->getHasItems()) |
|
253 | 253 | parent::render($writer); |
254 | 254 | } |
255 | 255 | |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | $this->_isEnabled = $this->getEnabled(true); |
263 | 263 | $this->_postBackOptions = $this->getPostBackOptions(); |
264 | 264 | $writer->writeLine(); |
265 | - foreach($this->getItems() as $index => $item) |
|
265 | + foreach ($this->getItems() as $index => $item) |
|
266 | 266 | { |
267 | - if($item->getHasAttributes()) |
|
267 | + if ($item->getHasAttributes()) |
|
268 | 268 | $writer->addAttributes($item->getAttributes()); |
269 | 269 | $writer->renderBeginTag('li'); |
270 | 270 | $this->renderBulletText($writer, $item, $index); |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | */ |
282 | 282 | protected function renderBulletText($writer, $item, $index) |
283 | 283 | { |
284 | - switch($this->getDisplayMode()) |
|
284 | + switch ($this->getDisplayMode()) |
|
285 | 285 | { |
286 | 286 | case TBulletedListDisplayMode::Text: |
287 | 287 | $this->renderTextItem($writer, $item, $index); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | protected function renderTextItem($writer, $item, $index) |
299 | 299 | { |
300 | - if($item->getEnabled()) |
|
300 | + if ($item->getEnabled()) |
|
301 | 301 | $writer->write(THttpUtility::htmlEncode($item->getText())); |
302 | 302 | else |
303 | 303 | { |
@@ -310,15 +310,15 @@ discard block |
||
310 | 310 | |
311 | 311 | protected function renderHyperLinkItem($writer, $item, $index) |
312 | 312 | { |
313 | - if(!$this->_isEnabled || !$item->getEnabled()) |
|
313 | + if (!$this->_isEnabled || !$item->getEnabled()) |
|
314 | 314 | $writer->addAttribute('disabled', 'disabled'); |
315 | 315 | else |
316 | 316 | { |
317 | 317 | $writer->addAttribute('href', $item->getValue()); |
318 | - if(($target = $this->getTarget()) !== '') |
|
318 | + if (($target = $this->getTarget()) !== '') |
|
319 | 319 | $writer->addAttribute('target', $target); |
320 | 320 | } |
321 | - if(($accesskey = $this->getAccessKey()) !== '') |
|
321 | + if (($accesskey = $this->getAccessKey()) !== '') |
|
322 | 322 | $writer->addAttribute('accesskey', $accesskey); |
323 | 323 | $writer->renderBeginTag('a'); |
324 | 324 | $writer->write(THttpUtility::htmlEncode($item->getText())); |
@@ -327,17 +327,17 @@ discard block |
||
327 | 327 | |
328 | 328 | protected function renderLinkButtonItem($writer, $item, $index) |
329 | 329 | { |
330 | - if(!$this->_isEnabled || !$item->getEnabled()) |
|
330 | + if (!$this->_isEnabled || !$item->getEnabled()) |
|
331 | 331 | $writer->addAttribute('disabled', 'disabled'); |
332 | 332 | else |
333 | 333 | { |
334 | 334 | $this->_currentRenderItemIndex = $index; |
335 | - $writer->addAttribute('id', $this->getClientID() . $index); |
|
336 | - $writer->addAttribute('href', "javascript:;//" . $this->getClientID() . $index); |
|
335 | + $writer->addAttribute('id', $this->getClientID().$index); |
|
336 | + $writer->addAttribute('href', "javascript:;//".$this->getClientID().$index); |
|
337 | 337 | $cs = $this->getPage()->getClientScript(); |
338 | 338 | $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
339 | 339 | } |
340 | - if(($accesskey = $this->getAccessKey()) !== '') |
|
340 | + if (($accesskey = $this->getAccessKey()) !== '') |
|
341 | 341 | $writer->addAttribute('accesskey', $accesskey); |
342 | 342 | $writer->renderBeginTag('a'); |
343 | 343 | $writer->write(THttpUtility::htmlEncode($item->getText())); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $options['CausesValidation'] = $this->getCausesValidation(); |
354 | 354 | $options['EventTarget'] = $this->getUniqueID(); |
355 | 355 | $options['EventParameter'] = $this->_currentRenderItemIndex; |
356 | - $options['ID'] = $this->getClientID() . $this->_currentRenderItemIndex; |
|
356 | + $options['ID'] = $this->getClientID().$this->_currentRenderItemIndex; |
|
357 | 357 | $options['StopEvent'] = true; |
358 | 358 | return $options; |
359 | 359 | } |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function raisePostBackEvent($param) |
62 | 62 | { |
63 | - if($this->getCausesValidation()) |
|
64 | - $this->getPage()->validate($this->getValidationGroup()); |
|
63 | + if($this->getCausesValidation()) { |
|
64 | + $this->getPage()->validate($this->getValidationGroup()); |
|
65 | + } |
|
65 | 66 | $this->onClick(new TBulletedListEventParameter((int)$param)); |
66 | 67 | } |
67 | 68 | |
@@ -140,8 +141,9 @@ discard block |
||
140 | 141 | $writer->addStyleAttribute('list-style-image', "url($url)"); |
141 | 142 | break; |
142 | 143 | } |
143 | - if($needStart && ($start = $this->getFirstBulletNumber()) != 1) |
|
144 | - $writer->addAttribute('start', "$start"); |
|
144 | + if($needStart && ($start = $this->getFirstBulletNumber()) != 1) { |
|
145 | + $writer->addAttribute('start', "$start"); |
|
146 | + } |
|
145 | 147 | parent::addAttributesToRender($writer); |
146 | 148 | } |
147 | 149 | |
@@ -249,8 +251,9 @@ discard block |
||
249 | 251 | */ |
250 | 252 | public function render($writer) |
251 | 253 | { |
252 | - if($this->getHasItems()) |
|
253 | - parent::render($writer); |
|
254 | + if($this->getHasItems()) { |
|
255 | + parent::render($writer); |
|
256 | + } |
|
254 | 257 | } |
255 | 258 | |
256 | 259 | /** |
@@ -264,8 +267,9 @@ discard block |
||
264 | 267 | $writer->writeLine(); |
265 | 268 | foreach($this->getItems() as $index => $item) |
266 | 269 | { |
267 | - if($item->getHasAttributes()) |
|
268 | - $writer->addAttributes($item->getAttributes()); |
|
270 | + if($item->getHasAttributes()) { |
|
271 | + $writer->addAttributes($item->getAttributes()); |
|
272 | + } |
|
269 | 273 | $writer->renderBeginTag('li'); |
270 | 274 | $this->renderBulletText($writer, $item, $index); |
271 | 275 | $writer->renderEndTag(); |
@@ -297,9 +301,9 @@ discard block |
||
297 | 301 | |
298 | 302 | protected function renderTextItem($writer, $item, $index) |
299 | 303 | { |
300 | - if($item->getEnabled()) |
|
301 | - $writer->write(THttpUtility::htmlEncode($item->getText())); |
|
302 | - else |
|
304 | + if($item->getEnabled()) { |
|
305 | + $writer->write(THttpUtility::htmlEncode($item->getText())); |
|
306 | + } else |
|
303 | 307 | { |
304 | 308 | $writer->addAttribute('disabled', 'disabled'); |
305 | 309 | $writer->renderBeginTag('span'); |
@@ -310,16 +314,18 @@ discard block |
||
310 | 314 | |
311 | 315 | protected function renderHyperLinkItem($writer, $item, $index) |
312 | 316 | { |
313 | - if(!$this->_isEnabled || !$item->getEnabled()) |
|
314 | - $writer->addAttribute('disabled', 'disabled'); |
|
315 | - else |
|
317 | + if(!$this->_isEnabled || !$item->getEnabled()) { |
|
318 | + $writer->addAttribute('disabled', 'disabled'); |
|
319 | + } else |
|
316 | 320 | { |
317 | 321 | $writer->addAttribute('href', $item->getValue()); |
318 | - if(($target = $this->getTarget()) !== '') |
|
319 | - $writer->addAttribute('target', $target); |
|
322 | + if(($target = $this->getTarget()) !== '') { |
|
323 | + $writer->addAttribute('target', $target); |
|
324 | + } |
|
325 | + } |
|
326 | + if(($accesskey = $this->getAccessKey()) !== '') { |
|
327 | + $writer->addAttribute('accesskey', $accesskey); |
|
320 | 328 | } |
321 | - if(($accesskey = $this->getAccessKey()) !== '') |
|
322 | - $writer->addAttribute('accesskey', $accesskey); |
|
323 | 329 | $writer->renderBeginTag('a'); |
324 | 330 | $writer->write(THttpUtility::htmlEncode($item->getText())); |
325 | 331 | $writer->renderEndTag(); |
@@ -327,9 +333,9 @@ discard block |
||
327 | 333 | |
328 | 334 | protected function renderLinkButtonItem($writer, $item, $index) |
329 | 335 | { |
330 | - if(!$this->_isEnabled || !$item->getEnabled()) |
|
331 | - $writer->addAttribute('disabled', 'disabled'); |
|
332 | - else |
|
336 | + if(!$this->_isEnabled || !$item->getEnabled()) { |
|
337 | + $writer->addAttribute('disabled', 'disabled'); |
|
338 | + } else |
|
333 | 339 | { |
334 | 340 | $this->_currentRenderItemIndex = $index; |
335 | 341 | $writer->addAttribute('id', $this->getClientID() . $index); |
@@ -337,8 +343,9 @@ discard block |
||
337 | 343 | $cs = $this->getPage()->getClientScript(); |
338 | 344 | $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
339 | 345 | } |
340 | - if(($accesskey = $this->getAccessKey()) !== '') |
|
341 | - $writer->addAttribute('accesskey', $accesskey); |
|
346 | + if(($accesskey = $this->getAccessKey()) !== '') { |
|
347 | + $writer->addAttribute('accesskey', $accesskey); |
|
348 | + } |
|
342 | 349 | $writer->renderBeginTag('a'); |
343 | 350 | $writer->write(THttpUtility::htmlEncode($item->getText())); |
344 | 351 | $writer->renderEndTag(); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function getClientSide() |
134 | 134 | { |
135 | - if($this->_clientSide === null) |
|
135 | + if ($this->_clientSide === null) |
|
136 | 136 | $this->_clientSide = $this->createClientSide(); |
137 | 137 | return $this->_clientSide; |
138 | 138 | } |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $options = parent::getPostBackOptions(); |
155 | 155 | $options['ClassName'] = $this->getCssClass(); |
156 | 156 | $options['ShowColorPicker'] = $this->getShowColorPicker(); |
157 | - if($options['ShowColorPicker']) |
|
157 | + if ($options['ShowColorPicker']) |
|
158 | 158 | { |
159 | 159 | $mode = $this->getMode(); |
160 | - if($mode == TColorPickerMode::Full) $options['Mode'] = $mode; |
|
161 | - elseif($mode == TColorPickerMode::Simple) $options['Palette'] = 'Tiny'; |
|
160 | + if ($mode == TColorPickerMode::Full) $options['Mode'] = $mode; |
|
161 | + elseif ($mode == TColorPickerMode::Simple) $options['Palette'] = 'Tiny'; |
|
162 | 162 | $options['OKButtonText'] = $this->getOKButtonText(); |
163 | 163 | $options['CancelButtonText'] = $this->getCancelButtonText(); |
164 | 164 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | protected function getAssetUrl($file = '') |
174 | 174 | { |
175 | 175 | $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
176 | - return $base . '/' . self::SCRIPT_PATH . '/' . $file; |
|
176 | + return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -191,15 +191,15 @@ discard block |
||
191 | 191 | protected function publishColorPickerAssets() |
192 | 192 | { |
193 | 193 | $cs = $this->getPage()->getClientScript(); |
194 | - $key = "prado:" . get_class($this); |
|
194 | + $key = "prado:".get_class($this); |
|
195 | 195 | $imgs['button.gif'] = $this->getAssetUrl('button.gif'); |
196 | 196 | $imgs['background.png'] = $this->getAssetUrl('background.png'); |
197 | 197 | $options = TJavaScript::encode($imgs); |
198 | 198 | $code = "Prado.WebUI.TColorPicker.UIImages = {$options};"; |
199 | 199 | $cs->registerEndScript($key, $code); |
200 | 200 | $cs->registerPradoScript("colorpicker"); |
201 | - $url = $this->getAssetUrl($this->getColorPickerStyle() . '.css'); |
|
202 | - if(!$cs->isStyleSheetFileRegistered($url)) |
|
201 | + $url = $this->getAssetUrl($this->getColorPickerStyle().'.css'); |
|
202 | + if (!$cs->isStyleSheetFileRegistered($url)) |
|
203 | 203 | $cs->registerStyleSheetFile($url, $url); |
204 | 204 | } |
205 | 205 | |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | $writer->addAttribute('class', 'TColorPicker_button'); |
218 | 218 | $writer->renderBeginTag('span'); |
219 | 219 | |
220 | - $writer->addAttribute('id', $this->getClientID() . '_button'); |
|
220 | + $writer->addAttribute('id', $this->getClientID().'_button'); |
|
221 | 221 | $writer->addAttribute('src', $this->getAssetUrl('button.gif')); |
222 | - if($color !== '') |
|
222 | + if ($color !== '') |
|
223 | 223 | $writer->addAttribute('style', "background-color:{$color};"); |
224 | 224 | $writer->addAttribute('width', '20'); |
225 | 225 | $writer->addAttribute('height', '20'); |
@@ -132,8 +132,9 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function getClientSide() |
134 | 134 | { |
135 | - if($this->_clientSide === null) |
|
136 | - $this->_clientSide = $this->createClientSide(); |
|
135 | + if($this->_clientSide === null) { |
|
136 | + $this->_clientSide = $this->createClientSide(); |
|
137 | + } |
|
137 | 138 | return $this->_clientSide; |
138 | 139 | } |
139 | 140 | |
@@ -157,8 +158,11 @@ discard block |
||
157 | 158 | if($options['ShowColorPicker']) |
158 | 159 | { |
159 | 160 | $mode = $this->getMode(); |
160 | - if($mode == TColorPickerMode::Full) $options['Mode'] = $mode; |
|
161 | - elseif($mode == TColorPickerMode::Simple) $options['Palette'] = 'Tiny'; |
|
161 | + if($mode == TColorPickerMode::Full) { |
|
162 | + $options['Mode'] = $mode; |
|
163 | + } elseif($mode == TColorPickerMode::Simple) { |
|
164 | + $options['Palette'] = 'Tiny'; |
|
165 | + } |
|
162 | 166 | $options['OKButtonText'] = $this->getOKButtonText(); |
163 | 167 | $options['CancelButtonText'] = $this->getCancelButtonText(); |
164 | 168 | } |
@@ -199,8 +203,9 @@ discard block |
||
199 | 203 | $cs->registerEndScript($key, $code); |
200 | 204 | $cs->registerPradoScript("colorpicker"); |
201 | 205 | $url = $this->getAssetUrl($this->getColorPickerStyle() . '.css'); |
202 | - if(!$cs->isStyleSheetFileRegistered($url)) |
|
203 | - $cs->registerStyleSheetFile($url, $url); |
|
206 | + if(!$cs->isStyleSheetFileRegistered($url)) { |
|
207 | + $cs->registerStyleSheetFile($url, $url); |
|
208 | + } |
|
204 | 209 | } |
205 | 210 | |
206 | 211 | /** |
@@ -219,8 +224,9 @@ discard block |
||
219 | 224 | |
220 | 225 | $writer->addAttribute('id', $this->getClientID() . '_button'); |
221 | 226 | $writer->addAttribute('src', $this->getAssetUrl('button.gif')); |
222 | - if($color !== '') |
|
223 | - $writer->addAttribute('style', "background-color:{$color};"); |
|
227 | + if($color !== '') { |
|
228 | + $writer->addAttribute('style', "background-color:{$color};"); |
|
229 | + } |
|
224 | 230 | $writer->addAttribute('width', '20'); |
225 | 231 | $writer->addAttribute('height', '20'); |
226 | 232 | $writer->addAttribute('alt', ''); |