__construct()
__toString()
buildAdminLink()
buildBasicLink()
buildBasicLinkWithIntegerParam()
buildBasicLinkWithStringParam()
buildIntegerAndTitleUrlComponent()
buildPublicLink()
buildQueryString()
buildSubComponentLink()
canPrependFull()
convertUriToAbsoluteUri()
getCanonicalLinkPrefix()
getPageNumberAsAction()
getPrefixHandlerClassName()
getTitleForUrl()
prepareExtensionAndAction()
resetHandlerInfo()
setCanonicalLinkPrefix()
setHandlerInfoForGroup()
useFriendlyUrls()
_buildLink()
_checkForFullLink()
_getPrefixHandler()
_loadHandlerInfoForGroup()
_loadPrefixHandlerClass()
$_canPrependFull
$_canonicalLinkPrefix
$_handlerCache
$_linkString
$_useFriendlyUrls
Helper methods to generate links to content.
Links generated by this are not necessarily HTML escaped. The calling code should escape them for the output context they apply to.
package | XenForo_Core |
---|
__construct(string $linkString, boolean $canPrependFull)
Use the static methods in general. However, you can create an object of this type from a link builder to generate an arbitrary URL.
string
boolean
True if the default full link prefix can be prepended to make a full URL
__toString() : string
string
LinkbuildAdminLink(string $type, mixed $data, array $extraParams) : string
The type should contain a prefix optionally split by a "/" with the specific action (eg "templates/edit").
string
Prefix and action
mixed
Data that the prefix/action should be applied to, if applicable
array
Additional params
string
The linkbuildBasicLink(string $prefix, string $action, string $extension) : string
string
string
string
string
buildBasicLinkWithIntegerParam(string $prefix, string $action, string $extension, mixed $data, string $intField, string $titleField) : false | string
Output will be in the format [prefix]/[title].[int]/[action]/ or similar, based on whether the correct values in data are set.
string
Link prefix
string
Link action
string
Link extension (for content type)
mixed
Specific data to link to. If available, an array or an object that implements ArrayAccess
string
The name of the field that holds the integer identifier
string
If there is a title field, the name of the field that holds the title
false
string
False if no data is provided, the link otherwisebuildBasicLinkWithStringParam(string $prefix, string $action, string $extension, mixed $data, string $strField) : false | string
Output will be in the format [prefix]/[param]/[action].
Note that it is expected that the string param is already clean enough to be inserted into the link.
string
Link prefix
string
Link action
string
Link extension (for content type)
mixed
Specific data to link to. If available, an array or an object that implements ArrayAccess, or a simple string to be used directly
string
The name of the field that holds the string identifier
false
string
False if no data is provided, the link otherwisebuildIntegerAndTitleUrlComponent(integer $integer, string $title, boolean $romanize) : string
Outputs
integer
string
boolean
If true, non-latin strings are romanized
string
buildPublicLink(string $type, mixed $data, array $extraParams, $skipPrepend) : string
The type should contain a prefix optionally split by a "/" with the specific action (eg "templates/edit").
string
Prefix and action
mixed
Data that the prefix/action should be applied to, if applicable
array
Additional params
string
The linkbuildQueryString(array $elements, string $prefix) : string
Keys of the array will become names of items in the query string. Nested arrays are supported.
array
Elements to build the query string from
string
For nested arrays, specifies the base context we're in. Leave default unless wanting all elements inside an array.
string
buildSubComponentLink(array $subComponents, string $outputPrefix, string $action, string $extension, mixed $data) : string | false
array
List of sub-components that are valid as keys, with specific child keys (title, intId, stringId)
string
string
string
mixed
string
false
String if sub-component matched with appropriate data, false otherwisecanPrependFull() : boolean
boolean
convertUriToAbsoluteUri(string $uri, boolean $includeHost, array $paths) : string
string
URI to convert
boolean
If true, includes host, port, and protocol
array
null
Paths to override (uses application level if not provided)
string
getCanonicalLinkPrefix() : string
string
getPageNumberAsAction(string $action, array $params) : string
string
array
string
$actiongetPrefixHandlerClassName(string $group, string $prefix) : string | false
string
string
string
false
getTitleForUrl(string $title, boolean $romanize) : string
Invalid elements are stripped or replaced with '-'. It may not be possible to reverse a URL'd title to the original title.
string
boolean
If true, non-latin strings are romanized
string
prepareExtensionAndAction(string $extension, string $action, $prepareAction)
If an extension is specified, the provided value will be prefixed with a ".". If there is an extension and there's no action, an explicit "index" action will be specified.
string
Initially, the extension to the link specified; prefixed with "." if necessary
string
The link action; modified if necessary
resetHandlerInfo(string | false $group)
Mainly used for testing.
string
false
If false, resets all handlers; otherwise, resets the specified handler group
setCanonicalLinkPrefix(string $linkPrefix)
string
setHandlerInfoForGroup(string $group, array $info)
Keys should be "original prefixes" and values should be arrays with keys matching the xf_route_prefix table.
string
Type of prefix to handle (public or admin)
array
Info to set
useFriendlyUrls(boolean $value)
boolean
_buildLink(string $group, string $type, mixed $data, array $extraParams) : string
string
Type of link being built (admin or public)
string
Type of data the link is for (prefix and action)
mixed
array
string
_checkForFullLink(string $type, boolean $fullLink, string $fullLinkPrefix) : string
string
Link type
boolean
Modified by ref. Returns whether a full link is requested.
string
If a full link is requested, the prefix to use
string
Link type, with full link param stripped off if necessary_getPrefixHandler(string $group, string $originalPrefix, boolean $haveData) : object | false
May also return false if only the standard behavior is desired.
string
Type of link (public or admin)
string
Prefix to build the link for (should be the "original prefix" in the DB)
boolean
Whether we have a data element
object
false
Object with "buildLink" method or false_loadHandlerInfoForGroup(string $group) : array
string
Type of prefix (public or admin)
array
Keys are "original prefixes" and values are info about output prefix/class/build settings_loadPrefixHandlerClass(array $info, boolean $haveData) : object | false
array
Info about how to build this link (includes build_link, route_class keys)
boolean
True if we have a data param for this link
object
false
Object with "buildLink" method or false$_canPrependFull
$_canonicalLinkPrefix : string | null
$_handlerCache : array
Many types of links will be generated multiple times on a page, so this cache reduces the amount of object creation/validation necessary.
$_linkString
$_useFriendlyUrls : boolean