harmonize My class

This commit is contained in:
Jean-Christian Denis 2023-05-08 10:53:12 +02:00
parent ae8bb8deba
commit 82622dd7bf
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 13 additions and 11 deletions

View file

@ -42,10 +42,10 @@ class Frontend extends dcNsProcess
}
$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]))) {
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), 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::path(), 'default-templates', $tplset]));
} 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]));
}
},
// breacrumb addon

View file

@ -17,15 +17,15 @@ namespace Dotclear\Plugin\CategoriesPage;
use dcCore;
/**
* Plugin definitions
* This module definitions.
*/
class My
{
/** @var string Required php version */
/** @var string This module required php version */
public const PHP_MIN = '7.4';
/**
* This module id
* This module id.
*/
public static function id(): string
{
@ -33,23 +33,25 @@ class My
}
/**
* This module name
* This module name.
*/
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 module root
* This module path.
*/
public static function root(): string
public static function path(): string
{
return dirname(__DIR__);
}
/**
* Check php version
* Check this module PHP version compliant.
*/
public static function phpCompliant(): bool
{