@@ -56,7 +56,7 @@ |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | - * @return array list of trigger callback options. |
|
59 | + * @return string list of trigger callback options. |
|
60 | 60 | */ |
61 | 61 | protected function getTriggerOptions() |
62 | 62 | { |
@@ -45,9 +45,9 @@ |
||
45 | 45 | protected function getTargetControl() |
46 | 46 | { |
47 | 47 | $id = $this->getControlID(); |
48 | - if(($control=$this->findControl($id)) instanceof TControl) |
|
48 | + if (($control = $this->findControl($id)) instanceof TControl) |
|
49 | 49 | return $control->getClientID(); |
50 | - if($id==='') |
|
50 | + if ($id === '') |
|
51 | 51 | { |
52 | 52 | throw new TConfigurationException( |
53 | 53 | 'ttriggeredcallback_invalid_controlid', get_class($this)); |
@@ -252,6 +252,7 @@ discard block |
||
252 | 252 | * method, be sure to call the parent implementation so that the event |
253 | 253 | * handler can be invoked. |
254 | 254 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
255 | + * @param TJuiAutoCompleteEventParameter $param |
|
255 | 256 | */ |
256 | 257 | public function onSuggest($param) |
257 | 258 | { |
@@ -264,6 +265,7 @@ discard block |
||
264 | 265 | * method, be sure to call the parent implementation so that the event |
265 | 266 | * handler can be invoked. |
266 | 267 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
268 | + * @param TJuiAutoCompleteEventParameter $param |
|
267 | 269 | */ |
268 | 270 | public function onSuggestionSelected($param) |
269 | 271 | { |
@@ -441,6 +443,7 @@ discard block |
||
441 | 443 | |
442 | 444 | /** |
443 | 445 | * Creates a new TCallbackEventParameter. |
446 | + * @param THttpResponse $response |
|
444 | 447 | */ |
445 | 448 | public function __construct($response, $parameter, $index=-1) |
446 | 449 | { |
@@ -235,14 +235,12 @@ |
||
235 | 235 | { |
236 | 236 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
237 | 237 | $this->onSuggest($parameter); |
238 | - } |
|
239 | - else if($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
238 | + } else if($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
240 | 239 | { |
241 | 240 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
242 | 241 | $this->onSuggestionSelected($parameter); |
243 | 242 | } |
244 | - } |
|
245 | - else if($this->getAutoPostBack()) |
|
243 | + } else if($this->getAutoPostBack()) |
|
246 | 244 | parent::raiseCallbackEvent($param); |
247 | 245 | } |
248 | 246 |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * @var ITemplate template for repeater items |
86 | 86 | */ |
87 | - private $_repeater=null; |
|
87 | + private $_repeater = null; |
|
88 | 88 | /** |
89 | 89 | * @var TPanel result panel holding the suggestion items. |
90 | 90 | */ |
91 | - private $_resultPanel=null; |
|
91 | + private $_resultPanel = null; |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Creates a new callback control, sets the adapter to |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function getOptions() |
125 | 125 | { |
126 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
126 | + if (($options = $this->getViewState('JuiOptions')) === null) |
|
127 | 127 | { |
128 | - $options=new TJuiControlOptions($this); |
|
128 | + $options = new TJuiControlOptions($this); |
|
129 | 129 | $this->setViewState('JuiOptions', $options); |
130 | 130 | } |
131 | 131 | return $options; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function getMinChars() |
206 | 206 | { |
207 | - return $this->getViewState('minChars',''); |
|
207 | + return $this->getViewState('minChars', ''); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -229,20 +229,20 @@ discard block |
||
229 | 229 | public function raiseCallbackEvent($param) |
230 | 230 | { |
231 | 231 | $token = $param->getCallbackParameter(); |
232 | - if(is_array($token) && count($token) == 2) |
|
232 | + if (is_array($token) && count($token) == 2) |
|
233 | 233 | { |
234 | - if($token[1] === '__TJuiAutoComplete_onSuggest__') |
|
234 | + if ($token[1] === '__TJuiAutoComplete_onSuggest__') |
|
235 | 235 | { |
236 | 236 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
237 | 237 | $this->onSuggest($parameter); |
238 | 238 | } |
239 | - else if($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
239 | + else if ($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
240 | 240 | { |
241 | 241 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
242 | 242 | $this->onSuggestionSelected($parameter); |
243 | 243 | } |
244 | 244 | } |
245 | - else if($this->getAutoPostBack()) |
|
245 | + else if ($this->getAutoPostBack()) |
|
246 | 246 | parent::raiseCallbackEvent($param); |
247 | 247 | } |
248 | 248 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | public function dataBind() |
286 | 286 | { |
287 | 287 | parent::dataBind(); |
288 | - if($this->getPage()->getIsCallback()) |
|
288 | + if ($this->getPage()->getIsCallback()) |
|
289 | 289 | $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
290 | 290 | } |
291 | 291 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function getResultPanel() |
296 | 296 | { |
297 | - if($this->_resultPanel===null) |
|
297 | + if ($this->_resultPanel === null) |
|
298 | 298 | $this->_resultPanel = $this->createResultPanel(); |
299 | 299 | return $this->_resultPanel; |
300 | 300 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function getSuggestions() |
317 | 317 | { |
318 | - if($this->_repeater===null) |
|
318 | + if ($this->_repeater === null) |
|
319 | 319 | $this->_repeater = $this->createRepeater(); |
320 | 320 | return $this->_repeater; |
321 | 321 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | protected function createRepeater() |
327 | 327 | { |
328 | 328 | $repeater = Prado::createComponent('System.Web.UI.WebControls.TRepeater'); |
329 | - $repeater->setItemTemplate(new TTemplate('<%# $this->Data %>',null)); |
|
329 | + $repeater->setItemTemplate(new TTemplate('<%# $this->Data %>', null)); |
|
330 | 330 | $this->getControls()->add($repeater); |
331 | 331 | return $repeater; |
332 | 332 | } |
@@ -364,16 +364,16 @@ discard block |
||
364 | 364 | */ |
365 | 365 | public function renderSuggestions($writer) |
366 | 366 | { |
367 | - if($this->getActiveControl()->canUpdateClientSide(true)) |
|
367 | + if ($this->getActiveControl()->canUpdateClientSide(true)) |
|
368 | 368 | { |
369 | - $data=array(); |
|
370 | - $items=$this->getSuggestions()->getItems(); |
|
369 | + $data = array(); |
|
370 | + $items = $this->getSuggestions()->getItems(); |
|
371 | 371 | $writer = new TTextWriter; |
372 | - for($i=0; $i<$items->Count; $i++) |
|
372 | + for ($i = 0; $i < $items->Count; $i++) |
|
373 | 373 | { |
374 | 374 | $items->itemAt($i)->render($writer); |
375 | - $item=$writer->flush(); |
|
376 | - $data[]=array( 'id' => $i, 'label' => $item); |
|
375 | + $item = $writer->flush(); |
|
376 | + $data[] = array('id' => $i, 'label' => $item); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | $this->getResponse()->getAdapter()->setResponseData($data); |
@@ -387,19 +387,19 @@ discard block |
||
387 | 387 | { |
388 | 388 | $options = $this->getOptions()->toArray(); |
389 | 389 | |
390 | - if(strlen($separator = $this->getSeparator())) |
|
390 | + if (strlen($separator = $this->getSeparator())) |
|
391 | 391 | $options['Separators'] = $separator; |
392 | 392 | |
393 | - if($this->getAutoPostBack()) |
|
393 | + if ($this->getAutoPostBack()) |
|
394 | 394 | { |
395 | - $options = array_merge($options,parent::getPostBackOptions()); |
|
395 | + $options = array_merge($options, parent::getPostBackOptions()); |
|
396 | 396 | $options['AutoPostBack'] = true; |
397 | 397 | } |
398 | - if(strlen($textCssClass = $this->getTextCssClass())) |
|
398 | + if (strlen($textCssClass = $this->getTextCssClass())) |
|
399 | 399 | $options['textCssClass'] = $textCssClass; |
400 | 400 | $options['minLength'] = $this->getMinChars(); |
401 | - $options['delay'] = $this->getFrequency()*1000.0; |
|
402 | - $options['appendTo'] = '#'.$this->getResultPanel()->getClientID(); |
|
401 | + $options['delay'] = $this->getFrequency() * 1000.0; |
|
402 | + $options['appendTo'] = '#' . $this->getResultPanel()->getClientID(); |
|
403 | 403 | $options['ID'] = $this->getClientID(); |
404 | 404 | $options['EventTarget'] = $this->getUniqueID(); |
405 | 405 | $options['CausesValidation'] = $this->getCausesValidation(); |
@@ -437,15 +437,15 @@ discard block |
||
437 | 437 | */ |
438 | 438 | class TJuiAutoCompleteEventParameter extends TCallbackEventParameter |
439 | 439 | { |
440 | - private $_selectedIndex=-1; |
|
440 | + private $_selectedIndex = -1; |
|
441 | 441 | |
442 | 442 | /** |
443 | 443 | * Creates a new TCallbackEventParameter. |
444 | 444 | */ |
445 | - public function __construct($response, $parameter, $index=-1) |
|
445 | + public function __construct($response, $parameter, $index = -1) |
|
446 | 446 | { |
447 | 447 | parent::__construct($response, $parameter); |
448 | - $this->_selectedIndex=$index; |
|
448 | + $this->_selectedIndex = $index; |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Publish the jQuery-ui style Css asset file. |
81 | - * @param file name |
|
81 | + * @param file string |
|
82 | 82 | * @return string Css file url. |
83 | 83 | */ |
84 | 84 | public function publishJuiStyle($file) |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * Gets a control instance named after a returned control id. |
154 | 154 | * Example: if a $param->draggable control id is returned from clientside, |
155 | 155 | * calling $param->DraggableControl will return the control instance |
156 | - * @return mixed control or null if not set. |
|
156 | + * @return null|TControl control or null if not set. |
|
157 | 157 | */ |
158 | 158 | public function __get($name) |
159 | 159 | { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | const SCRIPT_PATH = 'jquery'; |
29 | 29 | const CSS_PATH = 'css'; |
30 | - const BASE_CSS_FILENAME ='jquery-ui.css'; |
|
30 | + const BASE_CSS_FILENAME = 'jquery-ui.css'; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Replace default StateTracker with {@link TJuiCallbackPageStateTracker} for |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | * @param string jQuery asset file in the self::SCRIPT_PATH directory. |
71 | 71 | * @return string jQuery asset url. |
72 | 72 | */ |
73 | - protected function getAssetUrl($file='') |
|
73 | + protected function getAssetUrl($file = '') |
|
74 | 74 | { |
75 | 75 | $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
76 | - return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
|
76 | + return $base . '/' . self::SCRIPT_PATH . '/' . $file; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function publishJuiStyle($file) |
85 | 85 | { |
86 | - $url = $this->getAssetUrl(self::CSS_PATH.'/'.$this->getJuiBaseStyle().'/'.$file); |
|
86 | + $url = $this->getAssetUrl(self::CSS_PATH . '/' . $this->getJuiBaseStyle() . '/' . $file); |
|
87 | 87 | $cs = $this->getPage()->getClientScript(); |
88 | - if(!$cs->isStyleSheetFileRegistered($url)) |
|
88 | + if (!$cs->isStyleSheetFileRegistered($url)) |
|
89 | 89 | $cs->registerStyleSheetFile($url, $url); |
90 | 90 | return $url; |
91 | 91 | } |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function getControl($id) |
139 | 139 | { |
140 | - $control=null; |
|
141 | - $service=prado::getApplication()->getService(); |
|
140 | + $control = null; |
|
141 | + $service = prado::getApplication()->getService(); |
|
142 | 142 | if ($service instanceof TPageService) |
143 | 143 | { |
144 | 144 | // Find the control |
145 | 145 | // Warning, this will not work if you have a '_' in your control Id ! |
146 | - $controlId=str_replace(TControl::CLIENT_ID_SEPARATOR,TControl::ID_SEPARATOR,$id); |
|
147 | - $control=$service->getRequestedPage()->findControl($controlId); |
|
146 | + $controlId = str_replace(TControl::CLIENT_ID_SEPARATOR, TControl::ID_SEPARATOR, $id); |
|
147 | + $control = $service->getRequestedPage()->findControl($controlId); |
|
148 | 148 | } |
149 | 149 | return $control; |
150 | 150 | } |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function __get($name) |
159 | 159 | { |
160 | - $pos=strpos($name, 'Control',1); |
|
161 | - $name=strtolower(substr($name, 0, $pos)); |
|
160 | + $pos = strpos($name, 'Control', 1); |
|
161 | + $name = strtolower(substr($name, 0, $pos)); |
|
162 | 162 | |
163 | - $cp=$this->getCallbackParameter(); |
|
164 | - if(!isset($cp->$name) || $cp->$name=='') |
|
163 | + $cp = $this->getCallbackParameter(); |
|
164 | + if (!isset($cp->$name) || $cp->$name == '') |
|
165 | 165 | return null; |
166 | 166 | |
167 | 167 | return $this->getControl($cp->$name); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function loadState() { |
98 | 98 | parent::loadState(); |
99 | - $this->getControl()->getOptions()->setControl($this->getControl()); |
|
99 | + $this->getControl()->getOptions()->setControl($this->getControl()); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | } |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | class TJuiEventParameter extends TCallbackEventParameter |
131 | 131 | { |
132 | 132 | /** |
133 | - * getControl |
|
134 | - * |
|
135 | - * Compatibility method to get a control from its clientside id |
|
136 | - * @return TControl control, or null if not found |
|
133 | + * getControl |
|
134 | + * |
|
135 | + * Compatibility method to get a control from its clientside id |
|
136 | + * @return TControl control, or null if not found |
|
137 | 137 | */ |
138 | 138 | public function getControl($id) |
139 | 139 | { |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function addStatesToTrack() |
186 | 186 | { |
187 | - parent::addStatesToTrack(); |
|
188 | - $states = $this->getStatesToTrack(); |
|
189 | - $states['JuiOptions'] = array('TMapCollectionDiff', array($this, 'updateJuiOptions')); |
|
187 | + parent::addStatesToTrack(); |
|
188 | + $states = $this->getStatesToTrack(); |
|
189 | + $states['JuiOptions'] = array('TMapCollectionDiff', array($this, 'updateJuiOptions')); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | */ |
196 | 196 | protected function updateJuiOptions($options) |
197 | 197 | { |
198 | - foreach ($options as $key => $value) $options[$key] = $key . ': ' . (is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value)); |
|
199 | - $code = "jQuery('#{$this->_control->getWidgetID()}').{$this->_control->getWidget()}('option', { " . implode(', ', $options) . " });"; |
|
200 | - $this->_control->getPage()->getClientScript()->registerEndScript(sprintf('%08X', crc32($code)), $code); |
|
198 | + foreach ($options as $key => $value) $options[$key] = $key . ': ' . (is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value)); |
|
199 | + $code = "jQuery('#{$this->_control->getWidgetID()}').{$this->_control->getWidget()}('option', { " . implode(', ', $options) . " });"; |
|
200 | + $this->_control->getPage()->getClientScript()->registerEndScript(sprintf('%08X', crc32($code)), $code); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | } |
204 | 204 | \ No newline at end of file |
@@ -195,7 +195,9 @@ |
||
195 | 195 | */ |
196 | 196 | protected function updateJuiOptions($options) |
197 | 197 | { |
198 | - foreach ($options as $key => $value) $options[$key] = $key . ': ' . (is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value)); |
|
198 | + foreach ($options as $key => $value) { |
|
199 | + $options[$key] = $key . ': ' . (is_string($value) ? "'{$value}'" : TPropertyValue::ensureString($value)); |
|
200 | + } |
|
199 | 201 | $code = "jQuery('#{$this->_control->getWidgetID()}').{$this->_control->getWidget()}('option', { " . implode(', ', $options) . " });"; |
200 | 202 | $this->_control->getPage()->getClientScript()->registerEndScript(sprintf('%08X', crc32($code)), $code); |
201 | 203 | } |
@@ -21,9 +21,24 @@ discard block |
||
21 | 21 | */ |
22 | 22 | interface IJuiOptions |
23 | 23 | { |
24 | + /** |
|
25 | + * @return string |
|
26 | + */ |
|
24 | 27 | public function getWidget(); |
28 | + |
|
29 | + /** |
|
30 | + * @return string |
|
31 | + */ |
|
25 | 32 | public function getWidgetID(); |
33 | + |
|
34 | + /** |
|
35 | + * @return TJuiControlOptions |
|
36 | + */ |
|
26 | 37 | public function getOptions(); |
38 | + |
|
39 | + /** |
|
40 | + * @return string[] |
|
41 | + */ |
|
27 | 42 | public function getValidOptions(); |
28 | 43 | public function getValidEvents(); |
29 | 44 | } |
@@ -139,7 +154,7 @@ discard block |
||
139 | 154 | |
140 | 155 | /** |
141 | 156 | * Only serialize the options itself, not the corresponding parent control. |
142 | - * @return mixed array with the names of all variables of that object that should be serialized. |
|
157 | + * @return string[] array with the names of all variables of that object that should be serialized. |
|
143 | 158 | */ |
144 | 159 | public function __sleep() { |
145 | 160 | return array('_options'); |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function setControl($control) |
73 | 73 | { |
74 | - if(!$control instanceof IJuiOptions) |
|
75 | - throw new THttpException(500,'juioptions_control_invalid',$control->ID); |
|
76 | - $this->_control=$control; |
|
74 | + if (!$control instanceof IJuiOptions) |
|
75 | + throw new THttpException(500, 'juioptions_control_invalid', $control->ID); |
|
76 | + $this->_control = $control; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -83,27 +83,27 @@ discard block |
||
83 | 83 | * @param mixed option value. |
84 | 84 | * @throws THttpException |
85 | 85 | */ |
86 | - public function __set($name,$value) |
|
86 | + public function __set($name, $value) |
|
87 | 87 | { |
88 | - if($this->_options===null) |
|
89 | - $this->_options=array(); |
|
88 | + if ($this->_options === null) |
|
89 | + $this->_options = array(); |
|
90 | 90 | |
91 | - foreach($this->_control->getValidOptions() as $option) |
|
91 | + foreach ($this->_control->getValidOptions() as $option) |
|
92 | 92 | { |
93 | - if(0 == strcasecmp($name, $option)) |
|
93 | + if (0 == strcasecmp($name, $option)) |
|
94 | 94 | { |
95 | 95 | $low = strtolower($value); |
96 | - if($low === 'null') |
|
96 | + if ($low === 'null') |
|
97 | 97 | { |
98 | 98 | $this->_options[$option] = null; |
99 | - } elseif($low === 'true') { |
|
99 | + } elseif ($low === 'true') { |
|
100 | 100 | $this->_options[$option] = true; |
101 | - } elseif($low === 'false') { |
|
101 | + } elseif ($low === 'false') { |
|
102 | 102 | $this->_options[$option] = false; |
103 | - } elseif(is_numeric($value)) { |
|
103 | + } elseif (is_numeric($value)) { |
|
104 | 104 | // trick to get float or integer automatically when needed |
105 | 105 | $this->_options[$option] = $value + 0; |
106 | - } elseif(substr($low,0,8)=='function') { |
|
106 | + } elseif (substr($low, 0, 8) == 'function') { |
|
107 | 107 | $this->_options[$option] = new TJavaScriptLiteral($value); |
108 | 108 | } else { |
109 | 109 | $this->_options[$option] = $value; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - throw new TConfigurationException('juioptions_option_invalid',$this->_control->ID, $name); |
|
115 | + throw new TConfigurationException('juioptions_option_invalid', $this->_control->ID, $name); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function __get($name) |
125 | 125 | { |
126 | - if($this->_options===null) |
|
127 | - $this->_options=array(); |
|
126 | + if ($this->_options === null) |
|
127 | + $this->_options = array(); |
|
128 | 128 | |
129 | - foreach($this->_control->getValidOptions() as $option) |
|
129 | + foreach ($this->_control->getValidOptions() as $option) |
|
130 | 130 | { |
131 | - if(0 == strcasecmp($name, $option) && isset($this->_options[$option])) |
|
131 | + if (0 == strcasecmp($name, $option) && isset($this->_options[$option])) |
|
132 | 132 | { |
133 | 133 | return $this->_options[$option]; |
134 | 134 | } |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function toArray() |
152 | 152 | { |
153 | - $ret= ($this->_options===null) ? array() : $this->_options; |
|
153 | + $ret = ($this->_options === null) ? array() : $this->_options; |
|
154 | 154 | |
155 | - foreach($this->_control->getValidEvents() as $event) |
|
156 | - if($this->_control->hasEventHandler('on'.$event)) |
|
157 | - $ret[$event]=new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(".TJavascript::encode($this->_control->getUniqueID()).", ".TJavascript::encode($event).", event, ui, this); }"); |
|
155 | + foreach ($this->_control->getValidEvents() as $event) |
|
156 | + if ($this->_control->hasEventHandler('on' . $event)) |
|
157 | + $ret[$event] = new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(" . TJavascript::encode($this->_control->getUniqueID()) . ", " . TJavascript::encode($event) . ", event, ui, this); }"); |
|
158 | 158 | |
159 | 159 | return $ret; |
160 | 160 | } |
@@ -165,13 +165,13 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function raiseCallbackEvent($param) |
167 | 167 | { |
168 | - $callbackParam=$param->CallbackParameter; |
|
169 | - if(isset($callbackParam->event)) |
|
168 | + $callbackParam = $param->CallbackParameter; |
|
169 | + if (isset($callbackParam->event)) |
|
170 | 170 | { |
171 | - $eventName = 'On'.ucfirst($callbackParam->event); |
|
172 | - if($this->_control->hasEventHandler($eventName)) |
|
171 | + $eventName = 'On' . ucfirst($callbackParam->event); |
|
172 | + if ($this->_control->hasEventHandler($eventName)) |
|
173 | 173 | { |
174 | - $this->_control->$eventName( new TJuiEventParameter( |
|
174 | + $this->_control->$eventName(new TJuiEventParameter( |
|
175 | 175 | $this->_control->getResponse(), |
176 | 176 | isset($callbackParam->ui) ? $callbackParam->ui : null) |
177 | 177 | ); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function __construct($control) |
63 | 63 | { |
64 | - $this->setControl($control); |
|
64 | + $this->setControl($control); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function setControl($control) |
73 | 73 | { |
74 | 74 | if(!$control instanceof IJuiOptions) |
75 | - throw new THttpException(500,'juioptions_control_invalid',$control->ID); |
|
75 | + throw new THttpException(500,'juioptions_control_invalid',$control->ID); |
|
76 | 76 | $this->_control=$control; |
77 | 77 | } |
78 | 78 |
@@ -152,9 +152,10 @@ |
||
152 | 152 | { |
153 | 153 | $ret= ($this->_options===null) ? array() : $this->_options; |
154 | 154 | |
155 | - foreach($this->_control->getValidEvents() as $event) |
|
156 | - if($this->_control->hasEventHandler('on'.$event)) |
|
155 | + foreach($this->_control->getValidEvents() as $event) { |
|
156 | + if($this->_control->hasEventHandler('on'.$event)) |
|
157 | 157 | $ret[$event]=new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(".TJavascript::encode($this->_control->getUniqueID()).", ".TJavascript::encode($event).", event, ui, this); }"); |
158 | + } |
|
158 | 159 | |
159 | 160 | return $ret; |
160 | 161 | } |
@@ -158,6 +158,9 @@ |
||
158 | 158 | $this->triggerClientMethod('close'); |
159 | 159 | } |
160 | 160 | |
161 | + /** |
|
162 | + * @param string $method |
|
163 | + */ |
|
161 | 164 | private function triggerClientMethod($method) |
162 | 165 | { |
163 | 166 | $cs = $this->getPage()->getClientScript(); |
@@ -108,9 +108,10 @@ discard block |
||
108 | 108 | if(!isset($options['appendTo'])) |
109 | 109 | $options['appendTo'] = 'form:first'; |
110 | 110 | |
111 | - foreach($this->getControls() as $control) |
|
112 | - if($control instanceof TJuiDialogButton) |
|
111 | + foreach($this->getControls() as $control) { |
|
112 | + if($control instanceof TJuiDialogButton) |
|
113 | 113 | $options['buttons'][] = $control->getPostBackOptions(); |
114 | + } |
|
114 | 115 | |
115 | 116 | return $options; |
116 | 117 | } |
@@ -193,8 +194,7 @@ discard block |
||
193 | 194 | { |
194 | 195 | parent::renderContents($writer); |
195 | 196 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer, false); |
196 | - } |
|
197 | - else |
|
197 | + } else |
|
198 | 198 | parent::render($writer); |
199 | 199 | } |
200 | 200 | } |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function getOptions() |
70 | 70 | { |
71 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
71 | + if (($options = $this->getViewState('JuiOptions')) === null) |
|
72 | 72 | { |
73 | - $options=new TJuiControlOptions($this); |
|
73 | + $options = new TJuiControlOptions($this); |
|
74 | 74 | $this->setViewState('JuiOptions', $options); |
75 | 75 | } |
76 | 76 | return $options; |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | { |
102 | 102 | $options = $this->getOptions()->toArray(); |
103 | 103 | // always make the dialog a child of the form, or its inner inputs won't be collected |
104 | - if(!isset($options['appendTo'])) |
|
104 | + if (!isset($options['appendTo'])) |
|
105 | 105 | $options['appendTo'] = 'form:first'; |
106 | 106 | |
107 | - foreach($this->getControls() as $control) |
|
108 | - if($control instanceof TJuiDialogButton) |
|
107 | + foreach ($this->getControls() as $control) |
|
108 | + if ($control instanceof TJuiDialogButton) |
|
109 | 109 | $options['buttons'][] = $control->getPostBackOptions(); |
110 | 110 | |
111 | 111 | return $options; |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | { |
120 | 120 | parent::addAttributesToRender($writer); |
121 | 121 | |
122 | - $writer->addAttribute('id',$this->getClientID()); |
|
123 | - $options=TJavascript::encode($this->getPostBackOptions()); |
|
124 | - $cs=$this->getPage()->getClientScript(); |
|
125 | - $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
122 | + $writer->addAttribute('id', $this->getClientID()); |
|
123 | + $options = TJavascript::encode($this->getPostBackOptions()); |
|
124 | + $cs = $this->getPage()->getClientScript(); |
|
125 | + $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
126 | 126 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
127 | 127 | } |
128 | 128 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * Raises the OnCreate event |
141 | 141 | * @param object $params event parameters |
142 | 142 | */ |
143 | - public function onOpen ($params) |
|
143 | + public function onOpen($params) |
|
144 | 144 | { |
145 | 145 | $this->raiseEvent('OnOpen', $this, $params); |
146 | 146 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | private function triggerClientMethod($method) |
165 | 165 | { |
166 | 166 | $cs = $this->getPage()->getClientScript(); |
167 | - $code = "jQuery(document).ready(function() { jQuery('#".$this->getClientId()."').dialog('".$method."'); })"; |
|
167 | + $code = "jQuery(document).ready(function() { jQuery('#" . $this->getClientId() . "').dialog('" . $method . "'); })"; |
|
168 | 168 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
169 | 169 | } |
170 | 170 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function render($writer) |
187 | 187 | { |
188 | - if($this->getHasPreRendered() && $this->getActiveControl()->canUpdateClientSide()) |
|
188 | + if ($this->getHasPreRendered() && $this->getActiveControl()->canUpdateClientSide()) |
|
189 | 189 | { |
190 | 190 | parent::renderContents($writer); |
191 | 191 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer, false); |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | { |
244 | 244 | return array( |
245 | 245 | 'text' => $this->getText(), |
246 | - 'click' => new TJavaScriptLiteral("function(){new Prado.Callback('".$this->getUniqueID()."', 'onClick');}" |
|
247 | - )) ; |
|
246 | + 'click' => new TJavaScriptLiteral("function(){new Prado.Callback('" . $this->getUniqueID() . "', 'onClick');}" |
|
247 | + )); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public function getText() |
254 | 254 | { |
255 | - return $this->getViewState('Text',''); |
|
255 | + return $this->getViewState('Text', ''); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function setText($value) |
262 | 262 | { |
263 | - $this->setViewState('Text',$value,''); |
|
263 | + $this->setViewState('Text', $value, ''); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
267 | 267 | * Raises the OnClick event |
268 | 268 | * @param object $params event parameters |
269 | 269 | */ |
270 | - public function onClick ($params) |
|
270 | + public function onClick($params) |
|
271 | 271 | { |
272 | 272 | $this->raiseEvent('OnClick', $this, $params); |
273 | 273 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function raiseCallbackEvent($param) |
281 | 281 | { |
282 | - if($param->CallbackParameter === 'onClick') |
|
282 | + if ($param->CallbackParameter === 'onClick') |
|
283 | 283 | $this->onClick($param); |
284 | 284 | } |
285 | 285 |
@@ -264,6 +264,9 @@ |
||
264 | 264 | { |
265 | 265 | private $_template; |
266 | 266 | |
267 | + /** |
|
268 | + * @param string $template |
|
269 | + */ |
|
267 | 270 | public function __construct($template) |
268 | 271 | { |
269 | 272 | $this->_template = $template; |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getOptions() |
76 | 76 | { |
77 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
77 | + if (($options = $this->getViewState('JuiOptions')) === null) |
|
78 | 78 | { |
79 | - $options=new TJuiControlOptions($this); |
|
79 | + $options = new TJuiControlOptions($this); |
|
80 | 80 | $this->setViewState('JuiOptions', $options); |
81 | 81 | } |
82 | 82 | return $options; |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | { |
108 | 108 | $options = $this->getOptions()->toArray(); |
109 | 109 | // overload the "OnStop" event to add information about the current selected items |
110 | - if(isset($options['stop'])) |
|
110 | + if (isset($options['stop'])) |
|
111 | 111 | { |
112 | - $options['stop']=new TJavaScriptLiteral('function( event, ui ) { ui.index = new Array(); jQuery(\'#'.$this->getClientID().' .ui-selected\').each(function(idx, item){ ui.index.push(item.id) }); Prado.JuiCallback('.TJavascript::encode($this->getUniqueID()).', \'stop\', event, ui, this); }'); |
|
112 | + $options['stop'] = new TJavaScriptLiteral('function( event, ui ) { ui.index = new Array(); jQuery(\'#' . $this->getClientID() . ' .ui-selected\').each(function(idx, item){ ui.index.push(item.id) }); Prado.JuiCallback(' . TJavascript::encode($this->getUniqueID()) . ', \'stop\', event, ui, this); }'); |
|
113 | 113 | } |
114 | 114 | return $options; |
115 | 115 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | protected function addAttributesToRender($writer) |
122 | 122 | { |
123 | 123 | parent::addAttributesToRender($writer); |
124 | - $writer->addAttribute('id',$this->getClientID()); |
|
125 | - $options=TJavascript::encode($this->getPostBackOptions()); |
|
126 | - $cs=$this->getPage()->getClientScript(); |
|
127 | - $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
124 | + $writer->addAttribute('id', $this->getClientID()); |
|
125 | + $options = TJavascript::encode($this->getPostBackOptions()); |
|
126 | + $cs = $this->getPage()->getClientScript(); |
|
127 | + $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
128 | 128 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
129 | 129 | } |
130 | 130 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * Raises the OnCreate event |
143 | 143 | * @param object $params event parameters |
144 | 144 | */ |
145 | - public function onCreate ($params) |
|
145 | + public function onCreate($params) |
|
146 | 146 | { |
147 | 147 | $this->raiseEvent('OnCreate', $this, $params); |
148 | 148 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * Raises the OnSelected event |
152 | 152 | * @param object $params event parameters |
153 | 153 | */ |
154 | - public function onSelected ($params) |
|
154 | + public function onSelected($params) |
|
155 | 155 | { |
156 | 156 | $this->raiseEvent('OnSelected', $this, $params); |
157 | 157 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * Raises the OnSelecting event |
161 | 161 | * @param object $params event parameters |
162 | 162 | */ |
163 | - public function onSelecting ($params) |
|
163 | + public function onSelecting($params) |
|
164 | 164 | { |
165 | 165 | $this->raiseEvent('OnSelecting', $this, $params); |
166 | 166 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * Raises the OnStart event |
170 | 170 | * @param object $params event parameters |
171 | 171 | */ |
172 | - public function onStart ($params) |
|
172 | + public function onStart($params) |
|
173 | 173 | { |
174 | 174 | $this->raiseEvent('OnStart', $this, $params); |
175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * Raises the OnStop event |
179 | 179 | * @param object $params event parameters |
180 | 180 | */ |
181 | - public function onStop ($params) |
|
181 | + public function onStop($params) |
|
182 | 182 | { |
183 | 183 | $this->raiseEvent('OnStop', $this, $params); |
184 | 184 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * Raises the OnUnselected event |
188 | 188 | * @param object $params event parameters |
189 | 189 | */ |
190 | - public function onUnselected ($params) |
|
190 | + public function onUnselected($params) |
|
191 | 191 | { |
192 | 192 | $this->raiseEvent('OnUnselected', $this, $params); |
193 | 193 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * Raises the OnUnselecting event |
197 | 197 | * @param object $params event parameters |
198 | 198 | */ |
199 | - public function onUnselecting ($params) |
|
199 | + public function onUnselecting($params) |
|
200 | 200 | { |
201 | 201 | $this->raiseEvent('OnUnselecting', $this, $params); |
202 | 202 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | /** |
205 | 205 | * @var ITemplate template for repeater items |
206 | 206 | */ |
207 | - private $_repeater=null; |
|
207 | + private $_repeater = null; |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * @param array data source for Selectables. |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | public function dataBind() |
222 | 222 | { |
223 | 223 | parent::dataBind(); |
224 | - if($this->getPage()->getIsCallback()) |
|
224 | + if ($this->getPage()->getIsCallback()) |
|
225 | 225 | $this->renderSelectables($this->getResponse()->createHtmlWriter()); |
226 | 226 | } |
227 | 227 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function getSelectables() |
232 | 232 | { |
233 | - if($this->_repeater===null) |
|
233 | + if ($this->_repeater === null) |
|
234 | 234 | $this->_repeater = $this->createRepeater(); |
235 | 235 | return $this->_repeater; |
236 | 236 | } |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | protected function createRepeater() |
242 | 242 | { |
243 | 243 | $repeater = Prado::createComponent('System.Web.UI.WebControls.TRepeater'); |
244 | - $repeater->setHeaderTemplate(new TJuiSelectableTemplate('<ul id="'.$this->getWidgetID().'">')); |
|
244 | + $repeater->setHeaderTemplate(new TJuiSelectableTemplate('<ul id="' . $this->getWidgetID() . '">')); |
|
245 | 245 | $repeater->setFooterTemplate(new TJuiSelectableTemplate('</ul>')); |
246 | - $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->DataItem %></li>',null)); |
|
246 | + $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->DataItem %></li>', null)); |
|
247 | 247 | $repeater->setEmptyTemplate(new TJuiSelectableTemplate('<ul></ul>')); |
248 | 248 | $this->getControls()->add($repeater); |
249 | 249 | return $repeater; |
@@ -152,6 +152,7 @@ |
||
152 | 152 | * - application/x-www-form-urlencoded : Form data is encoded as name/value pairs. This is the standard encoding format. |
153 | 153 | * - multipart/form-data : Form data is encoded as a message with a separate part for each control on the page. |
154 | 154 | * - text/plain : Form data is encoded in plain text, without any control or formatting characters. |
155 | + * @param string $value |
|
155 | 156 | */ |
156 | 157 | public function setEnctype($value) |
157 | 158 | { |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function addAttributesToRender($writer) |
45 | 45 | { |
46 | - $writer->addAttribute('id',$this->getClientID()); |
|
47 | - $writer->addAttribute('method',$this->getMethod()); |
|
48 | - $uri=$this->getRequest()->getRequestURI(); |
|
49 | - $writer->addAttribute('action',str_replace('&','&',str_replace('&','&',$uri))); |
|
50 | - if(($enctype=$this->getEnctype())!=='') |
|
51 | - $writer->addAttribute('enctype',$enctype); |
|
52 | - |
|
53 | - $attributes=$this->getAttributes(); |
|
46 | + $writer->addAttribute('id', $this->getClientID()); |
|
47 | + $writer->addAttribute('method', $this->getMethod()); |
|
48 | + $uri = $this->getRequest()->getRequestURI(); |
|
49 | + $writer->addAttribute('action', str_replace('&', '&', str_replace('&', '&', $uri))); |
|
50 | + if (($enctype = $this->getEnctype()) !== '') |
|
51 | + $writer->addAttribute('enctype', $enctype); |
|
52 | + |
|
53 | + $attributes = $this->getAttributes(); |
|
54 | 54 | $attributes->remove('action'); |
55 | 55 | $writer->addAttributes($attributes); |
56 | 56 | |
57 | - if(($butt=$this->getDefaultButton())!=='') |
|
57 | + if (($butt = $this->getDefaultButton()) !== '') |
|
58 | 58 | { |
59 | - if(($button=$this->findControl($butt))!==null) |
|
59 | + if (($button = $this->findControl($butt)) !== null) |
|
60 | 60 | $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
61 | 61 | else |
62 | - throw new TInvalidDataValueException('form_defaultbutton_invalid',$butt); |
|
62 | + throw new TInvalidDataValueException('form_defaultbutton_invalid', $butt); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function render($writer) |
71 | 71 | { |
72 | - $page=$this->getPage(); |
|
72 | + $page = $this->getPage(); |
|
73 | 73 | |
74 | 74 | $this->addAttributesToRender($writer); |
75 | 75 | $writer->renderBeginTag('form'); |
76 | 76 | |
77 | - $cs=$page->getClientScript(); |
|
78 | - if($page->getClientSupportsJavaScript()) |
|
77 | + $cs = $page->getClientScript(); |
|
78 | + if ($page->getClientSupportsJavaScript()) |
|
79 | 79 | { |
80 | 80 | $cs->renderHiddenFieldsBegin($writer); |
81 | 81 | $cs->renderScriptFilesBegin($writer); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getDefaultButton() |
110 | 110 | { |
111 | - return $this->getViewState('DefaultButton',''); |
|
111 | + return $this->getViewState('DefaultButton', ''); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function setDefaultButton($value) |
121 | 121 | { |
122 | - $this->setViewState('DefaultButton',$value,''); |
|
122 | + $this->setViewState('DefaultButton', $value, ''); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function getMethod() |
129 | 129 | { |
130 | - return $this->getViewState('Method','post'); |
|
130 | + return $this->getViewState('Method', 'post'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function setMethod($value) |
137 | 137 | { |
138 | - $this->setViewState('Method',TPropertyValue::ensureEnum($value,'post','get'),'post'); |
|
138 | + $this->setViewState('Method', TPropertyValue::ensureEnum($value, 'post', 'get'), 'post'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function getEnctype() |
145 | 145 | { |
146 | - return $this->getViewState('Enctype',''); |
|
146 | + return $this->getViewState('Enctype', ''); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function setEnctype($value) |
157 | 157 | { |
158 | - $this->setViewState('Enctype',$value,''); |
|
158 | + $this->setViewState('Enctype', $value, ''); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -92,8 +92,7 @@ |
||
92 | 92 | |
93 | 93 | $cs->renderScriptFilesEnd($writer); |
94 | 94 | $cs->renderEndScripts($writer); |
95 | - } |
|
96 | - else |
|
95 | + } else |
|
97 | 96 | { |
98 | 97 | $cs->renderHiddenFieldsBegin($writer); |
99 | 98 |
@@ -278,6 +278,9 @@ discard block |
||
278 | 278 | $this->unloadRecursive(); |
279 | 279 | } |
280 | 280 | |
281 | + /** |
|
282 | + * @param string $enc |
|
283 | + */ |
|
281 | 284 | protected static function decodeUTF8($data, $enc) |
282 | 285 | { |
283 | 286 | if(is_array($data)) |
@@ -451,6 +454,7 @@ discard block |
||
451 | 454 | * Returns a list of registered validators. |
452 | 455 | * If validation group is specified, only the validators in that group will be returned. |
453 | 456 | * @param string validation group |
457 | + * @param string $validationGroup |
|
454 | 458 | * @return TList registered validators in the requested group. If the group is null, all validators will be returned. |
455 | 459 | */ |
456 | 460 | public function getValidators($validationGroup=null) |
@@ -562,6 +566,7 @@ discard block |
||
562 | 566 | * Applies a skin in the current theme to a control. |
563 | 567 | * This method should only be used by framework developers. |
564 | 568 | * @param TControl a control to be applied skin with |
569 | + * @param TControl $control |
|
565 | 570 | */ |
566 | 571 | public function applyControlSkin($control) |
567 | 572 | { |
@@ -856,6 +861,7 @@ discard block |
||
856 | 861 | * Processes post data. |
857 | 862 | * @param TMap post data to be processed |
858 | 863 | * @param boolean whether this method is invoked before {@link onLoad OnLoad}. |
864 | + * @param boolean $beforeLoad |
|
859 | 865 | */ |
860 | 866 | protected function processPostData($postData,$beforeLoad) |
861 | 867 | { |
@@ -981,6 +987,7 @@ discard block |
||
981 | 987 | /** |
982 | 988 | * Sets input focus on a control after the page is rendered to users. |
983 | 989 | * @param TControl|string control to receive focus, or the ID of the element on the page to receive focus |
990 | + * @param TControl $value |
|
984 | 991 | */ |
985 | 992 | public function setFocus($value) |
986 | 993 | { |
@@ -1066,6 +1073,7 @@ discard block |
||
1066 | 1073 | * Sets the state to be stored on the client side. |
1067 | 1074 | * This method should only be used by framework and control developers. |
1068 | 1075 | * @param string the state to be stored on the client side |
1076 | + * @param string $state |
|
1069 | 1077 | */ |
1070 | 1078 | public function setClientState($state) |
1071 | 1079 | { |
@@ -1185,6 +1193,8 @@ discard block |
||
1185 | 1193 | * referring to the context object (e.g. Page, Page.ClientScript). |
1186 | 1194 | * @param string method name of the context object |
1187 | 1195 | * @param array list of parameters to be passed to the action method |
1196 | + * @param string $context |
|
1197 | + * @param string $funcName |
|
1188 | 1198 | */ |
1189 | 1199 | public function registerCachingAction($context,$funcName,$funcParams) |
1190 | 1200 | { |
@@ -1230,15 +1240,18 @@ discard block |
||
1230 | 1240 | { |
1231 | 1241 | /** |
1232 | 1242 | * @param TPage the page that this persister works for |
1243 | + * @return TPage |
|
1233 | 1244 | */ |
1234 | 1245 | public function getPage(); |
1235 | 1246 | /** |
1236 | 1247 | * @param TPage the page that this persister works for |
1248 | + * @return void |
|
1237 | 1249 | */ |
1238 | 1250 | public function setPage(TPage $page); |
1239 | 1251 | /** |
1240 | 1252 | * Saves state to persistent storage. |
1241 | 1253 | * @param mixed state to be stored |
1254 | + * @return void |
|
1242 | 1255 | */ |
1243 | 1256 | public function save($state); |
1244 | 1257 | /** |
@@ -1272,6 +1285,7 @@ discard block |
||
1272 | 1285 | /** |
1273 | 1286 | * @param TPage |
1274 | 1287 | * @param mixed state data |
1288 | + * @param TPage $page |
|
1275 | 1289 | * @return string serialized data |
1276 | 1290 | */ |
1277 | 1291 | public static function serialize($page,$data) |
@@ -1291,6 +1305,7 @@ discard block |
||
1291 | 1305 | /** |
1292 | 1306 | * @param TPage |
1293 | 1307 | * @param string serialized data |
1308 | + * @param TPage $page |
|
1294 | 1309 | * @return mixed unserialized state data, null if data is corrupted |
1295 | 1310 | */ |
1296 | 1311 | public static function unserialize($page,$data) |
@@ -303,15 +303,15 @@ |
||
303 | 303 | |
304 | 304 | $this->setAdapter(new TActivePageAdapter($this)); |
305 | 305 | |
306 | - $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
307 | - if(strlen($callbackEventParameter) > 0) |
|
308 | - $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter); |
|
309 | - |
|
310 | - // Decode Callback postData from UTF-8 to current Charset |
|
311 | - if (($g=$this->getApplication()->getGlobalization(false))!==null && |
|
312 | - strtoupper($enc=$g->getCharset())!='UTF-8') |
|
313 | - foreach ($this->_postData as $k=>$v) |
|
314 | - $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
306 | + $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
307 | + if(strlen($callbackEventParameter) > 0) |
|
308 | + $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter); |
|
309 | + |
|
310 | + // Decode Callback postData from UTF-8 to current Charset |
|
311 | + if (($g=$this->getApplication()->getGlobalization(false))!==null && |
|
312 | + strtoupper($enc=$g->getCharset())!='UTF-8') |
|
313 | + foreach ($this->_postData as $k=>$v) |
|
314 | + $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
315 | 315 | |
316 | 316 | Prado::trace("Page onPreInit()",'System.Web.UI.TPage'); |
317 | 317 | $this->onPreInit(null); |
@@ -192,8 +192,7 @@ discard block |
||
192 | 192 | $this->processCallbackRequest($writer); |
193 | 193 | else |
194 | 194 | $this->processPostBackRequest($writer); |
195 | - } |
|
196 | - else |
|
195 | + } else |
|
197 | 196 | $this->processNormalRequest($writer); |
198 | 197 | |
199 | 198 | $this->_writer = null; |
@@ -282,8 +281,9 @@ discard block |
||
282 | 281 | { |
283 | 282 | if(is_array($data)) |
284 | 283 | { |
285 | - foreach($data as $k=>$v) |
|
286 | - $data[$k]=self::decodeUTF8($v, $enc); |
|
284 | + foreach($data as $k=>$v) { |
|
285 | + $data[$k]=self::decodeUTF8($v, $enc); |
|
286 | + } |
|
287 | 287 | return $data; |
288 | 288 | } elseif(is_string($data)) { |
289 | 289 | return iconv('UTF-8',$enc.'//IGNORE',$data); |
@@ -310,8 +310,9 @@ discard block |
||
310 | 310 | // Decode Callback postData from UTF-8 to current Charset |
311 | 311 | if (($g=$this->getApplication()->getGlobalization(false))!==null && |
312 | 312 | strtoupper($enc=$g->getCharset())!='UTF-8') |
313 | - foreach ($this->_postData as $k=>$v) |
|
314 | - $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
313 | + foreach ($this->_postData as $k=>$v) { |
|
314 | + $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
315 | + } |
|
315 | 316 | |
316 | 317 | Prado::trace("Page onPreInit()",'System.Web.UI.TPage'); |
317 | 318 | $this->onPreInit(null); |
@@ -462,9 +463,10 @@ discard block |
||
462 | 463 | else |
463 | 464 | { |
464 | 465 | $list=new TList; |
465 | - foreach($this->_validators as $validator) |
|
466 | - if($validator->getValidationGroup()===$validationGroup) |
|
466 | + foreach($this->_validators as $validator) { |
|
467 | + if($validator->getValidationGroup()===$validationGroup) |
|
467 | 468 | $list->add($validator); |
469 | + } |
|
468 | 470 | return $list; |
469 | 471 | } |
470 | 472 | } |
@@ -483,10 +485,10 @@ discard block |
||
483 | 485 | { |
484 | 486 | if($validationGroup===null) |
485 | 487 | { |
486 | - foreach($this->_validators as $validator) |
|
487 | - $validator->validate(); |
|
488 | - } |
|
489 | - else |
|
488 | + foreach($this->_validators as $validator) { |
|
489 | + $validator->validate(); |
|
490 | + } |
|
491 | + } else |
|
490 | 492 | { |
491 | 493 | foreach($this->_validators as $validator) |
492 | 494 | { |
@@ -509,13 +511,13 @@ discard block |
||
509 | 511 | { |
510 | 512 | if($this->_validators && $this->_validators->getCount()) |
511 | 513 | { |
512 | - foreach($this->_validators as $validator) |
|
513 | - if(!$validator->getIsValid()) |
|
514 | + foreach($this->_validators as $validator) { |
|
515 | + if(!$validator->getIsValid()) |
|
514 | 516 | return false; |
517 | + } |
|
515 | 518 | } |
516 | 519 | return true; |
517 | - } |
|
518 | - else |
|
520 | + } else |
|
519 | 521 | throw new TInvalidOperationException('page_isvalid_unknown'); |
520 | 522 | } |
521 | 523 | |
@@ -667,18 +669,22 @@ discard block |
||
667 | 669 | $theme=$this->getTheme(); |
668 | 670 | if($theme instanceof ITheme) |
669 | 671 | { |
670 | - foreach($theme->getStyleSheetFiles() as $url) |
|
671 | - $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
672 | - foreach($theme->getJavaScriptFiles() as $url) |
|
673 | - $cs->registerHeadScriptFile($url,$url); |
|
672 | + foreach($theme->getStyleSheetFiles() as $url) { |
|
673 | + $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
674 | + } |
|
675 | + foreach($theme->getJavaScriptFiles() as $url) { |
|
676 | + $cs->registerHeadScriptFile($url,$url); |
|
677 | + } |
|
674 | 678 | } |
675 | 679 | $styleSheet=$this->getStyleSheetTheme(); |
676 | 680 | if($styleSheet instanceof ITheme) |
677 | 681 | { |
678 | - foreach($styleSheet->getStyleSheetFiles() as $url) |
|
679 | - $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
680 | - foreach($styleSheet->getJavaScriptFiles() as $url) |
|
681 | - $cs->registerHeadScriptFile($url,$url); |
|
682 | + foreach($styleSheet->getStyleSheetFiles() as $url) { |
|
683 | + $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
684 | + } |
|
685 | + foreach($styleSheet->getJavaScriptFiles() as $url) { |
|
686 | + $cs->registerHeadScriptFile($url,$url); |
|
687 | + } |
|
682 | 688 | } |
683 | 689 | |
684 | 690 | if($cs->getRequiresHead() && $this->getHead()===null) |
@@ -804,8 +810,9 @@ discard block |
||
804 | 810 | $id=is_string($control)?$control:$control->getUniqueID(); |
805 | 811 | $this->_controlsRegisteredForPostData[$id]=true; |
806 | 812 | $params=func_get_args(); |
807 | - foreach($this->getCachingStack() as $item) |
|
808 | - $item->registerAction('Page','registerRequiresPostData',array($id)); |
|
813 | + foreach($this->getCachingStack() as $item) { |
|
814 | + $item->registerAction('Page','registerRequiresPostData',array($id)); |
|
815 | + } |
|
809 | 816 | } |
810 | 817 | |
811 | 818 | /** |
@@ -872,15 +879,13 @@ discard block |
||
872 | 879 | { |
873 | 880 | if($control->loadPostData($key,$postData)) |
874 | 881 | $this->_controlsPostDataChanged[]=$control; |
875 | - } |
|
876 | - else if($control instanceof IPostBackEventHandler && |
|
882 | + } else if($control instanceof IPostBackEventHandler && |
|
877 | 883 | empty($this->_postData[self::FIELD_POSTBACK_TARGET])) |
878 | 884 | { |
879 | 885 | $this->_postData->add(self::FIELD_POSTBACK_TARGET,$key); // not calling setPostBackEventTarget() because the control may be removed later |
880 | 886 | } |
881 | 887 | unset($this->_controlsRequiringPostData[$key]); |
882 | - } |
|
883 | - else if($beforeLoad) |
|
888 | + } else if($beforeLoad) |
|
884 | 889 | $this->_restPostData->add($key,$value); |
885 | 890 | } |
886 | 891 | |
@@ -892,8 +897,7 @@ discard block |
||
892 | 897 | { |
893 | 898 | if($control->loadPostData($key,$this->_postData)) |
894 | 899 | $this->_controlsPostDataChanged[]=$control; |
895 | - } |
|
896 | - else |
|
900 | + } else |
|
897 | 901 | throw new TInvalidDataValueException('page_postbackcontrol_invalid',$key); |
898 | 902 | unset($this->_controlsRequiringPostData[$key]); |
899 | 903 | } |
@@ -914,8 +918,9 @@ discard block |
||
914 | 918 | */ |
915 | 919 | protected function raiseChangedEvents() |
916 | 920 | { |
917 | - foreach($this->_controlsPostDataChanged as $control) |
|
918 | - $control->raisePostDataChangedEvent(); |
|
921 | + foreach($this->_controlsPostDataChanged as $control) { |
|
922 | + $control->raisePostDataChangedEvent(); |
|
923 | + } |
|
919 | 924 | } |
920 | 925 | |
921 | 926 | /** |
@@ -972,8 +977,7 @@ discard block |
||
972 | 977 | else |
973 | 978 | $focus=$this->_focus; |
974 | 979 | $this->getClientScript()->registerFocusControl($focus); |
975 | - } |
|
976 | - else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null) |
|
980 | + } else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null) |
|
977 | 981 | $this->getClientScript()->registerFocusControl($lastFocus); |
978 | 982 | $this->_inFormRender=false; |
979 | 983 | } |
@@ -1190,8 +1194,9 @@ discard block |
||
1190 | 1194 | { |
1191 | 1195 | if($this->_cachingStack) |
1192 | 1196 | { |
1193 | - foreach($this->_cachingStack as $cache) |
|
1194 | - $cache->registerAction($context,$funcName,$funcParams); |
|
1197 | + foreach($this->_cachingStack as $cache) { |
|
1198 | + $cache->registerAction($context,$funcName,$funcParams); |
|
1199 | + } |
|
1195 | 1200 | } |
1196 | 1201 | } |
1197 | 1202 | |
@@ -1309,8 +1314,7 @@ discard block |
||
1309 | 1314 | { |
1310 | 1315 | if(($str=$sm->validateData($str))!==false) |
1311 | 1316 | return unserialize($str); |
1312 | - } |
|
1313 | - else |
|
1317 | + } else |
|
1314 | 1318 | return unserialize($str); |
1315 | 1319 | } |
1316 | 1320 | return null; |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * system post fields |
31 | 31 | */ |
32 | - const FIELD_POSTBACK_TARGET='PRADO_POSTBACK_TARGET'; |
|
33 | - const FIELD_POSTBACK_PARAMETER='PRADO_POSTBACK_PARAMETER'; |
|
34 | - const FIELD_LASTFOCUS='PRADO_LASTFOCUS'; |
|
35 | - const FIELD_PAGESTATE='PRADO_PAGESTATE'; |
|
36 | - const FIELD_CALLBACK_TARGET='PRADO_CALLBACK_TARGET'; |
|
37 | - const FIELD_CALLBACK_PARAMETER='PRADO_CALLBACK_PARAMETER'; |
|
32 | + const FIELD_POSTBACK_TARGET = 'PRADO_POSTBACK_TARGET'; |
|
33 | + const FIELD_POSTBACK_PARAMETER = 'PRADO_POSTBACK_PARAMETER'; |
|
34 | + const FIELD_LASTFOCUS = 'PRADO_LASTFOCUS'; |
|
35 | + const FIELD_PAGESTATE = 'PRADO_PAGESTATE'; |
|
36 | + const FIELD_CALLBACK_TARGET = 'PRADO_CALLBACK_TARGET'; |
|
37 | + const FIELD_CALLBACK_PARAMETER = 'PRADO_CALLBACK_PARAMETER'; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * @var array system post fields |
41 | 41 | */ |
42 | - private static $_systemPostFields=array( |
|
42 | + private static $_systemPostFields = array( |
|
43 | 43 | 'PRADO_POSTBACK_TARGET'=>true, |
44 | 44 | 'PRADO_POSTBACK_PARAMETER'=>true, |
45 | 45 | 'PRADO_LASTFOCUS'=>true, |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * @var array list of registered validators |
60 | 60 | */ |
61 | - private $_validators=array(); |
|
61 | + private $_validators = array(); |
|
62 | 62 | /** |
63 | 63 | * @var boolean if validation has been performed |
64 | 64 | */ |
65 | - private $_validated=false; |
|
65 | + private $_validated = false; |
|
66 | 66 | /** |
67 | 67 | * @var TTheme page theme |
68 | 68 | */ |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * @var array list of controls whose data have been changed due to the postback |
92 | 92 | */ |
93 | - protected $_controlsPostDataChanged=array(); |
|
93 | + protected $_controlsPostDataChanged = array(); |
|
94 | 94 | /** |
95 | 95 | * @var array list of controls that need to load post data in the current request |
96 | 96 | */ |
97 | - protected $_controlsRequiringPostData=array(); |
|
97 | + protected $_controlsRequiringPostData = array(); |
|
98 | 98 | /** |
99 | 99 | * @var array list of controls that need to load post data in the next postback |
100 | 100 | */ |
101 | - protected $_controlsRegisteredForPostData=array(); |
|
101 | + protected $_controlsRegisteredForPostData = array(); |
|
102 | 102 | /** |
103 | 103 | * @var TControl control that needs to raise postback event |
104 | 104 | */ |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | /** |
111 | 111 | * @var boolean whether the form has been rendered |
112 | 112 | */ |
113 | - protected $_formRendered=false; |
|
113 | + protected $_formRendered = false; |
|
114 | 114 | /** |
115 | 115 | * @var boolean whether the current rendering is within a form |
116 | 116 | */ |
117 | - protected $_inFormRender=false; |
|
117 | + protected $_inFormRender = false; |
|
118 | 118 | /** |
119 | 119 | * @var TControl|string the control or the ID of the element on the page to be focused when the page is sent back to user |
120 | 120 | */ |
@@ -122,24 +122,24 @@ discard block |
||
122 | 122 | /** |
123 | 123 | * @var string page path to this page |
124 | 124 | */ |
125 | - private $_pagePath=''; |
|
125 | + private $_pagePath = ''; |
|
126 | 126 | /** |
127 | 127 | * @var boolean whether page state should be HMAC validated |
128 | 128 | */ |
129 | - private $_enableStateValidation=true; |
|
129 | + private $_enableStateValidation = true; |
|
130 | 130 | /** |
131 | 131 | * @var boolean whether page state should be encrypted |
132 | 132 | */ |
133 | - private $_enableStateEncryption=false; |
|
133 | + private $_enableStateEncryption = false; |
|
134 | 134 | /** |
135 | 135 | * @var boolean whether page state should be compressed |
136 | 136 | * @since 3.1.6 |
137 | 137 | */ |
138 | - private $_enableStateCompression=true; |
|
138 | + private $_enableStateCompression = true; |
|
139 | 139 | /** |
140 | 140 | * @var string page state persister class name |
141 | 141 | */ |
142 | - private $_statePersisterClass='System.Web.UI.TPageStatePersister'; |
|
142 | + private $_statePersisterClass = 'System.Web.UI.TPageStatePersister'; |
|
143 | 143 | /** |
144 | 144 | * @var mixed page state persister |
145 | 145 | */ |
@@ -151,15 +151,15 @@ discard block |
||
151 | 151 | /** |
152 | 152 | * @var string state string to be stored on the client side |
153 | 153 | */ |
154 | - private $_clientState=''; |
|
154 | + private $_clientState = ''; |
|
155 | 155 | /** |
156 | 156 | * @var boolean true if loading post data. |
157 | 157 | */ |
158 | - protected $_isLoadingPostData=false; |
|
158 | + protected $_isLoadingPostData = false; |
|
159 | 159 | /** |
160 | 160 | * @var boolean whether client supports javascript |
161 | 161 | */ |
162 | - private $_enableJavaScript=true; |
|
162 | + private $_enableJavaScript = true; |
|
163 | 163 | /** |
164 | 164 | * @var THtmlWriter current html render writer |
165 | 165 | */ |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function run($writer) |
183 | 183 | { |
184 | - Prado::trace("Running page life cycles",'System.Web.UI.TPage'); |
|
184 | + Prado::trace("Running page life cycles", 'System.Web.UI.TPage'); |
|
185 | 185 | $this->_writer = $writer; |
186 | 186 | |
187 | 187 | $this->determinePostBackMode(); |
188 | 188 | |
189 | - if($this->getIsPostBack()) |
|
189 | + if ($this->getIsPostBack()) |
|
190 | 190 | { |
191 | - if($this->getIsCallback()) |
|
191 | + if ($this->getIsCallback()) |
|
192 | 192 | $this->processCallbackRequest($writer); |
193 | 193 | else |
194 | 194 | $this->processPostBackRequest($writer); |
@@ -201,92 +201,92 @@ discard block |
||
201 | 201 | |
202 | 202 | protected function processNormalRequest($writer) |
203 | 203 | { |
204 | - Prado::trace("Page onPreInit()",'System.Web.UI.TPage'); |
|
204 | + Prado::trace("Page onPreInit()", 'System.Web.UI.TPage'); |
|
205 | 205 | $this->onPreInit(null); |
206 | 206 | |
207 | - Prado::trace("Page initRecursive()",'System.Web.UI.TPage'); |
|
207 | + Prado::trace("Page initRecursive()", 'System.Web.UI.TPage'); |
|
208 | 208 | $this->initRecursive(); |
209 | 209 | |
210 | - Prado::trace("Page onInitComplete()",'System.Web.UI.TPage'); |
|
210 | + Prado::trace("Page onInitComplete()", 'System.Web.UI.TPage'); |
|
211 | 211 | $this->onInitComplete(null); |
212 | 212 | |
213 | - Prado::trace("Page onPreLoad()",'System.Web.UI.TPage'); |
|
213 | + Prado::trace("Page onPreLoad()", 'System.Web.UI.TPage'); |
|
214 | 214 | $this->onPreLoad(null); |
215 | - Prado::trace("Page loadRecursive()",'System.Web.UI.TPage'); |
|
215 | + Prado::trace("Page loadRecursive()", 'System.Web.UI.TPage'); |
|
216 | 216 | $this->loadRecursive(); |
217 | - Prado::trace("Page onLoadComplete()",'System.Web.UI.TPage'); |
|
217 | + Prado::trace("Page onLoadComplete()", 'System.Web.UI.TPage'); |
|
218 | 218 | $this->onLoadComplete(null); |
219 | 219 | |
220 | - Prado::trace("Page preRenderRecursive()",'System.Web.UI.TPage'); |
|
220 | + Prado::trace("Page preRenderRecursive()", 'System.Web.UI.TPage'); |
|
221 | 221 | $this->preRenderRecursive(); |
222 | - Prado::trace("Page onPreRenderComplete()",'System.Web.UI.TPage'); |
|
222 | + Prado::trace("Page onPreRenderComplete()", 'System.Web.UI.TPage'); |
|
223 | 223 | $this->onPreRenderComplete(null); |
224 | 224 | |
225 | - Prado::trace("Page savePageState()",'System.Web.UI.TPage'); |
|
225 | + Prado::trace("Page savePageState()", 'System.Web.UI.TPage'); |
|
226 | 226 | $this->savePageState(); |
227 | - Prado::trace("Page onSaveStateComplete()",'System.Web.UI.TPage'); |
|
227 | + Prado::trace("Page onSaveStateComplete()", 'System.Web.UI.TPage'); |
|
228 | 228 | $this->onSaveStateComplete(null); |
229 | 229 | |
230 | - Prado::trace("Page renderControl()",'System.Web.UI.TPage'); |
|
230 | + Prado::trace("Page renderControl()", 'System.Web.UI.TPage'); |
|
231 | 231 | $this->renderControl($writer); |
232 | - Prado::trace("Page unloadRecursive()",'System.Web.UI.TPage'); |
|
232 | + Prado::trace("Page unloadRecursive()", 'System.Web.UI.TPage'); |
|
233 | 233 | $this->unloadRecursive(); |
234 | 234 | } |
235 | 235 | |
236 | 236 | protected function processPostBackRequest($writer) |
237 | 237 | { |
238 | - Prado::trace("Page onPreInit()",'System.Web.UI.TPage'); |
|
238 | + Prado::trace("Page onPreInit()", 'System.Web.UI.TPage'); |
|
239 | 239 | $this->onPreInit(null); |
240 | 240 | |
241 | - Prado::trace("Page initRecursive()",'System.Web.UI.TPage'); |
|
241 | + Prado::trace("Page initRecursive()", 'System.Web.UI.TPage'); |
|
242 | 242 | $this->initRecursive(); |
243 | 243 | |
244 | - Prado::trace("Page onInitComplete()",'System.Web.UI.TPage'); |
|
244 | + Prado::trace("Page onInitComplete()", 'System.Web.UI.TPage'); |
|
245 | 245 | $this->onInitComplete(null); |
246 | 246 | |
247 | - $this->_restPostData=new TMap; |
|
248 | - Prado::trace("Page loadPageState()",'System.Web.UI.TPage'); |
|
247 | + $this->_restPostData = new TMap; |
|
248 | + Prado::trace("Page loadPageState()", 'System.Web.UI.TPage'); |
|
249 | 249 | $this->loadPageState(); |
250 | - Prado::trace("Page processPostData()",'System.Web.UI.TPage'); |
|
251 | - $this->processPostData($this->_postData,true); |
|
252 | - Prado::trace("Page onPreLoad()",'System.Web.UI.TPage'); |
|
250 | + Prado::trace("Page processPostData()", 'System.Web.UI.TPage'); |
|
251 | + $this->processPostData($this->_postData, true); |
|
252 | + Prado::trace("Page onPreLoad()", 'System.Web.UI.TPage'); |
|
253 | 253 | $this->onPreLoad(null); |
254 | - Prado::trace("Page loadRecursive()",'System.Web.UI.TPage'); |
|
254 | + Prado::trace("Page loadRecursive()", 'System.Web.UI.TPage'); |
|
255 | 255 | $this->loadRecursive(); |
256 | - Prado::trace("Page processPostData()",'System.Web.UI.TPage'); |
|
257 | - $this->processPostData($this->_restPostData,false); |
|
258 | - Prado::trace("Page raiseChangedEvents()",'System.Web.UI.TPage'); |
|
256 | + Prado::trace("Page processPostData()", 'System.Web.UI.TPage'); |
|
257 | + $this->processPostData($this->_restPostData, false); |
|
258 | + Prado::trace("Page raiseChangedEvents()", 'System.Web.UI.TPage'); |
|
259 | 259 | $this->raiseChangedEvents(); |
260 | - Prado::trace("Page raisePostBackEvent()",'System.Web.UI.TPage'); |
|
260 | + Prado::trace("Page raisePostBackEvent()", 'System.Web.UI.TPage'); |
|
261 | 261 | $this->raisePostBackEvent(); |
262 | - Prado::trace("Page onLoadComplete()",'System.Web.UI.TPage'); |
|
262 | + Prado::trace("Page onLoadComplete()", 'System.Web.UI.TPage'); |
|
263 | 263 | $this->onLoadComplete(null); |
264 | 264 | |
265 | - Prado::trace("Page preRenderRecursive()",'System.Web.UI.TPage'); |
|
265 | + Prado::trace("Page preRenderRecursive()", 'System.Web.UI.TPage'); |
|
266 | 266 | $this->preRenderRecursive(); |
267 | - Prado::trace("Page onPreRenderComplete()",'System.Web.UI.TPage'); |
|
267 | + Prado::trace("Page onPreRenderComplete()", 'System.Web.UI.TPage'); |
|
268 | 268 | $this->onPreRenderComplete(null); |
269 | 269 | |
270 | - Prado::trace("Page savePageState()",'System.Web.UI.TPage'); |
|
270 | + Prado::trace("Page savePageState()", 'System.Web.UI.TPage'); |
|
271 | 271 | $this->savePageState(); |
272 | - Prado::trace("Page onSaveStateComplete()",'System.Web.UI.TPage'); |
|
272 | + Prado::trace("Page onSaveStateComplete()", 'System.Web.UI.TPage'); |
|
273 | 273 | $this->onSaveStateComplete(null); |
274 | 274 | |
275 | - Prado::trace("Page renderControl()",'System.Web.UI.TPage'); |
|
275 | + Prado::trace("Page renderControl()", 'System.Web.UI.TPage'); |
|
276 | 276 | $this->renderControl($writer); |
277 | - Prado::trace("Page unloadRecursive()",'System.Web.UI.TPage'); |
|
277 | + Prado::trace("Page unloadRecursive()", 'System.Web.UI.TPage'); |
|
278 | 278 | $this->unloadRecursive(); |
279 | 279 | } |
280 | 280 | |
281 | 281 | protected static function decodeUTF8($data, $enc) |
282 | 282 | { |
283 | - if(is_array($data)) |
|
283 | + if (is_array($data)) |
|
284 | 284 | { |
285 | - foreach($data as $k=>$v) |
|
286 | - $data[$k]=self::decodeUTF8($v, $enc); |
|
285 | + foreach ($data as $k=>$v) |
|
286 | + $data[$k] = self::decodeUTF8($v, $enc); |
|
287 | 287 | return $data; |
288 | - } elseif(is_string($data)) { |
|
289 | - return iconv('UTF-8',$enc.'//IGNORE',$data); |
|
288 | + } elseif (is_string($data)) { |
|
289 | + return iconv('UTF-8', $enc . '//IGNORE', $data); |
|
290 | 290 | } else { |
291 | 291 | return $data; |
292 | 292 | } |
@@ -304,38 +304,38 @@ discard block |
||
304 | 304 | $this->setAdapter(new TActivePageAdapter($this)); |
305 | 305 | |
306 | 306 | $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
307 | - if(strlen($callbackEventParameter) > 0) |
|
308 | - $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string)$callbackEventParameter); |
|
307 | + if (strlen($callbackEventParameter) > 0) |
|
308 | + $this->_postData[TPage::FIELD_CALLBACK_PARAMETER] = TJavaScript::jsonDecode((string) $callbackEventParameter); |
|
309 | 309 | |
310 | 310 | // Decode Callback postData from UTF-8 to current Charset |
311 | - if (($g=$this->getApplication()->getGlobalization(false))!==null && |
|
312 | - strtoupper($enc=$g->getCharset())!='UTF-8') |
|
311 | + if (($g = $this->getApplication()->getGlobalization(false)) !== null && |
|
312 | + strtoupper($enc = $g->getCharset()) != 'UTF-8') |
|
313 | 313 | foreach ($this->_postData as $k=>$v) |
314 | - $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
314 | + $this->_postData[$k] = self::decodeUTF8($v, $enc); |
|
315 | 315 | |
316 | - Prado::trace("Page onPreInit()",'System.Web.UI.TPage'); |
|
316 | + Prado::trace("Page onPreInit()", 'System.Web.UI.TPage'); |
|
317 | 317 | $this->onPreInit(null); |
318 | 318 | |
319 | - Prado::trace("Page initRecursive()",'System.Web.UI.TPage'); |
|
319 | + Prado::trace("Page initRecursive()", 'System.Web.UI.TPage'); |
|
320 | 320 | $this->initRecursive(); |
321 | 321 | |
322 | - Prado::trace("Page onInitComplete()",'System.Web.UI.TPage'); |
|
322 | + Prado::trace("Page onInitComplete()", 'System.Web.UI.TPage'); |
|
323 | 323 | $this->onInitComplete(null); |
324 | 324 | |
325 | - $this->_restPostData=new TMap; |
|
326 | - Prado::trace("Page loadPageState()",'System.Web.UI.TPage'); |
|
325 | + $this->_restPostData = new TMap; |
|
326 | + Prado::trace("Page loadPageState()", 'System.Web.UI.TPage'); |
|
327 | 327 | $this->loadPageState(); |
328 | - Prado::trace("Page processPostData()",'System.Web.UI.TPage'); |
|
329 | - $this->processPostData($this->_postData,true); |
|
330 | - Prado::trace("Page onPreLoad()",'System.Web.UI.TPage'); |
|
328 | + Prado::trace("Page processPostData()", 'System.Web.UI.TPage'); |
|
329 | + $this->processPostData($this->_postData, true); |
|
330 | + Prado::trace("Page onPreLoad()", 'System.Web.UI.TPage'); |
|
331 | 331 | $this->onPreLoad(null); |
332 | - Prado::trace("Page loadRecursive()",'System.Web.UI.TPage'); |
|
332 | + Prado::trace("Page loadRecursive()", 'System.Web.UI.TPage'); |
|
333 | 333 | $this->loadRecursive(); |
334 | 334 | |
335 | - Prado::trace("Page processPostData()",'System.Web.UI.TPage'); |
|
336 | - $this->processPostData($this->_restPostData,false); |
|
335 | + Prado::trace("Page processPostData()", 'System.Web.UI.TPage'); |
|
336 | + $this->processPostData($this->_restPostData, false); |
|
337 | 337 | |
338 | - Prado::trace("Page raiseChangedEvents()",'System.Web.UI.TPage'); |
|
338 | + Prado::trace("Page raiseChangedEvents()", 'System.Web.UI.TPage'); |
|
339 | 339 | $this->raiseChangedEvents(); |
340 | 340 | |
341 | 341 | |
@@ -345,17 +345,17 @@ discard block |
||
345 | 345 | Prado::trace("Page raisePostBackEvent()",'System.Web.UI.TPage'); |
346 | 346 | $this->raisePostBackEvent(); |
347 | 347 | */ |
348 | - Prado::trace("Page onLoadComplete()",'System.Web.UI.TPage'); |
|
348 | + Prado::trace("Page onLoadComplete()", 'System.Web.UI.TPage'); |
|
349 | 349 | $this->onLoadComplete(null); |
350 | 350 | |
351 | - Prado::trace("Page preRenderRecursive()",'System.Web.UI.TPage'); |
|
351 | + Prado::trace("Page preRenderRecursive()", 'System.Web.UI.TPage'); |
|
352 | 352 | $this->preRenderRecursive(); |
353 | - Prado::trace("Page onPreRenderComplete()",'System.Web.UI.TPage'); |
|
353 | + Prado::trace("Page onPreRenderComplete()", 'System.Web.UI.TPage'); |
|
354 | 354 | $this->onPreRenderComplete(null); |
355 | 355 | |
356 | - Prado::trace("Page savePageState()",'System.Web.UI.TPage'); |
|
356 | + Prado::trace("Page savePageState()", 'System.Web.UI.TPage'); |
|
357 | 357 | $this->savePageState(); |
358 | - Prado::trace("Page onSaveStateComplete()",'System.Web.UI.TPage'); |
|
358 | + Prado::trace("Page onSaveStateComplete()", 'System.Web.UI.TPage'); |
|
359 | 359 | $this->onSaveStateComplete(null); |
360 | 360 | |
361 | 361 | /* |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | */ |
365 | 365 | $this->getAdapter()->renderCallbackResponse($writer); |
366 | 366 | |
367 | - Prado::trace("Page unloadRecursive()",'System.Web.UI.TPage'); |
|
367 | + Prado::trace("Page unloadRecursive()", 'System.Web.UI.TPage'); |
|
368 | 368 | $this->unloadRecursive(); |
369 | 369 | } |
370 | 370 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public function getCallbackClient() |
377 | 377 | { |
378 | - if($this->getAdapter() !== null) |
|
378 | + if ($this->getAdapter() !== null) |
|
379 | 379 | return $this->getAdapter()->getCallbackClientHandler(); |
380 | 380 | else |
381 | 381 | return new TCallbackClientScript(); |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public function setForm(TForm $form) |
443 | 443 | { |
444 | - if($this->_form===null) |
|
445 | - $this->_form=$form; |
|
444 | + if ($this->_form === null) |
|
445 | + $this->_form = $form; |
|
446 | 446 | else |
447 | 447 | throw new TInvalidOperationException('page_form_duplicated'); |
448 | 448 | } |
@@ -453,17 +453,17 @@ discard block |
||
453 | 453 | * @param string validation group |
454 | 454 | * @return TList registered validators in the requested group. If the group is null, all validators will be returned. |
455 | 455 | */ |
456 | - public function getValidators($validationGroup=null) |
|
456 | + public function getValidators($validationGroup = null) |
|
457 | 457 | { |
458 | - if(!$this->_validators) |
|
459 | - $this->_validators=new TList; |
|
460 | - if(empty($validationGroup) === true) |
|
458 | + if (!$this->_validators) |
|
459 | + $this->_validators = new TList; |
|
460 | + if (empty($validationGroup) === true) |
|
461 | 461 | return $this->_validators; |
462 | 462 | else |
463 | 463 | { |
464 | - $list=new TList; |
|
465 | - foreach($this->_validators as $validator) |
|
466 | - if($validator->getValidationGroup()===$validationGroup) |
|
464 | + $list = new TList; |
|
465 | + foreach ($this->_validators as $validator) |
|
466 | + if ($validator->getValidationGroup() === $validationGroup) |
|
467 | 467 | $list->add($validator); |
468 | 468 | return $list; |
469 | 469 | } |
@@ -475,22 +475,22 @@ discard block |
||
475 | 475 | * If validation group is specified, only the validators in that group will be invoked. |
476 | 476 | * @param string validation group. If null, all validators will perform validation. |
477 | 477 | */ |
478 | - public function validate($validationGroup=null) |
|
478 | + public function validate($validationGroup = null) |
|
479 | 479 | { |
480 | - Prado::trace("Page validate()",'System.Web.UI.TPage'); |
|
481 | - $this->_validated=true; |
|
482 | - if($this->_validators && $this->_validators->getCount()) |
|
480 | + Prado::trace("Page validate()", 'System.Web.UI.TPage'); |
|
481 | + $this->_validated = true; |
|
482 | + if ($this->_validators && $this->_validators->getCount()) |
|
483 | 483 | { |
484 | - if($validationGroup===null) |
|
484 | + if ($validationGroup === null) |
|
485 | 485 | { |
486 | - foreach($this->_validators as $validator) |
|
486 | + foreach ($this->_validators as $validator) |
|
487 | 487 | $validator->validate(); |
488 | 488 | } |
489 | 489 | else |
490 | 490 | { |
491 | - foreach($this->_validators as $validator) |
|
491 | + foreach ($this->_validators as $validator) |
|
492 | 492 | { |
493 | - if($validator->getValidationGroup()===$validationGroup) |
|
493 | + if ($validator->getValidationGroup() === $validationGroup) |
|
494 | 494 | $validator->validate(); |
495 | 495 | } |
496 | 496 | } |
@@ -505,12 +505,12 @@ discard block |
||
505 | 505 | */ |
506 | 506 | public function getIsValid() |
507 | 507 | { |
508 | - if($this->_validated) |
|
508 | + if ($this->_validated) |
|
509 | 509 | { |
510 | - if($this->_validators && $this->_validators->getCount()) |
|
510 | + if ($this->_validators && $this->_validators->getCount()) |
|
511 | 511 | { |
512 | - foreach($this->_validators as $validator) |
|
513 | - if(!$validator->getIsValid()) |
|
512 | + foreach ($this->_validators as $validator) |
|
513 | + if (!$validator->getIsValid()) |
|
514 | 514 | return false; |
515 | 515 | } |
516 | 516 | return true; |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | */ |
525 | 525 | public function getTheme() |
526 | 526 | { |
527 | - if(is_string($this->_theme)) |
|
528 | - $this->_theme=$this->getService()->getThemeManager()->getTheme($this->_theme); |
|
527 | + if (is_string($this->_theme)) |
|
528 | + $this->_theme = $this->getService()->getThemeManager()->getTheme($this->_theme); |
|
529 | 529 | return $this->_theme; |
530 | 530 | } |
531 | 531 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | */ |
536 | 536 | public function setTheme($value) |
537 | 537 | { |
538 | - $this->_theme=empty($value)?null:$value; |
|
538 | + $this->_theme = empty($value) ?null:$value; |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | */ |
545 | 545 | public function getStyleSheetTheme() |
546 | 546 | { |
547 | - if(is_string($this->_styleSheet)) |
|
548 | - $this->_styleSheet=$this->getService()->getThemeManager()->getTheme($this->_styleSheet); |
|
547 | + if (is_string($this->_styleSheet)) |
|
548 | + $this->_styleSheet = $this->getService()->getThemeManager()->getTheme($this->_styleSheet); |
|
549 | 549 | return $this->_styleSheet; |
550 | 550 | } |
551 | 551 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | */ |
556 | 556 | public function setStyleSheetTheme($value) |
557 | 557 | { |
558 | - $this->_styleSheet=empty($value)?null:$value; |
|
558 | + $this->_styleSheet = empty($value) ?null:$value; |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | /** |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | */ |
566 | 566 | public function applyControlSkin($control) |
567 | 567 | { |
568 | - if(($theme=$this->getTheme())!==null) |
|
568 | + if (($theme = $this->getTheme()) !== null) |
|
569 | 569 | $theme->applySkin($control); |
570 | 570 | } |
571 | 571 | |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | */ |
577 | 577 | public function applyControlStyleSheet($control) |
578 | 578 | { |
579 | - if(($theme=$this->getStyleSheetTheme())!==null) |
|
579 | + if (($theme = $this->getStyleSheetTheme()) !== null) |
|
580 | 580 | $theme->applySkin($control); |
581 | 581 | } |
582 | 582 | |
@@ -585,16 +585,16 @@ discard block |
||
585 | 585 | */ |
586 | 586 | public function getClientScript() |
587 | 587 | { |
588 | - if(!$this->_clientScript) { |
|
588 | + if (!$this->_clientScript) { |
|
589 | 589 | $className = $classPath = $this->getService()->getClientScriptManagerClass(); |
590 | 590 | Prado::using($className); |
591 | - if(($pos=strrpos($className,'.'))!==false) |
|
592 | - $className=substr($className,$pos+1); |
|
591 | + if (($pos = strrpos($className, '.')) !== false) |
|
592 | + $className = substr($className, $pos + 1); |
|
593 | 593 | |
594 | - if(!class_exists($className,false) || ($className!=='TClientScriptManager' && !is_subclass_of($className,'TClientScriptManager'))) |
|
595 | - throw new THttpException(404,'page_csmanagerclass_invalid',$classPath); |
|
594 | + if (!class_exists($className, false) || ($className !== 'TClientScriptManager' && !is_subclass_of($className, 'TClientScriptManager'))) |
|
595 | + throw new THttpException(404, 'page_csmanagerclass_invalid', $classPath); |
|
596 | 596 | |
597 | - $this->_clientScript=new $className($this); |
|
597 | + $this->_clientScript = new $className($this); |
|
598 | 598 | } |
599 | 599 | return $this->_clientScript; |
600 | 600 | } |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | */ |
611 | 611 | public function onPreInit($param) |
612 | 612 | { |
613 | - $this->raiseEvent('OnPreInit',$this,$param); |
|
613 | + $this->raiseEvent('OnPreInit', $this, $param); |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | /** |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | */ |
624 | 624 | public function onInitComplete($param) |
625 | 625 | { |
626 | - $this->raiseEvent('OnInitComplete',$this,$param); |
|
626 | + $this->raiseEvent('OnInitComplete', $this, $param); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | /** |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | */ |
637 | 637 | public function onPreLoad($param) |
638 | 638 | { |
639 | - $this->raiseEvent('OnPreLoad',$this,$param); |
|
639 | + $this->raiseEvent('OnPreLoad', $this, $param); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | /** |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | */ |
650 | 650 | public function onLoadComplete($param) |
651 | 651 | { |
652 | - $this->raiseEvent('OnLoadComplete',$this,$param); |
|
652 | + $this->raiseEvent('OnLoadComplete', $this, $param); |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | /** |
@@ -662,26 +662,26 @@ discard block |
||
662 | 662 | */ |
663 | 663 | public function onPreRenderComplete($param) |
664 | 664 | { |
665 | - $this->raiseEvent('OnPreRenderComplete',$this,$param); |
|
666 | - $cs=$this->getClientScript(); |
|
667 | - $theme=$this->getTheme(); |
|
668 | - if($theme instanceof ITheme) |
|
665 | + $this->raiseEvent('OnPreRenderComplete', $this, $param); |
|
666 | + $cs = $this->getClientScript(); |
|
667 | + $theme = $this->getTheme(); |
|
668 | + if ($theme instanceof ITheme) |
|
669 | 669 | { |
670 | - foreach($theme->getStyleSheetFiles() as $url) |
|
671 | - $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
672 | - foreach($theme->getJavaScriptFiles() as $url) |
|
673 | - $cs->registerHeadScriptFile($url,$url); |
|
670 | + foreach ($theme->getStyleSheetFiles() as $url) |
|
671 | + $cs->registerStyleSheetFile($url, $url, $this->getCssMediaType($url)); |
|
672 | + foreach ($theme->getJavaScriptFiles() as $url) |
|
673 | + $cs->registerHeadScriptFile($url, $url); |
|
674 | 674 | } |
675 | - $styleSheet=$this->getStyleSheetTheme(); |
|
676 | - if($styleSheet instanceof ITheme) |
|
675 | + $styleSheet = $this->getStyleSheetTheme(); |
|
676 | + if ($styleSheet instanceof ITheme) |
|
677 | 677 | { |
678 | - foreach($styleSheet->getStyleSheetFiles() as $url) |
|
679 | - $cs->registerStyleSheetFile($url,$url,$this->getCssMediaType($url)); |
|
680 | - foreach($styleSheet->getJavaScriptFiles() as $url) |
|
681 | - $cs->registerHeadScriptFile($url,$url); |
|
678 | + foreach ($styleSheet->getStyleSheetFiles() as $url) |
|
679 | + $cs->registerStyleSheetFile($url, $url, $this->getCssMediaType($url)); |
|
680 | + foreach ($styleSheet->getJavaScriptFiles() as $url) |
|
681 | + $cs->registerHeadScriptFile($url, $url); |
|
682 | 682 | } |
683 | 683 | |
684 | - if($cs->getRequiresHead() && $this->getHead()===null) |
|
684 | + if ($cs->getRequiresHead() && $this->getHead() === null) |
|
685 | 685 | throw new TConfigurationException('page_head_required'); |
686 | 686 | } |
687 | 687 | |
@@ -695,9 +695,9 @@ discard block |
||
695 | 695 | */ |
696 | 696 | private function getCssMediaType($url) |
697 | 697 | { |
698 | - $segs=explode('.',basename($url)); |
|
699 | - if(isset($segs[2])) |
|
700 | - return $segs[count($segs)-2]; |
|
698 | + $segs = explode('.', basename($url)); |
|
699 | + if (isset($segs[2])) |
|
700 | + return $segs[count($segs) - 2]; |
|
701 | 701 | else |
702 | 702 | return ''; |
703 | 703 | } |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | */ |
712 | 712 | public function onSaveStateComplete($param) |
713 | 713 | { |
714 | - $this->raiseEvent('OnSaveStateComplete',$this,$param); |
|
714 | + $this->raiseEvent('OnSaveStateComplete', $this, $param); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -720,9 +720,9 @@ discard block |
||
720 | 720 | */ |
721 | 721 | private function determinePostBackMode() |
722 | 722 | { |
723 | - $postData=$this->getRequest(); |
|
724 | - if($postData->contains(self::FIELD_PAGESTATE) || $postData->contains(self::FIELD_POSTBACK_TARGET)) |
|
725 | - $this->_postData=$postData; |
|
723 | + $postData = $this->getRequest(); |
|
724 | + if ($postData->contains(self::FIELD_PAGESTATE) || $postData->contains(self::FIELD_POSTBACK_TARGET)) |
|
725 | + $this->_postData = $postData; |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | */ |
731 | 731 | public function getIsPostBack() |
732 | 732 | { |
733 | - return $this->_postData!==null; |
|
733 | + return $this->_postData !== null; |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | /** |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | public function saveState() |
750 | 750 | { |
751 | 751 | parent::saveState(); |
752 | - $this->setViewState('ControlsRequiringPostBack',$this->_controlsRegisteredForPostData,array()); |
|
752 | + $this->setViewState('ControlsRequiringPostBack', $this->_controlsRegisteredForPostData, array()); |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | /** |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | public function loadState() |
761 | 761 | { |
762 | 762 | parent::loadState(); |
763 | - $this->_controlsRequiringPostData=$this->getViewState('ControlsRequiringPostBack',array()); |
|
763 | + $this->_controlsRequiringPostData = $this->getViewState('ControlsRequiringPostBack', array()); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -768,9 +768,9 @@ discard block |
||
768 | 768 | */ |
769 | 769 | protected function loadPageState() |
770 | 770 | { |
771 | - Prado::trace("Loading state",'System.Web.UI.TPage'); |
|
772 | - $state=$this->getStatePersister()->load(); |
|
773 | - $this->loadStateRecursive($state,$this->getEnableViewState()); |
|
771 | + Prado::trace("Loading state", 'System.Web.UI.TPage'); |
|
772 | + $state = $this->getStatePersister()->load(); |
|
773 | + $this->loadStateRecursive($state, $this->getEnableViewState()); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | /** |
@@ -778,8 +778,8 @@ discard block |
||
778 | 778 | */ |
779 | 779 | protected function savePageState() |
780 | 780 | { |
781 | - Prado::trace("Saving state",'System.Web.UI.TPage'); |
|
782 | - $state=&$this->saveStateRecursive($this->getEnableViewState()); |
|
781 | + Prado::trace("Saving state", 'System.Web.UI.TPage'); |
|
782 | + $state = &$this->saveStateRecursive($this->getEnableViewState()); |
|
783 | 783 | $this->getStatePersister()->save($state); |
784 | 784 | } |
785 | 785 | |
@@ -801,11 +801,11 @@ discard block |
||
801 | 801 | */ |
802 | 802 | public function registerRequiresPostData($control) |
803 | 803 | { |
804 | - $id=is_string($control)?$control:$control->getUniqueID(); |
|
805 | - $this->_controlsRegisteredForPostData[$id]=true; |
|
806 | - $params=func_get_args(); |
|
807 | - foreach($this->getCachingStack() as $item) |
|
808 | - $item->registerAction('Page','registerRequiresPostData',array($id)); |
|
804 | + $id = is_string($control) ? $control : $control->getUniqueID(); |
|
805 | + $this->_controlsRegisteredForPostData[$id] = true; |
|
806 | + $params = func_get_args(); |
|
807 | + foreach ($this->getCachingStack() as $item) |
|
808 | + $item->registerAction('Page', 'registerRequiresPostData', array($id)); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | /** |
@@ -813,11 +813,11 @@ discard block |
||
813 | 813 | */ |
814 | 814 | public function getPostBackEventTarget() |
815 | 815 | { |
816 | - if($this->_postBackEventTarget===null && $this->_postData!==null) |
|
816 | + if ($this->_postBackEventTarget === null && $this->_postData !== null) |
|
817 | 817 | { |
818 | - $eventTarget=$this->_postData->itemAt(self::FIELD_POSTBACK_TARGET); |
|
819 | - if(!empty($eventTarget)) |
|
820 | - $this->_postBackEventTarget=$this->findControl($eventTarget); |
|
818 | + $eventTarget = $this->_postData->itemAt(self::FIELD_POSTBACK_TARGET); |
|
819 | + if (!empty($eventTarget)) |
|
820 | + $this->_postBackEventTarget = $this->findControl($eventTarget); |
|
821 | 821 | } |
822 | 822 | return $this->_postBackEventTarget; |
823 | 823 | } |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | */ |
829 | 829 | public function setPostBackEventTarget(TControl $control) |
830 | 830 | { |
831 | - $this->_postBackEventTarget=$control; |
|
831 | + $this->_postBackEventTarget = $control; |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | /** |
@@ -836,10 +836,10 @@ discard block |
||
836 | 836 | */ |
837 | 837 | public function getPostBackEventParameter() |
838 | 838 | { |
839 | - if($this->_postBackEventParameter===null && $this->_postData!==null) |
|
839 | + if ($this->_postBackEventParameter === null && $this->_postData !== null) |
|
840 | 840 | { |
841 | - if(($this->_postBackEventParameter=$this->_postData->itemAt(self::FIELD_POSTBACK_PARAMETER))===null) |
|
842 | - $this->_postBackEventParameter=''; |
|
841 | + if (($this->_postBackEventParameter = $this->_postData->itemAt(self::FIELD_POSTBACK_PARAMETER)) === null) |
|
842 | + $this->_postBackEventParameter = ''; |
|
843 | 843 | } |
844 | 844 | return $this->_postBackEventParameter; |
845 | 845 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | */ |
850 | 850 | public function setPostBackEventParameter($value) |
851 | 851 | { |
852 | - $this->_postBackEventParameter=$value; |
|
852 | + $this->_postBackEventParameter = $value; |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | /** |
@@ -857,48 +857,48 @@ discard block |
||
857 | 857 | * @param TMap post data to be processed |
858 | 858 | * @param boolean whether this method is invoked before {@link onLoad OnLoad}. |
859 | 859 | */ |
860 | - protected function processPostData($postData,$beforeLoad) |
|
860 | + protected function processPostData($postData, $beforeLoad) |
|
861 | 861 | { |
862 | - $this->_isLoadingPostData=true; |
|
863 | - if($beforeLoad) |
|
864 | - $this->_restPostData=new TMap; |
|
865 | - foreach($postData as $key=>$value) |
|
862 | + $this->_isLoadingPostData = true; |
|
863 | + if ($beforeLoad) |
|
864 | + $this->_restPostData = new TMap; |
|
865 | + foreach ($postData as $key=>$value) |
|
866 | 866 | { |
867 | - if($this->isSystemPostField($key)) |
|
867 | + if ($this->isSystemPostField($key)) |
|
868 | 868 | continue; |
869 | - else if($control=$this->findControl($key)) |
|
869 | + else if ($control = $this->findControl($key)) |
|
870 | 870 | { |
871 | - if($control instanceof IPostBackDataHandler) |
|
871 | + if ($control instanceof IPostBackDataHandler) |
|
872 | 872 | { |
873 | - if($control->loadPostData($key,$postData)) |
|
874 | - $this->_controlsPostDataChanged[]=$control; |
|
873 | + if ($control->loadPostData($key, $postData)) |
|
874 | + $this->_controlsPostDataChanged[] = $control; |
|
875 | 875 | } |
876 | - else if($control instanceof IPostBackEventHandler && |
|
876 | + else if ($control instanceof IPostBackEventHandler && |
|
877 | 877 | empty($this->_postData[self::FIELD_POSTBACK_TARGET])) |
878 | 878 | { |
879 | - $this->_postData->add(self::FIELD_POSTBACK_TARGET,$key); // not calling setPostBackEventTarget() because the control may be removed later |
|
879 | + $this->_postData->add(self::FIELD_POSTBACK_TARGET, $key); // not calling setPostBackEventTarget() because the control may be removed later |
|
880 | 880 | } |
881 | 881 | unset($this->_controlsRequiringPostData[$key]); |
882 | 882 | } |
883 | - else if($beforeLoad) |
|
884 | - $this->_restPostData->add($key,$value); |
|
883 | + else if ($beforeLoad) |
|
884 | + $this->_restPostData->add($key, $value); |
|
885 | 885 | } |
886 | 886 | |
887 | - foreach($this->_controlsRequiringPostData as $key=>$value) |
|
887 | + foreach ($this->_controlsRequiringPostData as $key=>$value) |
|
888 | 888 | { |
889 | - if($control=$this->findControl($key)) |
|
889 | + if ($control = $this->findControl($key)) |
|
890 | 890 | { |
891 | - if($control instanceof IPostBackDataHandler) |
|
891 | + if ($control instanceof IPostBackDataHandler) |
|
892 | 892 | { |
893 | - if($control->loadPostData($key,$this->_postData)) |
|
894 | - $this->_controlsPostDataChanged[]=$control; |
|
893 | + if ($control->loadPostData($key, $this->_postData)) |
|
894 | + $this->_controlsPostDataChanged[] = $control; |
|
895 | 895 | } |
896 | 896 | else |
897 | - throw new TInvalidDataValueException('page_postbackcontrol_invalid',$key); |
|
897 | + throw new TInvalidDataValueException('page_postbackcontrol_invalid', $key); |
|
898 | 898 | unset($this->_controlsRequiringPostData[$key]); |
899 | 899 | } |
900 | 900 | } |
901 | - $this->_isLoadingPostData=false; |
|
901 | + $this->_isLoadingPostData = false; |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | /** |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | */ |
915 | 915 | protected function raiseChangedEvents() |
916 | 916 | { |
917 | - foreach($this->_controlsPostDataChanged as $control) |
|
917 | + foreach ($this->_controlsPostDataChanged as $control) |
|
918 | 918 | $control->raisePostDataChangedEvent(); |
919 | 919 | } |
920 | 920 | |
@@ -923,9 +923,9 @@ discard block |
||
923 | 923 | */ |
924 | 924 | protected function raisePostBackEvent() |
925 | 925 | { |
926 | - if(($postBackHandler=$this->getPostBackEventTarget())===null) |
|
926 | + if (($postBackHandler = $this->getPostBackEventTarget()) === null) |
|
927 | 927 | $this->validate(); |
928 | - else if($postBackHandler instanceof IPostBackEventHandler) |
|
928 | + else if ($postBackHandler instanceof IPostBackEventHandler) |
|
929 | 929 | $postBackHandler->raisePostBackEvent($this->getPostBackEventParameter()); |
930 | 930 | } |
931 | 931 | |
@@ -944,8 +944,8 @@ discard block |
||
944 | 944 | */ |
945 | 945 | public function ensureRenderInForm($control) |
946 | 946 | { |
947 | - if(!$this->getIsCallback() && !$this->_inFormRender) |
|
948 | - throw new TConfigurationException('page_control_outofform',get_class($control), $control ? $control->getUniqueID() : null); |
|
947 | + if (!$this->getIsCallback() && !$this->_inFormRender) |
|
948 | + throw new TConfigurationException('page_control_outofform', get_class($control), $control ? $control->getUniqueID() : null); |
|
949 | 949 | } |
950 | 950 | |
951 | 951 | /** |
@@ -953,11 +953,11 @@ discard block |
||
953 | 953 | */ |
954 | 954 | public function beginFormRender($writer) |
955 | 955 | { |
956 | - if($this->_formRendered) |
|
956 | + if ($this->_formRendered) |
|
957 | 957 | throw new TConfigurationException('page_form_duplicated'); |
958 | - $this->_formRendered=true; |
|
959 | - $this->getClientScript()->registerHiddenField(self::FIELD_PAGESTATE,$this->getClientState()); |
|
960 | - $this->_inFormRender=true; |
|
958 | + $this->_formRendered = true; |
|
959 | + $this->getClientScript()->registerHiddenField(self::FIELD_PAGESTATE, $this->getClientState()); |
|
960 | + $this->_inFormRender = true; |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | /** |
@@ -965,17 +965,17 @@ discard block |
||
965 | 965 | */ |
966 | 966 | public function endFormRender($writer) |
967 | 967 | { |
968 | - if($this->_focus) |
|
968 | + if ($this->_focus) |
|
969 | 969 | { |
970 | - if(($this->_focus instanceof TControl) && $this->_focus->getVisible(true)) |
|
971 | - $focus=$this->_focus->getClientID(); |
|
970 | + if (($this->_focus instanceof TControl) && $this->_focus->getVisible(true)) |
|
971 | + $focus = $this->_focus->getClientID(); |
|
972 | 972 | else |
973 | - $focus=$this->_focus; |
|
973 | + $focus = $this->_focus; |
|
974 | 974 | $this->getClientScript()->registerFocusControl($focus); |
975 | 975 | } |
976 | - else if($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null) |
|
976 | + else if ($this->_postData && ($lastFocus = $this->_postData->itemAt(self::FIELD_LASTFOCUS)) !== null) |
|
977 | 977 | $this->getClientScript()->registerFocusControl($lastFocus); |
978 | - $this->_inFormRender=false; |
|
978 | + $this->_inFormRender = false; |
|
979 | 979 | } |
980 | 980 | |
981 | 981 | /** |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | */ |
985 | 985 | public function setFocus($value) |
986 | 986 | { |
987 | - $this->_focus=$value; |
|
987 | + $this->_focus = $value; |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | /** |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | */ |
1001 | 1001 | public function setClientSupportsJavaScript($value) |
1002 | 1002 | { |
1003 | - $this->_enableJavaScript=TPropertyValue::ensureBoolean($value); |
|
1003 | + $this->_enableJavaScript = TPropertyValue::ensureBoolean($value); |
|
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | /** |
@@ -1017,13 +1017,13 @@ discard block |
||
1017 | 1017 | */ |
1018 | 1018 | public function setHead(THead $value) |
1019 | 1019 | { |
1020 | - if($this->_head) |
|
1020 | + if ($this->_head) |
|
1021 | 1021 | throw new TInvalidOperationException('page_head_duplicated'); |
1022 | - $this->_head=$value; |
|
1023 | - if($this->_title!==null) |
|
1022 | + $this->_head = $value; |
|
1023 | + if ($this->_title !== null) |
|
1024 | 1024 | { |
1025 | 1025 | $this->_head->setTitle($this->_title); |
1026 | - $this->_title=null; |
|
1026 | + $this->_title = null; |
|
1027 | 1027 | } |
1028 | 1028 | } |
1029 | 1029 | |
@@ -1032,10 +1032,10 @@ discard block |
||
1032 | 1032 | */ |
1033 | 1033 | public function getTitle() |
1034 | 1034 | { |
1035 | - if($this->_head) |
|
1035 | + if ($this->_head) |
|
1036 | 1036 | return $this->_head->getTitle(); |
1037 | 1037 | else |
1038 | - return $this->_title===null ? '' : $this->_title; |
|
1038 | + return $this->_title === null ? '' : $this->_title; |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | /** |
@@ -1046,10 +1046,10 @@ discard block |
||
1046 | 1046 | */ |
1047 | 1047 | public function setTitle($value) |
1048 | 1048 | { |
1049 | - if($this->_head) |
|
1049 | + if ($this->_head) |
|
1050 | 1050 | $this->_head->setTitle($value); |
1051 | 1051 | else |
1052 | - $this->_title=$value; |
|
1052 | + $this->_title = $value; |
|
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | /** |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | */ |
1070 | 1070 | public function setClientState($state) |
1071 | 1071 | { |
1072 | - $this->_clientState=$state; |
|
1072 | + $this->_clientState = $state; |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | /** |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | */ |
1094 | 1094 | public function setStatePersisterClass($value) |
1095 | 1095 | { |
1096 | - $this->_statePersisterClass=$value; |
|
1096 | + $this->_statePersisterClass = $value; |
|
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | /** |
@@ -1101,10 +1101,10 @@ discard block |
||
1101 | 1101 | */ |
1102 | 1102 | public function getStatePersister() |
1103 | 1103 | { |
1104 | - if($this->_statePersister===null) |
|
1104 | + if ($this->_statePersister === null) |
|
1105 | 1105 | { |
1106 | - $this->_statePersister=Prado::createComponent($this->_statePersisterClass); |
|
1107 | - if(!($this->_statePersister instanceof IPageStatePersister)) |
|
1106 | + $this->_statePersister = Prado::createComponent($this->_statePersisterClass); |
|
1107 | + if (!($this->_statePersister instanceof IPageStatePersister)) |
|
1108 | 1108 | throw new TInvalidDataTypeException('page_statepersister_invalid'); |
1109 | 1109 | $this->_statePersister->setPage($this); |
1110 | 1110 | } |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | */ |
1125 | 1125 | public function setEnableStateValidation($value) |
1126 | 1126 | { |
1127 | - $this->_enableStateValidation=TPropertyValue::ensureBoolean($value); |
|
1127 | + $this->_enableStateValidation = TPropertyValue::ensureBoolean($value); |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | /** |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | */ |
1141 | 1141 | public function setEnableStateEncryption($value) |
1142 | 1142 | { |
1143 | - $this->_enableStateEncryption=TPropertyValue::ensureBoolean($value); |
|
1143 | + $this->_enableStateEncryption = TPropertyValue::ensureBoolean($value); |
|
1144 | 1144 | } |
1145 | 1145 | |
1146 | 1146 | /** |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | */ |
1159 | 1159 | public function setEnableStateCompression($value) |
1160 | 1160 | { |
1161 | - $this->_enableStateCompression=TPropertyValue::ensureBoolean($value); |
|
1161 | + $this->_enableStateCompression = TPropertyValue::ensureBoolean($value); |
|
1162 | 1162 | } |
1163 | 1163 | |
1164 | 1164 | /** |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | */ |
1175 | 1175 | public function setPagePath($value) |
1176 | 1176 | { |
1177 | - $this->_pagePath=$value; |
|
1177 | + $this->_pagePath = $value; |
|
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | /** |
@@ -1186,12 +1186,12 @@ discard block |
||
1186 | 1186 | * @param string method name of the context object |
1187 | 1187 | * @param array list of parameters to be passed to the action method |
1188 | 1188 | */ |
1189 | - public function registerCachingAction($context,$funcName,$funcParams) |
|
1189 | + public function registerCachingAction($context, $funcName, $funcParams) |
|
1190 | 1190 | { |
1191 | - if($this->_cachingStack) |
|
1191 | + if ($this->_cachingStack) |
|
1192 | 1192 | { |
1193 | - foreach($this->_cachingStack as $cache) |
|
1194 | - $cache->registerAction($context,$funcName,$funcParams); |
|
1193 | + foreach ($this->_cachingStack as $cache) |
|
1194 | + $cache->registerAction($context, $funcName, $funcParams); |
|
1195 | 1195 | } |
1196 | 1196 | } |
1197 | 1197 | |
@@ -1200,8 +1200,8 @@ discard block |
||
1200 | 1200 | */ |
1201 | 1201 | public function getCachingStack() |
1202 | 1202 | { |
1203 | - if(!$this->_cachingStack) |
|
1204 | - $this->_cachingStack=new TStack; |
|
1203 | + if (!$this->_cachingStack) |
|
1204 | + $this->_cachingStack = new TStack; |
|
1205 | 1205 | return $this->_cachingStack; |
1206 | 1206 | } |
1207 | 1207 | |
@@ -1274,17 +1274,17 @@ discard block |
||
1274 | 1274 | * @param mixed state data |
1275 | 1275 | * @return string serialized data |
1276 | 1276 | */ |
1277 | - public static function serialize($page,$data) |
|
1277 | + public static function serialize($page, $data) |
|
1278 | 1278 | { |
1279 | - $sm=$page->getApplication()->getSecurityManager(); |
|
1280 | - if($page->getEnableStateValidation()) |
|
1281 | - $str=$sm->hashData(serialize($data)); |
|
1279 | + $sm = $page->getApplication()->getSecurityManager(); |
|
1280 | + if ($page->getEnableStateValidation()) |
|
1281 | + $str = $sm->hashData(serialize($data)); |
|
1282 | 1282 | else |
1283 | - $str=serialize($data); |
|
1284 | - if($page->getEnableStateCompression() && extension_loaded('zlib')) |
|
1285 | - $str=gzcompress($str); |
|
1286 | - if($page->getEnableStateEncryption()) |
|
1287 | - $str=$sm->encrypt($str); |
|
1283 | + $str = serialize($data); |
|
1284 | + if ($page->getEnableStateCompression() && extension_loaded('zlib')) |
|
1285 | + $str = gzcompress($str); |
|
1286 | + if ($page->getEnableStateEncryption()) |
|
1287 | + $str = $sm->encrypt($str); |
|
1288 | 1288 | return base64_encode($str); |
1289 | 1289 | } |
1290 | 1290 | |
@@ -1293,21 +1293,21 @@ discard block |
||
1293 | 1293 | * @param string serialized data |
1294 | 1294 | * @return mixed unserialized state data, null if data is corrupted |
1295 | 1295 | */ |
1296 | - public static function unserialize($page,$data) |
|
1296 | + public static function unserialize($page, $data) |
|
1297 | 1297 | { |
1298 | - $str=base64_decode($data); |
|
1299 | - if($str==='') |
|
1298 | + $str = base64_decode($data); |
|
1299 | + if ($str === '') |
|
1300 | 1300 | return null; |
1301 | - if($str!==false) |
|
1301 | + if ($str !== false) |
|
1302 | 1302 | { |
1303 | - $sm=$page->getApplication()->getSecurityManager(); |
|
1304 | - if($page->getEnableStateEncryption()) |
|
1305 | - $str=$sm->decrypt($str); |
|
1306 | - if($page->getEnableStateCompression() && extension_loaded('zlib')) |
|
1307 | - $str=@gzuncompress($str); |
|
1308 | - if($page->getEnableStateValidation()) |
|
1303 | + $sm = $page->getApplication()->getSecurityManager(); |
|
1304 | + if ($page->getEnableStateEncryption()) |
|
1305 | + $str = $sm->decrypt($str); |
|
1306 | + if ($page->getEnableStateCompression() && extension_loaded('zlib')) |
|
1307 | + $str = @gzuncompress($str); |
|
1308 | + if ($page->getEnableStateValidation()) |
|
1309 | 1309 | { |
1310 | - if(($str=$sm->validateData($str))!==false) |
|
1310 | + if (($str = $sm->validateData($str)) !== false) |
|
1311 | 1311 | return unserialize($str); |
1312 | 1312 | } |
1313 | 1313 | else |
@@ -144,6 +144,7 @@ discard block |
||
144 | 144 | * Registers a content control. |
145 | 145 | * @param string ID of the content |
146 | 146 | * @param TContent |
147 | + * @param string $id |
|
147 | 148 | */ |
148 | 149 | public function registerContent($id,TContent $object) |
149 | 150 | { |
@@ -158,6 +159,7 @@ discard block |
||
158 | 159 | * This method should only be used by framework and control developers. |
159 | 160 | * @param string placeholder ID |
160 | 161 | * @param TContentPlaceHolder placeholder control |
162 | + * @param string $id |
|
161 | 163 | */ |
162 | 164 | public function registerContentPlaceHolder($id,TContentPlaceHolder $object) |
163 | 165 | { |
@@ -184,7 +186,7 @@ discard block |
||
184 | 186 | } |
185 | 187 | |
186 | 188 | /** |
187 | - * @return TTemplateControl|null master control associated with this control, null if none |
|
189 | + * @return TTemplateControl master control associated with this control, null if none |
|
188 | 190 | */ |
189 | 191 | public function getMaster() |
190 | 192 | { |
@@ -238,90 +238,90 @@ |
||
238 | 238 | parent::initRecursive($namingContainer); |
239 | 239 | } |
240 | 240 | |
241 | - /** |
|
242 | - * Function to update view controls with data in a given AR object. |
|
243 | - * View controls and AR object need to have the same name in IDs and Attrs respectively. |
|
244 | - * @param TActiveRecord $arObj |
|
245 | - * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
246 | - * @author Daniel Sampedro <[email protected]> |
|
247 | - */ |
|
248 | - public function tryToUpdateView($arObj, $throwExceptions = false) |
|
249 | - { |
|
250 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
251 | - foreach (array_keys($objAttrs) as $key) |
|
252 | - { |
|
253 | - try |
|
254 | - { |
|
255 | - if ($key != "RELATIONS") |
|
256 | - { |
|
257 | - $control = $this->{$key}; |
|
258 | - if ($control instanceof TTextBox) |
|
259 | - $control->Text = $arObj->{$key}; |
|
260 | - elseif ($control instanceof TCheckBox) |
|
261 | - $control->Checked = (boolean) $arObj->{$key}; |
|
262 | - elseif ($control instanceof TDatePicker) |
|
263 | - $control->Date = $arObj->{$key}; |
|
264 | - } |
|
265 | - else |
|
266 | - { |
|
267 | - foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
268 | - { |
|
269 | - $relControl = $this->{$relKey}; |
|
270 | - switch ($relValues[0]) |
|
271 | - { |
|
272 | - case TActiveRecord::BELONGS_TO: |
|
273 | - case TActiveRecord::HAS_ONE: |
|
274 | - $relControl->Text = $arObj->{$relKey}; |
|
275 | - break; |
|
276 | - case TActiveRecord::HAS_MANY: |
|
277 | - if ($relControl instanceof TListControl) |
|
278 | - { |
|
279 | - $relControl->DataSource = $arObj->{$relKey}; |
|
280 | - $relControl->dataBind(); |
|
281 | - } |
|
282 | - break; |
|
283 | - } |
|
284 | - } |
|
285 | - break; |
|
286 | - } |
|
287 | - } |
|
288 | - catch (Exception $ex) |
|
289 | - { |
|
290 | - if ($throwExceptions) |
|
291 | - throw $ex; |
|
292 | - } |
|
293 | - } |
|
294 | - } |
|
241 | + /** |
|
242 | + * Function to update view controls with data in a given AR object. |
|
243 | + * View controls and AR object need to have the same name in IDs and Attrs respectively. |
|
244 | + * @param TActiveRecord $arObj |
|
245 | + * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
246 | + * @author Daniel Sampedro <[email protected]> |
|
247 | + */ |
|
248 | + public function tryToUpdateView($arObj, $throwExceptions = false) |
|
249 | + { |
|
250 | + $objAttrs = get_class_vars(get_class($arObj)); |
|
251 | + foreach (array_keys($objAttrs) as $key) |
|
252 | + { |
|
253 | + try |
|
254 | + { |
|
255 | + if ($key != "RELATIONS") |
|
256 | + { |
|
257 | + $control = $this->{$key}; |
|
258 | + if ($control instanceof TTextBox) |
|
259 | + $control->Text = $arObj->{$key}; |
|
260 | + elseif ($control instanceof TCheckBox) |
|
261 | + $control->Checked = (boolean) $arObj->{$key}; |
|
262 | + elseif ($control instanceof TDatePicker) |
|
263 | + $control->Date = $arObj->{$key}; |
|
264 | + } |
|
265 | + else |
|
266 | + { |
|
267 | + foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
|
268 | + { |
|
269 | + $relControl = $this->{$relKey}; |
|
270 | + switch ($relValues[0]) |
|
271 | + { |
|
272 | + case TActiveRecord::BELONGS_TO: |
|
273 | + case TActiveRecord::HAS_ONE: |
|
274 | + $relControl->Text = $arObj->{$relKey}; |
|
275 | + break; |
|
276 | + case TActiveRecord::HAS_MANY: |
|
277 | + if ($relControl instanceof TListControl) |
|
278 | + { |
|
279 | + $relControl->DataSource = $arObj->{$relKey}; |
|
280 | + $relControl->dataBind(); |
|
281 | + } |
|
282 | + break; |
|
283 | + } |
|
284 | + } |
|
285 | + break; |
|
286 | + } |
|
287 | + } |
|
288 | + catch (Exception $ex) |
|
289 | + { |
|
290 | + if ($throwExceptions) |
|
291 | + throw $ex; |
|
292 | + } |
|
293 | + } |
|
294 | + } |
|
295 | 295 | |
296 | - /** |
|
297 | - * Function to try to update an AR object with data in view controls. |
|
298 | - * @param TActiveRecord $arObj |
|
299 | - * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
300 | - * @author Daniel Sampedro <[email protected]> |
|
301 | - */ |
|
302 | - public function tryToUpdateAR($arObj, $throwExceptions = false) |
|
303 | - { |
|
304 | - $objAttrs = get_class_vars(get_class($arObj)); |
|
305 | - foreach (array_keys($objAttrs) as $key) |
|
306 | - { |
|
307 | - try |
|
308 | - { |
|
309 | - if ($key == "RELATIONS") |
|
310 | - break; |
|
311 | - $control = $this->{$key}; |
|
312 | - if ($control instanceof TTextBox) |
|
313 | - $arObj->{$key} = $control->Text; |
|
314 | - elseif ($control instanceof TCheckBox) |
|
315 | - $arObj->{$key} = $control->Checked; |
|
316 | - elseif ($control instanceof TDatePicker) |
|
317 | - $arObj->{$key} = $control->Date; |
|
318 | - } |
|
319 | - catch (Exception $ex) |
|
320 | - { |
|
321 | - if ($throwExceptions) |
|
322 | - throw $ex; |
|
323 | - } |
|
324 | - } |
|
325 | - } |
|
296 | + /** |
|
297 | + * Function to try to update an AR object with data in view controls. |
|
298 | + * @param TActiveRecord $arObj |
|
299 | + * @param Boolean $throwExceptions Wheter or not to throw exceptions |
|
300 | + * @author Daniel Sampedro <[email protected]> |
|
301 | + */ |
|
302 | + public function tryToUpdateAR($arObj, $throwExceptions = false) |
|
303 | + { |
|
304 | + $objAttrs = get_class_vars(get_class($arObj)); |
|
305 | + foreach (array_keys($objAttrs) as $key) |
|
306 | + { |
|
307 | + try |
|
308 | + { |
|
309 | + if ($key == "RELATIONS") |
|
310 | + break; |
|
311 | + $control = $this->{$key}; |
|
312 | + if ($control instanceof TTextBox) |
|
313 | + $arObj->{$key} = $control->Text; |
|
314 | + elseif ($control instanceof TCheckBox) |
|
315 | + $arObj->{$key} = $control->Checked; |
|
316 | + elseif ($control instanceof TDatePicker) |
|
317 | + $arObj->{$key} = $control->Date; |
|
318 | + } |
|
319 | + catch (Exception $ex) |
|
320 | + { |
|
321 | + if ($throwExceptions) |
|
322 | + throw $ex; |
|
323 | + } |
|
324 | + } |
|
325 | + } |
|
326 | 326 | } |
327 | 327 |
@@ -30,32 +30,32 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * template file extension. |
32 | 32 | */ |
33 | - const EXT_TEMPLATE='.tpl'; |
|
33 | + const EXT_TEMPLATE = '.tpl'; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @var ITemplate the parsed template structure shared by the same control class |
37 | 37 | */ |
38 | - private static $_template=array(); |
|
38 | + private static $_template = array(); |
|
39 | 39 | /** |
40 | 40 | * @var ITemplate the parsed template structure specific for this control instance |
41 | 41 | */ |
42 | - private $_localTemplate=null; |
|
42 | + private $_localTemplate = null; |
|
43 | 43 | /** |
44 | 44 | * @var TTemplateControl the master control if any |
45 | 45 | */ |
46 | - private $_master=null; |
|
46 | + private $_master = null; |
|
47 | 47 | /** |
48 | 48 | * @var string master control class name |
49 | 49 | */ |
50 | - private $_masterClass=''; |
|
50 | + private $_masterClass = ''; |
|
51 | 51 | /** |
52 | 52 | * @var array list of TContent controls |
53 | 53 | */ |
54 | - private $_contents=array(); |
|
54 | + private $_contents = array(); |
|
55 | 55 | /** |
56 | 56 | * @var array list of TContentPlaceHolder controls |
57 | 57 | */ |
58 | - private $_placeholders=array(); |
|
58 | + private $_placeholders = array(); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Returns the template object associated with this control object. |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getTemplate() |
65 | 65 | { |
66 | - if($this->_localTemplate===null) |
|
66 | + if ($this->_localTemplate === null) |
|
67 | 67 | { |
68 | - $class=get_class($this); |
|
69 | - if(!isset(self::$_template[$class])) |
|
70 | - self::$_template[$class]=$this->loadTemplate(); |
|
68 | + $class = get_class($this); |
|
69 | + if (!isset(self::$_template[$class])) |
|
70 | + self::$_template[$class] = $this->loadTemplate(); |
|
71 | 71 | return self::$_template[$class]; |
72 | 72 | } |
73 | 73 | else |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function setTemplate($value) |
84 | 84 | { |
85 | - $this->_localTemplate=$value; |
|
85 | + $this->_localTemplate = $value; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function getIsSourceTemplateControl() |
94 | 94 | { |
95 | - if(($template=$this->getTemplate())!==null) |
|
95 | + if (($template = $this->getTemplate()) !== null) |
|
96 | 96 | return $template->getIsSourceTemplate(); |
97 | 97 | else |
98 | 98 | return false; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function getTemplateDirectory() |
105 | 105 | { |
106 | - if(($template=$this->getTemplate())!==null) |
|
106 | + if (($template = $this->getTemplate()) !== null) |
|
107 | 107 | return $template->getContextPath(); |
108 | 108 | else |
109 | 109 | return ''; |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | */ |
116 | 116 | protected function loadTemplate() |
117 | 117 | { |
118 | - Prado::trace("Loading template ".get_class($this),'System.Web.UI.TTemplateControl'); |
|
119 | - $template=$this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this)); |
|
118 | + Prado::trace("Loading template " . get_class($this), 'System.Web.UI.TTemplateControl'); |
|
119 | + $template = $this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this)); |
|
120 | 120 | return $template; |
121 | 121 | } |
122 | 122 | |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function createChildControls() |
129 | 129 | { |
130 | - if($tpl=$this->getTemplate()) |
|
130 | + if ($tpl = $this->getTemplate()) |
|
131 | 131 | { |
132 | - foreach($tpl->getDirective() as $name=>$value) |
|
132 | + foreach ($tpl->getDirective() as $name=>$value) |
|
133 | 133 | { |
134 | - if(is_string($value)) |
|
135 | - $this->setSubProperty($name,$value); |
|
134 | + if (is_string($value)) |
|
135 | + $this->setSubProperty($name, $value); |
|
136 | 136 | else |
137 | - throw new TConfigurationException('templatecontrol_directive_invalid',get_class($this),$name); |
|
137 | + throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name); |
|
138 | 138 | } |
139 | 139 | $tpl->instantiateIn($this); |
140 | 140 | } |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | * @param string ID of the content |
146 | 146 | * @param TContent |
147 | 147 | */ |
148 | - public function registerContent($id,TContent $object) |
|
148 | + public function registerContent($id, TContent $object) |
|
149 | 149 | { |
150 | - if(isset($this->_contents[$id])) |
|
151 | - throw new TConfigurationException('templatecontrol_contentid_duplicated',$id); |
|
150 | + if (isset($this->_contents[$id])) |
|
151 | + throw new TConfigurationException('templatecontrol_contentid_duplicated', $id); |
|
152 | 152 | else |
153 | - $this->_contents[$id]=$object; |
|
153 | + $this->_contents[$id] = $object; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | * @param string placeholder ID |
160 | 160 | * @param TContentPlaceHolder placeholder control |
161 | 161 | */ |
162 | - public function registerContentPlaceHolder($id,TContentPlaceHolder $object) |
|
162 | + public function registerContentPlaceHolder($id, TContentPlaceHolder $object) |
|
163 | 163 | { |
164 | - if(isset($this->_placeholders[$id])) |
|
165 | - throw new TConfigurationException('templatecontrol_placeholderid_duplicated',$id); |
|
164 | + if (isset($this->_placeholders[$id])) |
|
165 | + throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id); |
|
166 | 166 | else |
167 | - $this->_placeholders[$id]=$object; |
|
167 | + $this->_placeholders[$id] = $object; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function setMasterClass($value) |
182 | 182 | { |
183 | - $this->_masterClass=$value; |
|
183 | + $this->_masterClass = $value; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | * @param string ID of the content control |
198 | 198 | * @param TContent the content to be injected |
199 | 199 | */ |
200 | - public function injectContent($id,$content) |
|
200 | + public function injectContent($id, $content) |
|
201 | 201 | { |
202 | - if(isset($this->_placeholders[$id])) |
|
202 | + if (isset($this->_placeholders[$id])) |
|
203 | 203 | { |
204 | - $placeholder=$this->_placeholders[$id]; |
|
205 | - $controls=$placeholder->getParent()->getControls(); |
|
206 | - $loc=$controls->remove($placeholder); |
|
207 | - $controls->insertAt($loc,$content); |
|
204 | + $placeholder = $this->_placeholders[$id]; |
|
205 | + $controls = $placeholder->getParent()->getControls(); |
|
206 | + $loc = $controls->remove($placeholder); |
|
207 | + $controls->insertAt($loc, $content); |
|
208 | 208 | } |
209 | 209 | else |
210 | - throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id); |
|
210 | + throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -218,23 +218,23 @@ discard block |
||
218 | 218 | * Only framework developers should use this method. |
219 | 219 | * @param TControl the naming container control |
220 | 220 | */ |
221 | - protected function initRecursive($namingContainer=null) |
|
221 | + protected function initRecursive($namingContainer = null) |
|
222 | 222 | { |
223 | 223 | $this->ensureChildControls(); |
224 | - if($this->_masterClass!=='') |
|
224 | + if ($this->_masterClass !== '') |
|
225 | 225 | { |
226 | - $master=Prado::createComponent($this->_masterClass); |
|
227 | - if(!($master instanceof TTemplateControl)) |
|
226 | + $master = Prado::createComponent($this->_masterClass); |
|
227 | + if (!($master instanceof TTemplateControl)) |
|
228 | 228 | throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid'); |
229 | - $this->_master=$master; |
|
229 | + $this->_master = $master; |
|
230 | 230 | $this->getControls()->clear(); |
231 | 231 | $this->getControls()->add($master); |
232 | 232 | $master->ensureChildControls(); |
233 | - foreach($this->_contents as $id=>$content) |
|
234 | - $master->injectContent($id,$content); |
|
233 | + foreach ($this->_contents as $id=>$content) |
|
234 | + $master->injectContent($id, $content); |
|
235 | 235 | } |
236 | - else if(!empty($this->_contents)) |
|
237 | - throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this)); |
|
236 | + else if (!empty($this->_contents)) |
|
237 | + throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); |
|
238 | 238 | parent::initRecursive($namingContainer); |
239 | 239 | } |
240 | 240 |
@@ -69,8 +69,7 @@ discard block |
||
69 | 69 | if(!isset(self::$_template[$class])) |
70 | 70 | self::$_template[$class]=$this->loadTemplate(); |
71 | 71 | return self::$_template[$class]; |
72 | - } |
|
73 | - else |
|
72 | + } else |
|
74 | 73 | return $this->_localTemplate; |
75 | 74 | } |
76 | 75 | |
@@ -205,8 +204,7 @@ discard block |
||
205 | 204 | $controls=$placeholder->getParent()->getControls(); |
206 | 205 | $loc=$controls->remove($placeholder); |
207 | 206 | $controls->insertAt($loc,$content); |
208 | - } |
|
209 | - else |
|
207 | + } else |
|
210 | 208 | throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id); |
211 | 209 | } |
212 | 210 | |
@@ -230,10 +228,10 @@ discard block |
||
230 | 228 | $this->getControls()->clear(); |
231 | 229 | $this->getControls()->add($master); |
232 | 230 | $master->ensureChildControls(); |
233 | - foreach($this->_contents as $id=>$content) |
|
234 | - $master->injectContent($id,$content); |
|
235 | - } |
|
236 | - else if(!empty($this->_contents)) |
|
231 | + foreach($this->_contents as $id=>$content) { |
|
232 | + $master->injectContent($id,$content); |
|
233 | + } |
|
234 | + } else if(!empty($this->_contents)) |
|
237 | 235 | throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this)); |
238 | 236 | parent::initRecursive($namingContainer); |
239 | 237 | } |
@@ -261,8 +259,7 @@ discard block |
||
261 | 259 | $control->Checked = (boolean) $arObj->{$key}; |
262 | 260 | elseif ($control instanceof TDatePicker) |
263 | 261 | $control->Date = $arObj->{$key}; |
264 | - } |
|
265 | - else |
|
262 | + } else |
|
266 | 263 | { |
267 | 264 | foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
268 | 265 | { |
@@ -284,8 +281,7 @@ discard block |
||
284 | 281 | } |
285 | 282 | break; |
286 | 283 | } |
287 | - } |
|
288 | - catch (Exception $ex) |
|
284 | + } catch (Exception $ex) |
|
289 | 285 | { |
290 | 286 | if ($throwExceptions) |
291 | 287 | throw $ex; |
@@ -315,8 +311,7 @@ discard block |
||
315 | 311 | $arObj->{$key} = $control->Checked; |
316 | 312 | elseif ($control instanceof TDatePicker) |
317 | 313 | $arObj->{$key} = $control->Date; |
318 | - } |
|
319 | - catch (Exception $ex) |
|
314 | + } catch (Exception $ex) |
|
320 | 315 | { |
321 | 316 | if ($throwExceptions) |
322 | 317 | throw $ex; |