@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function addParsedObject($object) |
44 | 44 | { |
45 | 45 | if(is_string($object)) |
46 | - $object=html_entity_decode($object,ENT_QUOTES,'UTF-8'); |
|
46 | + $object=html_entity_decode($object, ENT_QUOTES, 'UTF-8'); |
|
47 | 47 | parent::addParsedObject($object); |
48 | 48 | } |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getText() |
54 | 54 | { |
55 | - return $this->getViewState('Text',''); |
|
55 | + return $this->getViewState('Text', ''); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function setText($value) |
62 | 62 | { |
63 | - $this->setViewState('Text',$value); |
|
63 | + $this->setViewState('Text', $value); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | if(($text=$this->getText())==='' && $this->getHasControls()) |
75 | 75 | { |
76 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
76 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
77 | 77 | parent::renderContents($htmlWriter); |
78 | 78 | $text=$htmlWriter->flush(); |
79 | 79 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function getDataField() |
40 | 40 | { |
41 | - return $this->getViewState('DataField',''); |
|
41 | + return $this->getViewState('DataField', ''); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function setDataField($value) |
48 | 48 | { |
49 | - $this->setViewState('DataField',$value,''); |
|
49 | + $this->setViewState('DataField', $value, ''); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getDataFormatString() |
56 | 56 | { |
57 | - return $this->getViewState('DataFormatString',''); |
|
57 | + return $this->getViewState('DataFormatString', ''); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function setDataFormatString($value) |
64 | 64 | { |
65 | - $this->setViewState('DataFormatString',$value,''); |
|
65 | + $this->setViewState('DataFormatString', $value, ''); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function getText() |
72 | 72 | { |
73 | - return $this->getViewState('Text',''); |
|
73 | + return $this->getViewState('Text', ''); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function setText($value) |
80 | 80 | { |
81 | - $this->setViewState('Text',$value,''); |
|
81 | + $this->setViewState('Text', $value, ''); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function getEncode() |
88 | 88 | { |
89 | - return $this->getViewState('Encode',false); |
|
89 | + return $this->getViewState('Encode', false); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function setEncode($value) |
96 | 96 | { |
97 | - $this->setViewState('Encode',TPropertyValue::ensureBoolean($value),false); |
|
97 | + $this->setViewState('Encode', TPropertyValue::ensureBoolean($value), false); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | * @param integer the index to the Columns property that the cell resides in. |
105 | 105 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
106 | 106 | */ |
107 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
107 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
108 | 108 | { |
109 | 109 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::EditItem || $itemType===TListItemType::SelectedItem) |
110 | 110 | { |
111 | 111 | if($this->getDataField()!=='') |
112 | 112 | { |
113 | - $cell->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
113 | + $cell->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
114 | 114 | } else { |
115 | 115 | $text=$this->getText(); |
116 | 116 | if($this->getEncode()) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | } |
121 | 121 | else |
122 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
122 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | * This method is invoked when datagrid performs databinding. |
128 | 128 | * It populates the content of the cell with the relevant data from data source. |
129 | 129 | */ |
130 | - public function dataBindColumn($sender,$param) |
|
130 | + public function dataBindColumn($sender, $param) |
|
131 | 131 | { |
132 | 132 | $item=$sender->getNamingContainer(); |
133 | 133 | $data=$item->getData(); |
134 | 134 | $formatString=$this->getDataFormatString(); |
135 | 135 | if(($field=$this->getDataField())!=='') |
136 | - $value=$this->formatDataValue($formatString,$this->getDataFieldValue($data,$field)); |
|
136 | + $value=$this->formatDataValue($formatString, $this->getDataFieldValue($data, $field)); |
|
137 | 137 | else |
138 | - $value=$this->formatDataValue($formatString,$data); |
|
138 | + $value=$this->formatDataValue($formatString, $data); |
|
139 | 139 | if($sender instanceof TTableCell) |
140 | 140 | { |
141 | 141 | if($this->getEncode()) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getTokenImageTheme() |
73 | 73 | { |
74 | - return $this->getViewState('TokenImageTheme',0); |
|
74 | + return $this->getViewState('TokenImageTheme', 0); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | public function setTokenImageTheme($value) |
91 | 91 | { |
92 | 92 | $value=TPropertyValue::ensureInteger($value); |
93 | - if($value>=0 && $value<=63) |
|
94 | - $this->setViewState('TokenImageTheme',$value,0); |
|
93 | + if($value >= 0 && $value <= 63) |
|
94 | + $this->setViewState('TokenImageTheme', $value, 0); |
|
95 | 95 | else |
96 | - throw new TConfigurationException('captcha_tokenimagetheme_invalid',0,63); |
|
96 | + throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getTokenFontSize() |
103 | 103 | { |
104 | - return $this->getViewState('TokenFontSize',30); |
|
104 | + return $this->getViewState('TokenFontSize', 30); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | public function setTokenFontSize($value) |
114 | 114 | { |
115 | 115 | $value=TPropertyValue::ensureInteger($value); |
116 | - if($value>=20 && $value<=100) |
|
117 | - $this->setViewState('TokenFontSize',$value,30); |
|
116 | + if($value >= 20 && $value <= 100) |
|
117 | + $this->setViewState('TokenFontSize', $value, 30); |
|
118 | 118 | else |
119 | - throw new TConfigurationException('captcha_tokenfontsize_invalid',20,100); |
|
119 | + throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function getMinTokenLength() |
126 | 126 | { |
127 | - return $this->getViewState('MinTokenLength',4); |
|
127 | + return $this->getViewState('MinTokenLength', 4); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | public function setMinTokenLength($value) |
134 | 134 | { |
135 | 135 | $length=TPropertyValue::ensureInteger($value); |
136 | - if($length>=self::MIN_TOKEN_LENGTH && $length<=self::MAX_TOKEN_LENGTH) |
|
137 | - $this->setViewState('MinTokenLength',$length,4); |
|
136 | + if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
137 | + $this->setViewState('MinTokenLength', $length, 4); |
|
138 | 138 | else |
139 | - throw new TConfigurationException('captcha_mintokenlength_invalid',self::MIN_TOKEN_LENGTH,self::MAX_TOKEN_LENGTH); |
|
139 | + throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function getMaxTokenLength() |
146 | 146 | { |
147 | - return $this->getViewState('MaxTokenLength',6); |
|
147 | + return $this->getViewState('MaxTokenLength', 6); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | public function setMaxTokenLength($value) |
154 | 154 | { |
155 | 155 | $length=TPropertyValue::ensureInteger($value); |
156 | - if($length>=self::MIN_TOKEN_LENGTH && $length<=self::MAX_TOKEN_LENGTH) |
|
157 | - $this->setViewState('MaxTokenLength',$length,6); |
|
156 | + if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
157 | + $this->setViewState('MaxTokenLength', $length, 6); |
|
158 | 158 | else |
159 | - throw new TConfigurationException('captcha_maxtokenlength_invalid',self::MIN_TOKEN_LENGTH,self::MAX_TOKEN_LENGTH); |
|
159 | + throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function getCaseSensitive() |
166 | 166 | { |
167 | - return $this->getViewState('CaseSensitive',true); |
|
167 | + return $this->getViewState('CaseSensitive', true); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function setCaseSensitive($value) |
174 | 174 | { |
175 | - $this->setViewState('CaseSensitive',TPropertyValue::ensureBoolean($value),true); |
|
175 | + $this->setViewState('CaseSensitive', TPropertyValue::ensureBoolean($value), true); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function getTokenAlphabet() |
182 | 182 | { |
183 | - return $this->getViewState('TokenAlphabet','234578adefhijmnrtABDEFGHJLMNRT'); |
|
183 | + return $this->getViewState('TokenAlphabet', '234578adefhijmnrtABDEFGHJLMNRT'); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function setTokenAlphabet($value) |
190 | 190 | { |
191 | - if(strlen($value)<2) |
|
191 | + if(strlen($value) < 2) |
|
192 | 192 | throw new TConfigurationException('captcha_tokenalphabet_invalid'); |
193 | - $this->setViewState('TokenAlphabet',$value,'234578adefhijmnrtABDEFGHJLMNRT'); |
|
193 | + $this->setViewState('TokenAlphabet', $value, '234578adefhijmnrtABDEFGHJLMNRT'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function getTokenExpiry() |
200 | 200 | { |
201 | - return $this->getViewState('TokenExpiry',600); |
|
201 | + return $this->getViewState('TokenExpiry', 600); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function setTokenExpiry($value) |
208 | 208 | { |
209 | - $this->setViewState('TokenExpiry',TPropertyValue::ensureInteger($value),600); |
|
209 | + $this->setViewState('TokenExpiry', TPropertyValue::ensureInteger($value), 600); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function getChangingTokenBackground() |
216 | 216 | { |
217 | - return $this->getViewState('ChangingTokenBackground',false); |
|
217 | + return $this->getViewState('ChangingTokenBackground', false); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function setChangingTokenBackground($value) |
224 | 224 | { |
225 | - $this->setViewState('ChangingTokenBackground',TPropertyValue::ensureBoolean($value),false); |
|
225 | + $this->setViewState('ChangingTokenBackground', TPropertyValue::ensureBoolean($value), false); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function getTestLimit() |
232 | 232 | { |
233 | - return $this->getViewState('TestLimit',5); |
|
233 | + return $this->getViewState('TestLimit', 5); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function setTestLimit($value) |
240 | 240 | { |
241 | - $this->setViewState('TestLimit',TPropertyValue::ensureInteger($value),5); |
|
241 | + $this->setViewState('TestLimit', TPropertyValue::ensureInteger($value), 5); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function getIsTokenExpired() |
248 | 248 | { |
249 | - if(($expiry=$this->getTokenExpiry())>0 && ($start=$this->getViewState('TokenGenerated',0))>0) |
|
250 | - return $expiry+$start<time(); |
|
249 | + if(($expiry=$this->getTokenExpiry()) > 0 && ($start=$this->getViewState('TokenGenerated', 0)) > 0) |
|
250 | + return $expiry + $start < time(); |
|
251 | 251 | else |
252 | 252 | return false; |
253 | 253 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function getPublicKey() |
259 | 259 | { |
260 | - if(($publicKey=$this->getViewState('PublicKey',''))==='') |
|
260 | + if(($publicKey=$this->getViewState('PublicKey', ''))==='') |
|
261 | 261 | { |
262 | 262 | $publicKey=$this->generateRandomKey(); |
263 | 263 | $this->setPublicKey($publicKey); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function setPublicKey($value) |
272 | 272 | { |
273 | - $this->setViewState('PublicKey',$value,''); |
|
273 | + $this->setViewState('PublicKey', $value, ''); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function getToken() |
280 | 280 | { |
281 | - return $this->generateToken($this->getPublicKey(),$this->getPrivateKey(),$this->getTokenAlphabet(),$this->getTokenLength(),$this->getCaseSensitive()); |
|
281 | + return $this->generateToken($this->getPublicKey(), $this->getPrivateKey(), $this->getTokenAlphabet(), $this->getTokenLength(), $this->getCaseSensitive()); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | { |
291 | 291 | $minLength=$this->getMinTokenLength(); |
292 | 292 | $maxLength=$this->getMaxTokenLength(); |
293 | - if($minLength>$maxLength) |
|
294 | - $tokenLength=rand($maxLength,$minLength); |
|
295 | - else if($minLength<$maxLength) |
|
296 | - $tokenLength=rand($minLength,$maxLength); |
|
293 | + if($minLength > $maxLength) |
|
294 | + $tokenLength=rand($maxLength, $minLength); |
|
295 | + else if($minLength < $maxLength) |
|
296 | + $tokenLength=rand($minLength, $maxLength); |
|
297 | 297 | else |
298 | 298 | $tokenLength=$minLength; |
299 | - $this->setViewState('TokenLength',$tokenLength); |
|
299 | + $this->setViewState('TokenLength', $tokenLength); |
|
300 | 300 | } |
301 | 301 | return $tokenLength; |
302 | 302 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $fileName=$this->generatePrivateKeyFile(); |
312 | 312 | $content=file_get_contents($fileName); |
313 | 313 | $matches=array(); |
314 | - if(preg_match("/privateKey='(.*?)'/ms",$content,$matches)>0) |
|
314 | + if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0) |
|
315 | 315 | $this->_privateKey=$matches[1]; |
316 | 316 | else |
317 | 317 | throw new TConfigurationException('captcha_privatekey_unknown'); |
@@ -326,18 +326,18 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function validate($input) |
328 | 328 | { |
329 | - $number=$this->getViewState('TestNumber',0); |
|
329 | + $number=$this->getViewState('TestNumber', 0); |
|
330 | 330 | if(!$this->_validated) |
331 | 331 | { |
332 | - $this->setViewState('TestNumber',++$number); |
|
332 | + $this->setViewState('TestNumber', ++$number); |
|
333 | 333 | $this->_validated=true; |
334 | 334 | } |
335 | - if($this->getIsTokenExpired() || (($limit=$this->getTestLimit())>0 && $number>$limit)) |
|
335 | + if($this->getIsTokenExpired() || (($limit=$this->getTestLimit()) > 0 && $number > $limit)) |
|
336 | 336 | { |
337 | 337 | $this->regenerateToken(); |
338 | 338 | return false; |
339 | 339 | } |
340 | - return ($this->getToken()===($this->getCaseSensitive()?$input:strtoupper($input))); |
|
340 | + return ($this->getToken()===($this->getCaseSensitive() ? $input : strtoupper($input))); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $this->setPublicKey(''); |
352 | 352 | $this->clearViewState('TokenGenerated'); |
353 | 353 | $this->clearViewState('RandomSeed'); |
354 | - $this->clearViewState('TestNumber',0); |
|
354 | + $this->clearViewState('TestNumber', 0); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | parent::onPreRender($param); |
364 | 364 | if(!self::checkRequirements()) |
365 | 365 | throw new TConfigurationException('captcha_imagettftext_required'); |
366 | - if(!$this->getViewState('TokenGenerated',0)) |
|
366 | + if(!$this->getViewState('TokenGenerated', 0)) |
|
367 | 367 | { |
368 | 368 | $manager=$this->getApplication()->getAssetManager(); |
369 | 369 | $manager->publishFilePath($this->getFontFile()); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $url.='?options='.urlencode($this->getTokenImageOptions()); |
372 | 372 | $this->setImageUrl($url); |
373 | 373 | |
374 | - $this->setViewState('TokenGenerated',time()); |
|
374 | + $this->setViewState('TokenGenerated', time()); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | protected function getTokenImageOptions() |
382 | 382 | { |
383 | - $privateKey=$this->getPrivateKey(); // call this method to ensure private key is generated |
|
383 | + $privateKey=$this->getPrivateKey(); // call this method to ensure private key is generated |
|
384 | 384 | $token=$this->getToken(); |
385 | 385 | $options=array(); |
386 | 386 | $options['publicKey']=$this->getPublicKey(); |
@@ -389,12 +389,12 @@ discard block |
||
389 | 389 | $options['alphabet']=$this->getTokenAlphabet(); |
390 | 390 | $options['fontSize']=$this->getTokenFontSize(); |
391 | 391 | $options['theme']=$this->getTokenImageTheme(); |
392 | - if(($randomSeed=$this->getViewState('RandomSeed',0))===0) |
|
392 | + if(($randomSeed=$this->getViewState('RandomSeed', 0))===0) |
|
393 | 393 | { |
394 | - $randomSeed=(int)(microtime()*1000000); |
|
395 | - $this->setViewState('RandomSeed',$randomSeed); |
|
394 | + $randomSeed=(int) (microtime() * 1000000); |
|
395 | + $this->setViewState('RandomSeed', $randomSeed); |
|
396 | 396 | } |
397 | - $options['randomSeed']=$this->getChangingTokenBackground()?0:$randomSeed; |
|
397 | + $options['randomSeed']=$this->getChangingTokenBackground() ? 0 : $randomSeed; |
|
398 | 398 | $str=serialize($options); |
399 | 399 | return base64_encode(md5($privateKey.$str).$str); |
400 | 400 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $content="<?php |
429 | 429 | \$privateKey='$key'; |
430 | 430 | ?>"; |
431 | - file_put_contents($fileName,$content); |
|
431 | + file_put_contents($fileName, $content); |
|
432 | 432 | } |
433 | 433 | return $fileName; |
434 | 434 | } |
@@ -449,10 +449,10 @@ discard block |
||
449 | 449 | * @param boolean whether the token is case sensitive |
450 | 450 | * @return string the token generated. |
451 | 451 | */ |
452 | - protected function generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive) |
|
452 | + protected function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive) |
|
453 | 453 | { |
454 | - $token=substr($this->hash2string(md5($publicKey.$privateKey),$alphabet).$this->hash2string(md5($privateKey.$publicKey),$alphabet),0,$tokenLength); |
|
455 | - return $caseSensitive?$token:strtoupper($token); |
|
454 | + $token=substr($this->hash2string(md5($publicKey.$privateKey), $alphabet).$this->hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength); |
|
455 | + return $caseSensitive ? $token : strtoupper($token); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -461,20 +461,20 @@ discard block |
||
461 | 461 | * @param string the alphabet used to represent the converted string. If empty, it means '234578adefhijmnrtwyABDEFGHIJLMNQRTWY', which excludes those confusing characters. |
462 | 462 | * @return string the converted string |
463 | 463 | */ |
464 | - protected function hash2string($hex,$alphabet='') |
|
464 | + protected function hash2string($hex, $alphabet='') |
|
465 | 465 | { |
466 | - if(strlen($alphabet)<2) |
|
466 | + if(strlen($alphabet) < 2) |
|
467 | 467 | $alphabet='234578adefhijmnrtABDEFGHJLMNQRT'; |
468 | 468 | $hexLength=strlen($hex); |
469 | 469 | $base=strlen($alphabet); |
470 | 470 | $result=''; |
471 | - for($i=0;$i<$hexLength;$i+=6) |
|
471 | + for($i=0; $i < $hexLength; $i+=6) |
|
472 | 472 | { |
473 | - $number=hexdec(substr($hex,$i,6)); |
|
473 | + $number=hexdec(substr($hex, $i, 6)); |
|
474 | 474 | while($number) |
475 | 475 | { |
476 | - $result.=$alphabet[$number%$base]; |
|
477 | - $number=floor($number/$base); |
|
476 | + $result.=$alphabet[$number % $base]; |
|
477 | + $number=floor($number / $base); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | return $result; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | class TColorPicker extends TTextBox |
39 | 39 | { |
40 | - const SCRIPT_PATH = 'prado/colorpicker'; |
|
40 | + const SCRIPT_PATH='prado/colorpicker'; |
|
41 | 41 | |
42 | 42 | private $_clientSide; |
43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getShowColorPicker() |
48 | 48 | { |
49 | - return $this->getViewState('ShowColorPicker',true); |
|
49 | + return $this->getViewState('ShowColorPicker', true); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setShowColorPicker($value) |
57 | 57 | { |
58 | - $this->setViewState('ShowColorPicker',TPropertyValue::ensureBoolean($value),true); |
|
58 | + $this->setViewState('ShowColorPicker', TPropertyValue::ensureBoolean($value), true); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | public function getClientSide() |
129 | 129 | { |
130 | 130 | if($this->_clientSide===null) |
131 | - $this->_clientSide = $this->createClientSide(); |
|
131 | + $this->_clientSide=$this->createClientSide(); |
|
132 | 132 | return $this->_clientSide; |
133 | 133 | } |
134 | 134 | |
@@ -146,18 +146,18 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function getPostBackOptions() |
148 | 148 | { |
149 | - $options = parent::getPostBackOptions(); |
|
150 | - $options['ClassName'] = $this->getCssClass(); |
|
151 | - $options['ShowColorPicker'] = $this->getShowColorPicker(); |
|
149 | + $options=parent::getPostBackOptions(); |
|
150 | + $options['ClassName']=$this->getCssClass(); |
|
151 | + $options['ShowColorPicker']=$this->getShowColorPicker(); |
|
152 | 152 | if($options['ShowColorPicker']) |
153 | 153 | { |
154 | - $mode = $this->getMode(); |
|
155 | - if($mode == TColorPickerMode::Full) $options['Mode'] = $mode; |
|
156 | - else if($mode == TColorPickerMode::Simple) $options['Palette'] = 'Tiny'; |
|
157 | - $options['OKButtonText'] = $this->getOKButtonText(); |
|
158 | - $options['CancelButtonText'] = $this->getCancelButtonText(); |
|
154 | + $mode=$this->getMode(); |
|
155 | + if($mode==TColorPickerMode::Full) $options['Mode']=$mode; |
|
156 | + else if($mode==TColorPickerMode::Simple) $options['Palette']='Tiny'; |
|
157 | + $options['OKButtonText']=$this->getOKButtonText(); |
|
158 | + $options['CancelButtonText']=$this->getCancelButtonText(); |
|
159 | 159 | } |
160 | - $options = array_merge($options,$this->getClientSide()->getOptions()->toArray()); |
|
160 | + $options=array_merge($options, $this->getClientSide()->getOptions()->toArray()); |
|
161 | 161 | return $options; |
162 | 162 | } |
163 | 163 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | protected function getAssetUrl($file='') |
169 | 169 | { |
170 | - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
170 | + $base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
171 | 171 | return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
172 | 172 | } |
173 | 173 | |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | */ |
186 | 186 | protected function publishColorPickerAssets() |
187 | 187 | { |
188 | - $cs = $this->getPage()->getClientScript(); |
|
189 | - $key = "prado:".get_class($this); |
|
190 | - $imgs['button.gif'] = $this->getAssetUrl('button.gif'); |
|
191 | - $imgs['background.png'] = $this->getAssetUrl('background.png'); |
|
192 | - $options = TJavaScript::encode($imgs); |
|
193 | - $code = "Prado.WebUI.TColorPicker.UIImages = {$options};"; |
|
188 | + $cs=$this->getPage()->getClientScript(); |
|
189 | + $key="prado:".get_class($this); |
|
190 | + $imgs['button.gif']=$this->getAssetUrl('button.gif'); |
|
191 | + $imgs['background.png']=$this->getAssetUrl('background.png'); |
|
192 | + $options=TJavaScript::encode($imgs); |
|
193 | + $code="Prado.WebUI.TColorPicker.UIImages = {$options};"; |
|
194 | 194 | $cs->registerEndScript($key, $code); |
195 | 195 | $cs->registerPradoScript("colorpicker"); |
196 | - $url = $this->getAssetUrl($this->getColorPickerStyle().'.css'); |
|
196 | + $url=$this->getAssetUrl($this->getColorPickerStyle().'.css'); |
|
197 | 197 | if(!$cs->isStyleSheetFileRegistered($url)) |
198 | 198 | $cs->registerStyleSheetFile($url, $url); |
199 | 199 | } |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | { |
209 | 209 | parent::renderEndTag($writer); |
210 | 210 | |
211 | - $color = $this->getText(); |
|
211 | + $color=$this->getText(); |
|
212 | 212 | $writer->addAttribute('class', 'TColorPicker_button'); |
213 | 213 | $writer->renderBeginTag('span'); |
214 | 214 | |
215 | 215 | $writer->addAttribute('id', $this->getClientID().'_button'); |
216 | 216 | $writer->addAttribute('src', $this->getAssetUrl('button.gif')); |
217 | - if($color !== '') |
|
217 | + if($color!=='') |
|
218 | 218 | $writer->addAttribute('style', "background-color:{$color};"); |
219 | 219 | $writer->addAttribute('width', '20'); |
220 | 220 | $writer->addAttribute('height', '20'); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @var boolean tells if the decoration uses state in its templates. If there are no templates |
66 | 66 | * in the instance of the decoration this variable is unused. |
67 | 67 | */ |
68 | - private $_usestate = false; |
|
68 | + private $_usestate=false; |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * @var TWebControl the control to decorate |
@@ -86,19 +86,19 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * @var string the text that goes before the open tag |
88 | 88 | */ |
89 | - private $_pretagtext = ''; |
|
89 | + private $_pretagtext=''; |
|
90 | 90 | /** |
91 | 91 | * @var string the text that goes after the open tag |
92 | 92 | */ |
93 | - private $_precontentstext = ''; |
|
93 | + private $_precontentstext=''; |
|
94 | 94 | /** |
95 | 95 | * @var string the text that goes before the close tag |
96 | 96 | */ |
97 | - private $_postcontentstext = ''; |
|
97 | + private $_postcontentstext=''; |
|
98 | 98 | /** |
99 | 99 | * @var string the text that goes after the close tag |
100 | 100 | */ |
101 | - private $_posttagtext = ''; |
|
101 | + private $_posttagtext=''; |
|
102 | 102 | |
103 | 103 | |
104 | 104 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @param TWebControl The control that is to be decorated. |
126 | 126 | * @param boolean whether decoration is just around the inner content |
127 | 127 | */ |
128 | - public function __construct($control, $onlyinternal = false) { |
|
129 | - $this->_control = $control; |
|
130 | - $this->_internalonly = $onlyinternal; |
|
128 | + public function __construct($control, $onlyinternal=false) { |
|
129 | + $this->_control=$control; |
|
130 | + $this->_internalonly=$onlyinternal; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function setUseState($value) |
146 | 146 | { |
147 | - $this->_usestate = TPropertyValue::ensureBoolean($value); |
|
147 | + $this->_usestate=TPropertyValue::ensureBoolean($value); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function setPreTagText($value) { |
161 | 161 | if(!$this->_internalonly && !$this->_control->getIsSkinApplied()) |
162 | - $this->_pretagtext = TPropertyValue::ensureString($value); |
|
162 | + $this->_pretagtext=TPropertyValue::ensureString($value); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function setPreContentsText($value) { |
177 | 177 | if(!$this->_control->getIsSkinApplied()) |
178 | - $this->_precontentstext = TPropertyValue::ensureString($value); |
|
178 | + $this->_precontentstext=TPropertyValue::ensureString($value); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function setPostContentsText($value) { |
193 | 193 | if(!$this->_control->getIsSkinApplied()) |
194 | - $this->_postcontentstext = TPropertyValue::ensureString($value); |
|
194 | + $this->_postcontentstext=TPropertyValue::ensureString($value); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function setPostTagText($value) { |
209 | 209 | if(!$this->_internalonly && !$this->_control->getIsSkinApplied()) |
210 | - $this->_posttagtext = TPropertyValue::ensureString($value); |
|
210 | + $this->_posttagtext=TPropertyValue::ensureString($value); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function setPreTagTemplate($value) { |
225 | 225 | if(!$this->_internalonly && !$this->_control->getIsSkinApplied()) |
226 | - $this->_pretagtemplate = $value; |
|
226 | + $this->_pretagtemplate=$value; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function setPreContentsTemplate($value) { |
241 | 241 | if(!$this->_control->getIsSkinApplied()) |
242 | - $this->_precontentstemplate = $value; |
|
242 | + $this->_precontentstemplate=$value; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function setPostContentsTemplate($value) { |
257 | 257 | if(!$this->_control->getIsSkinApplied()) |
258 | - $this->_postcontentstemplate = $value; |
|
258 | + $this->_postcontentstemplate=$value; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function setPostTagTemplate($value) { |
273 | 273 | if(!$this->_internalonly && !$this->_control->getIsSkinApplied()) |
274 | - $this->_posttagtemplate = $value; |
|
274 | + $this->_posttagtemplate=$value; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -280,15 +280,15 @@ discard block |
||
280 | 280 | * This call attaches the ensureTemplateDecoration to the TPage onSaveStateComplete so |
281 | 281 | * these controls don't have page states. This is as close to not influencing the page as possible. |
282 | 282 | */ |
283 | - public function instantiate($outercontrol = null) { |
|
283 | + public function instantiate($outercontrol=null) { |
|
284 | 284 | if($this->getPreTagTemplate() || $this->getPreContentsTemplate() || |
285 | 285 | $this->getPostContentsTemplate() || $this->getPostTagTemplate()) { |
286 | 286 | |
287 | - $this->_outercontrol = $outercontrol; |
|
287 | + $this->_outercontrol=$outercontrol; |
|
288 | 288 | if($this->getUseState()) |
289 | 289 | $this->ensureTemplateDecoration(); |
290 | 290 | else |
291 | - $this->_control->getPage()->onSaveStateComplete[] = array($this, 'ensureTemplateDecoration'); |
|
291 | + $this->_control->getPage()->onSaveStateComplete[]=array($this, 'ensureTemplateDecoration'); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
@@ -303,26 +303,26 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function ensureTemplateDecoration($sender=null, $param=null) { |
305 | 305 | |
306 | - $control = $this->_control; |
|
307 | - $outercontrol = $this->_outercontrol; |
|
308 | - if($outercontrol === null) |
|
309 | - $outercontrol = $control; |
|
306 | + $control=$this->_control; |
|
307 | + $outercontrol=$this->_outercontrol; |
|
308 | + if($outercontrol===null) |
|
309 | + $outercontrol=$control; |
|
310 | 310 | |
311 | 311 | if($this->_addedTemplateDecoration) |
312 | 312 | return $this->_addedTemplateDecoration; |
313 | 313 | |
314 | - $this->_addedTemplateDecoration = true; |
|
314 | + $this->_addedTemplateDecoration=true; |
|
315 | 315 | |
316 | 316 | if($this->getPreContentsTemplate()) |
317 | 317 | { |
318 | - $precontents = Prado::createComponent('TCompositeControl'); |
|
318 | + $precontents=Prado::createComponent('TCompositeControl'); |
|
319 | 319 | $this->getPreContentsTemplate()->instantiateIn($precontents); |
320 | 320 | $control->getControls()->insertAt(0, $precontents); |
321 | 321 | } |
322 | 322 | |
323 | 323 | if($this->getPostContentsTemplate()) |
324 | 324 | { |
325 | - $postcontents = Prado::createComponent('TCompositeControl'); |
|
325 | + $postcontents=Prado::createComponent('TCompositeControl'); |
|
326 | 326 | $this->getPostContentsTemplate()->instantiateIn($postcontents); |
327 | 327 | $control->getControls()->add($postcontents); |
328 | 328 | } |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | |
334 | 334 | if($this->getPreTagTemplate()) |
335 | 335 | { |
336 | - $pretag = Prado::createComponent('TCompositeControl'); |
|
336 | + $pretag=Prado::createComponent('TCompositeControl'); |
|
337 | 337 | $this->getPreTagTemplate()->instantiateIn($pretag); |
338 | 338 | $outercontrol->getParent()->getControls()->insertBefore($outercontrol, $pretag); |
339 | 339 | } |
340 | 340 | |
341 | 341 | if($this->getPostTagTemplate()) |
342 | 342 | { |
343 | - $posttag = Prado::createComponent('TCompositeControl'); |
|
343 | + $posttag=Prado::createComponent('TCompositeControl'); |
|
344 | 344 | $this->getPostTagTemplate()->instantiateIn($posttag); |
345 | 345 | $outercontrol->getParent()->getControls()->insertAfter($outercontrol, $posttag); |
346 | 346 | } |
@@ -34,11 +34,11 @@ |
||
34 | 34 | * @param TEventParameter event parameter |
35 | 35 | * @return boolean whether the event bubbling should stop here. |
36 | 36 | */ |
37 | - public function bubbleEvent($sender,$param) |
|
37 | + public function bubbleEvent($sender, $param) |
|
38 | 38 | { |
39 | 39 | if($param instanceof TCommandEventParameter) |
40 | 40 | { |
41 | - $this->raiseBubbleEvent($this,new TRepeaterCommandEventParameter($this,$sender,$param)); |
|
41 | + $this->raiseBubbleEvent($this, new TRepeaterCommandEventParameter($this, $sender, $param)); |
|
42 | 42 | return true; |
43 | 43 | } |
44 | 44 | else |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function getItemRenderer() |
55 | 55 | { |
56 | - return $this->getViewState('ItemRenderer',''); |
|
56 | + return $this->getViewState('ItemRenderer', ''); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function setItemRenderer($value) |
71 | 71 | { |
72 | - $this->setViewState('ItemRenderer',$value,''); |
|
72 | + $this->setViewState('ItemRenderer', $value, ''); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getEditItemRenderer() |
80 | 80 | { |
81 | - return $this->getViewState('EditItemRenderer',''); |
|
81 | + return $this->getViewState('EditItemRenderer', ''); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function setEditItemRenderer($value) |
96 | 96 | { |
97 | - $this->setViewState('EditItemRenderer',$value,''); |
|
97 | + $this->setViewState('EditItemRenderer', $value, ''); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | if($value instanceof ITemplate || $value===null) |
115 | 115 | $this->_editItemTemplate=$value; |
116 | 116 | else |
117 | - throw new TInvalidDataTypeException('templatecolumn_template_required','EditItemTemplate'); |
|
117 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'EditItemTemplate'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | if($value instanceof ITemplate || $value===null) |
135 | 135 | $this->_itemTemplate=$value; |
136 | 136 | else |
137 | - throw new TInvalidDataTypeException('templatecolumn_template_required','ItemTemplate'); |
|
137 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'ItemTemplate'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if($value instanceof ITemplate || $value===null) |
155 | 155 | $this->_headerTemplate=$value; |
156 | 156 | else |
157 | - throw new TInvalidDataTypeException('templatecolumn_template_required','HeaderTemplate'); |
|
157 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'HeaderTemplate'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | if($value instanceof ITemplate || $value===null) |
175 | 175 | $this->_footerTemplate=$value; |
176 | 176 | else |
177 | - throw new TInvalidDataTypeException('templatecolumn_template_required','FooterTemplate'); |
|
177 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'FooterTemplate'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param integer the index to the Columns property that the cell resides in. |
187 | 187 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
188 | 188 | */ |
189 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
189 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
190 | 190 | { |
191 | 191 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem) |
192 | 192 | { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $control->setItemType($itemType); |
214 | 214 | } |
215 | 215 | if($control instanceof IDataRenderer) |
216 | - $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
216 | + $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
217 | 217 | } |
218 | 218 | else if($template!==null) |
219 | 219 | $template->instantiateIn($cell); |
@@ -223,20 +223,20 @@ discard block |
||
223 | 223 | else if($itemType===TListItemType::Header) |
224 | 224 | { |
225 | 225 | if(($classPath=$this->getHeaderRenderer())!=='') |
226 | - $this->initializeHeaderCell($cell,$columnIndex); |
|
226 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
227 | 227 | else if($this->_headerTemplate!==null) |
228 | 228 | $this->_headerTemplate->instantiateIn($cell); |
229 | 229 | else |
230 | - $this->initializeHeaderCell($cell,$columnIndex); |
|
230 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
231 | 231 | } |
232 | 232 | else if($itemType===TListItemType::Footer) |
233 | 233 | { |
234 | 234 | if(($classPath=$this->getFooterRenderer())!=='') |
235 | - $this->initializeFooterCell($cell,$columnIndex); |
|
235 | + $this->initializeFooterCell($cell, $columnIndex); |
|
236 | 236 | else if($this->_footerTemplate!==null) |
237 | 237 | $this->_footerTemplate->instantiateIn($cell); |
238 | 238 | else |
239 | - $this->initializeFooterCell($cell,$columnIndex); |
|
239 | + $this->initializeFooterCell($cell, $columnIndex); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * This method is invoked when datagrid performs databinding. |
246 | 246 | * It populates the content of the cell with the relevant data from data source. |
247 | 247 | */ |
248 | - public function dataBindColumn($sender,$param) |
|
248 | + public function dataBindColumn($sender, $param) |
|
249 | 249 | { |
250 | 250 | $item=$sender->getNamingContainer(); |
251 | 251 | $sender->setData($item->getData()); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function getInitialValue() |
53 | 53 | { |
54 | - return $this->getViewState('InitialValue',$this->getControlPromptValue()); |
|
54 | + return $this->getViewState('InitialValue', $this->getControlPromptValue()); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function getControlPromptValue() |
63 | 63 | { |
64 | - $control = $this->getValidationTarget(); |
|
64 | + $control=$this->getValidationTarget(); |
|
65 | 65 | if($control instanceof TListControl) |
66 | 66 | return $control->getPromptValue(); |
67 | 67 | return ''; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function setInitialValue($value) |
75 | 75 | { |
76 | - $this->setViewState('InitialValue',TPropertyValue::ensureString($value),''); |
|
76 | + $this->setViewState('InitialValue', TPropertyValue::ensureString($value), ''); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function evaluateIsValid() |
91 | 91 | { |
92 | - $control = $this->getValidationTarget(); |
|
92 | + $control=$this->getValidationTarget(); |
|
93 | 93 | if($control instanceof TListControl) |
94 | 94 | return $this->validateListControl($control); |
95 | 95 | else if($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | |
101 | 101 | private function validateListControl($control) |
102 | 102 | { |
103 | - $initial = trim($this->getInitialValue()); |
|
104 | - $count = 0; |
|
103 | + $initial=trim($this->getInitialValue()); |
|
104 | + $count=0; |
|
105 | 105 | foreach($control->getItems() as $item) |
106 | 106 | { |
107 | - if($item->getSelected() && $item->getValue() != $initial) |
|
107 | + if($item->getSelected() && $item->getValue()!=$initial) |
|
108 | 108 | $count++; |
109 | 109 | } |
110 | 110 | return $count > 0; |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | |
113 | 113 | private function validateRadioButtonGroup($control) |
114 | 114 | { |
115 | - $initial = trim($this->getInitialValue()); |
|
115 | + $initial=trim($this->getInitialValue()); |
|
116 | 116 | foreach($control->getRadioButtonsInGroup() as $radio) |
117 | 117 | { |
118 | 118 | if($radio->getChecked()) |
119 | 119 | { |
120 | - if(strlen($value = $radio->getValue()) > 0) |
|
121 | - return $value !== $initial; |
|
120 | + if(strlen($value=$radio->getValue()) > 0) |
|
121 | + return $value!==$initial; |
|
122 | 122 | else |
123 | 123 | return true; |
124 | 124 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | private function validateStandardControl($control) |
130 | 130 | { |
131 | - $initial = trim($this->getInitialValue()); |
|
131 | + $initial=trim($this->getInitialValue()); |
|
132 | 132 | $value=$this->getValidationValue($control); |
133 | 133 | return (is_bool($value) && $value) || trim($value)!==$initial; |
134 | 134 | } |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function getClientScriptOptions() |
141 | 141 | { |
142 | - $options = parent::getClientScriptOptions(); |
|
142 | + $options=parent::getClientScriptOptions(); |
|
143 | 143 | $options['InitialValue']=$this->getInitialValue(); |
144 | - $control = $this->getValidationTarget(); |
|
144 | + $control=$this->getValidationTarget(); |
|
145 | 145 | if($control instanceof TListControl) |
146 | - $options['TotalItems'] = $control->getItemCount(); |
|
146 | + $options['TotalItems']=$control->getItemCount(); |
|
147 | 147 | if($control instanceof TRadioButton && strlen($control->getGroupName()) > 0) |
148 | - $options['GroupName'] = $control->getGroupName(); |
|
148 | + $options['GroupName']=$control->getGroupName(); |
|
149 | 149 | return $options; |
150 | 150 | } |
151 | 151 | } |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | */ |
37 | 37 | class TXmlTransform extends TControl { |
38 | 38 | |
39 | - const EXT_XML_FILE = '.xml'; |
|
40 | - const EXT_XSL_FILE = '.xsl'; |
|
39 | + const EXT_XML_FILE='.xml'; |
|
40 | + const EXT_XSL_FILE='.xsl'; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Constructor |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function setTransformPath($value) { |
65 | 65 | if(!is_file($value)) { |
66 | - $value = Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | - if($value === null) { |
|
66 | + $value=Prado::getPathOfNamespace($value, self::EXT_XSL_FILE); |
|
67 | + if($value===null) { |
|
68 | 68 | throw new TInvalidDataValueException('xmltransform_transformpath_invalid', $value); |
69 | 69 | } |
70 | 70 | } |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function setDocumentPath($value) { |
100 | 100 | if(!is_file($value)) { |
101 | - $value = Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | - if($value === null) { |
|
101 | + $value=Prado::getPathOfNamespace($value, self::EXT_XML_FILE); |
|
102 | + if($value===null) { |
|
103 | 103 | throw new TInvalidDataValueException('xmltransform_documentpath_invalid', $value); |
104 | 104 | } |
105 | 105 | } |
@@ -125,22 +125,22 @@ discard block |
||
125 | 125 | * @return TAttributeCollection the list of custom parameters |
126 | 126 | */ |
127 | 127 | public function getParameters() { |
128 | - if($params = $this->getViewState('Parameters',null)) { |
|
128 | + if($params=$this->getViewState('Parameters', null)) { |
|
129 | 129 | return $params; |
130 | 130 | } else { |
131 | - $params = new TAttributeCollection(); |
|
131 | + $params=new TAttributeCollection(); |
|
132 | 132 | $this->setViewState('Parameters', $params, null); |
133 | 133 | return $params; |
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | 137 | private function getTransformXmlDocument() { |
138 | - if(($content = $this->getTransformContent()) !== '') { |
|
139 | - $document = new DOMDocument(); |
|
138 | + if(($content=$this->getTransformContent())!=='') { |
|
139 | + $document=new DOMDocument(); |
|
140 | 140 | $document->loadXML($content); |
141 | 141 | return $document; |
142 | - } else if(($path = $this->getTransformPath()) !== '') { |
|
143 | - $document = new DOMDocument(); |
|
142 | + } else if(($path=$this->getTransformPath())!=='') { |
|
143 | + $document=new DOMDocument(); |
|
144 | 144 | $document->load($path); |
145 | 145 | return $document; |
146 | 146 | } else { |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | private function getSourceXmlDocument() { |
152 | - if(($content = $this->getDocumentContent()) !== '') { |
|
153 | - $document = new DOMDocument(); |
|
152 | + if(($content=$this->getDocumentContent())!=='') { |
|
153 | + $document=new DOMDocument(); |
|
154 | 154 | $document->loadXML($content); |
155 | 155 | return $document; |
156 | - } else if(($path = $this->getDocumentPath()) !== '') { |
|
157 | - $document = new DOMDocument(); |
|
156 | + } else if(($path=$this->getDocumentPath())!=='') { |
|
157 | + $document=new DOMDocument(); |
|
158 | 158 | $document->load($path); |
159 | 159 | return $document; |
160 | 160 | } else { |
@@ -167,24 +167,24 @@ discard block |
||
167 | 167 | * @param THtmlWriter The writer used for the rendering purpose |
168 | 168 | */ |
169 | 169 | public function render($writer) { |
170 | - if(($document=$this->getSourceXmlDocument()) === null) { |
|
171 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
170 | + if(($document=$this->getSourceXmlDocument())===null) { |
|
171 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
172 | 172 | parent::render($htmlWriter); |
173 | - $document = new DOMDocument(); |
|
173 | + $document=new DOMDocument(); |
|
174 | 174 | $document->loadXML($htmlWriter->flush()); |
175 | 175 | } |
176 | - $stylesheet = $this->getTransformXmlDocument(); |
|
176 | + $stylesheet=$this->getTransformXmlDocument(); |
|
177 | 177 | |
178 | 178 | // Perform XSL transformation |
179 | - $xslt = new XSLTProcessor(); |
|
179 | + $xslt=new XSLTProcessor(); |
|
180 | 180 | $xslt->importStyleSheet($stylesheet); |
181 | 181 | |
182 | 182 | // Check for parameters |
183 | - $parameters = $this->getParameters(); |
|
183 | + $parameters=$this->getParameters(); |
|
184 | 184 | foreach($parameters as $name => $value) { |
185 | 185 | $xslt->setParameter('', $name, $value); |
186 | 186 | } |
187 | - $output = $xslt->transformToXML($document); |
|
187 | + $output=$xslt->transformToXML($document); |
|
188 | 188 | |
189 | 189 | // Write output |
190 | 190 | $writer->write($output); |