| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|