@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function createListItemCollection() |
64 | 64 | { |
65 | - $collection = new TActiveListItemCollection; |
|
65 | + $collection=new TActiveListItemCollection; |
|
66 | 66 | $collection->setControl($this); |
67 | 67 | return $collection; |
68 | 68 | } |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function setSelectionMode($value) |
87 | 87 | { |
88 | - if(parent::getSelectionMode() === $value) |
|
88 | + if(parent::getSelectionMode()===$value) |
|
89 | 89 | return; |
90 | 90 | |
91 | 91 | parent::setSelectionMode($value); |
92 | - $multiple = $this->getIsMultiSelect(); |
|
93 | - $id = $this->getUniqueID(); $multi_id = $id.'[]'; |
|
92 | + $multiple=$this->getIsMultiSelect(); |
|
93 | + $id=$this->getUniqueID(); $multi_id=$id.'[]'; |
|
94 | 94 | if($this->getActiveControl()->canUpdateClientSide()) |
95 | 95 | { |
96 | - $client = $this->getPage()->getCallbackClient(); |
|
96 | + $client=$this->getPage()->getCallbackClient(); |
|
97 | 97 | $client->setAttribute($this, 'multiple', $multiple ? 'multiple' : false); |
98 | 98 | $client->setAttribute($this, 'name', $multiple ? $multi_id : $id); |
99 | 99 | } |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | protected function addAttributesToRender($writer) |
147 | 147 | { |
148 | 148 | parent::addAttributesToRender($writer); |
149 | - $writer->addAttribute('id',$this->getClientID()); |
|
150 | - if ($this->getAutoPostBack()) |
|
149 | + $writer->addAttribute('id', $this->getClientID()); |
|
150 | + if($this->getAutoPostBack()) |
|
151 | 151 | $this->getActiveControl()->registerCallbackClientScript( |
152 | 152 | $this->getClientClassName(), $this->getPostBackOptions()); |
153 | 153 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function setAlternateText($value) |
60 | 60 | { |
61 | - if(parent::getAlternateText() === $value) |
|
61 | + if(parent::getAlternateText()===$value) |
|
62 | 62 | return; |
63 | 63 | |
64 | 64 | parent::setAlternateText($value); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function setImageAlign($value) |
77 | 77 | { |
78 | - if(parent::getImageAlign() === $value) |
|
78 | + if(parent::getImageAlign()===$value) |
|
79 | 79 | return; |
80 | 80 | |
81 | 81 | parent::setImageAlign($value); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function setImageUrl($value) |
90 | 90 | { |
91 | - if(parent::getImageUrl() === $value) |
|
91 | + if(parent::getImageUrl()===$value) |
|
92 | 92 | return; |
93 | 93 | |
94 | 94 | parent::setImageUrl($value); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function setDescriptionUrl($value) |
103 | 103 | { |
104 | - if(parent::getDescriptionUrl() === $value) |
|
104 | + if(parent::getDescriptionUrl()===$value) |
|
105 | 105 | return; |
106 | 106 | |
107 | 107 | parent::setDescriptionUrl($value); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | protected function addAttributesToRender($writer) |
152 | 152 | { |
153 | 153 | parent::addAttributesToRender($writer); |
154 | - $writer->addAttribute('id',$this->getClientID()); |
|
154 | + $writer->addAttribute('id', $this->getClientID()); |
|
155 | 155 | $this->getActiveControl()->registerCallbackClientScript( |
156 | 156 | $this->getClientClassName(), $this->getPostBackOptions()); |
157 | 157 | } |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function setDisplayTextBox($value) |
76 | 76 | { |
77 | - $value = TPropertyValue::ensureBoolean($value); |
|
78 | - $this->setViewState('DisplayTextBox', $value,false); |
|
77 | + $value=TPropertyValue::ensureBoolean($value); |
|
78 | + $this->setViewState('DisplayTextBox', $value, false); |
|
79 | 79 | if($this->getActiveControl()->canUpdateClientSide()) |
80 | - $this->callClientFunction('setDisplayTextBox',$value); |
|
80 | + $this->callClientFunction('setDisplayTextBox', $value); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | * @param string static method name |
94 | 94 | * @param mixed method parmaeter |
95 | 95 | */ |
96 | - protected function callClientFunction($func,$value) |
|
96 | + protected function callClientFunction($func, $value) |
|
97 | 97 | { |
98 | - $client = $this->getPage()->getCallbackClient(); |
|
99 | - $code = $this->getClientClassName().'.'.$func; |
|
100 | - $client->callClientFunction($code,array($this,$value)); |
|
98 | + $client=$this->getPage()->getCallbackClient(); |
|
99 | + $code=$this->getClientClassName().'.'.$func; |
|
100 | + $client->callClientFunction($code, array($this, $value)); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected function getExternalControlID() |
123 | 123 | { |
124 | - $extID = $this->getEditTriggerControlID(); |
|
124 | + $extID=$this->getEditTriggerControlID(); |
|
125 | 125 | if($extID===null) return ''; |
126 | - if(($control = $this->findControl($extID))!==null) |
|
126 | + if(($control=$this->findControl($extID))!==null) |
|
127 | 127 | return $control->getClientID(); |
128 | 128 | return $extID; |
129 | 129 | } |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function setText($value) |
137 | 137 | { |
138 | - if(TTextBox::getText() === $value) |
|
138 | + if(TTextBox::getText()===$value) |
|
139 | 139 | return; |
140 | 140 | |
141 | 141 | TTextBox::setText($value); |
142 | 142 | if($this->getActiveControl()->canUpdateClientSide()) |
143 | 143 | { |
144 | - $client = $this->getPage()->getCallbackClient(); |
|
144 | + $client=$this->getPage()->getCallbackClient(); |
|
145 | 145 | $client->update($this->getLabelClientID(), $value); |
146 | 146 | $client->setValue($this, $value); |
147 | 147 | } |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | * @param boolean value |
153 | 153 | * @since 3.1.2 |
154 | 154 | */ |
155 | - public function setReadOnly ($value) |
|
155 | + public function setReadOnly($value) |
|
156 | 156 | { |
157 | 157 | $value=TPropertyValue::ensureBoolean($value); |
158 | - if(TTextBox::getReadOnly() === $value) |
|
158 | + if(TTextBox::getReadOnly()===$value) |
|
159 | 159 | return; |
160 | 160 | |
161 | 161 | TTextBox::setReadOnly($value); |
162 | - if ($this->getActiveControl()->canUpdateClientSide()) |
|
162 | + if($this->getActiveControl()->canUpdateClientSide()) |
|
163 | 163 | { |
164 | 164 | $this->callClientFunction('setReadOnly', $value); |
165 | 165 | } |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function onCallback($param) |
204 | 204 | { |
205 | - $action = $param->getCallbackParameter(); |
|
206 | - if(is_array($action) && $action[0] === '__InlineEditor_loadExternalText__') |
|
205 | + $action=$param->getCallbackParameter(); |
|
206 | + if(is_array($action) && $action[0]==='__InlineEditor_loadExternalText__') |
|
207 | 207 | { |
208 | - $parameter = new TCallbackEventParameter($this->getResponse(), $action[1]); |
|
208 | + $parameter=new TCallbackEventParameter($this->getResponse(), $action[1]); |
|
209 | 209 | $this->onLoadingText($parameter); |
210 | 210 | } |
211 | 211 | $this->raiseEvent('OnCallback', $this, $param); |
@@ -216,26 +216,26 @@ discard block |
||
216 | 216 | */ |
217 | 217 | protected function getPostBackOptions() |
218 | 218 | { |
219 | - $options = parent::getPostBackOptions(); |
|
220 | - $options['ID'] = $this->getLabelClientID(); |
|
221 | - $options['TextBoxID'] = $this->getClientID(); |
|
222 | - $options['ExternalControl'] = $this->getExternalControlID(); |
|
223 | - $options['AutoHide'] = $this->getAutoHideTextBox() == false ? '' : true; |
|
224 | - $options['AutoPostBack'] = $this->getAutoPostBack() == false ? '' : true; |
|
225 | - $options['Columns'] = $this->getColumns(); |
|
219 | + $options=parent::getPostBackOptions(); |
|
220 | + $options['ID']=$this->getLabelClientID(); |
|
221 | + $options['TextBoxID']=$this->getClientID(); |
|
222 | + $options['ExternalControl']=$this->getExternalControlID(); |
|
223 | + $options['AutoHide']=$this->getAutoHideTextBox()==false ? '' : true; |
|
224 | + $options['AutoPostBack']=$this->getAutoPostBack()==false ? '' : true; |
|
225 | + $options['Columns']=$this->getColumns(); |
|
226 | 226 | if($this->getTextMode()==='MultiLine') |
227 | 227 | { |
228 | - $options['Rows'] = $this->getRows(); |
|
229 | - $options['Wrap'] = $this->getWrap()== false ? '' : true; |
|
228 | + $options['Rows']=$this->getRows(); |
|
229 | + $options['Wrap']=$this->getWrap()==false ? '' : true; |
|
230 | 230 | } |
231 | 231 | else |
232 | 232 | { |
233 | - $length = $this->getMaxLength(); |
|
234 | - $options['MaxLength'] = $length > 0 ? $length : ''; |
|
233 | + $length=$this->getMaxLength(); |
|
234 | + $options['MaxLength']=$length > 0 ? $length : ''; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | if($this->hasEventHandler('OnLoadingText')) |
238 | - $options['LoadTextOnEdit'] = true; |
|
238 | + $options['LoadTextOnEdit']=true; |
|
239 | 239 | |
240 | 240 | $options['ReadOnly']=$this->getReadOnly(); |
241 | 241 | return $options; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function onLoadingText($param) |
250 | 250 | { |
251 | - $this->raiseEvent('OnLoadingText',$this,$param); |
|
251 | + $this->raiseEvent('OnLoadingText', $this, $param); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | { |
268 | 268 | //calls the TWebControl to avoid rendering other attribute normally render for a textbox. |
269 | 269 | TWebControl::addAttributesToRender($writer); |
270 | - $writer->addAttribute('id',$this->getLabelClientID()); |
|
270 | + $writer->addAttribute('id', $this->getLabelClientID()); |
|
271 | 271 | $this->getActiveControl()->registerCallbackClientScript( |
272 | 272 | $this->getClientClassName(), $this->getPostBackOptions()); |
273 | 273 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @var boolean true if validation is made during a callback request. |
38 | 38 | */ |
39 | - private $_isCallback = false; |
|
39 | + private $_isCallback=false; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @return boolean true if validation is made during a callback request. |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function raiseCallbackEvent($param) |
95 | 95 | { |
96 | - $this->_isCallback = true; |
|
97 | - $result = $this->onServerValidate($param->getCallbackParameter()); |
|
96 | + $this->_isCallback=true; |
|
97 | + $result=$this->onServerValidate($param->getCallbackParameter()); |
|
98 | 98 | $param->setResponseData($result); |
99 | 99 | $this->onCallback($param); |
100 | 100 | } |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | parent::setIsValid($value); |
111 | 111 | if($this->getActiveControl()->canUpdateClientSide()) |
112 | 112 | { |
113 | - $client = $this->getPage()->getCallbackClient(); |
|
114 | - $func = 'Prado.Validation.updateActiveCustomValidator'; |
|
113 | + $client=$this->getPage()->getCallbackClient(); |
|
114 | + $func='Prado.Validation.updateActiveCustomValidator'; |
|
115 | 115 | $client->callClientFunction($func, array($this, $value)); |
116 | 116 | } |
117 | 117 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | protected function getClientScriptOptions() |
136 | 136 | { |
137 | 137 | $options=TBaseValidator::getClientScriptOptions(); |
138 | - $options['EventTarget'] = $this->getUniqueID(); |
|
138 | + $options['EventTarget']=$this->getUniqueID(); |
|
139 | 139 | return $options; |
140 | 140 | } |
141 | 141 | |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function setErrorMessage($value) |
147 | 147 | { |
148 | - if(parent::getErrorMessage() === $value) |
|
148 | + if(parent::getErrorMessage()===$value) |
|
149 | 149 | return; |
150 | 150 | |
151 | 151 | |
152 | 152 | parent::setErrorMessage($value); |
153 | 153 | if($this->getActiveControl()->canUpdateClientSide()) |
154 | 154 | { |
155 | - $client = $this->getPage()->getCallbackClient(); |
|
156 | - $func = 'Prado.Validation.setErrorMessage'; |
|
155 | + $client=$this->getPage()->getCallbackClient(); |
|
156 | + $func='Prado.Validation.setErrorMessage'; |
|
157 | 157 | $client->callClientFunction($func, array($this, $value)); |
158 | 158 | } |
159 | 159 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function getObserveChanges() |
265 | 265 | { |
266 | - $changes = $this->getOption('ObserveChanges'); |
|
266 | + $changes=$this->getOption('ObserveChanges'); |
|
267 | 267 | return ($changes===null) ? true : $changes; |
268 | 268 | } |
269 | 269 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @package System.Web.UI.WebControls |
46 | 46 | * @since 3.0 |
47 | 47 | */ |
48 | -class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingContainer, IPostBackDataHandler, IValidatable |
|
48 | +class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingContainer, IPostBackDataHandler, IValidatable |
|
49 | 49 | { |
50 | 50 | private $_repeatedControl; |
51 | 51 | private $_isEnabled; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function findControl($id, $real=false) |
86 | 86 | { |
87 | - if ($real===true) |
|
87 | + if($real===true) |
|
88 | 88 | return parent::findControl($id); |
89 | 89 | return $this; |
90 | 90 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getTextAlign() |
114 | 114 | { |
115 | - return $this->getViewState('TextAlign',TTextAlign::Right); |
|
115 | + return $this->getViewState('TextAlign', TTextAlign::Right); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function setTextAlign($value) |
122 | 122 | { |
123 | - $this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,'TTextAlign'),TTextAlign::Right); |
|
123 | + $this->setViewState('TextAlign', TPropertyValue::ensureEnum($value, 'TTextAlign'), TTextAlign::Right); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | */ |
130 | 130 | protected function getRepeatInfo() |
131 | 131 | { |
132 | - if(($repeatInfo=$this->getViewState('RepeatInfo',null))===null) |
|
132 | + if(($repeatInfo=$this->getViewState('RepeatInfo', null))===null) |
|
133 | 133 | { |
134 | 134 | $repeatInfo=new TRepeatInfo; |
135 | - $this->setViewState('RepeatInfo',$repeatInfo,null); |
|
135 | + $this->setViewState('RepeatInfo', $repeatInfo, null); |
|
136 | 136 | } |
137 | 137 | return $repeatInfo; |
138 | 138 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function setEnabled($value) |
262 | 262 | { |
263 | 263 | parent::setEnabled($value); |
264 | - $value = !TPropertyValue::ensureBoolean($value); |
|
264 | + $value=!TPropertyValue::ensureBoolean($value); |
|
265 | 265 | // if this is an active control, |
266 | 266 | // and it's a callback, |
267 | 267 | // and we can update clientside, |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | $this->getPage()->getIsCallBack() && |
271 | 271 | $this->getActiveControl()->canUpdateClientSide()) |
272 | 272 | { |
273 | - $items = $this->getItems(); |
|
274 | - $cs = $this->getPage()->getCallbackClient(); |
|
275 | - $baseClientID = $this->getClientID().'_c'; |
|
273 | + $items=$this->getItems(); |
|
274 | + $cs=$this->getPage()->getCallbackClient(); |
|
275 | + $baseClientID=$this->getClientID().'_c'; |
|
276 | 276 | foreach($items as $index=>$item) |
277 | 277 | { |
278 | 278 | $cs->setAttribute($baseClientID.$index, 'disabled', $value); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @param integer index of the item being rendered |
288 | 288 | * @return null |
289 | 289 | */ |
290 | - public function generateItemStyle($itemType,$index) |
|
290 | + public function generateItemStyle($itemType, $index) |
|
291 | 291 | { |
292 | 292 | return null; |
293 | 293 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param string item type (Header,Footer,Item,AlternatingItem,SelectedItem,EditItem,Separator,Pager) |
301 | 301 | * @param integer zero-based index of the item in the item list |
302 | 302 | */ |
303 | - public function renderItem($writer,$repeatInfo,$itemType,$index) |
|
303 | + public function renderItem($writer, $repeatInfo, $itemType, $index) |
|
304 | 304 | { |
305 | 305 | $repeatedControl=$this->_repeatedControl; |
306 | 306 | $item=$this->getItems()->itemAt($index); |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $repeatedControl->setID("c$index"); |
312 | 312 | $repeatedControl->setText($item->getText()); |
313 | 313 | $repeatedControl->setChecked($item->getSelected()); |
314 | - $repeatedControl->setAttribute('value',$item->getValue()); |
|
314 | + $repeatedControl->setAttribute('value', $item->getValue()); |
|
315 | 315 | $repeatedControl->setEnabled($this->_isEnabled && $item->getEnabled()); |
316 | 316 | $repeatedControl->setEnableClientScript(false); |
317 | 317 | $repeatedControl->renderControl($writer); |
@@ -324,13 +324,13 @@ discard block |
||
324 | 324 | * @param array the input data collection |
325 | 325 | * @return boolean whether the data of the control has been changed |
326 | 326 | */ |
327 | - public function loadPostData($key,$values) |
|
327 | + public function loadPostData($key, $values) |
|
328 | 328 | { |
329 | 329 | if($this->getEnabled(true)) |
330 | 330 | { |
331 | - $index=(int)substr($key,strlen($this->getUniqueID())+2); |
|
331 | + $index=(int) substr($key, strlen($this->getUniqueID()) + 2); |
|
332 | 332 | $this->ensureDataBound(); |
333 | - if($index>=0 && $index<$this->getItemCount()) |
|
333 | + if($index >= 0 && $index < $this->getItemCount()) |
|
334 | 334 | { |
335 | 335 | $item=$this->getItems()->itemAt($index); |
336 | 336 | if($item->getEnabled()) |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $this->_repeatedControl->setValidationGroup($this->getValidationGroup()); |
379 | 379 | $page=$this->getPage(); |
380 | 380 | $n=$this->getItemCount(); |
381 | - for($i=0;$i<$n;++$i) |
|
381 | + for($i=0; $i < $n; ++$i) |
|
382 | 382 | { |
383 | 383 | $this->_repeatedControl->setID("c$i"); |
384 | 384 | $page->registerRequiresPostData($this->_repeatedControl); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * |
391 | 391 | *@return boolean true if we need a span |
392 | 392 | */ |
393 | - protected function getSpanNeeded () |
|
393 | + protected function getSpanNeeded() |
|
394 | 394 | { |
395 | 395 | return $this->getRepeatLayout()===TRepeatLayout::Raw; |
396 | 396 | } |
@@ -402,12 +402,12 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function render($writer) |
404 | 404 | { |
405 | - if ($needSpan=$this->getSpanNeeded()) |
|
405 | + if($needSpan=$this->getSpanNeeded()) |
|
406 | 406 | { |
407 | 407 | $writer->addAttribute('id', $this->getClientId()); |
408 | 408 | $writer->renderBeginTag('span'); |
409 | 409 | } |
410 | - if($this->getItemCount()>0) |
|
410 | + if($this->getItemCount() > 0) |
|
411 | 411 | { |
412 | 412 | $this->_isEnabled=$this->getEnabled(true); |
413 | 413 | $repeatInfo=$this->getRepeatInfo(); |
@@ -419,11 +419,11 @@ discard block |
||
419 | 419 | $this->setAccessKey(''); |
420 | 420 | $this->setTabIndex(0); |
421 | 421 | $this->addAttributesToRender($writer); |
422 | - $repeatInfo->renderRepeater($writer,$this); |
|
422 | + $repeatInfo->renderRepeater($writer, $this); |
|
423 | 423 | $this->setAccessKey($accessKey); |
424 | 424 | $this->setTabIndex($tabIndex); |
425 | 425 | } |
426 | - if ($needSpan) |
|
426 | + if($needSpan) |
|
427 | 427 | $writer->renderEndTag(); |
428 | 428 | |
429 | 429 | //checkbox skipped the client control script in addAttributesToRender |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | */ |
490 | 490 | protected function getPostBackOptions() |
491 | 491 | { |
492 | - $options['ID'] = $this->getClientID(); |
|
493 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
494 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
495 | - $options['ListName'] = $this->getUniqueID(); |
|
496 | - $options['ItemCount'] = $this->getItemCount(); |
|
492 | + $options['ID']=$this->getClientID(); |
|
493 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
494 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
495 | + $options['ListName']=$this->getUniqueID(); |
|
496 | + $options['ItemCount']=$this->getItemCount(); |
|
497 | 497 | return $options; |
498 | 498 | } |
499 | 499 |
@@ -1,1 +1,1 @@ |
||
1 | -<?php /** * TEACache class file * * @author Dario rigolin <[email protected]> * @link https://github.com/pradosoft/prado * @copyright Copyright © 2005-2016 The PRADO Group * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Caching */ /** * TEACache class * * TEACache implements a cache application module based on {@link http://eaccelerator.net/ eAccelerator}. * * By definition, cache does not ensure the existence of a value * even if it never expires. Cache is not meant to be an persistent storage. * * To use this module, the eAccelerator PHP extension must be loaded and enabled * * Please note that as of v0.9.6, eAccelerator no longer supports data caching. * This means if you still want to use this component, your eAccelerator should be of 0.9.5.x or lower version. * * Some usage examples of TEACache are as follows, * <code> * $cache=new TEACache; // TEACache may also be loaded as a Prado application module * $cache->init(null); * $cache->add('object',$object); * $object2=$cache->get('object'); * </code> * * If loaded, TEACache will register itself with {@link TApplication} as the * cache module. It can be accessed via {@link TApplication::getCache()}. * * TEACache may be configured in application configuration file as follows * <code> * <module id="cache" class="System.Caching.TEACache" /> * </code> * * @author Dario Rigolin <[email protected]> * @package System.Caching * @since 3.2.2 */ class TEACache extends TCache { /** * Initializes this module. * This method is required by the IModule interface. * @param TXmlElement configuration for this module, can be null * @throws TConfigurationException if eaccelerator extension is not installed or not started, check your php.ini */ public function init($config) { if(!function_exists('eaccelerator_get')) throw new TConfigurationException('eacceleratorcache_extension_required'); parent::init($config); } /** * Retrieves a value from cache with a specified key. * This is the implementation of the method declared in the parent class. * @param string a unique key identifying the cached value * @return string the value stored in cache, false if the value is not in the cache or expired. */ protected function getValue($key) { $value = eaccelerator_get($key); return ($value === null) ? false : $value; } /** * Stores a value identified by a key in cache. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function setValue($key,$value,$expire) { return eaccelerator_put($key,$value,$expire); } /** * Stores a value identified by a key into cache if the cache does not contain this key. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function addValue($key,$value,$expire) { return (null === eaccelerator_get($key)) ? $this->setValue($key,$value,$expire) : false; } /** * Deletes a value with the specified key from cache * This is the implementation of the method declared in the parent class. * @param string the key of the value to be deleted * @return boolean if no error happens during deletion */ protected function deleteValue($key) { return eaccelerator_rm($key); } /** * Deletes all values from cache. * Be careful of performing this operation if the cache is shared by multiple applications. */ public function flush() { // first, remove expired content from cache eaccelerator_gc(); // now, remove leftover cache-keys $keys = eaccelerator_list_keys(); foreach($keys as $key) $this->deleteValue(substr($key['name'], 1)); return true; } } |
|
2 | 1 | \ No newline at end of file |
2 | +<?php /** * TEACache class file * * @author Dario rigolin <[email protected]> * @link https://github.com/pradosoft/prado * @copyright Copyright © 2005-2016 The PRADO Group * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Caching */ /** * TEACache class * * TEACache implements a cache application module based on {@link http://eaccelerator.net/ eAccelerator}. * * By definition, cache does not ensure the existence of a value * even if it never expires. Cache is not meant to be an persistent storage. * * To use this module, the eAccelerator PHP extension must be loaded and enabled * * Please note that as of v0.9.6, eAccelerator no longer supports data caching. * This means if you still want to use this component, your eAccelerator should be of 0.9.5.x or lower version. * * Some usage examples of TEACache are as follows, * <code> * $cache=new TEACache; // TEACache may also be loaded as a Prado application module * $cache->init(null); * $cache->add('object',$object); * $object2=$cache->get('object'); * </code> * * If loaded, TEACache will register itself with {@link TApplication} as the * cache module. It can be accessed via {@link TApplication::getCache()}. * * TEACache may be configured in application configuration file as follows * <code> * <module id="cache" class="System.Caching.TEACache" /> * </code> * * @author Dario Rigolin <[email protected]> * @package System.Caching * @since 3.2.2 */ class TEACache extends TCache { /** * Initializes this module. * This method is required by the IModule interface. * @param TXmlElement configuration for this module, can be null * @throws TConfigurationException if eaccelerator extension is not installed or not started, check your php.ini */ public function init($config) { if(!function_exists('eaccelerator_get')) throw new TConfigurationException('eacceleratorcache_extension_required'); parent::init($config); } /** * Retrieves a value from cache with a specified key. * This is the implementation of the method declared in the parent class. * @param string a unique key identifying the cached value * @return string the value stored in cache, false if the value is not in the cache or expired. */ protected function getValue($key) { $value=eaccelerator_get($key); return ($value===null) ? false : $value; } /** * Stores a value identified by a key in cache. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function setValue($key, $value, $expire) { return eaccelerator_put($key, $value, $expire); } /** * Stores a value identified by a key into cache if the cache does not contain this key. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function addValue($key, $value, $expire) { return (null===eaccelerator_get($key)) ? $this->setValue($key, $value, $expire) : false; } /** * Deletes a value with the specified key from cache * This is the implementation of the method declared in the parent class. * @param string the key of the value to be deleted * @return boolean if no error happens during deletion */ protected function deleteValue($key) { return eaccelerator_rm($key); } /** * Deletes all values from cache. * Be careful of performing this operation if the cache is shared by multiple applications. */ public function flush() { // first, remove expired content from cache eaccelerator_gc(); // now, remove leftover cache-keys $keys=eaccelerator_list_keys(); foreach($keys as $key) $this->deleteValue(substr($key['name'], 1)); return true; } } |
|
3 | 3 | \ No newline at end of file |
@@ -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 | } |
@@ -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 | '{', |