use abstract plugin name

master
Jean-Christian Paul Denis 2022-12-10 21:28:19 +01:00
parent f5c59b638c
commit e322b2da16
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 15 additions and 19 deletions

View File

@ -17,16 +17,14 @@ if (!defined('DC_CONTEXT_ADMIN')) {
dcCore::app()->addBehavior(
'adminModulesListGetActions',
function ($list, $id, $_) {
if (!in_array($list->getList(), [
return in_array($list->getList(), [
'plugin-activate',
'theme-activate',
])) {
return null;
}
return
'<input type="submit" name="tinypacker[' .
html::escapeHTML($id) . ']" value="Pack" />';
]) ? sprintf(
'<input type="submit" name="%s[%s]" value="Pack" />',
basename(__DIR__),
html::escapeHTML($id)
) : null;
}
);
@ -34,19 +32,14 @@ dcCore::app()->addBehavior(
'adminModulesListDoActions',
function ($list, $modules, $type) {
# Pack action
if (empty($_POST['tinypacker'])
|| !is_array($_POST['tinypacker'])) {
if (empty($_POST[basename(__DIR__)])
|| !is_array($_POST[basename(__DIR__)])) {
return null;
}
$modules = array_keys($_POST['tinypacker']);
$id = $modules[0];
# Repository directory
$dir = path::real(
dcCore::app()->blog->public_path . '/' . (
defined('TINYPACKER_SUBDIR') ? TINYPACKER_SUBDIR : 'packages'
),
dcCore::app()->blog->public_path . '/packages',
false
);
@ -58,6 +51,9 @@ dcCore::app()->addBehavior(
}
# Module to pack
$modules = array_keys($_POST[basename(__DIR__)]);
$id = $modules[0];
if (!$list->modules->moduleExists($id)) {
throw new Exception(__('No such module.'));
}

View File

@ -23,8 +23,8 @@ $this->registerModule(
'requires' => [['core', '2.24']],
'permissions' => null,
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/tinyPacker',
'details' => 'https://plugins.dotaddict.org/dc2/details/tinyPacker',
'repository' => 'https://raw.githubudsfsfdsfsercontent.com/JcDenis/tinyPacker/master/dcstore.xml',
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
]
);