harmonize My class
This commit is contained in:
parent
4c01df6338
commit
a4cfc8a29a
@ -10,7 +10,7 @@
|
|||||||
* @copyright Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,9 +22,9 @@ $this->registerModule(
|
|||||||
[
|
[
|
||||||
'requires' => [['core', '2.26']],
|
'requires' => [['core', '2.26']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => dcCore::app()->auth->makePermissions([
|
||||||
dcAuth::PERMISSION_USAGE,
|
dcCore::app()->auth::PERMISSION_USAGE,
|
||||||
dcAuth::PERMISSION_CONTENT_ADMIN,
|
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
|
||||||
dcAuth::PERMISSION_ADMIN,
|
dcCore::app()->auth::PERMISSION_ADMIN,
|
||||||
]),
|
]),
|
||||||
'priority' => 2,
|
'priority' => 2,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
|
@ -37,7 +37,7 @@ class Frontend extends dcNsProcess
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', 'tpl']));
|
dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', 'tpl']));
|
||||||
|
|
||||||
dcCore::app()->tpl->addBlock('activityReports', [Template::class, 'activityReports']);
|
dcCore::app()->tpl->addBlock('activityReports', [Template::class, 'activityReports']);
|
||||||
dcCore::app()->tpl->addValue('activityReportFeedID', [Template::class, 'activityReportFeedID']);
|
dcCore::app()->tpl->addValue('activityReportFeedID', [Template::class, 'activityReportFeedID']);
|
||||||
|
32
src/My.php
32
src/My.php
@ -17,13 +17,10 @@ namespace Dotclear\Plugin\activityReport;
|
|||||||
use dcCore;
|
use dcCore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module definitions
|
* This module definitions.
|
||||||
*/
|
*/
|
||||||
class My
|
class My
|
||||||
{
|
{
|
||||||
/** @var string Required php version */
|
|
||||||
public const PHP_MIN = '8.1';
|
|
||||||
|
|
||||||
/** @var string Activity database table name */
|
/** @var string Activity database table name */
|
||||||
public const ACTIVITY_TABLE_NAME = 'activity';
|
public const ACTIVITY_TABLE_NAME = 'activity';
|
||||||
|
|
||||||
@ -33,6 +30,9 @@ class My
|
|||||||
/** @var int Incremental version by breaking changes */
|
/** @var int Incremental version by breaking changes */
|
||||||
public const COMPATIBILITY_VERSION = 3;
|
public const COMPATIBILITY_VERSION = 3;
|
||||||
|
|
||||||
|
/** @var string Required php version */
|
||||||
|
public const PHP_MIN = '7.4';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module id.
|
* This module id.
|
||||||
*/
|
*/
|
||||||
@ -46,17 +46,27 @@ class My
|
|||||||
*/
|
*/
|
||||||
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 module root.
|
* This module path.
|
||||||
*/
|
*/
|
||||||
public static function root(): string
|
public static function path(): string
|
||||||
{
|
{
|
||||||
return dirname(__DIR__);
|
return dirname(__DIR__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check this module PHP version compliant.
|
||||||
|
*/
|
||||||
|
public static function phpCompliant(): bool
|
||||||
|
{
|
||||||
|
return version_compare(phpversion(), self::PHP_MIN, '>=');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check is module is trully installed.
|
* Check is module is trully installed.
|
||||||
*
|
*
|
||||||
@ -66,12 +76,4 @@ class My
|
|||||||
{
|
{
|
||||||
return dcCore::app()->getVersion(self::id()) == dcCore::app()->plugins->moduleInfo(self::id(), 'version');
|
return dcCore::app()->getVersion(self::id()) == dcCore::app()->plugins->moduleInfo(self::id(), 'version');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check php version.
|
|
||||||
*/
|
|
||||||
public static function phpCompliant(): bool
|
|
||||||
{
|
|
||||||
return version_compare(phpversion(), self::PHP_MIN, '>=');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user