IURLGenerator
in
Class to generate URLs
Tags
Table of Contents
Constants
- URL_REGEX = '/' . self::URL_REGEX_NO_MODIFIERS . '/mi'
- Regex for matching http(s) urls
- URL_REGEX_NO_MODIFIERS = '(\s|\n|^)(https?:\/\/)([-A-Z0-9+_.]+(?::[0-9]+)?(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|\n|$)'
- Regex for matching http(s) urls (without modifiers for client compatibility)
Methods
- getAbsoluteURL() : string
- Makes an URL absolute
- getBaseUrl() : string
- getWebroot() : string
- imagePath() : string
- Returns the link to an image, like linkTo but only with prepending img/
- linkTo() : string
- Returns an URL for an image or file
- linkToDefaultPageUrl() : string
- Returns the URL of the default page based on the system configuration and the apps visible for the current user
- linkToDocs() : string
- linkToOCSRouteAbsolute() : string
- linkToRoute() : string
- Returns the URL for a route
- linkToRouteAbsolute() : string
- Returns the absolute URL for a route
Constants
URL_REGEX
Regex for matching http(s) urls
public
mixed
URL_REGEX
= '/' . self::URL_REGEX_NO_MODIFIERS . '/mi'
This is a copy of the frontend regex in core/src/OCP/comments.js, make sure to adjust both when changing
Tags
URL_REGEX_NO_MODIFIERS
Regex for matching http(s) urls (without modifiers for client compatibility)
public
mixed
URL_REGEX_NO_MODIFIERS
= '(\s|\n|^)(https?:\/\/)([-A-Z0-9+_.]+(?::[0-9]+)?(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|\n|$)'
This is a copy of the frontend regex in core/src/OCP/comments.js, make sure to adjust both when changing
Tags
Methods
getAbsoluteURL()
Makes an URL absolute
public
getAbsoluteURL(string $url) : string
Parameters
- $url : string
-
the url in the ownCloud host
Tags
Return values
string —the absolute version of the url
getBaseUrl()
public
getBaseUrl() : string
Tags
Return values
string —base url of the current request
getWebroot()
public
getWebroot() : string
Tags
Return values
string —webroot part of the base url
imagePath()
Returns the link to an image, like linkTo but only with prepending img/
public
imagePath(string $appName, string $file) : string
Parameters
- $appName : string
-
the name of the app
- $file : string
-
the name of the file
Tags
Return values
string —the url
linkTo()
Returns an URL for an image or file
public
linkTo(string $appName, string $file[, array<string|int, mixed> $args = [] ]) : string
Parameters
- $appName : string
-
the name of the app
- $file : string
-
the name of the file
- $args : array<string|int, mixed> = []
-
array with param=>value, will be appended to the returned url The value of $args will be urlencoded
Tags
Return values
string —the url
linkToDefaultPageUrl()
Returns the URL of the default page based on the system configuration and the apps visible for the current user
public
linkToDefaultPageUrl() : string
Tags
Return values
stringlinkToDocs()
public
linkToDocs(string $key) : string
Parameters
- $key : string
Tags
Return values
string —url to the online documentation
linkToOCSRouteAbsolute()
public
linkToOCSRouteAbsolute(string $routeName[, array<string|int, mixed> $arguments = [] ]) : string
Parameters
- $routeName : string
- $arguments : array<string|int, mixed> = []
Tags
Return values
stringlinkToRoute()
Returns the URL for a route
public
linkToRoute(string $routeName[, array<string|int, mixed> $arguments = [] ]) : string
Parameters
- $routeName : string
-
the name of the route
- $arguments : array<string|int, mixed> = []
-
an array with arguments which will be filled into the url
Tags
Return values
string —the url
linkToRouteAbsolute()
Returns the absolute URL for a route
public
linkToRouteAbsolute(string $routeName[, array<string|int, mixed> $arguments = [] ]) : string
Parameters
- $routeName : string
-
the name of the route
- $arguments : array<string|int, mixed> = []
-
an array with arguments which will be filled into the url
Tags
Return values
string —the absolute url