Constants

FC_FRONT

FC_FRONT

List of available front controllers types

FC_ADMIN

FC_ADMIN

FC_MODULE

FC_MODULE

Properties

$instance

$instance : \Dispatcher

Type

\Dispatcher

$default_routes

$default_routes : array

Type

array — List of default routes

$use_routes

$use_routes : boolean

Type

boolean — If true, use routes to build URL (mod rewrite must be activated)

$multilang_activated

$multilang_activated : 

Type

$routes

$routes : array

Type

array — List of loaded routes

$controller

$controller : string

Type

string — Current controller name

$request_uri

$request_uri : string

Type

string — Current request uri

$empty_route

$empty_route : array

Type

array — Store empty route (a route with an empty rule)

$default_controller

$default_controller : string

Type

string — Set default controller, which will be used if http parameter 'controller' is empty

$use_default_controller

$use_default_controller : 

Type

$controller_not_found

$controller_not_found : string

Type

string — Controller to use if found controller doesn't exist

$front_controller

$front_controller : string

Type

string — Front controller to use

Methods

getInstance()

getInstance() : \Dispatcher

Get current instance of dispatcher (singleton)

Returns

\Dispatcher

useDefaultController()

useDefaultController() 

dispatch()

dispatch() 

Find the controller and instantiate it

addRoute()

addRoute(string  $route_id, string  $rule, string  $controller, integer  $id_lang = null, array  $keywords = array(), array  $params = array(), integer  $id_shop = null) 

Parameters

string $route_id

Name of the route (need to be uniq, a second route with same name will override the first)

string $rule

Url rule

string $controller

Controller to call if request uri match the rule

integer $id_lang
array $keywords
array $params
integer $id_shop

hasRoute()

hasRoute(string  $route_id, integer  $id_lang = null, integer  $id_shop = null) : boolean

Check if a route exists

Parameters

string $route_id
integer $id_lang
integer $id_shop

Returns

boolean

hasKeyword()

hasKeyword(string  $route_id, integer  $id_lang, string  $keyword, integer  $id_shop = null) : boolean

Check if a keyword is written in a route rule

Parameters

string $route_id
integer $id_lang
string $keyword
integer $id_shop

Returns

boolean

validateRoute()

validateRoute(string  $route_id, string  $rule, array  $errors = array()) 

Check if a route rule contain all required keywords of default route definition

Parameters

string $route_id
string $rule

Rule to verify

array $errors

List of missing keywords

createUrl()

createUrl(string  $route_id, integer  $id_lang = null, array  $params = array(),   $force_routes = false, string  $anchor = '',   $id_shop = null) 

Create an url from

Parameters

string $route_id

Name the route

integer $id_lang
array $params
$force_routes
string $anchor

Optional anchor to add at the end of this url

$id_shop

getController()

getController(  $id_shop = null) : string

Retrieve the controller from url or request uri if routes are activated

Parameters

$id_shop

Returns

string

getControllers()

getControllers(  $dirs) : array

Get list of all available FO controllers

Parameters

$dirs

Returns

array

getModuleControllers()

getModuleControllers(  $type = 'all',   $module = null) : array

Get list of all available Module Front controllers

Parameters

$type
$module

Returns

array

getControllersInDirectory()

getControllersInDirectory(  $dir) : array

Get list of available controllers from the specified dir

Parameters

$dir

Returns

array

__construct()

__construct() 

Need to be instancied from getInstance() method

setRequestUri()

setRequestUri() 

Set request uri and iso lang

loadRoutes()

loadRoutes(  $id_shop = null) 

Load default routes group by languages

Parameters

$id_shop