Compare commits

..

3 Commits

6 changed files with 21 additions and 16 deletions

View File

@ -1,3 +1,9 @@
disclaimer 1.5.1 - 2023.11.04
===========================================================
* Require dotclear 2.28
* Require PHP 8.1
* Use last changes form Dotclear 2.28
disclaimer 1.5 - 2023.10.15
===========================================================
* Require dotclear 2.28

View File

@ -1,7 +1,7 @@
# README
[![Release](https://img.shields.io/badge/release-1.5-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/disclaimer/releases)
![Date](https://img.shields.io/badge/date-2023.10.15-c44d58.svg)
[![Release](https://img.shields.io/badge/release-1.5.1-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/disclaimer/releases)
![Date](https://img.shields.io/badge/date-2023.11.04-c44d58.svg)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/disclaimer)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/disclaimer/src/branch/master/LICENSE)

View File

@ -17,7 +17,7 @@ $this->registerModule(
'Disclaimer',
'Add a disclaimer to your blog entrance',
'Jean-Christian Denis, Pierre Van Glabeke',
'1.5',
'1.5.1',
[
'requires' => [['core', '2.28']],
'permissions' => 'My',

View File

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="disclaimer">
<name>Disclaimer</name>
<version>1.5</version>
<version>1.5.1</version>
<author>Jean-Christian Denis, Pierre Van Glabeke</author>
<desc>Add a disclaimer to your blog entrance</desc>
<file>https://git.dotclear.watch/JcDenis/disclaimer/releases/download/v1.5/plugin-disclaimer.zip</file>
<file>https://git.dotclear.watch/JcDenis/disclaimer/releases/download/v1.5.1/plugin-disclaimer.zip</file>
<da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/disclaimer/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/disclaimer/issues</da:support>

View File

@ -6,7 +6,6 @@ namespace Dotclear\Plugin\disclaimer;
use ArrayObject;
use Dotclear\App;
use Dotclear\Core\BlogSettings;
use Dotclear\Core\Process;
use Dotclear\Helper\Html\Form\{
Checkbox,
@ -19,6 +18,7 @@ use Dotclear\Helper\Html\Form\{
Textarea
};
use Dotclear\Helper\Html\Html;
use Dotclear\Interface\Core\BlogSettingsInterface;
use Exception;
/**
@ -42,7 +42,7 @@ class Backend extends Process
}
App::behavior()->addBehaviors([
'adminBeforeBlogSettingsUpdate' => function (BlogSettings $blog_settings): void {
'adminBeforeBlogSettingsUpdate' => function (BlogSettingsInterface $blog_settings): void {
$s = $blog_settings->get(My::id());
try {
@ -69,7 +69,7 @@ class Backend extends Process
}
},
'adminBlogPreferencesFormV2' => function (BlogSettings $blog_settings): void {
'adminBlogPreferencesFormV2' => function (BlogSettingsInterface $blog_settings): void {
$s = $blog_settings->get(My::id());
$disclaimer_bots_agents = $s->get('disclaimer_bots_agents');
@ -87,7 +87,7 @@ class Backend extends Process
]),
(new Para())->items([
(new Label(__('Title:')))->for('disclaimer_title'),
(new Input('disclaimer_title'))->size(30)->maxlenght(255)->value(Html::escapeHTML((string) $s->get('disclaimer_title'))),
(new Input('disclaimer_title'))->size(30)->maxlength(255)->value(Html::escapeHTML((string) $s->get('disclaimer_title'))),
]),
]),
(new Div())->class('two-boxes odd')->items([
@ -97,7 +97,7 @@ class Backend extends Process
]),
(new Para())->items([
(new Label(__('Link output:')))->for('disclaimer_redir'),
(new Input('disclaimer_redir'))->size(30)->maxlenght(255)->value(Html::escapeHTML((string) $s->get('disclaimer_redir'))),
(new Input('disclaimer_redir'))->size(30)->maxlength(255)->value(Html::escapeHTML((string) $s->get('disclaimer_redir'))),
]),
(new Note())->class('form-note')->text(__('Leave blank to redirect to the site Dotclear')),
]),
@ -108,7 +108,7 @@ class Backend extends Process
]),
(new Para())->items([
(new Label(__('List of robots allowed to index the site pages (separated by semicolons):')))->for('disclaimer_bots_agents'),
(new Input('disclaimer_bots_agents'))->size(120)->maxlenght(255)->value(Html::escapeHTML($disclaimer_bots_agents)),
(new Input('disclaimer_bots_agents'))->size(120)->maxlength(255)->value(Html::escapeHTML($disclaimer_bots_agents)),
]),
(new Para())->items([
(new Checkbox('disclaimer_bots_unactive', (bool) $s->get('disclaimer_bots_unactive')))->value(1),

View File

@ -61,12 +61,11 @@ class UrlHandler extends Url
}
# Set default-templates path for disclaimer files
$tplset = App::themes()->moduleInfo(App::blog()->settings()->get('system')->get('theme'), 'tplset');
if (!empty($tplset) && is_dir(My::path() . '/default-templates/' . $tplset)) {
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), My::path() . '/default-templates/' . $tplset);
} else {
App::frontend()->template()->setPath(App::frontend()->template()->getPath(), My::path() . '/default-templates/' . App::config()->defaultTplset());
$tplset = App::themes()->getDefine(App::blog()->settings()->get('system')->get('theme'))->get('tplset');
if (empty($tplset) || !is_dir(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]))) {
$tplset = App::config()->defaultTplset();
}
App::frontend()->template()->appendPath(implode(DIRECTORY_SEPARATOR, [My::path(), 'default-templates', $tplset]));
# New URL handler
$urlHandler = new HelperHandler();