@@ -422,6 +422,7 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | /** |
| 424 | 424 | * Parse additional options set in the Options property. |
| 425 | + * @param string $string |
|
| 425 | 426 | * @return array additional custom options |
| 426 | 427 | */ |
| 427 | 428 | protected function parseEditorOptions($string) |
@@ -446,6 +447,7 @@ discard block |
||
| 446 | 447 | } |
| 447 | 448 | |
| 448 | 449 | /** |
| 450 | + * @param string $culture |
|
| 449 | 451 | * @return string localized editor interface language extension. |
| 450 | 452 | */ |
| 451 | 453 | protected function getLanguageSuffix($culture) |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | * @var array list of locale => language file pairs. |
| 64 | 64 | */ |
| 65 | - private static $_langs = array( |
|
| 65 | + private static $_langs=array( |
|
| 66 | 66 | 'ar' => 'ar', |
| 67 | 67 | 'bg_BG' => 'bg_BG', |
| 68 | 68 | 'bs' => 'bs', |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * @var array list of default plugins to load, override using getAvailablePlugins(); |
| 122 | 122 | */ |
| 123 | - private static $_plugins = array( |
|
| 123 | + private static $_plugins=array( |
|
| 124 | 124 | 'advlist', |
| 125 | 125 | 'anchor', |
| 126 | 126 | 'autolink', |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | /** |
| 165 | 165 | * @var array default themes to load |
| 166 | 166 | */ |
| 167 | - private static $_themes = array( |
|
| 167 | + private static $_themes=array( |
|
| 168 | 168 | 'modern', |
| 169 | 169 | ); |
| 170 | 170 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function getEnableVisualEdit() |
| 213 | 213 | { |
| 214 | - return $this->getViewState('EnableVisualEdit',true); |
|
| 214 | + return $this->getViewState('EnableVisualEdit', true); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public function setEnableVisualEdit($value) |
| 222 | 222 | { |
| 223 | - $this->setViewState('EnableVisualEdit',TPropertyValue::ensureBoolean($value),true); |
|
| 223 | + $this->setViewState('EnableVisualEdit', TPropertyValue::ensureBoolean($value), true); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | { |
| 306 | 306 | if($this->getEnableVisualEdit() && $this->getEnabled(true)) |
| 307 | 307 | { |
| 308 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 308 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 309 | 309 | $this->registerEditorClientScript($writer); |
| 310 | 310 | } |
| 311 | 311 | |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | protected function loadJavascriptLibrary() |
| 342 | 342 | { |
| 343 | - $scripts = $this->getPage()->getClientScript(); |
|
| 343 | + $scripts=$this->getPage()->getClientScript(); |
|
| 344 | 344 | $scripts->registerPradoScript('htmlarea4'); |
| 345 | 345 | $this->copyCustomPlugins(); |
| 346 | 346 | } |
@@ -351,25 +351,25 @@ discard block |
||
| 351 | 351 | protected function registerEditorClientScript($writer) |
| 352 | 352 | { |
| 353 | 353 | $this->loadJavascriptLibrary(); |
| 354 | - $scripts = $this->getPage()->getClientScript(); |
|
| 355 | - $options = array( |
|
| 354 | + $scripts=$this->getPage()->getClientScript(); |
|
| 355 | + $options=array( |
|
| 356 | 356 | 'EditorOptions' => $this->getEditorOptions() |
| 357 | 357 | ); |
| 358 | 358 | |
| 359 | - $options = TJavaScript::encode($options,true,true); |
|
| 360 | - $script = "new {$this->getClientClassName()}($options)"; |
|
| 361 | - $scripts->registerEndScript('prado:THtmlArea4'.$this->ClientID,$script); |
|
| 359 | + $options=TJavaScript::encode($options, true, true); |
|
| 360 | + $script="new {$this->getClientClassName()}($options)"; |
|
| 361 | + $scripts->registerEndScript('prado:THtmlArea4'.$this->ClientID, $script); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | protected function copyCustomPlugins() |
| 365 | 365 | { |
| 366 | - if($plugins = $this->getCustomPluginPath()) |
|
| 366 | + if($plugins=$this->getCustomPluginPath()) |
|
| 367 | 367 | { |
| 368 | - $basepath = $this->getPage()->getClientScript()->getPradoScriptAssetPath('tinymce'); |
|
| 369 | - $assets = $this->getApplication()->getAssetManager(); |
|
| 370 | - $path = is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
| 371 | - $name = basename($path); |
|
| 372 | - $dest = $basepath.'/plugins/'.$name; |
|
| 368 | + $basepath=$this->getPage()->getClientScript()->getPradoScriptAssetPath('tinymce'); |
|
| 369 | + $assets=$this->getApplication()->getAssetManager(); |
|
| 370 | + $path=is_dir($plugins) ? $plugins : Prado::getPathOfNameSpace($plugins); |
|
| 371 | + $name=basename($path); |
|
| 372 | + $dest=$basepath.'/plugins/'.$name; |
|
| 373 | 373 | if(!is_dir($dest) || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 374 | 374 | $assets->copyDirectory($path, $dest); |
| 375 | 375 | } |
@@ -381,26 +381,26 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | protected function getEditorOptions() |
| 383 | 383 | { |
| 384 | - $options['mode'] = 'exact'; |
|
| 385 | - $options['elements'] = $this->getClientID(); |
|
| 386 | - $options['language'] = $this->getLanguageSuffix($this->getCulture()); |
|
| 384 | + $options['mode']='exact'; |
|
| 385 | + $options['elements']=$this->getClientID(); |
|
| 386 | + $options['language']=$this->getLanguageSuffix($this->getCulture()); |
|
| 387 | 387 | //$options['theme'] = 'modern'; //default |
| 388 | 388 | // mimic previous (tinyMCE3) sizing behaviour |
| 389 | - $options['width'] = $this->getWidth(); |
|
| 390 | - $options['height'] = $this->getHeight(); |
|
| 391 | - $options['resize'] = 'both'; |
|
| 392 | - $options['menubar'] = false; |
|
| 389 | + $options['width']=$this->getWidth(); |
|
| 390 | + $options['height']=$this->getHeight(); |
|
| 391 | + $options['resize']='both'; |
|
| 392 | + $options['menubar']=false; |
|
| 393 | 393 | if($this->getReadOnly()) |
| 394 | 394 | { |
| 395 | - $options['readonly'] = true; |
|
| 396 | - $options['toolbar'] = false; |
|
| 397 | - $options['menubar'] = false; |
|
| 398 | - $options['statusbar'] = false; |
|
| 395 | + $options['readonly']=true; |
|
| 396 | + $options['toolbar']=false; |
|
| 397 | + $options['menubar']=false; |
|
| 398 | + $options['statusbar']=false; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - $options['extended_valid_elements'] = 'a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
| 401 | + $options['extended_valid_elements']='a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]'; |
|
| 402 | 402 | |
| 403 | - $options = array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
| 403 | + $options=array_merge($options, $this->parseEditorOptions($this->getOptions())); |
|
| 404 | 404 | return $options; |
| 405 | 405 | } |
| 406 | 406 | |
@@ -410,20 +410,20 @@ discard block |
||
| 410 | 410 | */ |
| 411 | 411 | protected function parseEditorOptions($string) |
| 412 | 412 | { |
| 413 | - $options = array(); |
|
| 414 | - $substrings = preg_split('/,\s*\n|\n/', trim($string)); |
|
| 413 | + $options=array(); |
|
| 414 | + $substrings=preg_split('/,\s*\n|\n/', trim($string)); |
|
| 415 | 415 | foreach($substrings as $bits) |
| 416 | 416 | { |
| 417 | - $option = explode(":",$bits,2); |
|
| 417 | + $option=explode(":", $bits, 2); |
|
| 418 | 418 | |
| 419 | - if(count($option) == 2) |
|
| 419 | + if(count($option)==2) |
|
| 420 | 420 | { |
| 421 | - $value=trim(trim($option[1]),"'\""); |
|
| 422 | - if (($s=strtolower($value))==='false') |
|
| 421 | + $value=trim(trim($option[1]), "'\""); |
|
| 422 | + if(($s=strtolower($value))==='false') |
|
| 423 | 423 | $value=false; |
| 424 | - elseif ($s==='true') |
|
| 424 | + elseif($s==='true') |
|
| 425 | 425 | $value=true; |
| 426 | - $options[trim($option[0])] = $value; |
|
| 426 | + $options[trim($option[0])]=$value; |
|
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | return $options; |
@@ -434,12 +434,12 @@ discard block |
||
| 434 | 434 | */ |
| 435 | 435 | protected function getLanguageSuffix($culture) |
| 436 | 436 | { |
| 437 | - $app = $this->getApplication()->getGlobalization(); |
|
| 437 | + $app=$this->getApplication()->getGlobalization(); |
|
| 438 | 438 | if(empty($culture) && ($app!==null)) |
| 439 | - $culture = $app->getCulture(); |
|
| 440 | - $variants = array(); |
|
| 439 | + $culture=$app->getCulture(); |
|
| 440 | + $variants=array(); |
|
| 441 | 441 | if($app!==null) |
| 442 | - $variants = $app->getCultureVariants($culture); |
|
| 442 | + $variants=$app->getCultureVariants($culture); |
|
| 443 | 443 | |
| 444 | 444 | foreach($variants as $variant) |
| 445 | 445 | { |
@@ -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,42 +170,42 @@ 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 | - if (!in_array($url=$baseUrl.'/min/'.$subPath, $packagesUrl)) |
|
| 208 | + if(!in_array($url=$baseUrl.'/min/'.$subPath, $packagesUrl)) |
|
| 209 | 209 | { |
| 210 | 210 | if(!is_file($filePath=$path.'/min/'.$subPath)) |
| 211 | 211 | { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | foreach($packagesUrl as $url) |
| 226 | - $this->registerScriptFile($url,$url); |
|
| 226 | + $this->registerScriptFile($url, $url); |
|
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | } |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | public function getPradoScriptAssetUrl($script='prado') |
| 235 | 235 | { |
| 236 | 236 | if(!array_key_exists($script, self::$_scriptsFolders)) |
| 237 | - throw new TInvalidOperationException('csmanager_pradostyle_invalid',$script); |
|
| 237 | + throw new TInvalidOperationException('csmanager_pradostyle_invalid', $script); |
|
| 238 | 238 | |
| 239 | - $base = Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]); |
|
| 240 | - $assets = Prado::getApplication()->getAssetManager(); |
|
| 239 | + $base=Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]); |
|
| 240 | + $assets=Prado::getApplication()->getAssetManager(); |
|
| 241 | 241 | return $assets->getPublishedUrl($base); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | public function getPradoScriptAssetPath($script='prado') |
| 248 | 248 | { |
| 249 | 249 | if(!array_key_exists($script, self::$_scriptsFolders)) |
| 250 | - throw new TInvalidOperationException('csmanager_pradostyle_invalid',$script); |
|
| 250 | + throw new TInvalidOperationException('csmanager_pradostyle_invalid', $script); |
|
| 251 | 251 | |
| 252 | - $base = Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]); |
|
| 253 | - $assets = Prado::getApplication()->getAssetManager(); |
|
| 252 | + $base=Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]); |
|
| 253 | + $assets=Prado::getApplication()->getAssetManager(); |
|
| 254 | 254 | return $assets->getPublishedPath($base); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function getScriptUrls() |
| 262 | 262 | { |
| 263 | - $scripts = array_values($this->_headScriptFiles); |
|
| 264 | - $scripts = array_merge($scripts, array_values($this->_scriptFiles)); |
|
| 265 | - $scripts = array_unique($scripts); |
|
| 263 | + $scripts=array_values($this->_headScriptFiles); |
|
| 264 | + $scripts=array_merge($scripts, array_values($this->_scriptFiles)); |
|
| 265 | + $scripts=array_unique($scripts); |
|
| 266 | 266 | |
| 267 | 267 | return $scripts; |
| 268 | 268 | } |
@@ -273,17 +273,17 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | protected function getPackagePathUrl($base) |
| 275 | 275 | { |
| 276 | - $assets = Prado::getApplication()->getAssetManager(); |
|
| 276 | + $assets=Prado::getApplication()->getAssetManager(); |
|
| 277 | 277 | if(strpos($base, $assets->getBaseUrl())===false) |
| 278 | 278 | { |
| 279 | - if(($dir = Prado::getPathOfNameSpace($base)) !== null) { |
|
| 280 | - $base = $dir; |
|
| 279 | + if(($dir=Prado::getPathOfNameSpace($base))!==null) { |
|
| 280 | + $base=$dir; |
|
| 281 | 281 | } |
| 282 | 282 | return array($assets->getPublishedPath($base), $assets->publishFilePath($base)); |
| 283 | 283 | } |
| 284 | 284 | else |
| 285 | 285 | { |
| 286 | - return array($assets->getBasePath().str_replace($assets->getBaseUrl(),'',$base), $base); |
|
| 286 | + return array($assets->getBasePath().str_replace($assets->getBaseUrl(), '', $base), $base); |
|
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
@@ -293,10 +293,10 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | protected function getScriptPackageFolder($script) |
| 295 | 295 | { |
| 296 | - list($base, $subPath) = explode("/", $script, 2); |
|
| 296 | + list($base, $subPath)=explode("/", $script, 2); |
|
| 297 | 297 | |
| 298 | 298 | if(!array_key_exists($base, self::$_scriptsFolders)) |
| 299 | - throw new TInvalidOperationException('csmanager_pradostyle_invalid',$base); |
|
| 299 | + throw new TInvalidOperationException('csmanager_pradostyle_invalid', $base); |
|
| 300 | 300 | |
| 301 | 301 | return array(self::$_scriptsFolders[$base], $subPath); |
| 302 | 302 | } |
@@ -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,47 +449,47 @@ discard block |
||
| 449 | 449 | // $this->checkIfNotInRender(); |
| 450 | 450 | if(!isset($this->_registeredStyles[$name])) |
| 451 | 451 | { |
| 452 | - $base = $this->getPradoScriptAssetUrl(); |
|
| 452 | + $base=$this->getPradoScriptAssetUrl(); |
|
| 453 | 453 | |
| 454 | - if(self::$_styles === null) |
|
| 454 | + if(self::$_styles===null) |
|
| 455 | 455 | { |
| 456 | - $packageFile = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE; |
|
| 457 | - list($folders, $packages,$deps)= include($packageFile); |
|
| 458 | - self::$_stylesFolders = $folders; |
|
| 459 | - self::$_styles = $deps; |
|
| 460 | - self::$_stylesPackages = $packages; |
|
| 456 | + $packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE; |
|
| 457 | + list($folders, $packages, $deps)=include($packageFile); |
|
| 458 | + self::$_stylesFolders=$folders; |
|
| 459 | + self::$_styles=$deps; |
|
| 460 | + self::$_stylesPackages=$packages; |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - if (isset(self::$_styles[$name])) |
|
| 463 | + if(isset(self::$_styles[$name])) |
|
| 464 | 464 | $this->_registeredStyles[$name]=true; |
| 465 | 465 | else |
| 466 | - throw new TInvalidOperationException('csmanager_pradostyle_invalid',$name); |
|
| 466 | + throw new TInvalidOperationException('csmanager_pradostyle_invalid', $name); |
|
| 467 | 467 | |
| 468 | 468 | if(($packages=array_keys($this->_registeredStyles))!==array()) |
| 469 | 469 | { |
| 470 | 470 | $packagesUrl=array(); |
| 471 | 471 | $isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug; |
| 472 | - foreach ($packages as $p) |
|
| 472 | + foreach($packages as $p) |
|
| 473 | 473 | { |
| 474 | - foreach (self::$_styles[$p] as $dep) |
|
| 474 | + foreach(self::$_styles[$p] as $dep) |
|
| 475 | 475 | { |
| 476 | - foreach (self::$_stylesPackages[$dep] as $style) |
|
| 476 | + foreach(self::$_stylesPackages[$dep] as $style) |
|
| 477 | 477 | { |
| 478 | - if (!isset($this->_expandedStyles[$style])) |
|
| 478 | + if(!isset($this->_expandedStyles[$style])) |
|
| 479 | 479 | { |
| 480 | - list($base, $subPath) = $this->getStylePackageFolder($style); |
|
| 481 | - list($path, $baseUrl) = $this->getPackagePathUrl($base); |
|
| 480 | + list($base, $subPath)=$this->getStylePackageFolder($style); |
|
| 481 | + list($path, $baseUrl)=$this->getPackagePathUrl($base); |
|
| 482 | 482 | |
| 483 | - $this->_expandedStyles[$style] = true; |
|
| 483 | + $this->_expandedStyles[$style]=true; |
|
| 484 | 484 | // TODO minify css? |
| 485 | - if (!in_array($url=$baseUrl.'/'.$subPath, $packagesUrl)) |
|
| 485 | + if(!in_array($url=$baseUrl.'/'.$subPath, $packagesUrl)) |
|
| 486 | 486 | $packagesUrl[]=$url; |
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | foreach($packagesUrl as $url) |
| 492 | - $this->registerStyleSheetFile($url,$url); |
|
| 492 | + $this->registerStyleSheetFile($url, $url); |
|
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | } |
@@ -516,15 +516,15 @@ discard block |
||
| 516 | 516 | * @param string URL to the CSS file |
| 517 | 517 | * @param string media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types. |
| 518 | 518 | */ |
| 519 | - public function registerStyleSheetFile($key,$url,$media='') |
|
| 519 | + public function registerStyleSheetFile($key, $url, $media='') |
|
| 520 | 520 | { |
| 521 | 521 | if($media==='') |
| 522 | 522 | $this->_styleSheetFiles[$key]=$url; |
| 523 | 523 | else |
| 524 | - $this->_styleSheetFiles[$key]=array($url,$media); |
|
| 524 | + $this->_styleSheetFiles[$key]=array($url, $media); |
|
| 525 | 525 | |
| 526 | 526 | $params=func_get_args(); |
| 527 | - $this->_page->registerCachingAction('Page.ClientScript','registerStyleSheetFile',$params); |
|
| 527 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheetFile', $params); |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | /** |
@@ -532,12 +532,12 @@ discard block |
||
| 532 | 532 | * @param string a unique key identifying the CSS block |
| 533 | 533 | * @param string CSS block |
| 534 | 534 | */ |
| 535 | - public function registerStyleSheet($key,$css,$media='') |
|
| 535 | + public function registerStyleSheet($key, $css, $media='') |
|
| 536 | 536 | { |
| 537 | 537 | $this->_styleSheets[$key]=$css; |
| 538 | 538 | |
| 539 | 539 | $params=func_get_args(); |
| 540 | - $this->_page->registerCachingAction('Page.ClientScript','registerStyleSheet',$params); |
|
| 540 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheet', $params); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | /** |
@@ -546,17 +546,17 @@ discard block |
||
| 546 | 546 | */ |
| 547 | 547 | public function getStyleSheetUrls() |
| 548 | 548 | { |
| 549 | - $stylesheets = array_values( |
|
| 549 | + $stylesheets=array_values( |
|
| 550 | 550 | array_map(function($e) { |
| 551 | 551 | return is_array($e) ? $e[0] : $e; |
| 552 | 552 | }, $this->_styleSheetFiles) |
| 553 | 553 | ); |
| 554 | 554 | |
| 555 | 555 | foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) |
| 556 | - if (substr($url,strlen($url)-4)=='.css') |
|
| 557 | - $stylesheets[] = $url; |
|
| 556 | + if(substr($url, strlen($url) - 4)=='.css') |
|
| 557 | + $stylesheets[]=$url; |
|
| 558 | 558 | |
| 559 | - $stylesheets = array_unique($stylesheets); |
|
| 559 | + $stylesheets=array_unique($stylesheets); |
|
| 560 | 560 | |
| 561 | 561 | return $stylesheets; |
| 562 | 562 | } |
@@ -575,13 +575,13 @@ discard block |
||
| 575 | 575 | * @param string a unique key identifying the file |
| 576 | 576 | * @param string URL to the javascript file |
| 577 | 577 | */ |
| 578 | - public function registerHeadScriptFile($key,$url) |
|
| 578 | + public function registerHeadScriptFile($key, $url) |
|
| 579 | 579 | { |
| 580 | 580 | $this->checkIfNotInRender(); |
| 581 | 581 | $this->_headScriptFiles[$key]=$url; |
| 582 | 582 | |
| 583 | 583 | $params=func_get_args(); |
| 584 | - $this->_page->registerCachingAction('Page.ClientScript','registerHeadScriptFile',$params); |
|
| 584 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScriptFile', $params); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -589,13 +589,13 @@ discard block |
||
| 589 | 589 | * @param string a unique key identifying the script block |
| 590 | 590 | * @param string javascript block |
| 591 | 591 | */ |
| 592 | - public function registerHeadScript($key,$script) |
|
| 592 | + public function registerHeadScript($key, $script) |
|
| 593 | 593 | { |
| 594 | 594 | $this->checkIfNotInRender(); |
| 595 | 595 | $this->_headScripts[$key]=$script; |
| 596 | 596 | |
| 597 | 597 | $params=func_get_args(); |
| 598 | - $this->_page->registerCachingAction('Page.ClientScript','registerHeadScript',$params); |
|
| 598 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScript', $params); |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | /** |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | $this->_scriptFiles[$key]=$url; |
| 609 | 609 | |
| 610 | 610 | $params=func_get_args(); |
| 611 | - $this->_page->registerCachingAction('Page.ClientScript','registerScriptFile',$params); |
|
| 611 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerScriptFile', $params); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | /** |
@@ -616,13 +616,13 @@ discard block |
||
| 616 | 616 | * @param string a unique key identifying the script block |
| 617 | 617 | * @param string javascript block |
| 618 | 618 | */ |
| 619 | - public function registerBeginScript($key,$script) |
|
| 619 | + public function registerBeginScript($key, $script) |
|
| 620 | 620 | { |
| 621 | 621 | $this->checkIfNotInRender(); |
| 622 | 622 | $this->_beginScripts[$key]=$script; |
| 623 | 623 | |
| 624 | 624 | $params=func_get_args(); |
| 625 | - $this->_page->registerCachingAction('Page.ClientScript','registerBeginScript',$params); |
|
| 625 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerBeginScript', $params); |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | /** |
@@ -630,12 +630,12 @@ discard block |
||
| 630 | 630 | * @param string a unique key identifying the script block |
| 631 | 631 | * @param string javascript block |
| 632 | 632 | */ |
| 633 | - public function registerEndScript($key,$script) |
|
| 633 | + public function registerEndScript($key, $script) |
|
| 634 | 634 | { |
| 635 | 635 | $this->_endScripts[$key]=$script; |
| 636 | 636 | |
| 637 | 637 | $params=func_get_args(); |
| 638 | - $this->_page->registerCachingAction('Page.ClientScript','registerEndScript',$params); |
|
| 638 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerEndScript', $params); |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /** |
@@ -644,12 +644,12 @@ discard block |
||
| 644 | 644 | * @param string|array hidden field value, if the value is an array, every element |
| 645 | 645 | * in the array will be rendered as a hidden field value. |
| 646 | 646 | */ |
| 647 | - public function registerHiddenField($name,$value) |
|
| 647 | + public function registerHiddenField($name, $value) |
|
| 648 | 648 | { |
| 649 | 649 | $this->_hiddenFields[$name]=$value; |
| 650 | 650 | |
| 651 | 651 | $params=func_get_args(); |
| 652 | - $this->_page->registerCachingAction('Page.ClientScript','registerHiddenField',$params); |
|
| 652 | + $this->_page->registerCachingAction('Page.ClientScript', 'registerHiddenField', $params); |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | /** |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | public function renderStyleSheets($writer) |
| 763 | 763 | { |
| 764 | 764 | if(count($this->_styleSheets)) |
| 765 | - $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n",$this->_styleSheets)."\n/*]]>*/\n</style>\n"); |
|
| 765 | + $writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n", $this->_styleSheets)."\n/*]]>*/\n</style>\n"); |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | /** |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | */ |
| 771 | 771 | public function renderHeadScriptFiles($writer) |
| 772 | 772 | { |
| 773 | - $this->renderScriptFiles($writer,$this->_headScriptFiles); |
|
| 773 | + $this->renderScriptFiles($writer, $this->_headScriptFiles); |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | /** |
@@ -793,9 +793,9 @@ discard block |
||
| 793 | 793 | |
| 794 | 794 | public function markScriptFileAsRendered($url) |
| 795 | 795 | { |
| 796 | - $this->_renderedScriptFiles[$url] = $url; |
|
| 796 | + $this->_renderedScriptFiles[$url]=$url; |
|
| 797 | 797 | $params=func_get_args(); |
| 798 | - $this->_page->registerCachingAction('Page.ClientScript','markScriptFileAsRendered',$params); |
|
| 798 | + $this->_page->registerCachingAction('Page.ClientScript', 'markScriptFileAsRendered', $params); |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | protected function renderScriptFiles($writer, Array $scripts) |
@@ -819,8 +819,8 @@ discard block |
||
| 819 | 819 | { |
| 820 | 820 | if(!empty($this->_scriptFiles)) |
| 821 | 821 | { |
| 822 | - $addedScripts = array_diff($this->_scriptFiles,$this->getRenderedScriptFiles()); |
|
| 823 | - $this->renderScriptFiles($writer,$addedScripts); |
|
| 822 | + $addedScripts=array_diff($this->_scriptFiles, $this->getRenderedScriptFiles()); |
|
| 823 | + $this->renderScriptFiles($writer, $addedScripts); |
|
| 824 | 824 | } |
| 825 | 825 | } |
| 826 | 826 | |
@@ -858,12 +858,12 @@ discard block |
||
| 858 | 858 | |
| 859 | 859 | public function renderHiddenFieldsBegin($writer) |
| 860 | 860 | { |
| 861 | - $this->renderHiddenFieldsInt($writer,true); |
|
| 861 | + $this->renderHiddenFieldsInt($writer, true); |
|
| 862 | 862 | } |
| 863 | 863 | |
| 864 | 864 | public function renderHiddenFieldsEnd($writer) |
| 865 | 865 | { |
| 866 | - $this->renderHiddenFieldsInt($writer,false); |
|
| 866 | + $this->renderHiddenFieldsInt($writer, false); |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | /** |
@@ -885,12 +885,12 @@ discard block |
||
| 885 | 885 | */ |
| 886 | 886 | protected function renderHiddenFieldsInt($writer, $initial) |
| 887 | 887 | { |
| 888 | - if ($initial) $this->_renderedHiddenFields = array(); |
|
| 888 | + if($initial) $this->_renderedHiddenFields=array(); |
|
| 889 | 889 | $str=''; |
| 890 | 890 | foreach($this->_hiddenFields as $name=>$value) |
| 891 | 891 | { |
| 892 | - if (in_array($name,$this->_renderedHiddenFields)) continue; |
|
| 893 | - $id=strtr($name,':','_'); |
|
| 892 | + if(in_array($name, $this->_renderedHiddenFields)) continue; |
|
| 893 | + $id=strtr($name, ':', '_'); |
|
| 894 | 894 | if(is_array($value)) |
| 895 | 895 | { |
| 896 | 896 | foreach($value as $v) |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | { |
| 901 | 901 | $str.='<input type="hidden" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; |
| 902 | 902 | } |
| 903 | - $this->_renderedHiddenFields[] = $name; |
|
| 903 | + $this->_renderedHiddenFields[]=$name; |
|
| 904 | 904 | } |
| 905 | 905 | if($str!=='') |
| 906 | 906 | $writer->write("<div style=\"visibility:hidden;\">\n".$str."</div>\n"); |
@@ -916,7 +916,7 @@ discard block |
||
| 916 | 916 | */ |
| 917 | 917 | protected function checkIfNotInRender() |
| 918 | 918 | { |
| 919 | - if ($form = $this->_page->InFormRender) |
|
| 919 | + if($form=$this->_page->InFormRender) |
|
| 920 | 920 | throw new \Exception('Operation invalid when page is already rendering'); |
| 921 | 921 | } |
| 922 | 922 | } |