Changeset 7514
- Timestamp:
- 02/16/08 11:39:00 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/routing/sfPatternRouting.class.php
r7457 r7514 253 253 $suffix = $this->defaultSuffix; 254 254 255 // used for performance reasons 256 $namesHash = array(); 257 258 $r = null; 259 if (($route == '') || ($route == '/')) 260 { 261 $regexp = '/^[\/]*$/'; 262 $this->routes[$name] = array($route, $regexp, array(), array(), $default, $requirements, $suffix); 255 // a route must start by a slash. If there is none, add it automatically 256 if ('/' != $route[0]) 257 { 258 $route = '/'.$route; 259 } 260 261 if ($route == '/') 262 { 263 $this->routes[$name] = array($route, '/^[\/]*$/', array(), array(), $default, $requirements, $suffix); 263 264 } 264 265 else 265 266 { 267 // used for performance reasons 268 $namesHash = array(); 269 $r = null; 266 270 $elements = array(); 267 271 foreach (explode('/', $route) as $element) … … 458 462 } 459 463 $realUrl = preg_replace('/\/\*(\/|$)/', "$tmp$1", $realUrl); 460 } 461 462 // strip off last divider character463 if (strlen($realUrl) > 1)464 {465 $realUrl = rtrim($realUrl, $divider);466 } 467 468 if ( $realUrl != '/')464 465 // strip off last divider character 466 if (strlen($realUrl) > 1) 467 { 468 $realUrl = rtrim($realUrl, $divider); 469 } 470 } 471 472 if ('/' != $realUrl && '/' != substr($realUrl, -1)) 469 473 { 470 474 $realUrl .= $suffix;

