- Class name: DispatcherCore
- Source: classes/Dispatcher.php line 30
- $controller
- $controller_not_found
- $default_controller
- $default_routes
- $empty_route
- $front_controller
- $instance
- $multilang_activated
- $request_uri
- $routes
- $use_default_controller
- $use_routes
- __construct
- addRoute
- createUrl
- dispatch
- getController
- getControllers
- getControllersInDirectory
- getInstance
- getModuleControllers
- hasKeyword
- hasRoute
- loadRoutes
- setRequestUri
- useDefaultController
- validateRoute
const FC_ADMIN = 2
- Source: classes/Dispatcher.php line 36.
const FC_FRONT = 1
List of available front controllers types
- Source: classes/Dispatcher.php line 35.
const FC_MODULE = 3
- Source: classes/Dispatcher.php line 37.
protected string $controller
- Visibility: protected
- Source: classes/Dispatcher.php line 157.
protected string $controller_not_found = 'pagenotfound'
- Visibility: protected
- Source: classes/Dispatcher.php line 178.
protected string $default_controller
- Visibility: protected
- Source: classes/Dispatcher.php line 172.
public array $default_routes = array('category_rule' => array('controller' => 'category', 'rule' => '{id}-{rewrite}', 'keywords' => array('id' => array('regexp' => '[0-9]+', 'param' => 'id_category'), 'rewrite' => array('regexp' => '[_a-zA-Z0-9\pL\pS-]*'), 'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'))), 'supplier_rule' => array('controller' => 'supplier', 'rule' => '{id}__{rewrite}', 'keywords' => array('id' => array('regexp' => '[0-9]+', 'param' => 'id_supplier'), 'rewrite' => array('regexp' => '[_a-zA-Z0-9\pL\pS-]*'), 'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'))), 'manufacturer_rule' => array('controller' => 'manufacturer', 'rule' => '{id}_{rewrite}', 'keywords' => array('id' => array('regexp' => '[0-9]+', 'param' => 'id_manufacturer'), 'rewrite' => array('regexp' => '[_a-zA-Z0-9\pL\pS-]*'), 'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'))), 'cms_rule' => array('controller' => 'cms', 'rule' => 'content/{id}-{rewrite}', 'keywords' => array('id' => array('regexp' => '[0-9]+', 'param' => 'id_cms'), 'rewrite' => array('regexp' => '[_a-zA-Z0-9\pL\pS-]*'), 'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'))), 'cms_category_rule' => array('controller' => 'cms', 'rule' => 'content/category/{id}-{rewrite}', 'keywords' => array('id' => array('regexp' => '[0-9]+', 'param' => 'id_cms_category'), 'rewrite' => array('regexp' => '[_a-zA-Z0-9\pL\pS-]*'), 'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'))), 'module' => array('controller' => null, 'rule' => 'module/{module}{/:controller}', 'keywords' => array('module' => array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'module'), 'controller' => array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'controller')), 'params' => array('fc' => 'module')), 'product_rule' => array('controller' => 'product', 'rule' => '{category:/}{id}-{rewrite}{-:ean13}.html', 'keywords' => array('id' => array('regexp' => '[0-9]+', 'param' => 'id_product'), 'rewrite' => array('regexp' => '[_a-zA-Z0-9\pL\pS-]*'), 'ean13' => array('regexp' => '[0-9\pL]*'), 'category' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'categories' => array('regexp' => '[/_a-zA-Z0-9-\pL]*'), 'reference' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'manufacturer' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'supplier' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'price' => array('regexp' => '[0-9\.,]*'), 'tags' => array('regexp' => '[a-zA-Z0-9-\pL]*'))), 'layered_rule' => array('controller' => 'category', 'rule' => '{id}-{rewrite}{/:selected_filters}', 'keywords' => array('id' => array('regexp' => '[0-9]+', 'param' => 'id_category'), 'selected_filters' => array('regexp' => '.*', 'param' => 'selected_filters'), 'rewrite' => array('regexp' => '[_a-zA-Z0-9\pL\pS-]*'), 'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'), 'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'))))
- Visibility: public
- Source: classes/Dispatcher.php line 47.
protected array $empty_route
- Visibility: protected
- Source: classes/Dispatcher.php line 167.
protected string $front_controller = self::FC_FRONT
- Visibility: protected
- Source: classes/Dispatcher.php line 183.
public \Dispatcher $instance = null
- Visibility: public
- This property is static.
- Source: classes/Dispatcher.php line 42.
protected mixed $multilang_activated = false
- Visibility: protected
- Source: classes/Dispatcher.php line 147.
protected string $request_uri
- Visibility: protected
- Source: classes/Dispatcher.php line 162.
protected array $routes = array()
- Visibility: protected
- Source: classes/Dispatcher.php line 152.
protected mixed $use_default_controller = false
- Visibility: protected
- Source: classes/Dispatcher.php line 173.
protected boolean $use_routes = false
- Visibility: protected
- Source: classes/Dispatcher.php line 145.
mixed DispatcherCore::__construct()
Need to be instancied from getInstance() method
- Visibility: protected
- Source: classes/Dispatcher.php line 201
mixed DispatcherCore::addRoute(string $route_id, string $rule, string $controller, integer $id_lang, array $keywords, array $params, integer $id_shop)
- Visibility: public
- Source: classes/Dispatcher.php line 500
- $route_id string - Name of the route (need to be uniq, a second route with same name will override the first)
- $rule string - Url rule
- $controller string - Controller to call if request uri match the rule
- $id_lang integer
- $keywords array
- $params array
- $id_shop integer
mixed DispatcherCore::createUrl(string $route_id, integer $id_lang, array $params, $force_routes, string $anchor, $id_shop)
Create an url from
- Visibility: public
- Source: classes/Dispatcher.php line 634
- $route_id string - Name the route
- $id_lang integer
- $params array
- $force_routes mixed
- $anchor string - Optional anchor to add at the end of this url
- $id_shop mixed
mixed DispatcherCore::dispatch()
Find the controller and instantiate it
- Visibility: public
- Source: classes/Dispatcher.php line 254
string DispatcherCore::getController($id_shop)
Retrieve the controller from url or request uri if routes are activated
- Visibility: public
- Source: classes/Dispatcher.php line 719
- $id_shop mixed
array DispatcherCore::getControllers($dirs)
Get list of all available FO controllers
- Visibility: public
- This method is static.
- Source: classes/Dispatcher.php line 814
- $dirs mixed
array DispatcherCore::getControllersInDirectory(string $dir)
Get list of available controllers from the specified dir
- Visibility: public
- This method is static.
- Source: classes/Dispatcher.php line 870
- $dir string - Directory to scan (recursively)
\Dispatcher DispatcherCore::getInstance()
Get current instance of dispatcher (singleton)
- Visibility: public
- This method is static.
- Source: classes/Dispatcher.php line 190
array DispatcherCore::getModuleControllers($type, $module)
Get list of all available Module Front controllers
- Visibility: public
- This method is static.
- Source: classes/Dispatcher.php line 832
- $type mixed
- $module mixed
boolean DispatcherCore::hasKeyword(string $route_id, integer $id_lang, string $keyword, integer $id_shop)
Check if a keyword is written in a route rule
- Visibility: public
- Source: classes/Dispatcher.php line 585
- $route_id string
- $id_lang integer
- $keyword string
- $id_shop integer
boolean DispatcherCore::hasRoute(string $route_id, integer $id_lang, integer $id_shop)
Check if a route exists
- Visibility: public
- Source: classes/Dispatcher.php line 564
- $route_id string
- $id_lang integer
- $id_shop integer
mixed DispatcherCore::loadRoutes($id_shop)
Load default routes group by languages
- Visibility: protected
- Source: classes/Dispatcher.php line 402
- $id_shop mixed
mixed DispatcherCore::setRequestUri()
Set request uri and iso lang
- Visibility: protected
- Source: classes/Dispatcher.php line 376
mixed DispatcherCore::useDefaultController()
- Visibility: public
- Source: classes/Dispatcher.php line 231
mixed DispatcherCore::validateRoute(string $route_id, string $rule, array $errors)
Check if a route rule contain all required keywords of default route definition
- Visibility: public
- Source: classes/Dispatcher.php line 609
- $route_id string
- $rule string - Rule to verify
- $errors array - List of missing keywords