use abstract plugin name
parent
cdb07748cb
commit
7572803b26
16
_admin.php
16
_admin.php
|
@ -14,22 +14,22 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||
return null;
|
||||
}
|
||||
|
||||
dcCore::app()->blog->settings->addNamespace('pacKman');
|
||||
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||
|
||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $favs): void {
|
||||
$favs->register('pacKman', [
|
||||
$favs->register(basename(__DIR__), [
|
||||
'title' => __('Packages repository'),
|
||||
'url' => dcCore::app()->adminurl->get('admin.plugin.pacKman') . '#packman-repository-repository',
|
||||
'small-icon' => [dcPage::getPF('pacKman/icon.svg'), dcPage::getPF('pacKman/icon-dark.svg')],
|
||||
'large-icon' => [dcPage::getPF('pacKman/icon.svg'), dcPage::getPF('pacKman/icon-dark.svg')],
|
||||
'url' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)) . '#packman-repository-repository',
|
||||
'small-icon' => [dcPage::getPF(basename(__DIR__) . '/icon.svg'), dcPage::getPF(basename(__DIR__) . '/icon-dark.svg')],
|
||||
'large-icon' => [dcPage::getPF(basename(__DIR__) . '/icon.svg'), dcPage::getPF(basename(__DIR__) . '/icon-dark.svg')],
|
||||
//'permissions' => dcCore::app()->auth->isSuperAdmin(),
|
||||
]);
|
||||
});
|
||||
|
||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||
__('Packages repository'),
|
||||
dcCore::app()->adminurl->get('admin.plugin.pacKman') . '#packman-repository-repository',
|
||||
[dcPage::getPF('pacKman/icon.svg'), dcPage::getPF('pacKman/icon-dark.svg')],
|
||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.pacKman')) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||
dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__)) . '#packman-repository-repository',
|
||||
[dcPage::getPF(basename(__DIR__) . '/icon.svg'), dcPage::getPF(basename(__DIR__) . '/icon-dark.svg')],
|
||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||
dcCore::app()->auth->isSuperAdmin()
|
||||
);
|
||||
|
|
|
@ -18,8 +18,8 @@ $redir = empty($_REQUEST['redir']) ?
|
|||
dcCore::app()->admin->__get('list')->getURL() . '#plugins' : $_REQUEST['redir'];
|
||||
|
||||
# -- Get settings --
|
||||
dcCore::app()->blog->settings->addNamespace('pacKman');
|
||||
$s = dcCore::app()->blog->settings->pacKman;
|
||||
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||
$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
|
||||
|
||||
$packman_pack_nocomment = $s->packman_pack_nocomment;
|
||||
$packman_pack_fixnewline = $s->packman_pack_fixnewline;
|
||||
|
@ -59,7 +59,7 @@ if (!empty($_POST['save'])) {
|
|||
__('Configuration has been successfully updated.')
|
||||
);
|
||||
http::redirect(
|
||||
dcCore::app()->admin->__get('list')->getURL('module=pacKman&conf=1&redir=' .
|
||||
dcCore::app()->admin->__get('list')->getURL('module=' . basename(__DIR__) . '&conf=1&redir=' .
|
||||
dcCore::app()->admin->__get('list')->getRedir())
|
||||
);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ $this->registerModule(
|
|||
'requires' => [['core', '2.24']],
|
||||
'permissions' => null,
|
||||
'type' => 'plugin',
|
||||
'support' => 'https://github.com/JcDenis/pacKman',
|
||||
'details' => 'https://plugins.dotaddict.org/dc2/details/pacKman',
|
||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/pacKman/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',
|
||||
]
|
||||
);
|
||||
|
|
|
@ -14,15 +14,13 @@ if (!defined('DC_CONTEXT_ADMIN')) {
|
|||
return null;
|
||||
}
|
||||
|
||||
$mod_id = 'pacKman';
|
||||
|
||||
$this->addUserAction(
|
||||
/* type */
|
||||
'settings',
|
||||
/* action */
|
||||
'delete_all',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
basename(__DIR__),
|
||||
/* desc */
|
||||
__('delete all settings')
|
||||
);
|
||||
|
@ -33,7 +31,7 @@ $this->addUserAction(
|
|||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
basename(__DIR__),
|
||||
/* desc */
|
||||
__('delete plugin files')
|
||||
);
|
||||
|
@ -44,7 +42,7 @@ $this->addUserAction(
|
|||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
basename(__DIR__),
|
||||
/* desc */
|
||||
__('delete the version number')
|
||||
);
|
||||
|
@ -55,9 +53,9 @@ $this->addDirectAction(
|
|||
/* action */
|
||||
'delete_all',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
basename(__DIR__),
|
||||
/* desc */
|
||||
sprintf(__('delete all %s settings'), $mod_id)
|
||||
sprintf(__('delete all %s settings'), basename(__DIR__))
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
|
@ -66,9 +64,9 @@ $this->addDirectAction(
|
|||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
basename(__DIR__),
|
||||
/* desc */
|
||||
sprintf(__('delete %s plugin files'), $mod_id)
|
||||
sprintf(__('delete %s plugin files'), basename(__DIR__))
|
||||
);
|
||||
|
||||
$this->addDirectAction(
|
||||
|
@ -77,7 +75,7 @@ $this->addDirectAction(
|
|||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
$mod_id,
|
||||
basename(__DIR__),
|
||||
/* desc */
|
||||
sprintf(__('delete %s version number'), $mod_id)
|
||||
sprintf(__('delete %s version number'), basename(__DIR__))
|
||||
);
|
||||
|
|
|
@ -127,7 +127,7 @@ class libPackman
|
|||
html::escapeHTML($_REQUEST['redir'])
|
||||
) : ''
|
||||
) .
|
||||
form::hidden(['p'], 'pacKman') .
|
||||
form::hidden(['p'], basename(dirname('../' . __DIR__))) .
|
||||
form::hidden(['type'], $type) .
|
||||
form::hidden(['action'], 'packup') .
|
||||
'<input type="submit" name="packup" value="' .
|
||||
|
@ -203,8 +203,11 @@ class libPackman
|
|||
__(html::escapeHTML($module['name'])) .
|
||||
'</td>' .
|
||||
'<td class="nowrap">' .
|
||||
'<a class="packman-download" href="plugin.php?p=pacKman&package=' .
|
||||
basename($module['root']) . '&repo=' . $type . '" title="' . __('Download') . '">' .
|
||||
'<a class="packman-download" href="' .
|
||||
dcCore::app()->adminurl->get('admin.plugin.' . basename(dirname('../' . __DIR__)), [
|
||||
'package' => basename($module['root']),
|
||||
'repo' => $type,
|
||||
]) . '" title="' . __('Download') . '">' .
|
||||
html::escapeHTML(basename($module['root'])) . '</a>' .
|
||||
'</td>' .
|
||||
'</tr>';
|
||||
|
@ -217,7 +220,7 @@ class libPackman
|
|||
'<p class="col right">' . __('Selected modules action:') . ' ' .
|
||||
form::combo(['action'], $combo_action) .
|
||||
'<input type="submit" name="packup" value="' . __('ok') . '" />' .
|
||||
form::hidden(['p'], 'pacKman') .
|
||||
form::hidden(['p'], basename(dirname('../' . __DIR__))) .
|
||||
form::hidden(['tab'], 'repository') .
|
||||
form::hidden(['type'], $type) .
|
||||
dcCore::app()->formNonce() .
|
||||
|
|
18
index.php
18
index.php
|
@ -21,8 +21,8 @@ $action = $_POST['action'] ?? '';
|
|||
$type = isset($_POST['type']) && in_array($_POST['type'], ['plugins', 'themes', 'repository']) ? $_POST['type'] : '';
|
||||
|
||||
# Settings
|
||||
dcCore::app()->blog->settings->addNamespace('pacKman');
|
||||
$s = dcCore::app()->blog->settings->pacKman;
|
||||
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
|
||||
$s = dcCore::app()->blog->settings->__get(basename(__DIR__));
|
||||
|
||||
# Modules
|
||||
if (!(dcCore::app()->themes instanceof dcThemes)) {
|
||||
|
@ -133,7 +133,7 @@ try {
|
|||
if (!empty($_POST['redir'])) {
|
||||
http::redirect($_POST['redir']);
|
||||
} else {
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-' . $type);
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__DIR__), [], '#packman-' . $type);
|
||||
}
|
||||
|
||||
# Delete
|
||||
|
@ -153,7 +153,7 @@ try {
|
|||
if (!empty($_POST['redir'])) {
|
||||
http::redirect($_POST['redir']);
|
||||
} else {
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__DIR__), [], '#packman-repository-' . $type);
|
||||
}
|
||||
|
||||
# Install
|
||||
|
@ -180,7 +180,7 @@ try {
|
|||
if (!empty($_POST['redir'])) {
|
||||
http::redirect($_POST['redir']);
|
||||
} else {
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__DIR__), [], '#packman-repository-' . $type);
|
||||
}
|
||||
|
||||
# Copy
|
||||
|
@ -206,7 +206,7 @@ try {
|
|||
if (!empty($_POST['redir'])) {
|
||||
http::redirect($_POST['redir']);
|
||||
} else {
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__DIR__), [], '#packman-repository-' . $type);
|
||||
}
|
||||
|
||||
# Move
|
||||
|
@ -233,7 +233,7 @@ try {
|
|||
if (!empty($_POST['redir'])) {
|
||||
http::redirect($_POST['redir']);
|
||||
} else {
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.pacKman', [], '#packman-repository-' . $type);
|
||||
dcCore::app()->adminurl->redirect('admin.plugin.' . basename(__DIR__), [], '#packman-repository-' . $type);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
@ -244,7 +244,7 @@ try {
|
|||
echo
|
||||
'<html><head><title>' . __('pacKman') . '</title>' .
|
||||
dcPage::jsPageTabs() .
|
||||
dcPage::jsLoad(dcPage::getPF('pacKman/js/packman.js'));
|
||||
dcPage::jsLoad(dcPage::getPF(basename(__DIR__) . '/js/packman.js'));
|
||||
|
||||
# --BEHAVIOR-- packmanAdminHeader
|
||||
dcCore::app()->callBehavior('packmanAdminHeader');
|
||||
|
@ -261,7 +261,7 @@ dcPage::notices();
|
|||
if (dcCore::app()->error->flag() || !$is_configured) {
|
||||
echo
|
||||
'<div class="warning">' . __('pacKman is not well configured.') . ' ' .
|
||||
'<a href="' . dcCore::app()->adminurl->get('admin.plugins', ['module' => 'pacKman', 'conf' => '1', 'redir' => dcCore::app()->adminurl->get('admin.plugin.pacKman')]) . '">' . __('Configuration') . '</a>' .
|
||||
'<a href="' . dcCore::app()->adminurl->get('admin.plugins', ['module' => basename(__DIR__), 'conf' => '1', 'redir' => dcCore::app()->adminurl->get('admin.plugin.' . basename(__DIR__))]) . '">' . __('Configuration') . '</a>' .
|
||||
'</div>';
|
||||
} else {
|
||||
$repo_path_modules = array_merge(
|
||||
|
|
Loading…
Reference in New Issue