Creates and returns a link css object.

@param string $url

@return Css
970064
public function &link($url)
    {
        $css_object = new CssObject();

        $css_object->setType('file');
        $css_object->setCss($url);

        $this->add($css_object);

        return $css_object;
    }
475216
public function generateUrl($url)
    {
        $extern = false;
        if ((0 === strrpos($url, 'http://'))
            || (0 === strrpos($url, 'https://'))) {
            $extern = true;
        }

        $http = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';

        if (!$extern) {
            return ($this->getRoot() == '/')
                ? (($this->getRoot() == $url) ? '' : $url) : $http.$_SERVER['SERVER_NAME'].$this->getRoot().$url;
        } else {
            return $url;
        }
    }
50784
function css($flush = true) {
        $css = $this->_css;
        if ($flush) $this->_css = [];
        $html = '';
        foreach ($css as $url => $inc) {
            $html .= '<link rel="stylesheet" href="'.$url.'">'.PHP_EOL;
        }
        if (!empty($this->_styles)) {
            $styles = $this->_styles;
            if ($flush) $this->_styles = [];
            $html .= '<style>'.PHP_EOL;
            foreach ($styles as $selector => $style)
            {
                if ($selector) {
                    $html .= $selector . ' { ' . $style . ' }' . PHP_EOL;
                } else {
                    $html .= $style;
                }
            }
            $html .= '</style>';
        }
        return $html;
    }
1038554
public static function getImageFromUrl($url = '')
    {
        try {
            $curl = new Curl();
            $curl->setOpt(CURLOPT_RETURNTRANSFER, TRUE);
            $curl->setOpt(CURLOPT_ENCODING, "");
            $curl->setOpt(CURLOPT_MAXREDIRS, 10);
            $curl->setOpt(CURLOPT_TIMEOUT, 30);
            $curl->setOpt(CURLOPT_CONNECTTIMEOUT, 30);
            $curl->setOpt(CURLOPT_FOLLOWLOCATION, TRUE);
            $curl->get($url);
            if ($curl->error === TRUE) {
                self::debug('Error Exception: ' . $curl->httpErrorMessage);

                return array(
                    'status'          => 'error',
                    'code'            => $curl->httpStatusCode,
                    'error'           => $curl->errorMessage,
                    'response_header' => $curl->responseHeaders,
                    'content'         => NULL
                );
            } else {
                return array(
                    'status'          => 'success',
                    'code'            => $curl->httpStatusCode,
                    'error'           => $curl->errorMessage,
                    'response_header' => $curl->responseHeaders,
                    'content'         => $curl->response
                );
            }
        }
        catch (\Exception $e) {
            if (function_exists('log_message')) {
                $message = 'Error Code: ' . $e->getCode() . ' - File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage();
                log_message('error', $message);
            }

            return file_get_contents($url);
        }
    }
81774
private function getUrl(string $url): string
    {
        $urlParts = parse_url($url);

        if ($urlParts === false) {
            throw new \ParseError("Could not parse URL: $url");
        }

        if ($this->baseUrl !== null && ! isset($urlParts['host'])) {
            $url = $this->baseUrl . '/' . ltrim($url, '/');
        }

        return $url;
    }
100056
public function url($url)
    {
        if (strpos($url, 'https:') === 0) {
            $this->def['ssl'] = true;
        } else {
            if (strpos($url, 'http:') === false && strpos($url, '//') === false) {
                $url = 'http://' . $url;
            }
        }
        
        $this->def['url'] = $url;
        return $this;
    }
710498
public function getPagination($url)
    {
        $gets = null;
        $gets = $this->gets;
        $page = $this->page;
        $gets['pageSize'] = $this->pageSize;
        if ($page > 1) {
            $gets['page'] = 1;
            $newUrl = URLUtil::addParameter($url, $gets);
            $laquo = "<li><a href=\"{$newUrl}\">&laquo;</a></li>";
            $gets['page'] = $page - 1;
            $newUrl = URLUtil::addParameter($url, $gets);
            $left = "<li><a href=\"{$newUrl}\">&lt;</a></li>";
        } else {
            $laquo = "<li class=\"disabled\"><a href='#'>&laquo;</a></li>";
            $left = "<li class=\"disabled\"><a href='#'>&lt;</a></li>";
        }
        if ($page < $this->total) {
            $gets['page'] = $this->total;
            $newUrl = URLUtil::addParameter($url, $gets);
            $raquo = "<li><a href=\"{$newUrl}\">&raquo;</a></li>";
            $gets['page'] = $page + 1;
            $newUrl = URLUtil::addParameter($url, $gets);
            $right = "<li><a href=\"{$newUrl}\">&gt;</a></li>";
        } else {
            $raquo = "<li class=\"disabled\"><a href='#'>&raquo;</a></li>";
            $right = "<li class=\"disabled\"><a href='#'>&gt;</a></li>";
        }

        $otherPages = [];
        $start = 1;
        if ($this->total > 5) {
            $start = $page;
            while (true) {
                if ($start - 2 >= 1 && $start + 2 <= $this->total) {
                    break;
                } else if ($start - 2 <= 1) {
                    $start++;
                } else if ($start + 2 >= $this->total) {
                    $start--;
                }
            }
            $end = $start + 2;
            $start -= 2;
        } else {
            $end = $this->total;
        }
        for ($i = $start; $i <= $end; $i++) {
            if ($page == $i) {
                $otherPages[] = "<li class=\"active\"><a href=\"#\">{$i}</a></li>";
            } else {
                $gets['page'] = $i;
                $newUrl = URLUtil::addParameter($url, $gets);
                $otherPages[] = "<li><a href=\"{$newUrl}\">{$i}</a></li>";
            }
        }

        array_unshift($otherPages, $left);
        array_unshift($otherPages, $laquo);
        array_push($otherPages, $right);
        array_push($otherPages, $raquo);
        $html = '<ul class="pagination">' . join("\n", $otherPages) . '</ul>';
        return $html;
    }
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'];
        }
    }
842499
protected function patchUrl($url)
    {
        if (substr($url, 0, 1) !== '/' && !preg_match('#^[a-zA-Z0-9]+://#', $url)) {
            $url = \JUri::base(true) . '/' . $url;
        }

        $patched = false;
        $base = \JUri::base(false, false);
        if (stripos($url, $base) === 0) {
            $patched = true;
            $url = substr($url, strlen($base));
        } else {
            $base = \JUri::base(true, false);
            if (stripos($url, $base) === 0) {
                $patched = true;
                $url = substr($url, strlen($base));
            }
        }

        if ($patched) {
            $url = self::$helper->getUrl($url);
        }

        return $url;
    }
890547
public static function createFromUrl($url)
    {
        $instance = new static();

        if (self::$generic_file->fetchUrl($url, null, $instance)) {
            return $instance;
        }

        return;
    }
661344
public function favicon($url)
    {
        return $url ? $this->router->generate('media_favicon', ['host' => parse_url($url, PHP_URL_HOST)]) : false;
    }
69551
protected function buildUrl($url)
    {
        if (strpos($url, '://') || 0 === strpos($url, '/')) {
            return $url;
        } elseif ($url === '') {
            return $url;
        } else {
            return Url::build($url);
        }
    }
1193931
private function buildUrl($url)
    {
        $url = $this->protocol . '://' . $url . '/';

        if ($this->date) {
            $url .= $this->date;
        } else {
            $url .= 'latest';
        }

        $url .= '?base=' . $this->base;

        if ($this->key) {
            $url .= '&access_key=' . $this->key;
        }

        if ($symbols = $this->symbols) {
            $url .= '&symbols=' . implode(',', $symbols);
        }

        return $url;
    }
971777
public static function normalizeUrl($url) {
        if (!class_exists('URLNormalizer')) {
            require_once(realpath(__DIR__.'/../../classes').'/URLNormalizer.php'); 
        }

        $un = new \URLNormalizer();
        $un->setUrl($url);
        return $un->normalize();
    }
1125400
private function createUrl(string $url): Url
    {
        $url = new Url($url);

        if ((new SchemeLess)->isSatisfiedBy($url)) {
            $url = $url->appendScheme(
                new Scheme($this->schemes[0] ?? 'http')
            );
        }

        return $url;
    }
958548
public function createFormUrl($url)
    {
        $urlParts = parse_url($url);

        $scheme = isset($urlParts['scheme']) ? $urlParts['scheme'] : '';
        $user = isset($urlParts['user']) ? $urlParts['user'] : '';
        $password = isset($urlParts['pass']) ? $urlParts['pass'] : '';
        $host = isset($urlParts['host']) ? $urlParts['host'] : '';
        $port = isset($urlParts['port']) ? $urlParts['port'] : null;
        $path = isset($urlParts['path']) ? $urlParts['path'] : '';
        $query = isset($urlParts['query']) ? $urlParts['query'] : '';
        $fragment = isset($urlParts['fragment']) ? $urlParts['fragment'] : '';

        $this->setUri($scheme, $host, $port, $path, $query, $fragment, $user, $password);

        return $this;
    }
187354
public function visit(string $url): Dusk
    {
        $url = $this->applyBaseUrl($url);

        $this->getBrowser()->visit($url);

        return $this;
    }