cms_route_manager View code

A class to manage all recognized routes in the system.

package

CMS

license

GPL

author

Robert Campbell calguy1000@cmsmadesimple.org

since 1.9

Methods

route_exists(\CmsRoute $route, boolean $static_only = FALSE) : boolean

Test wether the specified route exists.

static

Arguments

\CmsRoute $route

The route object

boolean $static_only

A flag indicating that only static routes should be checked.

Response

boolean

find_match(string $str, boolean $exact = false, boolean $static_only = FALSE) : \CmsRoute

Find a route that matches the specified string

static

Arguments

string $str

The string to test against (usually an incoming url request)

boolean $exact

Perform an exact string match rather than a regex match.

boolean $static_only

A flag indicating that only static routes should be checked.

Response

\CmsRoute

the matching route, or null.

add_static(\CmsRoute &$route) : boolean

Add a static route.

static

This method will return TRUE, and do nothing if the route already exists. The route cache will be removed if the route is successfully added to the database.

Arguments

\CmsRoute $route

The route to add.

Response

boolean

del_static(string $term, string $key1 = null, string $key2 = null, string $key3 = null) : boolean

Delete a static route.

static

The route cache will be removed if the route is successfully removed from the database.

Arguments

string $term

The term to search for

string $key1

string $key2

string $key3

Response

boolean

add_dynamic(\CmsRoute $route) : \bool.

Add a dynamic route.

static

Dynamic routes are not stored to the database, and are checked after static routes when searching for a match. This method will return TRUE if the route already exists (static, or dynamic)

Arguments

\CmsRoute $route

The dynamic route object to add

Response

\bool.

register(\CmsRoute $route) : boolean

Register a new route.

static

This is just an alias (for compatibility reasons) to the add_dynamc method.

Arguments

\CmsRoute $route

The route to register

Response

boolean

load_routes() 

Load dynamic routes from the modules.

deprecated static

typically called by modules or places where static urls are added this method will load all modules and call setparameters to ensure that their dynamic routes are created.