harmonize My class
This commit is contained in:
parent
406f4a4357
commit
a6580e8d63
28
src/My.php
28
src/My.php
@ -17,14 +17,11 @@ namespace Dotclear\Plugin\disclaimer;
|
|||||||
use dcCore;
|
use dcCore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin definitions
|
* This module definitions.
|
||||||
*/
|
*/
|
||||||
class My
|
class My
|
||||||
{
|
{
|
||||||
/** @var string Required php version */
|
/** @var array Default list of bots agents */
|
||||||
public const PHP_MIN = '7.4';
|
|
||||||
|
|
||||||
/** @var array Default list of bots agents */
|
|
||||||
public const DEFAULT_BOTS_AGENTS = [
|
public const DEFAULT_BOTS_AGENTS = [
|
||||||
'bot',
|
'bot',
|
||||||
'Scooter',
|
'Scooter',
|
||||||
@ -43,14 +40,17 @@ class My
|
|||||||
'Crawler',
|
'Crawler',
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var string disclaimer specific cookie prefix */
|
/** @var string disclaimer specific cookie prefix */
|
||||||
public const COOKIE_PREFIX = 'dc_disclaimer_cookie_';
|
public const COOKIE_PREFIX = 'dc_disclaimer_cookie_';
|
||||||
|
|
||||||
/** @var string disclaimer specific session prefix */
|
/** @var string disclaimer specific session prefix */
|
||||||
public const SESSION_PREFIX = 'dc_disclaimer_sess_';
|
public const SESSION_PREFIX = 'dc_disclaimer_sess_';
|
||||||
|
|
||||||
|
/** @var string Required php version */
|
||||||
|
public const PHP_MIN = '7.4';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module id
|
* This module id.
|
||||||
*/
|
*/
|
||||||
public static function id(): string
|
public static function id(): string
|
||||||
{
|
{
|
||||||
@ -58,23 +58,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
|
||||||
{
|
{
|
||||||
|
@ -71,10 +71,10 @@ class UrlHandler extends dcUrlHandlers
|
|||||||
|
|
||||||
# Set default-templates path for disclaimer files
|
# Set default-templates path for disclaimer files
|
||||||
$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(My::root() . '/default-templates/' . $tplset)) {
|
if (!empty($tplset) && is_dir(My::path() . '/default-templates/' . $tplset)) {
|
||||||
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), My::root() . '/default-templates/' . $tplset);
|
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), My::path() . '/default-templates/' . $tplset);
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), My::root() . '/default-templates/' . DC_DEFAULT_TPLSET);
|
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), My::path() . '/default-templates/' . DC_DEFAULT_TPLSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
# New URL handler
|
# New URL handler
|
||||||
|
Loading…
Reference in New Issue
Block a user