[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/3rdParty/PhpShell/PHP/Shell/Extensions/ -> VerbosePrint.php (source)

   1  <?php
   2  class PHP_Shell_Extensions_VerbosePrint implements PHP_Shell_Extension {
   3      protected $opt_verbose = false;
   4      protected $oneshot_verbose = false;
   5  
   6      public function register() {
   7          $cmd = PHP_Shell_Commands::getInstance();
   8          $cmd->registerCommand('#^p #', $this, 'cmdPrint', 'p <var>', 'print the variable verbosly');
   9  
  10          $opt = PHP_Shell_Options::getInstance();
  11          $opt->registerOption('verboseprint', $this, 'optSetVerbose');
  12  
  13      }
  14  
  15      /**
  16      * handle the 'p ' command
  17      *
  18      * set the verbose flag
  19      *
  20      * @return string the pure command-string without the 'p ' command
  21      */
  22      public function cmdPrint($l) {
  23          $this->oneshot_verbose = true;
  24  
  25          $cmd = substr($l, 2);
  26  
  27          return $cmd;
  28      }
  29  
  30      public function optSetVerbose($key, $val) {
  31          switch($val) {
  32          case "false":
  33          case "on":
  34          case "1":
  35              $this->opt_verbose = true;
  36          default:
  37              $this->opt_verbose = false;
  38              break;
  39          }
  40      }
  41  
  42      /**
  43      * check if we have a verbose print-out
  44      *
  45      * @return bool 1 if verbose, 0 otherwise
  46      */
  47      public function isVerbose() {
  48          $v = $this->opt_verbose || $this->oneshot_verbose;
  49  
  50          $this->oneshot_verbose = false;
  51          
  52          return $v;
  53      }
  54  }
  55  
  56  


Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7