@@ -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 | } |