From 7ff7b24f366b86a5bf3a22593321d6f8ce7c7bf7 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 26 Mar 2023 21:48:03 +0200 Subject: [PATCH] use 2.26 Html Helpers --- src/ReservedWhiteList.php | 26 ++++++++++---------------- src/UnmoderatedWhiteList.php | 27 +++++++-------------------- 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/src/ReservedWhiteList.php b/src/ReservedWhiteList.php index 7ede74a..5574295 100644 --- a/src/ReservedWhiteList.php +++ b/src/ReservedWhiteList.php @@ -14,17 +14,15 @@ declare(strict_types=1); namespace Dotclear\Plugin\whiteListCom; -/* dotclear ns */ use dcCore; use dcPage; use dcSpamFilter; - -/* clearbricks ns */ -use form; -use html; -use http; - -/* php ns */ +use Dotclear\Helper\Html\Form\{ + Checkbox, + Hidden +}; +use Dotclear\Helper\Html\Html; +use Dotclear\Helper\Network\Http; use Exception; /** @@ -88,7 +86,7 @@ class ReservedWhiteList extends dcSpamFilter } $wlc->commit(); dcPage::addSuccessNotice(__('Reserved names have been successfully updated.')); - http::redirect($url); + Http::redirect($url); } $comments = $wlc->getCommentsUsers(); @@ -96,7 +94,7 @@ class ReservedWhiteList extends dcSpamFilter dcCore::app()->error->add($e->getMessage()); } - $res = '
' . + $res = '' . '

' . __('Check the users who can make comments without being moderated.') . '

' . '

' . __('Comments authors list') . '

' . '' . @@ -107,12 +105,8 @@ class ReservedWhiteList extends dcSpamFilter foreach ($comments as $user) { $res .= '' . '' . '' . ''; diff --git a/src/UnmoderatedWhiteList.php b/src/UnmoderatedWhiteList.php index bfa30be..b5a0c52 100644 --- a/src/UnmoderatedWhiteList.php +++ b/src/UnmoderatedWhiteList.php @@ -14,17 +14,12 @@ declare(strict_types=1); namespace Dotclear\Plugin\whiteListCom; -/* dotclear ns */ use dcCore; use dcPage; use dcSpamFilter; - -/* clearbricks ns */ -use form; -use html; -use http; - -/* php ns */ +use Dotclear\Helper\Html\Form\Checkbox; +use Dotclear\Helper\Html\Html; +use Dotclear\Helper\Network\Http; use Exception; /** @@ -80,7 +75,7 @@ class UnmoderatedWhiteList extends dcSpamFilter } $wlc->commit(); dcPage::addSuccessNotice(__('Unmoderated names have been successfully updated.')); - http::redirect($url); + Http::redirect($url); } $posts = $wlc->getPostsUsers(); $comments = $wlc->getCommentsUsers(); @@ -96,7 +91,7 @@ class UnmoderatedWhiteList extends dcSpamFilter '

'; } - $res .= '' . + $res .= '' . '

' . __('Check the users who can make comments without being moderated.') . '

' . '
' . '
' . @@ -108,11 +103,7 @@ class UnmoderatedWhiteList extends dcSpamFilter foreach ($posts as $user) { $res .= '
' . '' . '' . ''; @@ -130,11 +121,7 @@ class UnmoderatedWhiteList extends dcSpamFilter foreach ($comments as $user) { $res .= '' . '' . '' . '';
' . - form::checkbox( - ['reserved[' . $i . ']'], - $user['name'], - (null === $wlc->isReserved($user['name'], $user['email'])) - ) . - form::hidden(['reserved_email[' . $i . ']'], $user['email']) . + (new Checkbox(['reserved[' . $i . ']'], (null === $wlc->isReserved($user['name'], $user['email']))))->value($user['name'])->render() . + (new Hidden(['reserved_email[' . $i . ']'], $user['email']))->render() . ' ' . $user['name'] . '' . $user['email'] . '
' . - form::checkbox( - ['unmoderated[]'], - $user['email'], - $wlc->isUnmoderated($user['email']) - ) . + (new Checkbox(['unmoderated[]'], $wlc->isUnmoderated($user['email'])))->value($user['email'])->render() . ' ' . $user['name'] . '' . $user['email'] . '
' . - form::checkbox( - ['unmoderated[]'], - $user['email'], - $wlc->isUnmoderated($user['email']) - ) . + (new Checkbox(['unmoderated[]'], $wlc->isUnmoderated($user['email'])))->value($user['email'])->render() . ' ' . $user['name'] . '' . $user['email'] . '