@@ -29,7 +29,7 @@ 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 | /** |
35 | 35 | * PradoBase class. |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * @var array list of class exists checks |
75 | 75 | */ |
76 | - protected static $classExists = array(); |
|
76 | + protected static $classExists=array(); |
|
77 | 77 | /** |
78 | 78 | * @var Autoloader instance |
79 | 79 | */ |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public static function initAutoloader() |
99 | 99 | { |
100 | - $autoloadPaths = array( |
|
101 | - __DIR__ . '/../../../autoload.php', // prado as dependency |
|
102 | - __DIR__ . '/../vendor/autoload.php', // prado itself |
|
100 | + $autoloadPaths=array( |
|
101 | + __DIR__.'/../../../autoload.php', // prado as dependency |
|
102 | + __DIR__.'/../vendor/autoload.php', // prado itself |
|
103 | 103 | ); |
104 | 104 | foreach($autoloadPaths as $autoloadPath) |
105 | 105 | if(file_exists($autoloadPath)) { |
106 | - self::$_loader = $autoloadPath; |
|
106 | + self::$_loader=$autoloadPath; |
|
107 | 107 | break; |
108 | 108 | } |
109 | 109 | |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * Sets error handler to be Prado::phpErrorHandler |
122 | 122 | */ |
123 | - set_error_handler(array('\Prado\PradoBase','phpErrorHandler')); |
|
123 | + set_error_handler(array('\Prado\PradoBase', 'phpErrorHandler')); |
|
124 | 124 | /** |
125 | 125 | * Sets shutdown function to be Prado::phpFatalErrorHandler |
126 | 126 | */ |
127 | - register_shutdown_function(array('PradoBase','phpFatalErrorHandler')); |
|
127 | + register_shutdown_function(array('PradoBase', 'phpFatalErrorHandler')); |
|
128 | 128 | /** |
129 | 129 | * Sets exception handler to be Prado::exceptionHandler |
130 | 130 | */ |
131 | - set_exception_handler(array('\Prado\PradoBase','exceptionHandler')); |
|
131 | + set_exception_handler(array('\Prado\PradoBase', 'exceptionHandler')); |
|
132 | 132 | /** |
133 | 133 | * Disable php's builtin error reporting to avoid duplicated reports |
134 | 134 | */ |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public static function poweredByPrado($logoType=0) |
161 | 161 | { |
162 | - $logoName=$logoType==1?'powered2':'powered'; |
|
162 | + $logoName=$logoType==1 ? 'powered2' : 'powered'; |
|
163 | 163 | if(self::$_application!==null) |
164 | 164 | { |
165 | 165 | $am=self::$_application->getAssetManager(); |
166 | - $url=$am->publishFilePath(self::getPathOfNamespace('Prado\\'.$logoName,'.gif')); |
|
166 | + $url=$am->publishFilePath(self::getPathOfNamespace('Prado\\'.$logoName, '.gif')); |
|
167 | 167 | } |
168 | 168 | else |
169 | 169 | $url='http://pradosoft.github.io/docs/'.$logoName.'.gif'; |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | * @param string the filename that the error was raised in |
181 | 181 | * @param integer the line number the error was raised at |
182 | 182 | */ |
183 | - public static function phpErrorHandler($errno,$errstr,$errfile,$errline) |
|
183 | + public static function phpErrorHandler($errno, $errstr, $errfile, $errline) |
|
184 | 184 | { |
185 | 185 | if(error_reporting() & $errno) |
186 | - throw new TPhpErrorException($errno,$errstr,$errfile,$errline); |
|
186 | + throw new TPhpErrorException($errno, $errstr, $errfile, $errline); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public static function phpFatalErrorHandler() |
196 | 196 | { |
197 | - $error = error_get_last(); |
|
197 | + $error=error_get_last(); |
|
198 | 198 | if($error && |
199 | 199 | TPhpErrorException::isFatalError($error) && |
200 | 200 | error_reporting() & $error['type']) |
201 | 201 | { |
202 | - self::exceptionHandler(new TPhpErrorException($error['type'],$error['message'],$error['file'],$error['line'])); |
|
202 | + self::exceptionHandler(new TPhpErrorException($error['type'], $error['message'], $error['file'], $error['line'])); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | if(self::$_application!==null && ($errorHandler=self::$_application->getErrorHandler())!==null) |
218 | 218 | { |
219 | - $errorHandler->handleError(null,$exception); |
|
219 | + $errorHandler->handleError(null, $exception); |
|
220 | 220 | } |
221 | 221 | else |
222 | 222 | { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | |
266 | 266 | protected static function prado3NamespaceToPhpNamespace($type) |
267 | 267 | { |
268 | - if(substr($type, 0, 6) === 'System') |
|
268 | + if(substr($type, 0, 6)==='System') |
|
269 | 269 | $type='Prado'.substr($type, 6); |
270 | 270 | |
271 | 271 | return str_replace('.', '\\', $type); |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public static function createComponent($requestedType) |
288 | 288 | { |
289 | - $type = static::prado3NamespaceToPhpNamespace($requestedType); |
|
289 | + $type=static::prado3NamespaceToPhpNamespace($requestedType); |
|
290 | 290 | if(!isset(self::$classExists[$type])) |
291 | - self::$classExists[$type] = class_exists($type, false); |
|
291 | + self::$classExists[$type]=class_exists($type, false); |
|
292 | 292 | |
293 | - if( !isset(self::$_usings[$type]) && !self::$classExists[$type]) { |
|
293 | + if(!isset(self::$_usings[$type]) && !self::$classExists[$type]) { |
|
294 | 294 | static::using($type); |
295 | - self::$classExists[$type] = class_exists($type, false); |
|
295 | + self::$classExists[$type]=class_exists($type, false); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /* |
@@ -302,12 +302,12 @@ discard block |
||
302 | 302 | * \Application\Common\MyDataModule) |
303 | 303 | * Skip this if the class is inside the Prado\* namespace, since all Prado classes are now namespaced |
304 | 304 | */ |
305 | - if( ($pos = strrpos($type, '\\')) !== false && ($requestedType != $type) && strpos($type, 'Prado\\') !== 0) |
|
306 | - $type = substr($type,$pos+1); |
|
305 | + if(($pos=strrpos($type, '\\'))!==false && ($requestedType!=$type) && strpos($type, 'Prado\\')!==0) |
|
306 | + $type=substr($type, $pos + 1); |
|
307 | 307 | |
308 | - if(($n=func_num_args())>1) |
|
308 | + if(($n=func_num_args()) > 1) |
|
309 | 309 | { |
310 | - $args = func_get_args(); |
|
310 | + $args=func_get_args(); |
|
311 | 311 | switch($n) { |
312 | 312 | case 2: |
313 | 313 | return new $type($args[1]); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | break; |
324 | 324 | default: |
325 | 325 | $s='$args[1]'; |
326 | - for($i=2;$i<$n;++$i) |
|
326 | + for($i=2; $i < $n; ++$i) |
|
327 | 327 | $s.=",\$args[$i]"; |
328 | 328 | eval("\$component=new $type($s);"); |
329 | 329 | return $component; |
@@ -343,21 +343,21 @@ discard block |
||
343 | 343 | * @param boolean whether to check the existence of the class after the class file is included |
344 | 344 | * @throws TInvalidDataValueException if the namespace is invalid |
345 | 345 | */ |
346 | - public static function using($namespace,$checkClassExistence=true) |
|
346 | + public static function using($namespace, $checkClassExistence=true) |
|
347 | 347 | { |
348 | - $namespace = static::prado3NamespaceToPhpNamespace($namespace); |
|
348 | + $namespace=static::prado3NamespaceToPhpNamespace($namespace); |
|
349 | 349 | |
350 | - if(isset(self::$_usings[$namespace]) || class_exists($namespace,false)) |
|
350 | + if(isset(self::$_usings[$namespace]) || class_exists($namespace, false)) |
|
351 | 351 | return; |
352 | - if(($pos=strrpos($namespace,'\\'))===false) |
|
352 | + if(($pos=strrpos($namespace, '\\'))===false) |
|
353 | 353 | { |
354 | 354 | // trying to autoload an old class name |
355 | 355 | foreach(self::$_usings as $k => $v) |
356 | 356 | { |
357 | - $path = $v . DIRECTORY_SEPARATOR . $namespace . self::CLASS_FILE_EXT; |
|
357 | + $path=$v.DIRECTORY_SEPARATOR.$namespace.self::CLASS_FILE_EXT; |
|
358 | 358 | if(file_exists($path)) |
359 | 359 | { |
360 | - $phpNamespace = '\\'. $k.'\\'.$namespace; |
|
360 | + $phpNamespace='\\'.$k.'\\'.$namespace; |
|
361 | 361 | if(class_exists($phpNamespace, true) || interface_exists($phpNamespace, true)) |
362 | 362 | { |
363 | 363 | if(!class_exists($namespace) && !interface_exists($namespace)) |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
370 | - if($checkClassExistence && !class_exists($namespace,false) && !interface_exists($namespace,false)) |
|
371 | - throw new TInvalidOperationException('prado_component_unknown',$namespace,''); |
|
370 | + if($checkClassExistence && !class_exists($namespace, false) && !interface_exists($namespace, false)) |
|
371 | + throw new TInvalidOperationException('prado_component_unknown', $namespace, ''); |
|
372 | 372 | } |
373 | - else if(($path=self::getPathOfNamespace($namespace,self::CLASS_FILE_EXT))!==null) |
|
373 | + else if(($path=self::getPathOfNamespace($namespace, self::CLASS_FILE_EXT))!==null) |
|
374 | 374 | { |
375 | - $className=substr($namespace,$pos+1); |
|
375 | + $className=substr($namespace, $pos + 1); |
|
376 | 376 | if($className==='*') // a directory |
377 | 377 | { |
378 | 378 | self::$_usings[substr($namespace, 0, $pos)]=$path; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | else // a file |
381 | 381 | { |
382 | 382 | //self::$_usings[$namespace]=$path; |
383 | - if(!$checkClassExistence || (!class_exists($className,false) && !interface_exists($className, false))) |
|
383 | + if(!$checkClassExistence || (!class_exists($className, false) && !interface_exists($className, false))) |
|
384 | 384 | { |
385 | 385 | try |
386 | 386 | { |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | } |
391 | 391 | catch(\Exception $e) |
392 | 392 | { |
393 | - if($checkClassExistence && !class_exists($className,false)) |
|
394 | - throw new TInvalidOperationException('prado_component_unknown',$className,$e->getMessage()); |
|
393 | + if($checkClassExistence && !class_exists($className, false)) |
|
394 | + throw new TInvalidOperationException('prado_component_unknown', $className, $e->getMessage()); |
|
395 | 395 | else |
396 | 396 | throw $e; |
397 | 397 | } |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | */ |
415 | 415 | public static function getPathOfNamespace($namespace, $ext='') |
416 | 416 | { |
417 | - $namespace = static::prado3NamespaceToPhpNamespace($namespace); |
|
417 | + $namespace=static::prado3NamespaceToPhpNamespace($namespace); |
|
418 | 418 | |
419 | - if(self::CLASS_FILE_EXT === $ext || empty($ext)) |
|
419 | + if(self::CLASS_FILE_EXT===$ext || empty($ext)) |
|
420 | 420 | { |
421 | 421 | if(isset(self::$_usings[$namespace])) |
422 | 422 | return self::$_usings[$namespace]; |
@@ -425,11 +425,11 @@ discard block |
||
425 | 425 | return self::$_aliases[$namespace]; |
426 | 426 | } |
427 | 427 | |
428 | - $segs = explode('\\',$namespace); |
|
429 | - $alias = array_shift($segs); |
|
428 | + $segs=explode('\\', $namespace); |
|
429 | + $alias=array_shift($segs); |
|
430 | 430 | |
431 | - if(null !== ($file = array_pop($segs)) && null !== ($root = self::getPathOfAlias($alias))) |
|
432 | - return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR ,$segs),'/\\').(($file === '*') ? '' : DIRECTORY_SEPARATOR.$file.$ext); |
|
431 | + if(null!==($file=array_pop($segs)) && null!==($root=self::getPathOfAlias($alias))) |
|
432 | + return rtrim($root.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $segs), '/\\').(($file==='*') ? '' : DIRECTORY_SEPARATOR.$file.$ext); |
|
433 | 433 | |
434 | 434 | return null; |
435 | 435 | } |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | */ |
441 | 441 | public static function getPathOfAlias($alias) |
442 | 442 | { |
443 | - return isset(self::$_aliases[$alias])?self::$_aliases[$alias]:null; |
|
443 | + return isset(self::$_aliases[$alias]) ? self::$_aliases[$alias] : null; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | protected static function getPathAliases() |
@@ -454,19 +454,19 @@ discard block |
||
454 | 454 | * @throws TInvalidOperationException if the alias is already defined |
455 | 455 | * @throws TInvalidDataValueException if the path is not a valid file path |
456 | 456 | */ |
457 | - public static function setPathOfAlias($alias,$path) |
|
457 | + public static function setPathOfAlias($alias, $path) |
|
458 | 458 | { |
459 | 459 | if(isset(self::$_aliases[$alias]) && !defined('PRADO_TEST_RUN')) |
460 | - throw new TInvalidOperationException('prado_alias_redefined',$alias); |
|
460 | + throw new TInvalidOperationException('prado_alias_redefined', $alias); |
|
461 | 461 | else if(($rp=realpath($path))!==false && is_dir($rp)) |
462 | 462 | { |
463 | - if(strpos($alias,'.')===false) |
|
463 | + if(strpos($alias, '.')===false) |
|
464 | 464 | self::$_aliases[$alias]=$rp; |
465 | 465 | else |
466 | - throw new TInvalidDataValueException('prado_aliasname_invalid',$alias); |
|
466 | + throw new TInvalidDataValueException('prado_aliasname_invalid', $alias); |
|
467 | 467 | } |
468 | 468 | else |
469 | - throw new TInvalidDataValueException('prado_alias_invalid',$alias,$path); |
|
469 | + throw new TInvalidDataValueException('prado_alias_invalid', $alias, $path); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
@@ -491,13 +491,13 @@ discard block |
||
491 | 491 | continue; |
492 | 492 | echo '#'.$index.' '; |
493 | 493 | if(isset($t['file'])) |
494 | - echo basename($t['file']) . ':' . $t['line']; |
|
494 | + echo basename($t['file']).':'.$t['line']; |
|
495 | 495 | else |
496 | 496 | echo '<PHP inner-code>'; |
497 | 497 | echo ' -- '; |
498 | 498 | if(isset($t['class'])) |
499 | - echo $t['class'] . $t['type']; |
|
500 | - echo $t['function'] . '('; |
|
499 | + echo $t['class'].$t['type']; |
|
500 | + echo $t['function'].'('; |
|
501 | 501 | if(isset($t['args']) && sizeof($t['args']) > 0) |
502 | 502 | { |
503 | 503 | $count=0; |
@@ -506,25 +506,25 @@ discard block |
||
506 | 506 | if(is_string($item)) |
507 | 507 | { |
508 | 508 | $str=htmlentities(str_replace("\r\n", "", $item), ENT_QUOTES); |
509 | - if (strlen($item) > 70) |
|
510 | - echo "'". substr($str, 0, 70) . "...'"; |
|
509 | + if(strlen($item) > 70) |
|
510 | + echo "'".substr($str, 0, 70)."...'"; |
|
511 | 511 | else |
512 | - echo "'" . $str . "'"; |
|
512 | + echo "'".$str."'"; |
|
513 | 513 | } |
514 | - else if (is_int($item) || is_float($item)) |
|
514 | + else if(is_int($item) || is_float($item)) |
|
515 | 515 | echo $item; |
516 | - else if (is_object($item)) |
|
516 | + else if(is_object($item)) |
|
517 | 517 | echo get_class($item); |
518 | - else if (is_array($item)) |
|
519 | - echo 'array(' . count($item) . ')'; |
|
520 | - else if (is_bool($item)) |
|
518 | + else if(is_array($item)) |
|
519 | + echo 'array('.count($item).')'; |
|
520 | + else if(is_bool($item)) |
|
521 | 521 | echo $item ? 'true' : 'false'; |
522 | - else if ($item === null) |
|
522 | + else if($item===null) |
|
523 | 523 | echo 'NULL'; |
524 | - else if (is_resource($item)) |
|
524 | + else if(is_resource($item)) |
|
525 | 525 | echo get_resource_type($item); |
526 | 526 | $count++; |
527 | - if (count($t['args']) > $count) |
|
527 | + if(count($t['args']) > $count) |
|
528 | 528 | echo ', '; |
529 | 529 | } |
530 | 530 | } |
@@ -551,10 +551,10 @@ discard block |
||
551 | 551 | else |
552 | 552 | { |
553 | 553 | $languages=array(); |
554 | - foreach(explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language) |
|
554 | + foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $language) |
|
555 | 555 | { |
556 | - $array=explode(';q=',trim($language)); |
|
557 | - $languages[trim($array[0])]=isset($array[1])?(float)$array[1]:1.0; |
|
556 | + $array=explode(';q=', trim($language)); |
|
557 | + $languages[trim($array[0])]=isset($array[1]) ? (float) $array[1] : 1.0; |
|
558 | 558 | } |
559 | 559 | arsort($languages); |
560 | 560 | $languages=array_keys($languages); |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | if($language===null) |
576 | 576 | { |
577 | 577 | $langs=Prado::getUserLanguages(); |
578 | - $lang=explode('-',$langs[0]); |
|
578 | + $lang=explode('-', $langs[0]); |
|
579 | 579 | if(empty($lang[0]) || !ctype_alpha($lang[0])) |
580 | 580 | $language='en'; |
581 | 581 | else |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | * @param (string|TControl) control of the message |
597 | 597 | * @see log, getLogger |
598 | 598 | */ |
599 | - public static function trace($msg,$category='Uncategorized',$ctl=null) |
|
599 | + public static function trace($msg, $category='Uncategorized', $ctl=null) |
|
600 | 600 | { |
601 | 601 | if(self::$_application && self::$_application->getMode()===TApplicationMode::Performance) |
602 | 602 | return; |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | } |
610 | 610 | else |
611 | 611 | $level=TLogger::INFO; |
612 | - self::log($msg,$level,$category,$ctl); |
|
612 | + self::log($msg, $level, $category, $ctl); |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | /** |
@@ -624,11 +624,11 @@ discard block |
||
624 | 624 | * @param string category of the message |
625 | 625 | * @param (string|TControl) control of the message |
626 | 626 | */ |
627 | - public static function log($msg,$level=TLogger::INFO,$category='Uncategorized',$ctl=null) |
|
627 | + public static function log($msg, $level=TLogger::INFO, $category='Uncategorized', $ctl=null) |
|
628 | 628 | { |
629 | 629 | if(self::$_logger===null) |
630 | 630 | self::$_logger=new TLogger; |
631 | - self::$_logger->log($msg,$level,$category,$ctl); |
|
631 | + self::$_logger->log($msg, $level, $category, $ctl); |
|
632 | 632 | } |
633 | 633 | |
634 | 634 | /** |
@@ -650,9 +650,9 @@ discard block |
||
650 | 650 | * @param boolean whether to syntax highlight the output. Defaults to false. |
651 | 651 | * @return string the string representation of the variable |
652 | 652 | */ |
653 | - public static function varDump($var,$depth=10,$highlight=false) |
|
653 | + public static function varDump($var, $depth=10, $highlight=false) |
|
654 | 654 | { |
655 | - return TVarDumper::dump($var,$depth,$highlight); |
|
655 | + return TVarDumper::dump($var, $depth, $highlight); |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
@@ -667,31 +667,31 @@ discard block |
||
667 | 667 | */ |
668 | 668 | public static function localize($text, $parameters=array(), $catalogue=null, $charset=null) |
669 | 669 | { |
670 | - $app = Prado::getApplication()->getGlobalization(false); |
|
670 | + $app=Prado::getApplication()->getGlobalization(false); |
|
671 | 671 | |
672 | - $params = array(); |
|
672 | + $params=array(); |
|
673 | 673 | foreach($parameters as $key => $value) |
674 | - $params['{'.$key.'}'] = $value; |
|
674 | + $params['{'.$key.'}']=$value; |
|
675 | 675 | |
676 | 676 | //no translation handler provided |
677 | - if($app===null || ($config = $app->getTranslationConfiguration())===null) |
|
677 | + if($app===null || ($config=$app->getTranslationConfiguration())===null) |
|
678 | 678 | return strtr($text, $params); |
679 | 679 | |
680 | - if ($catalogue===null) |
|
681 | - $catalogue=isset($config['catalogue'])?$config['catalogue']:'messages'; |
|
680 | + if($catalogue===null) |
|
681 | + $catalogue=isset($config['catalogue']) ? $config['catalogue'] : 'messages'; |
|
682 | 682 | |
683 | 683 | Translation::init($catalogue); |
684 | 684 | |
685 | 685 | //globalization charset |
686 | - $appCharset = $app===null ? '' : $app->getCharset(); |
|
686 | + $appCharset=$app===null ? '' : $app->getCharset(); |
|
687 | 687 | |
688 | 688 | //default charset |
689 | - $defaultCharset = ($app===null) ? 'UTF-8' : $app->getDefaultCharset(); |
|
689 | + $defaultCharset=($app===null) ? 'UTF-8' : $app->getDefaultCharset(); |
|
690 | 690 | |
691 | 691 | //fall back |
692 | - if(empty($charset)) $charset = $appCharset; |
|
693 | - if(empty($charset)) $charset = $defaultCharset; |
|
692 | + if(empty($charset)) $charset=$appCharset; |
|
693 | + if(empty($charset)) $charset=$defaultCharset; |
|
694 | 694 | |
695 | - return Translation::formatter($catalogue)->format($text,$params,$catalogue,$charset); |
|
695 | + return Translation::formatter($catalogue)->format($text, $params, $catalogue, $charset); |
|
696 | 696 | } |
697 | 697 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @since 3.1.9 |
39 | 39 | */ |
40 | 40 | class TActiveLiteralColumn extends TLiteralColumn { |
41 | - protected function initializeHeaderCell($cell,$columnIndex) { |
|
41 | + protected function initializeHeaderCell($cell, $columnIndex) { |
|
42 | 42 | $text=$this->getHeaderText(); |
43 | 43 | |
44 | 44 | if(($classPath=$this->getHeaderRenderer())!=='') { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | else if($this->getAllowSorting()) { |
57 | 57 | $sortExpression=$this->getSortExpression(); |
58 | 58 | if(($url=$this->getHeaderImageUrl())!=='') { |
59 | - $button= new TActiveImageButton; |
|
59 | + $button=new TActiveImageButton; |
|
60 | 60 | $button->setImageUrl($url); |
61 | 61 | $button->setCommandName(TDataGrid::CMD_SORT); |
62 | 62 | $button->setCommandParameter($sortExpression); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $cell->getControls()->add($button); |
69 | 69 | } |
70 | 70 | else if($text!=='') { |
71 | - $button= new TActiveLinkButton; |
|
71 | + $button=new TActiveLinkButton; |
|
72 | 72 | $button->setText($text); |
73 | 73 | $button->setCommandName(TDataGrid::CMD_SORT); |
74 | 74 | $button->setCommandParameter($sortExpression); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | else { |
82 | 82 | if(($url=$this->getHeaderImageUrl())!=='') { |
83 | - $image= new TActiveImage; |
|
83 | + $image=new TActiveImage; |
|
84 | 84 | $image->setImageUrl($url); |
85 | 85 | if($text!=='') { |
86 | 86 | $image->setAlternateText($text); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param integer the index to the Columns property that the cell resides in. |
43 | 43 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
44 | 44 | */ |
45 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
45 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
46 | 46 | { |
47 | 47 | if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem || $itemType===TListItemType::EditItem) |
48 | 48 | { |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | $checkBox->setEnabled(false); |
52 | 52 | $cell->setHorizontalAlign('Center'); |
53 | 53 | $cell->getControls()->add($checkBox); |
54 | - $cell->registerObject('CheckBox',$checkBox); |
|
54 | + $cell->registerObject('CheckBox', $checkBox); |
|
55 | 55 | if($this->getDataField()!=='') |
56 | - $checkBox->attachEventHandler('OnDataBinding',array($this,'dataBindColumn')); |
|
56 | + $checkBox->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn')); |
|
57 | 57 | } |
58 | 58 | else |
59 | - parent::initializeCell($cell,$columnIndex,$itemType); |
|
59 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
60 | 60 | } |
61 | 61 | |
62 | - protected function initializeHeaderCell($cell,$columnIndex) |
|
62 | + protected function initializeHeaderCell($cell, $columnIndex) |
|
63 | 63 | { |
64 | 64 | $text=$this->getHeaderText(); |
65 | 65 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $sortExpression=$this->getSortExpression(); |
84 | 84 | if(($url=$this->getHeaderImageUrl())!=='') |
85 | 85 | { |
86 | - $button= new TActiveImageButton; |
|
86 | + $button=new TActiveImageButton; |
|
87 | 87 | $button->setImageUrl($url); |
88 | 88 | $button->setCommandName(TDataGrid::CMD_SORT); |
89 | 89 | $button->setCommandParameter($sortExpression); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | else if($text!=='') |
96 | 96 | { |
97 | - $button= new TActiveLinkButton; |
|
97 | + $button=new TActiveLinkButton; |
|
98 | 98 | $button->setText($text); |
99 | 99 | $button->setCommandName(TDataGrid::CMD_SORT); |
100 | 100 | $button->setCommandParameter($sortExpression); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | if(($url=$this->getHeaderImageUrl())!=='') |
110 | 110 | { |
111 | - $image= new TActiveImage; |
|
111 | + $image=new TActiveImage; |
|
112 | 112 | $image->setImageUrl($url); |
113 | 113 | if($text!=='') |
114 | 114 | $image->setAlternateText($text); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @since 3.1.9 |
39 | 39 | */ |
40 | 40 | class TActiveLiteralColumn extends TLiteralColumn { |
41 | - protected function initializeHeaderCell($cell,$columnIndex) { |
|
41 | + protected function initializeHeaderCell($cell, $columnIndex) { |
|
42 | 42 | $text=$this->getHeaderText(); |
43 | 43 | |
44 | 44 | if(($classPath=$this->getHeaderRenderer())!=='') { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | else if($this->getAllowSorting()) { |
57 | 57 | $sortExpression=$this->getSortExpression(); |
58 | 58 | if(($url=$this->getHeaderImageUrl())!=='') { |
59 | - $button= new TActiveImageButton; |
|
59 | + $button=new TActiveImageButton; |
|
60 | 60 | $button->setImageUrl($url); |
61 | 61 | $button->setCommandName(TDataGrid::CMD_SORT); |
62 | 62 | $button->setCommandParameter($sortExpression); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $cell->getControls()->add($button); |
69 | 69 | } |
70 | 70 | else if($text!=='') { |
71 | - $button= new TActiveLinkButton; |
|
71 | + $button=new TActiveLinkButton; |
|
72 | 72 | $button->setText($text); |
73 | 73 | $button->setCommandName(TDataGrid::CMD_SORT); |
74 | 74 | $button->setCommandParameter($sortExpression); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | else { |
82 | 82 | if(($url=$this->getHeaderImageUrl())!=='') { |
83 | - $image= new TActiveImage; |
|
83 | + $image=new TActiveImage; |
|
84 | 84 | $image->setImageUrl($url); |
85 | 85 | if($text!=='') { |
86 | 86 | $image->setAlternateText($text); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class TActiveDropDownListColumn extends TDropDownListColumn |
33 | 33 | { |
34 | - protected function initializeHeaderCell($cell,$columnIndex) |
|
34 | + protected function initializeHeaderCell($cell, $columnIndex) |
|
35 | 35 | { |
36 | 36 | $text=$this->getHeaderText(); |
37 | 37 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $sortExpression=$this->getSortExpression(); |
56 | 56 | if(($url=$this->getHeaderImageUrl())!=='') |
57 | 57 | { |
58 | - $button= new TActiveImageButton; |
|
58 | + $button=new TActiveImageButton; |
|
59 | 59 | $button->setImageUrl($url); |
60 | 60 | $button->setCommandName(TDataGrid::CMD_SORT); |
61 | 61 | $button->setCommandParameter($sortExpression); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | else if($text!=='') |
68 | 68 | { |
69 | - $button= new TActiveLinkButton; |
|
69 | + $button=new TActiveLinkButton; |
|
70 | 70 | $button->setText($text); |
71 | 71 | $button->setCommandName(TDataGrid::CMD_SORT); |
72 | 72 | $button->setCommandParameter($sortExpression); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | if(($url=$this->getHeaderImageUrl())!=='') |
82 | 82 | { |
83 | - $image= new TActiveImage; |
|
83 | + $image=new TActiveImage; |
|
84 | 84 | $image->setImageUrl($url); |
85 | 85 | if($text!=='') |
86 | 86 | $image->setAlternateText($text); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | class TActiveFileUpload extends TFileUpload implements IActiveControl, ICallbackEventHandler, INamingContainer |
55 | 55 | { |
56 | 56 | |
57 | - const SCRIPT_PATH = 'prado/activefileupload'; |
|
57 | + const SCRIPT_PATH='prado/activefileupload'; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @var THiddenField a flag to tell which component is doing the callback. |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * TActiveControlAdapter. If you override this class, be sure to set the |
84 | 84 | * adapter appropriately by, for example, by calling this constructor. |
85 | 85 | */ |
86 | - public function __construct(){ |
|
86 | + public function __construct() { |
|
87 | 87 | parent::__construct(); |
88 | 88 | $this->setAdapter(new TActiveControlAdapter($this)); |
89 | 89 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | protected function getAssetUrl($file='') |
97 | 97 | { |
98 | - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
98 | + $base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
99 | 99 | return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
100 | 100 | } |
101 | 101 | |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function onFileUpload($param) |
110 | 110 | { |
111 | - if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()){ |
|
111 | + if($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param==$this->_target->getUniqueID()) { |
|
112 | 112 | // save the file so that it will persist past the end of this return. |
113 | - $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),'')); |
|
113 | + $localName=str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), '')); |
|
114 | 114 | parent::saveAs($localName); |
115 | - $this->_localName = $localName; |
|
115 | + $this->_localName=$localName; |
|
116 | 116 | |
117 | - $params = new TActiveFileUploadCallbackParams; |
|
118 | - $params->localName = $localName; |
|
119 | - $params->fileName = addslashes($this->getFileName()); |
|
120 | - $params->fileSize = $this->getFileSize(); |
|
121 | - $params->fileType = $this->getFileType(); |
|
122 | - $params->errorCode = $this->getErrorCode(); |
|
117 | + $params=new TActiveFileUploadCallbackParams; |
|
118 | + $params->localName=$localName; |
|
119 | + $params->fileName=addslashes($this->getFileName()); |
|
120 | + $params->fileSize=$this->getFileSize(); |
|
121 | + $params->fileType=$this->getFileType(); |
|
122 | + $params->errorCode=$this->getErrorCode(); |
|
123 | 123 | |
124 | 124 | // return some javascript to display a completion status. |
125 | 125 | echo <<<EOS |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return string the path where the uploaded file will be stored temporarily, in namespace format |
145 | 145 | * default "Application.runtime.*" |
146 | 146 | */ |
147 | - public function getTempPath(){ |
|
147 | + public function getTempPath() { |
|
148 | 148 | return $this->getViewState('TempPath', 'Application.runtime.*'); |
149 | 149 | } |
150 | 150 | |
@@ -152,15 +152,15 @@ discard block |
||
152 | 152 | * @param string the path where the uploaded file will be stored temporarily in namespace format |
153 | 153 | * default "Application.runtime.*" |
154 | 154 | */ |
155 | - public function setTempPath($value){ |
|
156 | - $this->setViewState('TempPath',$value,'Application.runtime.*'); |
|
155 | + public function setTempPath($value) { |
|
156 | + $this->setViewState('TempPath', $value, 'Application.runtime.*'); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | 160 | * @return boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true. |
161 | 161 | * Note: When set to false, you will need to trigger the callback yourself. |
162 | 162 | */ |
163 | - public function getAutoPostBack(){ |
|
163 | + public function getAutoPostBack() { |
|
164 | 164 | return $this->getViewState('AutoPostBack', true); |
165 | 165 | } |
166 | 166 | |
@@ -168,28 +168,28 @@ discard block |
||
168 | 168 | * @param boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true. |
169 | 169 | * Note: When set to false, you will need to trigger the callback yourself. |
170 | 170 | */ |
171 | - public function setAutoPostBack($value){ |
|
172 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true); |
|
171 | + public function setAutoPostBack($value) { |
|
172 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | 176 | * @return string A chuck of javascript that will need to be called if {{@link getAutoPostBack AutoPostBack} is set to false} |
177 | 177 | */ |
178 | - public function getCallbackJavascript(){ |
|
178 | + public function getCallbackJavascript() { |
|
179 | 179 | return "Prado.WebUI.TActiveFileUpload.fileChanged(\"{$this->getClientID()}\")"; |
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | 183 | * @throws TInvalidDataValueException if the {@link getTempPath TempPath} is not writable. |
184 | 184 | */ |
185 | - public function onInit($sender){ |
|
185 | + public function onInit($sender) { |
|
186 | 186 | parent::onInit($sender); |
187 | 187 | |
188 | - if (!Prado::getApplication()->getCache()) |
|
189 | - if (!Prado::getApplication()->getSecurityManager()) |
|
188 | + if(!Prado::getApplication()->getCache()) |
|
189 | + if(!Prado::getApplication()->getSecurityManager()) |
|
190 | 190 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
191 | 191 | |
192 | - if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){ |
|
192 | + if(!is_writable(Prado::getPathOfNamespace($this->getTempPath()))) { |
|
193 | 193 | throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath()); |
194 | 194 | } |
195 | 195 | } |
@@ -201,17 +201,17 @@ discard block |
||
201 | 201 | * This method is mainly used by framework and control developers. |
202 | 202 | * @param TCallbackEventParameter the event parameter |
203 | 203 | */ |
204 | - public function raiseCallbackEvent($param){ |
|
205 | - $cp = $param->getCallbackParameter(); |
|
206 | - if ($key = $cp->targetID == $this->_target->getUniqueID()){ |
|
204 | + public function raiseCallbackEvent($param) { |
|
205 | + $cp=$param->getCallbackParameter(); |
|
206 | + if($key=$cp->targetID==$this->_target->getUniqueID()) { |
|
207 | 207 | |
208 | - $params = $this->popParamsByToken($cp->callbackToken); |
|
208 | + $params=$this->popParamsByToken($cp->callbackToken); |
|
209 | 209 | |
210 | - $_FILES[$key]['name'] = stripslashes($params->fileName); |
|
211 | - $_FILES[$key]['size'] = intval($params->fileSize); |
|
212 | - $_FILES[$key]['type'] = $params->fileType; |
|
213 | - $_FILES[$key]['error'] = intval($params->errorCode); |
|
214 | - $_FILES[$key]['tmp_name'] = $params->localName; |
|
210 | + $_FILES[$key]['name']=stripslashes($params->fileName); |
|
211 | + $_FILES[$key]['size']=intval($params->fileSize); |
|
212 | + $_FILES[$key]['type']=$params->fileType; |
|
213 | + $_FILES[$key]['error']=intval($params->errorCode); |
|
214 | + $_FILES[$key]['tmp_name']=$params->localName; |
|
215 | 215 | $this->loadPostData($key, null); |
216 | 216 | |
217 | 217 | $this->raiseEvent('OnFileUpload', $this, $param); |
@@ -230,17 +230,17 @@ discard block |
||
230 | 230 | |
231 | 231 | protected function pushParamsAndGetToken(TActiveFileUploadCallbackParams $params) |
232 | 232 | { |
233 | - if ($cache = Prado::getApplication()->getCache()) |
|
233 | + if($cache=Prado::getApplication()->getCache()) |
|
234 | 234 | { |
235 | 235 | // this is the most secure method, file info can't be forged from client side, no matter what |
236 | - $token = md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000*1000,9999*1000)); |
|
237 | - $cache->set($token, serialize($params), 5*60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
|
236 | + $token=md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000 * 1000, 9999 * 1000)); |
|
237 | + $cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
|
238 | 238 | } |
239 | 239 | else |
240 | - if ($mgr = Prado::getApplication()->getSecurityManager()) |
|
240 | + if($mgr=Prado::getApplication()->getSecurityManager()) |
|
241 | 241 | { |
242 | 242 | // this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key |
243 | - $token = urlencode(base64_encode($mgr->encrypt(serialize($params)))); |
|
243 | + $token=urlencode(base64_encode($mgr->encrypt(serialize($params)))); |
|
244 | 244 | } |
245 | 245 | else |
246 | 246 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
@@ -250,18 +250,18 @@ discard block |
||
250 | 250 | |
251 | 251 | protected function popParamsByToken($token) |
252 | 252 | { |
253 | - if ($cache = Prado::getApplication()->getCache()) |
|
253 | + if($cache=Prado::getApplication()->getCache()) |
|
254 | 254 | { |
255 | - $v = $cache->get($token); |
|
255 | + $v=$cache->get($token); |
|
256 | 256 | assert($v!=''); |
257 | 257 | $cache->delete($token); // remove it from cache so it can't be used again and won't take up space either |
258 | - $params = unserialize($v); |
|
258 | + $params=unserialize($v); |
|
259 | 259 | } |
260 | 260 | else |
261 | - if ($mgr = Prado::getApplication()->getSecurityManager()) |
|
261 | + if($mgr=Prado::getApplication()->getSecurityManager()) |
|
262 | 262 | { |
263 | - $v = $mgr->decrypt(base64_decode(urldecode($token))); |
|
264 | - $params = unserialize($v); |
|
263 | + $v=$mgr->decrypt(base64_decode(urldecode($token))); |
|
264 | + $params=unserialize($v); |
|
265 | 265 | } |
266 | 266 | else |
267 | 267 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
@@ -278,19 +278,19 @@ discard block |
||
278 | 278 | { |
279 | 279 | parent::onPreRender($param); |
280 | 280 | |
281 | - if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID()) |
|
281 | + if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId']==$this->getClientID()) |
|
282 | 282 | { |
283 | 283 | // tricky workaround to intercept "uploaded file too big" error: real uploads happens in onFileUpload instead |
284 | - $this->_errorCode = UPLOAD_ERR_FORM_SIZE; |
|
285 | - $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),'')); |
|
286 | - $fileName = addslashes($this->getFileName()); |
|
284 | + $this->_errorCode=UPLOAD_ERR_FORM_SIZE; |
|
285 | + $localName=str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), '')); |
|
286 | + $fileName=addslashes($this->getFileName()); |
|
287 | 287 | |
288 | - $params = new TActiveFileUploadCallbackParams; |
|
289 | - $params->localName = $localName; |
|
290 | - $params->fileName = $fileName; |
|
291 | - $params->fileSize = $this->getFileSize(); |
|
292 | - $params->fileType = $this->getFileType(); |
|
293 | - $params->errorCode = $this->getErrorCode(); |
|
288 | + $params=new TActiveFileUploadCallbackParams; |
|
289 | + $params->localName=$localName; |
|
290 | + $params->fileName=$fileName; |
|
291 | + $params->fileSize=$this->getFileSize(); |
|
292 | + $params->fileType=$this->getFileType(); |
|
293 | + $params->errorCode=$this->getErrorCode(); |
|
294 | 294 | |
295 | 295 | echo <<<EOS |
296 | 296 | <script language="Javascript"> |
@@ -310,29 +310,29 @@ discard block |
||
310 | 310 | |
311 | 311 | public function createChildControls() |
312 | 312 | { |
313 | - $this->_flag = new THiddenField; |
|
313 | + $this->_flag=new THiddenField; |
|
314 | 314 | $this->_flag->setID('Flag'); |
315 | 315 | $this->getControls()->add($this->_flag); |
316 | 316 | |
317 | - $this->_busy = new TImage; |
|
317 | + $this->_busy=new TImage; |
|
318 | 318 | $this->_busy->setID('Busy'); |
319 | 319 | $this->_busy->setImageUrl($this->getAssetUrl('ActiveFileUploadIndicator.gif')); |
320 | 320 | $this->_busy->setStyle("display:none"); |
321 | 321 | $this->getControls()->add($this->_busy); |
322 | 322 | |
323 | - $this->_success = new TImage; |
|
323 | + $this->_success=new TImage; |
|
324 | 324 | $this->_success->setID('Success'); |
325 | 325 | $this->_success->setImageUrl($this->getAssetUrl('ActiveFileUploadComplete.png')); |
326 | 326 | $this->_success->setStyle("display:none"); |
327 | 327 | $this->getControls()->add($this->_success); |
328 | 328 | |
329 | - $this->_error = new TImage; |
|
329 | + $this->_error=new TImage; |
|
330 | 330 | $this->_error->setID('Error'); |
331 | 331 | $this->_error->setImageUrl($this->getAssetUrl('ActiveFileUploadError.png')); |
332 | 332 | $this->_error->setStyle("display:none"); |
333 | 333 | $this->getControls()->add($this->_error); |
334 | 334 | |
335 | - $this->_target = new TInlineFrame; |
|
335 | + $this->_target=new TInlineFrame; |
|
336 | 336 | $this->_target->setID('Target'); |
337 | 337 | $this->_target->setFrameUrl($this->getAssetUrl('ActiveFileUploadBlank.html')); |
338 | 338 | $this->_target->setStyle("width:0px; height:0px;"); |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | /** |
344 | 344 | * Removes localfile on ending of the callback. |
345 | 345 | */ |
346 | - public function onUnload($param){ |
|
347 | - if ($this->getPage()->getIsCallback() && |
|
346 | + public function onUnload($param) { |
|
347 | + if($this->getPage()->getIsCallback() && |
|
348 | 348 | $this->getHasFile() && |
349 | - file_exists($this->getLocalName())){ |
|
349 | + file_exists($this->getLocalName())) { |
|
350 | 350 | unlink($this->getLocalName()); |
351 | 351 | } |
352 | 352 | parent::onUnload($param); |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | /** |
356 | 356 | * @return TBaseActiveCallbackControl standard callback control options. |
357 | 357 | */ |
358 | - public function getActiveControl(){ |
|
358 | + public function getActiveControl() { |
|
359 | 359 | return $this->getAdapter()->getBaseActiveControl(); |
360 | 360 | } |
361 | 361 | |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | * Adds ID attribute, and renders the javascript for active component. |
372 | 372 | * @param THtmlWriter the writer used for the rendering purpose |
373 | 373 | */ |
374 | - public function addAttributesToRender($writer){ |
|
374 | + public function addAttributesToRender($writer) { |
|
375 | 375 | parent::addAttributesToRender($writer); |
376 | - $writer->addAttribute('id',$this->getClientID()); |
|
376 | + $writer->addAttribute('id', $this->getClientID()); |
|
377 | 377 | |
378 | 378 | $this->getPage()->getClientScript()->registerPradoScript('activefileupload'); |
379 | - $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(),$this->getClientOptions()); |
|
379 | + $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getClientOptions()); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
383 | 383 | * @return string corresponding javascript class name for this control. |
384 | 384 | */ |
385 | - protected function getClientClassName(){ |
|
385 | + protected function getClientClassName() { |
|
386 | 386 | return 'Prado.WebUI.TActiveFileUpload'; |
387 | 387 | } |
388 | 388 | |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | * completeID => complete client ID, |
397 | 397 | * errorID => error client ID) |
398 | 398 | */ |
399 | - protected function getClientOptions(){ |
|
400 | - $options['ID'] = $this->getClientID(); |
|
401 | - $options['EventTarget'] = $this->getUniqueID(); |
|
402 | - |
|
403 | - $options['inputID'] = $this->getClientID(); |
|
404 | - $options['flagID'] = $this->_flag->getClientID(); |
|
405 | - $options['targetID'] = $this->_target->getUniqueID(); |
|
406 | - $options['formID'] = $this->getPage()->getForm()->getClientID(); |
|
407 | - $options['indicatorID'] = $this->_busy->getClientID(); |
|
408 | - $options['completeID'] = $this->_success->getClientID(); |
|
409 | - $options['errorID'] = $this->_error->getClientID(); |
|
410 | - $options['autoPostBack'] = $this->getAutoPostBack(); |
|
399 | + protected function getClientOptions() { |
|
400 | + $options['ID']=$this->getClientID(); |
|
401 | + $options['EventTarget']=$this->getUniqueID(); |
|
402 | + |
|
403 | + $options['inputID']=$this->getClientID(); |
|
404 | + $options['flagID']=$this->_flag->getClientID(); |
|
405 | + $options['targetID']=$this->_target->getUniqueID(); |
|
406 | + $options['formID']=$this->getPage()->getForm()->getClientID(); |
|
407 | + $options['indicatorID']=$this->_busy->getClientID(); |
|
408 | + $options['completeID']=$this->_success->getClientID(); |
|
409 | + $options['errorID']=$this->_error->getClientID(); |
|
410 | + $options['autoPostBack']=$this->getAutoPostBack(); |
|
411 | 411 | return $options; |
412 | 412 | } |
413 | 413 | |
@@ -418,12 +418,12 @@ discard block |
||
418 | 418 | * If true, you will not be able to save the uploaded file again. |
419 | 419 | * @return boolean true if the file saving is successful |
420 | 420 | */ |
421 | - public function saveAs($fileName,$deleteTempFile=true){ |
|
422 | - if (($this->getErrorCode()===UPLOAD_ERR_OK) && (file_exists($this->getLocalName()))){ |
|
423 | - if ($deleteTempFile) |
|
424 | - return rename($this->getLocalName(),$fileName); |
|
421 | + public function saveAs($fileName, $deleteTempFile=true) { |
|
422 | + if(($this->getErrorCode()===UPLOAD_ERR_OK) && (file_exists($this->getLocalName()))) { |
|
423 | + if($deleteTempFile) |
|
424 | + return rename($this->getLocalName(), $fileName); |
|
425 | 425 | else |
426 | - return copy($this->getLocalName(),$fileName); |
|
426 | + return copy($this->getLocalName(), $fileName); |
|
427 | 427 | } else |
428 | 428 | return false; |
429 | 429 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @return TImage the image displayed when an upload |
433 | 433 | * completes successfully. |
434 | 434 | */ |
435 | - public function getSuccessImage(){ |
|
435 | + public function getSuccessImage() { |
|
436 | 436 | $this->ensureChildControls(); |
437 | 437 | return $this->_success; |
438 | 438 | } |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * @return TImage the image displayed when an upload |
442 | 442 | * does not complete successfully. |
443 | 443 | */ |
444 | - public function getErrorImage(){ |
|
444 | + public function getErrorImage() { |
|
445 | 445 | $this->ensureChildControls(); |
446 | 446 | return $this->_error; |
447 | 447 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * @return TImage the image displayed when an upload |
451 | 451 | * is in progress. |
452 | 452 | */ |
453 | - public function getBusyImage(){ |
|
453 | + public function getBusyImage() { |
|
454 | 454 | $this->ensureChildControls(); |
455 | 455 | return $this->_busy; |
456 | 456 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | class TActiveHyperLinkColumn extends THyperLinkColumn |
33 | 33 | { |
34 | 34 | |
35 | - protected function initializeHeaderCell($cell,$columnIndex) |
|
35 | + protected function initializeHeaderCell($cell, $columnIndex) |
|
36 | 36 | { |
37 | 37 | $text=$this->getHeaderText(); |
38 | 38 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $sortExpression=$this->getSortExpression(); |
57 | 57 | if(($url=$this->getHeaderImageUrl())!=='') |
58 | 58 | { |
59 | - $button= new TActiveImageButton; |
|
59 | + $button=new TActiveImageButton; |
|
60 | 60 | $button->setImageUrl($url); |
61 | 61 | $button->setCommandName(TDataGrid::CMD_SORT); |
62 | 62 | $button->setCommandParameter($sortExpression); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | else if($text!=='') |
69 | 69 | { |
70 | - $button= new TActiveLinkButton; |
|
70 | + $button=new TActiveLinkButton; |
|
71 | 71 | $button->setText($text); |
72 | 72 | $button->setCommandName(TDataGrid::CMD_SORT); |
73 | 73 | $button->setCommandParameter($sortExpression); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | if(($url=$this->getHeaderImageUrl())!=='') |
83 | 83 | { |
84 | - $image= new TActiveImage; |
|
84 | + $image=new TActiveImage; |
|
85 | 85 | $image->setImageUrl($url); |
86 | 86 | if($text!=='') |
87 | 87 | $image->setAlternateText($text); |
@@ -34,18 +34,18 @@ |
||
34 | 34 | * @since 3.1.9 |
35 | 35 | */ |
36 | 36 | class TActiveEditCommandColumn extends TEditCommandColumn { |
37 | - protected function createButton($commandName,$text,$causesValidation,$validationGroup) { |
|
37 | + protected function createButton($commandName, $text, $causesValidation, $validationGroup) { |
|
38 | 38 | if($this->getButtonType()===TButtonColumnType::LinkButton) |
39 | - $button= new TActiveLinkButton; |
|
39 | + $button=new TActiveLinkButton; |
|
40 | 40 | else if($this->getButtonType()===TButtonColumnType::PushButton) |
41 | - $button= new TActiveButton; |
|
41 | + $button=new TActiveButton; |
|
42 | 42 | else // image buttons |
43 | 43 | { |
44 | - $button= new TActiveImageButton; |
|
44 | + $button=new TActiveImageButton; |
|
45 | 45 | $button->setToolTip($text); |
46 | - if(strcasecmp($commandName,'Update')===0) |
|
46 | + if(strcasecmp($commandName, 'Update')===0) |
|
47 | 47 | $url=$this->getUpdateImageUrl(); |
48 | - else if(strcasecmp($commandName,'Cancel')===0) |
|
48 | + else if(strcasecmp($commandName, 'Cancel')===0) |
|
49 | 49 | $url=$this->getCancelImageUrl(); |
50 | 50 | else |
51 | 51 | $url=$this->getEditImageUrl(); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getAutoPostBack() |
48 | 48 | { |
49 | - return $this->getViewState('AutoPostBack',true); |
|
49 | + return $this->getViewState('AutoPostBack', true); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function setAutoPostBack($value) |
59 | 59 | { |
60 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true); |
|
60 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | */ |
67 | 67 | protected function getDatePickerOptions() |
68 | 68 | { |
69 | - $options = parent::getDatePickerOptions(); |
|
69 | + $options=parent::getDatePickerOptions(); |
|
70 | 70 | $options['CausesValidation']=$this->getCausesValidation(); |
71 | 71 | $options['ValidationGroup']=$this->getValidationGroup(); |
72 | - $options['EventTarget'] = $this->getUniqueID(); |
|
73 | - $options['ShowCalendar'] = $this->getShowCalendar(); |
|
74 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
72 | + $options['EventTarget']=$this->getUniqueID(); |
|
73 | + $options['ShowCalendar']=$this->getShowCalendar(); |
|
74 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
75 | 75 | return $options; |
76 | 76 | } |
77 | 77 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * @return TBaseActiveCallbackControl standard callback control options. |
91 | 91 | */ |
92 | - public function getActiveControl(){ |
|
92 | + public function getActiveControl() { |
|
93 | 93 | return $this->getAdapter()->getBaseActiveControl(); |
94 | 94 | } |
95 | 95 | |
@@ -97,21 +97,21 @@ discard block |
||
97 | 97 | * Client-side Text property can only be updated after the OnLoad stage. |
98 | 98 | * @param string text content for the textbox |
99 | 99 | */ |
100 | - public function setText($value){ |
|
101 | - if(parent::getText() === $value) |
|
100 | + public function setText($value) { |
|
101 | + if(parent::getText()===$value) |
|
102 | 102 | return; |
103 | 103 | |
104 | 104 | parent::setText($value); |
105 | - if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()){ |
|
105 | + if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) { |
|
106 | 106 | $cb=$this->getPage()->getCallbackClient(); |
107 | 107 | $cb->setValue($this, $value); |
108 | - if ($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
108 | + if($this->getInputMode()==TDatePickerInputMode::DropDownList) |
|
109 | 109 | { |
110 | - $s = new TDateTimeStamp; |
|
111 | - $date = $s->getDate($this->getTimeStampFromText()); |
|
110 | + $s=new TDateTimeStamp; |
|
111 | + $date=$s->getDate($this->getTimeStampFromText()); |
|
112 | 112 | $id=$this->getClientID(); |
113 | 113 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'day', 'Value', $date['mday'], 'select'); |
114 | - $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon']-1, 'select'); |
|
114 | + $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon'] - 1, 'select'); |
|
115 | 115 | $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'year', 'Value', $date['year'], 'select'); |
116 | 116 | |
117 | 117 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * This method is mainly used by framework and control developers. |
125 | 125 | * @param TCallbackEventParameter the event parameter |
126 | 126 | */ |
127 | - public function raiseCallbackEvent($param){ |
|
127 | + public function raiseCallbackEvent($param) { |
|
128 | 128 | $this->onCallback($param); |
129 | 129 | } |
130 | 130 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * handler can be invoked. |
136 | 136 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
137 | 137 | */ |
138 | - public function onCallback($param){ |
|
138 | + public function onCallback($param) { |
|
139 | 139 | $this->raiseEvent('OnCallback', $this, $param); |
140 | 140 | } |
141 | 141 | |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | |
146 | 146 | protected function registerCalendarClientScriptPre() |
147 | 147 | { |
148 | - $cs = $this->getPage()->getClientScript(); |
|
148 | + $cs=$this->getPage()->getClientScript(); |
|
149 | 149 | $cs->registerPradoScript("activedatepicker"); |
150 | 150 | } |
151 | 151 | |
152 | 152 | protected function renderClientControlScript($writer) |
153 | 153 | { |
154 | - $cs = $this->getPage()->getClientScript(); |
|
154 | + $cs=$this->getPage()->getClientScript(); |
|
155 | 155 | if(!$cs->isEndScriptRegistered('TDatePicker.spacer')) |
156 | 156 | { |
157 | - $spacer = $this->getAssetUrl('spacer.gif'); |
|
158 | - $code = "Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
157 | + $spacer=$this->getAssetUrl('spacer.gif'); |
|
158 | + $code="Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
159 | 159 | $cs->registerEndScript('TDatePicker.spacer', $code); |
160 | 160 | } |
161 | 161 | |
162 | - $options = TJavaScript::encode($this->getDatePickerOptions()); |
|
163 | - $code = "new Prado.WebUI.TActiveDatePicker($options);"; |
|
162 | + $options=TJavaScript::encode($this->getDatePickerOptions()); |
|
163 | + $code="new Prado.WebUI.TActiveDatePicker($options);"; |
|
164 | 164 | $cs->registerEndScript("prado:".$this->getClientID(), $code); |
165 | 165 | } |
166 | 166 |