コード例 #1
0
ファイル: Filter.php プロジェクト: bhirsch/voipdrupal-4.7-1.0
 /**
  * Function called from {@link PHP_Beautifier::process()} to process the tokens.
  *
  * If the received token is one of the keys of {@link $aFilterTokenFunctions}
  * a function with the same name of the value of that key is called.
  * If the method doesn't exists, {@link __call()} is called, and return
  * {@link PHP_Beautifier_Filter::BYPASS}. PHP_Beautifier, now, call the next Filter is its list.
  * If the method exists, it can return true or {@link PHP_Beautifier_Filter::BYPASS}.
  * @param array token
  * @return bool true if the token is processed, false bypass to the next Filter
  * @see PHP_Beautifier::process()
  */
 public function handleToken($token)
 {
     $this->aToken = $token;
     if (!$this->bOn) {
         return false;
     }
     $sMethod = $sValue = false;
     if (array_key_exists($token[0], $this->aFilterTokenFunctions)) {
         $sMethod = $this->aFilterTokenFunctions[$token[0]];
         $sValue = $token[1];
     } elseif ($this->oBeaut->getTokenFunction($token[0])) {
         $sMethod = $this->oBeaut->getTokenFunction($token[0]);
     }
     $sValue = $token[1];
     if ($sMethod) {
         if ($this->oBeaut->iVerbose > 5) {
             echo $sMethod . ":" . trim($sValue) . "\n";
         }
         // return false if PHP_Beautifier_Filter::BYPASS
         return $this->{$sMethod}($sValue) !== PHP_Beautifier_Filter::BYPASS;
     } else {
         // WEIRD!!! -> Add the same received
         $this->oBeaut->add($token[1]);
         if ($this->oBeaut->iVerbose > 5) {
             echo trim($token) . "\n";
         }
         return true;
     }
     // never go here
     return false;
 }
コード例 #2
0
ファイル: Filter.php プロジェクト: rafasashi/PHP_Beautifier
 /**
  * Function called from {@link PHP_Beautifier::process()} to process the tokens.
  *
  * If the received token is one of the keys of {@link $aFilterTokenFunctions}
  * a function with the same name of the value of that key is called.
  * If the method doesn't exists, {@link __call()} is called, and return
  * {@link PHP_Beautifier_Filter::BYPASS}. PHP_Beautifier, now, call the next Filter is its list.
  * If the method exists, it can return true or {@link PHP_Beautifier_Filter::BYPASS}.
  * 
  * @param array $token Token to be handled
  *
  * @access public
  * @return bool true if the token is processed, false bypass to the next Filter
  * @see PHP_Beautifier::process()
  */
 public function handleToken($token)
 {
     $this->aToken = $token;
     if (!$this->bOn) {
         return false;
     }
     $sMethod = $sValue = false;
     if (array_key_exists($token[0], $this->aFilterTokenFunctions)) {
         $sMethod = $this->aFilterTokenFunctions[$token[0]];
         //$sValue = $token[1];
     } elseif ($this->oBeaut->getTokenFunction($token[0])) {
         $sMethod = $this->oBeaut->getTokenFunction($token[0]);
     }
     $sValue = $token[1];
     if ($sMethod) {
         PHP_Beautifier_Common::getLog()->log($this->getName() . "->" . $sMethod . "(" . trim($sValue) . ")", PEAR_LOG_DEBUG);
         // return false if PHP_Beautifier_Filter::BYPASS
         $result = $this->{$sMethod}($sValue) !== PHP_Beautifier_Filter::BYPASS;
         if ($result) {
             PHP_Beautifier_Common::getLog()->log($this->getName() . "->" . $sMethod . " done", PEAR_LOG_DEBUG);
         }
         return $result;
     } else {
         // WEIRD!!! -> Add the same received
         $this->oBeaut->add($token[1]);
         PHP_Beautifier_Common::getLog()->log("Add same received:" . trim($token[1]), PEAR_LOG_DEBUG);
         return true;
     }
     // never go here
     return false;
 }