class vB5_Route_Legacy_Usercp extends vB5_Route_Legacy

Traits

Constants

DEFAULT_CLASS

PREFIX_MAXSIZE

REGEX_MAXSIZE

Properties

protected $routeId from vB5_Route
protected $routeGuid from vB5_Route
protected $redirect301 Current route Id for current for request from vB5_Route
protected $prefix
protected $rawprefix from vB5_Route
protected string $regex Regular expression to be matched by URL. Always encoded in UTF-8. from vB5_Route
protected $ishomeroute from vB5_Route
protected string $controller (Optional) Stores controller to be called from vB5_Route
protected string $action (Optional) Stores action to be invoked in controller from vB5_Route
protected string $template (Optional) Stores template id to be loaded from vB5_Route
protected array $arguments Contains parameters stored in db and extracted from URL from vB5_Route
protected array $matches Contains the matches passed to the class from vB5_Route
protected array $queryParameters Contains query string parameters from vB5_Route
protected string $anchor Contains anchor id from vB5_Route
protected string $pageKey Contains the page key for preloading cache from vB5_Route
protected mixed $userAction Stores user action associated to the route. from vB5_Route
protected vB5_Route $canonicalRoute from vB5_Route
protected array $breadcrumbs Contains the breadcrumbs for header from vB5_Route
$headlinks Contains the links for header from vB5_Route
static protected $routeidentcache from vB5_Route

Methods

__sleep()

No description

__wakeup()

No description

__construct($routeInfo = array(), $matches = array(), $queryString = '')

No description

initRoute($routeInfo, $matches, $queryString = '', $anchor = '')

No description

from vB5_Route
getRouteId()

No description

from vB5_Route
getRouteGuid()

No description

from vB5_Route
getRedirect301()

discard all query parameters caches the new route and return it every time this is the simplest form of redirection if subclass is any complicate than this, override is needed

getPrefix()

No description

from vB5_Route
getRawPrefix()

No description

from vB5_Route
getIsHomeRoute()

No description

from vB5_Route
getController()

No description

from vB5_Route
getAction()

No description

from vB5_Route
getTemplate()

No description

from vB5_Route
getArguments()

No description

from vB5_Route
getQueryParameters()

No description

from vB5_Route
getAnchor()

No description

from vB5_Route
setPageKey()

No description

from vB5_Route
getPageKey()

No description

from vB5_Route
setUserAction()

No description

from vB5_Route
mixed
getUserAction()

Returns the user action associated with the route

from vB5_Route
setBreadcrumbs()

Sets the breadcrumbs for the route

from vB5_Route
addParentNodeBreadcrumbs(int $nodeId, bool $onlyAddTopParent = false)

Adds breadcrumb entries for all the parents of the passed node id.

from vB5_Route
checkRoutePermissions()

Checks to see if a user can access the page represented by this route. Will throw a vB_Exception_NodePermission if the user is not allowed to view the page. Does nothing otherwise. This is intended to get the permission checks out of the route constructors so that we don't get random exceptions while trying to create urls.

from vB5_Route
array
getBreadcrumbs()

Returns breadcrumbs to be displayed in page header

from vB5_Route
mixed
getUrl()

Get the url of this route. To be overriden by child classes.

from vB5_Route
getFullUrl($options = "")

No description

from vB5_Route
getCanonicalRoute()

Returns the route referenced by the associated item

from vB5_Route
getCanonicalPrefix()

No description

from vB5_Route
getCanonicalUrl()

Returns the canonical url which may be based on a different route

from vB5_Route
getCanonicalQueryParameters()

Returns false if query parameters do not determine canonicality otherwise return query parameters

from vB5_Route
static 
prepareTitle($title)

No description

from vB5_Route
static 
prepareUrlIdent($ident)

No description

from vB5_Route
static bool
validInput(array $data)

Checks if route info is valid and performs any required sanitation

static boolean
isPrefixUsed(string $prefix)

Checks if the prefix is already in use.

from vB5_Route
static int
saveRoute($data, $condition = array())

Stores route in db and returns its id

from vB5_Route
static 
createRoute($class, $data)

No description

from vB5_Route
static int
updateRoute($routeId, $data, $cloneRoute = false)

Update the route.

from vB5_Route
static 
updateRedirects($db, $oldrouteid, $newrouteid)

No description

from vB5_Route
static 
deleteRouteInternal($db, $routeid)

No description

from vB5_Route
static 
deleteRoute($routeid)

Deletes the route

from vB5_Route
static 
updateSecondaryHomepageRoutes($oldRouteInfo, $new_data)

No description

from vB5_Route
static 
removeHomepageRoute(array $routeInfo)

Do any extra processing required if this route is changed from a homepage route to a regular route.

from vB5_Route
static array
getPrefixSet(string $url)

Generates an array with all prefixes for $url

from vB5_Route
static null|vB5_Route
selectBestRoute($pathInfo, $queryString = '', $anchor = '', $matchedRoutes = array())

Returns the route that best fits the pathInfo in $matchedRoutes

from vB5_Route
static 
compareRoutes($route1, $route2)

No description

from vB5_Route
static 
getRouteByIdent($routeident)

No description

from vB5_Route
static array|bool
getChannelConversationRouteInfo(int $channelId)

Returns the route info for the generic conversation route for the given channel

from vB5_Route
static 
preloadRoutes($routeIds)

No description

from vB5_Route
static 
loadNameRoutes()

Loads list of named routes, which changes rarely

from vB5_Route
static 
getClassName($routeId, $routeInfo = array())

No description

from vB5_Route
static 
getRoute($routeId, $data = array(), $extra = array(), $anchor = '')

No description

from vB5_Route
static string
buildUrl(string $options, array $data = array(), array $extra = array(), string $anchor = '')

Returns the URL associated to the route info. It does not use canonical route.

from vB5_Route
static string[]
buildUrls(array $URLInfoList)

get the urls in one batch

from vB5_Route
static string[]
bulkFetchUrls(string $className, array $URLInfoList)

Build URLs using a single instance for the class. It does not check permissions. Used by buildUrls()

from vB5_Route
static array
exportArguments(string $arguments)

Returns arguments to be exported

from vB5_Route
static string
importArguments(string $arguments)

Returns an array with imported values for the route

from vB5_Route
static int
importContentId(string $arguments)

Returns the content id from the imported values of the route after being parsed

from vB5_Route
getHash($route, array $data, array $extra)

No description

from vB5_Route
static 
getHashKey($options = array(), $data = array(), $extra = array())

No description

from vB5_Route
getRouteSegments()

No description

from vB5_Route
getHeadLinks()

No description

from vB5_Route
setHeadLinks()

No description

from vB5_Route
static array
fetchCommonRoutes()

Returns a list of common routes. We check these to see if we can avoid the far most expensive selectBestRoute call

from vB5_Route
static 
resetRouteIdentCache()

Resets the route ident cache. This is only intended to be used externally for unit tests, where mulitple tests run during the same request, causing invalid routes (from a previous test to be in $routeidentcache. This doesn't happen on a normal page request, because $routeidentcache is in memory only for the duration of the request. VBV-12736

from vB5_Route
getNewRouteInfo()

No description

getRegex()

No description

static 
updateContentRoute($oldRouteInfo, $newRouteInfo)

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB5_Route_Legacy at line 23
__construct($routeInfo = array(), $matches = array(), $queryString = '')

Parameters

$routeInfo
$matches
$queryString

in vB5_Route at line 120
protected initRoute($routeInfo, $matches, $queryString = '', $anchor = '')

Parameters

$routeInfo
$matches
$queryString
$anchor

in vB5_Route at line 218
getRouteId()

in vB5_Route at line 223
getRouteGuid()

in vB5_Route_Legacy at line 42
getRedirect301()

discard all query parameters caches the new route and return it every time this is the simplest form of redirection if subclass is any complicate than this, override is needed

in vB5_Route at line 233
getPrefix()

in vB5_Route at line 238
getRawPrefix()

in vB5_Route at line 243
getIsHomeRoute()

in vB5_Route at line 248
getController()

in vB5_Route at line 253
getAction()

in vB5_Route at line 258
getTemplate()

in vB5_Route at line 263
getArguments()

in vB5_Route at line 268
getQueryParameters()

in vB5_Route at line 273
getAnchor()

in vB5_Route at line 278
protected setPageKey()

in vB5_Route at line 297
getPageKey()

in vB5_Route at line 302
protected setUserAction()

in vB5_Route at line 323
mixed getUserAction()

Returns the user action associated with the route

Return Value

mixed

in vB5_Route at line 331
protected setBreadcrumbs()

Sets the breadcrumbs for the route

in vB5_Route at line 348
protected addParentNodeBreadcrumbs(int $nodeId, bool $onlyAddTopParent = false)

Adds breadcrumb entries for all the parents of the passed node id.

This is inclusive of the passed node id, but excludes "home". Modifies $this->breadcrumbs

Parameters

int $nodeId Node ID
bool $onlyAddTopParent If true, only add the top-most parent after home, and ignore the rest.

in vB5_Route at line 401
protected checkRoutePermissions()

Checks to see if a user can access the page represented by this route. Will throw a vB_Exception_NodePermission if the user is not allowed to view the page. Does nothing otherwise. This is intended to get the permission checks out of the route constructors so that we don't get random exceptions while trying to create urls.

in vB5_Route at line 410
array getBreadcrumbs()

Returns breadcrumbs to be displayed in page header

Return Value

array

in vB5_Route at line 423
mixed getUrl()

Get the url of this route. To be overriden by child classes.

This should always return the path encoded in UTF-8. If vB_String::getCharset() is not utf-8, the url should be percent encoded using vB_String::encodeUtf8Url().

Return Value

mixed false|string

in vB5_Route at line 440
getFullUrl($options = "")

Parameters

$options

in vB5_Route at line 499
vB5_Route getCanonicalRoute()

Returns the route referenced by the associated item

Return Value

vB5_Route

in vB5_Route at line 505
getCanonicalPrefix()

in vB5_Route at line 520
getCanonicalUrl()

Returns the canonical url which may be based on a different route

in vB5_Route at line 550
getCanonicalQueryParameters()

Returns false if query parameters do not determine canonicality otherwise return query parameters

in vB5_Route at line 555
static protected prepareTitle($title)

Parameters

$title

in vB5_Route at line 561
static protected prepareUrlIdent($ident)

Parameters

$ident

in vB5_Route_Legacy at line 62
final static protected bool validInput(array $data)

Checks if route info is valid and performs any required sanitation

Parameters

array $data

Return Value

bool Returns TRUE iff data is valid

in vB5_Route at line 640
static boolean isPrefixUsed(string $prefix)

Checks if the prefix is already in use.

Note that redirect routes are not considered "in use" since they are will be overwritten as needed by new/edited pages.

Parameters

string $prefix
  • Prefix to be validated

Return Value

boolean

in vB5_Route at line 659
static protected int saveRoute($data, $condition = array())

Stores route in db and returns its id

Parameters

$data
$condition

Return Value

int

in vB5_Route at line 683
static createRoute($class, $data)

Parameters

$class
$data

in vB5_Route at line 727
static int updateRoute($routeId, $data, $cloneRoute = false)

Update the route.

If the url has changed this may result in a new route being created and the old route being turned into a 301 redirect.

Parameters

$routeId
$data
$cloneRoute

Return Value

int -- the ID of the route created/updated.

in vB5_Route at line 916
static protected updateRedirects($db, $oldrouteid, $newrouteid)

Parameters

$db
$oldrouteid
$newrouteid

in vB5_Route at line 943
static protected deleteRouteInternal($db, $routeid)

Parameters

$db
$routeid

in vB5_Route at line 969
static deleteRoute($routeid)

Deletes the route

This will also delete any redirects to the route being deleted (which don't have much purpose without the route)

It will also clear the cache for the routes deleted.

Parameters

$routeid

in vB5_Route at line 995
static protected updateSecondaryHomepageRoutes($oldRouteInfo, $new_data)

Parameters

$oldRouteInfo
$new_data

in vB5_Route at line 1009
static protected removeHomepageRoute(array $routeInfo)

Do any extra processing required if this route is changed from a homepage route to a regular route.

The flag will be changed automatically by the core function. This is for any class specific logic.

Parameters

array $routeInfo -- the route being changed.

in vB5_Route at line 1020
static array getPrefixSet(string $url)

Generates an array with all prefixes for $url

Parameters

string $url

Return Value

array

in vB5_Route at line 1050
static null|vB5_Route selectBestRoute($pathInfo, $queryString = '', $anchor = '', $matchedRoutes = array())

Returns the route that best fits the pathInfo in $matchedRoutes

Parameters

$pathInfo
$queryString
$anchor
$matchedRoutes

Return Value

null|vB5_Route +

in vB5_Route at line 1163
static protected compareRoutes($route1, $route2)

Parameters

$route1
$route2

in vB5_Route at line 1168
static getRouteByIdent($routeident)

Parameters

$routeident

in vB5_Route at line 1211
static array|bool getChannelConversationRouteInfo(int $channelId)

Returns the route info for the generic conversation route for the given channel

Parameters

int $channelId Channel node ID

Return Value

array|bool The route info or false on error.

in vB5_Route at line 1260
static preloadRoutes($routeIds)

Parameters

$routeIds

in vB5_Route at line 1287
static protected loadNameRoutes()

Loads list of named routes, which changes rarely

in vB5_Route at line 1314
static protected getClassName($routeId, $routeInfo = array())

Parameters

$routeId
$routeInfo

in vB5_Route at line 1328
static getRoute($routeId, $data = array(), $extra = array(), $anchor = '')

Parameters

$routeId
$data
$extra
$anchor

in vB5_Route at line 1375
static string buildUrl(string $options, array $data = array(), array $extra = array(), string $anchor = '')

Returns the URL associated to the route info. It does not use canonical route.

Parameters

string $options A string of routeid & options delimited by | beginning with routeid which can be an (int) routeid or a (string) route class identifier (ex. 'node', 'visitormessage'). Must begin with routeid, but the order of the subsequent options do not matter Accepted option string (TODO:complete this list): nosession: DEPRECATED - DO NOT USE fullurl, bburl: Prepends the frontendurl to the relative url Ex. '51|fullurl' 'node' 'visitormessage|bburl'
array $data An array of "matches" that the route constructor and initRoute() can use to generate the route. Usually the "matches" data is translated to the route arguments by initRoute(), or query parameters or anchors. Typically you will want to pass in all the required arguments for the route fetching/generation (ex. 'nodeid' for a conversation route or 'userid' for a profile route, 'contentpagenum' and 'pagenum' for an article route) and additional data that's only provided internally to for URL generation (ex. 'innerPost' for a conversation to add an anchor) See the specific route's constructor & initRoute() functions for more details about what parameters are used. Ex. array('nodeid' => 42, 'innerPost' => '99')
array $extra An array of query data. Will be translated into a query string. Ex. array('foo' => 'bar', 'life' => '42') will append ?foo=bar&life=42 to the url
string $anchor A string specifying the anchor tag without the hash symbol '#' Ex. 'post42' will append become #post42 to the url

Return Value

string The URL. Will return '#' if URL generation fails (typically occurs when a route identifier is provided in $options but is an invalid identifier, e.g. (int) routeid does not exist in routenew table or (string) routeid isn't a valid route class name)

Exceptions

Exception("error_no_routeid") if routeid was unable to be retrived from $options

in vB5_Route at line 1424
static string[] buildUrls(array $URLInfoList)

get the urls in one batch

Parameters

array $URLInfoList Array of data required for URL generation. Each key should uniquely identify each requested URL, and these keys will be used by the output array. Each element is an array with the following data: - route - data - extra - options - options.anchor

Return Value

string[] URLs built based on the input. Keys are a subset of the keys of the input array $URLInfoList.

in vB5_Route at line 1534
static protected string[] bulkFetchUrls(string $className, array $URLInfoList)

Build URLs using a single instance for the class. It does not check permissions. Used by buildUrls()

Parameters

string $className Route class of this bulk of URLs
array $URLInfoList Array of data required for URL generation. Each key should uniquely identify each requested URL, and these keys will be used by the output array. Each element is an array with the following data: - route - routeInfo - data - extra - anchor - innerHash @TODO: Expand above with more detail.

Return Value

string[] String array of URLs. The keys will be the same as those provided in input $URLInfoList. URL may be an empty string if route/url construction failed with an exception.

in vB5_Route at line 1574
static array exportArguments(string $arguments)

Returns arguments to be exported

Parameters

string $arguments

Return Value

array

in vB5_Route at line 1584
static string importArguments(string $arguments)

Returns an array with imported values for the route

Parameters

string $arguments

Return Value

string

in vB5_Route at line 1594
static int importContentId(string $arguments)

Returns the content id from the imported values of the route after being parsed

Parameters

string $arguments

Return Value

int

in vB5_Route at line 1599
getHash($route, array $data, array $extra)

Parameters

$route
array $data
array $extra

in vB5_Route at line 1614
static protected getHashKey($options = array(), $data = array(), $extra = array())

Parameters

$options
$data
$extra

in vB5_Route at line 1640
getRouteSegments()

in vB5_Route at line 1674
static array fetchCommonRoutes()

Returns a list of common routes. We check these to see if we can avoid the far most expensive selectBestRoute call

Return Value

array of string => string map of url to route class.

in vB5_Route at line 1711
static resetRouteIdentCache()

Resets the route ident cache. This is only intended to be used externally for unit tests, where mulitple tests run during the same request, causing invalid routes (from a previous test to be in $routeidentcache. This doesn't happen on a normal page request, because $routeidentcache is in memory only for the duration of the request. VBV-12736

We use it internally to clear the cache when it changes

at line 17
protected getNewRouteInfo()

in vB5_Route_Legacy at line 56
getRegex()

in vB5_Route_Legacy at line 68
final static protected updateContentRoute($oldRouteInfo, $newRouteInfo)

Parameters

$oldRouteInfo
$newRouteInfo