[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * (c) 2004-2006 Sean Kerr. 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 /** 13 * sfFilterChain manages registered filters for a specific context. 14 * 15 * @package symfony 16 * @subpackage filter 17 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 18 * @author Sean Kerr <skerr@mojavi.org> 19 * @version SVN: $Id: sfFilterChain.class.php 3244 2007-01-12 14:46:11Z fabien $ 20 */ 21 class sfFilterChain 22 { 23 protected 24 $chain = array(), 25 $index = -1; 26 27 /** 28 * Executes the next filter in this chain. 29 */ 30 public function execute() 31 { 32 // skip to the next filter 33 ++$this->index; 34 35 if ($this->index < count($this->chain)) 36 { 37 if (sfConfig::get('sf_logging_enabled')) 38 { 39 sfContext::getInstance()->getLogger()->info(sprintf('{sfFilter} executing filter "%s"', get_class($this->chain[$this->index]))); 40 } 41 42 // execute the next filter 43 $this->chain[$this->index]->execute($this); 44 } 45 } 46 47 /** 48 * Returns true if the filter chain contains a filter of a given class. 49 * 50 * @param string The class name of the filter 51 * 52 * @return boolean true if the filter exists, false otherwise 53 */ 54 public function hasFilter($class) 55 { 56 foreach ($this->chain as $filter) 57 { 58 if ($filter instanceof $class) 59 { 60 return true; 61 } 62 } 63 64 return false; 65 } 66 67 /** 68 * Registers a filter with this chain. 69 * 70 * @param sfFilter A sfFilter implementation instance. 71 */ 72 public function register($filter) 73 { 74 $this->chain[] = $filter; 75 } 76 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |