Development

/branches/1.3/lib/routing/sfNoRouting.class.php

You must first sign up to be able to contribute.

root/branches/1.3/lib/routing/sfNoRouting.class.php

Revision 20566, 2.1 kB (checked in by fabien, 5 years ago)

[1.3] deprecated sfNoRouting and sfPathInfoRouting classes

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
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  * sfNoRouting class is a very simple routing class that uses GET parameters.
13  *
14  * @package    symfony
15  * @subpackage routing
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfNoRouting extends sfRouting
20 {
21   /**
22    * @see sfRouting
23    */
24   public function getCurrentInternalUri($with_route_name = false)
25   {
26     $parameters = $this->mergeArrays($this->defaultParameters, $_GET);
27     $action = sprintf('%s/%s', $parameters['module'], $parameters['action']);
28
29     // other parameters
30     unset($parameters['module'], $parameters['action']);
31     ksort($parameters);
32     $parameters = count($parameters) ? '?'.http_build_query($parameters, null, '&') : '';
33
34     return sprintf('%s%s', $action, $parameters);
35   }
36
37  /**
38   * @see sfRouting
39   */
40   public function generate($name, $params = array(), $absolute = false)
41   {
42     $parameters = $this->mergeArrays($this->defaultParameters, $params);
43     if ($this->getDefaultParameter('module') == $parameters['module'])
44     {
45       unset($parameters['module']);
46     }
47     if ($this->getDefaultParameter('action') == $parameters['action'])
48     {
49       unset($parameters['action']);
50     }
51
52     $parameters = http_build_query($parameters, null, '&');
53
54     return $this->fixGeneratedUrl('/'.($parameters ? '?'.$parameters : ''), $absolute);
55   }
56
57  /**
58   * @see sfRouting
59   */
60   public function parse($url)
61   {
62     return array();
63   }
64
65   /**
66    * @see sfRouting
67    */
68   public function getRoutes()
69   {
70     return array();
71   }
72
73   /**
74    * @see sfRouting
75    */
76   public function setRoutes($routes)
77   {
78     return array();
79   }
80
81   /**
82    * @see sfRouting
83    */
84   public function hasRoutes()
85   {
86     return false;
87   }
88
89   /**
90    * @see sfRouting
91    */
92   public function clearRoutes()
93   {
94   }
95
96   protected function mergeArrays($arr1, $arr2)
97   {
98     foreach ($arr2 as $key => $value)
99     {
100       $arr1[$key] = $value;
101     }
102
103     return $arr1;
104   }
105 }
106
Note: See TracBrowser for help on using the browser.