sfNoRouting.class.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * sfNoRouting class is a very simple routing class that uses GET parameters.
  11. *
  12. * @package symfony
  13. * @subpackage routing
  14. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  15. * @version SVN: $Id: sfNoRouting.class.php 7779 2008-03-08 18:08:36Z fabien $
  16. */
  17. class sfNoRouting extends sfRouting
  18. {
  19. /**
  20. * @see sfRouting
  21. */
  22. public function getCurrentInternalUri($with_route_name = false)
  23. {
  24. $parameters = $this->fixDefaults($this->mergeArrays($this->defaultParameters, $_GET));
  25. $action = sprintf('%s/%s', $parameters['module'], $parameters['action']);
  26. // other parameters
  27. unset($parameters['module'], $parameters['action']);
  28. ksort($parameters);
  29. $parameters = count($parameters) ? '?'.http_build_query($parameters, null, '&') : '';
  30. return sprintf('%s%s', $action, $parameters);
  31. }
  32. /**
  33. * @see sfRouting
  34. */
  35. public function generate($name, $params = array(), $querydiv = '/', $divider = '/', $equals = '/')
  36. {
  37. $parameters = http_build_query($this->mergeArrays($this->defaultParameters, $params), null, '&');
  38. return '/'.($parameters ? '?'.$parameters : '');
  39. }
  40. /**
  41. * @see sfRouting
  42. */
  43. public function parse($url)
  44. {
  45. return array();
  46. }
  47. /**
  48. * @see sfRouting
  49. */
  50. public function getRoutes()
  51. {
  52. return array();
  53. }
  54. /**
  55. * @see sfRouting
  56. */
  57. public function setRoutes($routes)
  58. {
  59. return array();
  60. }
  61. /**
  62. * @see sfRouting
  63. */
  64. public function hasRoutes()
  65. {
  66. return false;
  67. }
  68. /**
  69. * @see sfRouting
  70. */
  71. public function clearRoutes()
  72. {
  73. }
  74. }