functionis_route($url)
33: function is_route($url) {
34: if ( isset ($this->routes[$url])) {
35: return true;
36: }
37: return false;
38: }
File: lib/support/mapper.php, #line 33
functionfind_route($request_uri)
40: function find_route($request_uri) {
41: $uri = parse_url($request_uri);
42: if ($uri['path'] == '/') {
43: $path[] = $uri['path'];
44: } else {
45: $path = explode('/', $uri['path']);
46: }
47:
48: $buffer = false;
49:
50: foreach ($this->routes as $route_path=>$options) {
51: if ($route_path == '/') {
52: $route_path_array[] = $route_path;
53: } else {
54: $route_path_array = explode('/', $route_path);
55: }
56:
57: if (count($route_path_array) != count($path)) {
58: continue ;
59: }
60:
61: foreach ($route_path_array as $key=>$part) {
62:
63: if (preg_match('/^:(.*)/', trim($part))) {
64: $this->params[ltrim($part, ':')] = $path[$key];
65: $buffer = $route_path;
66: }
67: elseif ($part != $path[$key]) {
68: $buffer = false;
69: break;
70: }
71: else if (trim($part) != '') {
72: $buffer = $route_path;
73: }
74: }
75:
76: if ($buffer) {
77: return $buffer;
78: }
79:
80: }
81: return false;
82: }
File: lib/support/mapper.php, #line 40
