@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | //$Id: packages.php 3319 2013-09-08 20:59:44Z ctrlaltca $ |
| 4 | 4 | |
| 5 | 5 | // To make future upgrades easier |
| 6 | -if (!defined('JQUERY_DIR')) define ('JQUERY_DIR', 'jquery'); |
|
| 7 | -if (!defined('BOOTSTRAP_DIR')) define ('BOOTSTRAP_DIR', 'bootstrap3'); |
|
| 6 | +if(!defined('JQUERY_DIR')) define('JQUERY_DIR', 'jquery'); |
|
| 7 | +if(!defined('BOOTSTRAP_DIR')) define('BOOTSTRAP_DIR', 'bootstrap3'); |
|
| 8 | 8 | |
| 9 | 9 | //package names and its contents (files relative to the current directory) |
| 10 | -$packages = array( |
|
| 10 | +$packages=array( |
|
| 11 | 11 | 'jquery-ui' => array( |
| 12 | 12 | JQUERY_DIR.'/css/base/jquery-ui.css', |
| 13 | 13 | ), |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | //package names and their dependencies |
| 71 | -$dependencies = array( |
|
| 71 | +$dependencies=array( |
|
| 72 | 72 | 'jquery-ui' => array('jquery-ui'), |
| 73 | 73 | 'jquery.ui.accordion' => array('jquery.ui.core', 'jquery.ui.accordion'), |
| 74 | 74 | 'jquery.ui.autocomplete' => array('jquery.ui.core', 'jquery.ui.autocomplete'), |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | $this->registerPradoScriptInternal($name); |
| 146 | 146 | $params=func_get_args(); |
| 147 | - $this->_page->registerCachingAction('Page.ClientScript','registerPradoScript',$params); |
|
| 147 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerPradoScript', $params); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -155,39 +155,39 @@ discard block |
||
| 155 | 155 | // $this->checkIfNotInRender(); |
| 156 | 156 | if(!isset($this->_registeredPradoScripts[$name])) |
| 157 | 157 | { |
| 158 | - if(self::$_pradoScripts === null) |
|
| 158 | + if(self::$_pradoScripts===null) |
|
| 159 | 159 | { |
| 160 | - $packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::PACKAGES_FILE; |
|
| 161 | - list($packages,$deps)= include($packageFile); |
|
| 162 | - self::$_pradoScripts = $deps; |
|
| 163 | - self::$_pradoPackages = $packages; |
|
| 160 | + $packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::PACKAGES_FILE; |
|
| 161 | + list($packages, $deps)=include($packageFile); |
|
| 162 | + self::$_pradoScripts=$deps; |
|
| 163 | + self::$_pradoPackages=$packages; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if (isset(self::$_pradoScripts[$name])) |
|
| 166 | + if(isset(self::$_pradoScripts[$name])) |
|
| 167 | 167 | $this->_registeredPradoScripts[$name]=true; |
| 168 | 168 | else |
| 169 | - throw new TInvalidOperationException('csmanager_pradoscript_invalid',$name); |
|
| 169 | + throw new TInvalidOperationException('csmanager_pradoscript_invalid', $name); |
|
| 170 | 170 | |
| 171 | 171 | if(($packages=array_keys($this->_registeredPradoScripts))!==array()) |
| 172 | 172 | { |
| 173 | - $base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; |
|
| 174 | - list($path,$baseUrl)=$this->getPackagePathUrl($base); |
|
| 173 | + $base=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; |
|
| 174 | + list($path, $baseUrl)=$this->getPackagePathUrl($base); |
|
| 175 | 175 | $packagesUrl=array(); |
| 176 | 176 | $isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug; |
| 177 | - foreach ($packages as $p) |
|
| 177 | + foreach($packages as $p) |
|
| 178 | 178 | { |
| 179 | - foreach (self::$_pradoScripts[$p] as $dep) |
|
| 179 | + foreach(self::$_pradoScripts[$p] as $dep) |
|
| 180 | 180 | { |
| 181 | - foreach (self::$_pradoPackages[$dep] as $script) |
|
| 182 | - if (!isset($this->_expandedPradoScripts[$script])) |
|
| 181 | + foreach(self::$_pradoPackages[$dep] as $script) |
|
| 182 | + if(!isset($this->_expandedPradoScripts[$script])) |
|
| 183 | 183 | { |
| 184 | - $this->_expandedPradoScripts[$script] = true; |
|
| 184 | + $this->_expandedPradoScripts[$script]=true; |
|
| 185 | 185 | if($isDebug) |
| 186 | 186 | { |
| 187 | - if (!in_array($url=$baseUrl.'/'.$script,$packagesUrl)) |
|
| 187 | + if(!in_array($url=$baseUrl.'/'.$script, $packagesUrl)) |
|
| 188 | 188 | $packagesUrl[]=$url; |
| 189 | 189 | } else { |
| 190 | - if (!in_array($url=$baseUrl.'/min/'.$script,$packagesUrl)) |
|
| 190 | + if(!in_array($url=$baseUrl.'/min/'.$script, $packagesUrl)) |
|
| 191 | 191 | { |
| 192 | 192 | if(!is_file($filePath=$path.'/min/'.$script)) |
| 193 | 193 | { |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | foreach($packagesUrl as $url) |
| 207 | - $this->registerScriptFile($url,$url); |
|
| 207 | + $this->registerScriptFile($url, $url); |
|
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function getPradoScriptAssetUrl() |
| 216 | 216 | { |
| 217 | - $base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; |
|
| 218 | - $assets = Prado::getApplication()->getAssetManager(); |
|
| 217 | + $base=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; |
|
| 218 | + $assets=Prado::getApplication()->getAssetManager(); |
|
| 219 | 219 | return $assets->getPublishedUrl($base); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function getScriptUrls() |
| 227 | 227 | { |
| 228 | - $scripts = array_values($this->_headScriptFiles); |
|
| 229 | - $scripts = array_merge($scripts, array_values($this->_scriptFiles)); |
|
| 230 | - $scripts = array_unique($scripts); |
|
| 228 | + $scripts=array_values($this->_headScriptFiles); |
|
| 229 | + $scripts=array_merge($scripts, array_values($this->_scriptFiles)); |
|
| 230 | + $scripts=array_unique($scripts); |
|
| 231 | 231 | |
| 232 | 232 | return $scripts; |
| 233 | 233 | } |
@@ -238,17 +238,17 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | protected function getPackagePathUrl($base) |
| 240 | 240 | { |
| 241 | - $assets = Prado::getApplication()->getAssetManager(); |
|
| 241 | + $assets=Prado::getApplication()->getAssetManager(); |
|
| 242 | 242 | if(strpos($base, $assets->getBaseUrl())===false) |
| 243 | 243 | { |
| 244 | - if(($dir = Prado::getPathOfNameSpace($base)) !== null) { |
|
| 245 | - $base = $dir; |
|
| 244 | + if(($dir=Prado::getPathOfNameSpace($base))!==null) { |
|
| 245 | + $base=$dir; |
|
| 246 | 246 | } |
| 247 | 247 | return array($assets->getPublishedPath($base), $assets->publishFilePath($base)); |
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| 251 | - return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base); |
|
| 251 | + return array($assets->getBasePath().str_replace($assets->getBaseUrl(), '', $base), $base); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -260,13 +260,13 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function getCallbackReference(ICallbackEventHandler $callbackHandler, $options=null) |
| 262 | 262 | { |
| 263 | - $options = !is_array($options) ? array() : $options; |
|
| 264 | - $class = new ReflectionClass($callbackHandler); |
|
| 265 | - $clientSide = $callbackHandler->getActiveControl()->getClientSide(); |
|
| 266 | - $options = array_merge($options, $clientSide->getOptions()->toArray()); |
|
| 267 | - $optionString = TJavaScript::encode($options); |
|
| 263 | + $options=!is_array($options) ? array() : $options; |
|
| 264 | + $class=new ReflectionClass($callbackHandler); |
|
| 265 | + $clientSide=$callbackHandler->getActiveControl()->getClientSide(); |
|
| 266 | + $options=array_merge($options, $clientSide->getOptions()->toArray()); |
|
| 267 | + $optionString=TJavaScript::encode($options); |
|
| 268 | 268 | $this->registerPradoScriptInternal('ajax'); |
| 269 | - $id = $callbackHandler->getUniqueID(); |
|
| 269 | + $id=$callbackHandler->getUniqueID(); |
|
| 270 | 270 | return "new Prado.CallbackRequest('{$id}',{$optionString})"; |
| 271 | 271 | } |
| 272 | 272 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $this->registerPradoScriptInternal('ajax'); |
| 284 | 284 | |
| 285 | 285 | $params=func_get_args(); |
| 286 | - $this->_page->registerCachingAction('Page.ClientScript','registerCallbackControl',$params); |
|
| 286 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerCallbackControl', $params); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -292,9 +292,9 @@ discard block |
||
| 292 | 292 | * @param string javascript class responsible for the control being registered for postback |
| 293 | 293 | * @param array postback options |
| 294 | 294 | */ |
| 295 | - public function registerPostBackControl($class,$options) |
|
| 295 | + public function registerPostBackControl($class, $options) |
|
| 296 | 296 | { |
| 297 | - if($class === null) { |
|
| 297 | + if($class===null) { |
|
| 298 | 298 | return; |
| 299 | 299 | } |
| 300 | 300 | if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null) |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $this->registerPradoScriptInternal('prado'); |
| 307 | 307 | |
| 308 | 308 | $params=func_get_args(); |
| 309 | - $this->_page->registerCachingAction('Page.ClientScript','registerPostBackControl',$params); |
|
| 309 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerPostBackControl', $params); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /** |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public function registerDefaultButton($panel, $button) |
| 319 | 319 | { |
| 320 | - $panelID=is_string($panel)?$panel:$panel->getUniqueID(); |
|
| 320 | + $panelID=is_string($panel) ? $panel : $panel->getUniqueID(); |
|
| 321 | 321 | |
| 322 | 322 | if(is_string($button)) |
| 323 | 323 | $buttonID=$button; |
@@ -326,14 +326,14 @@ discard block |
||
| 326 | 326 | $button->setIsDefaultButton(true); |
| 327 | 327 | $buttonID=$button->getUniqueID(); |
| 328 | 328 | } |
| 329 | - $options = TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID)); |
|
| 330 | - $code = "new Prado.WebUI.DefaultButton($options);"; |
|
| 329 | + $options=TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID)); |
|
| 330 | + $code="new Prado.WebUI.DefaultButton($options);"; |
|
| 331 | 331 | |
| 332 | 332 | $this->_endScripts['prado:'.$panelID]=$code; |
| 333 | 333 | $this->registerPradoScriptInternal('prado'); |
| 334 | 334 | |
| 335 | - $params=array($panelID,$buttonID); |
|
| 336 | - $this->_page->registerCachingAction('Page.ClientScript','registerDefaultButton',$params); |
|
| 335 | + $params=array($panelID, $buttonID); |
|
| 336 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerDefaultButton', $params); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -343,11 +343,11 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | protected function getDefaultButtonOptions($panelID, $buttonID) |
| 345 | 345 | { |
| 346 | - $options['ID'] = TControl::convertUniqueIdToClientId($panelID); |
|
| 347 | - $options['Panel'] = TControl::convertUniqueIdToClientId($panelID); |
|
| 348 | - $options['Target'] = TControl::convertUniqueIdToClientId($buttonID); |
|
| 349 | - $options['EventTarget'] = $buttonID; |
|
| 350 | - $options['Event'] = 'click'; |
|
| 346 | + $options['ID']=TControl::convertUniqueIdToClientId($panelID); |
|
| 347 | + $options['Panel']=TControl::convertUniqueIdToClientId($panelID); |
|
| 348 | + $options['Target']=TControl::convertUniqueIdToClientId($buttonID); |
|
| 349 | + $options['EventTarget']=$buttonID; |
|
| 350 | + $options['Event']='click'; |
|
| 351 | 351 | return $options; |
| 352 | 352 | } |
| 353 | 353 | |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | $this->registerPradoScriptInternal('jquery'); |
| 361 | 361 | if($target instanceof TControl) |
| 362 | 362 | $target=$target->getClientID(); |
| 363 | - $this->_endScripts['prado:focus'] = 'jQuery(\'#'.$target.'\').focus();'; |
|
| 363 | + $this->_endScripts['prado:focus']='jQuery(\'#'.$target.'\').focus();'; |
|
| 364 | 364 | |
| 365 | 365 | $params=func_get_args(); |
| 366 | - $this->_page->registerCachingAction('Page.ClientScript','registerFocusControl',$params); |
|
| 366 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerFocusControl', $params); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | { |
| 376 | 376 | $this->registerPradoStyleInternal($name); |
| 377 | 377 | $params=func_get_args(); |
| 378 | - $this->_page->registerCachingAction('Page.ClientScript','registerPradoStyle',$params); |
|
| 378 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerPradoStyle', $params); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
@@ -386,43 +386,43 @@ discard block |
||
| 386 | 386 | // $this->checkIfNotInRender(); |
| 387 | 387 | if(!isset($this->_registeredPradoStyles[$name])) |
| 388 | 388 | { |
| 389 | - $base = $this->getPradoScriptAssetUrl(); |
|
| 389 | + $base=$this->getPradoScriptAssetUrl(); |
|
| 390 | 390 | |
| 391 | - if(self::$_pradoStyles === null) |
|
| 391 | + if(self::$_pradoStyles===null) |
|
| 392 | 392 | { |
| 393 | - $packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE; |
|
| 394 | - list($packages,$deps)= include($packageFile); |
|
| 395 | - self::$_pradoStyles = $deps; |
|
| 396 | - self::$_pradoStylePackages = $packages; |
|
| 393 | + $packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE; |
|
| 394 | + list($packages, $deps)=include($packageFile); |
|
| 395 | + self::$_pradoStyles=$deps; |
|
| 396 | + self::$_pradoStylePackages=$packages; |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - if (isset(self::$_pradoStyles[$name])) |
|
| 399 | + if(isset(self::$_pradoStyles[$name])) |
|
| 400 | 400 | $this->_registeredPradoStyles[$name]=true; |
| 401 | 401 | else |
| 402 | - throw new TInvalidOperationException('csmanager_pradostyle_invalid',$name); |
|
| 402 | + throw new TInvalidOperationException('csmanager_pradostyle_invalid', $name); |
|
| 403 | 403 | |
| 404 | 404 | if(($packages=array_keys($this->_registeredPradoStyles))!==array()) |
| 405 | 405 | { |
| 406 | - $base = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; |
|
| 407 | - list($path,$baseUrl)=$this->getPackagePathUrl($base); |
|
| 406 | + $base=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_PATH; |
|
| 407 | + list($path, $baseUrl)=$this->getPackagePathUrl($base); |
|
| 408 | 408 | $packagesUrl=array(); |
| 409 | 409 | $isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug; |
| 410 | - foreach ($packages as $p) |
|
| 410 | + foreach($packages as $p) |
|
| 411 | 411 | { |
| 412 | - foreach (self::$_pradoStyles[$p] as $dep) |
|
| 412 | + foreach(self::$_pradoStyles[$p] as $dep) |
|
| 413 | 413 | { |
| 414 | - foreach (self::$_pradoStylePackages[$dep] as $style) |
|
| 415 | - if (!isset($this->_expandedPradoStyles[$style])) |
|
| 414 | + foreach(self::$_pradoStylePackages[$dep] as $style) |
|
| 415 | + if(!isset($this->_expandedPradoStyles[$style])) |
|
| 416 | 416 | { |
| 417 | - $this->_expandedPradoStyles[$style] = true; |
|
| 417 | + $this->_expandedPradoStyles[$style]=true; |
|
| 418 | 418 | // TODO minify css? |
| 419 | - if (!in_array($url=$baseUrl.'/'.$style,$packagesUrl)) |
|
| 419 | + if(!in_array($url=$baseUrl.'/'.$style, $packagesUrl)) |
|
| 420 | 420 | $packagesUrl[]=$url; |
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | foreach($packagesUrl as $url) |
| 425 | - $this->registerStyleSheetFile($url,$url); |
|
| 425 | + $this->registerStyleSheetFile($url, $url); |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -449,15 +449,15 @@ discard block |
||
| 449 | 449 | * @param string URL to the CSS file |
| 450 | 450 | * @param string media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types. |
| 451 | 451 | */ |
| 452 | - public function registerStyleSheetFile($key,$url,$media='') |
|
| 452 | + public function registerStyleSheetFile($key, $url, $media='') |
|
| 453 | 453 | { |
| 454 | 454 | if($media==='') |
| 455 | 455 | $this->_styleSheetFiles[$key]=$url; |
| 456 | 456 | else |
| 457 | - $this->_styleSheetFiles[$key]=array($url,$media); |
|
| 457 | + $this->_styleSheetFiles[$key]=array($url, $media); |
|
| 458 | 458 | |
| 459 | 459 | $params=func_get_args(); |
| 460 | - $this->_page->registerCachingAction('Page.ClientScript','registerStyleSheetFile',$params); |
|
| 460 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheetFile', $params); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | /** |
@@ -465,12 +465,12 @@ discard block |
||
| 465 | 465 | * @param string a unique key identifying the CSS block |
| 466 | 466 | * @param string CSS block |
| 467 | 467 | */ |
| 468 | - public function registerStyleSheet($key,$css,$media='') |
|
| 468 | + public function registerStyleSheet($key, $css, $media='') |
|
| 469 | 469 | { |
| 470 | 470 | $this->_styleSheets[$key]=$css; |
| 471 | 471 | |
| 472 | 472 | $params=func_get_args(); |
| 473 | - $this->_page->registerCachingAction('Page.ClientScript','registerStyleSheet',$params); |
|
| 473 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheet', $params); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | /** |
@@ -479,17 +479,17 @@ discard block |
||
| 479 | 479 | */ |
| 480 | 480 | public function getStyleSheetUrls() |
| 481 | 481 | { |
| 482 | - $stylesheets = array_values( |
|
| 482 | + $stylesheets=array_values( |
|
| 483 | 483 | array_map( |
| 484 | 484 | create_function('$e', 'return is_array($e) ? $e[0] : $e;'), |
| 485 | 485 | $this->_styleSheetFiles) |
| 486 | 486 | ); |
| 487 | 487 | |
| 488 | 488 | foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) |
| 489 | - if (substr($url,strlen($url)-4)=='.css') |
|
| 490 | - $stylesheets[] = $url; |
|
| 489 | + if(substr($url, strlen($url) - 4)=='.css') |
|
| 490 | + $stylesheets[]=$url; |
|
| 491 | 491 | |
| 492 | - $stylesheets = array_unique($stylesheets); |
|
| 492 | + $stylesheets=array_unique($stylesheets); |
|
| 493 | 493 | |
| 494 | 494 | return $stylesheets; |
| 495 | 495 | } |
@@ -508,13 +508,13 @@ discard block |
||
| 508 | 508 | * @param string a unique key identifying the file |
| 509 | 509 | * @param string URL to the javascript file |
| 510 | 510 | */ |
| 511 | - public function registerHeadScriptFile($key,$url) |
|
| 511 | + public function registerHeadScriptFile($key, $url) |
|
| 512 | 512 | { |
| 513 | 513 | $this->checkIfNotInRender(); |
| 514 | 514 | $this->_headScriptFiles[$key]=$url; |
| 515 | 515 | |
| 516 | 516 | $params=func_get_args(); |
| 517 | - $this->_page->registerCachingAction('Page.ClientScript','registerHeadScriptFile',$params); |
|
| 517 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScriptFile', $params); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
@@ -522,13 +522,13 @@ discard block |
||
| 522 | 522 | * @param string a unique key identifying the script block |
| 523 | 523 | * @param string javascript block |
| 524 | 524 | */ |
| 525 | - public function registerHeadScript($key,$script) |
|
| 525 | + public function registerHeadScript($key, $script) |
|
| 526 | 526 | { |
| 527 | 527 | $this->checkIfNotInRender(); |
| 528 | 528 | $this->_headScripts[$key]=$script; |
| 529 | 529 | |
| 530 | 530 | $params=func_get_args(); |
| 531 | - $this->_page->registerCachingAction('Page.ClientScript','registerHeadScript',$params); |
|
| 531 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScript', $params); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | /** |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | $this->_scriptFiles[$key]=$url; |
| 542 | 542 | |
| 543 | 543 | $params=func_get_args(); |
| 544 | - $this->_page->registerCachingAction('Page.ClientScript','registerScriptFile',$params); |
|
| 544 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerScriptFile', $params); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | /** |
@@ -549,13 +549,13 @@ discard block |
||
| 549 | 549 | * @param string a unique key identifying the script block |
| 550 | 550 | * @param string javascript block |
| 551 | 551 | */ |
| 552 | - public function registerBeginScript($key,$script) |
|
| 552 | + public function registerBeginScript($key, $script) |
|
| 553 | 553 | { |
| 554 | 554 | $this->checkIfNotInRender(); |
| 555 | 555 | $this->_beginScripts[$key]=$script; |
| 556 | 556 | |
| 557 | 557 | $params=func_get_args(); |
| 558 | - $this->_page->registerCachingAction('Page.ClientScript','registerBeginScript',$params); |
|
| 558 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerBeginScript', $params); |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | /** |
@@ -563,12 +563,12 @@ discard block |
||
| 563 | 563 | * @param string a unique key identifying the script block |
| 564 | 564 | * @param string javascript block |
| 565 | 565 | */ |
| 566 | - public function registerEndScript($key,$script) |
|
| 566 | + public function registerEndScript($key, $script) |
|
| 567 | 567 | { |
| 568 | 568 | $this->_endScripts[$key]=$script; |
| 569 | 569 | |
| 570 | 570 | $params=func_get_args(); |
| 571 | - $this->_page->registerCachingAction('Page.ClientScript','registerEndScript',$params); |
|
| 571 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerEndScript', $params); |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | /** |
@@ -577,12 +577,12 @@ discard block |
||
| 577 | 577 | * @param string|array hidden field value, if the value is an array, every element |
| 578 | 578 | * in the array will be rendered as a hidden field value. |
| 579 | 579 | */ |
| 580 | - public function registerHiddenField($name,$value) |
|
| 580 | + public function registerHiddenField($name, $value) |
|
| 581 | 581 | { |
| 582 | 582 | $this->_hiddenFields[$name]=$value; |
| 583 | 583 | |
| 584 | 584 | $params=func_get_args(); |
| 585 | - $this->_page->registerCachingAction('Page.ClientScript','registerHiddenField',$params); |
|
| 585 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerHiddenField', $params); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | /** |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | public function renderStyleSheets($writer) |
| 696 | 696 | { |
| 697 | 697 | if(count($this->_styleSheets)) |
| 698 | - $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n",$this->_styleSheets)."\n/*]]>*/\n</style>\n"); |
|
| 698 | + $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n", $this->_styleSheets)."\n/*]]>*/\n</style>\n"); |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | /** |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | */ |
| 704 | 704 | public function renderHeadScriptFiles($writer) |
| 705 | 705 | { |
| 706 | - $this->renderScriptFiles($writer,$this->_headScriptFiles); |
|
| 706 | + $this->renderScriptFiles($writer, $this->_headScriptFiles); |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | /** |
@@ -726,9 +726,9 @@ discard block |
||
| 726 | 726 | |
| 727 | 727 | public function markScriptFileAsRendered($url) |
| 728 | 728 | { |
| 729 | - $this->_renderedScriptFiles[$url] = $url; |
|
| 729 | + $this->_renderedScriptFiles[$url]=$url; |
|
| 730 | 730 | $params=func_get_args(); |
| 731 | - $this->_page->registerCachingAction('Page.ClientScript','markScriptFileAsRendered',$params); |
|
| 731 | + $this->_page->registerCachingAction('Page.ClientScript', 'markScriptFileAsRendered', $params); |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | protected function renderScriptFiles($writer, Array $scripts) |
@@ -752,8 +752,8 @@ discard block |
||
| 752 | 752 | { |
| 753 | 753 | if(!empty($this->_scriptFiles)) |
| 754 | 754 | { |
| 755 | - $addedScripts = array_diff($this->_scriptFiles,$this->getRenderedScriptFiles()); |
|
| 756 | - $this->renderScriptFiles($writer,$addedScripts); |
|
| 755 | + $addedScripts=array_diff($this->_scriptFiles, $this->getRenderedScriptFiles()); |
|
| 756 | + $this->renderScriptFiles($writer, $addedScripts); |
|
| 757 | 757 | } |
| 758 | 758 | } |
| 759 | 759 | |
@@ -791,12 +791,12 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | public function renderHiddenFieldsBegin($writer) |
| 793 | 793 | { |
| 794 | - $this->renderHiddenFieldsInt($writer,true); |
|
| 794 | + $this->renderHiddenFieldsInt($writer, true); |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | public function renderHiddenFieldsEnd($writer) |
| 798 | 798 | { |
| 799 | - $this->renderHiddenFieldsInt($writer,false); |
|
| 799 | + $this->renderHiddenFieldsInt($writer, false); |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | /** |
@@ -818,12 +818,12 @@ discard block |
||
| 818 | 818 | */ |
| 819 | 819 | protected function renderHiddenFieldsInt($writer, $initial) |
| 820 | 820 | { |
| 821 | - if ($initial) $this->_renderedHiddenFields = array(); |
|
| 821 | + if($initial) $this->_renderedHiddenFields=array(); |
|
| 822 | 822 | $str=''; |
| 823 | 823 | foreach($this->_hiddenFields as $name=>$value) |
| 824 | 824 | { |
| 825 | - if (in_array($name,$this->_renderedHiddenFields)) continue; |
|
| 826 | - $id=strtr($name,':','_'); |
|
| 825 | + if(in_array($name, $this->_renderedHiddenFields)) continue; |
|
| 826 | + $id=strtr($name, ':', '_'); |
|
| 827 | 827 | if(is_array($value)) |
| 828 | 828 | { |
| 829 | 829 | foreach($value as $v) |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | { |
| 834 | 834 | $str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
| 835 | 835 | } |
| 836 | - $this->_renderedHiddenFields[] = $name; |
|
| 836 | + $this->_renderedHiddenFields[]=$name; |
|
| 837 | 837 | } |
| 838 | 838 | if($str!=='') |
| 839 | 839 | $writer->write("<div style=\"visibility:hidden;\">\n".$str."</div>\n"); |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | */ |
| 850 | 850 | protected function checkIfNotInRender() |
| 851 | 851 | { |
| 852 | - if ($form = $this->_page->InFormRender) |
|
| 852 | + if($form=$this->_page->InFormRender) |
|
| 853 | 853 | throw new Exception('Operation invalid when page is already rendering'); |
| 854 | 854 | } |
| 855 | 855 | } |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | protected function setFunction($name, $code) |
| 884 | 884 | { |
| 885 | 885 | if(!TJavaScript::isJsLiteral($code)) |
| 886 | - $code = TJavaScript::quoteJsLiteral($this->ensureFunction($code)); |
|
| 886 | + $code=TJavaScript::quoteJsLiteral($this->ensureFunction($code)); |
|
| 887 | 887 | $this->setOption($name, $code); |
| 888 | 888 | } |
| 889 | 889 | |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | */ |
| 893 | 893 | protected function getOption($name) |
| 894 | 894 | { |
| 895 | - if ($this->_options) |
|
| 895 | + if($this->_options) |
|
| 896 | 896 | return $this->_options->itemAt($name); |
| 897 | 897 | else |
| 898 | 898 | return null; |
@@ -912,8 +912,8 @@ discard block |
||
| 912 | 912 | */ |
| 913 | 913 | public function getOptions() |
| 914 | 914 | { |
| 915 | - if (!$this->_options) |
|
| 916 | - $this->_options = Prado::createComponent('System.Collections.TMap'); |
|
| 915 | + if(!$this->_options) |
|
| 916 | + $this->_options=Prado::createComponent('System.Collections.TMap'); |
|
| 917 | 917 | return $this->_options; |
| 918 | 918 | } |
| 919 | 919 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function getMediaType() |
| 84 | 84 | { |
| 85 | - return $this->getViewState('MediaType',''); |
|
| 85 | + return $this->getViewState('MediaType', ''); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function setMediaType($value) |
| 92 | 92 | { |
| 93 | - $this->setViewState('MediaType',$value,''); |
|
| 93 | + $this->setViewState('MediaType', $value, ''); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -100,17 +100,17 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function onPreRender($param) |
| 102 | 102 | { |
| 103 | - $cs = $this->getPage()->getClientScript(); |
|
| 103 | + $cs=$this->getPage()->getClientScript(); |
|
| 104 | 104 | |
| 105 | - $styles = preg_split('/,|\s+/', $this->getPradoStyles()); |
|
| 105 | + $styles=preg_split('/,|\s+/', $this->getPradoStyles()); |
|
| 106 | 106 | foreach($styles as $style) |
| 107 | 107 | { |
| 108 | - if(($style = trim($style))!=='') |
|
| 108 | + if(($style=trim($style))!=='') |
|
| 109 | 109 | $cs->registerPradoStyle($style); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | if(($url=$this->getStyleSheetUrl())!=='') |
| 113 | - $cs->registerStyleSheetFile($url,$url,$this->getMediaType()); |
|
| 113 | + $cs->registerStyleSheetFile($url, $url, $this->getMediaType()); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |