/** * Build by resource. * * @param string $resource The resource key to find our route. * @param array $data The url query data. * @param boolean $xhtml Replace & by & for XML compilance. * @param integer $ssl Secure state for the resolved URI. * 1: Make URI secure using global secure site URI. * 2: Make URI unsecure using the global unsecure site URI. * * @return string Route url. */ public static function _($resource, $data = array(), $xhtml = true, $ssl = null) { if (strpos($resource, '.') === false) { $resource = 'com_quickcontent.' . $resource; } return parent::_($resource, $data, $xhtml, $ssl); }
/** * RemoteimageBuildRoute * * @param array &$query * * @return array */ function RemoteimageBuildRoute(&$query) { $segments = array(); $router = CmsRouter::getInstance('com_remoteimage'); $query = \Windwalker\Router\Route::build($query); if (!empty($query['view'])) { $segments = $router->build($query['view'], $query); unset($query['view']); } return $segments; }
/** * UserxtdBuildRoute * * @param array &$query * * @return array */ function UserxtdBuildRoute(&$query) { $segments = array(); $router = CmsRouter::getInstance('com_userxtd'); $query = \Windwalker\Router\Route::build($query); if (!empty($query['_resource'])) { $segments = $router->build($query['_resource'], $query); unset($query['_resource']); } else { $segments = $router->buildByRaw($query); } return $segments; }
/** * matchOptions * * @param Route $route * @param string $method * @param array $options * * @return bool */ protected function matchOptions(Route $route, $method, $options) { $options = $route->prepareOptions($options); // Match methods $this->checkType('method', $method, 'string'); $allowMethods = $route->getAllowMethods(); if ($allowMethods && !in_array(strtoupper($method), $allowMethods)) { return false; } // Match Host $this->checkType('host', $options['host'], 'string'); $host = $route->getHost(); if ($host && $host != strtolower($options['host'])) { return false; } // Match schemes $this->checkType('scheme', $options['scheme'], 'string'); $scheme = $route->getScheme(); if ($scheme && $scheme != strtolower($options['scheme'])) { return false; } $port = $route->getPort(); // Match port if (!$route->getSSL() && $port && $port != $options['port']) { return false; } if ($route->getSSL() && $port && $port != $options['port']) { return false; } return true; }
/** * Add Route * * @param string|Route $name * @param string $pattern * @param array $variables * @param array $method * @param array $options * * @return static */ public function addRoute($name, $pattern = null, $variables = array(), $method = array(), $options = array()) { if ($name instanceof Route) { $route = $name; } else { if (!is_string($pattern)) { throw new \InvalidArgumentException('Route pattern should be string'); } $route = new Route($name, $pattern, $variables, $method, $options); } if ($name = $route->getName()) { $this->routes[$name] = $route; } elseif (!$name || is_numeric($name)) { $this->routes[] = $route; } return $this; }
/** * redirectToList * * @param string $msg * @param string $type * * @return void */ public function redirectToList($msg = null, $type = 'message') { $this->redirect(\Windwalker\Router\Route::_('com_userxtd.user_id', array('id' => $this->recordId)), $msg, $type); }
/** * redirectToItem * * @param null $recordId * @param string $urlVar * @param null $msg * @param string $type * * @return void */ public function redirectToItem($recordId = null, $urlVar = 'id', $msg = null, $type = 'message') { $this->redirect(\Windwalker\Router\Route::_('com_userxtd.user_layout', array('id' => $recordId, 'layout' => 'edit'))); }