@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getOptions() |
74 | 74 | { |
75 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
75 | + if(($options=$this->getViewState('JuiOptions'))===null) |
|
76 | 76 | { |
77 | 77 | $options=new TJuiControlOptions($this); |
78 | 78 | $this->setViewState('JuiOptions', $options); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | { |
115 | 115 | parent::addAttributesToRender($writer); |
116 | 116 | |
117 | - $writer->addAttribute('id',$this->getClientID()); |
|
117 | + $writer->addAttribute('id', $this->getClientID()); |
|
118 | 118 | $options=TJavascript::encode($this->getPostBackOptions()); |
119 | 119 | $cs=$this->getPage()->getClientScript(); |
120 | 120 | $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * Raises the OnCreate event |
136 | 136 | * @param object $params event parameters |
137 | 137 | */ |
138 | - public function onCreate ($params) |
|
138 | + public function onCreate($params) |
|
139 | 139 | { |
140 | 140 | $this->raiseEvent('OnCreate', $this, $params); |
141 | 141 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * Raises the OnDrag event |
145 | 145 | * @param object $params event parameters |
146 | 146 | */ |
147 | - public function onDrag ($params) |
|
147 | + public function onDrag($params) |
|
148 | 148 | { |
149 | 149 | $this->raiseEvent('OnDrag', $this, $params); |
150 | 150 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * Raises the OnStart event |
154 | 154 | * @param object $params event parameters |
155 | 155 | */ |
156 | - public function onStart ($params) |
|
156 | + public function onStart($params) |
|
157 | 157 | { |
158 | 158 | $this->raiseEvent('OnStart', $this, $params); |
159 | 159 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * Raises the OnStop event |
163 | 163 | * @param object $params event parameters |
164 | 164 | */ |
165 | - public function onStop ($params) |
|
165 | + public function onStop($params) |
|
166 | 166 | { |
167 | 167 | $this->raiseEvent('OnStop', $this, $params); |
168 | 168 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function getOptions() |
94 | 94 | { |
95 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
95 | + if(($options=$this->getViewState('JuiOptions'))===null) |
|
96 | 96 | { |
97 | 97 | $options=new TJuiControlOptions($this); |
98 | 98 | $this->setViewState('JuiOptions', $options); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | parent::addAttributesToRender($writer); |
136 | 136 | |
137 | - $writer->addAttribute('id',$this->getClientID()); |
|
137 | + $writer->addAttribute('id', $this->getClientID()); |
|
138 | 138 | $options=TJavascript::encode($this->getPostBackOptions()); |
139 | 139 | $cs=$this->getPage()->getClientScript(); |
140 | 140 | $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * Raises the OnActivate event |
156 | 156 | * @param object $params event parameters |
157 | 157 | */ |
158 | - public function onActivate ($params) |
|
158 | + public function onActivate($params) |
|
159 | 159 | { |
160 | 160 | $this->raiseEvent('OnActivate', $this, $params); |
161 | 161 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * Raises the OnCreate event |
165 | 165 | * @param object $params event parameters |
166 | 166 | */ |
167 | - public function onCreate ($params) |
|
167 | + public function onCreate($params) |
|
168 | 168 | { |
169 | 169 | $this->raiseEvent('OnCreate', $this, $params); |
170 | 170 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * Raises the OnDeactivate event |
174 | 174 | * @param object $params event parameters |
175 | 175 | */ |
176 | - public function onDeactivate ($params) |
|
176 | + public function onDeactivate($params) |
|
177 | 177 | { |
178 | 178 | $this->raiseEvent('OnDeactivate', $this, $params); |
179 | 179 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * Raises the OnDrop event |
183 | 183 | * @param object $params event parameters |
184 | 184 | */ |
185 | - public function onDrop ($params) |
|
185 | + public function onDrop($params) |
|
186 | 186 | { |
187 | 187 | $this->raiseEvent('OnDrop', $this, $params); |
188 | 188 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * Raises the OnOut event |
192 | 192 | * @param object $params event parameters |
193 | 193 | */ |
194 | - public function OnOut ($params) |
|
194 | + public function OnOut($params) |
|
195 | 195 | { |
196 | 196 | $this->raiseEvent('OnOut', $this, $params); |
197 | 197 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * Raises the OnOver event |
201 | 201 | * @param object $params event parameters |
202 | 202 | */ |
203 | - public function OnOver ($params) |
|
203 | + public function OnOver($params) |
|
204 | 204 | { |
205 | 205 | $this->raiseEvent('OnOver', $this, $params); |
206 | 206 | } |
@@ -68,7 +68,7 @@ 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 | 73 | $options=new TJuiControlOptions($this); |
74 | 74 | $this->setViewState('JuiOptions', $options); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | parent::addAttributesToRender($writer); |
112 | 112 | |
113 | - $writer->addAttribute('id',$this->getClientID()); |
|
113 | + $writer->addAttribute('id', $this->getClientID()); |
|
114 | 114 | $options=TJavascript::encode($this->getPostBackOptions()); |
115 | 115 | $cs=$this->getPage()->getClientScript(); |
116 | 116 | $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
@@ -226,8 +226,7 @@ discard block |
||
226 | 226 | $base = $dir; |
227 | 227 | } |
228 | 228 | return array($assets->getPublishedPath($base), $assets->publishFilePath($base)); |
229 | - } |
|
230 | - else |
|
229 | + } else |
|
231 | 230 | { |
232 | 231 | return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base); |
233 | 232 | } |
@@ -748,8 +747,7 @@ discard block |
||
748 | 747 | { |
749 | 748 | foreach($value as $v) |
750 | 749 | $str.='<input type="hidden" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
751 | - } |
|
752 | - else |
|
750 | + } else |
|
753 | 751 | { |
754 | 752 | $str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
755 | 753 | } |
@@ -13,7 +13,6 @@ |
||
13 | 13 | namespace Prado\Web\UI; |
14 | 14 | use Prado\Prado; |
15 | 15 | use Prado\TApplicationMode; |
16 | -use Prado\Exceptions\TInvalidDataValueException; |
|
17 | 16 | use Prado\Exceptions\TInvalidOperationException; |
18 | 17 | use Prado\Web\Javascripts\TJavaScript; |
19 | 18 | use Prado\Web\UI\ActiveControls\ICallbackEventHandler; |
@@ -154,6 +154,7 @@ discard block |
||
154 | 154 | * Registers Prado javascript by library name. See "Web/Javascripts/packages.php" |
155 | 155 | * for library names. |
156 | 156 | * @param string script library name. |
157 | + * @param string $name |
|
157 | 158 | */ |
158 | 159 | public function registerPradoScript($name) |
159 | 160 | { |
@@ -256,7 +257,7 @@ discard block |
||
256 | 257 | |
257 | 258 | /** |
258 | 259 | * @param string javascript or css package path. |
259 | - * @return array tuple($path,$url). |
|
260 | + * @return string[] tuple($path,$url). |
|
260 | 261 | */ |
261 | 262 | protected function getPackagePathUrl($base) |
262 | 263 | { |
@@ -341,6 +342,7 @@ discard block |
||
341 | 342 | * the javascript code registration. |
342 | 343 | * @param string javascript class responsible for the control being registered for postback |
343 | 344 | * @param array postback options |
345 | + * @param string $class |
|
344 | 346 | */ |
345 | 347 | public function registerPostBackControl($class,$options) |
346 | 348 | { |
@@ -420,6 +422,7 @@ discard block |
||
420 | 422 | * Registers Prado style by library name. See "Web/Javascripts/packages.php" |
421 | 423 | * for library names. |
422 | 424 | * @param string style library name. |
425 | + * @param string $name |
|
423 | 426 | */ |
424 | 427 | public function registerPradoStyle($name) |
425 | 428 | { |
@@ -602,6 +605,7 @@ discard block |
||
602 | 605 | * Registers a javascript script block at the beginning of the form |
603 | 606 | * @param string a unique key identifying the script block |
604 | 607 | * @param string javascript block |
608 | + * @param string $key |
|
605 | 609 | */ |
606 | 610 | public function registerBeginScript($key,$script) |
607 | 611 | { |
@@ -630,6 +634,7 @@ discard block |
||
630 | 634 | * @param string a unique key identifying the hidden field |
631 | 635 | * @param string|array hidden field value, if the value is an array, every element |
632 | 636 | * in the array will be rendered as a hidden field value. |
637 | + * @param string $name |
|
633 | 638 | */ |
634 | 639 | public function registerHiddenField($name,$value) |
635 | 640 | { |
@@ -641,6 +646,7 @@ discard block |
||
641 | 646 | |
642 | 647 | /** |
643 | 648 | * @param string a unique key |
649 | + * @param string $key |
|
644 | 650 | * @return boolean whether there is a CSS file registered with the specified key |
645 | 651 | */ |
646 | 652 | public function isStyleSheetFileRegistered($key) |
@@ -677,6 +683,7 @@ discard block |
||
677 | 683 | |
678 | 684 | /** |
679 | 685 | * @param string a unique key |
686 | + * @param string $key |
|
680 | 687 | * @return boolean whether there is a javascript file registered with the specified key |
681 | 688 | */ |
682 | 689 | public function isScriptFileRegistered($key) |
@@ -857,6 +864,7 @@ discard block |
||
857 | 864 | * Flushes all pending script registrations |
858 | 865 | * @param THtmlWriter writer for the rendering purpose |
859 | 866 | * @param TControl the control forcing the flush (used only in error messages) |
867 | + * @param WebControls\TClientScript $control |
|
860 | 868 | */ |
861 | 869 | public function flushScriptFiles($writer, $control=null) |
862 | 870 | { |
@@ -869,6 +877,7 @@ discard block |
||
869 | 877 | |
870 | 878 | /** |
871 | 879 | * @param THtmlWriter writer for the rendering purpose |
880 | + * @param boolean $initial |
|
872 | 881 | */ |
873 | 882 | protected function renderHiddenFieldsInt($writer, $initial) |
874 | 883 | { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | $this->registerPradoScriptInternal($name); |
161 | 161 | $params=func_get_args(); |
162 | - $this->_page->registerCachingAction('Page.ClientScript','registerPradoScript',$params); |
|
162 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerPradoScript', $params); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -170,43 +170,43 @@ discard block |
||
170 | 170 | // $this->checkIfNotInRender(); |
171 | 171 | if(!isset($this->_registeredScripts[$name])) |
172 | 172 | { |
173 | - if(self::$_scripts === null) |
|
173 | + if(self::$_scripts===null) |
|
174 | 174 | { |
175 | - $packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::PACKAGES_FILE; |
|
176 | - list($folders, $packages, $deps)= include($packageFile); |
|
177 | - self::$_scriptsFolders = $folders; |
|
178 | - self::$_scripts = $deps; |
|
179 | - self::$_scriptsPackages = $packages; |
|
175 | + $packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::PACKAGES_FILE; |
|
176 | + list($folders, $packages, $deps)=include($packageFile); |
|
177 | + self::$_scriptsFolders=$folders; |
|
178 | + self::$_scripts=$deps; |
|
179 | + self::$_scriptsPackages=$packages; |
|
180 | 180 | } |
181 | 181 | |
182 | - if (isset(self::$_scripts[$name])) |
|
182 | + if(isset(self::$_scripts[$name])) |
|
183 | 183 | $this->_registeredScripts[$name]=true; |
184 | 184 | else |
185 | - throw new TInvalidOperationException('csmanager_pradoscript_invalid',$name); |
|
185 | + throw new TInvalidOperationException('csmanager_pradoscript_invalid', $name); |
|
186 | 186 | |
187 | 187 | if(($packages=array_keys($this->_registeredScripts))!==array()) |
188 | 188 | { |
189 | 189 | $packagesUrl=array(); |
190 | 190 | $isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug; |
191 | - foreach ($packages as $p) |
|
191 | + foreach($packages as $p) |
|
192 | 192 | { |
193 | - foreach (self::$_scripts[$p] as $dep) |
|
193 | + foreach(self::$_scripts[$p] as $dep) |
|
194 | 194 | { |
195 | - foreach (self::$_scriptsPackages[$dep] as $script) |
|
195 | + foreach(self::$_scriptsPackages[$dep] as $script) |
|
196 | 196 | { |
197 | - if (!isset($this->_expandedScripts[$script])) |
|
197 | + if(!isset($this->_expandedScripts[$script])) |
|
198 | 198 | { |
199 | - list($base, $subPath) = $this->getScriptPackageFolder($script); |
|
200 | - list($path, $baseUrl) = $this->getPackagePathUrl($base); |
|
199 | + list($base, $subPath)=$this->getScriptPackageFolder($script); |
|
200 | + list($path, $baseUrl)=$this->getPackagePathUrl($base); |
|
201 | 201 | |
202 | - $this->_expandedScripts[$script] = true; |
|
202 | + $this->_expandedScripts[$script]=true; |
|
203 | 203 | if($isDebug) |
204 | 204 | { |
205 | - if (!in_array($url=$baseUrl.'/'.$subPath, $packagesUrl)) |
|
205 | + if(!in_array($url=$baseUrl.'/'.$subPath, $packagesUrl)) |
|
206 | 206 | $packagesUrl[]=$url; |
207 | 207 | } else { |
208 | 208 | $minPath=preg_replace('/^(.*)(?<!\.min)\.js$/', "\\1.min.js", $subPath); |
209 | - if (!in_array($url=$baseUrl.'/'.$minPath, $packagesUrl)) |
|
209 | + if(!in_array($url=$baseUrl.'/'.$minPath, $packagesUrl)) |
|
210 | 210 | { |
211 | 211 | if(!is_file($filePath=$path.DIRECTORY_SEPARATOR.$minPath)) |
212 | 212 | { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | } |
222 | 222 | } |
223 | 223 | foreach($packagesUrl as $url) |
224 | - $this->registerScriptFile($url,$url); |
|
224 | + $this->registerScriptFile($url, $url); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | } |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | if(!isset(self::$_scriptsFolders[$script])) |
235 | 235 | $this->registerPradoScriptInternal($script); |
236 | 236 | |
237 | - $base = Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]); |
|
238 | - $assets = Prado::getApplication()->getAssetManager(); |
|
237 | + $base=Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]); |
|
238 | + $assets=Prado::getApplication()->getAssetManager(); |
|
239 | 239 | return $assets->getPublishedUrl($base); |
240 | 240 | } |
241 | 241 | |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | if(!isset(self::$_scriptsFolders[$script])) |
248 | 248 | $this->registerPradoScriptInternal($script); |
249 | 249 | |
250 | - $base = Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]); |
|
251 | - $assets = Prado::getApplication()->getAssetManager(); |
|
250 | + $base=Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]); |
|
251 | + $assets=Prado::getApplication()->getAssetManager(); |
|
252 | 252 | return $assets->getPublishedPath($base); |
253 | 253 | } |
254 | 254 | |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function getScriptUrls() |
260 | 260 | { |
261 | - $scripts = array_values($this->_headScriptFiles); |
|
262 | - $scripts = array_merge($scripts, array_values($this->_scriptFiles)); |
|
263 | - $scripts = array_unique($scripts); |
|
261 | + $scripts=array_values($this->_headScriptFiles); |
|
262 | + $scripts=array_merge($scripts, array_values($this->_scriptFiles)); |
|
263 | + $scripts=array_unique($scripts); |
|
264 | 264 | |
265 | 265 | return $scripts; |
266 | 266 | } |
@@ -271,14 +271,14 @@ discard block |
||
271 | 271 | */ |
272 | 272 | protected function getPackagePathUrl($base) |
273 | 273 | { |
274 | - $assets = Prado::getApplication()->getAssetManager(); |
|
274 | + $assets=Prado::getApplication()->getAssetManager(); |
|
275 | 275 | if(strpos($base, $assets->getBaseUrl())===false) |
276 | 276 | { |
277 | 277 | return array($assets->getPublishedPath($base), $assets->publishFilePath($base)); |
278 | 278 | } |
279 | 279 | else |
280 | 280 | { |
281 | - return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base); |
|
281 | + return array($assets->getBasePath().str_replace($assets->getBaseUrl(), '', $base), $base); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | */ |
289 | 289 | protected function getScriptPackageFolder($script) |
290 | 290 | { |
291 | - list($base, $subPath) = explode("/", $script, 2); |
|
291 | + list($base, $subPath)=explode("/", $script, 2); |
|
292 | 292 | |
293 | 293 | if(!array_key_exists($base, self::$_scriptsFolders)) |
294 | - throw new TInvalidOperationException('csmanager_pradostyle_invalid',$base); |
|
294 | + throw new TInvalidOperationException('csmanager_pradostyle_invalid', $base); |
|
295 | 295 | |
296 | - $namespace = self::$_scriptsFolders[$base]; |
|
297 | - if(($dir = Prado::getPathOfNameSpace($namespace)) !== null) { |
|
298 | - $namespace = $dir; |
|
296 | + $namespace=self::$_scriptsFolders[$base]; |
|
297 | + if(($dir=Prado::getPathOfNameSpace($namespace))!==null) { |
|
298 | + $namespace=$dir; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | return array($namespace, $subPath); |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | */ |
308 | 308 | protected function getStylePackageFolder($script) |
309 | 309 | { |
310 | - list($base, $subPath) = explode("/", $script, 2); |
|
310 | + list($base, $subPath)=explode("/", $script, 2); |
|
311 | 311 | |
312 | 312 | if(!array_key_exists($base, self::$_stylesFolders)) |
313 | - throw new TInvalidOperationException('csmanager_pradostyle_invalid',$base); |
|
313 | + throw new TInvalidOperationException('csmanager_pradostyle_invalid', $base); |
|
314 | 314 | |
315 | 315 | return array(self::$_stylesFolders[$base], $subPath); |
316 | 316 | } |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public function getCallbackReference(ICallbackEventHandler $callbackHandler, $options=null) |
325 | 325 | { |
326 | - $options = !is_array($options) ? array() : $options; |
|
327 | - $class = new \ReflectionClass($callbackHandler); |
|
328 | - $clientSide = $callbackHandler->getActiveControl()->getClientSide(); |
|
329 | - $options = array_merge($options, $clientSide->getOptions()->toArray()); |
|
330 | - $optionString = TJavaScript::encode($options); |
|
326 | + $options=!is_array($options) ? array() : $options; |
|
327 | + $class=new \ReflectionClass($callbackHandler); |
|
328 | + $clientSide=$callbackHandler->getActiveControl()->getClientSide(); |
|
329 | + $options=array_merge($options, $clientSide->getOptions()->toArray()); |
|
330 | + $optionString=TJavaScript::encode($options); |
|
331 | 331 | $this->registerPradoScriptInternal('ajax'); |
332 | - $id = $callbackHandler->getUniqueID(); |
|
332 | + $id=$callbackHandler->getUniqueID(); |
|
333 | 333 | return "new Prado.CallbackRequest('{$id}',{$optionString})"; |
334 | 334 | } |
335 | 335 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $this->registerPradoScriptInternal('ajax'); |
347 | 347 | |
348 | 348 | $params=func_get_args(); |
349 | - $this->_page->registerCachingAction('Page.ClientScript','registerCallbackControl',$params); |
|
349 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerCallbackControl', $params); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | * @param string javascript class responsible for the control being registered for postback |
356 | 356 | * @param array postback options |
357 | 357 | */ |
358 | - public function registerPostBackControl($class,$options) |
|
358 | + public function registerPostBackControl($class, $options) |
|
359 | 359 | { |
360 | - if($class === null) { |
|
360 | + if($class===null) { |
|
361 | 361 | return; |
362 | 362 | } |
363 | 363 | if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null) |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $this->registerPradoScriptInternal('prado'); |
370 | 370 | |
371 | 371 | $params=func_get_args(); |
372 | - $this->_page->registerCachingAction('Page.ClientScript','registerPostBackControl',$params); |
|
372 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerPostBackControl', $params); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | /** |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | public function registerDefaultButton($panel, $button) |
382 | 382 | { |
383 | - $panelID=is_string($panel)?$panel:$panel->getUniqueID(); |
|
383 | + $panelID=is_string($panel) ? $panel : $panel->getUniqueID(); |
|
384 | 384 | |
385 | 385 | if(is_string($button)) |
386 | 386 | $buttonID=$button; |
@@ -389,14 +389,14 @@ discard block |
||
389 | 389 | $button->setIsDefaultButton(true); |
390 | 390 | $buttonID=$button->getUniqueID(); |
391 | 391 | } |
392 | - $options = TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID)); |
|
393 | - $code = "new Prado.WebUI.DefaultButton($options);"; |
|
392 | + $options=TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID)); |
|
393 | + $code="new Prado.WebUI.DefaultButton($options);"; |
|
394 | 394 | |
395 | 395 | $this->_endScripts['prado:'.$panelID]=$code; |
396 | 396 | $this->registerPradoScriptInternal('prado'); |
397 | 397 | |
398 | - $params=array($panelID,$buttonID); |
|
399 | - $this->_page->registerCachingAction('Page.ClientScript','registerDefaultButton',$params); |
|
398 | + $params=array($panelID, $buttonID); |
|
399 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerDefaultButton', $params); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | */ |
407 | 407 | protected function getDefaultButtonOptions($panelID, $buttonID) |
408 | 408 | { |
409 | - $options['ID'] = TControl::convertUniqueIdToClientId($panelID); |
|
410 | - $options['Panel'] = TControl::convertUniqueIdToClientId($panelID); |
|
411 | - $options['Target'] = TControl::convertUniqueIdToClientId($buttonID); |
|
412 | - $options['EventTarget'] = $buttonID; |
|
413 | - $options['Event'] = 'click'; |
|
409 | + $options['ID']=TControl::convertUniqueIdToClientId($panelID); |
|
410 | + $options['Panel']=TControl::convertUniqueIdToClientId($panelID); |
|
411 | + $options['Target']=TControl::convertUniqueIdToClientId($buttonID); |
|
412 | + $options['EventTarget']=$buttonID; |
|
413 | + $options['Event']='click'; |
|
414 | 414 | return $options; |
415 | 415 | } |
416 | 416 | |
@@ -423,10 +423,10 @@ discard block |
||
423 | 423 | $this->registerPradoScriptInternal('jquery'); |
424 | 424 | if($target instanceof TControl) |
425 | 425 | $target=$target->getClientID(); |
426 | - $this->_endScripts['prado:focus'] = 'jQuery(\'#'.$target.'\').focus();'; |
|
426 | + $this->_endScripts['prado:focus']='jQuery(\'#'.$target.'\').focus();'; |
|
427 | 427 | |
428 | 428 | $params=func_get_args(); |
429 | - $this->_page->registerCachingAction('Page.ClientScript','registerFocusControl',$params); |
|
429 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerFocusControl', $params); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | /** |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | { |
439 | 439 | $this->registerPradoStyleInternal($name); |
440 | 440 | $params=func_get_args(); |
441 | - $this->_page->registerCachingAction('Page.ClientScript','registerPradoStyle',$params); |
|
441 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerPradoStyle', $params); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -449,45 +449,45 @@ discard block |
||
449 | 449 | // $this->checkIfNotInRender(); |
450 | 450 | if(!isset($this->_registeredStyles[$name])) |
451 | 451 | { |
452 | - if(self::$_styles === null) |
|
452 | + if(self::$_styles===null) |
|
453 | 453 | { |
454 | - $packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE; |
|
455 | - list($folders, $packages,$deps)= include($packageFile); |
|
456 | - self::$_stylesFolders = $folders; |
|
457 | - self::$_styles = $deps; |
|
458 | - self::$_stylesPackages = $packages; |
|
454 | + $packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE; |
|
455 | + list($folders, $packages, $deps)=include($packageFile); |
|
456 | + self::$_stylesFolders=$folders; |
|
457 | + self::$_styles=$deps; |
|
458 | + self::$_stylesPackages=$packages; |
|
459 | 459 | } |
460 | 460 | |
461 | - if (isset(self::$_styles[$name])) |
|
461 | + if(isset(self::$_styles[$name])) |
|
462 | 462 | $this->_registeredStyles[$name]=true; |
463 | 463 | else |
464 | - throw new TInvalidOperationException('csmanager_pradostyle_invalid',$name); |
|
464 | + throw new TInvalidOperationException('csmanager_pradostyle_invalid', $name); |
|
465 | 465 | |
466 | 466 | if(($packages=array_keys($this->_registeredStyles))!==array()) |
467 | 467 | { |
468 | 468 | $packagesUrl=array(); |
469 | 469 | $isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug; |
470 | - foreach ($packages as $p) |
|
470 | + foreach($packages as $p) |
|
471 | 471 | { |
472 | - foreach (self::$_styles[$p] as $dep) |
|
472 | + foreach(self::$_styles[$p] as $dep) |
|
473 | 473 | { |
474 | - foreach (self::$_stylesPackages[$dep] as $style) |
|
474 | + foreach(self::$_stylesPackages[$dep] as $style) |
|
475 | 475 | { |
476 | - if (!isset($this->_expandedStyles[$style])) |
|
476 | + if(!isset($this->_expandedStyles[$style])) |
|
477 | 477 | { |
478 | - list($base, $subPath) = $this->getStylePackageFolder($style); |
|
479 | - list($path, $baseUrl) = $this->getPackagePathUrl($base); |
|
478 | + list($base, $subPath)=$this->getStylePackageFolder($style); |
|
479 | + list($path, $baseUrl)=$this->getPackagePathUrl($base); |
|
480 | 480 | |
481 | - $this->_expandedStyles[$style] = true; |
|
481 | + $this->_expandedStyles[$style]=true; |
|
482 | 482 | // TODO minify css? |
483 | - if (!in_array($url=$baseUrl.'/'.$subPath, $packagesUrl)) |
|
483 | + if(!in_array($url=$baseUrl.'/'.$subPath, $packagesUrl)) |
|
484 | 484 | $packagesUrl[]=$url; |
485 | 485 | } |
486 | 486 | } |
487 | 487 | } |
488 | 488 | } |
489 | 489 | foreach($packagesUrl as $url) |
490 | - $this->registerStyleSheetFile($url,$url); |
|
490 | + $this->registerStyleSheetFile($url, $url); |
|
491 | 491 | } |
492 | 492 | } |
493 | 493 | } |
@@ -514,15 +514,15 @@ discard block |
||
514 | 514 | * @param string URL to the CSS file |
515 | 515 | * @param string media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types. |
516 | 516 | */ |
517 | - public function registerStyleSheetFile($key,$url,$media='') |
|
517 | + public function registerStyleSheetFile($key, $url, $media='') |
|
518 | 518 | { |
519 | 519 | if($media==='') |
520 | 520 | $this->_styleSheetFiles[$key]=$url; |
521 | 521 | else |
522 | - $this->_styleSheetFiles[$key]=array($url,$media); |
|
522 | + $this->_styleSheetFiles[$key]=array($url, $media); |
|
523 | 523 | |
524 | 524 | $params=func_get_args(); |
525 | - $this->_page->registerCachingAction('Page.ClientScript','registerStyleSheetFile',$params); |
|
525 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheetFile', $params); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
@@ -530,12 +530,12 @@ discard block |
||
530 | 530 | * @param string a unique key identifying the CSS block |
531 | 531 | * @param string CSS block |
532 | 532 | */ |
533 | - public function registerStyleSheet($key,$css,$media='') |
|
533 | + public function registerStyleSheet($key, $css, $media='') |
|
534 | 534 | { |
535 | 535 | $this->_styleSheets[$key]=$css; |
536 | 536 | |
537 | 537 | $params=func_get_args(); |
538 | - $this->_page->registerCachingAction('Page.ClientScript','registerStyleSheet',$params); |
|
538 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheet', $params); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | /** |
@@ -544,17 +544,17 @@ discard block |
||
544 | 544 | */ |
545 | 545 | public function getStyleSheetUrls() |
546 | 546 | { |
547 | - $stylesheets = array_values( |
|
547 | + $stylesheets=array_values( |
|
548 | 548 | array_map(function($e) { |
549 | 549 | return is_array($e) ? $e[0] : $e; |
550 | 550 | }, $this->_styleSheetFiles) |
551 | 551 | ); |
552 | 552 | |
553 | 553 | foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) |
554 | - if (substr($url,strlen($url)-4)=='.css') |
|
555 | - $stylesheets[] = $url; |
|
554 | + if(substr($url, strlen($url) - 4)=='.css') |
|
555 | + $stylesheets[]=$url; |
|
556 | 556 | |
557 | - $stylesheets = array_unique($stylesheets); |
|
557 | + $stylesheets=array_unique($stylesheets); |
|
558 | 558 | |
559 | 559 | return $stylesheets; |
560 | 560 | } |
@@ -573,13 +573,13 @@ discard block |
||
573 | 573 | * @param string a unique key identifying the file |
574 | 574 | * @param string URL to the javascript file |
575 | 575 | */ |
576 | - public function registerHeadScriptFile($key,$url) |
|
576 | + public function registerHeadScriptFile($key, $url) |
|
577 | 577 | { |
578 | 578 | $this->checkIfNotInRender(); |
579 | 579 | $this->_headScriptFiles[$key]=$url; |
580 | 580 | |
581 | 581 | $params=func_get_args(); |
582 | - $this->_page->registerCachingAction('Page.ClientScript','registerHeadScriptFile',$params); |
|
582 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScriptFile', $params); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | /** |
@@ -587,13 +587,13 @@ discard block |
||
587 | 587 | * @param string a unique key identifying the script block |
588 | 588 | * @param string javascript block |
589 | 589 | */ |
590 | - public function registerHeadScript($key,$script) |
|
590 | + public function registerHeadScript($key, $script) |
|
591 | 591 | { |
592 | 592 | $this->checkIfNotInRender(); |
593 | 593 | $this->_headScripts[$key]=$script; |
594 | 594 | |
595 | 595 | $params=func_get_args(); |
596 | - $this->_page->registerCachingAction('Page.ClientScript','registerHeadScript',$params); |
|
596 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScript', $params); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | $this->_scriptFiles[$key]=$url; |
607 | 607 | |
608 | 608 | $params=func_get_args(); |
609 | - $this->_page->registerCachingAction('Page.ClientScript','registerScriptFile',$params); |
|
609 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerScriptFile', $params); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | /** |
@@ -614,13 +614,13 @@ discard block |
||
614 | 614 | * @param string a unique key identifying the script block |
615 | 615 | * @param string javascript block |
616 | 616 | */ |
617 | - public function registerBeginScript($key,$script) |
|
617 | + public function registerBeginScript($key, $script) |
|
618 | 618 | { |
619 | 619 | $this->checkIfNotInRender(); |
620 | 620 | $this->_beginScripts[$key]=$script; |
621 | 621 | |
622 | 622 | $params=func_get_args(); |
623 | - $this->_page->registerCachingAction('Page.ClientScript','registerBeginScript',$params); |
|
623 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerBeginScript', $params); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | /** |
@@ -628,12 +628,12 @@ discard block |
||
628 | 628 | * @param string a unique key identifying the script block |
629 | 629 | * @param string javascript block |
630 | 630 | */ |
631 | - public function registerEndScript($key,$script) |
|
631 | + public function registerEndScript($key, $script) |
|
632 | 632 | { |
633 | 633 | $this->_endScripts[$key]=$script; |
634 | 634 | |
635 | 635 | $params=func_get_args(); |
636 | - $this->_page->registerCachingAction('Page.ClientScript','registerEndScript',$params); |
|
636 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerEndScript', $params); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | /** |
@@ -642,12 +642,12 @@ discard block |
||
642 | 642 | * @param string|array hidden field value, if the value is an array, every element |
643 | 643 | * in the array will be rendered as a hidden field value. |
644 | 644 | */ |
645 | - public function registerHiddenField($name,$value) |
|
645 | + public function registerHiddenField($name, $value) |
|
646 | 646 | { |
647 | 647 | $this->_hiddenFields[$name]=$value; |
648 | 648 | |
649 | 649 | $params=func_get_args(); |
650 | - $this->_page->registerCachingAction('Page.ClientScript','registerHiddenField',$params); |
|
650 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerHiddenField', $params); |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | /** |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | public function renderStyleSheets($writer) |
761 | 761 | { |
762 | 762 | if(count($this->_styleSheets)) |
763 | - $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n",$this->_styleSheets)."\n/*]]>*/\n</style>\n"); |
|
763 | + $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n", $this->_styleSheets)."\n/*]]>*/\n</style>\n"); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | */ |
769 | 769 | public function renderHeadScriptFiles($writer) |
770 | 770 | { |
771 | - $this->renderScriptFiles($writer,$this->_headScriptFiles); |
|
771 | + $this->renderScriptFiles($writer, $this->_headScriptFiles); |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | /** |
@@ -791,9 +791,9 @@ discard block |
||
791 | 791 | |
792 | 792 | public function markScriptFileAsRendered($url) |
793 | 793 | { |
794 | - $this->_renderedScriptFiles[$url] = $url; |
|
794 | + $this->_renderedScriptFiles[$url]=$url; |
|
795 | 795 | $params=func_get_args(); |
796 | - $this->_page->registerCachingAction('Page.ClientScript','markScriptFileAsRendered',$params); |
|
796 | + $this->_page->registerCachingAction('Page.ClientScript', 'markScriptFileAsRendered', $params); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | protected function renderScriptFiles($writer, Array $scripts) |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | { |
818 | 818 | if(!empty($this->_scriptFiles)) |
819 | 819 | { |
820 | - $addedScripts = array_diff($this->_scriptFiles,$this->getRenderedScriptFiles()); |
|
821 | - $this->renderScriptFiles($writer,$addedScripts); |
|
820 | + $addedScripts=array_diff($this->_scriptFiles, $this->getRenderedScriptFiles()); |
|
821 | + $this->renderScriptFiles($writer, $addedScripts); |
|
822 | 822 | } |
823 | 823 | } |
824 | 824 | |
@@ -856,12 +856,12 @@ discard block |
||
856 | 856 | |
857 | 857 | public function renderHiddenFieldsBegin($writer) |
858 | 858 | { |
859 | - $this->renderHiddenFieldsInt($writer,true); |
|
859 | + $this->renderHiddenFieldsInt($writer, true); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | public function renderHiddenFieldsEnd($writer) |
863 | 863 | { |
864 | - $this->renderHiddenFieldsInt($writer,false); |
|
864 | + $this->renderHiddenFieldsInt($writer, false); |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | /** |
@@ -883,12 +883,12 @@ discard block |
||
883 | 883 | */ |
884 | 884 | protected function renderHiddenFieldsInt($writer, $initial) |
885 | 885 | { |
886 | - if ($initial) $this->_renderedHiddenFields = array(); |
|
886 | + if($initial) $this->_renderedHiddenFields=array(); |
|
887 | 887 | $str=''; |
888 | 888 | foreach($this->_hiddenFields as $name=>$value) |
889 | 889 | { |
890 | - if (in_array($name,$this->_renderedHiddenFields)) continue; |
|
891 | - $id=strtr($name,':','_'); |
|
890 | + if(in_array($name, $this->_renderedHiddenFields)) continue; |
|
891 | + $id=strtr($name, ':', '_'); |
|
892 | 892 | if(is_array($value)) |
893 | 893 | { |
894 | 894 | foreach($value as $v) |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | { |
899 | 899 | $str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
900 | 900 | } |
901 | - $this->_renderedHiddenFields[] = $name; |
|
901 | + $this->_renderedHiddenFields[]=$name; |
|
902 | 902 | } |
903 | 903 | if($str!=='') |
904 | 904 | $writer->write("<div style=\"visibility:hidden;\">\n".$str."</div>\n"); |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | */ |
915 | 915 | protected function checkIfNotInRender() |
916 | 916 | { |
917 | - if ($form = $this->_page->InFormRender) |
|
917 | + if($form=$this->_page->InFormRender) |
|
918 | 918 | throw new \Exception('Operation invalid when page is already rendering'); |
919 | 919 | } |
920 | 920 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function save($state) |
52 | 52 | { |
53 | - $this->_page->setClientState(TPageStateFormatter::serialize($this->_page,$state)); |
|
53 | + $this->_page->setClientState(TPageStateFormatter::serialize($this->_page, $state)); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function load() |
62 | 62 | { |
63 | - if(($data=TPageStateFormatter::unserialize($this->_page,$this->_page->getRequestClientState()))!==null) |
|
63 | + if(($data=TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState()))!==null) |
|
64 | 64 | return $data; |
65 | 65 | else |
66 | - throw new THttpException(400,'pagestatepersister_pagestate_corrupted'); |
|
66 | + throw new THttpException(400, 'pagestatepersister_pagestate_corrupted'); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class THttpUtility |
20 | 20 | { |
21 | - private static $_encodeTable=array('<'=>'<','>'=>'>','"'=>'"'); |
|
22 | - private static $_decodeTable=array('<'=>'<','>'=>'>','"'=>'"'); |
|
23 | - private static $_stripTable=array('<'=>'','>'=>'','"'=>''); |
|
21 | + private static $_encodeTable=array('<'=>'<', '>'=>'>', '"'=>'"'); |
|
22 | + private static $_decodeTable=array('<'=>'<', '>'=>'>', '"'=>'"'); |
|
23 | + private static $_stripTable=array('<'=>'', '>'=>'', '"'=>''); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * HTML-encodes a string. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public static function htmlEncode($s) |
34 | 34 | { |
35 | - return strtr($s,self::$_encodeTable); |
|
35 | + return strtr($s, self::$_encodeTable); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function htmlDecode($s) |
45 | 45 | { |
46 | - return strtr($s,self::$_decodeTable); |
|
46 | + return strtr($s, self::$_decodeTable); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public static function htmlStrip($s) |
56 | 56 | { |
57 | - return strtr($s,self::$_stripTable); |
|
57 | + return strtr($s, self::$_stripTable); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | */ |
26 | 26 | class TDateTimeStamp |
27 | 27 | { |
28 | - protected static $_month_normal = array("",31,28,31,30,31,30,31,31,30,31,30,31); |
|
29 | - protected static $_month_leaf = array("",31,29,31,30,31,30,31,31,30,31,30,31); |
|
28 | + protected static $_month_normal=array("", 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
29 | + protected static $_month_leaf=array("", 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Returns the day of the week (0=Sunday, 1=Monday, .. 6=Saturday) |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function getDayofWeek($year, $month, $day) |
38 | 38 | { |
39 | - $dt = new DateTime(); |
|
39 | + $dt=new DateTime(); |
|
40 | 40 | $dt->setDate($year, $month, $day); |
41 | 41 | return (int) $dt->format('w'); |
42 | 42 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function isLeapYear($year) |
51 | 51 | { |
52 | - $year = $this->digitCheck($year); |
|
53 | - $dt = new DateTime(); |
|
52 | + $year=$this->digitCheck($year); |
|
53 | + $dt=new DateTime(); |
|
54 | 54 | $dt->setDate($year, 1, 1); |
55 | 55 | return (bool) $dt->format('L'); |
56 | 56 | } |
@@ -62,22 +62,22 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function digitCheck($y) |
64 | 64 | { |
65 | - if ($y < 100){ |
|
66 | - $yr = (integer) date("Y"); |
|
67 | - $century = (integer) ($yr /100); |
|
65 | + if($y < 100) { |
|
66 | + $yr=(integer) date("Y"); |
|
67 | + $century=(integer) ($yr / 100); |
|
68 | 68 | |
69 | - if ($yr%100 > 50) { |
|
70 | - $c1 = $century + 1; |
|
71 | - $c0 = $century; |
|
69 | + if($yr % 100 > 50) { |
|
70 | + $c1=$century + 1; |
|
71 | + $c0=$century; |
|
72 | 72 | } else { |
73 | - $c1 = $century; |
|
74 | - $c0 = $century - 1; |
|
73 | + $c1=$century; |
|
74 | + $c0=$century - 1; |
|
75 | 75 | } |
76 | - $c1 *= 100; |
|
76 | + $c1*=100; |
|
77 | 77 | // if 2-digit year is less than 30 years in future, set it to this century |
78 | 78 | // otherwise if more than 30 years in future, then we set 2-digit year to the prev century. |
79 | - if (($y + $c1) < $yr+30) $y = $y + $c1; |
|
80 | - else $y = $y + $c0*100; |
|
79 | + if(($y + $c1) < $yr + 30) $y=$y + $c1; |
|
80 | + else $y=$y + $c0 * 100; |
|
81 | 81 | } |
82 | 82 | return $y; |
83 | 83 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function getGMTDiff($ts=false) |
94 | 94 | { |
95 | - $dt = new DateTime(); |
|
95 | + $dt=new DateTime(); |
|
96 | 96 | if($ts) |
97 | 97 | $dt->setTimeStamp($ts); |
98 | 98 | else |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | */ |
107 | 107 | function parseDate($txt=false) |
108 | 108 | { |
109 | - if ($txt === false) return getdate(); |
|
109 | + if($txt===false) return getdate(); |
|
110 | 110 | |
111 | - $dt = new DateTime($txt); |
|
111 | + $dt=new DateTime($txt); |
|
112 | 112 | |
113 | 113 | return array( |
114 | 114 | 'seconds' => (int) $dt->format('s'), |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @return array an array with date info. |
130 | 130 | */ |
131 | - function getDate($d=false,$fast=false) |
|
131 | + function getDate($d=false, $fast=false) |
|
132 | 132 | { |
133 | - if ($d === false) return getdate(); |
|
133 | + if($d===false) return getdate(); |
|
134 | 134 | |
135 | - $dt = new DateTime(); |
|
135 | + $dt=new DateTime(); |
|
136 | 136 | $dt->setTimestamp($d); |
137 | 137 | |
138 | 138 | return array( |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * @return boolean true if valid date, semantic check only. |
155 | 155 | */ |
156 | - public function isValidDate($y,$m,$d) |
|
156 | + public function isValidDate($y, $m, $d) |
|
157 | 157 | { |
158 | - if ($this->isLeapYear($y)) |
|
159 | - $marr =& self::$_month_leaf; |
|
158 | + if($this->isLeapYear($y)) |
|
159 | + $marr=& self::$_month_leaf; |
|
160 | 160 | else |
161 | - $marr =& self::$_month_normal; |
|
161 | + $marr=& self::$_month_normal; |
|
162 | 162 | |
163 | - if ($m > 12 || $m < 1) return false; |
|
163 | + if($m > 12 || $m < 1) return false; |
|
164 | 164 | |
165 | - if ($d > 31 || $d < 1) return false; |
|
165 | + if($d > 31 || $d < 1) return false; |
|
166 | 166 | |
167 | - if ($marr[$m] < $d) return false; |
|
167 | + if($marr[$m] < $d) return false; |
|
168 | 168 | |
169 | - if ($y < 1000 && $y > 3000) return false; |
|
169 | + if($y < 1000 && $y > 3000) return false; |
|
170 | 170 | |
171 | 171 | return true; |
172 | 172 | } |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * @return string formatted date based on timestamp $d |
176 | 176 | */ |
177 | - function formatDate($fmt,$ts=false,$is_gmt=false) |
|
177 | + function formatDate($fmt, $ts=false, $is_gmt=false) |
|
178 | 178 | { |
179 | - $dt = new DateTime(); |
|
179 | + $dt=new DateTime(); |
|
180 | 180 | if($is_gmt) |
181 | 181 | $dt->setTimeZone(new DateTimeZone('UTC')); |
182 | 182 | $dt->setTimestamp($ts); |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | /** |
188 | 188 | * @return integer|float a timestamp given a local time |
189 | 189 | */ |
190 | - function getTimeStamp($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_gmt=false) |
|
190 | + function getTimeStamp($hr, $min, $sec, $mon=false, $day=false, $year=false, $is_gmt=false) |
|
191 | 191 | { |
192 | - $dt = new DateTime(); |
|
192 | + $dt=new DateTime(); |
|
193 | 193 | if($is_gmt) |
194 | 194 | $dt->setTimeZone(new DateTimeZone('UTC')); |
195 | 195 | $dt->setDate($year!==false ? $year : date('Y'), |
@@ -190,7 +190,7 @@ |
||
190 | 190 | |
191 | 191 | /** |
192 | 192 | * @return integer|float a timestamp given a local time |
193 | - */ |
|
193 | + */ |
|
194 | 194 | function getTimeStamp($hr,$min,$sec,$mon=false,$day=false,$year=false,$is_gmt=false) |
195 | 195 | { |
196 | 196 | $dt = new DateTime(); |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * the object and method name as string |
45 | 45 | * @param array The array of arguments to the function call chain |
46 | 46 | */ |
47 | - public function addCall($method,$args) |
|
47 | + public function addCall($method, $args) |
|
48 | 48 | { |
49 | - $this->add(array($method,$args)); |
|
49 | + $this->add(array($method, $args)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $args=func_get_args(); |
94 | 94 | if($this->getCount()===0) |
95 | - return isset($args[0])?$args[0]:null; |
|
95 | + return isset($args[0]) ? $args[0] : null; |
|
96 | 96 | |
97 | 97 | if(!$this->_iterator) |
98 | 98 | { |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | do { |
104 | 104 | $handler=$this->_iterator->current(); |
105 | 105 | $this->_iterator->next(); |
106 | - if(is_array($handler[0])&&$handler[0][0] instanceof IClassBehavior) |
|
107 | - array_splice($handler[1],1,count($args),$args); |
|
106 | + if(is_array($handler[0]) && $handler[0][0] instanceof IClassBehavior) |
|
107 | + array_splice($handler[1], 1, count($args), $args); |
|
108 | 108 | else |
109 | - array_splice($handler[1],0,count($args),$args); |
|
109 | + array_splice($handler[1], 0, count($args), $args); |
|
110 | 110 | $handler[1][]=$this; |
111 | - $result=call_user_func_array($handler[0],$handler[1]); |
|
111 | + $result=call_user_func_array($handler[0], $handler[1]); |
|
112 | 112 | } while($this->_iterator->valid()); |
113 | 113 | else |
114 | - $result = $args[0]; |
|
114 | + $result=$args[0]; |
|
115 | 115 | return $result; |
116 | 116 | } |
117 | 117 | |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | * @param string method name of the unspecified object method |
138 | 138 | * @param array arguments to the unspecified object method |
139 | 139 | */ |
140 | - public function __dycall($method,$args) |
|
140 | + public function __dycall($method, $args) |
|
141 | 141 | { |
142 | 142 | if($this->_method==$method) |
143 | - return call_user_func_array(array($this,'call'),$args); |
|
143 | + return call_user_func_array(array($this, 'call'), $args); |
|
144 | 144 | return null; |
145 | 145 | } |
146 | 146 | } |
147 | 147 | \ No newline at end of file |
@@ -10,7 +10,6 @@ |
||
10 | 10 | |
11 | 11 | namespace Prado\Util; |
12 | 12 | use Prado\Collections\TList; |
13 | -use Prado\Collections\TListIterator; |
|
14 | 13 | |
15 | 14 | /** |
16 | 15 | * TCallChain is a recursive event calling mechanism. This class implements |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $this->_owner=$owner; |
45 | 45 | foreach($this->events() as $event=>$handler) |
46 | - $owner->attachEventHandler($event,array($this,$handler)); |
|
46 | + $owner->attachEventHandler($event, array($this, $handler)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function detach($owner) |
57 | 57 | { |
58 | 58 | foreach($this->events() as $event=>$handler) |
59 | - $owner->detachEventHandler($event,array($this,$handler)); |
|
59 | + $owner->detachEventHandler($event, array($this, $handler)); |
|
60 | 60 | $this->_owner=null; |
61 | 61 | } |
62 | 62 |