forked from GNUsocial/gnu-social
[MODULES] Add module configuration
This commit is contained in:
parent
de8a2f579c
commit
508f1f8796
@ -33,6 +33,14 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
abstract class Module
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// Load Module settings
|
||||
foreach (Common::config(static::class) as $aname => $avalue) {
|
||||
$this->{$aname} = $avalue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize the class to store in the cache
|
||||
*
|
||||
|
@ -2,6 +2,36 @@
|
||||
|
||||
namespace App\Core\Modules;
|
||||
|
||||
use App\Core\Event;
|
||||
|
||||
abstract class Plugin extends Module
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function name()
|
||||
{
|
||||
$cls = get_class($this);
|
||||
return mb_substr($cls, 0, -6);
|
||||
}
|
||||
|
||||
public function version()
|
||||
{
|
||||
return GNUSOCIAL_BASE_VERSION;
|
||||
}
|
||||
|
||||
public function onPluginVersion(array &$versions): bool
|
||||
{
|
||||
$name = $this->name();
|
||||
|
||||
$versions[] = [
|
||||
'name' => $name,
|
||||
// TRANS: Displayed as version information for a plugin if no version information was found.
|
||||
'version' => _m('Unknown'),
|
||||
];
|
||||
|
||||
return Event::next;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user