Compare commits
No commits in common. "288c61ba2befd9ec815761188d052245d6f46209" and "bcf4a26cd1b8d5f610a1d0027511aa83cf65c59b" have entirely different histories.
288c61ba2b
...
bcf4a26cd1
121
CHANGELOG.md
121
CHANGELOG.md
|
@ -1,83 +1,62 @@
|
||||||
licenseBootstrap 2023.08.14
|
2023.05.13
|
||||||
===========================================================
|
- require dotclea r2.26
|
||||||
* Require Dotclear 2.27
|
- require php 8.1
|
||||||
* Require PHP 8.1
|
- use define php_min
|
||||||
* Upgrade to Dotclear 2.27 stable
|
- fix dump() method
|
||||||
* Move third party repository
|
|
||||||
* Use Dotclear style for CHANGELOG
|
|
||||||
|
|
||||||
licenseBootstrap 2023.05.13
|
2023.04.22
|
||||||
===========================================================
|
- require dotclea r2.26
|
||||||
* require dotclea r2.26
|
- require php 8.1
|
||||||
* require php 8.1
|
- add plugin Uninstaller features
|
||||||
* use define php_min
|
- use latest helper namespace
|
||||||
* fix dump() method
|
- fix nullsafe warnings
|
||||||
|
|
||||||
licenseBootstrap 2023.04.22
|
2023.03.25
|
||||||
===========================================================
|
- require dotclea r2.26
|
||||||
* require dotclea r2.26
|
- require php 8.1
|
||||||
* require php 8.1
|
- use namespace
|
||||||
* add plugin Uninstaller features
|
|
||||||
* use latest helper namespace
|
|
||||||
* fix nullsafe warnings
|
|
||||||
|
|
||||||
licenseBootstrap 2023.03.25
|
2022.12.22
|
||||||
===========================================================
|
- add wtfpl license
|
||||||
* require dotclea r2.26
|
- use SVG icon
|
||||||
* require php 8.1
|
- use anonymous function
|
||||||
* use namespace
|
- use abstract plugin id
|
||||||
|
- change serialize stuff into json stuff
|
||||||
|
- fix pacKman behavoir dis|enable
|
||||||
|
- fix autoload
|
||||||
|
- fix permissions
|
||||||
|
- fix install
|
||||||
|
|
||||||
licenseBootstrap 2022.12.22
|
2022.11.20
|
||||||
===========================================================
|
- fix compatibility with Dotclear 2.24 (required)
|
||||||
* add wtfpl license
|
|
||||||
* use SVG icon
|
|
||||||
* use anonymous function
|
|
||||||
* use abstract plugin id
|
|
||||||
* change serialize stuff into json stuff
|
|
||||||
* fix pacKman behavoir dis|enable
|
|
||||||
* fix autoload
|
|
||||||
* fix permissions
|
|
||||||
* fix install
|
|
||||||
|
|
||||||
licenseBootstrap 2022.11.20
|
2021.09.10
|
||||||
===========================================================
|
- clean up code
|
||||||
* fix compatibility with Dotclear 2.24 (required)
|
- Tested for Dotclear 2.19
|
||||||
|
|
||||||
licenseBootstrap 2021.09.10
|
2013.12.01
|
||||||
===========================================================
|
- Fix install
|
||||||
* clean up code
|
- Fix user info
|
||||||
* Tested for Dotclear 2.19
|
|
||||||
|
|
||||||
licenseBootstrap 2013.12.01
|
2013.10.29
|
||||||
===========================================================
|
- Fix full license bug
|
||||||
* Fix install
|
- Fix french help and support links
|
||||||
* Fix user info
|
|
||||||
|
|
||||||
licenseBootstrap 2013.10.29
|
2013.10.28
|
||||||
===========================================================
|
- Switched to DC 2.6
|
||||||
* Fix full license bug
|
- New icon
|
||||||
* Fix french help and support links
|
- Add dashboard icon
|
||||||
|
- Clean up code and (again) lighter admin interface
|
||||||
|
|
||||||
licenseBootstrap 2013.10.28
|
2013.05.11
|
||||||
===========================================================
|
- Fixed page title and messages and contents
|
||||||
* Switched to DC 2.6
|
|
||||||
* New icon
|
|
||||||
* Add dashboard icon
|
|
||||||
* Clean up code and (again) lighter admin interface
|
|
||||||
|
|
||||||
licenseBootstrap 2013.05.11
|
0.3 - 2010.06.05
|
||||||
===========================================================
|
- Switched to DC 2.2
|
||||||
* Fixed page title and messages and contents
|
- Changed admin interface (easy, light, fast)
|
||||||
|
|
||||||
licenseBootstrap 0.3 - 2010.06.05
|
0.2 - 2009.11.09
|
||||||
===========================================================
|
- Changed lots of things
|
||||||
* Switched to DC 2.2
|
|
||||||
* Changed admin interface (easy, light, fast)
|
|
||||||
|
|
||||||
licenseBootstrap 0.2 - 2009.11.09
|
0.1 - 2009.10.09
|
||||||
===========================================================
|
- First lab release
|
||||||
* Changed lots of things
|
|
||||||
|
|
||||||
licenseBootstrap 0.1 - 2009.10.09
|
|
||||||
===========================================================
|
|
||||||
* First lab release
|
|
27
README.md
27
README.md
|
@ -1,14 +1,15 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-2023.08.15-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/licenseBootstrap/releases)
|
[![Release](https://img.shields.io/github/v/release/JcDenis/licenseBootstrap)](https://github.com/JcDenis/licenseBootstrap/releases)
|
||||||
[![Date](https://img.shields.io/badge/date-2023.08.14-c44d58.svg)](https://git.dotclear.watch/JcDenis/licenseBootstrap/releases)
|
[![Date](https://img.shields.io/github/release-date/JcDenis/licenseBootstrap)](https://github.com/JcDenis/licenseBootstrap/releases)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
|
[![Issues](https://img.shields.io/github/issues/JcDenis/licenseBootstrap)](https://github.com/JcDenis/licenseBootstrap/issues)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/licenseBootstrap)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/licenseBootstrap)](https://git.dotclear.watch/JcDenis/licenseBootstrap/blob/master/LICENSE)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/licenseBootstrap)
|
||||||
|
[![License](https://img.shields.io/github/license/JcDenis/licenseBootstrap)](https://github.com/JcDenis/licenseBootstrap/blob/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS LICENSEBOOTSTRAP ?
|
## WHAT IS LICENSEBOOTSTRAP ?
|
||||||
|
|
||||||
_licenseBootstrap_ is a plugins for the open-source
|
licenseBootstrap is a plugins for the open-source
|
||||||
web publishing software called Dotclear.
|
web publishing software called Dotclear.
|
||||||
|
|
||||||
It help super admin to add license to their
|
It help super admin to add license to their
|
||||||
|
@ -16,15 +17,15 @@ themes and plugins from Dotclear administration pages.
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
_licenseBootstrap_ requires:
|
licenseBootstrap requires:
|
||||||
|
|
||||||
* Super administrator permissions
|
* Super administrator permissions
|
||||||
* Dotclear 2.26
|
* Dotclear 2.26
|
||||||
* Php 8.1+
|
* Php >= 8.1
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
First install _licenseBootstrap_, mannualy from a zip package or from
|
First install licenseBootstrap, mannualy from a zip package or from
|
||||||
Dotaddict repository. (See Dotclear's documentation to know how do this)
|
Dotaddict repository. (See Dotclear's documentation to know how do this)
|
||||||
|
|
||||||
Go to ''plugins manager'', expand licenseBootstrap information then
|
Go to ''plugins manager'', expand licenseBootstrap information then
|
||||||
|
@ -33,18 +34,18 @@ go to ''configure plugin'', fill in form.
|
||||||
Once it's done you can manage your modules license from menu
|
Once it's done you can manage your modules license from menu
|
||||||
''License bootstrap'' on sidebar or you can add dashboard icon.
|
''License bootstrap'' on sidebar or you can add dashboard icon.
|
||||||
|
|
||||||
By default, _licenseBootstrap_ uses old style code blocs,
|
By default, licenseBootstrap uses old style code blocs,
|
||||||
if you want a modern style you should use a more recent plugin
|
if you want a modern style you should use a more recent plugin
|
||||||
like the one called ''improve''.
|
like the one called ''improve''.
|
||||||
|
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
||||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/licenseBootstrap) or [GitHub Page](https://github.com/JcDenis/licenseBootstrap)
|
* Source & contribution : [GitHub Page](https://github.com/licenseBootstrap)
|
||||||
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/licenseBootstrap/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/licenseBootstrap)
|
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/licenseBootstrap)
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Jean-Christian Denis (author)
|
* Jean-Christian Denis
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
|
@ -18,7 +18,7 @@ $this->registerModule(
|
||||||
'License bootstrap',
|
'License bootstrap',
|
||||||
'Add license to your plugins and themes',
|
'Add license to your plugins and themes',
|
||||||
'Jean-Christian Denis',
|
'Jean-Christian Denis',
|
||||||
'2023.08.15',
|
'2023.05.13',
|
||||||
[
|
[
|
||||||
'requires' => [
|
'requires' => [
|
||||||
['php', '8.1'],
|
['php', '8.1'],
|
||||||
|
@ -26,8 +26,8 @@ $this->registerModule(
|
||||||
],
|
],
|
||||||
'permissions' => null,
|
'permissions' => null,
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
|
||||||
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="licenseBootstrap">
|
<module id="licenseBootstrap">
|
||||||
<name>License bootstrap</name>
|
<name>License bootstrap</name>
|
||||||
<version>2023.08.15</version>
|
<version>2023.05.13</version>
|
||||||
<author>Jean-Christian Denis</author>
|
<author>Jean-Christian Denis</author>
|
||||||
<desc>Add license to your plugins and themes</desc>
|
<desc>Add license to your plugins and themes</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/licenseBootstrap/releases/download/v2023.08.15/plugin-licenseBootstrap.zip</file>
|
<file>https://github.com/JcDenis/licenseBootstrap/releases/download/v2023.05.13/plugin-licenseBootstrap.zip</file>
|
||||||
<da:dcmin>2.26</da:dcmin>
|
<da:dcmin>2.26</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/licenseBootstrap/src/branch/master/README.md</da:details>
|
<da:details>https://plugins.dotaddict.org/dc2/details/licenseBootstrap</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/licenseBootstrap/issues</da:support>
|
<da:support>https://github.com/JcDenis/licenseBootstrap</da:support>
|
||||||
</module>
|
</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
@ -14,37 +14,37 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\licenseBootstrap;
|
namespace Dotclear\Plugin\licenseBootstrap;
|
||||||
|
|
||||||
|
use dcAdmin;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Core\Backend\Favorites;
|
use dcFavorites;
|
||||||
use Dotclear\Core\Process;
|
use dcNsProcess;
|
||||||
|
use dcPage;
|
||||||
|
|
||||||
class Backend extends Process
|
class Backend extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::BACKEND));
|
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||||
|
&& dcCore::app()->auth?->isSuperAdmin();
|
||||||
|
|
||||||
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status()) {
|
if (!static::$init) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
My::addBackendMenuItem();
|
|
||||||
|
|
||||||
dcCore::app()->addBehaviors([
|
dcCore::app()->addBehaviors([
|
||||||
'adminDashboardFavoritesV2' => function (Favorites $favs): void {
|
'adminDashboardFavoritesV2' => function (dcFavorites $favs): void {
|
||||||
$favs->register(
|
$favs->register(My::id(), [
|
||||||
My::id(),
|
|
||||||
[
|
|
||||||
'title' => My::name(),
|
'title' => My::name(),
|
||||||
'url' => My::manageUrl(),
|
'url' => dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
|
||||||
'small-icon' => My::icons(),
|
'small-icon' => dcPage::getPF(My::id() . '/icon.svg'),
|
||||||
'large-icon' => My::icons(),
|
'large-icon' => dcPage::getPF(My::id() . '/icon.svg'),
|
||||||
//'permissions' => null,
|
//'permissions' => dcCore::app()->auth->isSuperAdmin(),
|
||||||
]
|
]);
|
||||||
);
|
|
||||||
},
|
},
|
||||||
'packmanBeforeCreatePackage' => function ($module) {
|
'packmanBeforeCreatePackage' => function ($module) {
|
||||||
if (Settings::init()->behavior_packman) {
|
if (Settings::init()->behavior_packman) {
|
||||||
|
@ -53,6 +53,14 @@ class Backend extends Process
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
|
My::name(),
|
||||||
|
dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
|
||||||
|
dcPage::getPF(My::id() . '/icon.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\licenseBootstrap;
|
namespace Dotclear\Plugin\licenseBootstrap;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Core\Backend\Notices;
|
use dcPage;
|
||||||
use Dotclear\Core\Process;
|
use dcNsProcess;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Div,
|
Div,
|
||||||
|
@ -29,16 +29,19 @@ use Dotclear\Helper\Html\Form\{
|
||||||
};
|
};
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Config extends Process
|
class Config extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::CONFIG));
|
static::$init == defined('DC_CONTEXT_ADMIN')
|
||||||
|
&& dcCore::app()->auth?->isSuperAdmin();
|
||||||
|
|
||||||
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status()) {
|
if (!static::$init) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,10 +68,10 @@ class Config extends Process
|
||||||
$s->writeSetting('license_name', Utils::getName($license_name));
|
$s->writeSetting('license_name', Utils::getName($license_name));
|
||||||
$s->writeSetting('license_head', Utils::encode($license_head));
|
$s->writeSetting('license_head', Utils::encode($license_head));
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
dcPage::addSuccessNotice(
|
||||||
__('Configuration has been successfully updated.')
|
__('Configuration has been successfully updated.')
|
||||||
);
|
);
|
||||||
dcCore::app()->admin->url->redirect('admin.plugins', [
|
dcCore::app()->adminurl?->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(),
|
||||||
|
@ -82,7 +85,7 @@ class Config extends Process
|
||||||
|
|
||||||
public static function render(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
if (!self::status()) {
|
if (!static::$init) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,19 +16,22 @@ namespace Dotclear\Plugin\licenseBootstrap;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcNamespace;
|
use dcNamespace;
|
||||||
use Dotclear\Core\Process;
|
use dcNsProcess;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Install extends Process
|
class Install extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::INSTALL));
|
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||||
|
&& 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 (!self::status()) {
|
if (!static::$init) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,9 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\licenseBootstrap;
|
namespace Dotclear\Plugin\licenseBootstrap;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
use dcPage;
|
||||||
use dcThemes;
|
use dcThemes;
|
||||||
use Dotclear\Core\Backend\{
|
use dcNsProcess;
|
||||||
Notices,
|
|
||||||
Page
|
|
||||||
};
|
|
||||||
use Dotclear\Core\Process;
|
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
@ -34,16 +31,19 @@ use Dotclear\Helper\File\Path;
|
||||||
use Dotclear\Helper\Network\Http;
|
use Dotclear\Helper\Network\Http;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Manage extends Process
|
class Manage extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::MANAGE));
|
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||||
|
&& dcCore::app()->auth?->isSuperAdmin();
|
||||||
|
|
||||||
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status()) {
|
if (!static::$init) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,14 +75,13 @@ class Manage extends Process
|
||||||
Utils::addLicense($module);
|
Utils::addLicense($module);
|
||||||
}
|
}
|
||||||
|
|
||||||
Notices::addSuccessNotice(
|
dcPage::addSuccessNotice(
|
||||||
__('License successfully added.')
|
__('License successfully added.')
|
||||||
);
|
);
|
||||||
if (empty($_POST['redir'])) {
|
Http::redirect(
|
||||||
My::redirect();
|
empty($_POST['redir']) ?
|
||||||
} else {
|
dcCore::app()->admin->getPageURL() : $_POST['redir']
|
||||||
Http::redirect($_POST['redir']);
|
);
|
||||||
};
|
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -92,28 +91,28 @@ class Manage extends Process
|
||||||
|
|
||||||
public static function render(): void
|
public static function render(): void
|
||||||
{
|
{
|
||||||
if (!self::status()) {
|
if (!static::$init) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$m = self::loadModules();
|
$m = self::loadModules();
|
||||||
|
|
||||||
# Display
|
# Display
|
||||||
Page::openModule(
|
dcPage::openModule(
|
||||||
My::name(),
|
My::name(),
|
||||||
Page::jsPageTabs() .
|
dcPage::jsPageTabs() .
|
||||||
My::jsLoad('licensebootstrap') .
|
dcPage::jsModuleLoad(My::id() . '/js/licensebootstrap.js') .
|
||||||
|
|
||||||
# --BEHAVIOR-- licenseBootstrapAdminHeader
|
# --BEHAVIOR-- licenseBootstrapAdminHeader
|
||||||
dcCore::app()->callBehavior('licenseBootstrapAdminHeader')
|
dcCore::app()->callBehavior('licenseBootstrapAdminHeader')
|
||||||
);
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
Page::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
My::name() => '',
|
My::name() => '',
|
||||||
]) .
|
]) .
|
||||||
Notices::getNotices();
|
dcPage::notices();
|
||||||
|
|
||||||
self::displayModulesList(
|
self::displayModulesList(
|
||||||
$m['plugins']->getModules(),
|
$m['plugins']->getModules(),
|
||||||
|
@ -127,9 +126,9 @@ class Manage extends Process
|
||||||
__('Installed themes')
|
__('Installed themes')
|
||||||
);
|
);
|
||||||
|
|
||||||
Page::helpBlock('licenseBootstrap');
|
dcPage::helpBlock('licenseBootstrap');
|
||||||
|
|
||||||
Page::closeModule();
|
dcPage::closeModule();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function displayModulesList(array $modules, string $type, string $title): void
|
private static function displayModulesList(array $modules, string $type, string $title): void
|
||||||
|
@ -186,7 +185,6 @@ class Manage extends Process
|
||||||
'<p class="checkboxes-helpers"></p>' .
|
'<p class="checkboxes-helpers"></p>' .
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Hidden(['redir'], empty($_REQUEST['redir']) ? '' : Html::escapeHTML($_REQUEST['redir']))),
|
(new Hidden(['redir'], empty($_REQUEST['redir']) ? '' : Html::escapeHTML($_REQUEST['redir']))),
|
||||||
(new Hidden(['process'], 'Plugin')),
|
|
||||||
(new Hidden(['p'], My::id())),
|
(new Hidden(['p'], My::id())),
|
||||||
(new Hidden(['type'], $type)),
|
(new Hidden(['type'], $type)),
|
||||||
(new Hidden(['action'], 'addlicense')),
|
(new Hidden(['action'], 'addlicense')),
|
||||||
|
|
29
src/My.php
29
src/My.php
|
@ -15,19 +15,38 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\licenseBootstrap;
|
namespace Dotclear\Plugin\licenseBootstrap;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Module\MyPlugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module definitions.
|
* This module definitions.
|
||||||
*/
|
*/
|
||||||
class My extends MyPlugin
|
class My
|
||||||
{
|
{
|
||||||
/** @var string Licenses default templates folder name */
|
/** @var string Licenses default templates folder name */
|
||||||
public const TEMPLATE_FOLDER = 'licenses';
|
public const TEMPLATE_FOLDER = 'licenses';
|
||||||
|
|
||||||
protected static function checkCustomContext(int $context): ?bool
|
/**
|
||||||
|
* This module id.
|
||||||
|
*/
|
||||||
|
public static function id(): string
|
||||||
{
|
{
|
||||||
return $context === My::INSTALL ? null :
|
return basename(dirname(__DIR__));
|
||||||
defined('DC_CONTEXT_ADMIN') && 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,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\licenseBootstrap;
|
namespace Dotclear\Plugin\licenseBootstrap;
|
||||||
|
|
||||||
|
use dcCore;
|
||||||
|
|
||||||
class Settings
|
class Settings
|
||||||
{
|
{
|
||||||
/** @var Settings self instance */
|
/** @var Settings self instance */
|
||||||
|
@ -51,7 +53,7 @@ class Settings
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$s = My::settings();
|
$s = dcCore::app()->blog?->settings->get(My::id());
|
||||||
|
|
||||||
$this->hide_distrib = (bool) ($s?->get('hide_distrib') ?? false);
|
$this->hide_distrib = (bool) ($s?->get('hide_distrib') ?? false);
|
||||||
$this->overwrite = (bool) ($s?->get('overwrite') ?? false);
|
$this->overwrite = (bool) ($s?->get('overwrite') ?? false);
|
||||||
|
@ -89,8 +91,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) {
|
||||||
My::settings()->drop($key);
|
dcCore::app()->blog?->settings->get(My::id())->drop($key);
|
||||||
My::settings()->put($key, $value, gettype($this->{$key}), '', true, true);
|
dcCore::app()->blog?->settings->get(My::id())->put($key, $value, gettype($this->{$key}), '', true, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,19 +15,21 @@ declare(strict_types=1);
|
||||||
namespace Dotclear\Plugin\licenseBootstrap;
|
namespace Dotclear\Plugin\licenseBootstrap;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use Dotclear\Core\Process;
|
use dcNsProcess;
|
||||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||||
|
|
||||||
class Uninstall extends Process
|
class Uninstall extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
return self::status(My::checkContext(My::UNINSTALL));
|
static::$init = defined('DC_CONTEXT_ADMIN');
|
||||||
|
|
||||||
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,10 @@ class Utils
|
||||||
*/
|
*/
|
||||||
public static function addLicense(array $module): void
|
public static function addLicense(array $module): void
|
||||||
{
|
{
|
||||||
|
if (is_null(dcCore::app()->auth)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$s = Settings::init();
|
$s = Settings::init();
|
||||||
|
|
||||||
# --BEHAVIOR-- licenseBootstrapBeforeAddLicense
|
# --BEHAVIOR-- licenseBootstrapBeforeAddLicense
|
||||||
|
|
Loading…
Reference in New Issue