harmonize My class

main
Jean-Christian Paul Denis 2023-05-08 10:25:39 +02:00
parent 0e1627414f
commit bbd5f8089b
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 13 additions and 11 deletions

View File

@ -46,10 +46,10 @@ class Frontend extends dcNsProcess
} }
$tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->get('system')->get('theme'), 'tplset'); $tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->get('system')->get('theme'), 'tplset');
if (!empty($tplset) && is_dir(implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', $tplset]))) { if (!empty($tplset) && is_dir(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]))) {
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', $tplset])); dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]));
} else { } else {
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', DC_DEFAULT_TPLSET])); dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', DC_DEFAULT_TPLSET]));
} }
$all_allowed_ip = json_decode(dcCore::app()->blog->settings->get(My::id())->get('allowed_ip'), true); $all_allowed_ip = json_decode(dcCore::app()->blog->settings->get(My::id())->get('allowed_ip'), true);

View File

@ -17,15 +17,15 @@ namespace Dotclear\Plugin\construction;
use dcCore; use dcCore;
/** /**
* Plugin definitions * This module definitions.
*/ */
class My class My
{ {
/** @var string Required php version */ /** @var string Required php version */
public const PHP_MIN = '7.4'; public const PHP_MIN = '7.4';
/** /**
* This module id * This module id.
*/ */
public static function id(): string public static function id(): string
{ {
@ -33,23 +33,25 @@ class My
} }
/** /**
* This module name * This module name.
*/ */
public static function name(): string public static function name(): string
{ {
return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name')); $name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
return __(is_string($name) ? $name : self::id());
} }
/** /**
* This mdoule directory * This module path.
*/ */
public static function root(): string public static function path(): string
{ {
return dirname(__DIR__); return dirname(__DIR__);
} }
/** /**
* Check php version * Check this module PHP version compliant.
*/ */
public static function phpCompliant(): bool public static function phpCompliant(): bool
{ {