tweakStores/_config.php

77 lines
2.7 KiB
PHP
Raw Normal View History

2021-08-26 22:38:34 +00:00
<?php
2021-09-27 22:46:41 +00:00
/**
* @brief tweakStores, a plugin for Dotclear 2
2021-11-04 23:43:37 +00:00
*
2021-09-27 22:46:41 +00:00
* @package Dotclear
* @subpackage Plugin
2021-11-04 23:43:37 +00:00
*
2021-09-27 22:46:41 +00:00
* @author Jean-Christian Denis and Contributors
2021-11-04 23:43:37 +00:00
*
2021-09-27 22:46:41 +00:00
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
2021-08-26 22:38:34 +00:00
if (!defined('DC_CONTEXT_MODULE')) {
return null;
}
2021-11-04 23:43:37 +00:00
dcPage::checkSuper();
$redir = empty($_REQUEST['redir']) ?
2022-11-14 22:52:56 +00:00
dcCore::app()->admin->list->getURL() . '#plugins' : $_REQUEST['redir'];
2021-08-26 22:38:34 +00:00
# -- Get settings --
2022-11-14 22:52:56 +00:00
dcCore::app()->blog->settings->addNamespace('tweakStores');
$s = dcCore::app()->blog->settings->tweakStores;
2021-08-26 22:38:34 +00:00
2021-11-04 23:43:37 +00:00
$tweakStores_active = $s->active;
$tweakStores_packman = $s->packman;
2021-08-26 22:38:34 +00:00
$tweakStores_file_pattern = $s->file_pattern;
# -- Set settings --
if (!empty($_POST['save'])) {
try {
2021-11-04 23:43:37 +00:00
$tweakStores_active = !empty($_POST['tweakStores_active']);
$tweakStores_packman = !empty($_POST['tweakStores_packman']);
2021-08-26 22:38:34 +00:00
$tweakStores_file_pattern = $_POST['tweakStores_file_pattern'];
$s->put('active', $tweakStores_active);
$s->put('packman', $tweakStores_packman);
$s->put('file_pattern', $tweakStores_file_pattern);
dcPage::addSuccessNotice(
2021-11-04 23:43:37 +00:00
__('Configuration successfully updated')
2021-08-26 22:38:34 +00:00
);
http::redirect(
2022-11-14 22:52:56 +00:00
dcCore::app()->admin->list->getURL('module=tweakStores&conf=1&redir=' . dcCore::app()->admin->list->getRedir())
2021-08-26 22:38:34 +00:00
);
} catch (Exception $e) {
2022-11-14 22:52:56 +00:00
dcCore::app()->error->add($e->getMessage());
2021-08-26 22:38:34 +00:00
}
}
# -- Display form --
echo '
<div class="fieldset">
<h4>' . __('Tweak store') . '</h4>
2021-09-27 22:46:41 +00:00
<p><label class="classic" for="tweakStores_active">' .
2021-08-26 22:38:34 +00:00
form::checkbox('tweakStores_active', 1, $tweakStores_active) . ' ' .
__('Enable plugin') . '</label></p>
2021-11-04 23:43:37 +00:00
<p class="form-note">' . __('If enabled, new tab "Tweak stores" allows your to perfom actions relative to third-party repositories.') . '</p>
2021-08-26 22:38:34 +00:00
2021-09-27 22:46:41 +00:00
<p><label class="classic" for="tweakStores_packman">' .
2021-08-26 22:38:34 +00:00
form::checkbox('tweakStores_packman', 1, $tweakStores_packman) . ' ' .
__('Enable packman behaviors') . '</label></p>
2021-11-04 23:43:37 +00:00
<p class="form-note">' . __('If enabled, plugin pacKman will (re)generate on the fly dcstore.xml file at root directory of the module.') . '</p>
2021-08-26 22:38:34 +00:00
2021-11-04 23:43:37 +00:00
<p><label class="classic" for="tweakStores_file_pattern">' . __('Predictable URL to zip file on the external repository') .
2021-08-26 22:38:34 +00:00
form::field('tweakStores_file_pattern', 65, 255, $tweakStores_file_pattern, 'maximal') . '
</label></p>
2021-11-04 23:43:37 +00:00
<p class="form-note">' .
2021-08-26 22:38:34 +00:00
__('You can use widcard like %author%, %type%, %id%, %version%.') . '<br /> ' .
2021-11-04 08:22:34 +00:00
__('For example on github https://github.com/MyGitName/%id%/releases/download/v%version%/%type%-%id%.zip') . '<br />' .
__('Note: on github, you must create a release and join to it the module zip file.') . '
2021-08-26 22:38:34 +00:00
</p>
2021-11-04 23:43:37 +00:00
</div>';