Completed
Push — prado4-sauce ( 31ba42...77d75b )
by Fabio
16:20 queued 08:27
created
framework/Web/UI/ActiveControls/TActiveImageButton.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function setAlternateText($value)
60 60
 	{
61
-		if(parent::getAlternateText() === $value)
61
+		if(parent::getAlternateText()===$value)
62 62
 			return;
63 63
 
64 64
 		parent::setAlternateText($value);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function setImageAlign($value)
77 77
 	{
78
-		if(parent::getImageAlign() === $value)
78
+		if(parent::getImageAlign()===$value)
79 79
 			return;
80 80
 
81 81
 		parent::setImageAlign($value);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function setImageUrl($value)
90 90
 	{
91
-		if(parent::getImageUrl() === $value)
91
+		if(parent::getImageUrl()===$value)
92 92
 			return;
93 93
 
94 94
 		parent::setImageUrl($value);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function setDescriptionUrl($value)
103 103
 	{
104
-		if(parent::getDescriptionUrl() === $value)
104
+		if(parent::getDescriptionUrl()===$value)
105 105
 			return;
106 106
 
107 107
 		parent::setDescriptionUrl($value);
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	protected function addAttributesToRender($writer)
152 152
 	{
153 153
 		parent::addAttributesToRender($writer);
154
-		$writer->addAttribute('id',$this->getClientID());
154
+		$writer->addAttribute('id', $this->getClientID());
155 155
 		$this->getActiveControl()->registerCallbackClientScript(
156 156
 			$this->getClientClassName(), $this->getPostBackOptions());
157 157
 	}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -147,6 +147,7 @@  discard block
 block discarded – undo
147 147
 	/**
148 148
 	 * Sets the height of the image in the THyperLink
149 149
 	 * @param string height of the image in the THyperLink
150
+	 * @param string $value
150 151
 	 */
151 152
 	public function setImageHeight($value)
152 153
 	{
@@ -181,6 +182,7 @@  discard block
 block discarded – undo
181 182
 	/**
182 183
 	 * Sets the width of the image in the THyperLink
183 184
 	 * @param string width of the image
185
+	 * @param string $value
184 186
 	 */
185 187
 	public function setImageWidth($value)
186 188
 	{
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TCheckBoxList.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	{
405 405
 	  if ($needSpan=$this->getSpanNeeded())
406 406
 	  {
407
-	    $writer->addAttribute('id', $this->getClientId());
408
-	    $writer->renderBeginTag('span');
407
+		$writer->addAttribute('id', $this->getClientId());
408
+		$writer->renderBeginTag('span');
409 409
 	  }
410 410
 		if($this->getItemCount()>0)
411 411
 		{
@@ -463,14 +463,14 @@  discard block
 block discarded – undo
463 463
 	 */
464 464
 	public function getIsValid()
465 465
 	{
466
-	    return $this->_isValid;
466
+		return $this->_isValid;
467 467
 	}
468 468
 	/**
469 469
 	 * @param bool wether this control is valid.
470 470
 	 */
471 471
 	public function setIsValid($value)
472 472
 	{
473
-	    $this->_isValid=TPropertyValue::ensureBoolean($value);
473
+		$this->_isValid=TPropertyValue::ensureBoolean($value);
474 474
 	}
475 475
 
476 476
 	/**
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 	/**
61 61
 	 * Creates a control used for repetition (used as a template).
62
-	 * @return TControl the control to be repeated
62
+	 * @return TCheckBoxItem the control to be repeated
63 63
 	 */
64 64
 	protected function createRepeatedControl()
65 65
 	{
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * This method overrides the parent implementation so that it always returns
72 72
 	 * the checkbox list itself (because the checkbox list does not have child controls.)
73 73
 	 * @param string control ID
74
-	 * @return TControl control being found
74
+	 * @return \Prado\Web\UI\TControl|null control being found
75 75
 	 */
76 76
 	public function findControl($id, $real=false)
77 77
 	{
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	}
146 146
 
147 147
 	/**
148
-	 * @return string the direction of traversing the list, defaults to 'Vertical'
148
+	 * @return TRepeatDirection the direction of traversing the list, defaults to 'Vertical'
149 149
 	 */
150 150
 	public function getRepeatDirection()
151 151
 	{
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	}
162 162
 
163 163
 	/**
164
-	 * @return string how the list should be displayed, using table or using line breaks. Defaults to 'Table'.
164
+	 * @return TRepeatLayout how the list should be displayed, using table or using line breaks. Defaults to 'Table'.
165 165
 	 */
166 166
 	public function getRepeatLayout()
167 167
 	{
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	/**
441 441
 	 * Returns the value to be validated.
442 442
 	 * This methid is required by \Prado\Web\UI\IValidatable interface.
443
-	 * @return mixed the value of the property to be validated.
443
+	 * @return string the value of the property to be validated.
444 444
 	 */
445 445
 	public function getValidationPropertyValue()
446 446
 	{
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function findControl($id, $real=false)
77 77
 	{
78
-  		if ($real===true)
78
+  		if($real===true)
79 79
   			return parent::findControl($id);
80 80
 		return $this;
81 81
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function getTextAlign()
105 105
 	{
106
-		return $this->getViewState('TextAlign',TTextAlign::Right);
106
+		return $this->getViewState('TextAlign', TTextAlign::Right);
107 107
 	}
108 108
 
109 109
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function setTextAlign($value)
113 113
 	{
114
-		$this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TTextAlign'),TTextAlign::Right);
114
+		$this->setViewState('TextAlign', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TTextAlign'), TTextAlign::Right);
115 115
 	}
116 116
 
117 117
 
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	protected function getRepeatInfo()
122 122
 	{
123
-		if(($repeatInfo=$this->getViewState('RepeatInfo',null))===null)
123
+		if(($repeatInfo=$this->getViewState('RepeatInfo', null))===null)
124 124
 		{
125 125
 			$repeatInfo=new TRepeatInfo;
126
-			$this->setViewState('RepeatInfo',$repeatInfo,null);
126
+			$this->setViewState('RepeatInfo', $repeatInfo, null);
127 127
 		}
128 128
 		return $repeatInfo;
129 129
 	}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	public function setEnabled($value)
253 253
 	{
254 254
 		parent::setEnabled($value);
255
-		$value = !TPropertyValue::ensureBoolean($value);
255
+		$value=!TPropertyValue::ensureBoolean($value);
256 256
 		// if this is an active control,
257 257
 		// and it's a callback,
258 258
 		// and we can update clientside,
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 				$this->getPage()->getIsCallBack() &&
262 262
 				$this->getActiveControl()->canUpdateClientSide())
263 263
 		{
264
-			$items = $this->getItems();
265
-			$cs = $this->getPage()->getCallbackClient();
266
-			$baseClientID = $this->getClientID().'_c';
264
+			$items=$this->getItems();
265
+			$cs=$this->getPage()->getCallbackClient();
266
+			$baseClientID=$this->getClientID().'_c';
267 267
 			foreach($items as $index=>$item)
268 268
 			{
269 269
 				$cs->setAttribute($baseClientID.$index, 'disabled', $value);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @param integer index of the item being rendered
279 279
 	 * @return null
280 280
 	 */
281
-	public function generateItemStyle($itemType,$index)
281
+	public function generateItemStyle($itemType, $index)
282 282
 	{
283 283
 		return null;
284 284
 	}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @param string item type (Header,Footer,Item,AlternatingItem,SelectedItem,EditItem,Separator,Pager)
292 292
 	 * @param integer zero-based index of the item in the item list
293 293
 	 */
294
-	public function renderItem($writer,$repeatInfo,$itemType,$index)
294
+	public function renderItem($writer, $repeatInfo, $itemType, $index)
295 295
 	{
296 296
 		$repeatedControl=$this->_repeatedControl;
297 297
 		$item=$this->getItems()->itemAt($index);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		$repeatedControl->setID("c$index");
303 303
 		$repeatedControl->setText($item->getText());
304 304
 		$repeatedControl->setChecked($item->getSelected());
305
-		$repeatedControl->setAttribute('value',$item->getValue());
305
+		$repeatedControl->setAttribute('value', $item->getValue());
306 306
 		$repeatedControl->setEnabled($this->_isEnabled && $item->getEnabled());
307 307
 		$repeatedControl->setEnableClientScript(false);
308 308
 		$repeatedControl->renderControl($writer);
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 	 * @param array the input data collection
316 316
 	 * @return boolean whether the data of the control has been changed
317 317
 	 */
318
-	public function loadPostData($key,$values)
318
+	public function loadPostData($key, $values)
319 319
 	{
320 320
 		if($this->getEnabled(true))
321 321
 		{
322
-			$index=(int)substr($key,strlen($this->getUniqueID())+2);
322
+			$index=(int) substr($key, strlen($this->getUniqueID()) + 2);
323 323
 			$this->ensureDataBound();
324
-			if($index>=0 && $index<$this->getItemCount())
324
+			if($index >= 0 && $index < $this->getItemCount())
325 325
 			{
326 326
 				$item=$this->getItems()->itemAt($index);
327 327
 				if($item->getEnabled())
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		$this->_repeatedControl->setValidationGroup($this->getValidationGroup());
370 370
 		$page=$this->getPage();
371 371
 		$n=$this->getItemCount();
372
-		for($i=0;$i<$n;++$i)
372
+		for($i=0; $i < $n; ++$i)
373 373
 		{
374 374
 			$this->_repeatedControl->setID("c$i");
375 375
 			$page->registerRequiresPostData($this->_repeatedControl);
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 *
382 382
 	 *@return boolean true if we need a span
383 383
 	 */
384
-	protected function getSpanNeeded ()
384
+	protected function getSpanNeeded()
385 385
 	{
386 386
 		return $this->getRepeatLayout()===TRepeatLayout::Raw;
387 387
 	}
@@ -393,12 +393,12 @@  discard block
 block discarded – undo
393 393
 	 */
394 394
 	public function render($writer)
395 395
 	{
396
-	  if ($needSpan=$this->getSpanNeeded())
396
+	  if($needSpan=$this->getSpanNeeded())
397 397
 	  {
398 398
 	    $writer->addAttribute('id', $this->getClientId());
399 399
 	    $writer->renderBeginTag('span');
400 400
 	  }
401
-		if($this->getItemCount()>0)
401
+		if($this->getItemCount() > 0)
402 402
 		{
403 403
 			$this->_isEnabled=$this->getEnabled(true);
404 404
 			$repeatInfo=$this->getRepeatInfo();
@@ -410,11 +410,11 @@  discard block
 block discarded – undo
410 410
 			$this->setAccessKey('');
411 411
 			$this->setTabIndex(0);
412 412
 			$this->addAttributesToRender($writer);
413
-			$repeatInfo->renderRepeater($writer,$this);
413
+			$repeatInfo->renderRepeater($writer, $this);
414 414
 			$this->setAccessKey($accessKey);
415 415
 			$this->setTabIndex($tabIndex);
416 416
 		}
417
-		if ($needSpan)
417
+		if($needSpan)
418 418
 		  $writer->renderEndTag();
419 419
 
420 420
 		//checkbox skipped the client control script in addAttributesToRender
@@ -480,11 +480,11 @@  discard block
 block discarded – undo
480 480
 	 */
481 481
 	protected function getPostBackOptions()
482 482
 	{
483
-		$options['ID'] = $this->getClientID();
484
-		$options['ValidationGroup'] = $this->getValidationGroup();
485
-		$options['CausesValidation'] = $this->getCausesValidation();
486
-		$options['ListName'] = $this->getUniqueID();
487
-		$options['ItemCount'] = $this->getItemCount();
483
+		$options['ID']=$this->getClientID();
484
+		$options['ValidationGroup']=$this->getValidationGroup();
485
+		$options['CausesValidation']=$this->getCausesValidation();
486
+		$options['ListName']=$this->getUniqueID();
487
+		$options['ItemCount']=$this->getItemCount();
488 488
 		return $options;
489 489
 	}
490 490
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveRadioButton.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function setText($value)
90 90
 	{
91
-		if(parent::getText() === $value)
91
+		if(parent::getText()===$value)
92 92
 			return;
93 93
 
94 94
 		parent::setText($value);
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function setChecked($value)
107 107
 	{
108
-		$value = TPropertyValue::ensureBoolean($value);
109
-		if(parent::getChecked() === $value)
108
+		$value=TPropertyValue::ensureBoolean($value);
109
+		if(parent::getChecked()===$value)
110 110
 			return;
111 111
 
112 112
 		parent::setChecked($value);
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	 * @param string checkbox id
133 133
 	 * @param string onclick js
134 134
 	 */
135
-	protected function renderInputTag($writer,$clientID,$onclick)
135
+	protected function renderInputTag($writer, $clientID, $onclick)
136 136
 	{
137
-		parent::renderInputTag($writer,$clientID,$onclick);
138
-		if ($this->getAutoPostBack())
137
+		parent::renderInputTag($writer, $clientID, $onclick);
138
+		if($this->getAutoPostBack())
139 139
 			$this->getActiveControl()->registerCallbackClientScript(
140 140
 				$this->getClientClassName(), $this->getPostBackOptions());
141 141
 	}
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function getLabelAttributes()
156 156
 	{
157
-		$attributes = parent::getLabelAttributes();
158
-		$attributes['id'] = $this->getDefaultLabelID();
157
+		$attributes=parent::getLabelAttributes();
158
+		$attributes['id']=$this->getDefaultLabelID();
159 159
 		return $attributes;
160 160
 	}
161 161
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @param string checkbox id
166 166
 	 * @param string label text
167 167
 	 */
168
-	protected function renderLabel($writer,$clientID,$text)
168
+	protected function renderLabel($writer, $clientID, $text)
169 169
 	{
170 170
 		$writer->addAttribute('id', $this->getDefaultLabelID());
171 171
 		parent::renderLabel($writer, $clientID, $text);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	protected function getDefaultLabelID()
178 178
 	{
179
-		if($attributes=$this->getViewState('LabelAttributes',null))
179
+		if($attributes=$this->getViewState('LabelAttributes', null))
180 180
 			return TCheckBox::getLabelAttributes()->itemAt('id');
181 181
 		else
182 182
 			return $this->getClientID().'_label';
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveTextBox.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function setText($value)
96 96
 	{
97
-		if(parent::getText() === $value)
97
+		if(parent::getText()===$value)
98 98
 			return;
99 99
 
100 100
 		parent::setText($value);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	protected function addAttributesToRender($writer)
118 118
 	{
119 119
 		parent::addAttributesToRender($writer);
120
-		$writer->addAttribute('id',$this->getClientID());
120
+		$writer->addAttribute('id', $this->getClientID());
121 121
 		$this->getActiveControl()->registerCallbackClientScript(
122 122
 			$this->getClientClassName(), $this->getPostBackOptions());
123 123
 	}
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TReCaptcha2Validator.php 2 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -29,82 +29,82 @@
 block discarded – undo
29 29
 
30 30
 class TReCaptcha2Validator extends TBaseValidator
31 31
 {
32
-    protected $_isvalid = null;
32
+	protected $_isvalid = null;
33 33
 
34
-    protected function getClientClassName()
35
-    {
36
-        return 'Prado.WebUI.TReCaptcha2Validator';
37
-    }
38
-    public function getEnableClientScript()
39
-    {
40
-        return true;
41
-    }
42
-    protected function getCaptchaControl()
43
-    {
44
-        $control = $this->getValidationTarget();
45
-        if (!$control)
46
-            throw new Exception('No target control specified for TReCaptcha2Validator');
47
-        if (!($control instanceof TReCaptcha2))
48
-            throw new Exception('TReCaptcha2Validator only works with TReCaptcha2 controls');
49
-        return $control;
50
-    }
51
-    public function getClientScriptOptions()
52
-    {
53
-        $options = parent::getClientScriptOptions();
54
-        $options['ResponseFieldName'] = $this->getCaptchaControl()->getResponseFieldName();
55
-        return $options;
56
-    }
57
-    /**
58
-     * This method overrides the parent's implementation.
59
-     * The validation succeeds if the input control has the same value
60
-     * as the one displayed in the corresponding RECAPTCHA control.
61
-     *
62
-     * @return boolean whether the validation succeeds
63
-     */
64
-    protected function evaluateIsValid()
65
-    {
66
-        // check validity only once (if trying to evaulate multiple times, all redundant checks would fail)
67
-        if (is_null($this->_isvalid))
68
-        {
69
-            $control = $this->getCaptchaControl();
70
-            $this->_isvalid = $control->validate();
71
-        }
72
-        return ($this->_isvalid==true);
73
-    }
74
-    public function onPreRender($param)
75
-    {
76
-        parent::onPreRender($param);
34
+	protected function getClientClassName()
35
+	{
36
+		return 'Prado.WebUI.TReCaptcha2Validator';
37
+	}
38
+	public function getEnableClientScript()
39
+	{
40
+		return true;
41
+	}
42
+	protected function getCaptchaControl()
43
+	{
44
+		$control = $this->getValidationTarget();
45
+		if (!$control)
46
+			throw new Exception('No target control specified for TReCaptcha2Validator');
47
+		if (!($control instanceof TReCaptcha2))
48
+			throw new Exception('TReCaptcha2Validator only works with TReCaptcha2 controls');
49
+		return $control;
50
+	}
51
+	public function getClientScriptOptions()
52
+	{
53
+		$options = parent::getClientScriptOptions();
54
+		$options['ResponseFieldName'] = $this->getCaptchaControl()->getResponseFieldName();
55
+		return $options;
56
+	}
57
+	/**
58
+	 * This method overrides the parent's implementation.
59
+	 * The validation succeeds if the input control has the same value
60
+	 * as the one displayed in the corresponding RECAPTCHA control.
61
+	 *
62
+	 * @return boolean whether the validation succeeds
63
+	 */
64
+	protected function evaluateIsValid()
65
+	{
66
+		// check validity only once (if trying to evaulate multiple times, all redundant checks would fail)
67
+		if (is_null($this->_isvalid))
68
+		{
69
+			$control = $this->getCaptchaControl();
70
+			$this->_isvalid = $control->validate();
71
+		}
72
+		return ($this->_isvalid==true);
73
+	}
74
+	public function onPreRender($param)
75
+	{
76
+		parent::onPreRender($param);
77 77
 
78
-        $cs = $this->Page->getClientScript();
79
-        $cs->registerPradoScript('validator');
78
+		$cs = $this->Page->getClientScript();
79
+		$cs->registerPradoScript('validator');
80 80
 
81
-        // communicate validation status to the client side
82
-        $value = $this->_isvalid===false ? '0' : '1';
83
-        $cs->registerHiddenField($this->getClientID().'_1',$value);
81
+		// communicate validation status to the client side
82
+		$value = $this->_isvalid===false ? '0' : '1';
83
+		$cs->registerHiddenField($this->getClientID().'_1',$value);
84 84
 
85
-        // update validator display
86
-        if ($control = $this->getValidationTarget())
87
-        {
88
-            $fn = 'captchaUpdateValidatorStatus_'.$this->getClientID();
85
+		// update validator display
86
+		if ($control = $this->getValidationTarget())
87
+		{
88
+			$fn = 'captchaUpdateValidatorStatus_'.$this->getClientID();
89 89
 
90
-            $cs->registerEndScript($this->getClientID().'::validate', implode(' ',array(
91
-                // this function will be used to update the validator
92
-                'function '.$fn.'(valid)',
93
-                '{',
94
-                '  jQuery('.TJavaScript::quoteString('#'.$this->getClientID().'_1').').val(valid);',
95
-                '  Prado.Validation.validateControl('.TJavaScript::quoteString($control->ClientID).'); ',
96
-                '}',
97
-                '',
98
-                // update the validator to the result if we're in a callback 
99
-                // (if we're in initial rendering or a postback then the result will be rendered directly to the page html anyway)
100
-                $this->Page->IsCallback ? $fn.'('.$value.');' : '',
101
-                '',
102
-                // install event handler that clears the validation error when user changes the captcha response field
103
-                'jQuery("#'.$control->getClientID().'").on("change", '.TJavaScript::quoteString('#'.$control->getResponseFieldName()).', function() { ',
104
-                    $fn.'("1");',
105
-                '});',
106
-            )));
107
-        }
108
-    }
90
+			$cs->registerEndScript($this->getClientID().'::validate', implode(' ',array(
91
+				// this function will be used to update the validator
92
+				'function '.$fn.'(valid)',
93
+				'{',
94
+				'  jQuery('.TJavaScript::quoteString('#'.$this->getClientID().'_1').').val(valid);',
95
+				'  Prado.Validation.validateControl('.TJavaScript::quoteString($control->ClientID).'); ',
96
+				'}',
97
+				'',
98
+				// update the validator to the result if we're in a callback 
99
+				// (if we're in initial rendering or a postback then the result will be rendered directly to the page html anyway)
100
+				$this->Page->IsCallback ? $fn.'('.$value.');' : '',
101
+				'',
102
+				// install event handler that clears the validation error when user changes the captcha response field
103
+				'jQuery("#'.$control->getClientID().'").on("change", '.TJavaScript::quoteString('#'.$control->getResponseFieldName()).', function() { ',
104
+					$fn.'("1");',
105
+				'});',
106
+			)));
107
+		}
108
+	}
109 109
 }
110 110
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 class TReCaptcha2Validator extends TBaseValidator
31 31
 {
32
-    protected $_isvalid = null;
32
+    protected $_isvalid=null;
33 33
 
34 34
     protected function getClientClassName()
35 35
     {
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
     }
42 42
     protected function getCaptchaControl()
43 43
     {
44
-        $control = $this->getValidationTarget();
45
-        if (!$control)
44
+        $control=$this->getValidationTarget();
45
+        if(!$control)
46 46
             throw new Exception('No target control specified for TReCaptcha2Validator');
47
-        if (!($control instanceof TReCaptcha2))
47
+        if(!($control instanceof TReCaptcha2))
48 48
             throw new Exception('TReCaptcha2Validator only works with TReCaptcha2 controls');
49 49
         return $control;
50 50
     }
51 51
     public function getClientScriptOptions()
52 52
     {
53
-        $options = parent::getClientScriptOptions();
54
-        $options['ResponseFieldName'] = $this->getCaptchaControl()->getResponseFieldName();
53
+        $options=parent::getClientScriptOptions();
54
+        $options['ResponseFieldName']=$this->getCaptchaControl()->getResponseFieldName();
55 55
         return $options;
56 56
     }
57 57
     /**
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     protected function evaluateIsValid()
65 65
     {
66 66
         // check validity only once (if trying to evaulate multiple times, all redundant checks would fail)
67
-        if (is_null($this->_isvalid))
67
+        if(is_null($this->_isvalid))
68 68
         {
69
-            $control = $this->getCaptchaControl();
70
-            $this->_isvalid = $control->validate();
69
+            $control=$this->getCaptchaControl();
70
+            $this->_isvalid=$control->validate();
71 71
         }
72 72
         return ($this->_isvalid==true);
73 73
     }
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
     {
76 76
         parent::onPreRender($param);
77 77
 
78
-        $cs = $this->Page->getClientScript();
78
+        $cs=$this->Page->getClientScript();
79 79
         $cs->registerPradoScript('validator');
80 80
 
81 81
         // communicate validation status to the client side
82
-        $value = $this->_isvalid===false ? '0' : '1';
83
-        $cs->registerHiddenField($this->getClientID().'_1',$value);
82
+        $value=$this->_isvalid===false ? '0' : '1';
83
+        $cs->registerHiddenField($this->getClientID().'_1', $value);
84 84
 
85 85
         // update validator display
86
-        if ($control = $this->getValidationTarget())
86
+        if($control=$this->getValidationTarget())
87 87
         {
88
-            $fn = 'captchaUpdateValidatorStatus_'.$this->getClientID();
88
+            $fn='captchaUpdateValidatorStatus_'.$this->getClientID();
89 89
 
90
-            $cs->registerEndScript($this->getClientID().'::validate', implode(' ',array(
90
+            $cs->registerEndScript($this->getClientID().'::validate', implode(' ', array(
91 91
                 // this function will be used to update the validator
92 92
                 'function '.$fn.'(valid)',
93 93
                 '{',
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TReCaptcha2.php 2 patches
Indentation   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -55,310 +55,310 @@
 block discarded – undo
55 55
 
56 56
 class TReCaptcha2 extends TActivePanel implements ICallbackEventHandler, IValidatable
57 57
 {
58
-    const ChallengeFieldName = 'g-recaptcha-response';
59
-    private $_widgetId=0;
60
-    private $_isValid=true;
58
+	const ChallengeFieldName = 'g-recaptcha-response';
59
+	private $_widgetId=0;
60
+	private $_isValid=true;
61 61
 
62
-    public function __construct()
63
-    {
64
-        parent::__construct();
65
-        $this->setAdapter(new TActiveControlAdapter($this));
66
-    }
67
-    public function getActiveControl()
68
-    {
69
-        return $this->getAdapter()->getBaseActiveControl();
70
-    }
71
-    public function getClientSide()
72
-    {
73
-        return $this->getAdapter()->getBaseActiveControl()->getClientSide();
74
-    }
75
-    public function getClientClassName()
76
-    {
77
-        return 'Prado.WebUI.TReCaptcha2';
78
-    }
79
-    public function getTagName()
80
-    {
81
-        return 'div';
82
-    }
83
-    /**
84
-     * Returns true if this control validated successfully. 
85
-     * Defaults to true.
86
-     * @return bool wether this control validated successfully.
87
-     */
88
-    public function getIsValid()
89
-    {
90
-        return $this->_isValid;
91
-    }
92
-    /**
93
-     * @param bool wether this control is valid.
94
-     */
95
-    public function setIsValid($value)
96
-    {
97
-        $this->_isValid=TPropertyValue::ensureBoolean($value);
98
-    }
99
-    public function getValidationPropertyValue()
100
-    {
101
-        return $this->Request[$this->getResponseFieldName()];
102
-    }
103
-    public function getResponseFieldName()
104
-    {
105
-        $captchas = $this->Page->findControlsByType('TReCaptcha2');
106
-        $cont = 0;
107
-        $responseFieldName = self::ChallengeFieldName;
108
-        foreach ($captchas as $captcha)
109
-        {
110
-            if ($this->getClientID() == $captcha->ClientID)
111
-            {
112
-                $responseFieldName .= ($cont > 0) ? '-'.$cont : '';
113
-            }
114
-            $cont++;
115
-        }
116
-        return $responseFieldName;
117
-    }
118
-    /**
119
-     * Returns your site key. 
120
-     * @return string.
121
-     */
122
-    public function getSiteKey()
123
-    {
124
-        return $this->getViewState('SiteKey');
125
-    }
126
-    /**
127
-     * @param string your site key.
128
-     */
129
-    public function setSiteKey($value)
130
-    {
131
-        $this->setViewState('SiteKey', TPropertyValue::ensureString($value));
132
-    }
133
-    /**
134
-     * Returns your secret key. 
135
-     * @return string.
136
-     */
137
-    public function getSecretKey()
138
-    {
139
-        return $this->getViewState('SecretKey');
140
-    }
141
-    /**
142
-     * @param string your secret key.
143
-     */
144
-    public function setSecretKey($value)
145
-    {
146
-        $this->setViewState('SecretKey', TPropertyValue::ensureString($value));
147
-    }
148
-    /**
149
-     * Returns your language.
150
-     * @return string.
151
-     */
152
-    public function getLanguage()
153
-    {
154
-        return $this->getViewState('Language', 'en');
155
-    }
156
-    /**
157
-     * @param string your language.
158
-     */
159
-    public function setLanguage($value)
160
-    {
161
-        $this->setViewState('Language', TPropertyValue::ensureString($value), 'en');
162
-    }
163
-    /**
164
-     * Returns the color theme of the widget. 
165
-     * @return string.
166
-     */
167
-    public function getTheme()
168
-    {
169
-        return $this->getViewState('Theme', 'light');
170
-    }
171
-    /**
172
-     * The color theme of the widget.
173
-     * Default: light
174
-     * @param string the color theme of the widget.
175
-     */
176
-    public function setTheme($value)
177
-    {
178
-        $this->setViewState('Theme', TPropertyValue::ensureString($value), 'light');
179
-    }
180
-    /**
181
-     * Returns the type of CAPTCHA to serve.
182
-     * @return string.
183
-     */
184
-    public function getType()
185
-    {
186
-        return $this->getViewState('Type', 'image');
187
-    }
188
-    /**
189
-     * The type of CAPTCHA to serve.
190
-     * Default: image
191
-     * @param string the type of CAPTCHA to serve.
192
-     */
193
-    public function setType($value)
194
-    {
195
-        $this->setViewState('Type', TPropertyValue::ensureString($value), 'image');
196
-    }
197
-    /**
198
-     * Returns the size of the widget.
199
-     * @return string.
200
-     */
201
-    public function getSize()
202
-    {
203
-        return $this->getViewState('Size', 'normal');
204
-    }
205
-    /**
206
-     * The size of the widget.
207
-     * Default: normal
208
-     * @param string the size of the widget.
209
-     */
210
-    public function setSize($value)
211
-    {
212
-        $this->setViewState('Size', TPropertyValue::ensureString($value), 'normal');
213
-    }
214
-    /**
215
-     * Returns the tabindex of the widget and challenge.
216
-     * If other elements in your page use tabindex, it should be set to make user navigation easier.
217
-     * @return string.
218
-     */
219
-    public function getTabIndex()
220
-    {
221
-        return $this->getViewState('TabIndex', 0);
222
-    }
223
-    /**
224
-     * The tabindex of the widget and challenge.
225
-     * If other elements in your page use tabindex, it should be set to make user navigation easier.
226
-     * Default: 0
227
-     * @param string the tabindex of the widget and challenge.
228
-     */
229
-    public function setTabIndex($value)
230
-    {
231
-        $this->setViewState('TabIndex', TPropertyValue::ensureInteger($value), 0);
232
-    }
233
-    /**
234
-     * Resets the reCAPTCHA widget.
235
-     * Optional widget ID, defaults to the first widget created if unspecified.
236
-     */
237
-    public function reset()
238
-    {
239
-        $this->Page->CallbackClient->callClientFunction('grecaptcha.reset',array(array($this->WidgetId)));
240
-    }
241
-    /**
242
-     * Gets the response for the reCAPTCHA widget.
243
-     */
244
-    public function getResponse()
245
-    {
246
-        return $this->getViewState('Response', '');
247
-    }
248
-    public function setResponse($value)
249
-    {
250
-        $this->setViewState('Response', TPropertyValue::ensureString($value), '');
251
-    }
252
-    public function getWidgetId()
253
-    {
254
-        return $this->getViewState('WidgetId', 0);
255
-    }
256
-    public function setWidgetId($value)
257
-    {
258
-        $this->setViewState('WidgetId', TPropertyValue::ensureInteger($value), 0);
259
-    }
260
-    protected function getClientOptions()
261
-    {
262
-        $options['ID'] = $this->getClientID();
263
-        $options['EventTarget'] = $this->getUniqueID();
264
-        $options['FormID'] = $this->Page->getForm()->getClientID();
265
-        $options['onCallback'] = $this->hasEventHandler('OnCallback');
266
-        $options['onCallbackExpired'] = $this->hasEventHandler('OnCallbackExpired');
267
-        $options['options']['sitekey'] = $this->getSiteKey();
268
-        if ($theme = $this->getTheme()) $options['options']['theme'] = $theme;
269
-        if ($type = $this->getType()) $options['options']['type'] = $type;
270
-        if ($size = $this->getSize()) $options['options']['size'] = $size;
271
-        if ($tabIndex = $this->getTabIndex()) $options['options']['tabindex'] = $tabIndex;
62
+	public function __construct()
63
+	{
64
+		parent::__construct();
65
+		$this->setAdapter(new TActiveControlAdapter($this));
66
+	}
67
+	public function getActiveControl()
68
+	{
69
+		return $this->getAdapter()->getBaseActiveControl();
70
+	}
71
+	public function getClientSide()
72
+	{
73
+		return $this->getAdapter()->getBaseActiveControl()->getClientSide();
74
+	}
75
+	public function getClientClassName()
76
+	{
77
+		return 'Prado.WebUI.TReCaptcha2';
78
+	}
79
+	public function getTagName()
80
+	{
81
+		return 'div';
82
+	}
83
+	/**
84
+	 * Returns true if this control validated successfully. 
85
+	 * Defaults to true.
86
+	 * @return bool wether this control validated successfully.
87
+	 */
88
+	public function getIsValid()
89
+	{
90
+		return $this->_isValid;
91
+	}
92
+	/**
93
+	 * @param bool wether this control is valid.
94
+	 */
95
+	public function setIsValid($value)
96
+	{
97
+		$this->_isValid=TPropertyValue::ensureBoolean($value);
98
+	}
99
+	public function getValidationPropertyValue()
100
+	{
101
+		return $this->Request[$this->getResponseFieldName()];
102
+	}
103
+	public function getResponseFieldName()
104
+	{
105
+		$captchas = $this->Page->findControlsByType('TReCaptcha2');
106
+		$cont = 0;
107
+		$responseFieldName = self::ChallengeFieldName;
108
+		foreach ($captchas as $captcha)
109
+		{
110
+			if ($this->getClientID() == $captcha->ClientID)
111
+			{
112
+				$responseFieldName .= ($cont > 0) ? '-'.$cont : '';
113
+			}
114
+			$cont++;
115
+		}
116
+		return $responseFieldName;
117
+	}
118
+	/**
119
+	 * Returns your site key. 
120
+	 * @return string.
121
+	 */
122
+	public function getSiteKey()
123
+	{
124
+		return $this->getViewState('SiteKey');
125
+	}
126
+	/**
127
+	 * @param string your site key.
128
+	 */
129
+	public function setSiteKey($value)
130
+	{
131
+		$this->setViewState('SiteKey', TPropertyValue::ensureString($value));
132
+	}
133
+	/**
134
+	 * Returns your secret key. 
135
+	 * @return string.
136
+	 */
137
+	public function getSecretKey()
138
+	{
139
+		return $this->getViewState('SecretKey');
140
+	}
141
+	/**
142
+	 * @param string your secret key.
143
+	 */
144
+	public function setSecretKey($value)
145
+	{
146
+		$this->setViewState('SecretKey', TPropertyValue::ensureString($value));
147
+	}
148
+	/**
149
+	 * Returns your language.
150
+	 * @return string.
151
+	 */
152
+	public function getLanguage()
153
+	{
154
+		return $this->getViewState('Language', 'en');
155
+	}
156
+	/**
157
+	 * @param string your language.
158
+	 */
159
+	public function setLanguage($value)
160
+	{
161
+		$this->setViewState('Language', TPropertyValue::ensureString($value), 'en');
162
+	}
163
+	/**
164
+	 * Returns the color theme of the widget. 
165
+	 * @return string.
166
+	 */
167
+	public function getTheme()
168
+	{
169
+		return $this->getViewState('Theme', 'light');
170
+	}
171
+	/**
172
+	 * The color theme of the widget.
173
+	 * Default: light
174
+	 * @param string the color theme of the widget.
175
+	 */
176
+	public function setTheme($value)
177
+	{
178
+		$this->setViewState('Theme', TPropertyValue::ensureString($value), 'light');
179
+	}
180
+	/**
181
+	 * Returns the type of CAPTCHA to serve.
182
+	 * @return string.
183
+	 */
184
+	public function getType()
185
+	{
186
+		return $this->getViewState('Type', 'image');
187
+	}
188
+	/**
189
+	 * The type of CAPTCHA to serve.
190
+	 * Default: image
191
+	 * @param string the type of CAPTCHA to serve.
192
+	 */
193
+	public function setType($value)
194
+	{
195
+		$this->setViewState('Type', TPropertyValue::ensureString($value), 'image');
196
+	}
197
+	/**
198
+	 * Returns the size of the widget.
199
+	 * @return string.
200
+	 */
201
+	public function getSize()
202
+	{
203
+		return $this->getViewState('Size', 'normal');
204
+	}
205
+	/**
206
+	 * The size of the widget.
207
+	 * Default: normal
208
+	 * @param string the size of the widget.
209
+	 */
210
+	public function setSize($value)
211
+	{
212
+		$this->setViewState('Size', TPropertyValue::ensureString($value), 'normal');
213
+	}
214
+	/**
215
+	 * Returns the tabindex of the widget and challenge.
216
+	 * If other elements in your page use tabindex, it should be set to make user navigation easier.
217
+	 * @return string.
218
+	 */
219
+	public function getTabIndex()
220
+	{
221
+		return $this->getViewState('TabIndex', 0);
222
+	}
223
+	/**
224
+	 * The tabindex of the widget and challenge.
225
+	 * If other elements in your page use tabindex, it should be set to make user navigation easier.
226
+	 * Default: 0
227
+	 * @param string the tabindex of the widget and challenge.
228
+	 */
229
+	public function setTabIndex($value)
230
+	{
231
+		$this->setViewState('TabIndex', TPropertyValue::ensureInteger($value), 0);
232
+	}
233
+	/**
234
+	 * Resets the reCAPTCHA widget.
235
+	 * Optional widget ID, defaults to the first widget created if unspecified.
236
+	 */
237
+	public function reset()
238
+	{
239
+		$this->Page->CallbackClient->callClientFunction('grecaptcha.reset',array(array($this->WidgetId)));
240
+	}
241
+	/**
242
+	 * Gets the response for the reCAPTCHA widget.
243
+	 */
244
+	public function getResponse()
245
+	{
246
+		return $this->getViewState('Response', '');
247
+	}
248
+	public function setResponse($value)
249
+	{
250
+		$this->setViewState('Response', TPropertyValue::ensureString($value), '');
251
+	}
252
+	public function getWidgetId()
253
+	{
254
+		return $this->getViewState('WidgetId', 0);
255
+	}
256
+	public function setWidgetId($value)
257
+	{
258
+		$this->setViewState('WidgetId', TPropertyValue::ensureInteger($value), 0);
259
+	}
260
+	protected function getClientOptions()
261
+	{
262
+		$options['ID'] = $this->getClientID();
263
+		$options['EventTarget'] = $this->getUniqueID();
264
+		$options['FormID'] = $this->Page->getForm()->getClientID();
265
+		$options['onCallback'] = $this->hasEventHandler('OnCallback');
266
+		$options['onCallbackExpired'] = $this->hasEventHandler('OnCallbackExpired');
267
+		$options['options']['sitekey'] = $this->getSiteKey();
268
+		if ($theme = $this->getTheme()) $options['options']['theme'] = $theme;
269
+		if ($type = $this->getType()) $options['options']['type'] = $type;
270
+		if ($size = $this->getSize()) $options['options']['size'] = $size;
271
+		if ($tabIndex = $this->getTabIndex()) $options['options']['tabindex'] = $tabIndex;
272 272
 
273
-        return $options;
274
-    }
275
-    protected function registerClientScript()
276
-    {
277
-        $id         = $this->getClientID();
278
-        $options    = TJavaScript::encode($this->getClientOptions());
279
-        $className  = $this->getClientClassName();
280
-        $cs         = $this->Page->ClientScript;
281
-        $code       = "new $className($options);";
273
+		return $options;
274
+	}
275
+	protected function registerClientScript()
276
+	{
277
+		$id         = $this->getClientID();
278
+		$options    = TJavaScript::encode($this->getClientOptions());
279
+		$className  = $this->getClientClassName();
280
+		$cs         = $this->Page->ClientScript;
281
+		$code       = "new $className($options);";
282 282
 
283
-        $cs->registerPradoScript('ajax');
284
-        $cs->registerEndScript("grecaptcha:$id", $code);
285
-    }
286
-    public function validate()
287
-    {
288
-        $value = $this->getValidationPropertyValue();
289
-        if($value === null || empty($value))
290
-            return false;
283
+		$cs->registerPradoScript('ajax');
284
+		$cs->registerEndScript("grecaptcha:$id", $code);
285
+	}
286
+	public function validate()
287
+	{
288
+		$value = $this->getValidationPropertyValue();
289
+		if($value === null || empty($value))
290
+			return false;
291 291
 
292
-        return true;
293
-    }
294
-    /**
295
-     * Checks for API keys
296
-     * @param mixed event parameter
297
-     */
298
-    public function onPreRender($param)
299
-    {
300
-        parent::onPreRender($param);
292
+		return true;
293
+	}
294
+	/**
295
+	 * Checks for API keys
296
+	 * @param mixed event parameter
297
+	 */
298
+	public function onPreRender($param)
299
+	{
300
+		parent::onPreRender($param);
301 301
 
302
-        if("" == $this->getSiteKey())
303
-            throw new TConfigurationException('recaptcha_publickey_unknown');
304
-        if("" == $this->getSecretKey())
305
-            throw new TConfigurationException('recaptcha_privatekey_unknown');
302
+		if("" == $this->getSiteKey())
303
+			throw new TConfigurationException('recaptcha_publickey_unknown');
304
+		if("" == $this->getSecretKey())
305
+			throw new TConfigurationException('recaptcha_privatekey_unknown');
306 306
 
307
-        // need to register captcha fields so they will be sent postback
308
-        $this->Page->registerRequiresPostData($this->getResponseFieldName());
309
-        $this->Page->ClientScript->registerHeadScriptFile('grecaptcha2', 'https://www.google.com/recaptcha/api.js?onload=TReCaptcha2_onloadCallback&render=explicit&hl=' . $this->getLanguage());
310
-    }
311
-    protected function addAttributesToRender($writer)
312
-    {
313
-        $writer->addAttribute('id',$this->getClientID());
314
-        parent::addAttributesToRender($writer);
315
-    }
316
-    public function raiseCallbackEvent($param)
317
-    {
318
-        $params = $param->getCallbackParameter();
319
-        if ($params instanceof stdClass)
320
-        {
321
-            $callback = property_exists($params, 'onCallback');
322
-            $callbackExpired = property_exists($params, 'onCallbackExpired');
307
+		// need to register captcha fields so they will be sent postback
308
+		$this->Page->registerRequiresPostData($this->getResponseFieldName());
309
+		$this->Page->ClientScript->registerHeadScriptFile('grecaptcha2', 'https://www.google.com/recaptcha/api.js?onload=TReCaptcha2_onloadCallback&render=explicit&hl=' . $this->getLanguage());
310
+	}
311
+	protected function addAttributesToRender($writer)
312
+	{
313
+		$writer->addAttribute('id',$this->getClientID());
314
+		parent::addAttributesToRender($writer);
315
+	}
316
+	public function raiseCallbackEvent($param)
317
+	{
318
+		$params = $param->getCallbackParameter();
319
+		if ($params instanceof stdClass)
320
+		{
321
+			$callback = property_exists($params, 'onCallback');
322
+			$callbackExpired = property_exists($params, 'onCallbackExpired');
323 323
 
324
-            if ($callback)
325
-            {
326
-                $this->WidgetId = $params->widgetId;
327
-                $this->Response = $params->response;
328
-                $this->Page->CallbackClient->jQuery($params->responseField, 'text',array($params->response));
324
+			if ($callback)
325
+			{
326
+				$this->WidgetId = $params->widgetId;
327
+				$this->Response = $params->response;
328
+				$this->Page->CallbackClient->jQuery($params->responseField, 'text',array($params->response));
329 329
 
330
-                if ($params->onCallback)
331
-                {
332
-                    $this->onCallback($param);
333
-                }
334
-            }
330
+				if ($params->onCallback)
331
+				{
332
+					$this->onCallback($param);
333
+				}
334
+			}
335 335
 
336
-            if ($callbackExpired)
337
-            {
338
-                $this->Response = '';
339
-                $this->reset();
336
+			if ($callbackExpired)
337
+			{
338
+				$this->Response = '';
339
+				$this->reset();
340 340
 
341
-                if ($params->onCallbackExpired)
342
-                {
343
-                    $this->onCallbackExpired($param);
344
-                }
345
-            }
346
-        }
347
-    }
341
+				if ($params->onCallbackExpired)
342
+				{
343
+					$this->onCallbackExpired($param);
344
+				}
345
+			}
346
+		}
347
+	}
348 348
 
349
-    public function onCallback($param)
350
-    {
351
-        $this->raiseEvent('OnCallback', $this, $param);
352
-    }
349
+	public function onCallback($param)
350
+	{
351
+		$this->raiseEvent('OnCallback', $this, $param);
352
+	}
353 353
 
354
-    public function onCallbackExpired($param)
355
-    {
356
-        $this->raiseEvent('OnCallbackExpired', $this, $param);
357
-    }
354
+	public function onCallbackExpired($param)
355
+	{
356
+		$this->raiseEvent('OnCallbackExpired', $this, $param);
357
+	}
358 358
 
359
-    public function render($writer)
360
-    {
361
-        $this->registerClientScript();
362
-        parent::render($writer);
363
-    }
359
+	public function render($writer)
360
+	{
361
+		$this->registerClientScript();
362
+		parent::render($writer);
363
+	}
364 364
 }
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 class TReCaptcha2 extends TActivePanel implements ICallbackEventHandler, IValidatable
57 57
 {
58
-    const ChallengeFieldName = 'g-recaptcha-response';
58
+    const ChallengeFieldName='g-recaptcha-response';
59 59
     private $_widgetId=0;
60 60
     private $_isValid=true;
61 61
 
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
     }
103 103
     public function getResponseFieldName()
104 104
     {
105
-        $captchas = $this->Page->findControlsByType('TReCaptcha2');
106
-        $cont = 0;
107
-        $responseFieldName = self::ChallengeFieldName;
108
-        foreach ($captchas as $captcha)
105
+        $captchas=$this->Page->findControlsByType('TReCaptcha2');
106
+        $cont=0;
107
+        $responseFieldName=self::ChallengeFieldName;
108
+        foreach($captchas as $captcha)
109 109
         {
110
-            if ($this->getClientID() == $captcha->ClientID)
110
+            if($this->getClientID()==$captcha->ClientID)
111 111
             {
112
-                $responseFieldName .= ($cont > 0) ? '-'.$cont : '';
112
+                $responseFieldName.=($cont > 0) ? '-'.$cont : '';
113 113
             }
114 114
             $cont++;
115 115
         }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function reset()
238 238
     {
239
-        $this->Page->CallbackClient->callClientFunction('grecaptcha.reset',array(array($this->WidgetId)));
239
+        $this->Page->CallbackClient->callClientFunction('grecaptcha.reset', array(array($this->WidgetId)));
240 240
     }
241 241
     /**
242 242
      * Gets the response for the reCAPTCHA widget.
@@ -259,34 +259,34 @@  discard block
 block discarded – undo
259 259
     }
260 260
     protected function getClientOptions()
261 261
     {
262
-        $options['ID'] = $this->getClientID();
263
-        $options['EventTarget'] = $this->getUniqueID();
264
-        $options['FormID'] = $this->Page->getForm()->getClientID();
265
-        $options['onCallback'] = $this->hasEventHandler('OnCallback');
266
-        $options['onCallbackExpired'] = $this->hasEventHandler('OnCallbackExpired');
267
-        $options['options']['sitekey'] = $this->getSiteKey();
268
-        if ($theme = $this->getTheme()) $options['options']['theme'] = $theme;
269
-        if ($type = $this->getType()) $options['options']['type'] = $type;
270
-        if ($size = $this->getSize()) $options['options']['size'] = $size;
271
-        if ($tabIndex = $this->getTabIndex()) $options['options']['tabindex'] = $tabIndex;
262
+        $options['ID']=$this->getClientID();
263
+        $options['EventTarget']=$this->getUniqueID();
264
+        $options['FormID']=$this->Page->getForm()->getClientID();
265
+        $options['onCallback']=$this->hasEventHandler('OnCallback');
266
+        $options['onCallbackExpired']=$this->hasEventHandler('OnCallbackExpired');
267
+        $options['options']['sitekey']=$this->getSiteKey();
268
+        if($theme=$this->getTheme()) $options['options']['theme']=$theme;
269
+        if($type=$this->getType()) $options['options']['type']=$type;
270
+        if($size=$this->getSize()) $options['options']['size']=$size;
271
+        if($tabIndex=$this->getTabIndex()) $options['options']['tabindex']=$tabIndex;
272 272
 
273 273
         return $options;
274 274
     }
275 275
     protected function registerClientScript()
276 276
     {
277
-        $id         = $this->getClientID();
278
-        $options    = TJavaScript::encode($this->getClientOptions());
279
-        $className  = $this->getClientClassName();
280
-        $cs         = $this->Page->ClientScript;
281
-        $code       = "new $className($options);";
277
+        $id=$this->getClientID();
278
+        $options=TJavaScript::encode($this->getClientOptions());
279
+        $className=$this->getClientClassName();
280
+        $cs=$this->Page->ClientScript;
281
+        $code="new $className($options);";
282 282
 
283 283
         $cs->registerPradoScript('ajax');
284 284
         $cs->registerEndScript("grecaptcha:$id", $code);
285 285
     }
286 286
     public function validate()
287 287
     {
288
-        $value = $this->getValidationPropertyValue();
289
-        if($value === null || empty($value))
288
+        $value=$this->getValidationPropertyValue();
289
+        if($value===null || empty($value))
290 290
             return false;
291 291
 
292 292
         return true;
@@ -299,46 +299,46 @@  discard block
 block discarded – undo
299 299
     {
300 300
         parent::onPreRender($param);
301 301
 
302
-        if("" == $this->getSiteKey())
302
+        if(""==$this->getSiteKey())
303 303
             throw new TConfigurationException('recaptcha_publickey_unknown');
304
-        if("" == $this->getSecretKey())
304
+        if(""==$this->getSecretKey())
305 305
             throw new TConfigurationException('recaptcha_privatekey_unknown');
306 306
 
307 307
         // need to register captcha fields so they will be sent postback
308 308
         $this->Page->registerRequiresPostData($this->getResponseFieldName());
309
-        $this->Page->ClientScript->registerHeadScriptFile('grecaptcha2', 'https://www.google.com/recaptcha/api.js?onload=TReCaptcha2_onloadCallback&render=explicit&hl=' . $this->getLanguage());
309
+        $this->Page->ClientScript->registerHeadScriptFile('grecaptcha2', 'https://www.google.com/recaptcha/api.js?onload=TReCaptcha2_onloadCallback&render=explicit&hl='.$this->getLanguage());
310 310
     }
311 311
     protected function addAttributesToRender($writer)
312 312
     {
313
-        $writer->addAttribute('id',$this->getClientID());
313
+        $writer->addAttribute('id', $this->getClientID());
314 314
         parent::addAttributesToRender($writer);
315 315
     }
316 316
     public function raiseCallbackEvent($param)
317 317
     {
318
-        $params = $param->getCallbackParameter();
319
-        if ($params instanceof stdClass)
318
+        $params=$param->getCallbackParameter();
319
+        if($params instanceof stdClass)
320 320
         {
321
-            $callback = property_exists($params, 'onCallback');
322
-            $callbackExpired = property_exists($params, 'onCallbackExpired');
321
+            $callback=property_exists($params, 'onCallback');
322
+            $callbackExpired=property_exists($params, 'onCallbackExpired');
323 323
 
324
-            if ($callback)
324
+            if($callback)
325 325
             {
326
-                $this->WidgetId = $params->widgetId;
327
-                $this->Response = $params->response;
328
-                $this->Page->CallbackClient->jQuery($params->responseField, 'text',array($params->response));
326
+                $this->WidgetId=$params->widgetId;
327
+                $this->Response=$params->response;
328
+                $this->Page->CallbackClient->jQuery($params->responseField, 'text', array($params->response));
329 329
 
330
-                if ($params->onCallback)
330
+                if($params->onCallback)
331 331
                 {
332 332
                     $this->onCallback($param);
333 333
                 }
334 334
             }
335 335
 
336
-            if ($callbackExpired)
336
+            if($callbackExpired)
337 337
             {
338
-                $this->Response = '';
338
+                $this->Response='';
339 339
                 $this->reset();
340 340
 
341
-                if ($params->onCallbackExpired)
341
+                if($params->onCallbackExpired)
342 342
                 {
343 343
                     $this->onCallbackExpired($param);
344 344
                 }
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TStyleSheet.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function getMediaType()
84 84
 	{
85
-		return $this->getViewState('MediaType','');
85
+		return $this->getViewState('MediaType', '');
86 86
 	}
87 87
 
88 88
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function setMediaType($value)
92 92
 	{
93
-		$this->setViewState('MediaType',$value,'');
93
+		$this->setViewState('MediaType', $value, '');
94 94
 	}
95 95
 
96 96
 	/**
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function onPreRender($param)
102 102
 	{
103
-		$cs = $this->getPage()->getClientScript();
103
+		$cs=$this->getPage()->getClientScript();
104 104
 
105
-		$styles = preg_split('/,|\s+/', $this->getPradoStyles());
105
+		$styles=preg_split('/,|\s+/', $this->getPradoStyles());
106 106
 		foreach($styles as $style)
107 107
 		{
108
-			if(($style = trim($style))!=='')
108
+			if(($style=trim($style))!=='')
109 109
 				$cs->registerPradoStyle($style);
110 110
 		}
111 111
 
112 112
 		if(($url=$this->getStyleSheetUrl())!=='')
113
-			$cs->registerStyleSheetFile($url,$url,$this->getMediaType());
113
+			$cs->registerStyleSheetFile($url, $url, $this->getMediaType());
114 114
 	}
115 115
 
116 116
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TStyle.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 	 */
74 74
 	public function __construct($style=null)
75 75
 	{
76
-    parent::__construct();
76
+	parent::__construct();
77 77
 		if($style!==null)
78 78
 			$this->copyFrom($style);
79 79
 	}
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	}
229 229
 
230 230
 	/**
231
-	 * @return TDisplayStyle display style
231
+	 * @return string display style
232 232
 	 */
233 233
 	public function getDisplayStyle()
234 234
 	{
@@ -285,6 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * Sets custom style fields from a string.
286 286
 	 * Custom style fields will be overwritten by style fields explicitly defined.
287 287
 	 * @param string the custom style of the control
288
+	 * @param string $value
288 289
 	 */
289 290
 	public function setCustomStyle($value)
290 291
 	{
@@ -304,6 +305,8 @@  discard block
 block discarded – undo
304 305
 	 * Style fields set by this method will overwrite those set by {@link setCustomStyle}.
305 306
 	 * @param string style field name
306 307
 	 * @param string style field value
308
+	 * @param string $name
309
+	 * @param string $value
307 310
 	 */
308 311
 	public function setStyleField($name,$value)
309 312
 	{
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
 	protected function _getZappableSleepProps(&$exprops)
54 54
 	{
55 55
 		parent::_getZappableSleepProps($exprops);
56
-		if ($this->_fields===array())
57
-			$exprops[] = "\0TStyle\0_fields";
56
+		if($this->_fields===array())
57
+			$exprops[]="\0TStyle\0_fields";
58 58
 		if($this->_font===null)
59
-			$exprops[] = "\0TStyle\0_font";
59
+			$exprops[]="\0TStyle\0_font";
60 60
 		if($this->_class===null)
61
-			$exprops[] = "\0TStyle\0_class";
62
-		if ($this->_customStyle===null)
63
-			$exprops[] = "\0TStyle\0_customStyle";
64
-		if ($this->_displayStyle==='Fixed')
65
-			$exprops[] = "\0TStyle\0_displayStyle";
61
+			$exprops[]="\0TStyle\0_class";
62
+		if($this->_customStyle===null)
63
+			$exprops[]="\0TStyle\0_customStyle";
64
+		if($this->_displayStyle==='Fixed')
65
+			$exprops[]="\0TStyle\0_displayStyle";
66 66
 	}
67 67
 
68 68
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public function __clone()
83 83
 	{
84 84
 		if($this->_font!==null)
85
-			$this->_font = clone($this->_font);
85
+			$this->_font=clone($this->_font);
86 86
 	}
87 87
 
88 88
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function getBackColor()
92 92
 	{
93
-		return isset($this->_fields['background-color'])?$this->_fields['background-color']:'';
93
+		return isset($this->_fields['background-color']) ? $this->_fields['background-color'] : '';
94 94
 	}
95 95
 
96 96
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function getBorderColor()
111 111
 	{
112
-		return isset($this->_fields['border-color'])?$this->_fields['border-color']:'';
112
+		return isset($this->_fields['border-color']) ? $this->_fields['border-color'] : '';
113 113
 	}
114 114
 
115 115
 	/**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function getBorderStyle()
130 130
 	{
131
-		return isset($this->_fields['border-style'])?$this->_fields['border-style']:'';
131
+		return isset($this->_fields['border-style']) ? $this->_fields['border-style'] : '';
132 132
 	}
133 133
 
134 134
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function getBorderWidth()
150 150
 	{
151
-		return isset($this->_fields['border-width'])?$this->_fields['border-width']:'';
151
+		return isset($this->_fields['border-width']) ? $this->_fields['border-width'] : '';
152 152
 	}
153 153
 
154 154
 	/**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function getCssClass()
169 169
 	{
170
-		return $this->_class===null?'':$this->_class;
170
+		return $this->_class===null ? '' : $this->_class;
171 171
 	}
172 172
 
173 173
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 */
202 202
 	public function hasFont()
203 203
 	{
204
-		return $this->_font !== null;
204
+		return $this->_font!==null;
205 205
 	}
206 206
 
207 207
 	/**
@@ -209,20 +209,20 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public function setDisplayStyle($value)
211 211
 	{
212
-		$this->_displayStyle = TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TDisplayStyle');
212
+		$this->_displayStyle=TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TDisplayStyle');
213 213
 		switch($this->_displayStyle)
214 214
 		{
215 215
 			case TDisplayStyle::None:
216
-				$this->_fields['display'] = 'none';
216
+				$this->_fields['display']='none';
217 217
 				break;
218 218
 			case TDisplayStyle::Dynamic:
219
-				$this->_fields['display'] = ''; //remove the display property
219
+				$this->_fields['display']=''; //remove the display property
220 220
 				break;
221 221
 			case TDisplayStyle::Fixed:
222
-				$this->_fields['visibility'] = 'visible';
222
+				$this->_fields['visibility']='visible';
223 223
 				break;
224 224
 			case TDisplayStyle::Hidden:
225
-				$this->_fields['visibility'] = 'hidden';
225
+				$this->_fields['visibility']='hidden';
226 226
 				break;
227 227
 		}
228 228
 	}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function getForeColor()
242 242
 	{
243
-		return isset($this->_fields['color'])?$this->_fields['color']:'';
243
+		return isset($this->_fields['color']) ? $this->_fields['color'] : '';
244 244
 	}
245 245
 
246 246
 	/**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	public function getHeight()
261 261
 	{
262
-		return isset($this->_fields['height'])?$this->_fields['height']:'';
262
+		return isset($this->_fields['height']) ? $this->_fields['height'] : '';
263 263
 	}
264 264
 
265 265
 	/**
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function getCustomStyle()
280 280
 	{
281
-		return $this->_customStyle===null?'':$this->_customStyle;
281
+		return $this->_customStyle===null ? '' : $this->_customStyle;
282 282
 	}
283 283
 
284 284
 	/**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public function getStyleField($name)
298 298
 	{
299
-		return isset($this->_fields[$name])?$this->_fields[$name]:'';
299
+		return isset($this->_fields[$name]) ? $this->_fields[$name] : '';
300 300
 	}
301 301
 
302 302
 	/**
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	 * @param string style field name
306 306
 	 * @param string style field value
307 307
 	 */
308
-	public function setStyleField($name,$value)
308
+	public function setStyleField($name, $value)
309 309
 	{
310 310
 		$this->_fields[$name]=$value;
311 311
 	}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	public function getWidth()
334 334
 	{
335
-		return isset($this->_fields['width'])?$this->_fields['width']:'';
335
+		return isset($this->_fields['width']) ? $this->_fields['width'] : '';
336 336
 	}
337 337
 
338 338
 	/**
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	{
365 365
 		if($style instanceof TStyle)
366 366
 		{
367
-			$this->_fields=array_merge($this->_fields,$style->_fields);
367
+			$this->_fields=array_merge($this->_fields, $style->_fields);
368 368
 			if($style->_class!==null)
369 369
 				$this->_class=$style->_class;
370 370
 			if($style->_customStyle!==null)
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	{
385 385
 		if($style instanceof TStyle)
386 386
 		{
387
-			$this->_fields=array_merge($style->_fields,$this->_fields);
387
+			$this->_fields=array_merge($style->_fields, $this->_fields);
388 388
 			if($this->_class===null)
389 389
 				$this->_class=$style->_class;
390 390
 			if($this->_customStyle===null)
@@ -402,18 +402,18 @@  discard block
 block discarded – undo
402 402
 	{
403 403
 		if($this->_customStyle!==null)
404 404
 		{
405
-			foreach(explode(';',$this->_customStyle) as $style)
405
+			foreach(explode(';', $this->_customStyle) as $style)
406 406
 			{
407
-				$arr=explode(':',$style,2);
407
+				$arr=explode(':', $style, 2);
408 408
 				if(isset($arr[1]) && trim($arr[0])!=='')
409
-					$writer->addStyleAttribute(trim($arr[0]),trim($arr[1]));
409
+					$writer->addStyleAttribute(trim($arr[0]), trim($arr[1]));
410 410
 			}
411 411
 		}
412 412
 		$writer->addStyleAttributes($this->_fields);
413 413
 		if($this->_font!==null)
414 414
 			$this->_font->addAttributesToRender($writer);
415 415
 		if($this->_class!==null)
416
-			$writer->addAttribute('class',$this->_class);
416
+			$writer->addAttribute('class', $this->_class);
417 417
 	}
418 418
 
419 419
 	/**
Please login to merge, or discard this patch.
framework/Caching/ICache.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -149,6 +149,7 @@
 block discarded – undo
149 149
 	/**
150 150
 	 * Finds the database connection instance from the Application modules.
151 151
 	 * @param string Database connection module ID.
152
+	 * @param string $id
152 153
 	 * @return TDbConnection database connection.
153 154
 	 * @throws TConfigurationException when module is not of TDbConnection or TDataSourceConfig.
154 155
 	 */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid.
201 201
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
202 202
 	 */
203
-	public function set($id,$value,$expire=0,$dependency=null);
203
+	public function set($id, $value, $expire=0, $dependency=null);
204 204
 	/**
205 205
 	 * Stores a value identified by a key into cache if the cache does not contain this key.
206 206
 	 * Nothing will be done if the cache already contains the key.
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid.
211 211
 	 * @return boolean true if the value is successfully stored into cache, false otherwise
212 212
 	 */
213
-	public function add($id,$value,$expire=0,$dependency=null);
213
+	public function add($id, $value, $expire=0, $dependency=null);
214 214
 	/**
215 215
 	 * Deletes a value with the specified key from cache
216 216
 	 * @param string the key of the value to be deleted
Please login to merge, or discard this patch.