@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | { |
56 | 56 | private $_isValid=true; |
57 | 57 | |
58 | - const ChallengeFieldName = 'recaptcha_challenge_field'; |
|
59 | - const ResponseFieldName = 'recaptcha_response_field'; |
|
58 | + const ChallengeFieldName='recaptcha_challenge_field'; |
|
59 | + const ResponseFieldName='recaptcha_response_field'; |
|
60 | 60 | |
61 | 61 | public function getTagName() |
62 | 62 | { |
@@ -157,28 +157,27 @@ discard block |
||
157 | 157 | |
158 | 158 | public function getClientSideOptions() |
159 | 159 | { |
160 | - $options = array(); |
|
161 | - if ($theme = $this->getThemeName()) |
|
162 | - $options['theme'] = $theme; |
|
163 | - if ($lang = $this->getLanguage()) |
|
164 | - $options['lang'] = $lang; |
|
165 | - if ($trans = $this->getCustomTranslations()) |
|
166 | - $options['custom_translations'] = $trans; |
|
160 | + $options=array(); |
|
161 | + if($theme=$this->getThemeName()) |
|
162 | + $options['theme']=$theme; |
|
163 | + if($lang=$this->getLanguage()) |
|
164 | + $options['lang']=$lang; |
|
165 | + if($trans=$this->getCustomTranslations()) |
|
166 | + $options['custom_translations']=$trans; |
|
167 | 167 | return $options; |
168 | 168 | } |
169 | 169 | |
170 | 170 | public function validate() |
171 | 171 | { |
172 | - if (! |
|
173 | - ( |
|
174 | - ($challenge = @$_POST[$this->getChallengeFieldName()]) |
|
172 | + if(!( |
|
173 | + ($challenge=@$_POST[$this->getChallengeFieldName()]) |
|
175 | 174 | and |
176 | - ($response = @$_POST[$this->getResponseFieldName()]) |
|
175 | + ($response=@$_POST[$this->getResponseFieldName()]) |
|
177 | 176 | ) |
178 | 177 | ) |
179 | 178 | return false; |
180 | 179 | |
181 | - $resp = recaptcha_check_answer( |
|
180 | + $resp=recaptcha_check_answer( |
|
182 | 181 | $this->getPrivateKey(), |
183 | 182 | $_SERVER["REMOTE_ADDR"], |
184 | 183 | $challenge, |
@@ -195,13 +194,13 @@ discard block |
||
195 | 194 | { |
196 | 195 | parent::onPreRender($param); |
197 | 196 | |
198 | - if("" == $this->getPublicKey()) |
|
197 | + if(""==$this->getPublicKey()) |
|
199 | 198 | throw new TConfigurationException('recaptcha_publickey_unknown'); |
200 | - if("" == $this->getPrivateKey()) |
|
199 | + if(""==$this->getPrivateKey()) |
|
201 | 200 | throw new TConfigurationException('recaptcha_privatekey_unknown'); |
202 | 201 | |
203 | 202 | // need to register captcha fields so they will be sent back also in callbacks |
204 | - $page = $this->getPage(); |
|
203 | + $page=$this->getPage(); |
|
205 | 204 | $page->registerRequiresPostData($this->getChallengeFieldName()); |
206 | 205 | $page->registerRequiresPostData($this->getResponseFieldName()); |
207 | 206 | } |
@@ -209,32 +208,32 @@ discard block |
||
209 | 208 | protected function addAttributesToRender($writer) |
210 | 209 | { |
211 | 210 | parent::addAttributesToRender($writer); |
212 | - $writer->addAttribute('id',$this->getClientID()); |
|
211 | + $writer->addAttribute('id', $this->getClientID()); |
|
213 | 212 | } |
214 | 213 | |
215 | 214 | public function regenerateToken() |
216 | 215 | { |
217 | 216 | // if we're in a callback, then schedule re-rendering of the control |
218 | 217 | // if not, don't do anything, because a new challenge will be rendered anyway |
219 | - if ($this->Page->IsCallback) |
|
220 | - $this->Page->CallbackClient->jQuery($this->getClientID().' #recaptcha_reload','click'); |
|
218 | + if($this->Page->IsCallback) |
|
219 | + $this->Page->CallbackClient->jQuery($this->getClientID().' #recaptcha_reload', 'click'); |
|
221 | 220 | } |
222 | 221 | |
223 | 222 | public function renderContents($writer) |
224 | 223 | { |
225 | - $readyscript = 'jQuery(document).trigger('.TJavaScript::quoteString('captchaready:'.$this->getClientID()).')'; |
|
226 | - $cs = $this->Page->ClientScript; |
|
227 | - $id = $this->getClientID(); |
|
228 | - $divid = $id.'_1_recaptchadiv'; |
|
224 | + $readyscript='jQuery(document).trigger('.TJavaScript::quoteString('captchaready:'.$this->getClientID()).')'; |
|
225 | + $cs=$this->Page->ClientScript; |
|
226 | + $id=$this->getClientID(); |
|
227 | + $divid=$id.'_1_recaptchadiv'; |
|
229 | 228 | $writer->write('<div id="'.htmlspecialchars($divid).'">'); |
230 | 229 | |
231 | - if (!$this->Page->IsCallback) |
|
230 | + if(!$this->Page->IsCallback) |
|
232 | 231 | { |
233 | 232 | $writer->write(TJavaScript::renderScriptBlock( |
234 | 233 | 'var RecaptchaOptions = '.TJavaScript::jsonEncode($this->getClientSideOptions()).';' |
235 | 234 | )); |
236 | 235 | |
237 | - $html = recaptcha_get_html($this->getPublicKey()); |
|
236 | + $html=recaptcha_get_html($this->getPublicKey()); |
|
238 | 237 | /* |
239 | 238 | reCAPTCHA currently does not support multiple validations per page |
240 | 239 | $html = str_replace( |
@@ -249,8 +248,8 @@ discard block |
||
249 | 248 | } |
250 | 249 | else |
251 | 250 | { |
252 | - $options = $this->getClientSideOptions(); |
|
253 | - $options['callback'] = new TJavaScriptLiteral('function() { '.$readyscript.'; '.$this->getCallbackScript().'; }'); |
|
251 | + $options=$this->getClientSideOptions(); |
|
252 | + $options['callback']=new TJavaScriptLiteral('function() { '.$readyscript.'; '.$this->getCallbackScript().'; }'); |
|
254 | 253 | $cs->registerScriptFile('ReCaptcha::AjaxScript', 'http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'); |
255 | 254 | $cs->registerEndScript('ReCaptcha::CreateScript::'.$id, implode(' ', array( |
256 | 255 | 'if (!jQuery('.TJavaScript::quoteString('#'.$this->getResponseFieldName()).'))', |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | { |
47 | 47 | $isEnabled=$this->getEnabled(true); |
48 | 48 | if($this->getEnabled() && !$isEnabled) |
49 | - $writer->addAttribute('disabled','disabled'); |
|
49 | + $writer->addAttribute('disabled', 'disabled'); |
|
50 | 50 | parent::addAttributesToRender($writer); |
51 | 51 | if(($url=$this->getNavigateUrl())!=='' && $isEnabled) |
52 | - $writer->addAttribute('href',$url); |
|
52 | + $writer->addAttribute('href', $url); |
|
53 | 53 | if(($target=$this->getTarget())!=='') |
54 | - $writer->addAttribute('target',$target); |
|
54 | + $writer->addAttribute('target', $target); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getText() |
106 | 106 | { |
107 | - return $this->getViewState('Text',''); |
|
107 | + return $this->getViewState('Text', ''); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function setText($value) |
115 | 115 | { |
116 | - $this->setViewState('Text',$value,''); |
|
116 | + $this->setViewState('Text', $value, ''); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function getImageAlign() |
123 | 123 | { |
124 | - return $this->getViewState('ImageAlign',''); |
|
124 | + return $this->getViewState('ImageAlign', ''); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function setImageAlign($value) |
135 | 135 | { |
136 | - $this->setViewState('ImageAlign',$value,''); |
|
136 | + $this->setViewState('ImageAlign', $value, ''); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function getImageHeight() |
143 | 143 | { |
144 | - return $this->getViewState('ImageHeight',''); |
|
144 | + return $this->getViewState('ImageHeight', ''); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function setImageHeight($value) |
152 | 152 | { |
153 | - $this->setViewSTate('ImageHeight',$value,''); |
|
153 | + $this->setViewSTate('ImageHeight', $value, ''); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function getImageUrl() |
160 | 160 | { |
161 | - return $this->getViewState('ImageUrl',''); |
|
161 | + return $this->getViewState('ImageUrl', ''); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function setImageUrl($value) |
169 | 169 | { |
170 | - $this->setViewState('ImageUrl',$value,''); |
|
170 | + $this->setViewState('ImageUrl', $value, ''); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getImageWidth() |
177 | 177 | { |
178 | - return $this->getViewState('ImageWidth',''); |
|
178 | + return $this->getViewState('ImageWidth', ''); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function setImageWidth($value) |
186 | 186 | { |
187 | - $this->setViewState('ImageWidth',$value,''); |
|
187 | + $this->setViewState('ImageWidth', $value, ''); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function getNavigateUrl() |
194 | 194 | { |
195 | - return $this->getViewState('NavigateUrl',''); |
|
195 | + return $this->getViewState('NavigateUrl', ''); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function setNavigateUrl($value) |
203 | 203 | { |
204 | - $this->setViewState('NavigateUrl',$value,''); |
|
204 | + $this->setViewState('NavigateUrl', $value, ''); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function getTarget() |
237 | 237 | { |
238 | - return $this->getViewState('Target',''); |
|
238 | + return $this->getViewState('Target', ''); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function setTarget($value) |
246 | 246 | { |
247 | - $this->setViewState('Target',$value,''); |
|
247 | + $this->setViewState('Target', $value, ''); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class TReCaptchaValidator extends TBaseValidator |
32 | 32 | { |
33 | - protected $_isvalid = null; |
|
33 | + protected $_isvalid=null; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Gets the name of the javascript class responsible for performing validation for this control. |
@@ -49,18 +49,18 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function getCaptchaControl() |
51 | 51 | { |
52 | - $control = $this->getValidationTarget(); |
|
53 | - if (!$control) |
|
52 | + $control=$this->getValidationTarget(); |
|
53 | + if(!$control) |
|
54 | 54 | throw new Exception('No target control specified for TReCaptchaValidator'); |
55 | - if (!($control instanceof TReCaptcha)) |
|
55 | + if(!($control instanceof TReCaptcha)) |
|
56 | 56 | throw new Exception('TReCaptchaValidator only works with TReCaptcha controls'); |
57 | 57 | return $control; |
58 | 58 | } |
59 | 59 | |
60 | 60 | public function getClientScriptOptions() |
61 | 61 | { |
62 | - $options = parent::getClientScriptOptions(); |
|
63 | - $options['ResponseFieldName'] = $this->getCaptchaControl()->getResponseFieldName(); |
|
62 | + $options=parent::getClientScriptOptions(); |
|
63 | + $options['ResponseFieldName']=$this->getCaptchaControl()->getResponseFieldName(); |
|
64 | 64 | return $options; |
65 | 65 | } |
66 | 66 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | protected function evaluateIsValid() |
75 | 75 | { |
76 | 76 | // check validity only once (if trying to evaulate multiple times, all redundant checks would fail) |
77 | - if (is_null($this->_isvalid)) |
|
77 | + if(is_null($this->_isvalid)) |
|
78 | 78 | { |
79 | - $control = $this->getCaptchaControl(); |
|
80 | - $this->_isvalid = $control->validate(); |
|
79 | + $control=$this->getCaptchaControl(); |
|
80 | + $this->_isvalid=$control->validate(); |
|
81 | 81 | } |
82 | 82 | return ($this->_isvalid==true); |
83 | 83 | } |
@@ -86,23 +86,23 @@ discard block |
||
86 | 86 | { |
87 | 87 | parent::onPreRender($param); |
88 | 88 | |
89 | - $cs = $this->Page->getClientScript(); |
|
89 | + $cs=$this->Page->getClientScript(); |
|
90 | 90 | $cs->registerPradoScript('validator'); |
91 | 91 | |
92 | 92 | // communicate validation status to the client side |
93 | - $value = $this->_isvalid===false ? '0' : '1'; |
|
94 | - $cs->registerHiddenField($this->getClientID().'_1',$value); |
|
93 | + $value=$this->_isvalid===false ? '0' : '1'; |
|
94 | + $cs->registerHiddenField($this->getClientID().'_1', $value); |
|
95 | 95 | |
96 | 96 | // update validator display |
97 | - if ($control = $this->getValidationTarget()) |
|
97 | + if($control=$this->getValidationTarget()) |
|
98 | 98 | { |
99 | - $fn = 'captchaUpdateValidatorStatus_'.$this->getClientID(); |
|
99 | + $fn='captchaUpdateValidatorStatus_'.$this->getClientID(); |
|
100 | 100 | |
101 | 101 | // check if we need to request a new captcha too |
102 | - if ($this->Page->IsCallback) |
|
102 | + if($this->Page->IsCallback) |
|
103 | 103 | { |
104 | - if ($control->getVisible(true)) |
|
105 | - if (!is_null($this->_isvalid)) |
|
104 | + if($control->getVisible(true)) |
|
105 | + if(!is_null($this->_isvalid)) |
|
106 | 106 | { |
107 | 107 | // if the response has been tested and we reach the pre-render phase |
108 | 108 | // then we need to regenerate the token, because it won't test positive |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - $cs->registerEndScript($this->getClientID().'::validate', implode(' ',array( |
|
115 | + $cs->registerEndScript($this->getClientID().'::validate', implode(' ', array( |
|
116 | 116 | // this function will be used to update the validator |
117 | 117 | 'function '.$fn.'(valid)', |
118 | 118 | '{', |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function getDataKeyField() |
136 | 136 | { |
137 | - return $this->getViewState('DataKeyField',''); |
|
137 | + return $this->getViewState('DataKeyField', ''); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function setDataKeyField($value) |
144 | 144 | { |
145 | - $this->setViewState('DataKeyField',$value,''); |
|
145 | + $this->setViewState('DataKeyField', $value, ''); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function getDataKeys() |
152 | 152 | { |
153 | - if(($dataKeys=$this->getViewState('DataKeys',null))===null) |
|
153 | + if(($dataKeys=$this->getViewState('DataKeys', null))===null) |
|
154 | 154 | { |
155 | 155 | $dataKeys=new TList; |
156 | - $this->setViewState('DataKeys',$dataKeys,null); |
|
156 | + $this->setViewState('DataKeys', $dataKeys, null); |
|
157 | 157 | } |
158 | 158 | return $dataKeys; |
159 | 159 | } |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * @return mixed data value at the specified field |
170 | 170 | * @throws TInvalidDataValueException if the data is invalid |
171 | 171 | */ |
172 | - protected function getDataFieldValue($data,$field) |
|
172 | + protected function getDataFieldValue($data, $field) |
|
173 | 173 | { |
174 | - return TDataFieldAccessor::getDataFieldValue($data,$field); |
|
174 | + return TDataFieldAccessor::getDataFieldValue($data, $field); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function onSelectedIndexChanged($param) |
184 | 184 | { |
185 | - $this->raiseEvent('OnSelectedIndexChanged',$this,$param); |
|
185 | + $this->raiseEvent('OnSelectedIndexChanged', $this, $param); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class TJavascriptLogger extends TWebControl |
32 | 32 | { |
33 | - private static $_keyCodes = array( |
|
33 | + private static $_keyCodes=array( |
|
34 | 34 | '0'=>48, '1'=>49, '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, |
35 | 35 | 'a'=>65, 'b'=>66, 'c'=>67, 'd'=>68, 'e'=>69, 'f'=>70, 'g'=>71, 'h'=>72, |
36 | 36 | 'i'=>73, 'j'=>74, 'k'=>75, 'l'=>76, 'm'=>77, 'n'=>78, 'o'=>79, 'p'=>80, |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function onPreRender($param) |
68 | 68 | { |
69 | - $key = strtolower($this->getToggleKey()); |
|
70 | - $code = isset(self::$_keyCodes[$key]) ? self::$_keyCodes[$key] : 74; |
|
71 | - $js = "var logConsole; jQuery(function() { logConsole = new LogConsole($code)}); "; |
|
72 | - $cs = $this->getPage()->getClientScript(); |
|
73 | - $cs->registerBeginScript($this->getClientID(),$js); |
|
69 | + $key=strtolower($this->getToggleKey()); |
|
70 | + $code=isset(self::$_keyCodes[$key]) ? self::$_keyCodes[$key] : 74; |
|
71 | + $js="var logConsole; jQuery(function() { logConsole = new LogConsole($code)}); "; |
|
72 | + $cs=$this->getPage()->getClientScript(); |
|
73 | + $cs->registerBeginScript($this->getClientID(), $js); |
|
74 | 74 | $cs->registerPradoScript('logger'); |
75 | 75 | } |
76 | 76 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function renderContents($writer) |
83 | 83 | { |
84 | - $code = strtoupper($this->getToggleKey()); |
|
85 | - $info = '(<a href="http://web.archive.org/web/20060512041505/gleepglop.com/javascripts/logger/" target="_blank">more info</a>).'; |
|
86 | - $link = '<a href="javascript:if(logConsole)logConsole.toggle()">toggle the javascript log console.</a>'; |
|
87 | - $usage = 'Press ALT-'.$code.' (Or CTRL-'.$code.' on OS X) to'; |
|
84 | + $code=strtoupper($this->getToggleKey()); |
|
85 | + $info='(<a href="http://web.archive.org/web/20060512041505/gleepglop.com/javascripts/logger/" target="_blank">more info</a>).'; |
|
86 | + $link='<a href="javascript:if(logConsole)logConsole.toggle()">toggle the javascript log console.</a>'; |
|
87 | + $usage='Press ALT-'.$code.' (Or CTRL-'.$code.' on OS X) to'; |
|
88 | 88 | $writer->write("{$usage} {$link} {$info}"); |
89 | 89 | } |
90 | 90 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function getDataField() |
49 | 49 | { |
50 | - return $this->getViewState('DataField',''); |
|
50 | + return $this->getViewState('DataField', ''); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setDataField($value) |
57 | 57 | { |
58 | - $this->setViewState('DataField',$value,''); |
|
58 | + $this->setViewState('DataField', $value, ''); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getReadOnly() |
65 | 65 | { |
66 | - return $this->getViewState('ReadOnly',false); |
|
66 | + return $this->getViewState('ReadOnly', false); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function setReadOnly($value) |
73 | 73 | { |
74 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
74 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param integer the index to the Columns property that the cell resides in. |
85 | 85 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
86 | 86 | */ |
87 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
87 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
88 | 88 | { |
89 | 89 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem) |
90 | 90 | { |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | $checkBox->setEnabled(false); |
94 | 94 | $cell->setHorizontalAlign('Center'); |
95 | 95 | $cell->getControls()->add($checkBox); |
96 | - $cell->registerObject('CheckBox',$checkBox); |
|
96 | + $cell->registerObject('CheckBox', $checkBox); |
|
97 | 97 | if($this->getDataField()!=='') |
98 | - $checkBox->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
98 | + $checkBox->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
99 | 99 | } |
100 | 100 | else |
101 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
101 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | * This method is invoked when datagrid performs databinding. |
107 | 107 | * It populates the content of the cell with the relevant data from data source. |
108 | 108 | */ |
109 | - public function dataBindColumn($sender,$param) |
|
109 | + public function dataBindColumn($sender, $param) |
|
110 | 110 | { |
111 | 111 | $item=$sender->getNamingContainer(); |
112 | 112 | $data=$item->getData(); |
113 | 113 | if(($field=$this->getDataField())!=='') |
114 | - $value=TPropertyValue::ensureBoolean($this->getDataFieldValue($data,$field)); |
|
114 | + $value=TPropertyValue::ensureBoolean($this->getDataFieldValue($data, $field)); |
|
115 | 115 | else |
116 | 116 | $value=TPropertyValue::ensureBoolean($data); |
117 | 117 | if($sender instanceof TCheckBox) |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getForControl() |
44 | 44 | { |
45 | - return $this->getViewState('ForControl',''); |
|
45 | + return $this->getViewState('ForControl', ''); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | parent::addAttributesToRender($writer); |
133 | 133 | if($this->getPage()->getClientSupportsJavaScript()) |
134 | - $writer->addAttribute('id',$this->getClientID()); |
|
134 | + $writer->addAttribute('id', $this->getClientID()); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | if(($url=$this->getCssUrl())==='') |
145 | 145 | $url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'keyboard.css'); |
146 | - $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); |
|
146 | + $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | if(($forControl=$this->getForControl())==='') |
175 | 175 | throw new TConfigurationException('keyboard_forcontrol_required'); |
176 | 176 | if(($target=$this->findControl($forControl))===null) |
177 | - throw new TConfigurationException('keyboard_forcontrol_invalid',$forControl); |
|
177 | + throw new TConfigurationException('keyboard_forcontrol_invalid', $forControl); |
|
178 | 178 | |
179 | - $options['ID'] = $this->getClientID(); |
|
180 | - $options['ForControl'] = $target->getClientID(); |
|
181 | - $options['AutoHide'] = $this->getAutoHide(); |
|
182 | - $options['CssClass'] = $this->getKeyboardCssClass(); |
|
179 | + $options['ID']=$this->getClientID(); |
|
180 | + $options['ForControl']=$target->getClientID(); |
|
181 | + $options['AutoHide']=$this->getAutoHide(); |
|
182 | + $options['CssClass']=$this->getKeyboardCssClass(); |
|
183 | 183 | |
184 | 184 | return $options; |
185 | 185 | } |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function addAttributesToRender($writer) |
41 | 41 | { |
42 | - $writer->addAttribute('src',$this->getImageUrl()); |
|
43 | - $writer->addAttribute('alt',$this->getAlternateText()); |
|
42 | + $writer->addAttribute('src', $this->getImageUrl()); |
|
43 | + $writer->addAttribute('alt', $this->getAlternateText()); |
|
44 | 44 | if(($desc=$this->getDescriptionUrl())!=='') |
45 | - $writer->addAttribute('longdesc',$desc); |
|
45 | + $writer->addAttribute('longdesc', $desc); |
|
46 | 46 | if(($align=$this->getImageAlign())!=='') |
47 | - $writer->addAttribute('align',$align); |
|
47 | + $writer->addAttribute('align', $align); |
|
48 | 48 | parent::addAttributesToRender($writer); |
49 | 49 | } |
50 | 50 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function getAlternateText() |
64 | 64 | { |
65 | - return $this->getViewState('AlternateText',''); |
|
65 | + return $this->getViewState('AlternateText', ''); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function setAlternateText($value) |
73 | 73 | { |
74 | - $this->setViewState('AlternateText',$value,''); |
|
74 | + $this->setViewState('AlternateText', $value, ''); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getImageAlign() |
81 | 81 | { |
82 | - return $this->getViewState('ImageAlign',''); |
|
82 | + return $this->getViewState('ImageAlign', ''); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setImageAlign($value) |
93 | 93 | { |
94 | - $this->setViewState('ImageAlign',$value,''); |
|
94 | + $this->setViewState('ImageAlign', $value, ''); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function getImageUrl() |
101 | 101 | { |
102 | - return $this->getViewState('ImageUrl',''); |
|
102 | + return $this->getViewState('ImageUrl', ''); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function setImageUrl($value) |
109 | 109 | { |
110 | - $this->setViewState('ImageUrl',$value,''); |
|
110 | + $this->setViewState('ImageUrl', $value, ''); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function getDescriptionUrl() |
143 | 143 | { |
144 | - return $this->getViewState('DescriptionUrl',''); |
|
144 | + return $this->getViewState('DescriptionUrl', ''); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function setDescriptionUrl($value) |
151 | 151 | { |
152 | - $this->setViewState('DescriptionUrl',$value,''); |
|
152 | + $this->setViewState('DescriptionUrl', $value, ''); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * @var array list of locale => language file pairs. |
62 | 62 | */ |
63 | - private static $_langs = array( |
|
63 | + private static $_langs=array( |
|
64 | 64 | 'ar' => 'ar', |
65 | 65 | 'bg_BG' => 'bg_BG', |
66 | 66 | 'bs' => 'bs', |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * @var array list of default plugins to load, override using getAvailablePlugins(); |
120 | 120 | */ |
121 | - private static $_plugins = array( |
|
121 | + private static $_plugins=array( |
|
122 | 122 | 'advlist', |
123 | 123 | 'anchor', |
124 | 124 | 'autolink', |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | /** |
163 | 163 | * @var array default themes to load |
164 | 164 | */ |
165 | - private static $_themes = array( |
|
165 | + private static $_themes=array( |
|
166 | 166 | 'modern', |
167 | 167 | ); |
168 | 168 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getEnableVisualEdit() |
211 | 211 | { |
212 | - return $this->getViewState('EnableVisualEdit',true); |
|
212 | + return $this->getViewState('EnableVisualEdit', true); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function setEnableVisualEdit($value) |
220 | 220 | { |
221 | - $this->setViewState('EnableVisualEdit',TPropertyValue::ensureBoolean($value),true); |
|
221 | + $this->setViewState('EnableVisualEdit', TPropertyValue::ensureBoolean($value), true); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | { |
304 | 304 | if($this->getEnableVisualEdit() && $this->getEnabled(true)) |
305 | 305 | { |
306 | - $writer->addAttribute('id',$this->getClientID()); |
|
306 | + $writer->addAttribute('id', $this->getClientID()); |
|
307 | 307 | $this->registerEditorClientScript($writer); |
308 | 308 | } |
309 | 309 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | |
339 | 339 | protected function loadJavascriptLibrary() |
340 | 340 | { |
341 | - $scripts = $this->getPage()->getClientScript(); |
|
341 | + $scripts=$this->getPage()->getClientScript(); |
|
342 | 342 | $scripts->registerPradoScript('htmlarea4'); |
343 | 343 | $scripts->registerScriptFile('prado:THtmlArea4', $this->getScriptUrl()); |
344 | 344 | } |
@@ -349,14 +349,14 @@ discard block |
||
349 | 349 | protected function registerEditorClientScript($writer) |
350 | 350 | { |
351 | 351 | $this->loadJavascriptLibrary(); |
352 | - $scripts = $this->getPage()->getClientScript(); |
|
353 | - $options = array( |
|
352 | + $scripts=$this->getPage()->getClientScript(); |
|
353 | + $options=array( |
|
354 | 354 | 'EditorOptions' => $this->getEditorOptions() |
355 | 355 | ); |
356 | 356 | |
357 | - $options = TJavaScript::encode($options,true,true); |
|
358 | - $script = "new {$this->getClientClassName()}($options)"; |
|
359 | - $scripts->registerEndScript('prado:THtmlArea4'.$this->ClientID,$script); |
|
357 | + $options=TJavaScript::encode($options, true, true); |
|
358 | + $script="new {$this->getClientClassName()}($options)"; |
|
359 | + $scripts->registerEndScript('prado:THtmlArea4'.$this->ClientID, $script); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
@@ -373,19 +373,19 @@ discard block |
||
373 | 373 | */ |
374 | 374 | protected function getScriptDeploymentPath() |
375 | 375 | { |
376 | - $basedir = Prado::getPathOfNamespace('System.Web.Javascripts.source.tinymce-405'); |
|
377 | - $url = $this->getApplication()->getAssetManager()->publishFilePath($basedir); |
|
376 | + $basedir=Prado::getPathOfNamespace('System.Web.Javascripts.source.tinymce-405'); |
|
377 | + $url=$this->getApplication()->getAssetManager()->publishFilePath($basedir); |
|
378 | 378 | $this->copyCustomPlugins($url); |
379 | 379 | return $url; |
380 | 380 | } |
381 | 381 | |
382 | 382 | protected function copyCustomPlugins($url) |
383 | 383 | { |
384 | - if($plugins = $this->getCustomPluginPath()) |
|
384 | + if($plugins=$this->getCustomPluginPath()) |
|
385 | 385 | { |
386 | - $assets = $this->getApplication()->getAssetManager(); |
|
387 | - $path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
388 | - $dest = $assets->getBasePath().'/'.basename($url).'/plugins/'; |
|
386 | + $assets=$this->getApplication()->getAssetManager(); |
|
387 | + $path=is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
388 | + $dest=$assets->getBasePath().'/'.basename($url).'/plugins/'; |
|
389 | 389 | if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
390 | 390 | $assets->copyDirectory($path, $dest); |
391 | 391 | } |
@@ -397,26 +397,26 @@ discard block |
||
397 | 397 | */ |
398 | 398 | protected function getEditorOptions() |
399 | 399 | { |
400 | - $options['mode'] = 'exact'; |
|
401 | - $options['elements'] = $this->getClientID(); |
|
402 | - $options['language'] = $this->getLanguageSuffix($this->getCulture()); |
|
400 | + $options['mode']='exact'; |
|
401 | + $options['elements']=$this->getClientID(); |
|
402 | + $options['language']=$this->getLanguageSuffix($this->getCulture()); |
|
403 | 403 | //$options['theme'] = 'modern'; //default |
404 | 404 | // mimic previous (tinyMCE3) sizing behaviour |
405 | - $options['width'] = $this->getWidth(); |
|
406 | - $options['height'] = $this->getHeight(); |
|
407 | - $options['resize'] = 'both'; |
|
408 | - $options['menubar'] = false; |
|
405 | + $options['width']=$this->getWidth(); |
|
406 | + $options['height']=$this->getHeight(); |
|
407 | + $options['resize']='both'; |
|
408 | + $options['menubar']=false; |
|
409 | 409 | if($this->getReadOnly()) |
410 | 410 | { |
411 | - $options['readonly'] = true; |
|
412 | - $options['toolbar'] = false; |
|
413 | - $options['menubar'] = false; |
|
414 | - $options['statusbar'] = false; |
|
411 | + $options['readonly']=true; |
|
412 | + $options['toolbar']=false; |
|
413 | + $options['menubar']=false; |
|
414 | + $options['statusbar']=false; |
|
415 | 415 | } |
416 | 416 | |
417 | - $options['extended_valid_elements'] = 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
417 | + $options['extended_valid_elements']='a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
418 | 418 | |
419 | - $options = array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
419 | + $options=array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
420 | 420 | return $options; |
421 | 421 | } |
422 | 422 | |
@@ -426,20 +426,20 @@ discard block |
||
426 | 426 | */ |
427 | 427 | protected function parseEditorOptions($string) |
428 | 428 | { |
429 | - $options = array(); |
|
430 | - $substrings = preg_split('/,\s*\n|\n/', trim($string)); |
|
429 | + $options=array(); |
|
430 | + $substrings=preg_split('/,\s*\n|\n/', trim($string)); |
|
431 | 431 | foreach($substrings as $bits) |
432 | 432 | { |
433 | - $option = explode(":",$bits,2); |
|
433 | + $option=explode(":", $bits, 2); |
|
434 | 434 | |
435 | - if(count($option) == 2) |
|
435 | + if(count($option)==2) |
|
436 | 436 | { |
437 | - $value=trim(trim($option[1]),"'\""); |
|
438 | - if (($s=strtolower($value))==='false') |
|
437 | + $value=trim(trim($option[1]), "'\""); |
|
438 | + if(($s=strtolower($value))==='false') |
|
439 | 439 | $value=false; |
440 | - elseif ($s==='true') |
|
440 | + elseif($s==='true') |
|
441 | 441 | $value=true; |
442 | - $options[trim($option[0])] = $value; |
|
442 | + $options[trim($option[0])]=$value; |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | return $options; |
@@ -450,12 +450,12 @@ discard block |
||
450 | 450 | */ |
451 | 451 | protected function getLanguageSuffix($culture) |
452 | 452 | { |
453 | - $app = $this->getApplication()->getGlobalization(); |
|
453 | + $app=$this->getApplication()->getGlobalization(); |
|
454 | 454 | if(empty($culture) && ($app!==null)) |
455 | - $culture = $app->getCulture(); |
|
456 | - $variants = array(); |
|
455 | + $culture=$app->getCulture(); |
|
456 | + $variants=array(); |
|
457 | 457 | if($app!==null) |
458 | - $variants = $app->getCultureVariants($culture); |
|
458 | + $variants=$app->getCultureVariants($culture); |
|
459 | 459 | |
460 | 460 | foreach($variants as $variant) |
461 | 461 | { |