fix previously introduced unix bug
This commit is contained in:
parent
3d1f4694d5
commit
f6e93f6589
3 changed files with 19 additions and 15 deletions
|
@ -27,6 +27,7 @@ use Exception;
|
|||
|
||||
class Admin
|
||||
{
|
||||
private static $pid = '';
|
||||
protected static $init = false;
|
||||
|
||||
public static function init(): bool
|
||||
|
@ -36,6 +37,7 @@ class Admin
|
|||
&& dcCore::app()->blog->settings->get(basename(__NAMESPACE__))->get('active')
|
||||
) {
|
||||
dcCore::app()->auth->user_prefs->addWorkspace('interface');
|
||||
self::$pid = basename(dirname(__DIR__));
|
||||
self::$init = true;
|
||||
}
|
||||
|
||||
|
@ -48,10 +50,10 @@ class Admin
|
|||
return false;
|
||||
}
|
||||
|
||||
if (dcCore::app()->blog->settings->get(basename(__NAMESPACE__))->get('packman')) {
|
||||
if (dcCore::app()->blog->settings->get(self::$pid)->get('packman')) {
|
||||
// create dcstore.xml file on the fly when plugin packman pack a module
|
||||
dcCore::app()->addBehavior('packmanBeforeCreatePackage', function (array $module): void {
|
||||
Core::writeXML($module['id'], $module, dcCore::app()->blog->settings->get(basename(__NAMESPACE__))->get('file_pattern'));
|
||||
Core::writeXML($module['id'], $module, dcCore::app()->blog->settings->get(self::$pid)->get('file_pattern'));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -76,21 +78,21 @@ class Admin
|
|||
{
|
||||
return
|
||||
dcPage::jsJson('ts_copied', ['alert' => __('Copied to clipboard')]) .
|
||||
dcPage::jsModuleLoad(basename(__NAMESPACE__) . '/js/admin.js') .
|
||||
dcPage::jsModuleLoad(self::$pid . '/js/admin.js') .
|
||||
(
|
||||
!dcCore::app()->auth->user_prefs->interface->colorsyntax ? '' :
|
||||
dcPage::jsLoadCodeMirror(dcCore::app()->auth->user_prefs->interface->colorsyntax_theme) .
|
||||
dcPage::jsModuleLoad(basename(__NAMESPACE__) . '/js/cms.js')
|
||||
dcPage::jsModuleLoad(self::$pid . '/js/cms.js')
|
||||
);
|
||||
}
|
||||
|
||||
protected static function modulesToolsTabs(array $modules, array $excludes, string $page_url): void
|
||||
{
|
||||
$page_url .= '#' . basename(__NAMESPACE__);
|
||||
$page_url .= '#' . self::$pid;
|
||||
$user_ui_colorsyntax = dcCore::app()->auth->user_prefs->interface->colorsyntax;
|
||||
$user_ui_colorsyntax_theme = dcCore::app()->auth->user_prefs->interface->colorsyntax_theme;
|
||||
$combo = self::comboModules($modules, $excludes);
|
||||
$file_pattern = dcCore::app()->blog->settings->get(basename(__NAMESPACE__))->get('file_pattern');
|
||||
$file_pattern = dcCore::app()->blog->settings->get(self::$pid)->get('file_pattern');
|
||||
|
||||
# check dcstore repo
|
||||
$url = '';
|
||||
|
@ -139,7 +141,7 @@ class Admin
|
|||
}
|
||||
}
|
||||
echo
|
||||
'<div class="multi-part" id="' . basename(__NAMESPACE__) . '" title="' . dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') . '">' .
|
||||
'<div class="multi-part" id="' . self::$pid . '" title="' . dcCore::app()->plugins->moduleInfo(self::$pid, 'name') . '">' .
|
||||
'<h3>' . __('Tweak third-party repositories') . '</h3>';
|
||||
|
||||
if (!empty($_POST['write_xml'])) {
|
||||
|
@ -191,7 +193,7 @@ class Admin
|
|||
if (empty($file_pattern)) {
|
||||
echo sprintf(
|
||||
'<div class="fieldset"><h4>' . __('Generate xml code') . '</h4><p class="info"><a href="%s">%s</a></p></div>',
|
||||
dcCore::app()->adminurl->get('admin.plugins', ['module' => basename(__NAMESPACE__), 'conf' => 1, 'redir' => $page_url]),
|
||||
dcCore::app()->adminurl->get('admin.plugins', ['module' => self::$pid, 'conf' => 1, 'redir' => $page_url]),
|
||||
__('You must configure zip file pattern to complete xml code automatically.')
|
||||
);
|
||||
} else {
|
||||
|
@ -248,13 +250,13 @@ class Admin
|
|||
]
|
||||
) . '</p>' .
|
||||
'<p><input type="submit" name="write_xml" value="' . __('Save to module directory') . '" /> ' .
|
||||
'<a class="hidden-if-no-js button" href="#' . basename(__NAMESPACE__) . '" id="ts_copy_button">' . __('Copy to clipboard') . '</a>' .
|
||||
'<a class="hidden-if-no-js button" href="#' . self::$pid . '" id="ts_copy_button">' . __('Copy to clipboard') . '</a>' .
|
||||
form::hidden('buildxml_id', $_POST['buildxml_id']) .
|
||||
dcCore::app()->formNonce() . '</p>';
|
||||
}
|
||||
echo sprintf(
|
||||
'<p class="info"><a href="%s">%s</a></p>',
|
||||
dcCore::app()->adminurl->get('admin.plugins', ['module' => basename(__NAMESPACE__), 'conf' => 1, 'redir' => $page_url]),
|
||||
dcCore::app()->adminurl->get('admin.plugins', ['module' => self::$pid, 'conf' => 1, 'redir' => $page_url]),
|
||||
__('You can edit zip file pattern from configuration page.')
|
||||
);
|
||||
}
|
||||
|
|
|
@ -27,12 +27,14 @@ use Exception;
|
|||
|
||||
class Config
|
||||
{
|
||||
private static $pid = '';
|
||||
protected static $init = false;
|
||||
|
||||
public static function init(): bool
|
||||
{
|
||||
if (defined('DC_CONTEXT_ADMIN') && defined('DC_CONTEXT_MODULE')) {
|
||||
dcPage::checkSuper();
|
||||
self::$pid = basename(dirname(__DIR__));
|
||||
self::$init = true;
|
||||
}
|
||||
|
||||
|
@ -50,7 +52,7 @@ class Config
|
|||
}
|
||||
|
||||
try {
|
||||
$s = dcCore::app()->blog->settings->get(basename(__NAMESPACE__));
|
||||
$s = dcCore::app()->blog->settings->get(self::$pid);
|
||||
$s->put('active', !empty($_POST['s_active']));
|
||||
$s->put('packman', !empty($_POST['s_packman']));
|
||||
$s->put('file_pattern', $_POST['s_file_pattern']);
|
||||
|
@ -59,7 +61,7 @@ class Config
|
|||
__('Configuration successfully updated')
|
||||
);
|
||||
http::redirect(
|
||||
dcCore::app()->admin->__get('list')->getURL('module=' . basename(__NAMESPACE__) . '&conf=1&redir=' . dcCore::app()->admin->__get('list')->getRedir())
|
||||
dcCore::app()->admin->__get('list')->getURL('module=' . self::$pid . '&conf=1&redir=' . dcCore::app()->admin->__get('list')->getRedir())
|
||||
);
|
||||
|
||||
return true;
|
||||
|
@ -72,11 +74,11 @@ class Config
|
|||
|
||||
public static function render(): void
|
||||
{
|
||||
$s = dcCore::app()->blog->settings->get(basename(__NAMESPACE__));
|
||||
$s = dcCore::app()->blog->settings->get(self::$pid);
|
||||
|
||||
echo '
|
||||
<div class="fieldset">
|
||||
<h4>' . dcCore::app()->plugins->moduleInfo(basename(__NAMESPACE__), 'name') . '</h4>
|
||||
<h4>' . dcCore::app()->plugins->moduleInfo(self::$pid, 'name') . '</h4>
|
||||
|
||||
<p><label class="classic" for="s_active">' .
|
||||
form::checkbox('s_active', 1, (bool) $s->get('active')) . ' ' .
|
||||
|
|
|
@ -41,7 +41,7 @@ class Prepend
|
|||
|
||||
foreach (self::LIBS as $lib) {
|
||||
Clearbricks::lib()->autoload([
|
||||
implode('\\', ['Dotclear','Plugin', basename(__NAMESPACE__), $lib]) => __DIR__ . DIRECTORY_SEPARATOR . $lib . '.php',
|
||||
__NAMESPACE__ . '\\' . $lib => __DIR__ . DIRECTORY_SEPARATOR . $lib . '.php',
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue