@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * @var array list of locale => language file pairs. |
81 | 81 | */ |
82 | - private static $_langs = array( |
|
82 | + private static $_langs=array( |
|
83 | 83 | 'ar' => 'ar', |
84 | 84 | 'az' => 'az', |
85 | 85 | 'be' => 'be', |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * @var array list of default plugins to load, override using getAvailablePlugins(); |
166 | 166 | */ |
167 | - private static $_plugins = array( |
|
167 | + private static $_plugins=array( |
|
168 | 168 | 'advhr', |
169 | 169 | 'advimage', |
170 | 170 | 'advlink', |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | /** |
209 | 209 | * @var array default themes to load |
210 | 210 | */ |
211 | - private static $_themes = array( |
|
211 | + private static $_themes=array( |
|
212 | 212 | 'simple', |
213 | 213 | 'advanced' |
214 | 214 | ); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function getEnableVisualEdit() |
258 | 258 | { |
259 | - return $this->getViewState('EnableVisualEdit',true); |
|
259 | + return $this->getViewState('EnableVisualEdit', true); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public function setEnableVisualEdit($value) |
267 | 267 | { |
268 | - $this->setViewState('EnableVisualEdit',TPropertyValue::ensureBoolean($value),true); |
|
268 | + $this->setViewState('EnableVisualEdit', TPropertyValue::ensureBoolean($value), true); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | { |
349 | 349 | if($this->getEnableVisualEdit() && $this->getEnabled(true)) |
350 | 350 | { |
351 | - $writer->addAttribute('id',$this->getClientID()); |
|
351 | + $writer->addAttribute('id', $this->getClientID()); |
|
352 | 352 | $this->registerEditorClientScript($writer); |
353 | 353 | } |
354 | 354 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | protected function loadJavascriptLibrary() |
388 | 388 | { |
389 | - $scripts = $this->getPage()->getClientScript(); |
|
389 | + $scripts=$this->getPage()->getClientScript(); |
|
390 | 390 | $scripts->registerPradoScript('htmlarea'); |
391 | 391 | $scripts->registerScriptFile('prado:THtmlArea', $this->getScriptUrl()); |
392 | 392 | } |
@@ -397,16 +397,16 @@ discard block |
||
397 | 397 | protected function registerEditorClientScript($writer) |
398 | 398 | { |
399 | 399 | $this->loadJavascriptLibrary(); |
400 | - $scripts = $this->getPage()->getClientScript(); |
|
401 | - $options = array( |
|
400 | + $scripts=$this->getPage()->getClientScript(); |
|
401 | + $options=array( |
|
402 | 402 | 'EditorOptions' => $this->getEditorOptions() |
403 | 403 | ); |
404 | 404 | if($this->getEnableCompression()) |
405 | - $options['CompressionOptions'] = $this->getCompressionOptions(); |
|
405 | + $options['CompressionOptions']=$this->getCompressionOptions(); |
|
406 | 406 | |
407 | - $options = TJavaScript::encode($options,true,true); |
|
408 | - $script = "new {$this->getClientClassName()}($options)"; |
|
409 | - $scripts->registerEndScript('prado:THtmlArea'.$this->ClientID,$script); |
|
407 | + $options=TJavaScript::encode($options, true, true); |
|
408 | + $script="new {$this->getClientClassName()}($options)"; |
|
409 | + $scripts->registerEndScript('prado:THtmlArea'.$this->ClientID, $script); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
@@ -426,22 +426,22 @@ discard block |
||
426 | 426 | */ |
427 | 427 | protected function getScriptDeploymentPath() |
428 | 428 | { |
429 | - $tarfile = Prado::getPathOfNamespace('System.3rdParty.TinyMCE.tiny_mce', '.tar'); |
|
430 | - $md5sum = Prado::getPathOfNamespace('System.3rdParty.TinyMCE.tiny_mce', '.md5'); |
|
429 | + $tarfile=Prado::getPathOfNamespace('System.3rdParty.TinyMCE.tiny_mce', '.tar'); |
|
430 | + $md5sum=Prado::getPathOfNamespace('System.3rdParty.TinyMCE.tiny_mce', '.md5'); |
|
431 | 431 | if($tarfile===null || $md5sum===null) |
432 | 432 | throw new TConfigurationException('htmlarea_tarfile_invalid'); |
433 | - $url = $this->getApplication()->getAssetManager()->publishTarFile($tarfile, $md5sum); |
|
433 | + $url=$this->getApplication()->getAssetManager()->publishTarFile($tarfile, $md5sum); |
|
434 | 434 | $this->copyCustomPlugins($url); |
435 | 435 | return $url; |
436 | 436 | } |
437 | 437 | |
438 | 438 | protected function copyCustomPlugins($url) |
439 | 439 | { |
440 | - if($plugins = $this->getCustomPluginPath()) |
|
440 | + if($plugins=$this->getCustomPluginPath()) |
|
441 | 441 | { |
442 | - $assets = $this->getApplication()->getAssetManager(); |
|
443 | - $path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
444 | - $dest = $assets->getBasePath().'/'.basename($url).'/tiny_mce/plugins/'; |
|
442 | + $assets=$this->getApplication()->getAssetManager(); |
|
443 | + $path=is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
444 | + $dest=$assets->getBasePath().'/'.basename($url).'/tiny_mce/plugins/'; |
|
445 | 445 | if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
446 | 446 | $assets->copyDirectory($path, $dest); |
447 | 447 | } |
@@ -453,26 +453,26 @@ discard block |
||
453 | 453 | */ |
454 | 454 | protected function getEditorOptions() |
455 | 455 | { |
456 | - $options['mode'] = 'exact'; |
|
457 | - $options['elements'] = $this->getClientID(); |
|
458 | - $options['language'] = $this->getLanguageSuffix($this->getCulture()); |
|
459 | - $options['theme'] = 'advanced'; |
|
456 | + $options['mode']='exact'; |
|
457 | + $options['elements']=$this->getClientID(); |
|
458 | + $options['language']=$this->getLanguageSuffix($this->getCulture()); |
|
459 | + $options['theme']='advanced'; |
|
460 | 460 | |
461 | 461 | //make it basic advanced to fit into 1 line of buttons. |
462 | 462 | //$options['theme_advanced_buttons1'] = 'bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright, justifyfull,separator,bullist,numlist,separator,undo,redo,separator,link,unlink,separator,charmap,separator,code,help'; |
463 | 463 | //$options['theme_advanced_buttons2'] = ' '; |
464 | - $options['theme_advanced_buttons1'] = 'formatselect,fontselect,fontsizeselect,separator,bold,italic,underline,strikethrough,sub,sup'; |
|
465 | - $options['theme_advanced_buttons2'] = 'justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,outdent,indent,separator,forecolor,backcolor,separator,hr,link,unlink,image,charmap,separator,removeformat,code,help'; |
|
466 | - $options['theme_advanced_buttons3'] = ''; |
|
467 | - |
|
468 | - $options['theme_advanced_toolbar_location'] = 'top'; |
|
469 | - $options['theme_advanced_toolbar_align'] = 'left'; |
|
470 | - $options['theme_advanced_path_location'] = 'bottom'; |
|
471 | - $options['extended_valid_elements'] = 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
464 | + $options['theme_advanced_buttons1']='formatselect,fontselect,fontsizeselect,separator,bold,italic,underline,strikethrough,sub,sup'; |
|
465 | + $options['theme_advanced_buttons2']='justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,outdent,indent,separator,forecolor,backcolor,separator,hr,link,unlink,image,charmap,separator,removeformat,code,help'; |
|
466 | + $options['theme_advanced_buttons3']=''; |
|
467 | + |
|
468 | + $options['theme_advanced_toolbar_location']='top'; |
|
469 | + $options['theme_advanced_toolbar_align']='left'; |
|
470 | + $options['theme_advanced_path_location']='bottom'; |
|
471 | + $options['extended_valid_elements']='a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
472 | 472 | if($this->getReadOnly()) |
473 | - $options['readonly'] = true; |
|
473 | + $options['readonly']=true; |
|
474 | 474 | |
475 | - $options = array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
475 | + $options=array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
476 | 476 | return $options; |
477 | 477 | } |
478 | 478 | |
@@ -482,20 +482,20 @@ discard block |
||
482 | 482 | */ |
483 | 483 | protected function parseEditorOptions($string) |
484 | 484 | { |
485 | - $options = array(); |
|
486 | - $substrings = preg_split('/,\s*\n|\n/', trim($string)); |
|
485 | + $options=array(); |
|
486 | + $substrings=preg_split('/,\s*\n|\n/', trim($string)); |
|
487 | 487 | foreach($substrings as $bits) |
488 | 488 | { |
489 | - $option = explode(":",$bits,2); |
|
489 | + $option=explode(":", $bits, 2); |
|
490 | 490 | |
491 | - if(count($option) == 2) |
|
491 | + if(count($option)==2) |
|
492 | 492 | { |
493 | - $value=trim(trim($option[1]),"'\""); |
|
494 | - if (($s=strtolower($value))==='false') |
|
493 | + $value=trim(trim($option[1]), "'\""); |
|
494 | + if(($s=strtolower($value))==='false') |
|
495 | 495 | $value=false; |
496 | - elseif ($s==='true') |
|
496 | + elseif($s==='true') |
|
497 | 497 | $value=true; |
498 | - $options[trim($option[0])] = $value; |
|
498 | + $options[trim($option[0])]=$value; |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | return $options; |
@@ -506,12 +506,12 @@ discard block |
||
506 | 506 | */ |
507 | 507 | protected function getLanguageSuffix($culture) |
508 | 508 | { |
509 | - $app = $this->getApplication()->getGlobalization(); |
|
509 | + $app=$this->getApplication()->getGlobalization(); |
|
510 | 510 | if(empty($culture) && ($app!==null)) |
511 | - $culture = $app->getCulture(); |
|
512 | - $variants = array(); |
|
511 | + $culture=$app->getCulture(); |
|
512 | + $variants=array(); |
|
513 | 513 | if($app!==null) |
514 | - $variants = $app->getCultureVariants($culture); |
|
514 | + $variants=$app->getCultureVariants($culture); |
|
515 | 515 | |
516 | 516 | foreach($variants as $variant) |
517 | 517 | { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function getButtonTag() |
62 | 62 | { |
63 | - return $this->getViewState('ButtonTag',TButtonTag::Input); |
|
63 | + return $this->getViewState('ButtonTag', TButtonTag::Input); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function setButtonTag($value) |
70 | 70 | { |
71 | - $this->setViewState('ButtonTag',TPropertyValue::ensureEnum($value,'TButtonTag'),TButtonTag::Input); |
|
71 | + $this->setViewState('ButtonTag', TPropertyValue::ensureEnum($value, 'TButtonTag'), TButtonTag::Input); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getEnableClientScript() |
78 | 78 | { |
79 | - return $this->getViewState('EnableClientScript',true); |
|
79 | + return $this->getViewState('EnableClientScript', true); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function setEnableClientScript($value) |
86 | 86 | { |
87 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
87 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -96,20 +96,20 @@ discard block |
||
96 | 96 | { |
97 | 97 | $page=$this->getPage(); |
98 | 98 | $page->ensureRenderInForm($this); |
99 | - $writer->addAttribute('type',strtolower($this->getButtonType())); |
|
99 | + $writer->addAttribute('type', strtolower($this->getButtonType())); |
|
100 | 100 | if(($uniqueID=$this->getUniqueID())!=='') |
101 | - $writer->addAttribute('name',$uniqueID); |
|
101 | + $writer->addAttribute('name', $uniqueID); |
|
102 | 102 | if($this->getButtonTag()===TButtonTag::Button) |
103 | 103 | $this->addParsedObject($this->getText()); |
104 | 104 | else |
105 | - $writer->addAttribute('value',$this->getText()); |
|
105 | + $writer->addAttribute('value', $this->getText()); |
|
106 | 106 | if($this->getEnabled(true)) |
107 | 107 | { |
108 | 108 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
109 | 109 | $this->renderClientControlScript($writer); |
110 | 110 | } |
111 | 111 | else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
112 | - $writer->addAttribute('disabled','disabled'); |
|
112 | + $writer->addAttribute('disabled', 'disabled'); |
|
113 | 113 | |
114 | 114 | parent::addAttributesToRender($writer); |
115 | 115 | } |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | */ |
120 | 120 | protected function renderClientControlScript($writer) |
121 | 121 | { |
122 | - $writer->addAttribute('id',$this->getClientID()); |
|
123 | - $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
122 | + $writer->addAttribute('id', $this->getClientID()); |
|
123 | + $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if($this->getCausesValidation()) |
142 | 142 | { |
143 | 143 | $group=$this->getValidationGroup(); |
144 | - return $this->getPage()->getValidators($group)->getCount()>0; |
|
144 | + return $this->getPage()->getValidators($group)->getCount() > 0; |
|
145 | 145 | } |
146 | 146 | else |
147 | 147 | return false; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function setIsDefaultButton($value) |
154 | 154 | { |
155 | - $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false); |
|
155 | + $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | { |
183 | 183 | $options['ID']=$this->getClientID(); |
184 | 184 | $options['CausesValidation']=$this->getCausesValidation(); |
185 | - $options['EventTarget'] = $this->getUniqueID(); |
|
185 | + $options['EventTarget']=$this->getUniqueID(); |
|
186 | 186 | $options['ValidationGroup']=$this->getValidationGroup(); |
187 | 187 | |
188 | 188 | return $options; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function onClick($param) |
211 | 211 | { |
212 | - $this->raiseEvent('OnClick',$this,$param); |
|
212 | + $this->raiseEvent('OnClick', $this, $param); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function onCommand($param) |
223 | 223 | { |
224 | - $this->raiseEvent('OnCommand',$this,$param); |
|
225 | - $this->raiseBubbleEvent($this,$param); |
|
224 | + $this->raiseEvent('OnCommand', $this, $param); |
|
225 | + $this->raiseBubbleEvent($this, $param); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | if($this->getCausesValidation()) |
240 | 240 | $this->getPage()->validate($this->getValidationGroup()); |
241 | 241 | $this->onClick(null); |
242 | - $this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
|
242 | + $this->onCommand(new TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getText() |
249 | 249 | { |
250 | - return $this->getViewState('Text',''); |
|
250 | + return $this->getViewState('Text', ''); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function setText($value) |
257 | 257 | { |
258 | - $this->setViewState('Text',$value,''); |
|
258 | + $this->setViewState('Text', $value, ''); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function getCausesValidation() |
291 | 291 | { |
292 | - return $this->getViewState('CausesValidation',true); |
|
292 | + return $this->getViewState('CausesValidation', true); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public function setCausesValidation($value) |
299 | 299 | { |
300 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
300 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function getCommandName() |
307 | 307 | { |
308 | - return $this->getViewState('CommandName',''); |
|
308 | + return $this->getViewState('CommandName', ''); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function setCommandName($value) |
315 | 315 | { |
316 | - $this->setViewState('CommandName',$value,''); |
|
316 | + $this->setViewState('CommandName', $value, ''); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function getCommandParameter() |
323 | 323 | { |
324 | - return $this->getViewState('CommandParameter',''); |
|
324 | + return $this->getViewState('CommandParameter', ''); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | public function setCommandParameter($value) |
331 | 331 | { |
332 | - $this->setViewState('CommandParameter',$value,''); |
|
332 | + $this->setViewState('CommandParameter', $value, ''); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function getValidationGroup() |
339 | 339 | { |
340 | - return $this->getViewState('ValidationGroup',''); |
|
340 | + return $this->getViewState('ValidationGroup', ''); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function setValidationGroup($value) |
347 | 347 | { |
348 | - $this->setViewState('ValidationGroup',$value,''); |
|
348 | + $this->setViewState('ValidationGroup', $value, ''); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function getButtonType() |
355 | 355 | { |
356 | - return $this->getViewState('ButtonType',TButtonType::Submit); |
|
356 | + return $this->getViewState('ButtonType', TButtonType::Submit); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public function setButtonType($value) |
363 | 363 | { |
364 | - $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TButtonType'),TButtonType::Submit); |
|
364 | + $this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'TButtonType'), TButtonType::Submit); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getItemRenderer() |
55 | 55 | { |
56 | - return $this->getViewState('ItemRenderer',''); |
|
56 | + return $this->getViewState('ItemRenderer', ''); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function setItemRenderer($value) |
71 | 71 | { |
72 | - $this->setViewState('ItemRenderer',$value,''); |
|
72 | + $this->setViewState('ItemRenderer', $value, ''); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getEditItemRenderer() |
80 | 80 | { |
81 | - return $this->getViewState('EditItemRenderer',''); |
|
81 | + return $this->getViewState('EditItemRenderer', ''); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function setEditItemRenderer($value) |
96 | 96 | { |
97 | - $this->setViewState('EditItemRenderer',$value,''); |
|
97 | + $this->setViewState('EditItemRenderer', $value, ''); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | if($value instanceof ITemplate || $value===null) |
115 | 115 | $this->_editItemTemplate=$value; |
116 | 116 | else |
117 | - throw new TInvalidDataTypeException('templatecolumn_template_required','EditItemTemplate'); |
|
117 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'EditItemTemplate'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | if($value instanceof ITemplate || $value===null) |
135 | 135 | $this->_itemTemplate=$value; |
136 | 136 | else |
137 | - throw new TInvalidDataTypeException('templatecolumn_template_required','ItemTemplate'); |
|
137 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'ItemTemplate'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if($value instanceof ITemplate || $value===null) |
155 | 155 | $this->_headerTemplate=$value; |
156 | 156 | else |
157 | - throw new TInvalidDataTypeException('templatecolumn_template_required','HeaderTemplate'); |
|
157 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'HeaderTemplate'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | if($value instanceof ITemplate || $value===null) |
175 | 175 | $this->_footerTemplate=$value; |
176 | 176 | else |
177 | - throw new TInvalidDataTypeException('templatecolumn_template_required','FooterTemplate'); |
|
177 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'FooterTemplate'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param integer the index to the Columns property that the cell resides in. |
187 | 187 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
188 | 188 | */ |
189 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
189 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
190 | 190 | { |
191 | 191 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem) |
192 | 192 | { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $control->setItemType($itemType); |
214 | 214 | } |
215 | 215 | if($control instanceof IDataRenderer) |
216 | - $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
216 | + $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
217 | 217 | } |
218 | 218 | else if($template!==null) |
219 | 219 | $template->instantiateIn($cell); |
@@ -223,20 +223,20 @@ discard block |
||
223 | 223 | else if($itemType===TListItemType::Header) |
224 | 224 | { |
225 | 225 | if(($classPath=$this->getHeaderRenderer())!=='') |
226 | - $this->initializeHeaderCell($cell,$columnIndex); |
|
226 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
227 | 227 | else if($this->_headerTemplate!==null) |
228 | 228 | $this->_headerTemplate->instantiateIn($cell); |
229 | 229 | else |
230 | - $this->initializeHeaderCell($cell,$columnIndex); |
|
230 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
231 | 231 | } |
232 | 232 | else if($itemType===TListItemType::Footer) |
233 | 233 | { |
234 | 234 | if(($classPath=$this->getFooterRenderer())!=='') |
235 | - $this->initializeFooterCell($cell,$columnIndex); |
|
235 | + $this->initializeFooterCell($cell, $columnIndex); |
|
236 | 236 | else if($this->_footerTemplate!==null) |
237 | 237 | $this->_footerTemplate->instantiateIn($cell); |
238 | 238 | else |
239 | - $this->initializeFooterCell($cell,$columnIndex); |
|
239 | + $this->initializeFooterCell($cell, $columnIndex); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * This method is invoked when datagrid performs databinding. |
246 | 246 | * It populates the content of the cell with the relevant data from data source. |
247 | 247 | */ |
248 | - public function dataBindColumn($sender,$param) |
|
248 | + public function dataBindColumn($sender, $param) |
|
249 | 249 | { |
250 | 250 | $item=$sender->getNamingContainer(); |
251 | 251 | $sender->setData($item->getData()); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function getInitialValue() |
53 | 53 | { |
54 | - return $this->getViewState('InitialValue',$this->getControlPromptValue()); |
|
54 | + return $this->getViewState('InitialValue', $this->getControlPromptValue()); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function getControlPromptValue() |
63 | 63 | { |
64 | - $control = $this->getValidationTarget(); |
|
64 | + $control=$this->getValidationTarget(); |
|
65 | 65 | if($control instanceof TListControl) |
66 | 66 | return $control->getPromptValue(); |
67 | 67 | return ''; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function setInitialValue($value) |
75 | 75 | { |
76 | - $this->setViewState('InitialValue',TPropertyValue::ensureString($value),''); |
|
76 | + $this->setViewState('InitialValue', TPropertyValue::ensureString($value), ''); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function evaluateIsValid() |
91 | 91 | { |
92 | - $control = $this->getValidationTarget(); |
|
92 | + $control=$this->getValidationTarget(); |
|
93 | 93 | if($control instanceof TListControl) |
94 | 94 | return $this->validateListControl($control); |
95 | 95 | else if($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | |
101 | 101 | private function validateListControl($control) |
102 | 102 | { |
103 | - $initial = trim($this->getInitialValue()); |
|
104 | - $count = 0; |
|
103 | + $initial=trim($this->getInitialValue()); |
|
104 | + $count=0; |
|
105 | 105 | foreach($control->getItems() as $item) |
106 | 106 | { |
107 | - if($item->getSelected() && $item->getValue() != $initial) |
|
107 | + if($item->getSelected() && $item->getValue()!=$initial) |
|
108 | 108 | $count++; |
109 | 109 | } |
110 | 110 | return $count > 0; |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | |
113 | 113 | private function validateRadioButtonGroup($control) |
114 | 114 | { |
115 | - $initial = trim($this->getInitialValue()); |
|
115 | + $initial=trim($this->getInitialValue()); |
|
116 | 116 | foreach($control->getRadioButtonsInGroup() as $radio) |
117 | 117 | { |
118 | 118 | if($radio->getChecked()) |
119 | 119 | { |
120 | - if(strlen($value = $radio->getValue()) > 0) |
|
121 | - return $value !== $initial; |
|
120 | + if(strlen($value=$radio->getValue()) > 0) |
|
121 | + return $value!==$initial; |
|
122 | 122 | else |
123 | 123 | return true; |
124 | 124 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | private function validateStandardControl($control) |
130 | 130 | { |
131 | - $initial = trim($this->getInitialValue()); |
|
131 | + $initial=trim($this->getInitialValue()); |
|
132 | 132 | $value=$this->getValidationValue($control); |
133 | 133 | return (is_bool($value) && $value) || trim($value)!==$initial; |
134 | 134 | } |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function getClientScriptOptions() |
141 | 141 | { |
142 | - $options = parent::getClientScriptOptions(); |
|
142 | + $options=parent::getClientScriptOptions(); |
|
143 | 143 | $options['InitialValue']=$this->getInitialValue(); |
144 | - $control = $this->getValidationTarget(); |
|
144 | + $control=$this->getValidationTarget(); |
|
145 | 145 | if($control instanceof TListControl) |
146 | - $options['TotalItems'] = $control->getItemCount(); |
|
146 | + $options['TotalItems']=$control->getItemCount(); |
|
147 | 147 | if($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
148 | - $options['GroupName'] = $control->getGroupName(); |
|
148 | + $options['GroupName']=$control->getGroupName(); |
|
149 | 149 | return $options; |
150 | 150 | } |
151 | 151 | } |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | */ |
37 | 37 | class TXmlTransform extends TControl { |
38 | 38 | |
39 | - const EXT_XML_FILE = '.xml'; |
|
40 | - const EXT_XSL_FILE = '.xsl'; |
|
39 | + const EXT_XML_FILE='.xml'; |
|
40 | + const EXT_XSL_FILE='.xsl'; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Constructor |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function setTransformPath($value) { |
65 | 65 | if(!is_file($value)) { |
66 | - $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | - if($value === null) { |
|
66 | + $value=Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | + if($value===null) { |
|
68 | 68 | throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value); |
69 | 69 | } |
70 | 70 | } |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function setDocumentPath($value) { |
100 | 100 | if(!is_file($value)) { |
101 | - $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | - if($value === null) { |
|
101 | + $value=Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | + if($value===null) { |
|
103 | 103 | throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value); |
104 | 104 | } |
105 | 105 | } |
@@ -125,22 +125,22 @@ discard block |
||
125 | 125 | * @return TAttributeCollection the list of custom parameters |
126 | 126 | */ |
127 | 127 | public function getParameters() { |
128 | - if($params = $this->getViewState('Parameters',null)) { |
|
128 | + if($params=$this->getViewState('Parameters', null)) { |
|
129 | 129 | return $params; |
130 | 130 | } else { |
131 | - $params = new TAttributeCollection(); |
|
131 | + $params=new TAttributeCollection(); |
|
132 | 132 | $this->setViewState('Parameters', $params, null); |
133 | 133 | return $params; |
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | 137 | private function getTransformXmlDocument() { |
138 | - if(($content = $this->getTransformContent()) !== '') { |
|
139 | - $document = new DOMDocument(); |
|
138 | + if(($content=$this->getTransformContent())!=='') { |
|
139 | + $document=new DOMDocument(); |
|
140 | 140 | $document->loadXML($content); |
141 | 141 | return $document; |
142 | - } else if(($path = $this->getTransformPath()) !== '') { |
|
143 | - $document = new DOMDocument(); |
|
142 | + } else if(($path=$this->getTransformPath())!=='') { |
|
143 | + $document=new DOMDocument(); |
|
144 | 144 | $document->load($path); |
145 | 145 | return $document; |
146 | 146 | } else { |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | private function getSourceXmlDocument() { |
152 | - if(($content = $this->getDocumentContent()) !== '') { |
|
153 | - $document = new DOMDocument(); |
|
152 | + if(($content=$this->getDocumentContent())!=='') { |
|
153 | + $document=new DOMDocument(); |
|
154 | 154 | $document->loadXML($content); |
155 | 155 | return $document; |
156 | - } else if(($path = $this->getDocumentPath()) !== '') { |
|
157 | - $document = new DOMDocument(); |
|
156 | + } else if(($path=$this->getDocumentPath())!=='') { |
|
157 | + $document=new DOMDocument(); |
|
158 | 158 | $document->load($path); |
159 | 159 | return $document; |
160 | 160 | } else { |
@@ -167,24 +167,24 @@ discard block |
||
167 | 167 | * @param THtmlWriter The writer used for the rendering purpose |
168 | 168 | */ |
169 | 169 | public function render($writer) { |
170 | - if(($document=$this->getSourceXmlDocument()) === null) { |
|
171 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
170 | + if(($document=$this->getSourceXmlDocument())===null) { |
|
171 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
172 | 172 | parent::render($htmlWriter); |
173 | - $document = new DOMDocument(); |
|
173 | + $document=new DOMDocument(); |
|
174 | 174 | $document->loadXML($htmlWriter->flush()); |
175 | 175 | } |
176 | - $stylesheet = $this->getTransformXmlDocument(); |
|
176 | + $stylesheet=$this->getTransformXmlDocument(); |
|
177 | 177 | |
178 | 178 | // Perform XSL transformation |
179 | - $xslt = new XSLTProcessor(); |
|
179 | + $xslt=new XSLTProcessor(); |
|
180 | 180 | $xslt->importStyleSheet($stylesheet); |
181 | 181 | |
182 | 182 | // Check for parameters |
183 | - $parameters = $this->getParameters(); |
|
183 | + $parameters=$this->getParameters(); |
|
184 | 184 | foreach($parameters as $name => $value) { |
185 | 185 | $xslt->setParameter('', $name, $value); |
186 | 186 | } |
187 | - $output = $xslt->transformToXML($document); |
|
187 | + $output=$xslt->transformToXML($document); |
|
188 | 188 | |
189 | 189 | // Write output |
190 | 190 | $writer->write($output); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param array the input data collection |
59 | 59 | * @return boolean whether the data of the control has been changed |
60 | 60 | */ |
61 | - public function loadPostData($key,$values) |
|
61 | + public function loadPostData($key, $values) |
|
62 | 62 | { |
63 | 63 | $checked=$this->getChecked(); |
64 | 64 | if($newChecked=isset($values[$key])) |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function onCheckedChanged($param) |
89 | 89 | { |
90 | - $this->raiseEvent('OnCheckedChanged',$this,$param); |
|
90 | + $this->raiseEvent('OnCheckedChanged', $this, $param); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function getText() |
148 | 148 | { |
149 | - return $this->getViewState('Text',''); |
|
149 | + return $this->getViewState('Text', ''); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function setText($value) |
157 | 157 | { |
158 | - $this->setViewState('Text',$value,''); |
|
158 | + $this->setViewState('Text', $value, ''); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function getValue() |
165 | 165 | { |
166 | - return $this->getViewState('Value',''); |
|
166 | + return $this->getViewState('Value', ''); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function setValue($value) |
173 | 173 | { |
174 | - $this->setViewState('Value',TPropertyValue::ensureString($value),''); |
|
174 | + $this->setViewState('Value', TPropertyValue::ensureString($value), ''); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function getTextAlign() |
181 | 181 | { |
182 | - return $this->getViewState('TextAlign',TTextAlign::Right); |
|
182 | + return $this->getViewState('TextAlign', TTextAlign::Right); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function setTextAlign($value) |
189 | 189 | { |
190 | - $this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,'TTextAlign'),TTextAlign::Right); |
|
190 | + $this->setViewState('TextAlign', TPropertyValue::ensureEnum($value, 'TTextAlign'), TTextAlign::Right); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function getChecked() |
197 | 197 | { |
198 | - return $this->getViewState('Checked',false); |
|
198 | + return $this->getViewState('Checked', false); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function setChecked($value) |
206 | 206 | { |
207 | - $this->setViewState('Checked',TPropertyValue::ensureBoolean($value),false); |
|
207 | + $this->setViewState('Checked', TPropertyValue::ensureBoolean($value), false); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function getAutoPostBack() |
240 | 240 | { |
241 | - return $this->getViewState('AutoPostBack',false); |
|
241 | + return $this->getViewState('AutoPostBack', false); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function setAutoPostBack($value) |
249 | 249 | { |
250 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false); |
|
250 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function getCausesValidation() |
257 | 257 | { |
258 | - return $this->getViewState('CausesValidation',true); |
|
258 | + return $this->getViewState('CausesValidation', true); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function setCausesValidation($value) |
266 | 266 | { |
267 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
267 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function getValidationGroup() |
274 | 274 | { |
275 | - return $this->getViewState('ValidationGroup',''); |
|
275 | + return $this->getViewState('ValidationGroup', ''); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public function setValidationGroup($value) |
282 | 282 | { |
283 | - $this->setViewState('ValidationGroup',$value,''); |
|
283 | + $this->setViewState('ValidationGroup', $value, ''); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | if($this->getHasStyle()) |
312 | 312 | $this->getStyle()->addAttributesToRender($writer); |
313 | 313 | if(($tooltip=$this->getToolTip())!=='') |
314 | - $writer->addAttribute('title',$tooltip); |
|
314 | + $writer->addAttribute('title', $tooltip); |
|
315 | 315 | if($this->getHasAttributes()) |
316 | 316 | { |
317 | 317 | $attributes=$this->getAttributes(); |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | if($attributes->getCount()) |
323 | 323 | $writer->addAttributes($attributes); |
324 | 324 | if($value!==null) |
325 | - $attributes->add('value',$value); |
|
325 | + $attributes->add('value', $value); |
|
326 | 326 | } |
327 | 327 | else |
328 | 328 | $onclick=''; |
329 | 329 | if($needspan=$this->getSpanNeeded()) |
330 | 330 | { |
331 | - $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
331 | + $writer->addAttribute('id', $this->getSurroundingTagID()); |
|
332 | 332 | $writer->renderBeginTag($this->getSurroundingTag()); |
333 | 333 | } |
334 | 334 | $clientID=$this->getClientID(); |
@@ -336,17 +336,17 @@ discard block |
||
336 | 336 | { |
337 | 337 | if($this->getTextAlign()===TTextAlign::Left) |
338 | 338 | { |
339 | - $this->renderLabel($writer,$clientID,$text); |
|
340 | - $this->renderInputTag($writer,$clientID,$onclick); |
|
339 | + $this->renderLabel($writer, $clientID, $text); |
|
340 | + $this->renderInputTag($writer, $clientID, $onclick); |
|
341 | 341 | } |
342 | 342 | else |
343 | 343 | { |
344 | - $this->renderInputTag($writer,$clientID,$onclick); |
|
345 | - $this->renderLabel($writer,$clientID,$text); |
|
344 | + $this->renderInputTag($writer, $clientID, $onclick); |
|
345 | + $this->renderLabel($writer, $clientID, $text); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | else |
349 | - $this->renderInputTag($writer,$clientID,$onclick); |
|
349 | + $this->renderInputTag($writer, $clientID, $onclick); |
|
350 | 350 | if($needspan) |
351 | 351 | $writer->renderEndTag(); |
352 | 352 | } |
@@ -356,12 +356,12 @@ discard block |
||
356 | 356 | */ |
357 | 357 | public function getLabelAttributes() |
358 | 358 | { |
359 | - if($attributes=$this->getViewState('LabelAttributes',null)) |
|
359 | + if($attributes=$this->getViewState('LabelAttributes', null)) |
|
360 | 360 | return $attributes; |
361 | 361 | else |
362 | 362 | { |
363 | 363 | $attributes=new TAttributeCollection; |
364 | - $this->setViewState('LabelAttributes',$attributes,null); |
|
364 | + $this->setViewState('LabelAttributes', $attributes, null); |
|
365 | 365 | return $attributes; |
366 | 366 | } |
367 | 367 | } |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function getInputAttributes() |
373 | 373 | { |
374 | - if($attributes=$this->getViewState('InputAttributes',null)) |
|
374 | + if($attributes=$this->getViewState('InputAttributes', null)) |
|
375 | 375 | return $attributes; |
376 | 376 | else |
377 | 377 | { |
378 | 378 | $attributes=new TAttributeCollection; |
379 | - $this->setViewState('InputAttributes',$attributes,null); |
|
379 | + $this->setViewState('InputAttributes', $attributes, null); |
|
380 | 380 | return $attributes; |
381 | 381 | } |
382 | 382 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | return $value; |
391 | 391 | else |
392 | 392 | { |
393 | - $attributes=$this->getViewState('InputAttributes',null); |
|
393 | + $attributes=$this->getViewState('InputAttributes', null); |
|
394 | 394 | if($attributes && $attributes->contains('value')) |
395 | 395 | return $attributes->itemAt('value'); |
396 | 396 | else if($this->hasAttribute('value')) |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | public function getEnableClientScript() |
407 | 407 | { |
408 | - return $this->getViewState('EnableClientScript',true); |
|
408 | + return $this->getViewState('EnableClientScript', true); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | */ |
414 | 414 | public function setEnableClientScript($value) |
415 | 415 | { |
416 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
416 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | /** |
@@ -432,10 +432,10 @@ discard block |
||
432 | 432 | * @param string checkbox id |
433 | 433 | * @param string label text |
434 | 434 | */ |
435 | - protected function renderLabel($writer,$clientID,$text) |
|
435 | + protected function renderLabel($writer, $clientID, $text) |
|
436 | 436 | { |
437 | - $writer->addAttribute('for',$clientID); |
|
438 | - if($attributes=$this->getViewState('LabelAttributes',null)) |
|
437 | + $writer->addAttribute('for', $clientID); |
|
438 | + if($attributes=$this->getViewState('LabelAttributes', null)) |
|
439 | 439 | $writer->addAttributes($attributes); |
440 | 440 | $writer->renderBeginTag('label'); |
441 | 441 | $writer->write($text); |
@@ -448,21 +448,21 @@ discard block |
||
448 | 448 | * @param string checkbox id |
449 | 449 | * @param string onclick js |
450 | 450 | */ |
451 | - protected function renderInputTag($writer,$clientID,$onclick) |
|
451 | + protected function renderInputTag($writer, $clientID, $onclick) |
|
452 | 452 | { |
453 | 453 | if($clientID!=='') |
454 | - $writer->addAttribute('id',$clientID); |
|
455 | - $writer->addAttribute('type','checkbox'); |
|
454 | + $writer->addAttribute('id', $clientID); |
|
455 | + $writer->addAttribute('type', 'checkbox'); |
|
456 | 456 | if(($value=$this->getValueAttribute())!=='') |
457 | - $writer->addAttribute('value',$value); |
|
457 | + $writer->addAttribute('value', $value); |
|
458 | 458 | if(!empty($onclick)) |
459 | - $writer->addAttribute('onclick',$onclick); |
|
459 | + $writer->addAttribute('onclick', $onclick); |
|
460 | 460 | if(($uniqueID=$this->getUniqueID())!=='') |
461 | - $writer->addAttribute('name',$uniqueID); |
|
461 | + $writer->addAttribute('name', $uniqueID); |
|
462 | 462 | if($this->getChecked()) |
463 | - $writer->addAttribute('checked','checked'); |
|
463 | + $writer->addAttribute('checked', 'checked'); |
|
464 | 464 | if(!$this->getEnabled(true)) |
465 | - $writer->addAttribute('disabled','disabled'); |
|
465 | + $writer->addAttribute('disabled', 'disabled'); |
|
466 | 466 | |
467 | 467 | $page=$this->getPage(); |
468 | 468 | if($this->getEnabled(true) |
@@ -474,10 +474,10 @@ discard block |
||
474 | 474 | } |
475 | 475 | |
476 | 476 | if(($accesskey=$this->getAccessKey())!=='') |
477 | - $writer->addAttribute('accesskey',$accesskey); |
|
478 | - if(($tabindex=$this->getTabIndex())>0) |
|
479 | - $writer->addAttribute('tabindex',"$tabindex"); |
|
480 | - if($attributes=$this->getViewState('InputAttributes',null)) |
|
477 | + $writer->addAttribute('accesskey', $accesskey); |
|
478 | + if(($tabindex=$this->getTabIndex()) > 0) |
|
479 | + $writer->addAttribute('tabindex', "$tabindex"); |
|
480 | + if($attributes=$this->getViewState('InputAttributes', null)) |
|
481 | 481 | $writer->addAttributes($attributes); |
482 | 482 | $writer->renderBeginTag('input'); |
483 | 483 | $writer->renderEndTag(); |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | */ |
489 | 489 | protected function renderClientControlScript($writer) |
490 | 490 | { |
491 | - $cs = $this->getPage()->getClientScript(); |
|
492 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
491 | + $cs=$this->getPage()->getClientScript(); |
|
492 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
@@ -508,10 +508,10 @@ discard block |
||
508 | 508 | */ |
509 | 509 | protected function getPostBackOptions() |
510 | 510 | { |
511 | - $options['ID'] = $this->getClientID(); |
|
512 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
513 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
514 | - $options['EventTarget'] = $this->getUniqueID(); |
|
511 | + $options['ID']=$this->getClientID(); |
|
512 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
513 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
514 | + $options['EventTarget']=$this->getUniqueID(); |
|
515 | 515 | return $options; |
516 | 516 | } |
517 | 517 | } |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | protected function __getZappableSleepProps(&$exprops) |
55 | 55 | { |
56 | 56 | parent::__getZappableSleepProps($exprops); |
57 | - if ($this->_backImageUrl===null) |
|
58 | - $exprops[] = "\0TPanelStyle\0_backImageUrl"; |
|
59 | - if ($this->_direction===null) |
|
60 | - $exprops[] = "\0TPanelStyle\0_direction"; |
|
61 | - if ($this->_horizontalAlign===null) |
|
62 | - $exprops[] = "\0TPanelStyle\0_horizontalAlign"; |
|
63 | - if ($this->_scrollBars===null) |
|
64 | - $exprops[] = "\0TPanelStyle\0_scrollBars"; |
|
65 | - if ($this->_wrap===null) |
|
66 | - $exprops[] = "\0TPanelStyle\0_wrap"; |
|
57 | + if($this->_backImageUrl===null) |
|
58 | + $exprops[]="\0TPanelStyle\0_backImageUrl"; |
|
59 | + if($this->_direction===null) |
|
60 | + $exprops[]="\0TPanelStyle\0_direction"; |
|
61 | + if($this->_horizontalAlign===null) |
|
62 | + $exprops[]="\0TPanelStyle\0_horizontalAlign"; |
|
63 | + if($this->_scrollBars===null) |
|
64 | + $exprops[]="\0TPanelStyle\0_scrollBars"; |
|
65 | + if($this->_wrap===null) |
|
66 | + $exprops[]="\0TPanelStyle\0_wrap"; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -74,28 +74,28 @@ discard block |
||
74 | 74 | public function addAttributesToRender($writer) |
75 | 75 | { |
76 | 76 | if(($url=trim($this->getBackImageUrl()))!=='') |
77 | - $this->setStyleField('background-image','url('.$url.')'); |
|
77 | + $this->setStyleField('background-image', 'url('.$url.')'); |
|
78 | 78 | |
79 | 79 | switch($this->getScrollBars()) |
80 | 80 | { |
81 | - case TScrollBars::Horizontal: $this->setStyleField('overflow-x','scroll'); break; |
|
82 | - case TScrollBars::Vertical: $this->setStyleField('overflow-y','scroll'); break; |
|
83 | - case TScrollBars::Both: $this->setStyleField('overflow','scroll'); break; |
|
84 | - case TScrollBars::Auto: $this->setStyleField('overflow','auto'); break; |
|
81 | + case TScrollBars::Horizontal: $this->setStyleField('overflow-x', 'scroll'); break; |
|
82 | + case TScrollBars::Vertical: $this->setStyleField('overflow-y', 'scroll'); break; |
|
83 | + case TScrollBars::Both: $this->setStyleField('overflow', 'scroll'); break; |
|
84 | + case TScrollBars::Auto: $this->setStyleField('overflow', 'auto'); break; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | if(($align=$this->getHorizontalAlign())!==THorizontalAlign::NotSet) |
88 | - $this->setStyleField('text-align',strtolower($align)); |
|
88 | + $this->setStyleField('text-align', strtolower($align)); |
|
89 | 89 | |
90 | 90 | if(!$this->getWrap()) |
91 | - $this->setStyleField('white-space','nowrap'); |
|
91 | + $this->setStyleField('white-space', 'nowrap'); |
|
92 | 92 | |
93 | 93 | if(($direction=$this->getDirection())!==TContentDirection::NotSet) |
94 | 94 | { |
95 | 95 | if($direction===TContentDirection::LeftToRight) |
96 | - $this->setStyleField('direction','ltr'); |
|
96 | + $this->setStyleField('direction', 'ltr'); |
|
97 | 97 | else |
98 | - $this->setStyleField('direction','rtl'); |
|
98 | + $this->setStyleField('direction', 'rtl'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | parent::addAttributesToRender($writer); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getBackImageUrl() |
108 | 108 | { |
109 | - return $this->_backImageUrl===null?'':$this->_backImageUrl; |
|
109 | + return $this->_backImageUrl===null ? '' : $this->_backImageUrl; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function getDirection() |
125 | 125 | { |
126 | - return $this->_direction===null?TContentDirection::NotSet:$this->_direction; |
|
126 | + return $this->_direction===null ? TContentDirection::NotSet : $this->_direction; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function setDirection($value) |
133 | 133 | { |
134 | - $this->_direction=TPropertyValue::ensureEnum($value,'TContentDirection'); |
|
134 | + $this->_direction=TPropertyValue::ensureEnum($value, 'TContentDirection'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function getWrap() |
141 | 141 | { |
142 | - return $this->_wrap===null?true:$this->_wrap; |
|
142 | + return $this->_wrap===null ? true : $this->_wrap; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function getHorizontalAlign() |
158 | 158 | { |
159 | - return $this->_horizontalAlign===null?THorizontalAlign::NotSet:$this->_horizontalAlign; |
|
159 | + return $this->_horizontalAlign===null ? THorizontalAlign::NotSet : $this->_horizontalAlign; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function setHorizontalAlign($value) |
167 | 167 | { |
168 | - $this->_horizontalAlign=TPropertyValue::ensureEnum($value,'THorizontalAlign'); |
|
168 | + $this->_horizontalAlign=TPropertyValue::ensureEnum($value, 'THorizontalAlign'); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function getScrollBars() |
175 | 175 | { |
176 | - return $this->_scrollBars===null?TScrollBars::None:$this->_scrollBars; |
|
176 | + return $this->_scrollBars===null ? TScrollBars::None : $this->_scrollBars; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function setScrollBars($value) |
183 | 183 | { |
184 | - $this->_scrollBars=TPropertyValue::ensureEnum($value,'TScrollBars'); |
|
184 | + $this->_scrollBars=TPropertyValue::ensureEnum($value, 'TScrollBars'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function getRegularExpression() |
51 | 51 | { |
52 | 52 | $regex=parent::getRegularExpression(); |
53 | - return $regex===''?self::EMAIL_REGEXP:$regex; |
|
53 | + return $regex==='' ? self::EMAIL_REGEXP : $regex; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | public function evaluateIsValid() |
61 | 61 | { |
62 | 62 | $value=$this->getValidationValue($this->getValidationTarget()); |
63 | - $valid=$valid=is_string($value) && strlen($value)<=254 && parent::evaluateIsValid(); |
|
63 | + $valid=$valid=is_string($value) && strlen($value) <= 254 && parent::evaluateIsValid(); |
|
64 | 64 | |
65 | 65 | if($valid && $this->getCheckMXRecord() && function_exists('checkdnsrr')) |
66 | 66 | { |
67 | 67 | if($value!=='') |
68 | 68 | { |
69 | - if(($pos=strpos($value,'@'))!==false) |
|
69 | + if(($pos=strpos($value, '@'))!==false) |
|
70 | 70 | { |
71 | - $domain=substr($value,$pos+1); |
|
72 | - return $domain===''?false:checkdnsrr($domain,'MX'); |
|
71 | + $domain=substr($value, $pos + 1); |
|
72 | + return $domain==='' ? false : checkdnsrr($domain, 'MX'); |
|
73 | 73 | } |
74 | 74 | else |
75 | 75 | return false; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function getCheckMXRecord() |
85 | 85 | { |
86 | - return $this->getViewState('CheckMXRecord',false); |
|
86 | + return $this->getViewState('CheckMXRecord', false); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function setCheckMXRecord($value) |
94 | 94 | { |
95 | - $this->setViewState('CheckMXRecord',TPropertyValue::ensureBoolean($value),false); |
|
95 | + $this->setViewState('CheckMXRecord', TPropertyValue::ensureBoolean($value), false); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | { |
56 | 56 | private $_isValid=true; |
57 | 57 | |
58 | - const ChallengeFieldName = 'recaptcha_challenge_field'; |
|
59 | - const ResponseFieldName = 'recaptcha_response_field'; |
|
58 | + const ChallengeFieldName='recaptcha_challenge_field'; |
|
59 | + const ResponseFieldName='recaptcha_response_field'; |
|
60 | 60 | |
61 | 61 | public function getTagName() |
62 | 62 | { |
@@ -157,28 +157,27 @@ discard block |
||
157 | 157 | |
158 | 158 | public function getClientSideOptions() |
159 | 159 | { |
160 | - $options = array(); |
|
161 | - if ($theme = $this->getThemeName()) |
|
162 | - $options['theme'] = $theme; |
|
163 | - if ($lang = $this->getLanguage()) |
|
164 | - $options['lang'] = $lang; |
|
165 | - if ($trans = $this->getCustomTranslations()) |
|
166 | - $options['custom_translations'] = $trans; |
|
160 | + $options=array(); |
|
161 | + if($theme=$this->getThemeName()) |
|
162 | + $options['theme']=$theme; |
|
163 | + if($lang=$this->getLanguage()) |
|
164 | + $options['lang']=$lang; |
|
165 | + if($trans=$this->getCustomTranslations()) |
|
166 | + $options['custom_translations']=$trans; |
|
167 | 167 | return $options; |
168 | 168 | } |
169 | 169 | |
170 | 170 | public function validate() |
171 | 171 | { |
172 | - if (! |
|
173 | - ( |
|
174 | - ($challenge = @$_POST[$this->getChallengeFieldName()]) |
|
172 | + if(!( |
|
173 | + ($challenge=@$_POST[$this->getChallengeFieldName()]) |
|
175 | 174 | and |
176 | - ($response = @$_POST[$this->getResponseFieldName()]) |
|
175 | + ($response=@$_POST[$this->getResponseFieldName()]) |
|
177 | 176 | ) |
178 | 177 | ) |
179 | 178 | return false; |
180 | 179 | |
181 | - $resp = recaptcha_check_answer( |
|
180 | + $resp=recaptcha_check_answer( |
|
182 | 181 | $this->getPrivateKey(), |
183 | 182 | $_SERVER["REMOTE_ADDR"], |
184 | 183 | $challenge, |
@@ -195,13 +194,13 @@ discard block |
||
195 | 194 | { |
196 | 195 | parent::onPreRender($param); |
197 | 196 | |
198 | - if("" == $this->getPublicKey()) |
|
197 | + if(""==$this->getPublicKey()) |
|
199 | 198 | throw new TConfigurationException('recaptcha_publickey_unknown'); |
200 | - if("" == $this->getPrivateKey()) |
|
199 | + if(""==$this->getPrivateKey()) |
|
201 | 200 | throw new TConfigurationException('recaptcha_privatekey_unknown'); |
202 | 201 | |
203 | 202 | // need to register captcha fields so they will be sent back also in callbacks |
204 | - $page = $this->getPage(); |
|
203 | + $page=$this->getPage(); |
|
205 | 204 | $page->registerRequiresPostData($this->getChallengeFieldName()); |
206 | 205 | $page->registerRequiresPostData($this->getResponseFieldName()); |
207 | 206 | } |
@@ -209,32 +208,32 @@ discard block |
||
209 | 208 | protected function addAttributesToRender($writer) |
210 | 209 | { |
211 | 210 | parent::addAttributesToRender($writer); |
212 | - $writer->addAttribute('id',$this->getClientID()); |
|
211 | + $writer->addAttribute('id', $this->getClientID()); |
|
213 | 212 | } |
214 | 213 | |
215 | 214 | public function regenerateToken() |
216 | 215 | { |
217 | 216 | // if we're in a callback, then schedule re-rendering of the control |
218 | 217 | // if not, don't do anything, because a new challenge will be rendered anyway |
219 | - if ($this->Page->IsCallback) |
|
220 | - $this->Page->CallbackClient->jQuery($this->getClientID().' #recaptcha_reload','click'); |
|
218 | + if($this->Page->IsCallback) |
|
219 | + $this->Page->CallbackClient->jQuery($this->getClientID().' #recaptcha_reload', 'click'); |
|
221 | 220 | } |
222 | 221 | |
223 | 222 | public function renderContents($writer) |
224 | 223 | { |
225 | - $readyscript = 'jQuery(document).trigger('.TJavaScript::quoteString('captchaready:'.$this->getClientID()).')'; |
|
226 | - $cs = $this->Page->ClientScript; |
|
227 | - $id = $this->getClientID(); |
|
228 | - $divid = $id.'_1_recaptchadiv'; |
|
224 | + $readyscript='jQuery(document).trigger('.TJavaScript::quoteString('captchaready:'.$this->getClientID()).')'; |
|
225 | + $cs=$this->Page->ClientScript; |
|
226 | + $id=$this->getClientID(); |
|
227 | + $divid=$id.'_1_recaptchadiv'; |
|
229 | 228 | $writer->write('<div id="'.htmlspecialchars($divid).'">'); |
230 | 229 | |
231 | - if (!$this->Page->IsCallback) |
|
230 | + if(!$this->Page->IsCallback) |
|
232 | 231 | { |
233 | 232 | $writer->write(TJavaScript::renderScriptBlock( |
234 | 233 | 'var RecaptchaOptions = '.TJavaScript::jsonEncode($this->getClientSideOptions()).';' |
235 | 234 | )); |
236 | 235 | |
237 | - $html = recaptcha_get_html($this->getPublicKey()); |
|
236 | + $html=recaptcha_get_html($this->getPublicKey()); |
|
238 | 237 | /* |
239 | 238 | reCAPTCHA currently does not support multiple validations per page |
240 | 239 | $html = str_replace( |
@@ -249,8 +248,8 @@ discard block |
||
249 | 248 | } |
250 | 249 | else |
251 | 250 | { |
252 | - $options = $this->getClientSideOptions(); |
|
253 | - $options['callback'] = new TJavaScriptLiteral('function() { '.$readyscript.'; '.$this->getCallbackScript().'; }'); |
|
251 | + $options=$this->getClientSideOptions(); |
|
252 | + $options['callback']=new TJavaScriptLiteral('function() { '.$readyscript.'; '.$this->getCallbackScript().'; }'); |
|
254 | 253 | $cs->registerScriptFile('ReCaptcha::AjaxScript', 'http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'); |
255 | 254 | $cs->registerEndScript('ReCaptcha::CreateScript::'.$id, implode(' ', array( |
256 | 255 | 'if (!jQuery('.TJavaScript::quoteString('#'.$this->getResponseFieldName()).'))', |