Changeset 6663
- Timestamp:
- 12/21/07 08:45:11 (2 years ago)
- Files:
-
- branches/1.1/lib/routing/sfNoRouting.class.php (modified) (1 diff)
- branches/1.1/lib/routing/sfPathInfoRouting.class.php (modified) (1 diff)
- branches/1.1/lib/routing/sfPatternRouting.class.php (modified) (7 diffs)
- branches/1.1/lib/routing/sfRouting.class.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/routing/sfNoRouting.class.php
r4892 r6663 32 32 33 33 // module/action 34 $module = isset($parameters['module']) ? $parameters['module'] : $this-> parameterHolder->get('default_module');35 $action = isset($parameters['action']) ? $parameters['action'] : $this-> parameterHolder->get('default_action');34 $module = isset($parameters['module']) ? $parameters['module'] : $this->options['default_module']; 35 $action = isset($parameters['action']) ? $parameters['action'] : $this->options['default_action']; 36 36 37 37 // other parameters branches/1.1/lib/routing/sfPathInfoRouting.class.php
r4892 r6663 33 33 { 34 34 $parameters = $this->currentRouteParameters; 35 $module = isset($parameters['module']) ? $parameters['module'] : $this-> parameterHolder->get('default_module');36 $action = isset($parameters['action']) ? $parameters['action'] : $this-> parameterHolder->get('default_action');35 $module = isset($parameters['module']) ? $parameters['module'] : $this->options['default_module']; 36 $action = isset($parameters['action']) ? $parameters['action'] : $this->options['default_action']; 37 37 38 38 // other parameters branches/1.1/lib/routing/sfPatternRouting.class.php
r6661 r6663 34 34 * 35 35 * @param sfEventDispatcher A sfEventDispatcher instance 36 * @param array An associative array of initialization parameters.36 * @param array An associative array of initialization options. 37 37 * 38 38 * @return Boolean true, if initialization completes successfully, otherwise false. … … 40 40 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRouting. 41 41 */ 42 public function initialize(sfEventDispatcher $dispatcher, $ parameters = array())43 { 44 parent::initialize($dispatcher, $ parameters);45 46 $this->setDefaultSuffix( $this->parameterHolder->get('suffix'));42 public function initialize(sfEventDispatcher $dispatcher, $options = array()) 43 { 44 parent::initialize($dispatcher, $options); 45 46 $this->setDefaultSuffix(isset($options['suffix']) ? $options['suffix'] : ''); 47 47 } 48 48 … … 85 85 else 86 86 { 87 $module = isset($parameters['module']) && $parameters['module'] ? $parameters['module'] : $this-> parameterHolder->get('default_module');88 $action = isset($parameters['action']) && $parameters['action'] ? $parameters['action'] : $this-> parameterHolder->get('default_action');87 $module = isset($parameters['module']) && $parameters['module'] ? $parameters['module'] : $this->options['default_module']; 88 $action = isset($parameters['action']) && $parameters['action'] ? $parameters['action'] : $this->options['default_action']; 89 89 90 90 $internalUri = $module.'/'.$action; … … 169 169 public function clearRoutes() 170 170 { 171 if ($this-> parameterHolder->get('logging'))171 if ($this->options['logging']) 172 172 { 173 173 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Clear all current routes'))); … … 330 330 } 331 331 332 if ($this-> parameterHolder->get('logging'))332 if ($this->options['logging']) 333 333 { 334 334 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Connect "%s"%s', $route, $suffix ? ' ("'.$suffix.'" suffix)' : '')))); … … 581 581 $this->currentInternalUri = null; 582 582 583 if ($this-> parameterHolder->get('logging'))583 if ($this->options['logging']) 584 584 { 585 585 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Match route [%s] "%s"', $routeName, $route)))); … … 594 594 if (!$break) 595 595 { 596 if ($this-> parameterHolder->get('logging'))596 if ($this->options['logging']) 597 597 { 598 598 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('No matching route found'))); branches/1.1/lib/routing/sfRouting.class.php
r6510 r6663 22 22 $dispatcher = null, 23 23 $defaultParameters = array(), 24 $ parameterHolder = null;24 $options = array(); 25 25 26 26 /** … … 29 29 * @see initialize() 30 30 */ 31 public function __construct(sfEventDispatcher $dispatcher, $ parameters = array())31 public function __construct(sfEventDispatcher $dispatcher, $options = array()) 32 32 { 33 $this->initialize($dispatcher, $ parameters);33 $this->initialize($dispatcher, $options); 34 34 35 if ( $this->parameterHolder->get('auto_shutdown', true))35 if (isset($this->options['auto_shutdown']) && $this->options['auto_shutdown']) 36 36 { 37 37 register_shutdown_function(array($this, 'shutdown')); … … 43 43 * 44 44 * @param sfEventDispatcher A sfEventDispatcher instance 45 * @param array An associative array of initialization parameters.45 * @param array An associative array of initialization options. 46 46 * 47 47 * @return Boolean true, if initialization completes successfully, otherwise false. … … 49 49 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRouting. 50 50 */ 51 public function initialize(sfEventDispatcher $dispatcher, $ parameters = array())51 public function initialize(sfEventDispatcher $dispatcher, $options = array()) 52 52 { 53 53 $this->dispatcher = $dispatcher; 54 54 55 if (!isset($ parameters['default_module']))55 if (!isset($options['default_module'])) 56 56 { 57 $ parameters['default_module'] = 'default';57 $options['default_module'] = 'default'; 58 58 } 59 59 60 if (!isset($ parameters['default_action']))60 if (!isset($options['default_action'])) 61 61 { 62 $ parameters['default_action'] = 'index';62 $options['default_action'] = 'index'; 63 63 } 64 64 65 $this->parameterHolder = new sfParameterHolder(); 66 $this->parameterHolder->add($parameters); 65 if (!isset($options['logging'])) 66 { 67 $options['logging'] = false; 68 } 69 70 $this->options = $options; 67 71 68 72 $this->dispatcher->connect('user.change_culture', array($this, 'listenToChangeCultureEvent'));

