use abstract plugin name
This commit is contained in:
parent
f5c59b638c
commit
e322b2da16
2 changed files with 15 additions and 19 deletions
28
_admin.php
28
_admin.php
|
@ -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.'));
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
]
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue