Example #1
0
 public function parse(Library\HttpUrl $url)
 {
     $vars = array();
     $path = trim($url->getPath(), '/');
     //Remove base path
     $path = substr_replace($path, '', 0, strlen($this->getObject('request')->getBaseUrl()->getPath()));
     // Set the format
     if (!empty($url->format)) {
         $url->query['format'] = $url->format;
     }
     //Parse site route
     $url->query['site'] = $this->getObject('application')->getSite();
     $path = str_replace($url->query['site'], '', $path);
     $path = ltrim($path, '/');
     //Parse component route
     if (!empty($path)) {
         $segments = explode('/', $path);
         if (isset($segments[0])) {
             $vars['option'] = 'com_' . $segments[0];
             if (isset($segments[1])) {
                 $vars['view'] = $segments[1];
             } else {
                 $vars['view'] = $segments[0];
             }
         }
     }
     $url->query = array_merge($url->query, $vars);
     $url->path = '';
     return true;
 }
Example #2
0
 public function parse(Library\HttpUrl $url)
 {
     // Get the path
     $path = trim($url->getPath(), '/');
     //Remove base path
     $path = substr_replace($path, '', 0, strlen($this->getObject('request')->getBaseUrl()->getPath()));
     // Set the format
     if (!empty($url->format)) {
         $url->query['format'] = $url->format;
     }
     //Set the route
     $url->path = trim($path, '/');
     return $this->_parseRoute($url);
 }
Example #3
0
 public function parse(Library\HttpUrl $url)
 {
     $vars = array();
     $path = trim($url->getPath(), '/');
     //Remove base path
     $path = substr_replace($path, '', 0, strlen($this->getObject('request')->getBaseUrl()->getPath()));
     // Set the format
     if (!empty($url->format)) {
         $url->query['format'] = $url->format;
     }
     //Parse site route
     $url->query['site'] = $this->getObject('application')->getSite();
     $path = preg_replace('/^' . $url->query['site'] . '/', '', $path);
     $path = ltrim($path, '/');
     // Parse language.
     $languages = $this->getObject('application.languages');
     if (count($languages) > 1) {
         $language = $languages->find(array('slug' => strtok($path, '/')));
         if (count($language)) {
             $languages->setActive($language->top());
             $path = substr($path, strlen(strtok($path, '/')) + 1);
         }
     }
     //Parse component route
     if (!empty($path)) {
         $segments = explode('/', $path);
         if (isset($segments[0])) {
             $vars['option'] = 'com_' . $segments[0];
             if (isset($segments[1])) {
                 $vars['view'] = $segments[1];
             } else {
                 $vars['view'] = $segments[0];
             }
         }
     }
     $url->query = array_merge($url->query, $vars);
     $url->path = '';
     return true;
 }