@@ -88,7 +88,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'; |
@@ -94,7 +94,7 @@ discard block |
||
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 |
||
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 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TActiveTextBox class file. |
|
4 | - * |
|
5 | - * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
6 | - * @link https://github.com/pradosoft/prado |
|
7 | - * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @package System.Web.UI.ActiveControls |
|
10 | - */ |
|
3 | + * TActiveTextBox class file. |
|
4 | + * |
|
5 | + * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
6 | + * @link https://github.com/pradosoft/prado |
|
7 | + * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @package System.Web.UI.ActiveControls |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Load active control adapter. |
@@ -29,82 +29,82 @@ |
||
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 |
@@ -29,7 +29,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | '{', |
@@ -55,310 +55,310 @@ |
||
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 | } |
@@ -55,7 +55,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TTableFooterRow class file |
|
4 | - * |
|
5 | - * @author Qiang Xue <[email protected]> |
|
6 | - * @link https://github.com/pradosoft/prado |
|
7 | - * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @package System.Web.UI.WebControls |
|
10 | - */ |
|
3 | + * TTableFooterRow class file |
|
4 | + * |
|
5 | + * @author Qiang Xue <[email protected]> |
|
6 | + * @link https://github.com/pradosoft/prado |
|
7 | + * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @package System.Web.UI.WebControls |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Includes TTableRow class. |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | //$Id: packages.php 3319 2013-09-08 20:59:44Z ctrlaltca $ |
4 | 4 | |
5 | 5 | // To make future upgrades easier |
6 | -if (!defined('JQUERY_DIR')) define ('JQUERY_DIR', 'jquery'); |
|
7 | -if (!defined('BOOTSTRAP_DIR')) define ('BOOTSTRAP_DIR', 'bootstrap3'); |
|
6 | +if(!defined('JQUERY_DIR')) define('JQUERY_DIR', 'jquery'); |
|
7 | +if(!defined('BOOTSTRAP_DIR')) define('BOOTSTRAP_DIR', 'bootstrap3'); |
|
8 | 8 | |
9 | 9 | //package names and its contents (files relative to the current directory) |
10 | -$packages = array( |
|
10 | +$packages=array( |
|
11 | 11 | 'jquery-ui' => array( |
12 | 12 | JQUERY_DIR.'/css/base/jquery-ui.css', |
13 | 13 | ), |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | |
70 | 70 | //package names and their dependencies |
71 | -$dependencies = array( |
|
71 | +$dependencies=array( |
|
72 | 72 | 'jquery-ui' => array('jquery-ui'), |
73 | 73 | 'jquery.ui.accordion' => array('jquery.ui.core', 'jquery.ui.accordion'), |
74 | 74 | 'jquery.ui.autocomplete' => array('jquery.ui.core', 'jquery.ui.autocomplete'), |
@@ -82,7 +82,7 @@ discard block |
||
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 |
||
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 |
||
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 | /** |