CMS Made Simple API

cms_route_manager
in package

FinalYes

A class to manage all recognized routes in the system.

Tags
license

GPL

author

Robert Campbell calguy1000@cmsmadesimple.org

since
1.9

Table of Contents

Methods

add_dynamic()  : mixed
Add a dynamic route.
add_static()  : bool
Add a static route.
del_static()  : bool
Delete a static route.
find_match()  : CmsRoute
Find a route that matches the specified string
load_routes()  : mixed
Load dynamic routes from the modules.
register()  : bool
Register a new route.
route_exists()  : bool
Test wether the specified route exists.

Methods

add_dynamic()

Add a dynamic route.

public static add_dynamic(CmsRoute $route) : mixed

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)

Parameters
$route : CmsRoute

The dynamic route object to add

Tags
author

Robert Campbell calguy1000@cmsmadesimple.org

since
1.11
@return

bool.

add_static()

Add a static route.

public static add_static(CmsRoute &$route) : bool

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.

Parameters
$route : CmsRoute

The route to add.

Tags
author

Robert Campbell calguy1000@cmsmadesimple.org

since
1.11
Return values
bool

del_static()

Delete a static route.

public static del_static(string $term[, string $key1 = null ][, string $key2 = null ][, string $key3 = null ]) : bool

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

Parameters
$term : string

The term to search for

$key1 : string = null
$key2 : string = null
$key3 : string = null
Tags
author

Robert Campbell calguy1000@cmsmadesimple.org

since
1.11
Return values
bool

find_match()

Find a route that matches the specified string

public static find_match(string $str[, bool $exact = false ][, bool $static_only = FALSE ]) : CmsRoute
Parameters
$str : string

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

$exact : bool = false

Perform an exact string match rather than a regex match.

$static_only : bool = FALSE

A flag indicating that only static routes should be checked.

Return values
CmsRoute

the matching route, or null.

load_routes()

Load dynamic routes from the modules.

public static load_routes() : mixed

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.

register()

Register a new route.

public static register(CmsRoute $route) : bool

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

Parameters
$route : CmsRoute

The route to register

Tags
see
add_dynamic
Return values
bool

route_exists()

Test wether the specified route exists.

public static route_exists(CmsRoute $route[, bool $static_only = FALSE ]) : bool
Parameters
$route : CmsRoute

The route object

$static_only : bool = FALSE

A flag indicating that only static routes should be checked.

Return values
bool

        
On this page

Search results