Development

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

You must first sign up to be able to contribute.

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

Revision 7779, 1.7 kB (checked in by fabien, 7 years ago)

change sfRouting::generate() signature to allow optional parameter value

  • 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->fixDefaults($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(), $querydiv = '/', $divider = '/', $equals = '/')
41   {
42     $parameters = http_build_query($this->mergeArrays($this->defaultParameters, $params), null, '&');
43
44     return '/'.($parameters ? '?'.$parameters : '');
45   }
46
47  /**
48   * @see sfRouting
49   */
50   public function parse($url)
51   {
52     return array();
53   }
54
55   /**
56    * @see sfRouting
57    */
58   public function getRoutes()
59   {
60     return array();
61   }
62
63   /**
64    * @see sfRouting
65    */
66   public function setRoutes($routes)
67   {
68     return array();
69   }
70
71   /**
72    * @see sfRouting
73    */
74   public function hasRoutes()
75   {
76     return false;
77   }
78
79   /**
80    * @see sfRouting
81    */
82   public function clearRoutes()
83   {
84   }
85 }
86
Note: See TracBrowser for help on using the browser.