4
* This file is part of the symfony package.
5
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
7
* For the full copyright and license information, please view the LICENSE
8
* file that was distributed with this source code.
12
* sfNoRouting class is a very simple routing class that uses GET parameters.
16
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
17
* @version SVN: $Id: sfNoRouting.class.php 20566 2009-07-29 07:04:01Z fabien $
19
class sfNoRouting extends sfRouting
24
public function getCurrentInternalUri($with_route_name = false)
26
$parameters = $this->mergeArrays($this->defaultParameters, $_GET);
27
$action = sprintf('%s/%s', $parameters['module'], $parameters['action']);
30
unset($parameters['module'], $parameters['action']);
32
$parameters = count($parameters) ? '?'.http_build_query($parameters, null, '&') : '';
34
return sprintf('%s%s', $action, $parameters);
40
public function generate($name, $params = array(), $absolute = false)
42
$parameters = $this->mergeArrays($this->defaultParameters, $params);
43
if ($this->getDefaultParameter('module') == $parameters['module'])
45
unset($parameters['module']);
47
if ($this->getDefaultParameter('action') == $parameters['action'])
49
unset($parameters['action']);
52
$parameters = http_build_query($parameters, null, '&');
54
return $this->fixGeneratedUrl('/'.($parameters ? '?'.$parameters : ''), $absolute);
60
public function parse($url)
68
public function getRoutes()
76
public function setRoutes($routes)
84
public function hasRoutes()
92
public function clearRoutes()
96
protected function mergeArrays($arr1, $arr2)
98
foreach ($arr2 as $key => $value)
100
$arr1[$key] = $value;