SproutCMS

This is the code documentation for the SproutCMS project

Page options:

Inherited members

class Url

Helper functions for working with URLs.

Functions

NameVisibilityDescription
addSocialDomainpublic (static)Add a domain to provided social link, if it doesn't have one
addUrlSchemepublic (static)Add a scheme (e.g. 'http://') to a URL which doesn't have one
basepublic (static)Base URL, with or without the index page.
canonicalpublic (static)Return HTML for canonical URLs
checkRedirectpublic (static)Checks the provided argument is a valid redirect URL to the local site
currentpublic (static)Fetches the current URI.
filepublic (static)Return the URL to a file. Absolute filenames and relative filenames
mergepublic (static)Merges an array of arguments with the current URI and query string to
redirectpublic (static)Sends a page redirect header and runs the system.redirect Event.
sitepublic (static)Fetches an absolute site URL based on a URI segment.
withoutArgspublic (static)Removes one or more argumens from the current URL, returning a URL which can have arguments appended to it

public addSocialDomain

string Url::addSocialDomain ( string $social_link , string $domain );

Add a domain to provided social link, if it doesn't have one

public addUrlScheme

string Url::addUrlScheme ( string $url );

Add a scheme (e.g. 'http://') to a URL which doesn't have one

public base

string Url::base ( [ boolean $index [, boolean $protocol ]] );

Base URL, with or without the index page.

If protocol is specified, a full URL including the domain will be used
otherwise only the root path will be used

If a subsite-section has a defined URL prefix, it will be added to the URL automatically

public canonical

string Url::canonical ( string $canonical_url );

Return HTML for canonical URLs

public checkRedirect

unknown Url::checkRedirect ( string $url [, bool $allow_querysting ] );

Checks the provided argument is a valid redirect URL to the local site

This is designed to prevent redirects to other domains, bad pages, etc

public current

string Url::current ( [ boolean $qs ] );

Fetches the current URI.

public file

string Url::file ( string $file [, boolean $index ] );

Return the URL to a file. Absolute filenames and relative filenames
are allowed.

public merge

string Url::merge ( array $arguments );

Merges an array of arguments with the current URI and query string to
overload, instead of replace, the current query string.

public redirect

void Url::redirect ( [ mixed $uri [, string $method ]] );

Sends a page redirect header and runs the system.redirect Event.

public site

string Url::site ( [ string $uri [, string $protocol ]] );

Fetches an absolute site URL based on a URI segment.

public withoutArgs

unknown Url::withoutArgs ( );

Removes one or more argumens from the current URL, returning a URL which can have arguments appended to it
Multiple arguments can be specified

If the current URL is:
    /search?q=test&category=general
and the function call is:
    Url::withoutArgs('q')
the resulting URL will be:
    /search?category=general&

Use rtrim($url, '&?') if you do not desire the trailing ? or &