PHP Class url, kirby

Mostrar archivo Open project: bastianallgeier/kirby Class Usage Examples

Public Methods

Method Description
current ( ) : string Returns the current URL
has_query ( string $url ) : boolean Checks if the URL has a query string attached
short ( string $url, integer $chars = false, boolean $base = false, string $rep = '…' ) : string Shortens an URL It removes http:// or https:// and uses str::short afterwards
strip_hash ( string $url ) : string Strips a hash value from the URL
strip_query ( string $url ) : string Strips the query from the URL
valid ( string $url ) : boolean Checks for a valid URL

Method Details

current() static public method

Returns the current URL
static public current ( ) : string
return string

has_query() static public method

Checks if the URL has a query string attached
static public has_query ( string $url ) : boolean
$url string
return boolean

short() static public method

Shortens an URL It removes http:// or https:// and uses str::short afterwards
static public short ( string $url, integer $chars = false, boolean $base = false, string $rep = '…' ) : string
$url string The URL to be shortened
$chars integer The final number of characters the URL should have
$base boolean True: only take the base of the URL.
$rep string The element, which should be added if the string is too long. Ellipsis is the default.
return string The shortened URL

strip_hash() static public method

Strips a hash value from the URL
static public strip_hash ( string $url ) : string
$url string
return string

strip_query() static public method

Strips the query from the URL
static public strip_query ( string $url ) : string
$url string
return string

valid() static public method

Checks for a valid URL
static public valid ( string $url ) : boolean
$url string
return boolean