diff --git a/src/BackendBehaviors.php b/src/BackendBehaviors.php index ca57b18..d2b4074 100644 --- a/src/BackendBehaviors.php +++ b/src/BackendBehaviors.php @@ -16,8 +16,16 @@ namespace Dotclear\Plugin\topWriter; use ArrayObject; use dcCore; -use form; -use html; +use Dotclear\Helper\Html\Form\{ + Checkbox, + Div, + Label, + Number, + Para, + Select, + Text +}; +use Dotclear\Helper\Html\Html; /** * @ingroup DC_PLUGIN_TOPWRITER @@ -41,7 +49,7 @@ class BackendBehaviors # Display $__dashboard_items[0][] = '
' . - '

' . html::escapeHTML(__('Top writer: entries')) . '

' . + '

' . Html::escapeHTML(__('Top writer: entries')) . '

' . '' . '
'; } @@ -58,7 +66,7 @@ class BackendBehaviors # Display $__dashboard_items[0][] = '
' . - '

' . html::escapeHTML(__('Top writer: comments')) . '

' . + '

' . Html::escapeHTML(__('Top writer: comments')) . '

' . '' . '
'; } @@ -70,27 +78,38 @@ class BackendBehaviors $pref = self::setDefaultPref(); echo - '
' . - '

' . __('Top writer: entries') . '

' . - '

' . - '

' . - form::combo('topWriterPostsPeriod', Utils::periods(), $pref['topWriterPostsPeriod']) . '

' . - '

' . - form::number('topWriterPostsLimit', ['min' => 1, 'max' => 20, 'default' => $pref['topWriterPostsLimit']]) . '

' . - '
' . - - '
' . - '

' . __('Top writer: comments') . '

' . - '

' . - '

' . - form::combo('topWriterCommentsPeriod', Utils::periods(), $pref['topWriterCommentsPeriod']) . '

' . - '

' . - form::number('topWriterCommentsLimit', ['min' => 1, 'max' => 20, 'default' => $pref['topWriterCommentsLimit']]) . '

' . - '
'; + (new Div())->items([ + (new Div())->class('fieldset')->items([ + (new Text('h4', __('Top writer: entries'))), + (new Para())->items([ + (new Checkbox('topWriterPostsItems', $pref['topWriterPostsItems']))->value(1), + (new Label(__('Show'), Label::OUTSIDE_LABEL_AFTER))->for('topWriterPostsItems')->class('classic'), + ]), + (new Para())->class('field')->items([ + (new Label(__('Period:'), Label::OUTSIDE_LABEL_BEFORE))->for('topWriterPostsPeriod'), + (new Select('topWriterPostsPeriod'))->default($pref['topWriterPostsPeriod'])->items(Utils::periods()), + ]), + (new Para())->class('field')->items([ + (new Label(__('Limit:'), Label::OUTSIDE_LABEL_BEFORE))->for('topWriterPostsLimit'), + (new Number('topWriterPostsLimit'))->min(1)->max(20)->value($pref['topWriterPostsLimit']), + ]), + ]), + (new Div())->class('fieldset')->items([ + (new Text('h4', __('Top writer: comments'))), + (new Para())->items([ + (new Checkbox('topWriterCommentsItems', $pref['topWriterCommentsItems']))->value(1), + (new Label(__('Show'), Label::OUTSIDE_LABEL_AFTER))->for('topWriterCommentsItems')->class('classic'), + ]), + (new Para())->class('field')->items([ + (new Label(__('Period:'), Label::OUTSIDE_LABEL_BEFORE))->for('topWriterCommentsPeriod'), + (new Select('topWriterCommentsPeriod'))->default($pref['topWriterCommentsPeriod'])->items(Utils::periods()), + ]), + (new Para())->class('field')->items([ + (new Label(__('Limit:'), Label::OUTSIDE_LABEL_BEFORE))->for('topWriterCommentsLimit'), + (new Number('topWriterCommentsLimit'))->min(1)->max(20)->value($pref['topWriterCommentsLimit']), + ]), + ]), + ])->render(); } public static function adminAfterDashboardOptionsUpdate(?string $user_id): void diff --git a/src/Widgets.php b/src/Widgets.php index 4fd4d3c..3397e5f 100644 --- a/src/Widgets.php +++ b/src/Widgets.php @@ -15,9 +15,9 @@ declare(strict_types=1); namespace Dotclear\Plugin\topWriter; use dcCore; +use Dotclear\Helper\Html\Html; use Dotclear\Plugin\widgets\WidgetsStack; use Dotclear\Plugin\widgets\WidgetsElement; -use html; class Widgets { @@ -133,7 +133,7 @@ class Widgets (bool) $w->content_only, 'topcomments ' . $w->class, '', - ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . + ($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') . sprintf('', implode('', self::lines($lines, 'comments', $w->text))) ); } @@ -153,7 +153,7 @@ class Widgets (bool) $w->content_only, 'topentries ' . $w->class, '', - ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . + ($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') . sprintf('', implode('', self::lines($lines, 'posts', $w->text))) ); }