mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
remove MTTExtension::name
This commit is contained in:
parent
767c669435
commit
0512a5d1a6
2 changed files with 9 additions and 5 deletions
|
|
@ -16,6 +16,10 @@ class ExtSettingsController extends ApiController {
|
|||
if (!$instance) {
|
||||
return;
|
||||
}
|
||||
$meta = MTTExtension::extMetaInfo($ext);
|
||||
if (!$meta || !isset($meta['name'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $instance->settingsPage();
|
||||
|
||||
|
|
@ -25,7 +29,7 @@ class ExtSettingsController extends ApiController {
|
|||
$name = htmlspecialchars($lang->get($nameKey));
|
||||
}
|
||||
else {
|
||||
$name = htmlspecialchars($instance::name);
|
||||
$name = htmlspecialchars($meta['name']);
|
||||
}
|
||||
$escapedExt = htmlspecialchars($ext);
|
||||
$e = function($s) use($lang) { return htmlspecialchars($lang->get($s)); };
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ abstract class ApiController
|
|||
abstract class MTTExtension
|
||||
{
|
||||
const bundleId = '';
|
||||
const name = '';
|
||||
|
||||
abstract function init();
|
||||
|
||||
public static function extMetaInfo(string $ext): ?array
|
||||
|
|
@ -142,11 +142,11 @@ class MTTExtensionLoader
|
|||
}
|
||||
|
||||
$className = get_class($instance);
|
||||
if (!defined("$className::bundleId") || !defined("$className::name")) {
|
||||
throw new Exception("Failed to register extension '$ext': require class constants (bundleId, name)");
|
||||
if (!defined("$className::bundleId")) {
|
||||
throw new Exception("Failed to load extension '$ext': missing required class constants (bundleId)");
|
||||
}
|
||||
if ($instance::bundleId != $ext) {
|
||||
throw new Exception("Extension '$ext' bundleId does not conforms to extension dir");
|
||||
throw new Exception("Failed to load extension '$ext': bundleId does not conforms to extension dir");
|
||||
}
|
||||
|
||||
Lang::instance()->loadExtensionLang($ext);
|
||||
|
|
|
|||
Loading…
Reference in a new issue