rebuild namespace (ns playground)
parent
c928eca287
commit
bdd295d5ce
|
@ -12,11 +12,7 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcAdmin;
|
use dcAdmin;
|
||||||
|
@ -33,58 +29,52 @@ use files;
|
||||||
*
|
*
|
||||||
* Add menu and dashboard icons, load Improve action modules.
|
* Add menu and dashboard icons, load Improve action modules.
|
||||||
*/
|
*/
|
||||||
class admin
|
class Admin
|
||||||
{
|
{
|
||||||
public static function process(): void
|
private static $init = false;
|
||||||
|
|
||||||
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
self::addSettingsNamespace();
|
if (defined('DC_CONTEXT_ADMIN')) {
|
||||||
self::addAdminBehaviors();
|
dcCore::app()->blog->settings->addNamespace(Core::id());
|
||||||
self::addAdminMenu();
|
self::$init = true;
|
||||||
self::addImproveActions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function addSettingsNamespace(): void
|
return self::$init;
|
||||||
{
|
|
||||||
dcCore::app()->blog->settings->addNamespace('improve');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function addAdminBehaviors(): void
|
public static function process()
|
||||||
{
|
{
|
||||||
|
if (!self::$init) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $favs): void {
|
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $favs): void {
|
||||||
$favs->register(
|
$favs->register(
|
||||||
'improve',
|
'improve',
|
||||||
[
|
[
|
||||||
'title' => __('improve'),
|
'title' => __('improve'),
|
||||||
'url' => dcCore::app()->adminurl->get('admin.plugin.improve'),
|
'url' => dcCore::app()->adminurl->get('admin.plugin.' . Core::id()),
|
||||||
'small-icon' => dcPage::getPF('improve/icon.svg'),
|
'small-icon' => dcPage::getPF(Core::id() . '/icon.svg'),
|
||||||
'large-icon' => dcPage::getPF('improve/icon.svg'),
|
'large-icon' => dcPage::getPF(Core::id() . '/icon.svg'),
|
||||||
//'permissions' => null,
|
//'permissions' => null,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
private static function addAdminMenu(): void
|
|
||||||
{
|
|
||||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
__('improve'),
|
__('improve'),
|
||||||
dcCore::app()->adminurl->get('admin.plugin.improve'),
|
dcCore::app()->adminurl->get('admin.plugin.' . Core::id()),
|
||||||
dcPage::getPF('improve/icon.svg'),
|
dcPage::getPF(Core::id() . '/icon.svg'),
|
||||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.improve')) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . Core::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||||
dcCore::app()->auth->isSuperAdmin()
|
dcCore::app()->auth->isSuperAdmin()
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
private static function addImproveActions(): void
|
foreach (files::scandir(Prepend::getActionsDir()) as $file) {
|
||||||
{
|
if (is_file(Prepend::getActionsDir() . $file) && '.php' == substr($file, -4)) {
|
||||||
foreach (files::scandir(prepend::getActionsDir()) as $file) {
|
Clearbricks::lib()->autoload([Prepend::getActionsNS() . substr($file, 0, -4) => Prepend::getActionsDir() . $file]);
|
||||||
if (is_file(prepend::getActionsDir() . $file) && '.php' == substr($file, -4)) {
|
dcCore::app()->addBehavior('improveAddAction', [Prepend::getActionsNS() . substr($file, 0, -4), 'create']); /* @phpstan-ignore-line */
|
||||||
Clearbricks::lib()->autoload([prepend::getActionsNS() . substr($file, 0, -4) => prepend::getActionsDir() . $file]);
|
|
||||||
dcCore::app()->addBehavior('improveAddAction', [prepend::getActionsNS() . substr($file, 0, -4), 'create']); /* @phpstan-ignore-line */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process */
|
|
||||||
admin::process();
|
|
||||||
|
|
|
@ -12,11 +12,7 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
@ -33,34 +29,28 @@ use Exception;
|
||||||
*
|
*
|
||||||
* Set preference for this plugin.
|
* Set preference for this plugin.
|
||||||
*/
|
*/
|
||||||
class config
|
class Config
|
||||||
{
|
{
|
||||||
/** @var improve $improve improve core instance */
|
private static $init = false;
|
||||||
private $improve = null;
|
|
||||||
|
|
||||||
public function __construct()
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
|
if (defined('DC_CONTEXT_ADMIN')) {
|
||||||
dcPage::checkSuper();
|
dcPage::checkSuper();
|
||||||
|
|
||||||
$this->improve = new improve();
|
dcCore::app()->blog->settings->addNamespace(Core::id());
|
||||||
|
self::$init = true;
|
||||||
$this->saveConfig();
|
|
||||||
$this->displayConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getModules(): array
|
return self::$init;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function process(): void
|
||||||
{
|
{
|
||||||
$modules = [];
|
if (!self::$init) {
|
||||||
foreach ($this->improve->modules() as $action) {
|
return;
|
||||||
$modules[$action->name()] = $action->id();
|
|
||||||
}
|
|
||||||
$modules = array_merge($modules, array_flip($this->improve->disabled()));
|
|
||||||
|
|
||||||
return $modules;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function saveConfig(): void
|
|
||||||
{
|
|
||||||
if (empty($_POST['save'])) {
|
if (empty($_POST['save'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -70,8 +60,8 @@ class config
|
||||||
if (!empty($_POST['disabled']) && is_array($_POST['disabled'])) {
|
if (!empty($_POST['disabled']) && is_array($_POST['disabled'])) {
|
||||||
$pdisabled = implode(';', $_POST['disabled']);
|
$pdisabled = implode(';', $_POST['disabled']);
|
||||||
}
|
}
|
||||||
dcCore::app()->blog->settings->improve->put('disabled', $pdisabled);
|
dcCore::app()->blog->settings->get(Core::id())->put('disabled', $pdisabled);
|
||||||
dcCore::app()->blog->settings->improve->put('nodetails', !empty($_POST['nodetails']));
|
dcCore::app()->blog->settings->get(Core::id())->put('nodetails', !empty($_POST['nodetails']));
|
||||||
|
|
||||||
dcPage::addSuccessNotice(__('Configuration successfully updated'));
|
dcPage::addSuccessNotice(__('Configuration successfully updated'));
|
||||||
|
|
||||||
|
@ -84,24 +74,33 @@ class config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function displayConfig(): void
|
public static function render()
|
||||||
{
|
{
|
||||||
|
if (!self::$init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$improve = new Core();
|
||||||
|
|
||||||
|
$modules = [];
|
||||||
|
foreach ($improve->modules() as $action) {
|
||||||
|
$modules[$action->name()] = $action->id();
|
||||||
|
}
|
||||||
|
$modules = array_merge($modules, array_flip($improve->disabled()));
|
||||||
|
|
||||||
echo '<div class="fieldset"><h4>' . __('List of disabled actions:') . '</h4>';
|
echo '<div class="fieldset"><h4>' . __('List of disabled actions:') . '</h4>';
|
||||||
|
|
||||||
foreach ($this->getModules() as $name => $id) {
|
foreach ($modules as $name => $id) {
|
||||||
echo
|
echo
|
||||||
'<p><label class="classic" title="' . $id . '">' .
|
'<p><label class="classic" title="' . $id . '">' .
|
||||||
form::checkbox(['disabled[]'], $id, ['checked' => array_key_exists($id, $this->improve->disabled())]) .
|
form::checkbox(['disabled[]'], $id, ['checked' => array_key_exists($id, $improve->disabled())]) .
|
||||||
__($name) . '</label></p>';
|
__($name) . '</label></p>';
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
'</div><div class="fieldset"><h4>' . __('Options') . '</h4>' .
|
'</div><div class="fieldset"><h4>' . __('Options') . '</h4>' .
|
||||||
'<p><label class="classic">' .
|
'<p><label class="classic">' .
|
||||||
form::checkbox('nodetails', '1', ['checked' => dcCore::app()->blog->settings->improve->nodetails]) .
|
form::checkbox('nodetails', '1', ['checked' => dcCore::app()->blog->settings->get(Core::id())->get('nodetails')]) .
|
||||||
__('Hide details of rendered actions') . '</label></p>' .
|
__('Hide details of rendered actions') . '</label></p>' .
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process */
|
|
||||||
new config();
|
|
||||||
|
|
|
@ -12,15 +12,10 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcUtils;
|
|
||||||
|
|
||||||
/* php */
|
/* php */
|
||||||
use Exception;
|
use Exception;
|
||||||
|
@ -31,7 +26,7 @@ use Exception;
|
||||||
* Set default settings and version
|
* Set default settings and version
|
||||||
* and manage changes on updates.
|
* and manage changes on updates.
|
||||||
*/
|
*/
|
||||||
class install
|
class Install
|
||||||
{
|
{
|
||||||
/** @var array Improve default settings */
|
/** @var array Improve default settings */
|
||||||
private static $default_settings = [[
|
private static $default_settings = [[
|
||||||
|
@ -41,26 +36,37 @@ class install
|
||||||
'string',
|
'string',
|
||||||
]];
|
]];
|
||||||
|
|
||||||
public static function process(): ?bool
|
// Nothing to change below
|
||||||
|
private static $init = false;
|
||||||
|
|
||||||
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
if (!dcCore::app()->newVersion(
|
self::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->newVersion(Core::id(), dcCore::app()->plugins->moduleInfo(Core::id(), 'version'));
|
||||||
basename(__DIR__),
|
|
||||||
dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
|
return self::$init;
|
||||||
)) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
public static function process(): ?bool
|
||||||
|
{
|
||||||
|
if (!self::$init) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
self::update_0_8_0();
|
self::update_0_8_0();
|
||||||
self::putSettings();
|
self::putSettings();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function putSettings(): void
|
private static function putSettings(): void
|
||||||
{
|
{
|
||||||
foreach (self::$default_settings as $v) {
|
foreach (self::$default_settings as $v) {
|
||||||
dcCore::app()->blog->settings->__get(basename(__DIR__))->put(
|
dcCore::app()->blog->settings->get(Core::id())->put(
|
||||||
$v[0],
|
$v[0],
|
||||||
$v[2],
|
$v[2],
|
||||||
$v[3],
|
$v[3],
|
||||||
|
@ -74,22 +80,13 @@ class install
|
||||||
/** Update improve < 0.8 : action modules settings name */
|
/** Update improve < 0.8 : action modules settings name */
|
||||||
private static function update_0_8_0(): void
|
private static function update_0_8_0(): void
|
||||||
{
|
{
|
||||||
if (version_compare(dcCore::app()->getVersion(basename(__DIR__)) ?? '0', '0.8', '<')) {
|
if (version_compare(dcCore::app()->getVersion(Core::id()) ?? '0', '0.8', '<')) {
|
||||||
foreach (dcCore::app()->blog->settings->__get(basename(__DIR__))->dumpGlobalSettings() as $id => $values) {
|
foreach (dcCore::app()->blog->settings->get(Core::id())->dumpGlobalSettings() as $id => $values) {
|
||||||
$newId = str_replace('ImproveAction', '', $id);
|
$newId = str_replace('ImproveAction', '', $id);
|
||||||
if ($id != $newId) {
|
if ($id != $newId) {
|
||||||
dcCore::app()->blog->settings->__get(basename(__DIR__))->rename($id, strtolower($newId));
|
dcCore::app()->blog->settings->get(Core::id())->rename($id, strtolower($newId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process */
|
|
||||||
try {
|
|
||||||
return install::process();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
dcCore::app()->error->add($e->getMessage());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
171
inc/Manage.php
171
inc/Manage.php
|
@ -12,11 +12,7 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
@ -38,59 +34,63 @@ use Exception;
|
||||||
* Display page and configure modules
|
* Display page and configure modules
|
||||||
* and launch action.
|
* and launch action.
|
||||||
*/
|
*/
|
||||||
class index
|
class Manage
|
||||||
{
|
{
|
||||||
/** @var improve $improve improve core instance */
|
/** @var improve $improve improve core instance */
|
||||||
private $improve = null;
|
private static $improve = null;
|
||||||
/** @var string $type Current module(s) type */
|
/** @var string $type Current module(s) type */
|
||||||
private $type = 'plugin';
|
private static $type = 'plugin';
|
||||||
/** @var string $module Current module id */
|
/** @var string $module Current module id */
|
||||||
private $module = '-';
|
private static $module = '-';
|
||||||
/** @var action|null $action Current action module */
|
/** @var action|null $action Current action module */
|
||||||
private $action = null;
|
private static $action = null;
|
||||||
|
|
||||||
public function __construct()
|
private static $init = false;
|
||||||
|
|
||||||
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
|
if (defined('DC_CONTEXT_ADMIN')) {
|
||||||
dcPage::checkSuper();
|
dcPage::checkSuper();
|
||||||
|
|
||||||
$this->improve = new improve();
|
self::$improve = new Core();
|
||||||
$this->type = $this->getType();
|
self::$type = self::getType();
|
||||||
$this->module = $this->getModule();
|
self::$module = self::getModule();
|
||||||
$this->action = $this->getAction();
|
self::$action = self::getAction();
|
||||||
|
self::$init = true;
|
||||||
$this->doAction();
|
|
||||||
$this->displayPage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getType(): string
|
return self::$init;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getType(): string
|
||||||
{
|
{
|
||||||
return $_REQUEST['type'] ?? 'plugin';
|
return $_REQUEST['type'] ?? 'plugin';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getModule(): string
|
private static function getModule(): string
|
||||||
{
|
{
|
||||||
$module = $_REQUEST['module'] ?? '';
|
$module = $_REQUEST['module'] ?? '';
|
||||||
if (!in_array($module, $this->comboModules())) {
|
if (!in_array($module, self::comboModules())) {
|
||||||
$module = '-';
|
$module = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $module;
|
return $module;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAction(): ?action
|
private static function getAction(): ?action
|
||||||
{
|
{
|
||||||
return empty($_REQUEST['config']) ? null : $this->improve->module($_REQUEST['config']);
|
return empty($_REQUEST['config']) ? null : self::$improve->module($_REQUEST['config']);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPreference(): array
|
private static function getPreference(): array
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (!empty($this->type)) {
|
if (!empty(self::$type)) {
|
||||||
$preferences = dcCore::app()->blog->settings->improve->preferences;
|
$preferences = dcCore::app()->blog->settings->get(Core::id())->get('preferences');
|
||||||
if (is_string($preferences)) {
|
if (is_string($preferences)) {
|
||||||
$preferences = unserialize($preferences);
|
$preferences = unserialize($preferences);
|
||||||
if (is_array($preferences)) {
|
if (is_array($preferences)) {
|
||||||
return array_key_exists($this->type, $preferences) ? $preferences[$this->type] : [];
|
return array_key_exists(self::$type, $preferences) ? $preferences[self::$type] : [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,18 +100,18 @@ class index
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setPreferences(): bool
|
private static function setPreferences(): bool
|
||||||
{
|
{
|
||||||
if (!empty($_POST['save_preferences'])) {
|
if (!empty($_POST['save_preferences'])) {
|
||||||
$preferences[$this->type] = [];
|
$preferences[self::$type] = [];
|
||||||
if (!empty($_POST['actions'])) {
|
if (!empty($_POST['actions'])) {
|
||||||
foreach ($this->improve->modules() as $action) {
|
foreach (self::$improve->modules() as $action) {
|
||||||
if (in_array($this->type, $action->types()) && in_array($action->id(), $_POST['actions'])) {
|
if (in_array(self::$type, $action->types()) && in_array($action->id(), $_POST['actions'])) {
|
||||||
$preferences[$this->type][] = $action->id();
|
$preferences[self::$type][] = $action->id();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dcCore::app()->blog->settings->improve->put('preferences', serialize($preferences), 'string', null, true, true);
|
dcCore::app()->blog->settings->get(Core::id())->put('preferences', serialize($preferences), 'string', null, true, true);
|
||||||
dcAdminNotices::addSuccessNotice(__('Configuration successfully updated'));
|
dcAdminNotices::addSuccessNotice(__('Configuration successfully updated'));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -120,9 +120,9 @@ class index
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function comboModules(): array
|
private static function comboModules(): array
|
||||||
{
|
{
|
||||||
$allow_distrib = (bool) dcCore::app()->blog->settings->improve->allow_distrib;
|
$allow_distrib = (bool) dcCore::app()->blog->settings->get(Core::id())->get('allow_distrib');
|
||||||
$official = [
|
$official = [
|
||||||
'plugin' => explode(',', DC_DISTRIB_PLUGINS),
|
'plugin' => explode(',', DC_DISTRIB_PLUGINS),
|
||||||
'theme' => explode(',', DC_DISTRIB_THEMES),
|
'theme' => explode(',', DC_DISTRIB_THEMES),
|
||||||
|
@ -134,9 +134,9 @@ class index
|
||||||
}
|
}
|
||||||
|
|
||||||
$combo_modules = [];
|
$combo_modules = [];
|
||||||
$modules = self::getModules($this->type == 'plugin' ? 'plugins' : 'themes');
|
$modules = self::getModules(self::$type == 'plugin' ? 'plugins' : 'themes');
|
||||||
foreach ($modules as $id => $m) {
|
foreach ($modules as $id => $m) {
|
||||||
if (!$m['root_writable'] || !$allow_distrib && in_array($id, $official[$this->type])) {
|
if (!$m['root_writable'] || !$allow_distrib && in_array($id, $official[self::$type])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$combo_modules[sprintf(__('%s (%s)'), __($m['name']), $id)] = $id;
|
$combo_modules[sprintf(__('%s (%s)'), __($m['name']), $id)] = $id;
|
||||||
|
@ -161,37 +161,41 @@ class index
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function doAction(): void
|
public static function process(): void
|
||||||
{
|
{
|
||||||
|
if (!self::$init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$log_id = '';
|
$log_id = '';
|
||||||
$done = $this->setPreferences();
|
$done = self::setPreferences();
|
||||||
|
|
||||||
if (!empty($_POST['fix'])) {
|
if (!empty($_POST['fix'])) {
|
||||||
if (empty($_POST['actions'])) {
|
if (empty($_POST['actions'])) {
|
||||||
dcAdminNotices::addWarningNotice(__('No action selected'));
|
dcAdminNotices::addWarningNotice(__('No action selected'));
|
||||||
} elseif ($this->module == '-') {
|
} elseif (self::$module == '-') {
|
||||||
dcAdminNotices::addWarningNotice(__('No module selected'));
|
dcAdminNotices::addWarningNotice(__('No module selected'));
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$time = $this->improve->fixModule(
|
$time = self::$improve->fixModule(
|
||||||
$this->type,
|
self::$type,
|
||||||
$this->module,
|
self::$module,
|
||||||
self::getModules($this->type == 'plugin' ? 'plugins' : 'themes', $this->module),
|
self::getModules(self::$type == 'plugin' ? 'plugins' : 'themes', self::$module),
|
||||||
$_POST['actions']
|
$_POST['actions']
|
||||||
);
|
);
|
||||||
$log_id = $this->improve->writeLogs();
|
$log_id = self::$improve->writeLogs();
|
||||||
dcCore::app()->blog->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
|
|
||||||
if ($this->improve->hasLog('error')) {
|
if (self::$improve->hasLog('error')) {
|
||||||
$notice = ['type' => dcAdminNotices::NOTICE_ERROR, 'msg' => __('Fix of "%s" complete in %s secondes with errors')];
|
$notice = ['type' => dcAdminNotices::NOTICE_ERROR, 'msg' => __('Fix of "%s" complete in %s secondes with errors')];
|
||||||
} elseif ($this->improve->hasLog('warning')) {
|
} elseif (self::$improve->hasLog('warning')) {
|
||||||
$notice = ['type' => dcAdminNotices::NOTICE_WARNING, 'msg' => __('Fix of "%s" complete in %s secondes with warnings')];
|
$notice = ['type' => dcAdminNotices::NOTICE_WARNING, 'msg' => __('Fix of "%s" complete in %s secondes with warnings')];
|
||||||
} elseif ($this->improve->hasLog('success')) {
|
} elseif (self::$improve->hasLog('success')) {
|
||||||
$notice = ['type' => dcAdminNotices::NOTICE_SUCCESS, 'msg' => __('Fix of "%s" complete in %s secondes')];
|
$notice = ['type' => dcAdminNotices::NOTICE_SUCCESS, 'msg' => __('Fix of "%s" complete in %s secondes')];
|
||||||
} else {
|
} else {
|
||||||
$notice = ['type' => dcAdminNotices::NOTICE_SUCCESS, 'msg' => __('Fix of "%s" complete in %s secondes without messages')];
|
$notice = ['type' => dcAdminNotices::NOTICE_SUCCESS, 'msg' => __('Fix of "%s" complete in %s secondes without messages')];
|
||||||
}
|
}
|
||||||
dcAdminNotices::addNotice($notice['type'], sprintf($notice['msg'], $this->module, $time));
|
dcAdminNotices::addNotice($notice['type'], sprintf($notice['msg'], self::$module, $time));
|
||||||
|
|
||||||
$done = true;
|
$done = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -202,19 +206,23 @@ class index
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($done) {
|
if ($done) {
|
||||||
dcCore::app()->adminurl->redirect('admin.plugin.improve', ['type' => $this->type, 'module' => $this->module, 'upd' => $log_id]);
|
dcCore::app()->adminurl->redirect('admin.plugin.' . Core::id(), ['type' => self::$type, 'module' => self::$module, 'upd' => $log_id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function displayPage(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
|
if (!self::$init) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$bc = empty($_REQUEST['config']) ?
|
$bc = empty($_REQUEST['config']) ?
|
||||||
($this->type == 'theme' ? __('Themes actions') : __('Plugins actions')) :
|
(self::$type == 'theme' ? __('Themes actions') : __('Plugins actions')) :
|
||||||
__('Configure module');
|
__('Configure module');
|
||||||
|
|
||||||
echo '<html><head><title>' . __('improve') . '</title>' .
|
echo '<html><head><title>' . __('improve') . '</title>' .
|
||||||
dcPage::jsLoad(dcPage::getPF('improve/js/index.js')) .
|
dcPage::jsModuleLoad(Core::id() . '/js/index.js') .
|
||||||
($this->action === null ? '' : $this->action->header()) .
|
(self::$action === null ? '' : self::$action->header()) .
|
||||||
'</head><body>' .
|
'</head><body>' .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
|
@ -224,64 +232,64 @@ class index
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (empty($_REQUEST['config'])) {
|
if (empty($_REQUEST['config'])) {
|
||||||
$this->displayActions();
|
self::displayActions();
|
||||||
} else {
|
} else {
|
||||||
$this->displayConfigurator();
|
self::displayConfigurator();
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</body></html>';
|
echo '</body></html>';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function displayConfigurator(): void
|
private static function displayConfigurator(): void
|
||||||
{
|
{
|
||||||
$back_url = $_REQUEST['redir'] ?? dcCore::app()->adminurl->get('admin.plugin.improve', ['type' => $this->type]);
|
$back_url = $_REQUEST['redir'] ?? dcCore::app()->adminurl->get('admin.plugin.' . Core::id(), ['type' => self::$type]);
|
||||||
|
|
||||||
if (null === $this->action) {
|
if (null === self::$action) {
|
||||||
echo '
|
echo '
|
||||||
<p class="warning">' . __('Unknow module') . '</p>
|
<p class="warning">' . __('Unknow module') . '</p>
|
||||||
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>';
|
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>';
|
||||||
} else {
|
} else {
|
||||||
$redir = $_REQUEST['redir'] ?? dcCore::app()->adminurl->get('admin.plugin.improve', ['type' => $this->type, 'config' => $this->action->id()]);
|
$redir = $_REQUEST['redir'] ?? dcCore::app()->adminurl->get('admin.plugin.' . Core::id(), ['type' => self::$type, 'config' => self::$action->id()]);
|
||||||
$res = $this->action->configure($redir);
|
$res = self::$action->configure($redir);
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<h3>' . sprintf(__('Configure module "%s"'), $this->action->name()) . '</h3>
|
<h3>' . sprintf(__('Configure module "%s"'), self::$action->name()) . '</h3>
|
||||||
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>
|
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>
|
||||||
<p class="info">' . html::escapeHTML($this->action->description()) . '</p>
|
<p class="info">' . html::escapeHTML(self::$action->description()) . '</p>
|
||||||
<form action="' . dcCore::app()->adminurl->get('admin.plugin.improve') . '" method="post" id="form-actions">' .
|
<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id()) . '" method="post" id="form-actions">' .
|
||||||
(empty($res) ? '<p class="message">' . __('Nothing to configure') . '</p>' : $res) . '
|
(empty($res) ? '<p class="message">' . __('Nothing to configure') . '</p>' : $res) . '
|
||||||
<p class="clear"><input type="submit" name="save" value="' . __('Save') . '" />' .
|
<p class="clear"><input type="submit" name="save" value="' . __('Save') . '" />' .
|
||||||
form::hidden('type', $this->type) .
|
form::hidden('type', self::$type) .
|
||||||
form::hidden('config', $this->action->id()) .
|
form::hidden('config', self::$action->id()) .
|
||||||
form::hidden('redir', $redir) .
|
form::hidden('redir', $redir) .
|
||||||
dcCore::app()->formNonce() . '</p>' .
|
dcCore::app()->formNonce() . '</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function displayActions(): void
|
private static function displayActions(): void
|
||||||
{
|
{
|
||||||
echo
|
echo
|
||||||
'<form method="get" action="' . dcCore::app()->adminurl->get('admin.plugin.improve') . '" id="improve_menu">' .
|
'<form method="get" action="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id()) . '" id="improve_menu">' .
|
||||||
'<p class="anchor-nav"><label for="type" class="classic">' . __('Goto:') . ' </label>' .
|
'<p class="anchor-nav"><label for="type" class="classic">' . __('Goto:') . ' </label>' .
|
||||||
form::combo('type', [__('Plugins') => 'plugin', __('Themes') => 'theme'], $this->type) . ' ' .
|
form::combo('type', [__('Plugins') => 'plugin', __('Themes') => 'theme'], self::$type) . ' ' .
|
||||||
'<input type="submit" value="' . __('Ok') . '" />' .
|
'<input type="submit" value="' . __('Ok') . '" />' .
|
||||||
form::hidden('p', 'improve') . '</p>' .
|
form::hidden('p', 'improve') . '</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
|
|
||||||
$combo_modules = $this->comboModules();
|
$combo_modules = self::comboModules();
|
||||||
if (count($combo_modules) == 1) {
|
if (count($combo_modules) == 1) {
|
||||||
echo '<p class="message">' . __('No module to manage') . '</p>';
|
echo '<p class="message">' . __('No module to manage') . '</p>';
|
||||||
} else {
|
} else {
|
||||||
echo '<form action="' . dcCore::app()->adminurl->get('admin.plugin.improve') . '" method="post" id="form-actions">' .
|
echo '<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id()) . '" method="post" id="form-actions">' .
|
||||||
'<table><caption class="hidden">' . __('Actions') . '</caption><thead><tr>' .
|
'<table><caption class="hidden">' . __('Actions') . '</caption><thead><tr>' .
|
||||||
'<th colspan="2" class="first">' . __('Action') . '</td>' .
|
'<th colspan="2" class="first">' . __('Action') . '</td>' .
|
||||||
'<th scope="col">' . __('Description') . '</td>' .
|
'<th scope="col">' . __('Description') . '</td>' .
|
||||||
'<th scope="col">' . __('Configuration') . '</td>' .
|
'<th scope="col">' . __('Configuration') . '</td>' .
|
||||||
(DC_DEBUG ? '<th scope="col">' . __('Priority') . '</td>' : '') . /* @phpstan-ignore-line */
|
(DC_DEBUG ? '<th scope="col">' . __('Priority') . '</td>' : '') . /* @phpstan-ignore-line */
|
||||||
'</tr></thead><tbody>';
|
'</tr></thead><tbody>';
|
||||||
foreach ($this->improve->modules() as $action) {
|
foreach (self::$improve->modules() as $action) {
|
||||||
if (!in_array($this->type, $action->types())) {
|
if (!in_array(self::$type, $action->types())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
|
@ -290,7 +298,7 @@ class index
|
||||||
['actions[]',
|
['actions[]',
|
||||||
'action_' . $action->id(), ],
|
'action_' . $action->id(), ],
|
||||||
$action->id(),
|
$action->id(),
|
||||||
in_array($action->id(), $this->getPreference()) && $action->isConfigured(),
|
in_array($action->id(), self::getPreference()) && $action->isConfigured(),
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
!$action->isConfigured()
|
!$action->isConfigured()
|
||||||
|
@ -301,7 +309,7 @@ class index
|
||||||
'<td class="maximal">' . $action->description() . '</td>' .
|
'<td class="maximal">' . $action->description() . '</td>' .
|
||||||
'<td class="minimal nowrap modules">' . (
|
'<td class="minimal nowrap modules">' . (
|
||||||
false === $action->configurator() ? '' :
|
false === $action->configurator() ? '' :
|
||||||
'<a class="module-config" href="' . dcCore::app()->adminurl->get('admin.plugin.improve', ['type' => $this->type, 'config' => $action->id()]) .
|
'<a class="module-config" href="' . dcCore::app()->adminurl->get('admin.plugin.' . Core::id(), ['type' => self::$type, 'config' => $action->id()]) .
|
||||||
'" title="' . sprintf(__("Configure action '%s'"), $action->name()) . '">' . __('Configure') . '</a>'
|
'" title="' . sprintf(__("Configure action '%s'"), $action->name()) . '">' . __('Configure') . '</a>'
|
||||||
) . '</td>' .
|
) . '</td>' .
|
||||||
(DC_DEBUG ? '<td class="minimal"><span class="debug">' . $action->priority() . '</span></td>' : '') . /* @phpstan-ignore-line */
|
(DC_DEBUG ? '<td class="minimal"><span class="debug">' . $action->priority() . '</span></td>' : '') . /* @phpstan-ignore-line */
|
||||||
|
@ -314,17 +322,17 @@ class index
|
||||||
form::checkbox('save_preferences', 1, !empty($_POST['save_preferences'])) .
|
form::checkbox('save_preferences', 1, !empty($_POST['save_preferences'])) .
|
||||||
__('Save fields selection as preference') . '</label></p>
|
__('Save fields selection as preference') . '</label></p>
|
||||||
<p class="col right"><label for="module" class="classic">' . __('Select a module:') . ' </label>' .
|
<p class="col right"><label for="module" class="classic">' . __('Select a module:') . ' </label>' .
|
||||||
form::combo('module', $combo_modules, $this->module) .
|
form::combo('module', $combo_modules, self::$module) .
|
||||||
' <input type="submit" name="fix" value="' . __('Fix it') . '" />' .
|
' <input type="submit" name="fix" value="' . __('Fix it') . '" />' .
|
||||||
form::hidden(['type'], $this->type) .
|
form::hidden(['type'], self::$type) .
|
||||||
dcCore::app()->formNonce() . '
|
dcCore::app()->formNonce() . '
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<br class="clear" />
|
<br class="clear" />
|
||||||
</form>';
|
</form>';
|
||||||
|
|
||||||
if (!empty($_REQUEST['upd']) && !dcCore::app()->blog->settings->improve->nodetails) {
|
if (!empty($_REQUEST['upd']) && !dcCore::app()->blog->settings->get(Core::id())->get('nodetails')) {
|
||||||
$logs = $this->improve->parseLogs((int) $_REQUEST['upd']);
|
$logs = self::$improve->parseLogs((int) $_REQUEST['upd']);
|
||||||
|
|
||||||
if (!empty($logs)) {
|
if (!empty($logs)) {
|
||||||
echo '<div class="fieldset"><h4>' . __('Details') . '</h4>';
|
echo '<div class="fieldset"><h4>' . __('Details') . '</h4>';
|
||||||
|
@ -333,7 +341,7 @@ class index
|
||||||
foreach ($types as $type => $tools) {
|
foreach ($types as $type => $tools) {
|
||||||
echo '<div class="' . $type . '"><ul>';
|
echo '<div class="' . $type . '"><ul>';
|
||||||
foreach ($tools as $tool => $msgs) {
|
foreach ($tools as $tool => $msgs) {
|
||||||
$a = $this->improve->module($tool);
|
$a = self::$improve->module($tool);
|
||||||
if (null !== $a) {
|
if (null !== $a) {
|
||||||
echo '<li>' . $a->name() . '<ul>';
|
echo '<li>' . $a->name() . '<ul>';
|
||||||
foreach ($msgs as $msg) {
|
foreach ($msgs as $msg) {
|
||||||
|
@ -352,6 +360,3 @@ class index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process */
|
|
||||||
new index();
|
|
||||||
|
|
|
@ -12,14 +12,10 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
use Clearbricks;
|
use Clearbricks;
|
||||||
|
|
||||||
if (!defined('DC_RC_PATH') || !defined('DC_CONTEXT_ADMIN')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve prepend class
|
* Improve prepend class
|
||||||
*
|
*
|
||||||
|
@ -27,23 +23,39 @@ if (!defined('DC_RC_PATH') || !defined('DC_CONTEXT_ADMIN')) {
|
||||||
*/
|
*/
|
||||||
class prepend
|
class prepend
|
||||||
{
|
{
|
||||||
public static function process(): void
|
private static $init = false;
|
||||||
|
|
||||||
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
foreach (['improve', 'action', 'module'] as $class) {
|
self::$init = defined('DC_RC_PATH') && defined('DC_CONTEXT_ADMIN');
|
||||||
Clearbricks::lib()->autoload(['plugins\\improve\\' . $class => __DIR__ . '/inc/core/' . $class . '.php']);
|
|
||||||
|
return self::$init;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function process()
|
||||||
|
{
|
||||||
|
if (!self::$init) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Core plugin class
|
||||||
|
foreach (['Core', 'Action', 'Module'] as $class) {
|
||||||
|
Clearbricks::lib()->autoload(['Dotclear\\Plugin\\improve\\' . $class => implode(DIRECTORY_SEPARATOR, [__DIR__, 'core', $class . '.php'])]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dotclear plugin class
|
||||||
|
foreach (['Admin', 'Config', 'Install', 'Manage', 'Prepend', 'Uninstall'] as $class) {
|
||||||
|
Clearbricks::lib()->autoload(['Dotclear\\Plugin\\improve\\' . $class => implode(DIRECTORY_SEPARATOR, [__DIR__, $class . '.php'])]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getActionsDir(): string
|
public static function getActionsDir(): string
|
||||||
{
|
{
|
||||||
return __DIR__ . '/inc/module/';
|
return __DIR__ . '/module/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getActionsNS(): string
|
public static function getActionsNS(): string
|
||||||
{
|
{
|
||||||
return 'plugins\\improve\\module\\';
|
return 'Dotclear\\Plugin\\improve\\Module\\';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process */
|
|
||||||
prepend::process();
|
|
||||||
|
|
|
@ -10,74 +10,91 @@
|
||||||
* @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_CONTEXT_ADMIN')) {
|
declare(strict_types=1);
|
||||||
return null;
|
|
||||||
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
|
class Uninstall
|
||||||
|
{
|
||||||
|
private static $init = false;
|
||||||
|
|
||||||
|
public static function init(): bool
|
||||||
|
{
|
||||||
|
self::$init = defined('DC_RC_PATH');
|
||||||
|
|
||||||
|
return self::$init;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mod_id = 'improve';
|
public static function process($uninstaller)
|
||||||
|
{
|
||||||
|
if (!self::$init) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->addUserAction(
|
$uninstaller->addUserAction(
|
||||||
/* type */
|
/* type */
|
||||||
'settings',
|
'settings',
|
||||||
/* action */
|
/* action */
|
||||||
'delete_all',
|
'delete_all',
|
||||||
/* ns */
|
/* ns */
|
||||||
$mod_id,
|
Core::id(),
|
||||||
/* desc */
|
/* desc */
|
||||||
__('delete all settings')
|
__('delete all settings')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$uninstaller->addUserAction(
|
||||||
/* type */
|
/* type */
|
||||||
'plugins',
|
'plugins',
|
||||||
/* action */
|
/* action */
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
/* ns */
|
||||||
$mod_id,
|
Core::id(),
|
||||||
/* desc */
|
/* desc */
|
||||||
__('delete plugin files')
|
__('delete plugin files')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addUserAction(
|
$uninstaller->addUserAction(
|
||||||
/* type */
|
/* type */
|
||||||
'versions',
|
'versions',
|
||||||
/* action */
|
/* action */
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
/* ns */
|
||||||
$mod_id,
|
Core::id(),
|
||||||
/* desc */
|
/* desc */
|
||||||
__('delete the version number')
|
__('delete the version number')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$uninstaller->addDirectAction(
|
||||||
/* type */
|
/* type */
|
||||||
'settings',
|
'settings',
|
||||||
/* action */
|
/* action */
|
||||||
'delete_all',
|
'delete_all',
|
||||||
/* ns */
|
/* ns */
|
||||||
$mod_id,
|
Core::id(),
|
||||||
/* desc */
|
/* desc */
|
||||||
sprintf(__('delete all %s settings'), $mod_id)
|
sprintf(__('delete all %s settings'), Core::id())
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$uninstaller->addDirectAction(
|
||||||
/* type */
|
/* type */
|
||||||
'plugins',
|
'plugins',
|
||||||
/* action */
|
/* action */
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
/* ns */
|
||||||
$mod_id,
|
Core::id(),
|
||||||
/* desc */
|
/* desc */
|
||||||
sprintf(__('delete %s plugin files'), $mod_id)
|
sprintf(__('delete %s plugin files'), Core::id())
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addDirectAction(
|
$uninstaller->addDirectAction(
|
||||||
/* type */
|
/* type */
|
||||||
'versions',
|
'versions',
|
||||||
/* action */
|
/* action */
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
/* ns */
|
||||||
$mod_id,
|
Core::id(),
|
||||||
/* desc */
|
/* desc */
|
||||||
sprintf(__('delete %s version number'), $mod_id)
|
sprintf(__('delete %s version number'), Core::id())
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
@ -22,7 +22,7 @@ use dcPage;
|
||||||
use http;
|
use http;
|
||||||
|
|
||||||
/* php */
|
/* php */
|
||||||
use arrayObject;
|
use ArrayObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve action class helper
|
* Improve action class helper
|
||||||
|
@ -34,7 +34,7 @@ use arrayObject;
|
||||||
* then function init() of your class wil be called.
|
* then function init() of your class wil be called.
|
||||||
* One class must manage only one action.
|
* One class must manage only one action.
|
||||||
*/
|
*/
|
||||||
abstract class action
|
abstract class Action
|
||||||
{
|
{
|
||||||
/** @var array<string> Current module */
|
/** @var array<string> Current module */
|
||||||
protected $module = [];
|
protected $module = [];
|
||||||
|
@ -83,9 +83,9 @@ abstract class action
|
||||||
*/
|
*/
|
||||||
final public function __construct()
|
final public function __construct()
|
||||||
{
|
{
|
||||||
$this->class_name = str_replace(prepend::getActionsNS(), '', get_called_class());
|
$this->class_name = str_replace(Prepend::getActionsNS(), '', get_called_class());
|
||||||
|
|
||||||
$settings = dcCore::app()->blog->settings->improve->get('settings_' . $this->class_name);
|
$settings = dcCore::app()->blog->settings->get(Core::id())->get('settings_' . $this->class_name);
|
||||||
if (null != $settings) {
|
if (null != $settings) {
|
||||||
$settings = unserialize($settings);
|
$settings = unserialize($settings);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ abstract class action
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
||||||
// can overload priority by settings
|
// can overload priority by settings
|
||||||
if (1 < ($p = (int) dcCore::app()->blog->settings->improve->get('priority_' . $this->class_name))) {
|
if (1 < ($p = (int) dcCore::app()->blog->settings->get(Core::id())->get('priority_' . $this->class_name))) {
|
||||||
$this->priority = $p;
|
$this->priority = $p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ abstract class action
|
||||||
*
|
*
|
||||||
* @param ArrayObject $list ArrayObject of actions list
|
* @param ArrayObject $list ArrayObject of actions list
|
||||||
*/
|
*/
|
||||||
final public static function create(arrayObject $list): void
|
final public static function create(ArrayObject $list): void
|
||||||
{
|
{
|
||||||
$child = static::class;
|
$child = static::class;
|
||||||
$class = new $child();
|
$class = new $child();
|
||||||
|
@ -235,7 +235,7 @@ abstract class action
|
||||||
*/
|
*/
|
||||||
final protected function redirect(string $url): bool
|
final protected function redirect(string $url): bool
|
||||||
{
|
{
|
||||||
dcCore::app()->blog->settings->improve->put(
|
dcCore::app()->blog->settings->get(Core::id())->put(
|
||||||
'settings_' . $this->class_name,
|
'settings_' . $this->class_name,
|
||||||
serialize($this->settings),
|
serialize($this->settings),
|
||||||
'string',
|
'string',
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
@ -29,7 +29,7 @@ use Exception;
|
||||||
/**
|
/**
|
||||||
* Improve main class
|
* Improve main class
|
||||||
*/
|
*/
|
||||||
class improve
|
class Core
|
||||||
{
|
{
|
||||||
/** @var array Allowed file extensions to open */
|
/** @var array Allowed file extensions to open */
|
||||||
private static $readfile_extensions = [
|
private static $readfile_extensions = [
|
||||||
|
@ -53,7 +53,7 @@ class improve
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$disabled = explode(';', (string) dcCore::app()->blog->settings->improve->disabled);
|
$disabled = explode(';', (string) dcCore::app()->blog->settings->get(self::id())->get('disabled'));
|
||||||
$list = new ArrayObject();
|
$list = new ArrayObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -74,6 +74,11 @@ class improve
|
||||||
uasort($this->actions, [$this, 'sortModules']);
|
uasort($this->actions, [$this, 'sortModules']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function id()
|
||||||
|
{
|
||||||
|
return basename(dirname(dirname(__DIR__)));
|
||||||
|
}
|
||||||
|
|
||||||
public function getLogs(): array
|
public function getLogs(): array
|
||||||
{
|
{
|
||||||
return $this->logs;
|
return $this->logs;
|
||||||
|
@ -183,7 +188,7 @@ class improve
|
||||||
public function fixModule(string $type, string $id, array $properties, array $actions): float
|
public function fixModule(string $type, string $id, array $properties, array $actions): float
|
||||||
{
|
{
|
||||||
$time_start = microtime(true);
|
$time_start = microtime(true);
|
||||||
$module = module::clean($type, $id, $properties);
|
$module = Module::clean($type, $id, $properties);
|
||||||
|
|
||||||
$workers = [];
|
$workers = [];
|
||||||
foreach ($actions as $action) {
|
foreach ($actions as $action) {
|
||||||
|
@ -303,7 +308,7 @@ class improve
|
||||||
|
|
||||||
public function getURL(array $params = []): string
|
public function getURL(array $params = []): string
|
||||||
{
|
{
|
||||||
return dcCore::app()->adminurl->get('admin.plugin.improve', $params, '&');
|
return dcCore::app()->adminurl->get('admin.plugin.' . self::id(), $params, '&');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use path;
|
use path;
|
||||||
|
@ -23,7 +23,7 @@ use path;
|
||||||
* Help to load module configuration file (_define.php)
|
* Help to load module configuration file (_define.php)
|
||||||
* and gather information about it.
|
* and gather information about it.
|
||||||
*/
|
*/
|
||||||
class module
|
class Module
|
||||||
{
|
{
|
||||||
/** @var array Current module properties */
|
/** @var array Current module properties */
|
||||||
private $properties = [];
|
private $properties = [];
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use files;
|
use files;
|
||||||
|
@ -24,7 +24,7 @@ use path;
|
||||||
/**
|
/**
|
||||||
* Improve action module Dotclear depreciated
|
* Improve action module Dotclear depreciated
|
||||||
*/
|
*/
|
||||||
class dcdeprecated extends action
|
class dcdeprecated extends Action
|
||||||
{
|
{
|
||||||
/** @var array Deprecated functions [filetype [pattern, deprecated, replacement, version, help link]] */
|
/** @var array Deprecated functions [filetype [pattern, deprecated, replacement, version, help link]] */
|
||||||
private $deprecated = ['php' => [], 'js' => []];
|
private $deprecated = ['php' => [], 'js' => []];
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use form;
|
use form;
|
||||||
|
@ -30,7 +30,7 @@ use Exception;
|
||||||
/**
|
/**
|
||||||
* Improve action module dcstore.xml
|
* Improve action module dcstore.xml
|
||||||
*/
|
*/
|
||||||
class dcstore extends action
|
class dcstore extends Action
|
||||||
{
|
{
|
||||||
/** @var string Settings dcstore zip url pattern */
|
/** @var string Settings dcstore zip url pattern */
|
||||||
private $pattern = '';
|
private $pattern = '';
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use form;
|
use form;
|
||||||
|
@ -23,7 +23,7 @@ use form;
|
||||||
/**
|
/**
|
||||||
* Improve action module end of file
|
* Improve action module end of file
|
||||||
*/
|
*/
|
||||||
class endoffile extends action
|
class endoffile extends Action
|
||||||
{
|
{
|
||||||
protected function init(): bool
|
protected function init(): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use form;
|
use form;
|
||||||
|
@ -26,7 +26,7 @@ use form;
|
||||||
/**
|
/**
|
||||||
* Improve action module Github shields.io
|
* Improve action module Github shields.io
|
||||||
*/
|
*/
|
||||||
class gitshields extends action
|
class gitshields extends Action
|
||||||
{
|
{
|
||||||
/** @var string Username of git repo */
|
/** @var string Username of git repo */
|
||||||
private $username = '';
|
private $username = '';
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use form;
|
use form;
|
||||||
|
@ -27,7 +27,7 @@ use Exception;
|
||||||
/**
|
/**
|
||||||
* Improve action module license file
|
* Improve action module license file
|
||||||
*/
|
*/
|
||||||
class licensefile extends action
|
class licensefile extends Action
|
||||||
{
|
{
|
||||||
/** @var array Possible license filenames */
|
/** @var array Possible license filenames */
|
||||||
protected static $license_filenames = [
|
protected static $license_filenames = [
|
||||||
|
@ -115,7 +115,7 @@ class licensefile extends action
|
||||||
private function writeFullLicense(): ?bool
|
private function writeFullLicense(): ?bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$full = file_get_contents(dirname(__FILE__) . '/licensefile/' . $this->getSetting('action_version') . '.full.txt');
|
$full = file_get_contents(__DIR__ . '/licensefile/' . $this->getSetting('action_version') . '.full.txt');
|
||||||
if (empty($full)) {
|
if (empty($full)) {
|
||||||
$this->setError(__('Failed to load license content'));
|
$this->setError(__('Failed to load license content'));
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
use plugins\improve\improve;
|
use Dotclear\Plugin\improve\Core;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use form;
|
use form;
|
||||||
|
@ -24,7 +24,7 @@ use form;
|
||||||
/**
|
/**
|
||||||
* Improve action module new line
|
* Improve action module new line
|
||||||
*/
|
*/
|
||||||
class newline extends action
|
class newline extends Action
|
||||||
{
|
{
|
||||||
protected function init(): bool
|
protected function init(): bool
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ class newline extends action
|
||||||
if (!empty($_POST['save']) && !empty($_POST['newline_extensions'])) {
|
if (!empty($_POST['save']) && !empty($_POST['newline_extensions'])) {
|
||||||
$this->setSettings(
|
$this->setSettings(
|
||||||
'extensions',
|
'extensions',
|
||||||
improve::cleanExtensions($_POST['newline_extensions'])
|
Core::cleanExtensions($_POST['newline_extensions'])
|
||||||
);
|
);
|
||||||
$this->redirect($url);
|
$this->redirect($url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,11 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
use Dotclear\Plugin\improve\Core;
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
@ -32,7 +33,7 @@ use Exception;
|
||||||
/**
|
/**
|
||||||
* Improve action module PHP CS Fixer
|
* Improve action module PHP CS Fixer
|
||||||
*/
|
*/
|
||||||
class phpcsfixer extends action
|
class phpcsfixer extends Action
|
||||||
{
|
{
|
||||||
/** @var array<int,string> Type of runtime errors */
|
/** @var array<int,string> Type of runtime errors */
|
||||||
protected static $errors = [
|
protected static $errors = [
|
||||||
|
@ -68,8 +69,8 @@ class phpcsfixer extends action
|
||||||
$this->getPhpPath();
|
$this->getPhpPath();
|
||||||
|
|
||||||
dcCore::app()->auth->user_prefs->addWorkspace('interface');
|
dcCore::app()->auth->user_prefs->addWorkspace('interface');
|
||||||
self::$user_ui_colorsyntax = dcCore::app()->auth->user_prefs->interface->colorsyntax;
|
self::$user_ui_colorsyntax = dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax');
|
||||||
self::$user_ui_colorsyntax_theme = dcCore::app()->auth->user_prefs->interface->colorsyntax_theme;
|
self::$user_ui_colorsyntax_theme = dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +97,7 @@ class phpcsfixer extends action
|
||||||
]);
|
]);
|
||||||
$this->redirect($url);
|
$this->redirect($url);
|
||||||
}
|
}
|
||||||
$content = (string) file_get_contents(dirname(__FILE__) . '/phpcsfixer/phpcsfixer.rules.php');
|
$content = (string) file_get_contents(__DIR__ . '/phpcsfixer/phpcsfixer.rules.php');
|
||||||
|
|
||||||
return
|
return
|
||||||
'<p><label class="classic" for="phpexe_path">' .
|
'<p><label class="classic" for="phpexe_path">' .
|
||||||
|
@ -115,7 +116,7 @@ class phpcsfixer extends action
|
||||||
]) . '</p>' .
|
]) . '</p>' .
|
||||||
(
|
(
|
||||||
!self::$user_ui_colorsyntax ? '' :
|
!self::$user_ui_colorsyntax ? '' :
|
||||||
dcPage::jsLoad(dcPage::getPF('improve/inc/module/phpcsfixer/phpcsfixer.improve.js')) .
|
dcPage::jsModuleLoad(Core::id() . '/inc/module/phpcsfixer/phpcsfixer.improve.js') .
|
||||||
dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', self::$user_ui_colorsyntax_theme)
|
dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', self::$user_ui_colorsyntax_theme)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -125,9 +126,9 @@ class phpcsfixer extends action
|
||||||
$command = sprintf(
|
$command = sprintf(
|
||||||
'%sphp %s/phpcsfixer/libs/php-cs-fixer.phar fix %s --config=%s/phpcsfixer/phpcsfixer.rules.php --using-cache=no',
|
'%sphp %s/phpcsfixer/libs/php-cs-fixer.phar fix %s --config=%s/phpcsfixer/phpcsfixer.rules.php --using-cache=no',
|
||||||
$this->phpexe_path,
|
$this->phpexe_path,
|
||||||
dirname(__FILE__),
|
__DIR__,
|
||||||
$this->module['sroot'],
|
$this->module['sroot'],
|
||||||
dirname(__FILE__)
|
__DIR__
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use form;
|
use form;
|
||||||
|
@ -30,7 +30,7 @@ use Exception;
|
||||||
/**
|
/**
|
||||||
* Improve action module php header
|
* Improve action module php header
|
||||||
*/
|
*/
|
||||||
class phpheader extends action
|
class phpheader extends Action
|
||||||
{
|
{
|
||||||
/** @var string Exemple of header */
|
/** @var string Exemple of header */
|
||||||
private static $exemple = <<<EOF
|
private static $exemple = <<<EOF
|
||||||
|
|
|
@ -12,10 +12,11 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
use Dotclear\Plugin\improve\Core;
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
@ -32,7 +33,7 @@ use Exception;
|
||||||
/**
|
/**
|
||||||
* Improve action module PHPStan
|
* Improve action module PHPStan
|
||||||
*/
|
*/
|
||||||
class phpstan extends action
|
class phpstan extends Action
|
||||||
{
|
{
|
||||||
/** @var boolean User pref to use colored synthax */
|
/** @var boolean User pref to use colored synthax */
|
||||||
protected static $user_ui_colorsyntax = false;
|
protected static $user_ui_colorsyntax = false;
|
||||||
|
@ -69,8 +70,8 @@ class phpstan extends action
|
||||||
$this->ignored_vars = is_string($ignored_vars) ? $ignored_vars : '';
|
$this->ignored_vars = is_string($ignored_vars) ? $ignored_vars : '';
|
||||||
|
|
||||||
dcCore::app()->auth->user_prefs->addWorkspace('interface');
|
dcCore::app()->auth->user_prefs->addWorkspace('interface');
|
||||||
self::$user_ui_colorsyntax = dcCore::app()->auth->user_prefs->interface->colorsyntax;
|
self::$user_ui_colorsyntax = dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax');
|
||||||
self::$user_ui_colorsyntax_theme = dcCore::app()->auth->user_prefs->interface->colorsyntax_theme;
|
self::$user_ui_colorsyntax_theme = dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +101,7 @@ class phpstan extends action
|
||||||
]);
|
]);
|
||||||
$this->redirect($url);
|
$this->redirect($url);
|
||||||
}
|
}
|
||||||
$content = (string) file_get_contents(dirname(__FILE__) . '/phpstan/phpstan.rules.conf');
|
$content = (string) file_get_contents(__DIR__ . '/phpstan/phpstan.rules.conf');
|
||||||
|
|
||||||
return
|
return
|
||||||
'<p class="info">' . __('You must enable improve details to view analyse results !') . '</p>' .
|
'<p class="info">' . __('You must enable improve details to view analyse results !') . '</p>' .
|
||||||
|
@ -134,7 +135,7 @@ class phpstan extends action
|
||||||
]) . '</p>' .
|
]) . '</p>' .
|
||||||
(
|
(
|
||||||
!self::$user_ui_colorsyntax ? '' :
|
!self::$user_ui_colorsyntax ? '' :
|
||||||
dcPage::jsLoad(dcPage::getPF('improved/inc/module/phpstan/phpstan.improve.js')) .
|
dcPage::jsModuleLoad(Core::id() . '/inc/module/phpstan/phpstan.improve.js') .
|
||||||
dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', self::$user_ui_colorsyntax_theme)
|
dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', self::$user_ui_colorsyntax_theme)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +183,7 @@ class phpstan extends action
|
||||||
$command = sprintf(
|
$command = sprintf(
|
||||||
'%sphp %s/phpstan/libs/phpstan.phar analyse ' . $path . '--configuration=%s',
|
'%sphp %s/phpstan/libs/phpstan.phar analyse ' . $path . '--configuration=%s',
|
||||||
$this->phpexe_path,
|
$this->phpexe_path,
|
||||||
dirname(__FILE__),
|
__DIR__,
|
||||||
DC_VAR . '/phpstan.neon'
|
DC_VAR . '/phpstan.neon'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -238,9 +239,9 @@ class phpstan extends action
|
||||||
$this->run_level,
|
$this->run_level,
|
||||||
$this->module['sroot'],
|
$this->module['sroot'],
|
||||||
DC_ROOT,
|
DC_ROOT,
|
||||||
dirname(__FILE__) . '/phpstan',
|
__DIR__ . '/phpstan',
|
||||||
],
|
],
|
||||||
(string) file_get_contents(dirname(__FILE__) . '/phpstan/phpstan.rules.conf')
|
(string) file_get_contents(__DIR__ . '/phpstan/phpstan.rules.conf')
|
||||||
);
|
);
|
||||||
|
|
||||||
$ignored = explode(';', $this->ignored_vars);
|
$ignored = explode(';', $this->ignored_vars);
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use l10n;
|
use l10n;
|
||||||
|
@ -25,7 +25,7 @@ use l10n;
|
||||||
/**
|
/**
|
||||||
* Improve action module dcstore.xml
|
* Improve action module dcstore.xml
|
||||||
*/
|
*/
|
||||||
class po2php extends action
|
class po2php extends Action
|
||||||
{
|
{
|
||||||
/** @var string License bloc */
|
/** @var string License bloc */
|
||||||
private $license = <<<EOF
|
private $license = <<<EOF
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Improve action module tab
|
* Improve action module tab
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace plugins\improve\module;
|
namespace Dotclear\Plugin\improve\Module;
|
||||||
|
|
||||||
/* dotclear */
|
/* dotclear */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
|
||||||
/* improve */
|
/* improve */
|
||||||
use plugins\improve\action;
|
use Dotclear\Plugin\improve\Action;
|
||||||
|
|
||||||
/* clearbricks */
|
/* clearbricks */
|
||||||
use form;
|
use form;
|
||||||
|
|
Loading…
Reference in New Issue