From 99fb9bad557d43a1635be2331d7035aa61d19ec4 Mon Sep 17 00:00:00 2001
From: Jean-Christian Denis
Date: Sun, 20 Nov 2022 22:36:32 +0100
Subject: [PATCH] release 2022.11.20
---
CHANGELOG.md | 3 +
README.md | 21 +++++--
_admin.php | 55 ++++++++---------
_config.php | 62 +++++++++----------
_define.php | 21 +++----
_install.php | 99 ++++++++++++++---------------
_prepend.php | 13 ++--
_uninstall.php | 57 ++++++++++-------
dcstore.xml | 23 +++----
inc/class.license.bootstrap.php | 106 +++++++++++++++-----------------
inc/lib.license.bootstrap.php | 43 +++++++------
index.php | 73 ++++++++++------------
locales/fr/main.lang.php | 48 ---------------
locales/fr/resources.php | 10 +--
14 files changed, 297 insertions(+), 337 deletions(-)
delete mode 100644 locales/fr/main.lang.php
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 19cd752..c407321 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+2022.11.20
+- fix compatibility with Dotclear 2.24 (required)
+
2021.09.10
- clean up code
- Tested for Dotclear 2.19
diff --git a/README.md b/README.md
index 9803a45..3949ffe 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,12 @@
# README
+[![Release](https://img.shields.io/github/v/release/JcDenis/licenseBootstrap)](https://github.com/JcDenis/licenseBootstrap/releases)
+[![Date](https://img.shields.io/github/release-date/JcDenis/licenseBootstrap)](https://github.com/JcDenis/licenseBootstrap/releases)
+[![Issues](https://img.shields.io/github/issues/JcDenis/licenseBootstrap)](https://github.com/JcDenis/licenseBootstrap/issues)
+[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
+[![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 ?
licenseBootstrap is a plugins for the open-source
@@ -13,7 +20,7 @@ themes and plugins from Dotclear administration pages.
licenseBootstrap requires:
* Super administrator permissions
- * Dotclear 2.6
+ * Dotclear 2.24
## USAGE
@@ -26,8 +33,14 @@ go to ''configure plugin'', fill in form.
Once it's done you can manage your modules license from menu
''License bootstrap'' on sidebar or you can add dashboard icon.
-## MORE
+## LINKS
- * License : GNU GPL v2
+ * License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [GitHub Page](https://github.com/licenseBootstrap)
- * Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/licenseBootstrap)
\ No newline at end of file
+ * Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/licenseBootstrap)
+
+## CONTRIBUTORS
+
+ * Jean-Christian Denis
+
+ You are welcome to contribute to this code.
\ No newline at end of file
diff --git a/_admin.php b/_admin.php
index 796e886..051febb 100644
--- a/_admin.php
+++ b/_admin.php
@@ -1,31 +1,30 @@
blog->settings->addNamespace('licenseBootstrap');
+dcCore::app()->blog->settings->addNamespace('licenseBootstrap');
-$core->addBehavior('adminDashboardFavorites', [
- 'licenseBootstrapBehaviors', 'adminDashboardFavorites'
+dcCore::app()->addBehavior('adminDashboardFavoritesV2', [
+ 'licenseBootstrapBehaviors', 'adminDashboardFavorites',
]);
-$core->addBehavior('packmanBeforeCreatePackage', [
- 'licenseBootstrapBehaviors', 'packmanBeforeCreatePackage'
+dcCore::app()->addBehavior('packmanBeforeCreatePackage', [
+ 'licenseBootstrapBehaviors', 'packmanBeforeCreatePackage',
]);
-$_menu['Plugins']->addItem(
+dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
__('License bootstrap'),
'plugin.php?p=licenseBootstrap',
'index.php?pf=licenseBootstrap/icon.png',
@@ -33,35 +32,35 @@ $_menu['Plugins']->addItem(
'/plugin.php\?p=licenseBootstrap(&.*)?$/',
$_SERVER['REQUEST_URI']
),
- $core->auth->isSuperAdmin()
+ dcCore::app()->auth->isSuperAdmin()
);
class licenseBootstrapBehaviors
{
- public static function adminDashboardFavorites($core, $favs)
+ public static function adminDashboardFavorites($favs)
{
- $favs->register('licenseBootstrap', array(
- 'title' => __('License bootstrap'),
- 'url' => 'plugin.php?p=licenseBootstrap',
- 'small-icon' => 'index.php?pf=licenseBootstrap/icon.png',
- 'large-icon' => 'index.php?pf=licenseBootstrap/icon-big.png',
- 'permissions' => $core->auth->isSuperAdmin(),
- 'active_cb' => array(
- 'licenseBootstrapBehaviors',
- 'adminDashboardFavoritesActive'
- )
- ));
+ $favs->register('licenseBootstrap', [
+ 'title' => __('License bootstrap'),
+ 'url' => 'plugin.php?p=licenseBootstrap',
+ 'small-icon' => 'index.php?pf=licenseBootstrap/icon.png',
+ 'large-icon' => 'index.php?pf=licenseBootstrap/icon-big.png',
+ 'permissions' => dcCore::app()->auth->isSuperAdmin(),
+ 'active_cb' => [
+ 'licenseBootstrapBehaviors',
+ 'adminDashboardFavoritesActive',
+ ],
+ ]);
}
public static function adminDashboardFavoritesActive($request, $params)
{
- return $request == 'plugin.php'
- && isset($params['p'])
+ return $request == 'plugin.php'
+ && isset($params['p'])
&& $params['p'] == 'licenseBootstrap';
}
- public static function packmanBeforeCreatePackage($core, $module)
+ public static function packmanBeforeCreatePackage($module)
{
- licenseBootstrap::addLicense($core, $module);
+ licenseBootstrap::addLicense($module);
}
-}
\ No newline at end of file
+}
diff --git a/_config.php b/_config.php
index f19433c..0ba6e02 100644
--- a/_config.php
+++ b/_config.php
@@ -1,38 +1,36 @@
getURL() . '#plugins' : $_REQUEST['redir'];
+$redir = empty($_REQUEST['redir']) ?
+ dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'];
# -- Get settings --
-$core->blog->settings->addNamespace('licenseBootstrap');
-$s = $core->blog->settings->licenseBootstrap;
+dcCore::app()->blog->settings->addNamespace('licenseBootstrap');
+$s = dcCore::app()->blog->settings->licenseBootstrap;
-$lb_overwrite = (boolean) $s->overwrite;
-$lb_write_full = (boolean) $s->write_full;
-$lb_write_php = (boolean) $s->write_php;
-$lb_write_js = (boolean) $s->write_js;
-$lb_exclude_locales = (boolean) $s->exclude_locales;
+$lb_overwrite = (bool) $s->overwrite;
+$lb_write_full = (bool) $s->write_full;
+$lb_write_php = (bool) $s->write_php;
+$lb_write_js = (bool) $s->write_js;
+$lb_exclude_locales = (bool) $s->exclude_locales;
$lb_license_name = licenseBootstrap::getName($s->license_name);
$lb_license_head = licenseBootstrap::gethead($s->license_name, licenseBootstrap::decode($s->license_head));
# -- Set settings --
if (!empty($_POST['save'])) {
-
try {
$lb_overwrite = !empty($_POST['lb_overwrite']);
$lb_write_full = !empty($_POST['lb_write_full']);
@@ -42,24 +40,23 @@ if (!empty($_POST['save'])) {
$lb_license_name = $_POST['lb_license_name'];
$lb_license_head = licenseBootstrap::gethead($lb_license_name, !empty($_POST['lb_license_head_' . $lb_license_name]) ? $_POST['lb_license_head_' . $lb_license_name] : '');
- $s->put('overwrite', $lb_overwrite);
- $s->put('write_full', $lb_write_full);
- $s->put('write_php', $lb_write_php);
- $s->put('write_js', $lb_write_js);
- $s->put('exclude_locales', $lb_exclude_locales);
- $s->put('license_name', licenseBootstrap::getName($lb_license_name));
- $s->put('license_head', licenseBootstrap::encode($lb_license_head));
+ $s->put('overwrite', $lb_overwrite);
+ $s->put('write_full', $lb_write_full);
+ $s->put('write_php', $lb_write_php);
+ $s->put('write_js', $lb_write_js);
+ $s->put('exclude_locales', $lb_exclude_locales);
+ $s->put('license_name', licenseBootstrap::getName($lb_license_name));
+ $s->put('license_head', licenseBootstrap::encode($lb_license_head));
dcPage::addSuccessNotice(
__('Configuration has been successfully updated.')
);
http::redirect(
- $list->getURL('module=licenseBootstrap&conf=1&redir='.
- $list->getRedir())
+ dcCore::app()->admin->list->getURL('module=licenseBootstrap&conf=1&redir=' .
+ dcCore::app()->admin->list->getRedir())
);
- }
- catch (Exception $e) {
- $core->error->add($e->getMessage());
+ } catch (Exception $e) {
+ dcCore::app()->error->add($e->getMessage());
}
}
@@ -74,7 +71,7 @@ __('Overwrite existing licenses') .
'
@@ -98,17 +95,16 @@ __('Do not add license block to files from locales folder') .
' . __('Licenses') . '
';
-foreach(licenseBootstrap::getLicenses() as $name) {
-
+foreach (licenseBootstrap::getLicenses() as $name) {
$check = false;
- $head = licenseBootstrap::getHead($name);
+ $head = licenseBootstrap::getHead($name);
if ($name == $lb_license_name) {
$check = true;
- $head = licenseBootstrap::getHead($name, $lb_license_head);
+ $head = licenseBootstrap::getHead($name, $lb_license_head);
}
echo '
' .
form::textarea('lb_license_head_' . $name, 50, 10, html::escapeHTML($head)) . '
@@ -121,4 +117,4 @@ echo '
' . __('Files') . '
-';
\ No newline at end of file
+
';
diff --git a/_define.php b/_define.php
index e5ed9bb..054be58 100644
--- a/_define.php
+++ b/_define.php
@@ -1,16 +1,15 @@
registerModule(
'License bootstrap',
'Add license to your plugins and themes',
'Jean-Christian Denis',
- '2021.09.10',
+ '2022.11.20',
[
- 'requires' => [['core', '2.19']],
+ 'requires' => [['core', '2.24']],
'permissions' => null,
- 'type' => 'plugin',
- 'support' => 'https://github.com/JcDenis/licenseBootstrap',
- 'details' => 'https://plugins.dotaddict.org/dc2/details/licenseBootstrap',
- 'repository' => 'https://raw.githubusercontent.com/JcDenis/licenseBootstrap/master/dcstore.xml'
+ 'type' => 'plugin',
+ 'support' => 'https://github.com/JcDenis/licenseBootstrap',
+ 'details' => 'https://plugins.dotaddict.org/dc2/details/licenseBootstrap',
+ 'repository' => 'https://raw.githubusercontent.com/JcDenis/licenseBootstrap/master/dcstore.xml',
]
-);
\ No newline at end of file
+);
diff --git a/_install.php b/_install.php
index 6e49d22..caadb0d 100644
--- a/_install.php
+++ b/_install.php
@@ -1,117 +1,120 @@
getVersion($mod_id),
- $core->plugins->moduleInfo($mod_id, 'version'),
+ dcCore::app()->getVersion($mod_id),
+ dcCore::app()->plugins->moduleInfo($mod_id, 'version'),
'>='
)) {
-
return null;
}
# Check Dotclear version
- if (!method_exists('dcUtils', 'versionsCompare')
+ if (!method_exists('dcUtils', 'versionsCompare')
|| dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false)) {
throw new Exception(sprintf(
- '%s requires Dotclear %s', $mod_id, $dc_min
+ '%s requires Dotclear %s',
+ $mod_id,
+ $dc_min
));
}
# Set module settings
- $core->blog->settings->addNamespace($mod_id);
- foreach($mod_conf as $v) {
- $core->blog->settings->{$mod_id}->put(
- $v[0], $v[2], $v[3], $v[1], false, true
+ dcCore::app()->blog->settings->addNamespace($mod_id);
+ foreach ($mod_conf as $v) {
+ dcCore::app()->blog->settings->{$mod_id}->put(
+ $v[0],
+ $v[2],
+ $v[3],
+ $v[1],
+ false,
+ true
);
}
# Set module version
- $core->setVersion(
+ dcCore::app()->setVersion(
$mod_id,
- $core->plugins->moduleInfo($mod_id, 'version')
+ dcCore::app()->plugins->moduleInfo($mod_id, 'version')
);
return true;
-}
-catch (Exception $e) {
- $core->error->add($e->getMessage());
+} catch (Exception $e) {
+ dcCore::app()->error->add($e->getMessage());
return false;
-}
\ No newline at end of file
+}
diff --git a/_prepend.php b/_prepend.php
index 43e5703..5614d3e 100644
--- a/_prepend.php
+++ b/_prepend.php
@@ -1,21 +1,18 @@
autoload(['licenseBootstrap' => __DIR__ . '/inc/class.license.bootstrap.php']);
+Clearbricks::lib()->autoload(['libLicenseBootstrap' => __DIR__ . '/inc/lib.license.bootstrap.php']);
diff --git a/_uninstall.php b/_uninstall.php
index fd7c26a..8c42106 100644
--- a/_uninstall.php
+++ b/_uninstall.php
@@ -1,16 +1,15 @@
addUserAction(
- /* type */ 'settings',
- /* action */ 'delete_all',
- /* ns */ $mod_id,
- /* desc */ __('delete all settings')
+ /* type */
+ 'settings',
+ /* action */
+ 'delete_all',
+ /* ns */
+ $mod_id,
+ /* desc */
+ __('delete all settings')
);
$this->addUserAction(
- /* type */ 'plugins',
- /* action */ 'delete',
- /* ns */ $mod_id,
- /* desc */ __('delete plugin files')
+ /* type */
+ 'plugins',
+ /* action */
+ 'delete',
+ /* ns */
+ $mod_id,
+ /* desc */
+ __('delete plugin files')
);
$this->addDirectAction(
- /* type */ 'settings',
- /* action */ 'delete_all',
- /* ns */ $mod_id,
- /* desc */ sprintf(__('delete all %s settings'), $mod_id)
+ /* type */
+ 'settings',
+ /* action */
+ 'delete_all',
+ /* ns */
+ $mod_id,
+ /* desc */
+ sprintf(__('delete all %s settings'), $mod_id)
);
$this->addDirectAction(
- /* type */ 'plugins',
- /* action */ 'delete',
- /* ns */ $mod_id,
- /* desc */ sprintf(__('delete %s plugin files'), $mod_id)
-);
\ No newline at end of file
+ /* type */
+ 'plugins',
+ /* action */
+ 'delete',
+ /* ns */
+ $mod_id,
+ /* desc */
+ sprintf(__('delete %s plugin files'), $mod_id)
+);
diff --git a/dcstore.xml b/dcstore.xml
index 2b6becb..cca33ea 100644
--- a/dcstore.xml
+++ b/dcstore.xml
@@ -1,12 +1,13 @@
+
-
-License bootstrap
-2021.09.10
-Jean-Christian Denis
-Add license to your plugins and themes
-https://github.com/JcDenis/licenseBootstrap/releases/download/v2021.09.10/plugin-licenseBootstrap.zip
-2.19
-https://plugins.dotaddict.org/dc2/details/licenseBootstrap
-https://github.com/JcDenis/licenseBootstrap
-
-
\ No newline at end of file
+
+ License bootstrap
+ 2022.11.20
+ Jean-Christian Denis
+ Add license to your plugins and themes
+ https://github.com/JcDenis/licenseBootstrap/releases/download/v2022.11.20/plugin-licenseBootstrap.zip
+ 2.24
+ https://plugins.dotaddict.org/dc2/details/licenseBootstrap
+ https://github.com/JcDenis/licenseBootstrap
+
+
diff --git a/inc/class.license.bootstrap.php b/inc/class.license.bootstrap.php
index 2e4dc42..03bd6e5 100644
--- a/inc/class.license.bootstrap.php
+++ b/inc/class.license.bootstrap.php
@@ -1,41 +1,38 @@
blog->settings->licenseBootstrap;
+ $s = dcCore::app()->blog->settings->licenseBootstrap;
# --BEHAVIOR-- licenseBootstrapBeforeAddLicense
- $core->callBehavior(
+ dcCore::app()->callBehavior(
'licenseBootstrapBeforeAddLicense',
- $core,
$module
);
@@ -50,7 +47,7 @@ class licenseBootstrap
$s->license_name,
licenseBootstrap::decode($s->license_head),
$module,
- $core->auth,
+ dcCore::app()->auth,
$s->overwrite,
$s->write_php,
$s->write_js,
@@ -58,23 +55,22 @@ class licenseBootstrap
);
# --BEHAVIOR-- licenseBootstrapAfterAddLicense
- $core->callBehavior(
+ dcCore::app()->callBehavior(
'licenseBootstrapAfterAddLicense',
- $core,
$module
);
}
/**
* Get available licenses.
- *
+ *
* @return array List of licenses names
*/
public static function getLicenses()
{
if (empty(licenseBootstrap::$licenses)) {
$file_reg = '/^([a-z0-9]+)\.head\.txt$/';
- $res = array();
+ $res = [];
foreach (files::scandir(dirname(__FILE__) . '/licenses/') as $file) {
if (preg_match($file_reg, $file, $matches)) {
$res[] = $matches[1];
@@ -90,57 +86,57 @@ class licenseBootstrap
* Get license name.
*
* Check requested license name and return existing one.
- *
+ *
* @param string $name License name
* @return string License name
*/
- public static function getName($name='gpl2')
+ public static function getName($name = 'gpl2')
{
return in_array($name, self::getLicenses()) ? $name : 'gpl2';
}
/**
* Get license header.
- *
+ *
* @param string $name License name
* @param string $content Header content
* @return string Header content
*/
- public static function getHead($name='gpl2', $content='')
+ public static function getHead($name = 'gpl2', $content = '')
{
if (!in_array($name, self::getLicenses())) {
- $name = 'gpl2';
+ $name = 'gpl2';
$content = '';
}
- return empty($content) ?
+ return empty($content) ?
self::getContent($name, 'head') : $content;
}
/**
* Get full license.
- *
+ *
* @param string $name License name
* @return string Full license content
*/
- public static function getFull($name='gpl2')
+ public static function getFull($name = 'gpl2')
{
return self::getContent($name, 'full');
}
/**
* Get original license content.
- *
+ *
* @param string $name License name
* @param string $part License part (head or full)
* @return string License content
*/
- public static function getContent($name='gpl2', $part='head')
+ public static function getContent($name = 'gpl2', $part = 'head')
{
if (!in_array($name, self::getLicenses())) {
$name = 'gpl2';
}
- if (!in_array($part, array('head', 'full'))) {
+ if (!in_array($part, ['head', 'full'])) {
$part = 'head';
}
@@ -151,7 +147,7 @@ class licenseBootstrap
/**
* Write license block into module files headers
- *
+ *
* @param string $name License name
* @param string $content License block content
* @param array $module Module info
@@ -173,13 +169,12 @@ class licenseBootstrap
$user
);
- foreach(self::getModuleFiles($module['root']) as $file) {
-
+ foreach (self::getModuleFiles($module['root']) as $file) {
if ($locales && preg_match('/(\.lang\.php|libs)/', $file)) {
continue;
}
- $path = $module['root'] . '/' . $file;
+ $path = $module['root'] . '/' . $file;
$extension = files::getExtension($file);
if ($php && $extension == 'php') {
@@ -191,8 +186,7 @@ class licenseBootstrap
$overwrite
)
);
- }
- elseif ($js && $extension == 'js') {
+ } elseif ($js && $extension == 'js') {
file_put_contents(
$file,
self::replaceJsContent(
@@ -207,7 +201,7 @@ class licenseBootstrap
/**
* Write full license file
- *
+ *
* @param string $name License name
* @param array $module Module info
* @param boolean $overwrite Overwrite existing license
@@ -218,7 +212,6 @@ class licenseBootstrap
throw new Exception();
}
if (file_exists($module['root'] . '/LICENSE') && !$overwrite) {
-
return null;
}
@@ -230,7 +223,7 @@ class licenseBootstrap
/**
* Replace license block in PHP file
- *
+ *
* @param string $content File content
* @param string $license License content
* @param boolean $overwrite Overwrite existing license
@@ -246,7 +239,6 @@ class licenseBootstrap
);
if ($clean != $content && !$overwrite) {
-
return $content;
}
@@ -255,7 +247,7 @@ class licenseBootstrap
'getInfo('user_cn'),
$user->getinfo('user_name'),
$user->getInfo('user_email'),
- $user->getInfo('user_url')
- ),
+ $user->getInfo('user_url'),
+ ],
$content
);
}
/**
* Get list of module files
- *
+ *
* @param string $path Path to scan
* @param string $dir Ignore
* @param array $res Ignore
* @return array List of files
*/
- protected static function getModuleFiles($path, $dir='', $res=array())
+ protected static function getModuleFiles($path, $dir = '', $res = [])
{
$path = path::real($path);
if (!is_dir($path) || !is_readable($path)) {
-
- return array();
+ return [];
}
if (!$dir) {
@@ -353,18 +343,18 @@ class licenseBootstrap
$files = files::scandir($path);
- foreach($files AS $file) {
+ foreach ($files as $file) {
if (substr($file, 0, 1) == '.') {
continue;
}
if (is_dir($path . '/' . $file)) {
$res = self::getModuleFiles(
- $path . '/' . $file, $dir . '/' . $file,
+ $path . '/' . $file,
+ $dir . '/' . $file,
$res
);
- }
- else {
+ } else {
$res[] = empty($dir) ? $file : $dir . '/' . $file;
}
}
@@ -381,4 +371,4 @@ class licenseBootstrap
{
return unserialize(base64_decode($a));
}
-}
\ No newline at end of file
+}
diff --git a/inc/lib.license.bootstrap.php b/inc/lib.license.bootstrap.php
index 62a09a6..fc355b1 100644
--- a/inc/lib.license.bootstrap.php
+++ b/inc/lib.license.bootstrap.php
@@ -1,34 +1,32 @@
' .
'' . $title . '
';
if (empty($modules) && !is_array($modules)) {
- echo
+ echo
'' . __('There are no modules.') . '
' .
'';
@@ -38,19 +36,19 @@ class libLicenseBootstrap
echo
'
' .
'
';
@@ -86,12 +85,12 @@ class libLicenseBootstrap
protected static function sort($modules)
{
- $sorter = array();
- foreach($modules as $id => $module) {
+ $sorter = [];
+ foreach ($modules as $id => $module) {
$sorter[$id] = $id;
}
array_multisort($sorter, SORT_ASC, $modules);
return $modules;
}
-}
\ No newline at end of file
+}
diff --git a/index.php b/index.php
index 6996655..f910820 100644
--- a/index.php
+++ b/index.php
@@ -1,16 +1,15 @@
blog->settings->addNamespace('licenseBootstrap');
-$s = $core->blog->settings->licenseBootstrap;
+dcCore::app()->blog->settings->addNamespace('licenseBootstrap');
+$s = dcCore::app()->blog->settings->licenseBootstrap;
# Modules
-if (!isset($core->themes)) {
- $core->themes = new dcThemes($core);
- $core->themes->loadModules($core->blog->themes_path, null);
+if (!isset(dcCore::app()->themes)) {
+ dcCore::app()->themes = new dcThemes();
+ dcCore::app()->themes->loadModules(dcCore::app()->blog->themes_path, null);
}
-$themes = $core->themes;
-$plugins = $core->plugins;
+$themes = dcCore::app()->themes;
+$plugins = dcCore::app()->plugins;
# Rights
-$is_editable =
- !empty($type)
- && !empty($_POST['modules'])
+$is_editable = !empty($type)
+ && !empty($_POST['modules'])
&& is_array($_POST['modules']);
# Actions
-try
-{
+try {
# Add license to modules
if ($action == 'addlicense' && $is_editable) {
-
$modules = array_keys($_POST['modules']);
foreach ($modules as $id) {
-
if (!${$type}->moduleExists($id)) {
throw new Exception('No such module');
}
- $module = ${$type}->getModules($id);
- $module['id'] = $id;
+ $module = ${$type}->getModules($id);
+ $module['id'] = $id;
$module['type'] = $type == 'themes' ? 'theme' : 'plugin';
- licenseBootstrap::addLicense($core, $module);
+ licenseBootstrap::addLicense($module);
}
- dcPage::addSuccessNotice(
+ dcAdminNotices::addSuccessNotice(
__('License successfully added.')
);
- http::redirect(empty($_POST['redir']) ?
- $p_url : $_POST['redir']
+ http::redirect(
+ empty($_POST['redir']) ?
+ dcCore::app()->admin->getPageURL() : $_POST['redir']
);
}
-}
-catch(Exception $e) {
- $core->error->add($e->getMessage());
+} catch(Exception $e) {
+ dcCore::app()->error->add($e->getMessage());
}
# Display
-echo
+echo
'' . __('License bootstrap') . '' .
dcPage::jsPageTabs() .
dcPage::jsLoad('index.php?pf=licenseBootstrap/js/licensebootstrap.js') .
# --BEHAVIOR-- licenseBootstrapAdminHeader
-$core->callBehavior('licenseBootstrapAdminHeader', $core) .
+dcCore::app()->callBehavior('licenseBootstrapAdminHeader') .
'' .
dcPage::breadcrumb(
- array(
- __('Plugins') => '',
- __('License bootstrap') => ''
- )
+ [
+ __('Plugins') => '',
+ __('License bootstrap') => '',
+ ]
) .
dcPage::notices();
libLicenseBootstrap::modules(
- $core,
$plugins->getModules(),
'plugins',
__('Installed plugins')
);
libLicenseBootstrap::modules(
- $core,
$themes->getModules(),
'themes',
__('Installed themes')
@@ -108,5 +101,5 @@ libLicenseBootstrap::modules(
dcPage::helpBlock('licenseBootstrap');
-echo
-'';
\ No newline at end of file
+echo
+'