2021-08-18 22:51:40 +00:00
|
|
|
<?php
|
2021-09-02 21:44:01 +00:00
|
|
|
/**
|
|
|
|
* @brief translater, a plugin for Dotclear 2
|
2021-11-01 21:32:32 +00:00
|
|
|
*
|
2021-09-02 21:44:01 +00:00
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
2021-11-01 21:32:32 +00:00
|
|
|
*
|
2021-09-02 21:44:01 +00:00
|
|
|
* @author Jean-Christian Denis & contributors
|
2021-11-01 21:32:32 +00:00
|
|
|
*
|
2021-09-02 21:44:01 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2021-08-18 22:51:40 +00:00
|
|
|
if (!defined('DC_CONTEXT_MODULE')) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-11-13 17:40:31 +00:00
|
|
|
$translater = new dcTranslater();
|
2021-08-18 22:51:40 +00:00
|
|
|
|
2021-08-19 20:29:52 +00:00
|
|
|
if (!empty($_POST['save'])) {
|
2021-09-24 23:58:59 +00:00
|
|
|
try {
|
2021-11-09 22:58:45 +00:00
|
|
|
foreach ($translater->getDefaultSettings() as $key => $value) {
|
|
|
|
$translater->$key = $_POST[$key] ?? '';
|
2021-09-24 23:58:59 +00:00
|
|
|
}
|
2021-11-09 22:58:45 +00:00
|
|
|
$translater->writeSettings();
|
2022-11-13 17:40:31 +00:00
|
|
|
dcAdminNotices::addSuccessNotice(
|
2021-09-24 23:58:59 +00:00
|
|
|
__('Configuration successfully updated.')
|
|
|
|
);
|
2022-11-13 17:40:31 +00:00
|
|
|
dcCore::app()->adminurl->redirect(
|
2021-11-01 21:32:32 +00:00
|
|
|
'admin.plugins',
|
2022-11-13 17:40:31 +00:00
|
|
|
['module' => 'translater', 'conf' => 1, 'redir' => dcCore::app()->admin->list->getRedir()]
|
2021-09-24 23:58:59 +00:00
|
|
|
);
|
|
|
|
} catch (Exception $e) {
|
2022-11-13 17:40:31 +00:00
|
|
|
dcCore::app()->error->add($e->getMessage());
|
2021-09-24 23:58:59 +00:00
|
|
|
}
|
2021-08-18 22:51:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
2021-09-24 23:58:59 +00:00
|
|
|
<div class="fieldset"><h4>' . __('Translation') . '</h4>
|
|
|
|
<p><label for="write_langphp">' .
|
|
|
|
form::checkbox('write_langphp', '1', $translater->write_langphp) .
|
|
|
|
__('Write .lang.php files') . '</label></p>
|
|
|
|
<p><label for="scan_tpl">' .
|
|
|
|
form::checkbox('scan_tpl', '1', $translater->scan_tpl) .
|
|
|
|
__('Translate also strings of template files') . '</label></p>
|
2021-11-01 21:32:32 +00:00
|
|
|
<p><label for="parse_nodc">' .
|
2021-09-24 23:58:59 +00:00
|
|
|
form::checkbox('parse_nodc', '1', $translater->parse_nodc) .
|
|
|
|
__('Translate only unknow strings') . '</label></p>
|
|
|
|
<p><label for="hide_default">' .
|
|
|
|
form::checkbox('hide_default', '1', $translater->hide_default) .
|
|
|
|
__('Hide default modules of Dotclear') . '</label></p>
|
|
|
|
<p><label for="parse_comment">' .
|
|
|
|
form::checkbox('parse_comment', '1', $translater->parse_comment) .
|
|
|
|
__('Write comments in files') . '</label></p>
|
|
|
|
<p><label for="parse_user">' .
|
2021-11-01 21:32:32 +00:00
|
|
|
form::checkbox('parse_user', '1', $translater->parse_user) .
|
2021-09-24 23:58:59 +00:00
|
|
|
__('Write informations about author in files') . '</label></p>
|
|
|
|
<p><label for="parse_userinfo">' . __('User info:') . '</label>' .
|
|
|
|
form::field('parse_userinfo', 65, 255, $translater->parse_userinfo) . '</p>
|
|
|
|
<p class="form-note">' . sprintf(
|
2021-11-01 21:32:32 +00:00
|
|
|
__('Following informations can be used: %s'),
|
|
|
|
implode(', ', $translater::$allowed_user_informations)
|
|
|
|
) . '
|
2021-09-24 23:58:59 +00:00
|
|
|
</p>
|
2021-08-18 22:51:40 +00:00
|
|
|
</div>
|
|
|
|
|
2021-09-24 23:58:59 +00:00
|
|
|
<div class="fieldset"><h4>' . __('Import/Export') . '</h4>
|
2021-11-01 21:32:32 +00:00
|
|
|
<p><label for="import_overwrite">' .
|
|
|
|
form::checkbox('import_overwrite', '1', $translater->import_overwrite) .
|
2021-09-24 23:58:59 +00:00
|
|
|
__('Overwrite existing languages') . '</label></p>
|
|
|
|
<p><label for="export_filename">' . __('Name of exported package:') . '</label>' .
|
|
|
|
form::field('export_filename', 65, 255, $translater->export_filename) . '</p>
|
2021-08-18 22:51:40 +00:00
|
|
|
</div>
|
|
|
|
|
2021-09-24 23:58:59 +00:00
|
|
|
<div class="fieldset"><h4>' . __('Backups') . '</h4>
|
|
|
|
<p><label for="backup_auto">' .
|
|
|
|
form::checkbox('backup_auto', '1', $translater->backup_auto) .
|
|
|
|
__('Make backups when changes are made') . '</label></p>
|
2021-11-01 21:32:32 +00:00
|
|
|
<p><label for="backup_limit" class="classic">' . sprintf(
|
|
|
|
__('Limit backups to %s files per module'),
|
|
|
|
form::number('backup_limit', ['min' => 0, 'max' => 50, 'default' => $translater->backup_limit])
|
|
|
|
) . '</label></p>
|
2022-12-26 20:27:16 +00:00
|
|
|
<p class="form-note">' . __('Set to 0 for no limit.') . '</p>
|
2021-09-24 23:58:59 +00:00
|
|
|
<p><label for="backup_folder">' . __('Store backups in:') . '</label>' .
|
|
|
|
form::combo('backup_folder', $translater::$allowed_backup_folders, $translater->backup_folder) . '</p>
|
2021-08-18 22:51:40 +00:00
|
|
|
</div>
|
|
|
|
|
2021-09-24 23:58:59 +00:00
|
|
|
<div class="fieldset"><h4>' . __('Behaviors') . '</h4>
|
2021-11-01 21:32:32 +00:00
|
|
|
<p><label for="start_page">' . __('Default start menu:') . '</label>' .
|
|
|
|
form::combo('start_page', [
|
|
|
|
__('Plugins') => 'plugin',
|
|
|
|
__('Themes') => 'theme',
|
2022-11-13 17:40:31 +00:00
|
|
|
__('Home') => '-',
|
2021-09-24 23:58:59 +00:00
|
|
|
], $translater->start_page) . '</p>
|
2021-11-01 21:32:32 +00:00
|
|
|
<p><label for="plugin_menu">' .
|
2021-09-24 23:58:59 +00:00
|
|
|
form::checkbox('plugin_menu', '1', $translater->plugin_menu) .
|
2021-09-25 14:32:04 +00:00
|
|
|
__('Enable menu on plugins page') . '</label></p>
|
2021-11-01 21:32:32 +00:00
|
|
|
<p><label for="theme_menu">' .
|
2021-09-24 23:58:59 +00:00
|
|
|
form::checkbox('theme_menu', '1', $translater->theme_menu) .
|
|
|
|
__('Enable menu on themes page') . '</label></p>
|
2021-09-26 22:32:16 +00:00
|
|
|
</div>';
|
|
|
|
|
2021-11-01 21:32:32 +00:00
|
|
|
dcPage::helpBlock('translater.config');
|