Permalink
Browse files

fixed anchor to handle mulitple namespaces for routing only, not linking

  • Loading branch information...
1 parent 02590de commit b1f506f65a86649873e4e6dfb42117419f732e52 @jeffturcotte jeffturcotte committed Feb 9, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 Anchor.php
View
@@ -737,7 +737,11 @@ public static function format($format, $underscorize=FALSE, $default=NULL)
// alter the full and class paths with namespace
if ($callback->namespace) {
- $namespace = self::underscorize($callback->namespace);
+ $namespace = preg_split('/(\\\\|_)/', $callback->namespace);
+ foreach($namespace as $key => $piece) {
+ $namespace[$key] = self::underscorize($piece);
+ }
+ $namespace = join('/', $namespace);
$path = "{$namespace}/{$path}";
$class_path = "{$namespace}/{$class_path}";
}
@@ -1061,7 +1065,7 @@ public static function run($exit=TRUE)
}
} catch (AnchorNotFoundException $e) {
if (!self::call(self::$not_found_callback)) {
- self::call('AnchorDefaultAdapter::notFound');
+ //self::call('AnchorDefaultAdapter::notFound');
}
break;
} catch (AnchorContinueException $e) {
@@ -1733,9 +1737,9 @@ private static function parseCallback($callback)
preg_match(
'/
- (?P<method>
+ ^(?P<method>
((?P<class>
- ((?P<namespace>[A-Za-z0-9\|\*\?]+)(\\\\|_))?
+ (?P<namespace>([A-Za-z0-9\|\*\?]+(\\\\|_))+)?
(?P<short_class>[A-Za-z0-9\|\*\?]+)
)::)?
(?P<short_method>[A-Za-z0-9\|\*\?\s_-]+)
@@ -1754,6 +1758,7 @@ private static function parseCallback($callback)
}
}
+ $callback->namespace = trim($callback->namespace, '\\ _');
$callback->parent_namespace = preg_replace('/(\\\\|_[A-Z]).*$/', '', $callback->namespace);
// create callback pattern

0 comments on commit b1f506f

Please sign in to comment.