Example #1
0
 /**
  * Parse the segments of a URL.
  *
  * @param   array   The segments of the URL to parse.
  * @return  array   The URL attributes to be used by the application.
  */
 public function parse(&$segments)
 {
     $path = implode('/', $segments);
     $vars = array();
     $matches = array();
     if (preg_match('/(\\d+)-([^\\/]+)/', $path, $matches)) {
         $vars['alias'] = $matches[2];
         $path = str_replace($matches[0], $matches[1], $path);
         $segments = array_filter(explode('/', $path));
     }
     $path = implode('/', $segments);
     $matches = array();
     if (preg_match('/@(\\w+)/', $path, $matches)) {
         $vars['oid'] = $matches[1];
         if (isset($matches[2])) {
             $vars['view'] = $matches[2];
         }
         $path = ltrim(str_replace($matches[0], '', $path), '/');
         $segments = array_filter(explode('/', $path));
     }
     $vars = array_merge($vars, parent::parse($segments));
     if (isset($vars['id']) && current($segments)) {
         $vars['alias'] = array_shift($segments);
     }
     return $vars;
 }
Example #2
0
 /**
  * Parse the segments of a URL.
  *
  * @param   array   The segments of the URL to parse.
  * 
  * @return  array   The URL attributes to be used by the application.
  */
 public function parse(&$segments)
 {
     $query = array();
     if (!count($segments)) {
         $query['view'] = 'packages';
     } else {
         $query = parent::parse($segments);
     }
     return $query;
 }
Example #3
0
 /**
  * (non-PHPdoc).
  *
  * @see ComBaseRouterAbstract::parse()
  */
 public function parse(&$segments)
 {
     $query = array();
     $path = implode('/', $segments);
     if ($path == 'new') {
         array_pop($segments);
         $query = array_merge(parent::parse($segments), array('new' => true));
     } else {
         return parent::parse($segments);
     }
     return $query;
 }
Example #4
0
 /**
  * (non-PHPdoc).
  *
  * @see ComBaseRouterAbstract::build()
  */
 public function build(&$query)
 {
     $segments = array();
     if (isset($query['oid'])) {
         $segments[] = '@' . $query['oid'];
         unset($query['oid']);
     }
     $segments = array_merge($segments, parent::build($query));
     if (isset($query['server'])) {
         $segments[] = 'server';
         $segments[] = $query['server'];
         unset($query['server']);
     }
     if (isset($query['get']) == 'accesstoken') {
         $segments[] = 'token';
         unset($query['get']);
     }
     return $segments;
 }
Example #5
0
 /**
  * Parse the segments of a URL.
  *
  * @param   array   The segments of the URL to parse.
  * @return  array   The URL attributes to be used by the application.
  */
 public function parse(&$segments)
 {
     $path = implode('/', $segments);
     $vars = array();
     $matches = array();
     if (preg_match('/(\\d+)-([^\\/]+)/', $path, $matches)) {
         $vars['alias'] = $matches[2];
         $path = str_replace($matches[0], $matches[1], $path);
         $segments = array_filter(explode('/', $path));
     }
     $last = AnHelperArray::getValueAtIndex($segments, AnHelperArray::LAST_INDEX);
     if (preg_match('/@\\w+/', $last)) {
         $vars['oid'] = str_replace('@', '', array_pop($segments));
     }
     $vars = array_merge($vars, parent::parse($segments));
     if (isset($vars['get']) && $vars['get'] == 'graph') {
         $vars['type'] = count($segments) ? array_shift($segments) : 'followers';
     }
     return $vars;
 }