@@ -325,6 +325,7 @@ |
||
325 | 325 | * If you override this method, be sure to call the parent implementation |
326 | 326 | * so that the event handlers can be invoked. |
327 | 327 | * @param \Prado\Web\UI\TCommandEventParameter event parameter to be passed to the event handlers |
328 | + * @param \Prado\Web\UI\TCommandEventParameter $param |
|
328 | 329 | */ |
329 | 330 | public function onCommand($param) |
330 | 331 | { |
@@ -102,8 +102,7 @@ |
||
102 | 102 | { |
103 | 103 | $this->renderLinkButtonHref($writer); |
104 | 104 | $this->renderClientControlScript($writer); |
105 | - } |
|
106 | - elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
105 | + } elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
107 | 106 | $writer->addAttribute('disabled', 'disabled'); |
108 | 107 | } |
109 | 108 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function addAttributesToRender($writer) |
91 | 91 | { |
92 | - $page = $this->getPage(); |
|
92 | + $page=$this->getPage(); |
|
93 | 93 | $page->ensureRenderInForm($this); |
94 | 94 | |
95 | 95 | $writer->addAttribute('id', $this->getClientID()); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function renderClientControlScript($writer) |
115 | 115 | { |
116 | - $cs = $this->getPage()->getClientScript(); |
|
116 | + $cs=$this->getPage()->getClientScript(); |
|
117 | 117 | $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
118 | 118 | } |
119 | 119 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | protected function renderLinkButtonHref($writer) |
141 | 141 | { |
142 | 142 | //create unique no-op url references |
143 | - $nop = "javascript:;//" . $this->getClientID(); |
|
143 | + $nop="javascript:;//".$this->getClientID(); |
|
144 | 144 | $writer->addAttribute('href', $nop); |
145 | 145 | } |
146 | 146 | |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | */ |
162 | 162 | protected function getPostBackOptions() |
163 | 163 | { |
164 | - $options['ID'] = $this->getClientID(); |
|
165 | - $options['EventTarget'] = $this->getUniqueID(); |
|
166 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
167 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
168 | - $options['StopEvent'] = true; |
|
164 | + $options['ID']=$this->getClientID(); |
|
165 | + $options['EventTarget']=$this->getUniqueID(); |
|
166 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
167 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
168 | + $options['StopEvent']=true; |
|
169 | 169 | |
170 | 170 | return $options; |
171 | 171 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function renderContents($writer) |
180 | 180 | { |
181 | - if(($text = $this->getText()) === '') |
|
181 | + if(($text=$this->getText())==='') |
|
182 | 182 | parent::renderContents($writer); |
183 | 183 | else |
184 | 184 | $writer->write($text); |
@@ -53,6 +53,7 @@ discard block |
||
53 | 53 | * control does work with javascript and your class wants to flag that it requires an id |
54 | 54 | * to operate properly. Once set to true, it stays that way. |
55 | 55 | * @param boolean pass true to enable enforcement of the tag attribute id. |
56 | + * @param boolean $value |
|
56 | 57 | */ |
57 | 58 | public function setEnsureId($value) |
58 | 59 | { |
@@ -60,7 +61,7 @@ discard block |
||
60 | 61 | } |
61 | 62 | |
62 | 63 | /** |
63 | - * @return whether this web control must have an id |
|
64 | + * @return boolean this web control must have an id |
|
64 | 65 | */ |
65 | 66 | public function getEnsureId() |
66 | 67 | { |
@@ -107,6 +108,7 @@ discard block |
||
107 | 108 | * Only one-character string can be set, or an exception will be raised. |
108 | 109 | * Pass in an empty string if you want to disable access key. |
109 | 110 | * @param string the access key to be set |
111 | + * @param string $value |
|
110 | 112 | * @throws TInvalidDataValueException if the access key is specified with more than one character |
111 | 113 | */ |
112 | 114 | public function setAccessKey($value) |
@@ -186,6 +188,7 @@ discard block |
||
186 | 188 | |
187 | 189 | /** |
188 | 190 | * @param string the border width of the control |
191 | + * @param string $value |
|
189 | 192 | */ |
190 | 193 | public function setBorderWidth($value) |
191 | 194 | { |
@@ -213,6 +216,7 @@ discard block |
||
213 | 216 | |
214 | 217 | /** |
215 | 218 | * @param string the foreground color of the control |
219 | + * @param string $value |
|
216 | 220 | */ |
217 | 221 | public function setForeColor($value) |
218 | 222 | { |
@@ -239,7 +243,7 @@ discard block |
||
239 | 243 | } |
240 | 244 | |
241 | 245 | /** |
242 | - * @return TDisplayStyle display style of the control, default is TDisplayStyle::Fixed |
|
246 | + * @return string display style of the control, default is TDisplayStyle::Fixed |
|
243 | 247 | */ |
244 | 248 | public function getDisplay() |
245 | 249 | { |
@@ -248,6 +252,7 @@ discard block |
||
248 | 252 | |
249 | 253 | /** |
250 | 254 | * @param string the css class of the control |
255 | + * @param string $value |
|
251 | 256 | */ |
252 | 257 | public function setCssClass($value) |
253 | 258 | { |
@@ -267,6 +272,7 @@ discard block |
||
267 | 272 | |
268 | 273 | /** |
269 | 274 | * @param string the height of the control |
275 | + * @param string $value |
|
270 | 276 | */ |
271 | 277 | public function setHeight($value) |
272 | 278 | { |
@@ -310,6 +316,7 @@ discard block |
||
310 | 316 | * Sets the css style string of the control. |
311 | 317 | * The style string will be prefixed to the styles set via other control properties (e.g. Height, Width). |
312 | 318 | * @param string the css style string |
319 | + * @param string $value |
|
313 | 320 | * @throws TInvalidDataValueException if the parameter is not a string |
314 | 321 | */ |
315 | 322 | public function setStyle($value) |
@@ -340,6 +347,7 @@ discard block |
||
340 | 347 | * Sets the tab index of the control. |
341 | 348 | * Pass 0 if you want to disable tab index. |
342 | 349 | * @param integer the tab index to be set |
350 | + * @param integer $value |
|
343 | 351 | */ |
344 | 352 | public function setTabIndex($value) |
345 | 353 | { |
@@ -388,6 +396,7 @@ discard block |
||
388 | 396 | |
389 | 397 | /** |
390 | 398 | * @param string the width of the control |
399 | + * @param string $value |
|
391 | 400 | */ |
392 | 401 | public function setWidth($value) |
393 | 402 | { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @var boolean ensures the inclusion the id in the tag rendering. |
43 | 43 | */ |
44 | - private $_ensureid = false; |
|
44 | + private $_ensureid=false; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @var TWebControlDecorator this render things before and after both the open and close tag |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function setEnsureId($value) |
59 | 59 | { |
60 | - $this->_ensureid |= TPropertyValue::ensureBoolean($value); |
|
60 | + $this->_ensureid|=TPropertyValue::ensureBoolean($value); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | /** |
72 | 72 | * @return TWebControlDecorator |
73 | 73 | */ |
74 | - public function getDecorator($create = true) |
|
74 | + public function getDecorator($create=true) |
|
75 | 75 | { |
76 | 76 | if($create && !$this->_decorator) |
77 | - $this->_decorator = new TWebControlDecorator($this); |
|
77 | + $this->_decorator=new TWebControlDecorator($this); |
|
78 | 78 | return $this->_decorator; |
79 | 79 | } |
80 | 80 | |
@@ -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 ''; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function getHasStyle() |
281 | 281 | { |
282 | - return $this->getViewState('Style', null) !== null; |
|
282 | + return $this->getViewState('Style', null)!==null; |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -297,11 +297,11 @@ 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 | { |
304 | - $style = $this->createStyle(); |
|
304 | + $style=$this->createStyle(); |
|
305 | 305 | $this->setViewState('Style', $style, null); |
306 | 306 | return $style; |
307 | 307 | } |
@@ -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,17 +418,17 @@ 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 | 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 | 433 | if($this->getHasAttributes()) |
434 | 434 | { |
@@ -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); |
@@ -128,6 +128,7 @@ |
||
128 | 128 | * Initializes the control . |
129 | 129 | * @param TWebControl The control that is to be decorated. |
130 | 130 | * @param boolean whether decoration is just around the inner content |
131 | + * @param TWebControl $control |
|
131 | 132 | */ |
132 | 133 | public function __construct($control, $onlyinternal = false) { |
133 | 134 | $this->_control = $control; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @var boolean tells if the decoration uses state in its templates. If there are no templates |
71 | 71 | * in the instance of the decoration this variable is unused. |
72 | 72 | */ |
73 | - private $_usestate = false; |
|
73 | + private $_usestate=false; |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * @var TWebControl the control to decorate |
@@ -85,25 +85,25 @@ discard block |
||
85 | 85 | /** |
86 | 86 | * @var boolean This tells if the Templates have been |
87 | 87 | */ |
88 | - private $_addedTemplateDecoration = false; |
|
88 | + private $_addedTemplateDecoration=false; |
|
89 | 89 | |
90 | 90 | |
91 | 91 | /** |
92 | 92 | * @var string the text that goes before the open tag |
93 | 93 | */ |
94 | - private $_pretagtext = ''; |
|
94 | + private $_pretagtext=''; |
|
95 | 95 | /** |
96 | 96 | * @var string the text that goes after the open tag |
97 | 97 | */ |
98 | - private $_precontentstext = ''; |
|
98 | + private $_precontentstext=''; |
|
99 | 99 | /** |
100 | 100 | * @var string the text that goes before the close tag |
101 | 101 | */ |
102 | - private $_postcontentstext = ''; |
|
102 | + private $_postcontentstext=''; |
|
103 | 103 | /** |
104 | 104 | * @var string the text that goes after the close tag |
105 | 105 | */ |
106 | - private $_posttagtext = ''; |
|
106 | + private $_posttagtext=''; |
|
107 | 107 | |
108 | 108 | |
109 | 109 | |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @param TWebControl The control that is to be decorated. |
131 | 131 | * @param boolean whether decoration is just around the inner content |
132 | 132 | */ |
133 | - public function __construct($control, $onlyinternal = false) { |
|
134 | - $this->_control = $control; |
|
135 | - $this->_internalonly = $onlyinternal; |
|
133 | + public function __construct($control, $onlyinternal=false) { |
|
134 | + $this->_control=$control; |
|
135 | + $this->_internalonly=$onlyinternal; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function setUseState($value) |
151 | 151 | { |
152 | - $this->_usestate = TPropertyValue::ensureBoolean($value); |
|
152 | + $this->_usestate=TPropertyValue::ensureBoolean($value); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function setPreTagText($value) { |
166 | 166 | if(!$this->_internalonly && !$this->_control->getIsSkinApplied()) |
167 | - $this->_pretagtext = TPropertyValue::ensureString($value); |
|
167 | + $this->_pretagtext=TPropertyValue::ensureString($value); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function setPreContentsText($value) { |
182 | 182 | if(!$this->_control->getIsSkinApplied()) |
183 | - $this->_precontentstext = TPropertyValue::ensureString($value); |
|
183 | + $this->_precontentstext=TPropertyValue::ensureString($value); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function setPostContentsText($value) { |
198 | 198 | if(!$this->_control->getIsSkinApplied()) |
199 | - $this->_postcontentstext = TPropertyValue::ensureString($value); |
|
199 | + $this->_postcontentstext=TPropertyValue::ensureString($value); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function setPostTagText($value) { |
214 | 214 | if(!$this->_internalonly && !$this->_control->getIsSkinApplied()) |
215 | - $this->_posttagtext = TPropertyValue::ensureString($value); |
|
215 | + $this->_posttagtext=TPropertyValue::ensureString($value); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function setPreTagTemplate($value) { |
230 | 230 | if(!$this->_internalonly && !$this->_control->getIsSkinApplied()) |
231 | - $this->_pretagtemplate = $value; |
|
231 | + $this->_pretagtemplate=$value; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function setPreContentsTemplate($value) { |
246 | 246 | if(!$this->_control->getIsSkinApplied()) |
247 | - $this->_precontentstemplate = $value; |
|
247 | + $this->_precontentstemplate=$value; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function setPostContentsTemplate($value) { |
262 | 262 | if(!$this->_control->getIsSkinApplied()) |
263 | - $this->_postcontentstemplate = $value; |
|
263 | + $this->_postcontentstemplate=$value; |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function setPostTagTemplate($value) { |
278 | 278 | if(!$this->_internalonly && !$this->_control->getIsSkinApplied()) |
279 | - $this->_posttagtemplate = $value; |
|
279 | + $this->_posttagtemplate=$value; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -285,15 +285,15 @@ discard block |
||
285 | 285 | * This call attaches the ensureTemplateDecoration to the TPage onSaveStateComplete so |
286 | 286 | * these controls don't have page states. This is as close to not influencing the page as possible. |
287 | 287 | */ |
288 | - public function instantiate($outercontrol = null) { |
|
288 | + public function instantiate($outercontrol=null) { |
|
289 | 289 | if($this->getPreTagTemplate() || $this->getPreContentsTemplate() || |
290 | 290 | $this->getPostContentsTemplate() || $this->getPostTagTemplate()) { |
291 | 291 | |
292 | - $this->_outercontrol = $outercontrol; |
|
292 | + $this->_outercontrol=$outercontrol; |
|
293 | 293 | if($this->getUseState()) |
294 | 294 | $this->ensureTemplateDecoration(); |
295 | 295 | else |
296 | - $this->_control->getPage()->onSaveStateComplete[] = [$this, 'ensureTemplateDecoration']; |
|
296 | + $this->_control->getPage()->onSaveStateComplete[]=[$this, 'ensureTemplateDecoration']; |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -306,28 +306,28 @@ discard block |
||
306 | 306 | * control |
307 | 307 | * @return boolean returns true if the template decorations have been added |
308 | 308 | */ |
309 | - public function ensureTemplateDecoration($sender = null, $param = null) { |
|
309 | + public function ensureTemplateDecoration($sender=null, $param=null) { |
|
310 | 310 | |
311 | - $control = $this->_control; |
|
312 | - $outercontrol = $this->_outercontrol; |
|
313 | - if($outercontrol === null) |
|
314 | - $outercontrol = $control; |
|
311 | + $control=$this->_control; |
|
312 | + $outercontrol=$this->_outercontrol; |
|
313 | + if($outercontrol===null) |
|
314 | + $outercontrol=$control; |
|
315 | 315 | |
316 | 316 | if($this->_addedTemplateDecoration) |
317 | 317 | return $this->_addedTemplateDecoration; |
318 | 318 | |
319 | - $this->_addedTemplateDecoration = true; |
|
319 | + $this->_addedTemplateDecoration=true; |
|
320 | 320 | |
321 | 321 | if($this->getPreContentsTemplate()) |
322 | 322 | { |
323 | - $precontents = new TCompositeControl; |
|
323 | + $precontents=new TCompositeControl; |
|
324 | 324 | $this->getPreContentsTemplate()->instantiateIn($precontents); |
325 | 325 | $control->getControls()->insertAt(0, $precontents); |
326 | 326 | } |
327 | 327 | |
328 | 328 | if($this->getPostContentsTemplate()) |
329 | 329 | { |
330 | - $postcontents = new TCompositeControl; |
|
330 | + $postcontents=new TCompositeControl; |
|
331 | 331 | $this->getPostContentsTemplate()->instantiateIn($postcontents); |
332 | 332 | $control->getControls()->add($postcontents); |
333 | 333 | } |
@@ -338,14 +338,14 @@ discard block |
||
338 | 338 | |
339 | 339 | if($this->getPreTagTemplate()) |
340 | 340 | { |
341 | - $pretag = new TCompositeControl; |
|
341 | + $pretag=new TCompositeControl; |
|
342 | 342 | $this->getPreTagTemplate()->instantiateIn($pretag); |
343 | 343 | $outercontrol->getParent()->getControls()->insertBefore($outercontrol, $pretag); |
344 | 344 | } |
345 | 345 | |
346 | 346 | if($this->getPostTagTemplate()) |
347 | 347 | { |
348 | - $posttag = new TCompositeControl; |
|
348 | + $posttag=new TCompositeControl; |
|
349 | 349 | $this->getPostTagTemplate()->instantiateIn($posttag); |
350 | 350 | $outercontrol->getParent()->getControls()->insertAfter($outercontrol, $posttag); |
351 | 351 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getConfig() |
50 | 50 | { |
51 | - $config = $this->getViewState('Config', null); |
|
52 | - return ($config === null) ? \HTMLPurifier_Config::createDefault() : $config; |
|
51 | + $config=$this->getViewState('Config', null); |
|
52 | + return ($config===null) ? \HTMLPurifier_Config::createDefault() : $config; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function render($writer) |
61 | 61 | { |
62 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
62 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
63 | 63 | parent::render($htmlWriter); |
64 | 64 | $writer->write($this->parseSafeHtml($htmlWriter->flush())); |
65 | 65 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function parseSafeHtml($text) |
73 | 73 | { |
74 | - $purifier = new \HTMLPurifier($this->getConfig()); |
|
74 | + $purifier=new \HTMLPurifier($this->getConfig()); |
|
75 | 75 | return $purifier->purify($text); |
76 | 76 | } |
77 | 77 | } |
@@ -77,6 +77,7 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * Renders javascript block |
79 | 79 | * @param string javascript block |
80 | + * @param string $script |
|
80 | 81 | * @return string rendering result |
81 | 82 | */ |
82 | 83 | public static function renderScriptBlock($script) |
@@ -97,7 +98,7 @@ discard block |
||
97 | 98 | } |
98 | 99 | |
99 | 100 | /** |
100 | - * @return Marks a string as a javascript function. Once marke, the string is considered as a |
|
101 | + * @return TJavaScriptLiteral a string as a javascript function. Once marke, the string is considered as a |
|
101 | 102 | * raw javascript function that is not supposed to be encoded by {@link encode} |
102 | 103 | */ |
103 | 104 | public static function quoteJsLiteral($js) |
@@ -260,6 +261,7 @@ discard block |
||
260 | 261 | * @param string string to be decoded |
261 | 262 | * @param bool whether to convert returned objects to associative arrays |
262 | 263 | * @param int recursion depth |
264 | + * @param string $value |
|
263 | 265 | * @return mixed decoded variable |
264 | 266 | */ |
265 | 267 | public static function jsonDecode($value, $assoc = false, $depth = 512) |
@@ -302,7 +304,8 @@ discard block |
||
302 | 304 | * Minimize the size of a javascript script. |
303 | 305 | * This method is based on Douglas Crockford's JSMin. |
304 | 306 | * @param string code that you want to minimzie |
305 | - * @return minimized version of the code |
|
307 | + * @param string $code |
|
308 | + * @return string version of the code |
|
306 | 309 | */ |
307 | 310 | public static function JSMin($code) |
308 | 311 | { |
@@ -160,8 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | } |
162 | 162 | return '{' . $results . '}'; |
163 | - } |
|
164 | - else |
|
163 | + } else |
|
165 | 164 | { |
166 | 165 | foreach($value as $v) |
167 | 166 | { |
@@ -174,8 +173,7 @@ discard block |
||
174 | 173 | } |
175 | 174 | return '[' . $results . ']'; |
176 | 175 | } |
177 | - } |
|
178 | - elseif(is_int($value)) |
|
176 | + } elseif(is_int($value)) |
|
179 | 177 | return "$value"; |
180 | 178 | elseif(is_float($value)) |
181 | 179 | { |
@@ -195,8 +193,7 @@ discard block |
||
195 | 193 | return str_replace($locale['decimal_point'], '.', "$value"); |
196 | 194 | break; |
197 | 195 | } |
198 | - } |
|
199 | - elseif(is_object($value)) |
|
196 | + } elseif(is_object($value)) |
|
200 | 197 | if ($value instanceof TJavaScriptLiteral) |
201 | 198 | return $value->toJavaScriptLiteral(); |
202 | 199 | else |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function renderScriptFiles($files) |
35 | 35 | { |
36 | - $str = ''; |
|
36 | + $str=''; |
|
37 | 37 | foreach($files as $file) |
38 | - $str .= self::renderScriptFile($file); |
|
38 | + $str.=self::renderScriptFile($file); |
|
39 | 39 | return $str; |
40 | 40 | } |
41 | 41 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public static function renderScriptFile($file) |
48 | 48 | { |
49 | - return '<script type="text/javascript" src="' . THttpUtility::htmlEncode($file) . "\"></script>\n"; |
|
49 | + return '<script type="text/javascript" src="'.THttpUtility::htmlEncode($file)."\"></script>\n"; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public static function renderScriptBlocks($scripts) |
58 | 58 | { |
59 | 59 | if(count($scripts)) |
60 | - return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n" . implode("\n", $scripts) . "\n/*]]>*/\n</script>\n"; |
|
60 | + return "<script type=\"text/javascript\">\n/*<![CDATA[*/\n".implode("\n", $scripts)."\n/*]]>*/\n</script>\n"; |
|
61 | 61 | else |
62 | 62 | return ''; |
63 | 63 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | public static function renderScriptBlocksCallback($scripts) |
71 | 71 | { |
72 | 72 | if(count($scripts)) |
73 | - return implode("\n", $scripts) . "\n"; |
|
73 | + return implode("\n", $scripts)."\n"; |
|
74 | 74 | else |
75 | 75 | return ''; |
76 | 76 | } |
@@ -139,40 +139,40 @@ discard block |
||
139 | 139 | * @param boolean wether to encode empty strings too. Default to false for BC. |
140 | 140 | * @return string the encoded string |
141 | 141 | */ |
142 | - public static function encode($value, $toMap = true, $encodeEmptyStrings = false) |
|
142 | + public static function encode($value, $toMap=true, $encodeEmptyStrings=false) |
|
143 | 143 | { |
144 | 144 | if(is_string($value)) |
145 | 145 | return self::quoteString($value); |
146 | 146 | elseif(is_bool($value)) |
147 | - return $value?'true':'false'; |
|
147 | + return $value ? 'true' : 'false'; |
|
148 | 148 | elseif(is_array($value)) |
149 | 149 | { |
150 | - $results = ''; |
|
151 | - if(($n = count($value)) > 0 && array_keys($value) !== range(0, $n - 1)) |
|
150 | + $results=''; |
|
151 | + if(($n=count($value)) > 0 && array_keys($value)!==range(0, $n - 1)) |
|
152 | 152 | { |
153 | 153 | foreach($value as $k => $v) |
154 | 154 | { |
155 | - if($v !== '' || $encodeEmptyStrings) |
|
155 | + if($v!=='' || $encodeEmptyStrings) |
|
156 | 156 | { |
157 | - if($results !== '') |
|
158 | - $results .= ','; |
|
159 | - $results .= "'$k':" . self::encode($v, $toMap, $encodeEmptyStrings); |
|
157 | + if($results!=='') |
|
158 | + $results.=','; |
|
159 | + $results.="'$k':".self::encode($v, $toMap, $encodeEmptyStrings); |
|
160 | 160 | } |
161 | 161 | } |
162 | - return '{' . $results . '}'; |
|
162 | + return '{'.$results.'}'; |
|
163 | 163 | } |
164 | 164 | else |
165 | 165 | { |
166 | 166 | foreach($value as $v) |
167 | 167 | { |
168 | - if($v !== '' || $encodeEmptyStrings) |
|
168 | + if($v!=='' || $encodeEmptyStrings) |
|
169 | 169 | { |
170 | - if($results !== '') |
|
171 | - $results .= ','; |
|
172 | - $results .= self::encode($v, $toMap, $encodeEmptyStrings); |
|
170 | + if($results!=='') |
|
171 | + $results.=','; |
|
172 | + $results.=self::encode($v, $toMap, $encodeEmptyStrings); |
|
173 | 173 | } |
174 | 174 | } |
175 | - return '[' . $results . ']'; |
|
175 | + return '['.$results.']'; |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | elseif(is_int($value)) |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | return 'Number.POSITIVE_INFINITY'; |
189 | 189 | break; |
190 | 190 | default: |
191 | - $locale = localeConv(); |
|
192 | - if($locale['decimal_point'] == '.') |
|
191 | + $locale=localeConv(); |
|
192 | + if($locale['decimal_point']=='.') |
|
193 | 193 | return "$value"; |
194 | 194 | else |
195 | 195 | return str_replace($locale['decimal_point'], '.', "$value"); |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | elseif(is_object($value)) |
200 | - if ($value instanceof TJavaScriptLiteral) |
|
200 | + if($value instanceof TJavaScriptLiteral) |
|
201 | 201 | return $value->toJavaScriptLiteral(); |
202 | 202 | else |
203 | 203 | return self::encode(get_object_vars($value), $toMap); |
204 | - elseif($value === null) |
|
204 | + elseif($value===null) |
|
205 | 205 | return 'null'; |
206 | 206 | else |
207 | 207 | return ''; |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | * @param mixed variable to be encoded |
213 | 213 | * @return string encoded string |
214 | 214 | */ |
215 | - public static function jsonEncode($value, $options = 0) |
|
215 | + public static function jsonEncode($value, $options=0) |
|
216 | 216 | { |
217 | - if (($g = Prado::getApplication()->getGlobalization(false)) !== null && |
|
218 | - strtoupper($enc = $g->getCharset()) != 'UTF-8') { |
|
217 | + if(($g=Prado::getApplication()->getGlobalization(false))!==null && |
|
218 | + strtoupper($enc=$g->getCharset())!='UTF-8') { |
|
219 | 219 | self::convertToUtf8($value, $enc); |
220 | 220 | } |
221 | 221 | |
222 | - $s = @json_encode($value, $options); |
|
222 | + $s=@json_encode($value, $options); |
|
223 | 223 | self::checkJsonError(); |
224 | 224 | return $s; |
225 | 225 | } |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | */ |
232 | 232 | private static function convertToUtf8(&$value, $sourceEncoding) { |
233 | 233 | if(is_string($value)) |
234 | - $value = iconv($sourceEncoding, 'UTF-8', $value); |
|
235 | - elseif (is_array($value)) |
|
234 | + $value=iconv($sourceEncoding, 'UTF-8', $value); |
|
235 | + elseif(is_array($value)) |
|
236 | 236 | { |
237 | 237 | foreach($value as &$element) |
238 | 238 | self::convertToUtf8($element, $sourceEncoding); |
@@ -247,37 +247,37 @@ discard block |
||
247 | 247 | * @param int recursion depth |
248 | 248 | * @return mixed decoded variable |
249 | 249 | */ |
250 | - public static function jsonDecode($value, $assoc = false, $depth = 512) |
|
250 | + public static function jsonDecode($value, $assoc=false, $depth=512) |
|
251 | 251 | { |
252 | - $s = @json_decode($value, $assoc, $depth); |
|
252 | + $s=@json_decode($value, $assoc, $depth); |
|
253 | 253 | self::checkJsonError(); |
254 | 254 | return $s; |
255 | 255 | } |
256 | 256 | |
257 | 257 | private static function checkJsonError() |
258 | 258 | { |
259 | - switch ($err = json_last_error()) |
|
259 | + switch($err=json_last_error()) |
|
260 | 260 | { |
261 | 261 | case JSON_ERROR_NONE: |
262 | 262 | return; |
263 | 263 | break; |
264 | 264 | case JSON_ERROR_DEPTH: |
265 | - $msg = 'Maximum stack depth exceeded'; |
|
265 | + $msg='Maximum stack depth exceeded'; |
|
266 | 266 | break; |
267 | 267 | case JSON_ERROR_STATE_MISMATCH: |
268 | - $msg = 'Underflow or the modes mismatch'; |
|
268 | + $msg='Underflow or the modes mismatch'; |
|
269 | 269 | break; |
270 | 270 | case JSON_ERROR_CTRL_CHAR: |
271 | - $msg = 'Unexpected control character found'; |
|
271 | + $msg='Unexpected control character found'; |
|
272 | 272 | break; |
273 | 273 | case JSON_ERROR_SYNTAX: |
274 | - $msg = 'Syntax error, malformed JSON'; |
|
274 | + $msg='Syntax error, malformed JSON'; |
|
275 | 275 | break; |
276 | 276 | case JSON_ERROR_UTF8: |
277 | - $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
277 | + $msg='Malformed UTF-8 characters, possibly incorrectly encoded'; |
|
278 | 278 | break; |
279 | 279 | default: |
280 | - $msg = 'Unknown error'; |
|
280 | + $msg='Unknown error'; |
|
281 | 281 | break; |
282 | 282 | } |
283 | 283 | throw new \Exception("JSON error ($err): $msg"); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
155 | - * @return mixed the algorithm used to encrypt/decrypt data. Defaults to the string 'aes-256-cbc'. |
|
155 | + * @return string the algorithm used to encrypt/decrypt data. Defaults to the string 'aes-256-cbc'. |
|
156 | 156 | */ |
157 | 157 | public function getCryptAlgorithm() |
158 | 158 | { |
@@ -173,6 +173,7 @@ discard block |
||
173 | 173 | /** |
174 | 174 | * Encrypts data with {@link getEncryptionKey EncryptionKey}. |
175 | 175 | * @param string data to be encrypted. |
176 | + * @param string $data |
|
176 | 177 | * @return string the encrypted data |
177 | 178 | * @throws TNotSupportedException if PHP OpenSSL extension is not loaded |
178 | 179 | */ |
@@ -191,6 +192,7 @@ discard block |
||
191 | 192 | /** |
192 | 193 | * Decrypts data with {@link getEncryptionKey EncryptionKey}. |
193 | 194 | * @param string data to be decrypted. |
195 | + * @param string $data |
|
194 | 196 | * @return string the decrypted data |
195 | 197 | * @throws TNotSupportedException if PHP OpenSSL extension is not loaded |
196 | 198 | */ |
@@ -184,8 +184,7 @@ discard block |
||
184 | 184 | $key = md5($this->getEncryptionKey()); |
185 | 185 | $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($this->_cryptAlgorithm)); |
186 | 186 | return $iv . openssl_encrypt($data, $this->_cryptAlgorithm, $key, null, $iv); |
187 | - } |
|
188 | - else |
|
187 | + } else |
|
189 | 188 | throw new TNotSupportedException('securitymanager_openssl_required'); |
190 | 189 | } |
191 | 190 | |
@@ -202,8 +201,7 @@ discard block |
||
202 | 201 | $key = md5($this->getEncryptionKey()); |
203 | 202 | $iv = $this->substr($data, 0, openssl_cipher_iv_length($this->_cryptAlgorithm)); |
204 | 203 | return openssl_decrypt($this->substr($data, $this->strlen($iv), $this->strlen($data)), $this->_cryptAlgorithm, $key, null, $iv); |
205 | - } |
|
206 | - else |
|
204 | + } else |
|
207 | 205 | throw new TNotSupportedException('securitymanager_openssl_required'); |
208 | 206 | } |
209 | 207 |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | */ |
51 | 51 | class TSecurityManager extends \Prado\TModule |
52 | 52 | { |
53 | - const STATE_VALIDATION_KEY = 'prado:securitymanager:validationkey'; |
|
54 | - const STATE_ENCRYPTION_KEY = 'prado:securitymanager:encryptionkey'; |
|
53 | + const STATE_VALIDATION_KEY='prado:securitymanager:validationkey'; |
|
54 | + const STATE_ENCRYPTION_KEY='prado:securitymanager:encryptionkey'; |
|
55 | 55 | |
56 | 56 | private $_validationKey; |
57 | 57 | private $_encryptionKey; |
58 | - private $_hashAlgorithm = 'sha256'; |
|
59 | - private $_cryptAlgorithm = 'aes-256-cbc'; |
|
58 | + private $_hashAlgorithm='sha256'; |
|
59 | + private $_cryptAlgorithm='aes-256-cbc'; |
|
60 | 60 | private $_mbstring; |
61 | 61 | |
62 | 62 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function init($config) |
68 | 68 | { |
69 | - $this->_mbstring = extension_loaded('mbstring'); |
|
69 | + $this->_mbstring=extension_loaded('mbstring'); |
|
70 | 70 | $this->getApplication()->setSecurityManager($this); |
71 | 71 | } |
72 | 72 | |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function getValidationKey() |
86 | 86 | { |
87 | - if(null === $this->_validationKey) { |
|
88 | - if(null === ($this->_validationKey = $this->getApplication()->getGlobalState(self::STATE_VALIDATION_KEY))) { |
|
89 | - $this->_validationKey = $this->generateRandomKey(); |
|
87 | + if(null===$this->_validationKey) { |
|
88 | + if(null===($this->_validationKey=$this->getApplication()->getGlobalState(self::STATE_VALIDATION_KEY))) { |
|
89 | + $this->_validationKey=$this->generateRandomKey(); |
|
90 | 90 | $this->getApplication()->setGlobalState(self::STATE_VALIDATION_KEY, $this->_validationKey, null, true); |
91 | 91 | } |
92 | 92 | } |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function setValidationKey($value) |
101 | 101 | { |
102 | - if('' === $value) |
|
102 | + if(''===$value) |
|
103 | 103 | throw new TInvalidDataValueException('securitymanager_validationkey_invalid'); |
104 | 104 | |
105 | - $this->_validationKey = $value; |
|
105 | + $this->_validationKey=$value; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getEncryptionKey() |
113 | 113 | { |
114 | - if(null === $this->_encryptionKey) { |
|
115 | - if(null === ($this->_encryptionKey = $this->getApplication()->getGlobalState(self::STATE_ENCRYPTION_KEY))) { |
|
116 | - $this->_encryptionKey = $this->generateRandomKey(); |
|
114 | + if(null===$this->_encryptionKey) { |
|
115 | + if(null===($this->_encryptionKey=$this->getApplication()->getGlobalState(self::STATE_ENCRYPTION_KEY))) { |
|
116 | + $this->_encryptionKey=$this->generateRandomKey(); |
|
117 | 117 | $this->getApplication()->setGlobalState(self::STATE_ENCRYPTION_KEY, $this->_encryptionKey, null, true); |
118 | 118 | } |
119 | 119 | } |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function setEncryptionKey($value) |
128 | 128 | { |
129 | - if('' === $value) |
|
129 | + if(''===$value) |
|
130 | 130 | throw new TInvalidDataValueException('securitymanager_encryptionkey_invalid'); |
131 | 131 | |
132 | - $this->_encryptionKey = $value; |
|
132 | + $this->_encryptionKey=$value; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function setHashAlgorithm($value) |
149 | 149 | { |
150 | - $this->_hashAlgorithm = TPropertyValue::ensureString($value); |
|
150 | + $this->_hashAlgorithm=TPropertyValue::ensureString($value); |
|
151 | 151 | if(!in_array($this->_hashAlgorithm, hash_algos())) |
152 | 152 | throw new TInvalidDataValueException('securitymanager_hash_algorithm_invalid'); |
153 | 153 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function setCryptAlgorithm($value) |
168 | 168 | { |
169 | - $this->_cryptAlgorithm = TPropertyValue::ensureString($value); |
|
169 | + $this->_cryptAlgorithm=TPropertyValue::ensureString($value); |
|
170 | 170 | if(!in_array($this->_hashAlgorithm, openssl_get_cipher_methods())) |
171 | 171 | throw new TInvalidDataValueException('securitymanager_crypt_algorithm_invalid'); |
172 | 172 | } |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | { |
182 | 182 | if(extension_loaded('openssl')) |
183 | 183 | { |
184 | - $key = md5($this->getEncryptionKey()); |
|
185 | - $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($this->_cryptAlgorithm)); |
|
186 | - return $iv . openssl_encrypt($data, $this->_cryptAlgorithm, $key, null, $iv); |
|
184 | + $key=md5($this->getEncryptionKey()); |
|
185 | + $iv=openssl_random_pseudo_bytes(openssl_cipher_iv_length($this->_cryptAlgorithm)); |
|
186 | + return $iv.openssl_encrypt($data, $this->_cryptAlgorithm, $key, null, $iv); |
|
187 | 187 | } |
188 | 188 | else |
189 | 189 | throw new TNotSupportedException('securitymanager_openssl_required'); |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | { |
200 | 200 | if(extension_loaded('openssl')) |
201 | 201 | { |
202 | - $key = md5($this->getEncryptionKey()); |
|
203 | - $iv = $this->substr($data, 0, openssl_cipher_iv_length($this->_cryptAlgorithm)); |
|
202 | + $key=md5($this->getEncryptionKey()); |
|
203 | + $iv=$this->substr($data, 0, openssl_cipher_iv_length($this->_cryptAlgorithm)); |
|
204 | 204 | return openssl_decrypt($this->substr($data, $this->strlen($iv), $this->strlen($data)), $this->_cryptAlgorithm, $key, null, $iv); |
205 | 205 | } |
206 | 206 | else |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function hashData($data) |
216 | 216 | { |
217 | - $hmac = $this->computeHMAC($data); |
|
218 | - return $hmac . $data; |
|
217 | + $hmac=$this->computeHMAC($data); |
|
218 | + return $hmac.$data; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -227,14 +227,14 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function validateData($data) |
229 | 229 | { |
230 | - $len = $this->strlen($this->computeHMAC('test')); |
|
230 | + $len=$this->strlen($this->computeHMAC('test')); |
|
231 | 231 | |
232 | 232 | if($this->strlen($data) < $len) |
233 | 233 | return false; |
234 | 234 | |
235 | - $hmac = $this->substr($data, 0, $len); |
|
236 | - $data2 = $this->substr($data, $len, $this->strlen($data)); |
|
237 | - return $hmac === $this->computeHMAC($data2) ? $data2 : false; |
|
235 | + $hmac=$this->substr($data, 0, $len); |
|
236 | + $data2=$this->substr($data, $len, $this->strlen($data)); |
|
237 | + return $hmac===$this->computeHMAC($data2) ? $data2 : false; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -130,6 +130,7 @@ |
||
130 | 130 | |
131 | 131 | /** |
132 | 132 | * @param string search condition, the SQL string after the WHERE clause. |
133 | + * @param string $value |
|
133 | 134 | */ |
134 | 135 | public function setSearchCondition($value) |
135 | 136 | { |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function initializeSort() |
64 | 64 | { |
65 | - $table = $this->getTableInfo(); |
|
66 | - $sorts = ['Sort By', str_repeat('-', 15)]; |
|
67 | - $headers = []; |
|
65 | + $table=$this->getTableInfo(); |
|
66 | + $sorts=['Sort By', str_repeat('-', 15)]; |
|
67 | + $headers=[]; |
|
68 | 68 | foreach($table->getColumns() as $name => $colum) |
69 | 69 | { |
70 | - $fname = ucwords(str_replace('_', ' ', $name)); |
|
71 | - $sorts[$name . ' ASC'] = $fname . ' Ascending'; |
|
72 | - $sorts[$name . ' DESC'] = $fname . ' Descending'; |
|
73 | - $headers[] = $fname ; |
|
70 | + $fname=ucwords(str_replace('_', ' ', $name)); |
|
71 | + $sorts[$name.' ASC']=$fname.' Ascending'; |
|
72 | + $sorts[$name.' DESC']=$fname.' Descending'; |
|
73 | + $headers[]=$fname; |
|
74 | 74 | } |
75 | 75 | $this->_sort->setDataSource($sorts); |
76 | 76 | $this->_sort->dataBind(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | public function onPreRender($param) |
85 | 85 | { |
86 | 86 | parent::onPreRender($param); |
87 | - if(!$this->getPage()->getIsPostBack() || $this->getViewState('CurrentClass') != $this->getRecordClass()) |
|
87 | + if(!$this->getPage()->getIsPostBack() || $this->getViewState('CurrentClass')!=$this->getRecordClass()) |
|
88 | 88 | { |
89 | 89 | $this->initializeSort(); |
90 | 90 | $this->setViewState('CurrentClass', $this->getRecordClass()); |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function loadRecordData() |
99 | 99 | { |
100 | - $search = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
100 | + $search=new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
101 | 101 | $this->_list->setVirtualItemCount($this->getRecordFinder()->count($search)); |
102 | - $finder = $this->getRecordFinder(); |
|
103 | - $criteria = $this->getRecordCriteria(); |
|
102 | + $finder=$this->getRecordFinder(); |
|
103 | + $criteria=$this->getRecordCriteria(); |
|
104 | 104 | $this->_list->setDataSource($finder->findAll($criteria)); |
105 | 105 | $this->_list->dataBind(); |
106 | 106 | } |
@@ -110,21 +110,21 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function getRecordCriteria() |
112 | 112 | { |
113 | - $total = $this->_list->getVirtualItemCount(); |
|
114 | - $limit = $this->_list->getPageSize(); |
|
115 | - $offset = $this->_list->getCurrentPageIndex() * $limit; |
|
113 | + $total=$this->_list->getVirtualItemCount(); |
|
114 | + $limit=$this->_list->getPageSize(); |
|
115 | + $offset=$this->_list->getCurrentPageIndex() * $limit; |
|
116 | 116 | if($offset + $limit > $total) |
117 | - $limit = $total - $offset; |
|
118 | - $criteria = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
117 | + $limit=$total - $offset; |
|
118 | + $criteria=new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
119 | 119 | if($limit > 0) |
120 | 120 | { |
121 | 121 | $criteria->setLimit($limit); |
122 | 122 | if($offset <= $total) |
123 | 123 | $criteria->setOffset($offset); |
124 | 124 | } |
125 | - $order = explode(' ', $this->_sort->getSelectedValue(), 2); |
|
126 | - if(is_array($order) && count($order) === 2) |
|
127 | - $criteria->OrdersBy[$order[0]] = $order[1]; |
|
125 | + $order=explode(' ', $this->_sort->getSelectedValue(), 2); |
|
126 | + if(is_array($order) && count($order)===2) |
|
127 | + $criteria->OrdersBy[$order[0]]=$order[1]; |
|
128 | 128 | return $criteria; |
129 | 129 | } |
130 | 130 | |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function initializeEdit($sender, $param) |
183 | 183 | { |
184 | - if(($ctrl = $this->getEditViewControl()) !== null) |
|
184 | + if(($ctrl=$this->getEditViewControl())!==null) |
|
185 | 185 | { |
186 | 186 | if($param instanceof TRepeaterCommandEventParameter) |
187 | 187 | { |
188 | - $pk = $param->getItem()->getCustomData(); |
|
188 | + $pk=$param->getItem()->getCustomData(); |
|
189 | 189 | $ctrl->setRecordPk($pk); |
190 | 190 | $ctrl->initializeEditForm(); |
191 | 191 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | if($param instanceof TRepeaterCommandEventParameter) |
201 | 201 | { |
202 | - $pk = $param->getItem()->getCustomData(); |
|
202 | + $pk=$param->getItem()->getCustomData(); |
|
203 | 203 | $this->getRecordFinder()->deleteByPk($pk); |
204 | 204 | } |
205 | 205 | } |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | */ |
210 | 210 | protected function listItemCreated($sender, $param) |
211 | 211 | { |
212 | - $item = $param->getItem(); |
|
212 | + $item=$param->getItem(); |
|
213 | 213 | if($item instanceof IItemDataRenderer) |
214 | 214 | { |
215 | - $type = $item->getItemType(); |
|
216 | - if($type == TListItemType::Item || $type == TListItemType::AlternatingItem) |
|
215 | + $type=$item->getItemType(); |
|
216 | + if($type==TListItemType::Item || $type==TListItemType::AlternatingItem) |
|
217 | 217 | $this->populateField($sender, $param); |
218 | 218 | } |
219 | 219 | } |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | */ |
225 | 225 | protected function populateField($sender, $param) |
226 | 226 | { |
227 | - $item = $param->getItem(); |
|
228 | - if(($data = $item->getData()) !== null) |
|
227 | + $item=$param->getItem(); |
|
228 | + if(($data=$item->getData())!==null) |
|
229 | 229 | { |
230 | 230 | $item->setCustomData($this->getRecordPkValues($data)); |
231 | - if(($prop = $item->findControl('_properties')) !== null) |
|
231 | + if(($prop=$item->findControl('_properties'))!==null) |
|
232 | 232 | { |
233 | 233 | $item->_properties->setDataSource($this->getRecordPropertyValues($data)); |
234 | 234 | $item->_properties->dataBind(); |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | */ |
302 | 302 | protected function getEditViewControl() |
303 | 303 | { |
304 | - if(($id = $this->getEditViewID()) !== null) |
|
304 | + if(($id=$this->getEditViewID())!==null) |
|
305 | 305 | { |
306 | - $ctrl = $this->getParent()->findControl($id); |
|
307 | - if($ctrl === null) |
|
306 | + $ctrl=$this->getParent()->findControl($id); |
|
307 | + if($ctrl===null) |
|
308 | 308 | throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id); |
309 | 309 | return $ctrl; |
310 | 310 | } |
@@ -25,6 +25,7 @@ |
||
25 | 25 | /** |
26 | 26 | * Writes a string. |
27 | 27 | * @param string string to be written |
28 | + * @return void |
|
28 | 29 | */ |
29 | 30 | public function write($str); |
30 | 31 | /** |
@@ -35,6 +35,7 @@ |
||
35 | 35 | * Raises postdata changed event. |
36 | 36 | * The implementation of this function should raise appropriate event(s) (e.g. OnTextChanged) |
37 | 37 | * indicating the control data is changed. |
38 | + * @return void |
|
38 | 39 | */ |
39 | 40 | public function raisePostDataChangedEvent(); |
40 | 41 | /** |