@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function getTagName() |
39 | 39 | { |
40 | - return ($this->getForControl()==='')?'span':'label'; |
|
40 | + return ($this->getForControl()==='') ? 'span' : 'label'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | protected function addAttributesToRender($writer) |
49 | 49 | { |
50 | 50 | if($this->_forControl!=='') |
51 | - $writer->addAttribute('for',$this->_forControl); |
|
51 | + $writer->addAttribute('for', $this->_forControl); |
|
52 | 52 | parent::addAttributesToRender($writer); |
53 | 53 | } |
54 | 54 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | } |
73 | 73 | else |
74 | - throw new TInvalidDataValueException('label_associatedcontrol_invalid',$aid); |
|
74 | + throw new TInvalidDataValueException('label_associatedcontrol_invalid', $aid); |
|
75 | 75 | } |
76 | 76 | else |
77 | 77 | parent::render($writer); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function getText() |
96 | 96 | { |
97 | - return $this->getViewState('Text',''); |
|
97 | + return $this->getViewState('Text', ''); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setText($value) |
104 | 104 | { |
105 | - $this->setViewState('Text',TPropertyValue::ensureString($value),''); |
|
105 | + $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function getForControl() |
138 | 138 | { |
139 | - return $this->getViewState('ForControl',''); |
|
139 | + return $this->getViewState('ForControl', ''); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setForControl($value) |
148 | 148 | { |
149 | - $this->setViewState('ForControl',$value,''); |
|
149 | + $this->setViewState('ForControl', $value, ''); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getMinSelection() |
78 | 78 | { |
79 | - return $this->getViewState('MinSelection',-1); |
|
79 | + return $this->getViewState('MinSelection', -1); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function setMinSelection($value) |
86 | 86 | { |
87 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
87 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
88 | 88 | $value=-1; |
89 | - $this->setViewState('MinSelection',$value,-1); |
|
89 | + $this->setViewState('MinSelection', $value, -1); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function getMaxSelection() |
96 | 96 | { |
97 | - return $this->getViewState('MaxSelection',-1); |
|
97 | + return $this->getViewState('MaxSelection', -1); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setMaxSelection($value) |
104 | 104 | { |
105 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
105 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
106 | 106 | $value=-1; |
107 | - $this->setViewState('MaxSelection',$value,-1); |
|
107 | + $this->setViewState('MaxSelection', $value, -1); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getRequiredSelections() |
115 | 115 | { |
116 | - return $this->getViewState('RequiredSelections',''); |
|
116 | + return $this->getViewState('RequiredSelections', ''); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function setRequiredSelections($value) |
124 | 124 | { |
125 | - $this->setViewState('RequiredSelections',$value,''); |
|
125 | + $this->setViewState('RequiredSelections', $value, ''); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -135,28 +135,28 @@ discard block |
||
135 | 135 | { |
136 | 136 | $control=$this->getValidationTarget(); |
137 | 137 | |
138 | - $exists = true; |
|
139 | - $values = $this->getSelection($control); |
|
140 | - $count = count($values); |
|
141 | - $required = $this->getRequiredValues(); |
|
138 | + $exists=true; |
|
139 | + $values=$this->getSelection($control); |
|
140 | + $count=count($values); |
|
141 | + $required=$this->getRequiredValues(); |
|
142 | 142 | |
143 | 143 | //if required, check the values |
144 | 144 | if(!empty($required)) |
145 | 145 | { |
146 | - if($count < count($required) ) |
|
146 | + if($count < count($required)) |
|
147 | 147 | return false; |
148 | 148 | foreach($required as $require) |
149 | - $exists = $exists && in_array($require, $values); |
|
149 | + $exists=$exists && in_array($require, $values); |
|
150 | 150 | } |
151 | 151 | |
152 | - $min = $this->getMinSelection(); |
|
153 | - $max = $this->getMaxSelection(); |
|
152 | + $min=$this->getMinSelection(); |
|
153 | + $max=$this->getMaxSelection(); |
|
154 | 154 | |
155 | - if($min !== -1 && $max !== -1) |
|
155 | + if($min!==-1 && $max!==-1) |
|
156 | 156 | return $exists && $count >= $min && $count <= $max; |
157 | - else if($min === -1 && $max !== -1) |
|
157 | + else if($min===-1 && $max!==-1) |
|
158 | 158 | return $exists && $count <= $max; |
159 | - else if($min !== -1 && $max === -1) |
|
159 | + else if($min!==-1 && $max===-1) |
|
160 | 160 | return $exists && $count >= $min; |
161 | 161 | else |
162 | 162 | return $exists; |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function getSelection($control) |
170 | 170 | { |
171 | - $values = array(); |
|
171 | + $values=array(); |
|
172 | 172 | |
173 | 173 | //get the data |
174 | 174 | foreach($control->getItems() as $item) |
175 | 175 | { |
176 | 176 | if($item->getSelected()) |
177 | - $values[] = $item->getValue(); |
|
177 | + $values[]=$item->getValue(); |
|
178 | 178 | } |
179 | 179 | return $values; |
180 | 180 | } |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function getRequiredValues() |
186 | 186 | { |
187 | - $required = array(); |
|
188 | - $string = $this->getRequiredSelections(); |
|
187 | + $required=array(); |
|
188 | + $string=$this->getRequiredSelections(); |
|
189 | 189 | if(!empty($string)) |
190 | - $required = preg_split('/,\s*/', $string); |
|
190 | + $required=preg_split('/,\s*/', $string); |
|
191 | 191 | return $required; |
192 | 192 | } |
193 | 193 | |
@@ -197,26 +197,26 @@ discard block |
||
197 | 197 | */ |
198 | 198 | protected function getClientScriptOptions() |
199 | 199 | { |
200 | - $options = parent::getClientScriptOptions(); |
|
201 | - $control = $this->getValidationTarget(); |
|
200 | + $options=parent::getClientScriptOptions(); |
|
201 | + $control=$this->getValidationTarget(); |
|
202 | 202 | |
203 | 203 | if(!$control instanceof TListControl) |
204 | 204 | { |
205 | 205 | throw new TConfigurationException( |
206 | 206 | 'listcontrolvalidator_invalid_control', |
207 | - $this->getID(),$this->getControlToValidate(), get_class($control)); |
|
207 | + $this->getID(), $this->getControlToValidate(), get_class($control)); |
|
208 | 208 | } |
209 | 209 | |
210 | - $min = $this->getMinSelection(); |
|
211 | - $max = $this->getMaxSelection(); |
|
212 | - if($min !== -1) |
|
213 | - $options['Min']= $min; |
|
214 | - if($max !== -1) |
|
215 | - $options['Max']= $max; |
|
216 | - $required = $this->getRequiredSelections(); |
|
210 | + $min=$this->getMinSelection(); |
|
211 | + $max=$this->getMaxSelection(); |
|
212 | + if($min!==-1) |
|
213 | + $options['Min']=$min; |
|
214 | + if($max!==-1) |
|
215 | + $options['Max']=$max; |
|
216 | + $required=$this->getRequiredSelections(); |
|
217 | 217 | if(strlen($required) > 0) |
218 | - $options['Required']= $required; |
|
219 | - $options['TotalItems'] = $control->getItemCount(); |
|
218 | + $options['Required']=$required; |
|
219 | + $options['TotalItems']=$control->getItemCount(); |
|
220 | 220 | |
221 | 221 | return $options; |
222 | 222 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function __construct() |
46 | 46 | { |
47 | 47 | parent::__construct(); |
48 | - $this->EnableViewState = false; |
|
48 | + $this->EnableViewState=false; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function setContinueBuffering($value) |
63 | 63 | { |
64 | - $this->_continueBuffering = TPropertyValue::ensureBoolean($value); |
|
64 | + $this->_continueBuffering=TPropertyValue::ensureBoolean($value); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | //$writer->write('<!-- flush -->'); |
74 | 74 | // ajax responses can't be parsed by the client side before loaded and returned completely, |
75 | 75 | // so don't bother with flushing output somewhere mid-page if refreshing in a callback |
76 | - if (!$this->Page->IsCallback) |
|
76 | + if(!$this->Page->IsCallback) |
|
77 | 77 | { |
78 | 78 | $this->Page->flushWriter(); |
79 | 79 | // $this->Application->flushOutput($this->ContinueBuffering); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | parent::loadState($state); |
78 | 78 | $this->_stateLoaded=true; |
79 | 79 | if(!$this->_dataBound) |
80 | - $this->_listControl->getItems()->loadState($this->getViewState('Items',null)); |
|
80 | + $this->_listControl->getItems()->loadState($this->getViewState('Items', null)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function saveState() |
88 | 88 | { |
89 | - $this->setViewState('Items',$this->_listControl->getItems()->saveState(),null); |
|
89 | + $this->setViewState('Items', $this->_listControl->getItems()->saveState(), null); |
|
90 | 90 | return parent::saveState(); |
91 | 91 | } |
92 | 92 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getDataTextField() |
113 | 113 | { |
114 | - return $this->getViewState('DataTextField',''); |
|
114 | + return $this->getViewState('DataTextField', ''); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function setDataTextField($value) |
124 | 124 | { |
125 | - $this->setViewState('DataTextField',$value,''); |
|
125 | + $this->setViewState('DataTextField', $value, ''); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function getDataTextFormatString() |
132 | 132 | { |
133 | - return $this->getViewState('DataTextFormatString',''); |
|
133 | + return $this->getViewState('DataTextFormatString', ''); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function setDataTextFormatString($value) |
140 | 140 | { |
141 | - $this->setViewState('DataTextFormatString',$value,''); |
|
141 | + $this->setViewState('DataTextFormatString', $value, ''); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function getDataValueField() |
148 | 148 | { |
149 | - return $this->getViewState('DataValueField',''); |
|
149 | + return $this->getViewState('DataValueField', ''); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function setDataValueField($value) |
159 | 159 | { |
160 | - $this->setViewState('DataValueField',$value,''); |
|
160 | + $this->setViewState('DataValueField', $value, ''); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function getReadOnly() |
167 | 167 | { |
168 | - return $this->getViewState('ReadOnly',false); |
|
168 | + return $this->getViewState('ReadOnly', false); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function setReadOnly($value) |
175 | 175 | { |
176 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
176 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function getListValueField() |
199 | 199 | { |
200 | - return $this->getViewState('ListValueField',''); |
|
200 | + return $this->getViewState('ListValueField', ''); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function setListValueField($value) |
207 | 207 | { |
208 | - $this->setViewState('ListValueField',$value,''); |
|
208 | + $this->setViewState('ListValueField', $value, ''); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function getListTextField() |
215 | 215 | { |
216 | - return $this->getViewState('ListTextField',''); |
|
216 | + return $this->getViewState('ListTextField', ''); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function setListTextField($value) |
223 | 223 | { |
224 | - $this->setViewState('ListTextField',$value,''); |
|
224 | + $this->setViewState('ListTextField', $value, ''); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public function getListTextFormatString() |
231 | 231 | { |
232 | - return $this->getViewState('ListTextFormatString',''); |
|
232 | + return $this->getViewState('ListTextFormatString', ''); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function setListTextFormatString($value) |
239 | 239 | { |
240 | - $this->setViewState('ListTextFormatString',$value,''); |
|
240 | + $this->setViewState('ListTextFormatString', $value, ''); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param integer the index to the Columns property that the cell resides in. |
252 | 252 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
253 | 253 | */ |
254 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
254 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
255 | 255 | { |
256 | 256 | if(!$this->_dataBound && $this->_listControl->getDataSource()!==null) |
257 | 257 | { |
@@ -268,21 +268,21 @@ discard block |
||
268 | 268 | { |
269 | 269 | $listControl=clone $this->_listControl; |
270 | 270 | $cell->getControls()->add($listControl); |
271 | - $cell->registerObject('DropDownList',$listControl); |
|
271 | + $cell->registerObject('DropDownList', $listControl); |
|
272 | 272 | $control=$listControl; |
273 | 273 | } |
274 | 274 | else |
275 | 275 | $control=$cell; |
276 | - $control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
276 | + $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
277 | 277 | break; |
278 | 278 | case TListItemType::Item: |
279 | 279 | case TListItemType::AlternatingItem: |
280 | 280 | case TListItemType::SelectedItem: |
281 | 281 | if($this->getDataTextField()!=='' || $this->getDataValueField()!=='') |
282 | - $cell->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
282 | + $cell->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
283 | 283 | break; |
284 | 284 | default: |
285 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
285 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
286 | 286 | break; |
287 | 287 | } |
288 | 288 | } |
@@ -292,21 +292,21 @@ discard block |
||
292 | 292 | * This method is invoked when datagrid performs databinding. |
293 | 293 | * It populates the content of the cell with the relevant data from data source. |
294 | 294 | */ |
295 | - public function dataBindColumn($sender,$param) |
|
295 | + public function dataBindColumn($sender, $param) |
|
296 | 296 | { |
297 | 297 | $item=$sender->getNamingContainer(); |
298 | 298 | $data=$item->getData(); |
299 | 299 | if(($valueField=$this->getDataValueField())!=='') |
300 | - $value=$this->getDataFieldValue($data,$valueField); |
|
300 | + $value=$this->getDataFieldValue($data, $valueField); |
|
301 | 301 | else |
302 | 302 | $value=''; |
303 | 303 | if(($textField=$this->getDataTextField())!=='') |
304 | 304 | { |
305 | - $text=$this->getDataFieldValue($data,$textField); |
|
305 | + $text=$this->getDataFieldValue($data, $textField); |
|
306 | 306 | if($valueField==='') |
307 | 307 | $value=$text; |
308 | 308 | $formatString=$this->getDataTextFormatString(); |
309 | - $text=$this->formatDataValue($formatString,$text); |
|
309 | + $text=$this->formatDataValue($formatString, $text); |
|
310 | 310 | } |
311 | 311 | else |
312 | 312 | $text=$value; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function addAttributesToRender($writer) |
54 | 54 | { |
55 | - $writer->addAttribute('name',$this->getUniqueID()); |
|
55 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
56 | 56 | parent::addAttributesToRender($writer); |
57 | 57 | } |
58 | 58 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @param array the input data collection |
74 | 74 | * @return boolean whether the data of the component has been changed |
75 | 75 | */ |
76 | - public function loadPostData($key,$values) |
|
76 | + public function loadPostData($key, $values) |
|
77 | 77 | { |
78 | 78 | if(!$this->getEnabled(true)) |
79 | 79 | return false; |
80 | 80 | $this->ensureDataBound(); |
81 | - $selection=isset($values[$key])?$values[$key]:null; |
|
81 | + $selection=isset($values[$key]) ? $values[$key] : null; |
|
82 | 82 | if($selection!==null) |
83 | 83 | { |
84 | - $index=$this->getItems()->findIndexByValue($selection,false); |
|
84 | + $index=$this->getItems()->findIndexByValue($selection, false); |
|
85 | 85 | if($this->getSelectedIndex()!==$index) |
86 | 86 | { |
87 | 87 | $this->setSelectedIndex($index); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function getText() |
38 | 38 | { |
39 | - return $this->getViewState('Text',''); |
|
39 | + return $this->getViewState('Text', ''); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function setText($value) |
47 | 47 | { |
48 | - $this->setViewState('Text',TPropertyValue::ensureString($value),''); |
|
48 | + $this->setViewState('Text', TPropertyValue::ensureString($value), ''); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getEncode() |
81 | 81 | { |
82 | - return $this->getViewState('Encode',false); |
|
82 | + return $this->getViewState('Encode', false); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setEncode($value) |
89 | 89 | { |
90 | - $this->setViewState('Encode',TPropertyValue::ensureBoolean($value),false); |
|
90 | + $this->setViewState('Encode', TPropertyValue::ensureBoolean($value), false); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function getRegularExpression() |
64 | 64 | { |
65 | - return $this->getViewState('RegularExpression',''); |
|
65 | + return $this->getViewState('RegularExpression', ''); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function setRegularExpression($value) |
72 | 72 | { |
73 | - $this->setViewState('RegularExpression',$value,''); |
|
73 | + $this->setViewState('RegularExpression', $value, ''); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | { |
85 | 85 | if(($value=$this->getValidationValue($this->getValidationTarget()))==='') |
86 | 86 | return true; |
87 | - if(($expression=addcslashes($this->getRegularExpression(),"/"))!=='') |
|
87 | + if(($expression=addcslashes($this->getRegularExpression(), "/"))!=='') |
|
88 | 88 | { |
89 | - $mods = $this->getPatternModifiers(); |
|
90 | - return preg_match("/^$expression\$/{$mods}",$value); |
|
89 | + $mods=$this->getPatternModifiers(); |
|
90 | + return preg_match("/^$expression\$/{$mods}", $value); |
|
91 | 91 | } |
92 | 92 | else |
93 | 93 | return true; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function getClientScriptOptions() |
135 | 135 | { |
136 | - $options = parent::getClientScriptOptions(); |
|
136 | + $options=parent::getClientScriptOptions(); |
|
137 | 137 | $options['ValidationExpression']=$this->getRegularExpression(); |
138 | 138 | $options['PatternModifiers']=$this->getClientSidePatternModifiers(); |
139 | 139 | return $options; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getCaptchaControl() |
52 | 52 | { |
53 | - return $this->getViewState('CaptchaControl',''); |
|
53 | + return $this->getViewState('CaptchaControl', ''); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function setCaptchaControl($value) |
63 | 63 | { |
64 | - $this->setViewState('CaptchaControl',TPropertyValue::ensureString($value),''); |
|
64 | + $this->setViewState('CaptchaControl', TPropertyValue::ensureString($value), ''); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | if(($id=$this->getCaptchaControl())==='') |
88 | 88 | throw new TConfigurationException('captchavalidator_captchacontrol_required'); |
89 | 89 | else if(($control=$this->findControl($id))===null) |
90 | - throw new TConfigurationException('captchavalidator_captchacontrol_inexistent',$id); |
|
90 | + throw new TConfigurationException('captchavalidator_captchacontrol_inexistent', $id); |
|
91 | 91 | else if(!($control instanceof TCaptcha)) |
92 | - throw new TConfigurationException('captchavalidator_captchacontrol_invalid',$id); |
|
92 | + throw new TConfigurationException('captchavalidator_captchacontrol_invalid', $id); |
|
93 | 93 | else |
94 | 94 | return $control; |
95 | 95 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | private function generateTokenHash($token) |
119 | 119 | { |
120 | - for($h=0,$i=strlen($token)-1;$i>=0;--$i) |
|
120 | + for($h=0, $i=strlen($token) - 1; $i >= 0; --$i) |
|
121 | 121 | $h+=ord($token[$i]); |
122 | 122 | return $h; |
123 | 123 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function setHistorySize($value) |
81 | 81 | { |
82 | - if(($value=TPropertyValue::ensureInteger($value))>0) |
|
82 | + if(($value=TPropertyValue::ensureInteger($value)) > 0) |
|
83 | 83 | $this->_historySize=$value; |
84 | 84 | else |
85 | 85 | throw new TInvalidDataValueException('sessionpagestatepersister_historysize_invalid'); |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | $session=$this->_page->getSession(); |
94 | 94 | $session->open(); |
95 | 95 | $data=serialize($state); |
96 | - $timestamp=(string)microtime(true); |
|
96 | + $timestamp=(string) microtime(true); |
|
97 | 97 | $key=self::STATE_SESSION_KEY.$timestamp; |
98 | - $session->add($key,$data); |
|
98 | + $session->add($key, $data); |
|
99 | 99 | if(($queue=$session->itemAt(self::QUEUE_SESSION_KEY))===null) |
100 | 100 | $queue=array(); |
101 | 101 | $queue[]=$key; |
102 | - if(count($queue)>$this->getHistorySize()) |
|
102 | + if(count($queue) > $this->getHistorySize()) |
|
103 | 103 | { |
104 | 104 | $expiredKey=array_shift($queue); |
105 | 105 | $session->remove($expiredKey); |
106 | 106 | } |
107 | - $session->add(self::QUEUE_SESSION_KEY,$queue); |
|
108 | - $this->_page->setClientState(TPageStateFormatter::serialize($this->_page,$timestamp)); |
|
107 | + $session->add(self::QUEUE_SESSION_KEY, $queue); |
|
108 | + $this->_page->setClientState(TPageStateFormatter::serialize($this->_page, $timestamp)); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function load() |
117 | 117 | { |
118 | - if(($timestamp=TPageStateFormatter::unserialize($this->_page,$this->_page->getRequestClientState()))!==null) |
|
118 | + if(($timestamp=TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState()))!==null) |
|
119 | 119 | { |
120 | 120 | $session=$this->_page->getSession(); |
121 | 121 | $session->open(); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if(($data=$session->itemAt($key))!==null) |
124 | 124 | return unserialize($data); |
125 | 125 | } |
126 | - throw new THttpException(400,'sessionpagestatepersister_pagestate_corrupted'); |
|
126 | + throw new THttpException(400, 'sessionpagestatepersister_pagestate_corrupted'); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 |