diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ecbef5..6e1347c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +enhancePostContent 2023.10.16 +=========================================================== +* Require Dotclear 2.28 +* Require PHP 8.1 +* Code review + enhancePostContent 2023.10.13 =========================================================== * Require Dotclear 2.28 diff --git a/README.md b/README.md index 7bf7f4f..078b4c3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # README -[![Release](https://img.shields.io/badge/release-2023.10.13-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/enhancePostContent/releases) -![Date](https://img.shields.io/badge/date-2023.10.13-c44d58.svg) +[![Release](https://img.shields.io/badge/release-2023.10.16-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/enhancePostContent/releases) +![Date](https://img.shields.io/badge/date-2023.10.16-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/enhancePostContent) [![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/enhancePostContent/src/branch/master/LICENSE) @@ -14,10 +14,10 @@ _enhancePostContent_ is a plugin for the open-source web publishing software cal ## REQUIREMENTS -* admin permissions to set up plugin -* content admin permissions to manage fitlers * Dotclear 2.28 * PHP 8.1+ +* Dotclear admin permissions to set up plugin +* Dotclear content admin permissions to manage fitlers ## USAGE diff --git a/_define.php b/_define.php index 8d4e000..064c678 100644 --- a/_define.php +++ b/_define.php @@ -9,14 +9,13 @@ * Add features to words in post content. * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ $this->registerModule( 'Enhance post content', 'Add features to words in post content', 'Jean-Christian Denis and Contributors', - '2023.10.13', + '2023.10.16', [ 'type' => 'plugin', 'requires' => [['core', '2.28']], diff --git a/dcstore.xml b/dcstore.xml index 04c4fe3..143811f 100644 --- a/dcstore.xml +++ b/dcstore.xml @@ -2,10 +2,10 @@ Enhance post content - 2023.10.13 + 2023.10.16 Jean-Christian Denis and Contributors Add features to words in post content - https://git.dotclear.watch/JcDenis/enhancePostContent/releases/download/v2023.10.13/plugin-enhancePostContent.zip + https://git.dotclear.watch/JcDenis/enhancePostContent/releases/download/v2023.10.16/plugin-enhancePostContent.zip 2.28 https://git.dotclear.watch/JcDenis/enhancePostContent/src/branch/master/README.md https://git.dotclear.watch/JcDenis/enhancePostContent/issues diff --git a/locales/en/resources.php b/locales/en/resources.php index 7e6c726..4542ffc 100644 --- a/locales/en/resources.php +++ b/locales/en/resources.php @@ -1,17 +1,10 @@ resources['help']['enhancePostContent'] = __DIR__ . '/help/help.html'; +\Dotclear\App::backend()->resources()->set('help', 'enhancePostContent', __DIR__ . '/help/help.html'); diff --git a/locales/fr/resources.php b/locales/fr/resources.php index 7e6c726..4542ffc 100644 --- a/locales/fr/resources.php +++ b/locales/fr/resources.php @@ -1,17 +1,10 @@ resources['help']['enhancePostContent'] = __DIR__ . '/help/help.html'; +\Dotclear\App::backend()->resources()->set('help', 'enhancePostContent', __DIR__ . '/help/help.html'); diff --git a/src/Backend.php b/src/Backend.php index 07e23e4..08fe92c 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -7,7 +7,6 @@ namespace Dotclear\Plugin\enhancePostContent; use ArrayObject; use Dotclear\App; use Dotclear\Core\Backend\Favorites; -use Dotclear\Core\BlogSettings; use Dotclear\Core\Process; use Dotclear\Helper\Html\Form\{ Checkbox, @@ -19,13 +18,13 @@ use Dotclear\Helper\Html\Form\{ Para, Text }; +use Dotclear\Interface\Core\BlogSettingsInterface; /** - * @brief enhancePostContent backend class. - * @ingroup enhancePostContent + * @brief enhancePostContent backend class. + * @ingroup enhancePostContent * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class Backend extends Process @@ -55,7 +54,7 @@ class Backend extends Process ]); }, // backend user preference form - 'adminBlogPreferencesFormV2' => function (BlogSettings $blog_settings): void { + 'adminBlogPreferencesFormV2' => function (BlogSettingsInterface $blog_settings): void { $active = (bool) $blog_settings->get(My::id())->get('active'); $allowedtplvalues = Epc::blogAllowedTemplateValue(); $allowedpubpages = Epc::blogAllowedTemplatePage(); @@ -121,7 +120,7 @@ class Backend extends Process ->render(); }, // backend user preference save - 'adminBeforeBlogSettingsUpdate' => function (BlogSettings $blog_settings): void { + 'adminBeforeBlogSettingsUpdate' => function (BlogSettingsInterface $blog_settings): void { $active = !empty($_POST['epc_active']); $allowedtplvalues = Epc::decodeMulti($_POST['epc_allowedtplvalues']); $allowedpubpages = Epc::decodeMulti($_POST['epc_allowedpubpages']); @@ -146,7 +145,7 @@ class Backend extends Process ]; }, // widgets registration - 'initWidgets' => [Widgets::class, 'initWidgets'], + 'initWidgets' => Widgets::initWidgets(...), ]); return true; diff --git a/src/BackendList.php b/src/BackendList.php index ac8c1b9..fd9d5df 100644 --- a/src/BackendList.php +++ b/src/BackendList.php @@ -14,11 +14,10 @@ use Dotclear\Helper\Html\Form\Checkbox; use Dotclear\Helper\Html\Html; /** - * @brief enhancePostContent filters list class. - * @ingroup enhancePostContent + * @brief enhancePostContent filters list class. + * @ingroup enhancePostContent * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class BackendList extends Listing diff --git a/src/Epc.php b/src/Epc.php index 10701b6..2dadd1a 100644 --- a/src/Epc.php +++ b/src/Epc.php @@ -1,15 +1,5 @@ [ 'id' => 'entryexcerpt', - 'cb' => [self::class, 'widgetContentEntryExcerpt'], + 'cb' => self::widgetContentEntryExcerpt(...), ], 'entry content' => [ 'id' => 'entrycontent', - 'cb' => [self::class, 'widgetContentEntryContent'], + 'cb' => self::widgetContentEntryContent(...), ], 'comment content' => [ 'id' => 'commentcontent', - 'cb' => [self::class, 'widgetContentCommentContent'], + 'cb' => self::widgetContentCommentContent(...), ], ]); diff --git a/src/EpcFilter.php b/src/EpcFilter.php index e5323a1..adbe79b 100644 --- a/src/EpcFilter.php +++ b/src/EpcFilter.php @@ -10,13 +10,12 @@ use Dotclear\Plugin\widgets\WidgetsElement; use Exception; /** - * @brief enhancePostContent abstract filter class. - * @ingroup enhancePostContent + * @brief enhancePostContent abstract filter class. + * @ingroup enhancePostContent * * All filter must extends this class. * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ abstract class EpcFilter diff --git a/src/EpcFilters.php b/src/EpcFilters.php index 374cad5..cf95f08 100644 --- a/src/EpcFilters.php +++ b/src/EpcFilters.php @@ -5,18 +5,21 @@ declare(strict_types=1); namespace Dotclear\Plugin\enhancePostContent; /** - * @brief enhancePostContent filters stack. - * @ingroup enhancePostContent + * @brief enhancePostContent filters stack. + * @ingroup enhancePostContent * * Use Epc::getFilters() to get loaded stack * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class EpcFilters { - /** @var array $satck The filters stack */ + /** + * The filters stack. + * + * @var array $stack + */ private array $stack = []; /** diff --git a/src/EpcRecord.php b/src/EpcRecord.php index 0ffb4be..94a0435 100644 --- a/src/EpcRecord.php +++ b/src/EpcRecord.php @@ -12,11 +12,10 @@ use Dotclear\Database\{ use Exception; /** - * @brief enhancePostContent filters records. - * @ingroup enhancePostContent + * @brief enhancePostContent filters records. + * @ingroup enhancePostContent * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class EpcRecord diff --git a/src/Frontend.php b/src/Frontend.php index fa987fc..6696009 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -8,11 +8,10 @@ use Dotclear\App; use Dotclear\Core\Process; /** - * @brief enhancePostContent frontend class. - * @ingroup enhancePostContent + * @brief enhancePostContent frontend class. + * @ingroup enhancePostContent * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class Frontend extends Process @@ -50,7 +49,7 @@ class Frontend extends Process } }, // Widgets - 'initWidgets' => [Widgets::class, 'initWidgets'], + 'initWidgets' => Widgets::initWidgets(...), ]); return true; diff --git a/src/Install.php b/src/Install.php index 4764916..f127716 100644 --- a/src/Install.php +++ b/src/Install.php @@ -10,11 +10,10 @@ use Dotclear\Database\Structure; use Exception; /** - * @brief enhancePostContent installation class. - * @ingroup enhancePostContent + * @brief enhancePostContent installation class. + * @ingroup enhancePostContent * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class Install extends Process diff --git a/src/Manage.php b/src/Manage.php index 7500012..47c2d09 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -1,15 +1,5 @@ addBehavior('enhancePostContentFilters', function (EpcFilters $stack): void { + App::behavior()->addBehavior('enhancePostContentFilters', function (EpcFilters $stack): void { foreach (Epc::DEFAULT_FILTERS as $class) { $stack->add(new $class()); } diff --git a/src/Uninstall.php b/src/Uninstall.php index 3429648..6f27ce4 100644 --- a/src/Uninstall.php +++ b/src/Uninstall.php @@ -8,11 +8,10 @@ use Dotclear\Core\Process; use Dotclear\Plugin\Uninstaller\Uninstaller; /** - * @brief enhancePostContent uninstall class. - * @ingroup enhancePostContent + * @brief enhancePostContent uninstall class. + * @ingroup enhancePostContent * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class Uninstall extends Process diff --git a/src/Widgets.php b/src/Widgets.php index c1c7536..f4a8449 100644 --- a/src/Widgets.php +++ b/src/Widgets.php @@ -11,11 +11,10 @@ use Dotclear\Plugin\widgets\WidgetsStack; use Dotclear\Plugin\widgets\WidgetsElement; /** - * @brief enhancePostContent widgets class. - * @ingroup enhancePostContent + * @brief enhancePostContent widgets class. + * @ingroup enhancePostContent * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class Widgets @@ -30,7 +29,7 @@ class Widgets $w->create( 'epclist', My::name(), - [self::class, 'parseWidget'], + self::parseWidget(...), null, __('List filtered contents.') );