Add Base Module class

This commit is contained in:
Hypolite Petovan 2017-12-17 12:05:19 -05:00
parent f07776a78e
commit 7c470f0be9

60
src/BaseModule.php Normal file
View File

@ -0,0 +1,60 @@
<?php
namespace Friendica;
/**
* All modules in Friendica should extend BaseModule, although not all modules
* need to extend all the methods described here
*
* @author Hypolite Petovan mrpetovan@gmail.com
*/
abstract class BaseModule extends BaseObject
{
/**
* @brief Initialization method common to both content() and post()
*
* Extend this method if you need to do any shared processing before both
* content() or post()
*/
public static function init()
{
}
/**
* @brief Module GET method to display any content
*
* Extend this method if the module is supposed to return any display
* through a GET request. It can be an HTML page through templating or a
* XML feed or a JSON output.
*
* @return string
*/
public static function content()
{
$o = '';
return $o;
}
/**
* @brief Module POST method to process submitted data
*
* Extend this method if the module is supposed to process POST requests.
* Doesn't display any content
*/
public static function post()
{
// goaway('module');
}
/**
* @brief Called after post()
*
* Unknown purpose
*/
public static function afterpost()
{
}
}