release 2023.07.29
This commit is contained in:
parent
cb56a4715b
commit
1d3eca3a9c
12 changed files with 86 additions and 122 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2023.07.29
|
||||||
|
- require Dotclear 2.27
|
||||||
|
- require php 8.1+
|
||||||
|
- update to Dotclear 2.27-dev
|
||||||
|
|
||||||
2023.05.29
|
2023.05.29
|
||||||
- require dotclear 2.26
|
- require dotclear 2.26
|
||||||
- require php 8.1+
|
- require php 8.1+
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[![Release](https://img.shields.io/github/v/release/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/releases)
|
[![Release](https://img.shields.io/github/v/release/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/releases)
|
||||||
[![Date](https://img.shields.io/github/release-date/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/releases)
|
[![Date](https://img.shields.io/github/release-date/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/releases)
|
||||||
[![Issues](https://img.shields.io/github/issues/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/issues)
|
[![Issues](https://img.shields.io/github/issues/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/issues)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/pacKman)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/pacKman)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/blob/master/LICENSE)
|
[![License](https://img.shields.io/github/license/JcDenis/pacKman)](https://github.com/JcDenis/pacKman/blob/master/LICENSE)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ themes and plugins from Dotclear administration pages.
|
||||||
pacKman requires:
|
pacKman requires:
|
||||||
|
|
||||||
* Super administrator permissions
|
* Super administrator permissions
|
||||||
* Dotclear 2.26
|
* Dotclear 2.27
|
||||||
* PHP 8.1+
|
* PHP 8.1+
|
||||||
* A writable cache directory
|
* A writable cache directory
|
||||||
* A writable directory to put packages. (can be VAR dir)
|
* A writable directory to put packages. (can be VAR dir)
|
||||||
|
|
|
@ -20,11 +20,11 @@ $this->registerModule(
|
||||||
'Packages repository',
|
'Packages repository',
|
||||||
'Manage your Dotclear packages',
|
'Manage your Dotclear packages',
|
||||||
'Jean-Christian Denis',
|
'Jean-Christian Denis',
|
||||||
'2023.05.29',
|
'2023.07.29',
|
||||||
[
|
[
|
||||||
'requires' => [
|
'requires' => [
|
||||||
['php', '8.1'],
|
['php', '8.1'],
|
||||||
['core', '2.26'],
|
['core', '2.27'],
|
||||||
],
|
],
|
||||||
'permissions' => null,
|
'permissions' => null,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="pacKman">
|
<module id="pacKman">
|
||||||
<name>Packages repository</name>
|
<name>Packages repository</name>
|
||||||
<version>2023.05.29</version>
|
<version>2023.07.29</version>
|
||||||
<author>Jean-Christian Denis</author>
|
<author>Jean-Christian Denis</author>
|
||||||
<desc>Manage your Dotclear packages</desc>
|
<desc>Manage your Dotclear packages</desc>
|
||||||
<file>https://github.com/JcDenis/pacKman/releases/download/v2023.05.29/plugin-pacKman.zip</file>
|
<file>https://github.com/JcDenis/pacKman/releases/download/v2023.07.29/plugin-pacKman.zip</file>
|
||||||
<da:dcmin>2.26</da:dcmin>
|
<da:dcmin>2.27</da:dcmin>
|
||||||
<da:details>https://plugins.dotaddict.org/dc2/details/pacKman</da:details>
|
<da:details>https://plugins.dotaddict.org/dc2/details/pacKman</da:details>
|
||||||
<da:support>https://github.com/JcDenis/pacKman</da:support>
|
<da:support>https://github.com/JcDenis/pacKman</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -14,46 +14,35 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcAdmin;
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcFavorites;
|
use Dotclear\Core\Process;
|
||||||
use dcPage;
|
use Dotclear\Core\Backend\Favorites;
|
||||||
use dcNsProcess;
|
|
||||||
|
|
||||||
class Backend extends dcNsProcess
|
class Backend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init == defined('DC_CONTEXT_ADMIN')
|
return self::status(My::checkContext(My::BACKEND));
|
||||||
&& dcCore::app()->auth?->isSuperAdmin();
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $favs): void {
|
My::addBackendMenuItem();
|
||||||
|
|
||||||
|
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (Favorites $favs): void {
|
||||||
$favs->register(My::id(), [
|
$favs->register(My::id(), [
|
||||||
'title' => My::name(),
|
'title' => My::name(),
|
||||||
'url' => dcCore::app()->adminurl?->get('admin.plugin.' . My::id(), [], '#packman-repository-repository'),
|
'url' => My::manageUrl(),
|
||||||
'small-icon' => [dcPage::getPF(My::id() . '/icon.svg'), dcPage::getPF(My::id() . '/icon-dark.svg')],
|
'small-icon' => My::icons(),
|
||||||
'large-icon' => [dcPage::getPF(My::id() . '/icon.svg'), dcPage::getPF(My::id() . '/icon-dark.svg')],
|
'large-icon' => My::icons(),
|
||||||
//'permissions' => dcCore::app()->auth->isSuperAdmin(),
|
//'permissions' => dcCore::app()->auth->isSuperAdmin(),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
|
||||||
My::name(),
|
|
||||||
dcCore::app()->adminurl?->get('admin.plugin.' . My::id()) . '#packman-repository-repository',
|
|
||||||
[dcPage::getPF(My::id() . '/icon.svg'), dcPage::getPF(My::id() . '/icon-dark.svg')],
|
|
||||||
preg_match('/' . preg_quote((string) dcCore::app()->adminurl?->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
|
||||||
dcCore::app()->auth?->isSuperAdmin()
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcPage;
|
use Dotclear\Core\Process;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Backend\Notices;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Div,
|
Div,
|
||||||
|
@ -30,19 +30,16 @@ use Dotclear\Helper\Html\Form\{
|
||||||
};
|
};
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Config extends dcNsProcess
|
class Config extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init == defined('DC_CONTEXT_ADMIN')
|
return self::status(My::checkContext(My::CONFIG));
|
||||||
&& dcCore::app()->auth?->isSuperAdmin();
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,10 +59,10 @@ class Config extends dcNsProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Configuration has been successfully updated.')
|
__('Configuration has been successfully updated.')
|
||||||
);
|
);
|
||||||
dcCore::app()->adminurl?->redirect('admin.plugins', [
|
dcCore::app()->admin->url->redirect('admin.plugins', [
|
||||||
'module' => My::id(),
|
'module' => My::id(),
|
||||||
'conf' => '1',
|
'conf' => '1',
|
||||||
'redir' => dcCore::app()->admin->__get('list')->getRedir(),
|
'redir' => dcCore::app()->admin->__get('list')->getRedir(),
|
||||||
|
@ -79,7 +76,7 @@ class Config extends dcNsProcess
|
||||||
|
|
||||||
public static function render(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,22 +16,19 @@ namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNamespace;
|
use dcNamespace;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Process;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Install extends dcNsProcess
|
class Install extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
return self::status(My::checkContext(My::INSTALL));
|
||||||
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,12 @@ namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
/* dotclear ns */
|
/* dotclear ns */
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcPage;
|
|
||||||
use dcThemes;
|
use dcThemes;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Process;
|
||||||
|
use Dotclear\Core\Backend\{
|
||||||
|
Notices,
|
||||||
|
Page
|
||||||
|
};
|
||||||
use Dotclear\Helper\File\Files;
|
use Dotclear\Helper\File\Files;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Div,
|
Div,
|
||||||
|
@ -27,19 +30,16 @@ use Dotclear\Helper\Html\Form\{
|
||||||
use Dotclear\Helper\Network\Http;
|
use Dotclear\Helper\Network\Http;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Manage extends dcNsProcess
|
class Manage extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
return self::status(My::checkContext(My::MANAGE));
|
||||||
&& dcCore::app()->auth?->isSuperAdmin();
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,14 +104,14 @@ class Manage extends dcNsProcess
|
||||||
Http::head(404, 'Not Found');
|
Http::head(404, 'Not Found');
|
||||||
exit;
|
exit;
|
||||||
} elseif (!empty($action) && !$is_editable) {
|
} elseif (!empty($action) && !$is_editable) {
|
||||||
dcPage::addErrorNotice(
|
Notices::addErrorNotice(
|
||||||
__('No modules selected.')
|
__('No modules selected.')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
Http::redirect($_POST['redir']);
|
Http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-' . $type);
|
My::redirect([], '#packman-' . $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Pack
|
# Pack
|
||||||
|
@ -140,14 +140,14 @@ class Manage extends dcNsProcess
|
||||||
dcCore::app()->callBehavior('packmanAfterCreatePackage', $module->dump());
|
dcCore::app()->callBehavior('packmanAfterCreatePackage', $module->dump());
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Package successfully created.')
|
__('Package successfully created.')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
Http::redirect($_POST['redir']);
|
Http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-' . $type);
|
My::redirect([], '#packman-' . $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete
|
# Delete
|
||||||
|
@ -155,7 +155,7 @@ class Manage extends dcNsProcess
|
||||||
$del_success = false;
|
$del_success = false;
|
||||||
foreach ($_POST['modules'] as $root => $id) {
|
foreach ($_POST['modules'] as $root => $id) {
|
||||||
if (!file_exists($root) || !Files::isDeletable($root)) {
|
if (!file_exists($root) || !Files::isDeletable($root)) {
|
||||||
dcPage::addWarningNotice(sprintf(__('Undeletable file "%s"', $root)));
|
Notices::addWarningNotice(sprintf(__('Undeletable file "%s"', $root)));
|
||||||
} else {
|
} else {
|
||||||
$del_success = true;
|
$del_success = true;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ class Manage extends dcNsProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($del_success) {
|
if ($del_success) {
|
||||||
dcPage::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Package successfully deleted.')
|
__('Package successfully deleted.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ class Manage extends dcNsProcess
|
||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
Http::redirect($_POST['redir']);
|
Http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type);
|
My::redirect([], '#packman-repository-' . $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
|
@ -192,14 +192,14 @@ class Manage extends dcNsProcess
|
||||||
dcCore::app()->callBehavior('packmanAfterInstallPackage', $type, $id, $root);
|
dcCore::app()->callBehavior('packmanAfterInstallPackage', $type, $id, $root);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Package successfully installed.')
|
__('Package successfully installed.')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
Http::redirect($_POST['redir']);
|
Http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type);
|
My::redirect([], '#packman-repository-' . $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copy
|
# Copy
|
||||||
|
@ -218,14 +218,14 @@ class Manage extends dcNsProcess
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Package successfully copied.')
|
__('Package successfully copied.')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
Http::redirect($_POST['redir']);
|
Http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type);
|
My::redirect([], '#packman-repository-' . $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Move
|
# Move
|
||||||
|
@ -245,14 +245,14 @@ class Manage extends dcNsProcess
|
||||||
unlink($root);
|
unlink($root);
|
||||||
}
|
}
|
||||||
|
|
||||||
dcPage::addSuccessNotice(
|
Notices::addSuccessNotice(
|
||||||
__('Package successfully moved.')
|
__('Package successfully moved.')
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($_POST['redir'])) {
|
if (!empty($_POST['redir'])) {
|
||||||
Http::redirect($_POST['redir']);
|
Http::redirect($_POST['redir']);
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type);
|
My::redirect([], '#packman-repository-' . $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -264,7 +264,7 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
public static function render(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
if (!static::$init) {
|
if (!self::status()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,21 +295,21 @@ class Manage extends dcNsProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
# Display
|
# Display
|
||||||
dcPage::openModule(
|
Page::openModule(
|
||||||
My::name(),
|
My::name(),
|
||||||
dcPage::jsPageTabs() .
|
Page::jsPageTabs() .
|
||||||
dcPage::jsModuleLoad(My::id() . '/js/backend.js') .
|
My::jsLoad('backend') .
|
||||||
|
|
||||||
# --BEHAVIOR-- packmanAdminHeader
|
# --BEHAVIOR-- packmanAdminHeader
|
||||||
dcCore::app()->callBehavior('packmanAdminHeader')
|
dcCore::app()->callBehavior('packmanAdminHeader')
|
||||||
);
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
dcPage::breadcrumb([
|
Page::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
My::name() => '',
|
My::name() => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices();
|
Notices::GetNotices();
|
||||||
|
|
||||||
if (dcCore::app()->error->flag() || !$is_configured || !$is_plugins_configured || !$is_themes_configured) {
|
if (dcCore::app()->error->flag() || !$is_configured || !$is_plugins_configured || !$is_themes_configured) {
|
||||||
echo
|
echo
|
||||||
|
@ -377,7 +377,7 @@ class Manage extends dcNsProcess
|
||||||
# --BEHAVIOR-- packmanAdminTabs
|
# --BEHAVIOR-- packmanAdminTabs
|
||||||
dcCore::app()->callBehavior('packmanAdminTabs');
|
dcCore::app()->callBehavior('packmanAdminTabs');
|
||||||
|
|
||||||
dcPage::helpBlock('pacKman');
|
Page::helpBlock('pacKman');
|
||||||
dcPage::closeModule();
|
Page::closeModule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
28
src/My.php
28
src/My.php
|
@ -15,11 +15,12 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module definitions.
|
* This module definitions.
|
||||||
*/
|
*/
|
||||||
class My
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
/** @var array Excluded files */
|
/** @var array Excluded files */
|
||||||
public const EXCLUDED_FILES = [
|
public const EXCLUDED_FILES = [
|
||||||
|
@ -35,29 +36,8 @@ class My
|
||||||
'_disabled',
|
'_disabled',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
public static function checkCustomContext(int $context): ?bool
|
||||||
* This module id.
|
|
||||||
*/
|
|
||||||
public static function id(): string
|
|
||||||
{
|
{
|
||||||
return basename(dirname(__DIR__));
|
return dcCore::app()->auth->isSuperAdmin();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This module name.
|
|
||||||
*/
|
|
||||||
public static function name(): string
|
|
||||||
{
|
|
||||||
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
|
|
||||||
|
|
||||||
return __(is_string($name) ? $name : self::id());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This module path.
|
|
||||||
*/
|
|
||||||
public static function path(): string
|
|
||||||
{
|
|
||||||
return dirname(__DIR__);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
|
||||||
|
|
||||||
class Settings
|
class Settings
|
||||||
{
|
{
|
||||||
// Remove comments from files
|
// Remove comments from files
|
||||||
|
@ -50,7 +48,7 @@ class Settings
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$s = dcCore::app()->blog?->settings->get(My::id());
|
$s = My::settings();
|
||||||
|
|
||||||
$this->pack_nocomment = (bool) ($s?->get('pack_nocomment') ?? false);
|
$this->pack_nocomment = (bool) ($s?->get('pack_nocomment') ?? false);
|
||||||
$this->pack_fixnewline = (bool) ($s?->get('pack_fixnewline') ?? false);
|
$this->pack_fixnewline = (bool) ($s?->get('pack_fixnewline') ?? false);
|
||||||
|
@ -79,8 +77,8 @@ class Settings
|
||||||
public function writeSetting(string $key, mixed $value): bool
|
public function writeSetting(string $key, mixed $value): bool
|
||||||
{
|
{
|
||||||
if (property_exists($this, $key) && settype($value, gettype($this->{$key})) === true) {
|
if (property_exists($this, $key) && settype($value, gettype($this->{$key})) === true) {
|
||||||
dcCore::app()->blog?->settings->get(My::id())->drop($key);
|
My::settings()->drop($key);
|
||||||
dcCore::app()->blog?->settings->get(My::id())->put($key, $value, gettype($this->{$key}), '', true, true);
|
My::settings()->put($key, $value, gettype($this->{$key}), '', true, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,21 +15,19 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\pacKman;
|
namespace Dotclear\Plugin\pacKman;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNsProcess;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||||
|
|
||||||
class Uninstall extends dcNsProcess
|
class Uninstall extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN');
|
return self::status(My::checkContext(My::UNINSTALL));
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ class Utils
|
||||||
(new Text('h3', $title)),
|
(new Text('h3', $title)),
|
||||||
(new Form('packman-form-' . $type))
|
(new Form('packman-form-' . $type))
|
||||||
->method('post')
|
->method('post')
|
||||||
->action('plugin.php')
|
->action(My::manageUrl())
|
||||||
->fields([
|
->fields([
|
||||||
(new Para(null, 'table'))
|
(new Para(null, 'table'))
|
||||||
->class('clear')
|
->class('clear')
|
||||||
|
@ -163,13 +163,13 @@ class Utils
|
||||||
->class('checkboxes-helpers'),
|
->class('checkboxes-helpers'),
|
||||||
(new Para())
|
(new Para())
|
||||||
->items([
|
->items([
|
||||||
(new Hidden(['redir'], Html::escapeHTML($_REQUEST['redir'] ?? ''))),
|
|
||||||
(new Hidden(['p'], My::id())),
|
|
||||||
(new Hidden(['type'], $type)),
|
|
||||||
(new Hidden(['action'], 'packup')),
|
|
||||||
(new Submit(['packup']))
|
(new Submit(['packup']))
|
||||||
->value(__('Pack up selected modules')),
|
->value(__('Pack up selected modules')),
|
||||||
dcCore::app()->formNonce(false),
|
... My::hiddenFields([
|
||||||
|
'type' => $type,
|
||||||
|
'action' => 'packup',
|
||||||
|
'redir' => Html::escapeHTML($_REQUEST['redir'] ?? ''),
|
||||||
|
]),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
|
@ -279,7 +279,7 @@ class Utils
|
||||||
(new Text('h3', $title)),
|
(new Text('h3', $title)),
|
||||||
(new Form('packman-form-repository-' . $type))
|
(new Form('packman-form-repository-' . $type))
|
||||||
->method('post')
|
->method('post')
|
||||||
->action('plugin.php')
|
->action(My::manageUrl())
|
||||||
->fields([
|
->fields([
|
||||||
(new Para(null, 'table'))
|
(new Para(null, 'table'))
|
||||||
->class('clear')
|
->class('clear')
|
||||||
|
@ -311,10 +311,10 @@ class Utils
|
||||||
->items($combo_action),
|
->items($combo_action),
|
||||||
(new Submit(['packup']))
|
(new Submit(['packup']))
|
||||||
->value(__('ok')),
|
->value(__('ok')),
|
||||||
(new Hidden(['p'], My::id())),
|
... My::hiddenFields([
|
||||||
(new Hidden(['tab'], 'repository')),
|
'tab' => 'repository',
|
||||||
(new Hidden(['type'], $type)),
|
'type' => $type,
|
||||||
dcCore::app()->formNonce(false),
|
]),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in a new issue