diff options
author | Mario <mario@mariovavti.com> | 2024-07-06 11:05:22 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-07-06 11:05:22 +0000 |
commit | 45275910e606a02b12393714ea3b0409da440d61 (patch) | |
tree | 10b2d173d58cb930f8df28fe75af73dd4974c08c /Zotlabs/Web/Controller.php | |
parent | 0c1d0f7498661fb34dcca6f3c6566e757af310a7 (diff) | |
parent | c04e781926a78e514cdf211fa24930a331149072 (diff) | |
download | volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.tar.gz volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.tar.bz2 volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.zip |
Merge branch '9.2RC'master
Diffstat (limited to 'Zotlabs/Web/Controller.php')
-rw-r--r-- | Zotlabs/Web/Controller.php | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/Zotlabs/Web/Controller.php b/Zotlabs/Web/Controller.php index 2d0f58891..6384f24df 100644 --- a/Zotlabs/Web/Controller.php +++ b/Zotlabs/Web/Controller.php @@ -2,12 +2,58 @@ namespace Zotlabs\Web; +/** + * Base controller class for Modules. + * + * Modules should extend this class, and override the methods needed. Emtpy + * default implementations allow Modules to only override the methods they + * need. + * + * The methods defined by this class is invoked in order: + * + * - init() + * - post() -- only for POST requests + * - get() + * + * Modules which emit other serialisations besides HTML (XML,JSON, etc.) should + * do so within the module `init` and/or `post` functions and then invoke + * `killme()` to terminate further processing. + */ +abstract class Controller { -class Controller { + /** + * Initialize request processing. + * + * This method is called before any other request processing, and + * regardless of the request method. The theme is not yet loaded when + * this method is invoked. + */ + public function init() { + } - function init() {} - function post() {} - function get() {} + /** + * Process POST requests. + * + * This method is called if the incoming request is a POST request. It is + * invoked after the theme has been loaded. This method should not normally + * render HTML output, as processing will fall through to the GET processing + * if this method completes without error or stopping processing in other + * ways. + */ + public function post() { + } + /** + * Process GET requests or the body part of POST requests. + * + * This method is called directly for GET requests, and immediately after the + * `post()` method for POST requests. + * + * It will return the module content as a HTML string. + * + * @return string HTML content for the module. + */ + public function get() { + return ''; + } } - |