primo commit
This commit is contained in:
426
libraries/vendor/joomla/uri/src/AbstractUri.php
vendored
Normal file
426
libraries/vendor/joomla/uri/src/AbstractUri.php
vendored
Normal file
@ -0,0 +1,426 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Part of the Joomla Framework Uri Package
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
namespace Joomla\Uri;
|
||||
|
||||
/**
|
||||
* Base Joomla Uri Class
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
abstract class AbstractUri implements UriInterface
|
||||
{
|
||||
/**
|
||||
* Original URI
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $uri;
|
||||
|
||||
/**
|
||||
* Protocol
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $scheme;
|
||||
|
||||
/**
|
||||
* Host
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $host;
|
||||
|
||||
/**
|
||||
* Port
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $port;
|
||||
|
||||
/**
|
||||
* Username
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Password
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $pass;
|
||||
|
||||
/**
|
||||
* Path
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* Query
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $query;
|
||||
|
||||
/**
|
||||
* Anchor
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $fragment;
|
||||
|
||||
/**
|
||||
* Query variable hash
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $vars = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* You can pass a URI string to the constructor to initialise a specific URI.
|
||||
*
|
||||
* @param string $uri The optional URI string
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function __construct($uri = null)
|
||||
{
|
||||
if ($uri !== null) {
|
||||
$this->parse($uri);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method to get the string representation of the UriInterface object.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns full URI string.
|
||||
*
|
||||
* @param array $parts An array of strings specifying the parts to render.
|
||||
*
|
||||
* @return string The rendered URI string.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function toString($parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'])
|
||||
{
|
||||
$bitmask = 0;
|
||||
|
||||
foreach ($parts as $part) {
|
||||
$const = 'static::' . strtoupper($part);
|
||||
|
||||
if (\defined($const)) {
|
||||
$bitmask |= \constant($const);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render($bitmask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns full uri string.
|
||||
*
|
||||
* @param integer $parts A bitmask specifying the parts to render.
|
||||
*
|
||||
* @return string The rendered URI string.
|
||||
*
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public function render($parts = self::ALL)
|
||||
{
|
||||
// Make sure the query is created
|
||||
$query = $this->getQuery();
|
||||
|
||||
$uri = '';
|
||||
$uri .= $parts & static::SCHEME ? (!empty($this->scheme) ? $this->scheme . '://' : '') : '';
|
||||
$uri .= $parts & static::USER ? $this->user : '';
|
||||
$uri .= $parts & static::PASS ? (!empty($this->pass) ? ':' : '') . $this->pass . (!empty($this->user) ? '@' : '') : '';
|
||||
$uri .= $parts & static::HOST ? $this->host : '';
|
||||
$uri .= $parts & static::PORT ? (!empty($this->port) ? ':' : '') . $this->port : '';
|
||||
$uri .= $parts & static::PATH ? $this->path : '';
|
||||
$uri .= $parts & static::QUERY ? (!empty($query) ? '?' . $query : '') : '';
|
||||
$uri .= $parts & static::FRAGMENT ? (!empty($this->fragment) ? '#' . $this->fragment : '') : '';
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if variable exists.
|
||||
*
|
||||
* @param string $name Name of the query variable to check.
|
||||
*
|
||||
* @return boolean True if the variable exists.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function hasVar($name)
|
||||
{
|
||||
return array_key_exists($name, $this->vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a query variable by name.
|
||||
*
|
||||
* @param string $name Name of the query variable to get.
|
||||
* @param string $default Default value to return if the variable is not set.
|
||||
*
|
||||
* @return mixed Requested query variable if present otherwise the default value.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getVar($name, $default = null)
|
||||
{
|
||||
if (array_key_exists($name, $this->vars)) {
|
||||
return $this->vars[$name];
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns flat query string.
|
||||
*
|
||||
* @param boolean $toArray True to return the query as a key => value pair array.
|
||||
*
|
||||
* @return string|array Query string or Array of parts in query string depending on the function param
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getQuery($toArray = false)
|
||||
{
|
||||
if ($toArray) {
|
||||
return $this->vars;
|
||||
}
|
||||
|
||||
// If the query is empty build it first
|
||||
if ($this->query === null) {
|
||||
$this->query = static::buildQuery($this->vars);
|
||||
}
|
||||
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI scheme (protocol)
|
||||
*
|
||||
* @return string The URI scheme.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getScheme()
|
||||
{
|
||||
return $this->scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI username
|
||||
*
|
||||
* @return string The username, or null if no username was specified.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI password
|
||||
*
|
||||
* @return string The password, or null if no password was specified.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getPass()
|
||||
{
|
||||
return $this->pass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI host
|
||||
*
|
||||
* @return string The hostname/IP or null if no hostname/IP was specified.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getHost()
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI port
|
||||
*
|
||||
* @return integer The port number, or null if no port was specified.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getPort()
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URI path string
|
||||
*
|
||||
* @return string The URI path string.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI anchor string
|
||||
*
|
||||
* @return string The URI anchor string.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getFragment()
|
||||
{
|
||||
return $this->fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the current URI is using HTTPS.
|
||||
*
|
||||
* @return boolean True if using SSL via HTTPS.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function isSsl()
|
||||
{
|
||||
return strtolower($this->getScheme()) === 'https';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a query from an array (reverse of the PHP parse_str()).
|
||||
*
|
||||
* @param array $params The array of key => value pairs to return as a query string.
|
||||
*
|
||||
* @return string The resulting query string.
|
||||
*
|
||||
* @see parse_str()
|
||||
* @since 1.0
|
||||
*/
|
||||
protected static function buildQuery(array $params)
|
||||
{
|
||||
return urldecode(http_build_query($params, '', '&'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a given URI and populate the class fields.
|
||||
*
|
||||
* @param string $uri The URI string to parse.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
protected function parse($uri)
|
||||
{
|
||||
// Set the original URI to fall back on
|
||||
$this->uri = $uri;
|
||||
|
||||
/*
|
||||
* Parse the URI and populate the object fields. If URI is parsed properly,
|
||||
* set method return value to true.
|
||||
*/
|
||||
|
||||
$parts = UriHelper::parse_url($uri);
|
||||
|
||||
if ($parts === false) {
|
||||
throw new \RuntimeException(sprintf('Could not parse the requested URI %s', $uri));
|
||||
}
|
||||
|
||||
$retval = ($parts) ? true : false;
|
||||
|
||||
// We need to replace & with & for parse_str to work right...
|
||||
if (isset($parts['query']) && strpos($parts['query'], '&') !== false) {
|
||||
$parts['query'] = str_replace('&', '&', $parts['query']);
|
||||
}
|
||||
|
||||
foreach ($parts as $key => $value) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
|
||||
// Parse the query
|
||||
if (isset($parts['query'])) {
|
||||
parse_str($parts['query'], $this->vars);
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves //, ../ and ./ from a path and returns the result.
|
||||
*
|
||||
* For example:
|
||||
* /foo/bar/../boo.php => /foo/boo.php
|
||||
* /foo/bar/../../boo.php => /boo.php
|
||||
* /foo/bar/.././/boo.php => /foo/boo.php
|
||||
*
|
||||
* @param string $path The URI path to clean.
|
||||
*
|
||||
* @return string Cleaned and resolved URI path.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
protected function cleanPath($path)
|
||||
{
|
||||
$path = explode('/', preg_replace('#(/+)#', '/', $path));
|
||||
|
||||
for ($i = 0, $n = \count($path); $i < $n; $i++) {
|
||||
if ($path[$i] == '.' || $path[$i] == '..') {
|
||||
if (($path[$i] == '.') || ($path[$i] == '..' && $i == 1 && $path[0] == '')) {
|
||||
unset($path[$i]);
|
||||
$path = array_values($path);
|
||||
$i--;
|
||||
$n--;
|
||||
} elseif ($path[$i] == '..' && ($i > 1 || ($i == 1 && $path[0] != ''))) {
|
||||
unset($path[$i], $path[$i - 1]);
|
||||
|
||||
$path = array_values($path);
|
||||
$i -= 2;
|
||||
$n -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return implode('/', $path);
|
||||
}
|
||||
}
|
||||
198
libraries/vendor/joomla/uri/src/Uri.php
vendored
Normal file
198
libraries/vendor/joomla/uri/src/Uri.php
vendored
Normal file
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Part of the Joomla Framework Uri Package
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
namespace Joomla\Uri;
|
||||
|
||||
/**
|
||||
* Uri Class
|
||||
*
|
||||
* This class parses a URI and provides a common interface for the Joomla Framework to access and manipulate a URI.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class Uri extends AbstractUri
|
||||
{
|
||||
/**
|
||||
* Adds a query variable and value, replacing the value if it already exists and returning the old value
|
||||
*
|
||||
* @param string $name Name of the query variable to set.
|
||||
* @param string $value Value of the query variable.
|
||||
*
|
||||
* @return string Previous value for the query variable.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function setVar($name, $value)
|
||||
{
|
||||
$tmp = $this->vars[$name] ?? null;
|
||||
|
||||
$this->vars[$name] = $value;
|
||||
|
||||
// Empty the query
|
||||
$this->query = null;
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an item from the query string variables if it exists
|
||||
*
|
||||
* @param string $name Name of variable to remove.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function delVar($name)
|
||||
{
|
||||
if (array_key_exists($name, $this->vars)) {
|
||||
unset($this->vars[$name]);
|
||||
|
||||
// Empty the query
|
||||
$this->query = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the query to a supplied string in format foo=bar&x=y
|
||||
*
|
||||
* @param array|string $query The query string or array.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function setQuery($query)
|
||||
{
|
||||
if (\is_array($query)) {
|
||||
$this->vars = $query;
|
||||
} else {
|
||||
if (strpos($query, '&') !== false) {
|
||||
$query = str_replace('&', '&', $query);
|
||||
}
|
||||
|
||||
parse_str($query, $this->vars);
|
||||
}
|
||||
|
||||
// Empty the query
|
||||
$this->query = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the URI scheme (protocol)
|
||||
*
|
||||
* @param string $scheme The URI scheme.
|
||||
*
|
||||
* @return Uri This method supports chaining.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function setScheme($scheme)
|
||||
{
|
||||
$this->scheme = $scheme;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the URI username
|
||||
*
|
||||
* @param string $user The URI username.
|
||||
*
|
||||
* @return Uri This method supports chaining.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function setUser($user)
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the URI password
|
||||
*
|
||||
* @param string $pass The URI password.
|
||||
*
|
||||
* @return Uri This method supports chaining.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function setPass($pass)
|
||||
{
|
||||
$this->pass = $pass;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the URI host
|
||||
*
|
||||
* @param string $host The URI host.
|
||||
*
|
||||
* @return Uri This method supports chaining.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function setHost($host)
|
||||
{
|
||||
$this->host = $host;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the URI port
|
||||
*
|
||||
* @param integer $port The URI port number.
|
||||
*
|
||||
* @return Uri This method supports chaining.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function setPort($port)
|
||||
{
|
||||
$this->port = $port;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the URI path string
|
||||
*
|
||||
* @param string $path The URI path string.
|
||||
*
|
||||
* @return Uri This method supports chaining.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->path = $this->cleanPath($path);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the URI anchor string
|
||||
*
|
||||
* @param string $anchor The URI anchor string.
|
||||
*
|
||||
* @return Uri This method supports chaining.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function setFragment($anchor)
|
||||
{
|
||||
$this->fragment = $anchor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
70
libraries/vendor/joomla/uri/src/UriHelper.php
vendored
Normal file
70
libraries/vendor/joomla/uri/src/UriHelper.php
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Part of the Joomla Framework Uri Package
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
namespace Joomla\Uri;
|
||||
|
||||
/**
|
||||
* Uri Helper
|
||||
*
|
||||
* This class provides a UTF-8 safe version of parse_url().
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class UriHelper
|
||||
{
|
||||
/**
|
||||
* Does a UTF-8 safe version of PHP parse_url function
|
||||
*
|
||||
* @param string $url URL to parse
|
||||
* @param integer $component Retrieve just a specific URL component
|
||||
*
|
||||
* @return array|boolean Associative array or false if badly formed URL.
|
||||
*
|
||||
* @link https://www.php.net/manual/en/function.parse-url.php
|
||||
* @since 1.0
|
||||
*/
|
||||
public static function parse_url($url, $component = -1)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
// If no UTF-8 chars in the url just parse it using php native parse_url which is faster.
|
||||
if (extension_loaded('mbstring') && mb_convert_encoding($url, 'ISO-8859-1', 'UTF-8') === $url) {
|
||||
return parse_url($url, $component);
|
||||
}
|
||||
|
||||
// URL with UTF-8 chars in the url.
|
||||
|
||||
// Build the reserved uri encoded characters map.
|
||||
$reservedUriCharactersMap = [
|
||||
'%21' => '!',
|
||||
'%2A' => '*',
|
||||
'%27' => "'",
|
||||
'%28' => '(',
|
||||
'%29' => ')',
|
||||
'%3B' => ';',
|
||||
'%3A' => ':',
|
||||
'%40' => '@',
|
||||
'%26' => '&',
|
||||
'%3D' => '=',
|
||||
'%24' => '$',
|
||||
'%2C' => ',',
|
||||
'%2F' => '/',
|
||||
'%3F' => '?',
|
||||
'%23' => '#',
|
||||
'%5B' => '[',
|
||||
'%5D' => ']',
|
||||
];
|
||||
|
||||
// Encode the URL (so UTF-8 chars are encoded), revert the encoding in the reserved uri characters and parse the url.
|
||||
$parts = parse_url(strtr(urlencode($url), $reservedUriCharactersMap), $component);
|
||||
|
||||
// With a well formed url decode the url (so UTF-8 chars are decoded).
|
||||
return $parts ? array_map('urldecode', $parts) : $parts;
|
||||
}
|
||||
}
|
||||
63
libraries/vendor/joomla/uri/src/UriImmutable.php
vendored
Normal file
63
libraries/vendor/joomla/uri/src/UriImmutable.php
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Part of the Joomla Framework Uri Package
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
namespace Joomla\Uri;
|
||||
|
||||
/**
|
||||
* UriImmutable Class
|
||||
*
|
||||
* This is an immutable version of the AbstractUri class.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
final class UriImmutable extends AbstractUri
|
||||
{
|
||||
/**
|
||||
* Flag if the class been instantiated
|
||||
*
|
||||
* @var boolean
|
||||
* @since 1.0
|
||||
*/
|
||||
private $constructed = false;
|
||||
|
||||
/**
|
||||
* Prevent setting undeclared properties.
|
||||
*
|
||||
* @param string $name This is an immutable object, setting $name is not allowed.
|
||||
* @param mixed $value This is an immutable object, setting $value is not allowed.
|
||||
*
|
||||
* @return void This method always throws an exception.
|
||||
*
|
||||
* @since 1.0
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
throw new \BadMethodCallException('This is an immutable object');
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a special constructor that prevents calling the __construct method again.
|
||||
*
|
||||
* @param string $uri The optional URI string
|
||||
*
|
||||
* @since 1.0
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __construct($uri = null)
|
||||
{
|
||||
if ($this->constructed === true) {
|
||||
throw new \BadMethodCallException('This is an immutable object');
|
||||
}
|
||||
|
||||
$this->constructed = true;
|
||||
|
||||
parent::__construct($uri);
|
||||
}
|
||||
}
|
||||
218
libraries/vendor/joomla/uri/src/UriInterface.php
vendored
Normal file
218
libraries/vendor/joomla/uri/src/UriInterface.php
vendored
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Part of the Joomla Framework Uri Package
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2022 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
namespace Joomla\Uri;
|
||||
|
||||
/**
|
||||
* Uri Interface
|
||||
*
|
||||
* Interface for read-only access to URIs.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
interface UriInterface
|
||||
{
|
||||
/**
|
||||
* Include the scheme (http, https, etc.)
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public const SCHEME = 1;
|
||||
|
||||
/**
|
||||
* Include the user
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public const USER = 2;
|
||||
|
||||
/**
|
||||
* Include the password
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public const PASS = 4;
|
||||
|
||||
/**
|
||||
* Include the host
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public const HOST = 8;
|
||||
|
||||
/**
|
||||
* Include the port
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public const PORT = 16;
|
||||
|
||||
/**
|
||||
* Include the path
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public const PATH = 32;
|
||||
|
||||
/**
|
||||
* Include the query string
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public const QUERY = 64;
|
||||
|
||||
/**
|
||||
* Include the fragment
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public const FRAGMENT = 128;
|
||||
|
||||
/**
|
||||
* Include all available url parts (scheme, user, pass, host, port, path, query, fragment)
|
||||
*
|
||||
* @var integer
|
||||
* @since 1.2.0
|
||||
*/
|
||||
public const ALL = 255;
|
||||
|
||||
/**
|
||||
* Magic method to get the string representation of the URI object.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function __toString();
|
||||
|
||||
/**
|
||||
* Returns full URI string.
|
||||
*
|
||||
* @param array $parts An array of strings specifying the parts to render.
|
||||
*
|
||||
* @return string The rendered URI string.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function toString($parts = ['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment']);
|
||||
|
||||
/**
|
||||
* Checks if variable exists.
|
||||
*
|
||||
* @param string $name Name of the query variable to check.
|
||||
*
|
||||
* @return boolean True if the variable exists.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function hasVar($name);
|
||||
|
||||
/**
|
||||
* Returns a query variable by name.
|
||||
*
|
||||
* @param string $name Name of the query variable to get.
|
||||
* @param string $default Default value to return if the variable is not set.
|
||||
*
|
||||
* @return mixed Requested query variable if present otherwise the default value.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getVar($name, $default = null);
|
||||
|
||||
/**
|
||||
* Returns flat query string.
|
||||
*
|
||||
* @param boolean $toArray True to return the query as a key => value pair array.
|
||||
*
|
||||
* @return array|string Query string, optionally as an array.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getQuery($toArray = false);
|
||||
|
||||
/**
|
||||
* Get the URI scheme (protocol)
|
||||
*
|
||||
* @return string The URI scheme.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getScheme();
|
||||
|
||||
/**
|
||||
* Get the URI username
|
||||
*
|
||||
* @return string The username, or null if no username was specified.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getUser();
|
||||
|
||||
/**
|
||||
* Get the URI password
|
||||
*
|
||||
* @return string The password, or null if no password was specified.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getPass();
|
||||
|
||||
/**
|
||||
* Get the URI host
|
||||
*
|
||||
* @return string The hostname/IP or null if no hostname/IP was specified.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getHost();
|
||||
|
||||
/**
|
||||
* Get the URI port
|
||||
*
|
||||
* @return integer The port number, or null if no port was specified.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getPort();
|
||||
|
||||
/**
|
||||
* Gets the URI path string
|
||||
*
|
||||
* @return string The URI path string.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getPath();
|
||||
|
||||
/**
|
||||
* Get the URI anchor string
|
||||
*
|
||||
* @return string The URI anchor string.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function getFragment();
|
||||
|
||||
/**
|
||||
* Checks whether the current URI is using HTTPS.
|
||||
*
|
||||
* @return boolean True if using SSL via HTTPS.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function isSsl();
|
||||
}
|
||||
Reference in New Issue
Block a user