@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | protected function registerStyleSheet() |
| 145 | 145 | { |
| 146 | 146 | $cs=$this->getPage()->getClientScript(); |
| 147 | - $cssFile=Prado::getPathOfNamespace('Vendor.bower-asset.highlightjs.styles.'.$this->getSyntaxStyle(),'.css'); |
|
| 147 | + $cssFile=Prado::getPathOfNamespace('Vendor.bower-asset.highlightjs.styles.'.$this->getSyntaxStyle(), '.css'); |
|
| 148 | 148 | $cssKey='prado:TTextHighlighter:'.$cssFile; |
| 149 | 149 | if(!$cs->isStyleSheetFileRegistered($cssKey)) |
| 150 | 150 | $cs->registerStyleSheetFile($cssKey, $this->publishFilePath($cssFile)); |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | protected function getTextHighlightOptions() |
| 158 | 158 | { |
| 159 | - $options = array(); |
|
| 160 | - $options['ID'] = $this->getClientID(); |
|
| 161 | - $options['tabsize'] = str_repeat(' ', $this->getTabSize()); |
|
| 162 | - $options['copycode'] = $this->getEnableCopyCode(); |
|
| 163 | - $options['linenum'] = $this->getShowLineNumbers(); |
|
| 159 | + $options=array(); |
|
| 160 | + $options['ID']=$this->getClientID(); |
|
| 161 | + $options['tabsize']=str_repeat(' ', $this->getTabSize()); |
|
| 162 | + $options['copycode']=$this->getEnableCopyCode(); |
|
| 163 | + $options['linenum']=$this->getShowLineNumbers(); |
|
| 164 | 164 | |
| 165 | 165 | return $options; |
| 166 | 166 | } |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | protected function renderClientControlScript($writer) |
| 194 | 194 | { |
| 195 | - $cs = $this->getPage()->getClientScript(); |
|
| 195 | + $cs=$this->getPage()->getClientScript(); |
|
| 196 | 196 | $cs->registerPradoScript('texthighlight'); |
| 197 | 197 | |
| 198 | - $options = TJavaScript::encode($this->getTextHighlightOptions()); |
|
| 199 | - $code = "new Prado.WebUI.TTextHighlighter($options);"; |
|
| 198 | + $options=TJavaScript::encode($this->getTextHighlightOptions()); |
|
| 199 | + $code="new Prado.WebUI.TTextHighlighter($options);"; |
|
| 200 | 200 | $cs->registerEndScript("prado:".$this->getClientID(), $code); |
| 201 | 201 | |
| 202 | 202 | } |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | * Defines the default permission for writable directories and files |
| 30 | 30 | */ |
| 31 | 31 | if(!defined('PRADO_CHMOD')) |
| 32 | - define('PRADO_CHMOD',0777); |
|
| 32 | + define('PRADO_CHMOD', 0777); |
|
| 33 | 33 | /** |
| 34 | 34 | * Defines the Composer's vendor/ path. |
| 35 | 35 | */ |
| 36 | 36 | if(!defined('PRADO_VENDORDIR')) |
| 37 | 37 | { |
| 38 | - $reflector = new \ReflectionClass('\Composer\Autoload\ClassLoader'); |
|
| 39 | - define('PRADO_VENDORDIR',dirname(dirname($reflector->getFileName()))); |
|
| 38 | + $reflector=new \ReflectionClass('\Composer\Autoload\ClassLoader'); |
|
| 39 | + define('PRADO_VENDORDIR', dirname(dirname($reflector->getFileName()))); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * @var array list of class exists checks |
| 89 | 89 | */ |
| 90 | - protected static $classExists = array(); |
|
| 90 | + protected static $classExists=array(); |
|
| 91 | 91 | /** |
| 92 | 92 | * @return string the version of Prado framework |
| 93 | 93 | */ |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public static function initAutoloader() |
| 109 | 109 | { |
| 110 | - self::$classMap = require(__DIR__ . '/classes.php'); |
|
| 110 | + self::$classMap=require(__DIR__.'/classes.php'); |
|
| 111 | 111 | |
| 112 | 112 | spl_autoload_register(array(get_called_class(), 'autoload')); |
| 113 | 113 | } |
@@ -122,15 +122,15 @@ discard block |
||
| 122 | 122 | /** |
| 123 | 123 | * Sets error handler to be Prado::phpErrorHandler |
| 124 | 124 | */ |
| 125 | - set_error_handler(array('\Prado\PradoBase','phpErrorHandler')); |
|
| 125 | + set_error_handler(array('\Prado\PradoBase', 'phpErrorHandler')); |
|
| 126 | 126 | /** |
| 127 | 127 | * Sets shutdown function to be Prado::phpFatalErrorHandler |
| 128 | 128 | */ |
| 129 | - register_shutdown_function(array('PradoBase','phpFatalErrorHandler')); |
|
| 129 | + register_shutdown_function(array('PradoBase', 'phpFatalErrorHandler')); |
|
| 130 | 130 | /** |
| 131 | 131 | * Sets exception handler to be Prado::exceptionHandler |
| 132 | 132 | */ |
| 133 | - set_exception_handler(array('\Prado\PradoBase','exceptionHandler')); |
|
| 133 | + set_exception_handler(array('\Prado\PradoBase', 'exceptionHandler')); |
|
| 134 | 134 | /** |
| 135 | 135 | * Disable php's builtin error reporting to avoid duplicated reports |
| 136 | 136 | */ |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public static function poweredByPrado($logoType=0) |
| 155 | 155 | { |
| 156 | - $logoName=$logoType==1?'powered2':'powered'; |
|
| 156 | + $logoName=$logoType==1 ? 'powered2' : 'powered'; |
|
| 157 | 157 | if(self::$_application!==null) |
| 158 | 158 | { |
| 159 | 159 | $am=self::$_application->getAssetManager(); |
| 160 | - $url=$am->publishFilePath(self::getPathOfNamespace('Prado\\'.$logoName,'.gif')); |
|
| 160 | + $url=$am->publishFilePath(self::getPathOfNamespace('Prado\\'.$logoName, '.gif')); |
|
| 161 | 161 | } |
| 162 | 162 | else |
| 163 | 163 | $url='http://pradosoft.github.io/docs/'.$logoName.'.gif'; |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | * @param string the filename that the error was raised in |
| 175 | 175 | * @param integer the line number the error was raised at |
| 176 | 176 | */ |
| 177 | - public static function phpErrorHandler($errno,$errstr,$errfile,$errline) |
|
| 177 | + public static function phpErrorHandler($errno, $errstr, $errfile, $errline) |
|
| 178 | 178 | { |
| 179 | 179 | if(error_reporting() & $errno) |
| 180 | - throw new TPhpErrorException($errno,$errstr,$errfile,$errline); |
|
| 180 | + throw new TPhpErrorException($errno, $errstr, $errfile, $errline); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public static function phpFatalErrorHandler() |
| 190 | 190 | { |
| 191 | - $error = error_get_last(); |
|
| 191 | + $error=error_get_last(); |
|
| 192 | 192 | if($error && |
| 193 | 193 | TPhpErrorException::isFatalError($error) && |
| 194 | 194 | error_reporting() & $error['type']) |
| 195 | 195 | { |
| 196 | - self::exceptionHandler(new TPhpErrorException($error['type'],$error['message'],$error['file'],$error['line'])); |
|
| 196 | + self::exceptionHandler(new TPhpErrorException($error['type'], $error['message'], $error['file'], $error['line'])); |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null) |
| 212 | 212 | { |
| 213 | - $errorHandler->handleError(null,$exception); |
|
| 213 | + $errorHandler->handleError(null, $exception); |
|
| 214 | 214 | } |
| 215 | 215 | else |
| 216 | 216 | { |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | protected static function prado3NamespaceToPhpNamespace($type) |
| 261 | 261 | { |
| 262 | - if(substr($type, 0, 6) === 'System') |
|
| 262 | + if(substr($type, 0, 6)==='System') |
|
| 263 | 263 | $type='Prado'.substr($type, 6); |
| 264 | 264 | |
| 265 | - if(false === strpos($type, '\\')) |
|
| 265 | + if(false===strpos($type, '\\')) |
|
| 266 | 266 | return str_replace('.', '\\', $type); |
| 267 | 267 | else |
| 268 | 268 | return $type; |
@@ -283,13 +283,13 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public static function createComponent($requestedType) |
| 285 | 285 | { |
| 286 | - $type = static::prado3NamespaceToPhpNamespace($requestedType); |
|
| 286 | + $type=static::prado3NamespaceToPhpNamespace($requestedType); |
|
| 287 | 287 | if(!isset(self::$classExists[$type])) |
| 288 | - self::$classExists[$type] = class_exists($type, false); |
|
| 288 | + self::$classExists[$type]=class_exists($type, false); |
|
| 289 | 289 | |
| 290 | - if( !isset(self::$_usings[$type]) && !self::$classExists[$type]) { |
|
| 290 | + if(!isset(self::$_usings[$type]) && !self::$classExists[$type]) { |
|
| 291 | 291 | static::using($type); |
| 292 | - self::$classExists[$type] = class_exists($type, false); |
|
| 292 | + self::$classExists[$type]=class_exists($type, false); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /* |
@@ -299,12 +299,12 @@ discard block |
||
| 299 | 299 | * \Application\Common\MyDataModule) |
| 300 | 300 | * Skip this if the class is inside the Prado\* namespace, since all Prado classes are now namespaced |
| 301 | 301 | */ |
| 302 | - if( ($pos = strrpos($type, '\\')) !== false && ($requestedType != $type) && strpos($type, 'Prado\\') !== 0) |
|
| 303 | - $type = substr($type,$pos+1); |
|
| 302 | + if(($pos=strrpos($type, '\\'))!==false && ($requestedType!=$type) && strpos($type, 'Prado\\')!==0) |
|
| 303 | + $type=substr($type, $pos + 1); |
|
| 304 | 304 | |
| 305 | - if(($n=func_num_args())>1) |
|
| 305 | + if(($n=func_num_args()) > 1) |
|
| 306 | 306 | { |
| 307 | - $args = func_get_args(); |
|
| 307 | + $args=func_get_args(); |
|
| 308 | 308 | switch($n) { |
| 309 | 309 | case 2: |
| 310 | 310 | return new $type($args[1]); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | break; |
| 321 | 321 | default: |
| 322 | 322 | $s='$args[1]'; |
| 323 | - for($i=2;$i<$n;++$i) |
|
| 323 | + for($i=2; $i < $n; ++$i) |
|
| 324 | 324 | $s.=",\$args[$i]"; |
| 325 | 325 | eval("\$component=new $type($s);"); |
| 326 | 326 | return $component; |
@@ -340,31 +340,31 @@ discard block |
||
| 340 | 340 | * @param boolean whether to check the existence of the class after the class file is included |
| 341 | 341 | * @throws TInvalidDataValueException if the namespace is invalid |
| 342 | 342 | */ |
| 343 | - public static function using($namespace,$checkClassExistence=true) |
|
| 343 | + public static function using($namespace, $checkClassExistence=true) |
|
| 344 | 344 | { |
| 345 | - $namespace = static::prado3NamespaceToPhpNamespace($namespace); |
|
| 345 | + $namespace=static::prado3NamespaceToPhpNamespace($namespace); |
|
| 346 | 346 | |
| 347 | - if(isset(self::$_usings[$namespace]) || class_exists($namespace,false)) |
|
| 347 | + if(isset(self::$_usings[$namespace]) || class_exists($namespace, false)) |
|
| 348 | 348 | return; |
| 349 | 349 | |
| 350 | 350 | if(array_key_exists($namespace, self::$classMap)) |
| 351 | 351 | { |
| 352 | 352 | // fast autoload a Prado3 class name |
| 353 | - $phpNamespace = self::$classMap[$namespace]; |
|
| 353 | + $phpNamespace=self::$classMap[$namespace]; |
|
| 354 | 354 | if(class_exists($phpNamespace, true) || interface_exists($phpNamespace, true)) |
| 355 | 355 | { |
| 356 | 356 | if(!class_exists($namespace) && !interface_exists($namespace)) |
| 357 | 357 | class_alias($phpNamespace, $namespace, true); |
| 358 | 358 | return; |
| 359 | 359 | } |
| 360 | - } elseif(($pos=strrpos($namespace,'\\'))===false) { |
|
| 360 | + } elseif(($pos=strrpos($namespace, '\\'))===false) { |
|
| 361 | 361 | // trying to autoload an old class name |
| 362 | 362 | foreach(self::$_usings as $k => $v) |
| 363 | 363 | { |
| 364 | - $path = $v . DIRECTORY_SEPARATOR . $namespace . self::CLASS_FILE_EXT; |
|
| 364 | + $path=$v.DIRECTORY_SEPARATOR.$namespace.self::CLASS_FILE_EXT; |
|
| 365 | 365 | if(file_exists($path)) |
| 366 | 366 | { |
| 367 | - $phpNamespace = '\\'. $k.'\\'.$namespace; |
|
| 367 | + $phpNamespace='\\'.$k.'\\'.$namespace; |
|
| 368 | 368 | if(class_exists($phpNamespace, true) || interface_exists($phpNamespace, true)) |
| 369 | 369 | { |
| 370 | 370 | if(!class_exists($namespace) && !interface_exists($namespace)) |
@@ -374,10 +374,10 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - if($checkClassExistence && !class_exists($namespace,false) && !interface_exists($namespace,false)) |
|
| 378 | - throw new TInvalidOperationException('prado_component_unknown',$namespace,''); |
|
| 379 | - } elseif(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null) { |
|
| 380 | - $className=substr($namespace,$pos+1); |
|
| 377 | + if($checkClassExistence && !class_exists($namespace, false) && !interface_exists($namespace, false)) |
|
| 378 | + throw new TInvalidOperationException('prado_component_unknown', $namespace, ''); |
|
| 379 | + } elseif(($path=self::getPathOfNamespace($namespace, self::CLASS_FILE_EXT))!==null) { |
|
| 380 | + $className=substr($namespace, $pos + 1); |
|
| 381 | 381 | if($className==='*') // a directory |
| 382 | 382 | { |
| 383 | 383 | self::$_usings[substr($namespace, 0, $pos)]=$path; |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | else // a file |
| 386 | 386 | { |
| 387 | 387 | //self::$_usings[$namespace]=$path; |
| 388 | - if(!$checkClassExistence || (!class_exists($className,false) && !interface_exists($className, false))) |
|
| 388 | + if(!$checkClassExistence || (!class_exists($className, false) && !interface_exists($className, false))) |
|
| 389 | 389 | { |
| 390 | 390 | try |
| 391 | 391 | { |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | catch(\Exception $e) |
| 397 | 397 | { |
| 398 | - if($checkClassExistence && !class_exists($className,false)) |
|
| 399 | - throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage()); |
|
| 398 | + if($checkClassExistence && !class_exists($className, false)) |
|
| 399 | + throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage()); |
|
| 400 | 400 | else |
| 401 | 401 | throw $e; |
| 402 | 402 | } |
@@ -419,9 +419,9 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public static function getPathOfNamespace($namespace, $ext='') |
| 421 | 421 | { |
| 422 | - $namespace = static::prado3NamespaceToPhpNamespace($namespace); |
|
| 422 | + $namespace=static::prado3NamespaceToPhpNamespace($namespace); |
|
| 423 | 423 | |
| 424 | - if(self::CLASS_FILE_EXT === $ext || empty($ext)) |
|
| 424 | + if(self::CLASS_FILE_EXT===$ext || empty($ext)) |
|
| 425 | 425 | { |
| 426 | 426 | if(isset(self::$_usings[$namespace])) |
| 427 | 427 | return self::$_usings[$namespace]; |
@@ -430,11 +430,11 @@ discard block |
||
| 430 | 430 | return self::$_aliases[$namespace]; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - $segs = explode('\\',$namespace); |
|
| 434 | - $alias = array_shift($segs); |
|
| 433 | + $segs=explode('\\', $namespace); |
|
| 434 | + $alias=array_shift($segs); |
|
| 435 | 435 | |
| 436 | - if(null !== ($file = array_pop($segs)) && null !== ($root = self::getPathOfAlias($alias))) |
|
| 437 | - return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR ,$segs),'/\\').(($file === '*') ? '' : DIRECTORY_SEPARATOR.$file.$ext); |
|
| 436 | + if(null!==($file=array_pop($segs)) && null!==($root=self::getPathOfAlias($alias))) |
|
| 437 | + return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $segs), '/\\').(($file==='*') ? '' : DIRECTORY_SEPARATOR.$file.$ext); |
|
| 438 | 438 | |
| 439 | 439 | return null; |
| 440 | 440 | } |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | */ |
| 446 | 446 | public static function getPathOfAlias($alias) |
| 447 | 447 | { |
| 448 | - return isset(self::$_aliases[$alias])?self::$_aliases[$alias]:null; |
|
| 448 | + return isset(self::$_aliases[$alias]) ? self::$_aliases[$alias] : null; |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | protected static function getPathAliases() |
@@ -459,19 +459,19 @@ discard block |
||
| 459 | 459 | * @throws TInvalidOperationException if the alias is already defined |
| 460 | 460 | * @throws TInvalidDataValueException if the path is not a valid file path |
| 461 | 461 | */ |
| 462 | - public static function setPathOfAlias($alias,$path) |
|
| 462 | + public static function setPathOfAlias($alias, $path) |
|
| 463 | 463 | { |
| 464 | 464 | if(isset(self::$_aliases[$alias]) && !defined('PRADO_TEST_RUN')) |
| 465 | - throw new TInvalidOperationException('prado_alias_redefined',$alias); |
|
| 465 | + throw new TInvalidOperationException('prado_alias_redefined', $alias); |
|
| 466 | 466 | else if(($rp=realpath($path))!==false && is_dir($rp)) |
| 467 | 467 | { |
| 468 | - if(strpos($alias,'.')===false) |
|
| 468 | + if(strpos($alias, '.')===false) |
|
| 469 | 469 | self::$_aliases[$alias]=$rp; |
| 470 | 470 | else |
| 471 | - throw new TInvalidDataValueException('prado_aliasname_invalid',$alias); |
|
| 471 | + throw new TInvalidDataValueException('prado_aliasname_invalid', $alias); |
|
| 472 | 472 | } |
| 473 | 473 | else |
| 474 | - throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path); |
|
| 474 | + throw new TInvalidDataValueException('prado_alias_invalid', $alias, $path); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | /** |
@@ -496,13 +496,13 @@ discard block |
||
| 496 | 496 | continue; |
| 497 | 497 | echo '#'.$index.' '; |
| 498 | 498 | if(isset($t['file'])) |
| 499 | - echo basename($t['file']) . ':' . $t['line']; |
|
| 499 | + echo basename($t['file']).':'.$t['line']; |
|
| 500 | 500 | else |
| 501 | 501 | echo '<PHP inner-code>'; |
| 502 | 502 | echo ' -- '; |
| 503 | 503 | if(isset($t['class'])) |
| 504 | - echo $t['class'] . $t['type']; |
|
| 505 | - echo $t['function'] . '('; |
|
| 504 | + echo $t['class'].$t['type']; |
|
| 505 | + echo $t['function'].'('; |
|
| 506 | 506 | if(isset($t['args']) && sizeof($t['args']) > 0) |
| 507 | 507 | { |
| 508 | 508 | $count=0; |
@@ -511,25 +511,25 @@ discard block |
||
| 511 | 511 | if(is_string($item)) |
| 512 | 512 | { |
| 513 | 513 | $str=htmlentities(str_replace("\r\n", "", $item), ENT_QUOTES); |
| 514 | - if (strlen($item) > 70) |
|
| 515 | - echo "'". substr($str, 0, 70) . "...'"; |
|
| 514 | + if(strlen($item) > 70) |
|
| 515 | + echo "'".substr($str, 0, 70)."...'"; |
|
| 516 | 516 | else |
| 517 | - echo "'" . $str . "'"; |
|
| 517 | + echo "'".$str."'"; |
|
| 518 | 518 | } |
| 519 | - else if (is_int($item) || is_float($item)) |
|
| 519 | + else if(is_int($item) || is_float($item)) |
|
| 520 | 520 | echo $item; |
| 521 | - else if (is_object($item)) |
|
| 521 | + else if(is_object($item)) |
|
| 522 | 522 | echo get_class($item); |
| 523 | - else if (is_array($item)) |
|
| 524 | - echo 'array(' . count($item) . ')'; |
|
| 525 | - else if (is_bool($item)) |
|
| 523 | + else if(is_array($item)) |
|
| 524 | + echo 'array('.count($item).')'; |
|
| 525 | + else if(is_bool($item)) |
|
| 526 | 526 | echo $item ? 'true' : 'false'; |
| 527 | - else if ($item === null) |
|
| 527 | + else if($item===null) |
|
| 528 | 528 | echo 'NULL'; |
| 529 | - else if (is_resource($item)) |
|
| 529 | + else if(is_resource($item)) |
|
| 530 | 530 | echo get_resource_type($item); |
| 531 | 531 | $count++; |
| 532 | - if (count($t['args']) > $count) |
|
| 532 | + if(count($t['args']) > $count) |
|
| 533 | 533 | echo ', '; |
| 534 | 534 | } |
| 535 | 535 | } |
@@ -556,10 +556,10 @@ discard block |
||
| 556 | 556 | else |
| 557 | 557 | { |
| 558 | 558 | $languages=array(); |
| 559 | - foreach(explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language) |
|
| 559 | + foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language) |
|
| 560 | 560 | { |
| 561 | - $array=explode(';q=',trim($language)); |
|
| 562 | - $languages[trim($array[0])]=isset($array[1])?(float)$array[1]:1.0; |
|
| 561 | + $array=explode(';q=', trim($language)); |
|
| 562 | + $languages[trim($array[0])]=isset($array[1]) ? (float) $array[1] : 1.0; |
|
| 563 | 563 | } |
| 564 | 564 | arsort($languages); |
| 565 | 565 | $languages=array_keys($languages); |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | if($language===null) |
| 581 | 581 | { |
| 582 | 582 | $langs=Prado::getUserLanguages(); |
| 583 | - $lang=explode('-',$langs[0]); |
|
| 583 | + $lang=explode('-', $langs[0]); |
|
| 584 | 584 | if(empty($lang[0]) || !ctype_alpha($lang[0])) |
| 585 | 585 | $language='en'; |
| 586 | 586 | else |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | * @param (string|TControl) control of the message |
| 602 | 602 | * @see log, getLogger |
| 603 | 603 | */ |
| 604 | - public static function trace($msg,$category='Uncategorized',$ctl=null) |
|
| 604 | + public static function trace($msg, $category='Uncategorized', $ctl=null) |
|
| 605 | 605 | { |
| 606 | 606 | if(self::$_application && self::$_application->getMode()===TApplicationMode::Performance) |
| 607 | 607 | return; |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | } |
| 615 | 615 | else |
| 616 | 616 | $level=TLogger::INFO; |
| 617 | - self::log($msg,$level,$category,$ctl); |
|
| 617 | + self::log($msg, $level, $category, $ctl); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | /** |
@@ -629,11 +629,11 @@ discard block |
||
| 629 | 629 | * @param string category of the message |
| 630 | 630 | * @param (string|TControl) control of the message |
| 631 | 631 | */ |
| 632 | - public static function log($msg,$level=TLogger::INFO,$category='Uncategorized',$ctl=null) |
|
| 632 | + public static function log($msg, $level=TLogger::INFO, $category='Uncategorized', $ctl=null) |
|
| 633 | 633 | { |
| 634 | 634 | if(self::$_logger===null) |
| 635 | 635 | self::$_logger=new TLogger; |
| 636 | - self::$_logger->log($msg,$level,$category,$ctl); |
|
| 636 | + self::$_logger->log($msg, $level, $category, $ctl); |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | /** |
@@ -655,9 +655,9 @@ discard block |
||
| 655 | 655 | * @param boolean whether to syntax highlight the output. Defaults to false. |
| 656 | 656 | * @return string the string representation of the variable |
| 657 | 657 | */ |
| 658 | - public static function varDump($var,$depth=10,$highlight=false) |
|
| 658 | + public static function varDump($var, $depth=10, $highlight=false) |
|
| 659 | 659 | { |
| 660 | - return TVarDumper::dump($var,$depth,$highlight); |
|
| 660 | + return TVarDumper::dump($var, $depth, $highlight); |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | /** |
@@ -672,31 +672,31 @@ discard block |
||
| 672 | 672 | */ |
| 673 | 673 | public static function localize($text, $parameters=array(), $catalogue=null, $charset=null) |
| 674 | 674 | { |
| 675 | - $app = Prado::getApplication()->getGlobalization(false); |
|
| 675 | + $app=Prado::getApplication()->getGlobalization(false); |
|
| 676 | 676 | |
| 677 | - $params = array(); |
|
| 677 | + $params=array(); |
|
| 678 | 678 | foreach($parameters as $key => $value) |
| 679 | - $params['{'.$key.'}'] = $value; |
|
| 679 | + $params['{'.$key.'}']=$value; |
|
| 680 | 680 | |
| 681 | 681 | //no translation handler provided |
| 682 | - if($app===null || ($config = $app->getTranslationConfiguration())===null) |
|
| 682 | + if($app===null || ($config=$app->getTranslationConfiguration())===null) |
|
| 683 | 683 | return strtr($text, $params); |
| 684 | 684 | |
| 685 | - if ($catalogue===null) |
|
| 686 | - $catalogue=isset($config['catalogue'])?$config['catalogue']:'messages'; |
|
| 685 | + if($catalogue===null) |
|
| 686 | + $catalogue=isset($config['catalogue']) ? $config['catalogue'] : 'messages'; |
|
| 687 | 687 | |
| 688 | 688 | Translation::init($catalogue); |
| 689 | 689 | |
| 690 | 690 | //globalization charset |
| 691 | - $appCharset = $app===null ? '' : $app->getCharset(); |
|
| 691 | + $appCharset=$app===null ? '' : $app->getCharset(); |
|
| 692 | 692 | |
| 693 | 693 | //default charset |
| 694 | - $defaultCharset = ($app===null) ? 'UTF-8' : $app->getDefaultCharset(); |
|
| 694 | + $defaultCharset=($app===null) ? 'UTF-8' : $app->getDefaultCharset(); |
|
| 695 | 695 | |
| 696 | 696 | //fall back |
| 697 | - if(empty($charset)) $charset = $appCharset; |
|
| 698 | - if(empty($charset)) $charset = $defaultCharset; |
|
| 697 | + if(empty($charset)) $charset=$appCharset; |
|
| 698 | + if(empty($charset)) $charset=$defaultCharset; |
|
| 699 | 699 | |
| 700 | - return Translation::formatter($catalogue)->format($text,$params,$catalogue,$charset); |
|
| 700 | + return Translation::formatter($catalogue)->format($text, $params, $catalogue, $charset); |
|
| 701 | 701 | } |
| 702 | 702 | } |