/** * Generates the full URL for a certain page. * * @param integer page number * @return string page URL */ public function url($page = 1) { // Clean the page number $page = \max(1, (int) $page); // No page number in URLs to first page if ($page === 1) { $page = null; } switch ($this->config['current_page']['source']) { case 'query_string': return \Core::url(\HttpIO::$uri) . \HttpIO::query(array($this->config['current_page']['key'] => $page)); case 'route': return \Core::url(Core::route_url(array($this->config['current_page']['key'] => $page))) . \HttpIO::query(); default: $tmparr = array(); if (\is_numeric($this->config['current_page']['key'])) { for ($i = 0; $i < $this->config['current_page']['key']; $i++) { $tmparr[$i] = (string) \HttpIO::$params['arguments'][$i]; } } $tmparr[$this->config['current_page']['key']] = $page; return \Core::url(\HttpIO::uri($tmparr)) . \HttpIO::query(); } return '#'; }
/** * Create a URL from the current request. This is a shortcut for: * * echo URL::site($this->request->uri($params), $protocol); * * @param array $protocol URI parameters * @param mixed $protocol protocol string or boolean, adds protocol and domain * @return string * @uses URL::site * @uses HttpIO::uri */ public static function url(array $params = null, $protocol = null) { // Create a URI with the current route and convert it to a URL return Core::url(HttpIO::uri($params), $protocol); }