Example #1
0
 static function recognise(URL $url)
 {
     if (self::$match === null) {
         self::$match = array();
         static::generate_matches();
     }
     $path = $url->getPath()->getPath(true);
     $matches = null;
     foreach (self::$match as $data) {
         if ($data->matches($path, $matches)) {
             return $data->call($matches);
         }
     }
 }
Example #2
0
 static function recognise(URL $url)
 {
     $path = $url->getPath()->getPath(true);
     $match = null;
     foreach (static::$match as $expr => $class) {
         $matches = Format::consumeRegex($path, $expr, $match);
         if ($matches) {
             if (is_array($class) || is_string($class)) {
                 if (is_array($class)) {
                     $data = isset($class['data']) ? $class['data'] : $match;
                     $class = $class['class'];
                 } else {
                     $data = $match;
                     //matched but no data
                     if ($data === true) {
                         $data = array();
                     }
                 }
                 if (is_string($class)) {
                     if ($class[0] != '\\') {
                         $class_expr = '\\*\\Web\\Page\\Controller\\' . $class;
                         $class = null;
                         foreach (\Radical\Core\Libraries::get($class_expr) as $class) {
                             //$class set
                             break;
                         }
                         if ($class === null) {
                             return null;
                         }
                     }
                     return new $class($data);
                 }
             }
             return $class;
         }
     }
 }
Example #3
0
 function getRealPath()
 {
     return parent::getPath();
 }