[ 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 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11 /** 12 * @package symfony 13 * @subpackage config 14 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 15 * @version SVN: $Id: sfRoutingConfigHandler.class.php 3203 2007-01-09 18:32:54Z fabien $ 16 */ 17 class sfRoutingConfigHandler extends sfYamlConfigHandler 18 { 19 /** 20 * Executes this configuration handler. 21 * 22 * @param array An array of absolute filesystem path to a configuration file 23 * 24 * @return string Data to be written to a cache file 25 * 26 * @throws sfConfigurationException If a requested configuration file does not exist or is not readable 27 * @throws sfParseException If a requested configuration file is improperly formatted 28 */ 29 public function execute($configFiles) 30 { 31 // parse the yaml 32 $config = $this->parseYamls($configFiles); 33 34 // connect routes 35 $routes = sfRouting::getInstance(); 36 foreach ($config as $name => $params) 37 { 38 $routes->connect( 39 $name, 40 ($params['url'] ? $params['url'] : '/'), 41 (isset($params['param']) ? $params['param'] : array()), 42 (isset($params['requirements']) ? $params['requirements'] : array()) 43 ); 44 } 45 46 // compile data 47 $retval = sprintf("<?php\n". 48 "// auto-generated by sfRoutingConfigHandler\n". 49 "// date: %s\n\$routes = sfRouting::getInstance();\n\$routes->setRoutes(\n%s\n);\n", 50 date('Y/m/d H:i:s'), var_export($routes->getRoutes(), 1)); 51 52 return $retval; 53 } 54 }
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 |