PHP Класс JBZoo\Utils\Url

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
addArg ( array $newParams, mixed $uri = null ) : string Add or remove query arguments to the URL.
build ( array $queryParams ) : string
buildAll ( mixed $url, mixed $parts = [], integer $flags = self::URL_REPLACE, array &$newUrl = [] ) : string Build a URL. The parts of the second URL will be merged into the first according to the flags argument.
create ( array $parts = [] ) : string
current ( boolean $addAuth = false ) : string Return the current URL.
delArg ( string | array $keys, boolean $uri = null ) : string Removes an item or list from the query string.
getAuth ( ) : null | string Get current auth info
isAbsolute ( $path ) : boolean Is absolute url
isHttps ( boolean $trustProxyHeaders = false ) : boolean Checks to see if the page is being server over SSL or not
parseLink ( string $text ) : string Turns all of the links in a string into HTML links.
path ( ) : string Return the current path
pathToRel ( $path ) : string Convert file path to relative URL
pathToUrl ( $path ) : string Convert file path to absolute URL
root ( boolean $addAuth = false ) : null | string Return current root URL

Защищенные методы

Метод Описание
_linkifyCallback ( string $matches ) : string Callback for the preg_replace in the linkify() method.
_linkifyRegex ( string $text ) : mixed Callback for the preg_replace in the linkify() method.

Описание методов

_linkifyCallback() защищенный статический Метод

Part of the LinkifyURL Project
protected static _linkifyCallback ( string $matches ) : string
$matches string Matches from the preg_ function
Результат string

_linkifyRegex() защищенный статический Метод

Part of the LinkifyURL Project
protected static _linkifyRegex ( string $text ) : mixed
$text string Matches from the preg_ function
Результат mixed

addArg() публичный статический Метод

Add or remove query arguments to the URL.
public static addArg ( array $newParams, mixed $uri = null ) : string
$newParams array Either newkey or an associative array
$uri mixed URI or URL to append the queru/queries to.
Результат string

build() публичный статический Метод

public static build ( array $queryParams ) : string
$queryParams array
Результат string

buildAll() публичный статический Метод

Build a URL. The parts of the second URL will be merged into the first according to the flags argument.
См. также: https://github.com/jakeasmith/http_build_url/
Автор: Jake Smith ([email protected])
public static buildAll ( mixed $url, mixed $parts = [], integer $flags = self::URL_REPLACE, array &$newUrl = [] ) : string
$url mixed (part(s) of) an URL in form of a string or associative array like parse_url() returns
$parts mixed same as the first argument
$flags integer a bitmask of binary or'ed HTTP_URL constants; HTTP_URL_REPLACE is the default
$newUrl array if set, it will be filled with the parts of the composed url like parse_url() would return
Результат string

create() публичный статический Метод

public static create ( array $parts = [] ) : string
$parts array
Результат string

current() публичный статический Метод

Return the current URL.
public static current ( boolean $addAuth = false ) : string
$addAuth boolean
Результат string

delArg() публичный статический Метод

Removes an item or list from the query string.
public static delArg ( string | array $keys, boolean $uri = null ) : string
$keys string | array Query key or keys to remove.
$uri boolean When false uses the $_SERVER value
Результат string

getAuth() публичный статический Метод

Get current auth info
public static getAuth ( ) : null | string
Результат null | string

isAbsolute() публичный статический Метод

Is absolute url
public static isAbsolute ( $path ) : boolean
$path
Результат boolean

isHttps() публичный статический Метод

Checks to see if the page is being server over SSL or not
public static isHttps ( boolean $trustProxyHeaders = false ) : boolean
$trustProxyHeaders boolean
Результат boolean

path() публичный статический Метод

Return the current path
public static path ( ) : string
Результат string

pathToRel() публичный статический Метод

Convert file path to relative URL
public static pathToRel ( $path ) : string
$path
Результат string

pathToUrl() публичный статический Метод

Convert file path to absolute URL
public static pathToUrl ( $path ) : string
$path
Результат string

root() публичный статический Метод

Return current root URL
public static root ( boolean $addAuth = false ) : null | string
$addAuth boolean
Результат null | string