diff options
| author | 2014-12-05 14:48:09 +0100 | |
|---|---|---|
| committer | 2014-12-05 14:48:09 +0100 | |
| commit | f8aa66152fcab24ae7cd9663dab0c0c96a45ca24 (patch) | |
| tree | b7a30a609c87d61ae05c7dc1c2b8534366076e6a /lib/Minz/Extension.php | |
| parent | 9fc60317eecba785b66011f04b9a5150296f2df6 (diff) | |
Give possibility to register a new Controller.
- Add a Extension->registerController(name) method
- Controllers must be written in extension_dir/controllers/nameController.php
- Controllers must be named as FreshExtension_name_Controller
- Controllers must extend Minz_ActionController
See https://github.com/FreshRSS/FreshRSS/issues/252
Diffstat (limited to 'lib/Minz/Extension.php')
| -rw-r--r-- | lib/Minz/Extension.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Minz/Extension.php b/lib/Minz/Extension.php index a1fdd659b..ad3465640 100644 --- a/lib/Minz/Extension.php +++ b/lib/Minz/Extension.php @@ -136,4 +136,17 @@ class Minz_Extension { '&' . $mtime; return Minz_Url::display($url); } + + /** + * Register a controller in the Dispatcher. + * + * @param @base_name the base name of the controller. Final name will be: + * FreshExtension_<base_name>_Controller. + */ + public function registerController($base_name) { + $controller_name = 'FreshExtension_' . $base_name . '_Controller'; + $filename = $this->path . '/controllers/' . $base_name . 'Controller.php'; + + Minz_Dispatcher::registerController($base_name, $controller_name, $filename); + } } |
