Finds a page by its URL. Returns the page object and sets the $parameters property.
@param string $url The requested URL string.
@return \Cms\Classes\Page Returns \Cms\Classes\Page object or null if the page cannot be found.
196414
public function findByUrl($url)
    {
        $this->url = $url;
        $url = RouterHelper::normalizeUrl($url);

        /**
         * @event cms.router.beforeRoute
         * Fires before the CMS Router handles a route
         *
         * Example usage:
         *
         *     Event::listen('cms.router.beforeRoute', function ((string) $url, (\Cms\Classes\Router) $thisRouterInstance) {
         *         return \Cms\Classes\Page::loadCached('trick-theme-code', 'page-file-name');
         *     });
         *
         */
        $apiResult = Event::fire('cms.router.beforeRoute', [$url, $this], true);
        if ($apiResult !== null) {
            return $apiResult;
        }

        for ($pass = 1; $pass <= 2; $pass++) {
            $fileName = null;
            $urlList = [];

            $cacheable = Config::get('cms.enableRoutesCache');
            if ($cacheable) {
                $fileName = $this->getCachedUrlFileName($url, $urlList);
                if (is_array($fileName)) {
                    list($fileName, $this->parameters) = $fileName;
                }
            }

            /*
             * Find the page by URL and cache the route
             */
            if (!$fileName) {
                $router = $this->getRouterObject();
                if ($router->match($url)) {
                    $this->parameters = $router->getParameters();

                    $fileName = $router->matchedRoute();

                    if ($cacheable) {
                        if (!$urlList || !is_array($urlList)) {
                            $urlList = [];
                        }

                        $urlList[$url] = !empty($this->parameters)
                            ? [$fileName, $this->parameters]
                            : $fileName;

                        $key = $this->getUrlListCacheKey();
                        Cache::put(
                            $key,
                            base64_encode(serialize($urlList)),
                            Config::get('cms.urlCacheTtl', 1)
                        );
                    }
                }
            }

            /*
             * Return the page
             */
            if ($fileName) {
                if (($page = Page::loadCached($this->theme, $fileName)) === null) {
                    /*
                     * If the page was not found on the disk, clear the URL cache
                     * and repeat the routing process.
                     */
                    if ($pass == 1) {
                        $this->clearCache();
                        continue;
                    }

                    return null;
                }

                return $page;
            }

            return null;
        }
    }
1016823
public function url($page)
	{
		if ($page <= 0) $page = 1;

		// If we have any extra query string key / value pairs that need to be added
		// onto the URL, we will put them in query string form and then attach it
		// to the URL. This allows for extra information like sortings storage.
		$parameters = [$this->pageName => $page];

		if (count($this->query) > 0)
		{
			$parameters = array_merge($this->query, $parameters);
		}

		return $this->path.'?'
		                .http_build_query($parameters, null, '&')
		                .$this->buildFragment();
	}
546237
public function getPage() {
    $page = $this->traverse($this->pageMap, Server::getRequestUriParts());
    if ($page === null) {
      return null;
    }
    return $this->createWebPageFromClassName($page);
  }
1027074
public function getUrl($url)
    {
        if (is_array($url) && ! empty($url['route'])) {
            try {
                $Comet = \CometPHP\Comet::getInstance();
            } catch (\CometPHP\Exceptions\CometNotBooted $e) {
                return null;
            }

            $routeName = $url['route'];
            unset($url['route']);

            $generatedUrl = $Comet['routeGenerator']->generate(
                $routeName,
                $url
            );

            return $generatedUrl;
        }

        return $url;
    }
742628
public static function startPage($page = null)
    {
        if ($page !== null) {
            self::$_startPage = $page;
        }
        return self::$_startPage;
    }
857296
public function get($url, $parameters = [])
    {
        $query = $this->buildQuery($url, $parameters);
        $url = static::LOCATION.$url.(strpos($url, '?') !== false ? '&' : '?').$query;
        $headers = $this->buildHeaders();

        $request = $this->requestProvider->createRequest('GET', $url, $headers);
        $response = $this->client->send($request);

        // Throw any errors we have before continuing
        $this->errorCheckResponse($response);

        return json_decode($this->streamToString($response->getBody()));
    }
1036074
public function parse($url)
    {
        $this->_fixUrlForParsing($url);

        if (empty($url->path) && !isset($url->query['option'])) {
            $url->path = (get_viewer()->guest()) ? 'pages' : 'dashboard';
        }

        $segments = explode('/', trim($url->path, '/'));
        $segments = array_filter($segments);

        if (!empty($segments)) {
            $component = array_shift($segments);
            $url->query = array_merge(array('option' => 'com_'.$component), $url->query);
            $component = str_replace('com_', '', $url->query['option']);
            $query = $this->getComponentRouter($component)->parse($segments);
            $url->query = array_merge($url->query, array('option' => 'com_'.$component), $query);
        }

        return $url;
    }
76639
public function url($url = null)
    {
        if ($url) {
            $command = $this->getDriver()->factoryCommand('url', WebDriver_Command::METHOD_POST, ['url' => $url]);
            //protect slowest pages and lost selenium connection
            try {
                $this->getDriver()->curl($command);
            } catch (WebDriver_NoSeleniumException $mainException) {
                if (!$this->config()->get(WebDriver_Config::IMPROVED_URL_OPEN)) {
                    throw $mainException;
                }
                try {
                    $currentUrl = $this->url();
                    $partCheck = [PHP_URL_PATH, PHP_URL_QUERY, PHP_URL_HOST];
                    $isEqual = true;
                    foreach ($partCheck as $urlPart) {
                        if (parse_url($url, $urlPart) != parse_url($currentUrl, $urlPart)) {
                            var_dump(parse_url($url, $urlPart));
                            $isEqual = false;
                        }
                    }
                    if (!$isEqual) {
                        throw $mainException;
                    }
                } catch (WebDriver_NoSeleniumException $e) {
                    throw $mainException;
                }
            }
        } else {
            $result = $this->getDriver()->curl(
                $this->getDriver()->factoryCommand('url', WebDriver_Command::METHOD_GET)
            );
            return $result['value'];
        }
    }
434572
public static function google(Url $url)
    {
        if (($value = $url->getQueryParameter('url'))) {
            return Url::create($value);
        }

        return $url;
    }
1018109
public function page($page = null) {
		if ($page) {
			$this->_config['page'] = $page = ((integer) $page ?: 1);
			$this->offset(($page - 1) * $this->_config['limit']);
			return $this;
		}
		return $this->_config['page'];
	}
1007296
public function url(string $url = null) : self
    {
        if (! $url) {
            $url = null;

            $httpHost = getenv('APP_URL'); // Has to start with a protocol - for example "http://"!

            if ($httpHost === false) {
                $url = 'http';

                // Quick and dirty
                if (isset($_SERVER['HTTPS'])) {
                    $url .= 's';
                }

                $url .= '://';

                $httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost/';
            }  

            $requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
            
            $safeRequestURI = htmlentities(strip_tags(urldecode($requestUri)));

            $url .= "{$httpHost}{$safeRequestURI}";
        } 

        if ($this->validate and ! filter_var($url, FILTER_VALIDATE_URL)) {
            throw new Exception("Open Graph: Invalid URL '{$url}'");
        }

        $this->forget('url');

        $this->tags[] = $this->createTag('url', $url);

        return $this;
    }
636759
public function get(String $url = NULL)
    {
        $response = $this->curl
                         ->init($this->url ?? $url)
                         ->option('returntransfer', true)
                         ->option('ssl_verifypeer', $this->sslVerifyPeer)
                         ->exec();

        return $this->_result($response);
    }
264538
protected static function parseUrl($url)
    {
        $url           = isset($url) ? $url : "//$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
        $url           = parse_url($url);
        $url['browse'] = './';
        if (array_key_exists('browse', self::$requestMethod)
            && !empty(self::$requestMethod['browse'])
        ) {
            $url['browse'] = self::$requestMethod['browse'];
        }
        return $url;
    }
1013692
public function setUrl(string $url = null)
    {
        $this->url = $url;

        if ($url !== null) {
            $this->callbackData = null;
            $this->switchInlineQuery = null;
        }

        return $this;
    }
150020
public function getByUrl(?string $url, $locale): ?Page
	{
		/* @var $orm Orm */
		$orm = $this->getRepository()->getModel();
		if ($locale instanceof Locale) {
			$eLocale = $locale;
		} else {
			$eLocale = $orm->locales->getByLocale($locale);
		}

		$urls = $this->getPageList();
		if (isset($urls[$url])) {
			$builder = $this->builder()
				->andWhere('[id] = %i', $urls[$url])
				->andWhere('[localeId] = %i', $eLocale->id);
			return $this->toEntity($builder);
		}
		return null;
	}
258360
public static function tryParse(string $url): ?UrlInterface
    {
        if (!self::myParse(null, $url, $scheme, $host, $port, $path, $queryString, $fragment)) {
            return null;
        }

        return new self($scheme, $host, $port, $path, $queryString, $fragment);
    }
1157194
public function url($url, ...$parameters)
    {
        $this->link_type = self::LINK_URL;
        $this->link_value = [$url, $parameters];
        $this->checkActive();

        return $this;
    }