From 152772ea60f325562aa967985061aa86c20ef89c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Jul 2026 12:59:05 +0800 Subject: [PATCH 1/3] feat(widgets): feature intro shared JS + plate info count-mates Move FeatureIntro tab/media script into widget-set.js; align plate info stats with zibll count-mates layout and residual CSS. --- assets/css/frontend/widget-batch5.css | 16 ++++++++++ assets/js/widget-set.js | 36 ++++++++++++++++++++++ src/AKSRT/Widgets/WidgetFeatureIntro.php | 20 ++---------- src/AKSRT/Widgets/WidgetForumPlateInfo.php | 13 ++++---- 4 files changed, 60 insertions(+), 25 deletions(-) diff --git a/assets/css/frontend/widget-batch5.css b/assets/css/frontend/widget-batch5.css index c5d94b39..930abbf3 100644 --- a/assets/css/frontend/widget-batch5.css +++ b/assets/css/frontend/widget-batch5.css @@ -2517,3 +2517,19 @@ a.main-color > .icon-cover-card:hover, .aksrt-product-tab__skeleton .placeholder.s1 { width: 48%; } .aksrt-main-posts[data-load-mode="ajax"].is-ajax-loading { opacity: .85; } .widget-search-box.is-affix { position: sticky; top: 72px; } + + +/* batch40-42 residual */ +.aksrt-plate-info .count-mates { + gap: 8px; margin-top: 12px; padding-top: 10px; + border-top: 1px solid var(--color-line, rgba(0,0,0,.06)); +} +.aksrt-plate-info .count-mates item, +.aksrt-plate-info .count-mates .mate-views, +.aksrt-plate-info .count-mates .mate-reply, +.aksrt-plate-info .count-mates .mate-follow { + flex: 1 1 0; min-width: 0; text-align: center; +} +.aksrt-plate-info .count-mates .em14 { font-weight: 700; line-height: 1.2; } +.aksrt-fi[data-aksrt-feature-intro] .aksrt-fi__panel { display: none; } +.aksrt-fi[data-aksrt-feature-intro] .aksrt-fi__panel.is-active { display: block; } diff --git a/assets/js/widget-set.js b/assets/js/widget-set.js index 6bd366d6..4bbdad30 100644 --- a/assets/js/widget-set.js +++ b/assets/js/widget-set.js @@ -344,6 +344,41 @@ }); } + + // Feature intro media tabs. + function initFeatureIntro() { + document.querySelectorAll('[data-aksrt-feature-intro]').forEach(function (root) { + if (root.dataset.aksrtFiBound === '1') return; + root.dataset.aksrtFiBound = '1'; + var tabs = [].slice.call(root.querySelectorAll('.aksrt-fi__tab')); + var panels = [].slice.call(root.querySelectorAll('.aksrt-fi__panel')); + if (!tabs.length || !panels.length) return; + function go(i) { + tabs.forEach(function (t, idx) { + t.classList.toggle('is-active', idx === i); + }); + panels.forEach(function (p, idx) { + p.classList.toggle('is-active', idx === i); + var v = p.querySelector('video'); + if (!v) return; + if (idx === i) { + if (!v.getAttribute('src') && v.getAttribute('data-src')) { + v.setAttribute('src', v.getAttribute('data-src')); + } + if (v.play) v.play().catch(function () {}); + } else if (v.pause) { + v.pause(); + } + }); + } + tabs.forEach(function (t) { + t.addEventListener('click', function () { + go(parseInt(t.getAttribute('data-index') || '0', 10)); + }); + }); + }); + } + function initFloatingQRCodes() { var wrap = document.querySelector('.float-right'); if (!wrap) return; @@ -388,6 +423,7 @@ initForumTabTopics(); initProductTabs(); initMainPostsLazy(); + initFeatureIntro(); initFloatingQRCodes(); } diff --git a/src/AKSRT/Widgets/WidgetFeatureIntro.php b/src/AKSRT/Widgets/WidgetFeatureIntro.php index 5f718b6b..7638b2b7 100644 --- a/src/AKSRT/Widgets/WidgetFeatureIntro.php +++ b/src/AKSRT/Widgets/WidgetFeatureIntro.php @@ -44,7 +44,7 @@ class WidgetFeatureIntro extends \WP_Widget { echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $uid = 'aksrt-fi-' . esc_attr($this->id); - echo '
'; + echo '
'; echo '
'; if ($heading !== '') { echo '

' . esc_html($heading) . '

'; @@ -105,23 +105,7 @@ class WidgetFeatureIntro extends \WP_Widget { } echo '
'; - if (count($slides) > 1) { - ?> - - ' . esc_html($desc) . '
'; } if ($show_stats) { - echo '
'; - echo ' ' . esc_html((string) $posts) . ''; - echo ' ' . esc_html((string) $reply) . ''; - if ($views > 0) { - echo ' ' . esc_html((string) $views) . ''; - } - echo ' ' . esc_html((string) $follow) . ''; + // zibll count-mates: label above big number. + echo '
'; + echo '
' . esc_html__('帖子', 'aksrt') . '
' . esc_html((string) $posts) . '
'; + echo '
' . esc_html__('回复', 'aksrt') . '
' . esc_html((string) $reply) . '
'; + echo '
' . esc_html__('阅读', 'aksrt') . '
' . esc_html((string) $views) . '
'; + echo '
' . esc_html__('关注', 'aksrt') . '
' . esc_html((string) $follow) . '
'; echo '
'; } From 22f7e7ecf5f55fab4c3044e35d22db80f35496af Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Jul 2026 12:59:05 +0800 Subject: [PATCH 2/3] fix(widgets): drop decorative ajaxpager shells on side lists Recent comments, categories, tag cloud, and user lists no longer wrap static HTML in inert ajaxpager attributes without real pagination. --- src/AKSRT/Widgets/CategoriesWidget.php | 3 --- src/AKSRT/Widgets/RecentCommentsWidget.php | 3 --- src/AKSRT/Widgets/TagCloudWidget.php | 3 --- src/AKSRT/Widgets/WidgetUserLists.php | 3 --- 4 files changed, 12 deletions(-) diff --git a/src/AKSRT/Widgets/CategoriesWidget.php b/src/AKSRT/Widgets/CategoriesWidget.php index 62e79ec8..d034cc8d 100644 --- a/src/AKSRT/Widgets/CategoriesWidget.php +++ b/src/AKSRT/Widgets/CategoriesWidget.php @@ -176,10 +176,7 @@ class CategoriesWidget extends \WP_Widget { if ($title !== '') { echo $args['before_title'] . esc_html($title) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } - $rest = rest_url('aksrt/v1/widgets/categories'); - echo '
'; echo self::render_html($instance); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - echo '
'; echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } diff --git a/src/AKSRT/Widgets/RecentCommentsWidget.php b/src/AKSRT/Widgets/RecentCommentsWidget.php index b7c8dd05..6dc5bf6f 100644 --- a/src/AKSRT/Widgets/RecentCommentsWidget.php +++ b/src/AKSRT/Widgets/RecentCommentsWidget.php @@ -169,10 +169,7 @@ class RecentCommentsWidget extends \WP_Widget { if ($title !== '') { echo $args['before_title'] . esc_html($title) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } - $rest = rest_url('aksrt/v1/widgets/recent-comments'); - echo '
'; echo self::render_html($instance); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - echo '
'; echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } diff --git a/src/AKSRT/Widgets/TagCloudWidget.php b/src/AKSRT/Widgets/TagCloudWidget.php index 07ce035c..f6c3f3c7 100644 --- a/src/AKSRT/Widgets/TagCloudWidget.php +++ b/src/AKSRT/Widgets/TagCloudWidget.php @@ -101,10 +101,7 @@ class TagCloudWidget extends \WP_Widget { if ($title !== '') { echo $args['before_title'] . esc_html($title) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } - $rest = rest_url('aksrt/v1/widgets/tag-cloud'); - echo '
'; echo self::render_html($instance); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - echo '
'; echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } diff --git a/src/AKSRT/Widgets/WidgetUserLists.php b/src/AKSRT/Widgets/WidgetUserLists.php index 752169bb..74034798 100644 --- a/src/AKSRT/Widgets/WidgetUserLists.php +++ b/src/AKSRT/Widgets/WidgetUserLists.php @@ -143,10 +143,7 @@ class WidgetUserLists extends \WP_Widget { if ($title !== '') { echo $args['before_title'] . esc_html($title) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } - $rest = rest_url('aksrt/v1/widgets/user-lists'); - echo '
'; echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - echo '
'; echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } From 1a92adbaf1d7f5ab3428f2cef74ca91f961dae34 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Jul 2026 12:59:05 +0800 Subject: [PATCH 3/3] feat(widgets): number paginate for hot/paid/forum lists Extend aksrt_get_ajax_number_paginate to HotPosts, PaidPosts, forum hot/topic lists and product tabs; REST accepts number + paid filters. --- src/AKSRT/Core/WidgetAjax.php | 20 +++++++++---- src/AKSRT/Widgets/HotPostsWidget.php | 26 +++++++++++------ src/AKSRT/Widgets/WidgetForumHotTopics.php | 28 +++++++++++------- src/AKSRT/Widgets/WidgetForumTopicLists.php | 32 +++++++++++++-------- src/AKSRT/Widgets/WidgetPaidPosts.php | 24 +++++++++++----- src/AKSRT/Widgets/WidgetProductTab.php | 2 +- 6 files changed, 88 insertions(+), 44 deletions(-) diff --git a/src/AKSRT/Core/WidgetAjax.php b/src/AKSRT/Core/WidgetAjax.php index 0acba307..febe7a93 100644 --- a/src/AKSRT/Core/WidgetAjax.php +++ b/src/AKSRT/Core/WidgetAjax.php @@ -125,10 +125,16 @@ class WidgetAjax { if (!class_exists('\AKSRT\Widgets\WidgetPaidPosts')) { return $this->fail(); } + $paginate = sanitize_key((string) ($request->get_param('paginate') ?? 'ajax')); + if (!in_array($paginate, ['none', 'ajax', 'number'], true)) { + $paginate = 'ajax'; + } $instance = [ - 'count' => max(1, min(20, (int) ($request->get_param('count') ?? 6))), - 'orderby' => sanitize_key((string) ($request->get_param('orderby') ?? 'date')), - 'paginate' => sanitize_key((string) ($request->get_param('paginate') ?? 'ajax')), + 'count' => max(1, min(20, (int) ($request->get_param('count') ?? 6))), + 'orderby' => sanitize_key((string) ($request->get_param('orderby') ?? 'date')), + 'cat' => max(0, (int) ($request->get_param('cat') ?? 0)), + 'limit_day' => max(0, (int) ($request->get_param('limit_day') ?? 0)), + 'paginate' => $paginate, ]; $page = max(1, (int) ($request->get_param('page') ?? $request->get_param('paged') ?? 1)); return $this->payload(\AKSRT\Widgets\WidgetPaidPosts::query_payload($instance, $page), $page); @@ -187,12 +193,16 @@ class WidgetAjax { if (!class_exists('\AKSRT\Widgets\HotPostsWidget')) { return $this->fail(); } + $paginate = sanitize_key((string) ($request->get_param('paginate') ?? 'ajax')); + if (!in_array($paginate, ['none', 'ajax', 'number'], true)) { + $paginate = 'ajax'; + } $instance = [ 'count' => max(1, min(20, (int) ($request->get_param('count') ?? 5))), 'order_by' => sanitize_key((string) ($request->get_param('order_by') ?? 'views')), 'days' => max(0, (int) ($request->get_param('days') ?? 30)), 'show_thumb' => $request->get_param('show_thumb') === null ? 1 : (int) $request->get_param('show_thumb'), - 'paginate' => sanitize_key((string) ($request->get_param('paginate') ?? 'ajax')), + 'paginate' => $paginate, ]; $page = max(1, (int) ($request->get_param('page') ?? 1)); return $this->payload(\AKSRT\Widgets\HotPostsWidget::query_payload($instance, $page), $page); @@ -260,7 +270,7 @@ class WidgetAjax { 'orderby' => sanitize_key((string) ($request->get_param('orderby') ?? 'views')), 'style' => $style, 'plate' => max(0, (int) ($request->get_param('plate') ?? $request->get_param('plate_id') ?? 0)), - 'paginate' => sanitize_key((string) ($request->get_param('paginate') ?? 'ajax')), + 'paginate' => in_array(sanitize_key((string) ($request->get_param('paginate') ?? 'ajax')), ['none', 'ajax', 'number'], true) ? sanitize_key((string) ($request->get_param('paginate') ?? 'ajax')) : 'ajax', ]; $page = max(1, (int) ($request->get_param('page') ?? 1)); return $this->payload(\AKSRT\Widgets\WidgetForumHotTopics::query_payload($instance, $page), $page); diff --git a/src/AKSRT/Widgets/HotPostsWidget.php b/src/AKSRT/Widgets/HotPostsWidget.php index 8d452688..1ab3eaff 100644 --- a/src/AKSRT/Widgets/HotPostsWidget.php +++ b/src/AKSRT/Widgets/HotPostsWidget.php @@ -172,19 +172,26 @@ class HotPostsWidget extends \WP_Widget { $max_pages = max(1, (int) $q->max_num_pages); $total = (int) $q->found_posts; $has_more = $page < $max_pages; + $base_qs = array_filter([ + 'count' => $count, + 'order_by' => sanitize_key((string) ($instance['order_by'] ?? 'views')), + 'days' => max(0, (int) ($instance['days'] ?? 30)), + 'show_thumb' => !empty($instance['show_thumb']) ? 1 : 0, + 'paginate' => $paginate, + ], static function ($v) { + return $v !== '' && $v !== null; + }); + $rest_base = add_query_arg($base_qs, rest_url('aksrt/v1/widgets/hot-posts')); $paginate_html = ''; if ($paginate === 'ajax' && $has_more) { - $next = add_query_arg([ - 'page' => $page + 1, - 'count' => $count, - 'order_by' => sanitize_key((string) ($instance['order_by'] ?? 'views')), - 'days' => max(0, (int) ($instance['days'] ?? 30)), - 'show_thumb' => !empty($instance['show_thumb']) ? 1 : 0, - 'paginate' => 'ajax', - ], rest_url('aksrt/v1/widgets/hot-posts')); + $next = add_query_arg(['page' => $page + 1], $rest_base); $paginate_html = function_exists('aksrt_get_ajax_next_paginate') ? aksrt_get_ajax_next_paginate($total, $page, $count, $next) : ''; + } elseif ($paginate === 'number' && $max_pages > 1) { + $paginate_html = function_exists('aksrt_get_ajax_number_paginate') + ? aksrt_get_ajax_number_paginate($total, $page, $count, $rest_base) + : '
'; } else { $paginate_html = '
'; } @@ -243,6 +250,7 @@ class HotPostsWidget extends \WP_Widget { @@ -257,7 +265,7 @@ class HotPostsWidget extends \WP_Widget { 'order_by' => in_array($new_instance['order_by'] ?? '', ['views', 'comments', 'likes', 'favorites', 'downloads'], true) ? $new_instance['order_by'] : 'views', 'days' => absint($new_instance['days'] ?? 30), 'show_thumb' => !empty($new_instance['show_thumb']) ? 1 : 0, - 'paginate' => sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) === 'none' ? 'none' : 'ajax', + 'paginate' => in_array(sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')), ['none', 'ajax', 'number'], true) ? sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) : 'ajax', ]; } } diff --git a/src/AKSRT/Widgets/WidgetForumHotTopics.php b/src/AKSRT/Widgets/WidgetForumHotTopics.php index 80632deb..e921cf4d 100644 --- a/src/AKSRT/Widgets/WidgetForumHotTopics.php +++ b/src/AKSRT/Widgets/WidgetForumHotTopics.php @@ -141,20 +141,27 @@ class WidgetForumHotTopics extends \WP_Widget { $max_pages = max(1, (int) $q->max_num_pages); $total = (int) $q->found_posts; $has_more = $page < $max_pages; + $base_qs = array_filter([ + 'count' => $count, + 'period' => sanitize_key((string) ($instance['period'] ?? 'week')), + 'orderby' => sanitize_key((string) ($instance['orderby'] ?? 'views')), + 'style' => $style, + 'plate' => max(0, (int) ($instance['plate'] ?? 0)), + 'paginate' => $paginate, + ], static function ($v) { + return $v !== '' && $v !== null; + }); + $rest_base = add_query_arg($base_qs, rest_url('aksrt/v1/widgets/forum-topics')); $paginate_html = ''; if ($paginate === 'ajax' && $has_more) { - $next = add_query_arg([ - 'page' => $page + 1, - 'count' => $count, - 'period' => sanitize_key((string) ($instance['period'] ?? 'week')), - 'orderby' => sanitize_key((string) ($instance['orderby'] ?? 'views')), - 'style' => $style, - 'plate' => max(0, (int) ($instance['plate'] ?? 0)), - 'paginate' => 'ajax', - ], rest_url('aksrt/v1/widgets/forum-topics')); + $next = add_query_arg(['page' => $page + 1], $rest_base); $paginate_html = function_exists('aksrt_get_ajax_next_paginate') ? aksrt_get_ajax_next_paginate($total, $page, $count, $next) : ''; + } elseif ($paginate === 'number' && $max_pages > 1) { + $paginate_html = function_exists('aksrt_get_ajax_number_paginate') + ? aksrt_get_ajax_number_paginate($total, $page, $count, $rest_base) + : '
'; } else { $paginate_html = '
'; } @@ -231,6 +238,7 @@ class WidgetForumHotTopics extends \WP_Widget { @@ -254,7 +262,7 @@ class WidgetForumHotTopics extends \WP_Widget { 'orderby' => $orderby, 'style' => $style, 'plate' => max(0, (int) ($new_instance['plate'] ?? 0)), - 'paginate' => sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) === 'none' ? 'none' : 'ajax', + 'paginate' => in_array(sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')), ['none', 'ajax', 'number'], true) ? sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) : 'ajax', ]; } } diff --git a/src/AKSRT/Widgets/WidgetForumTopicLists.php b/src/AKSRT/Widgets/WidgetForumTopicLists.php index d8fe5691..e66d993f 100644 --- a/src/AKSRT/Widgets/WidgetForumTopicLists.php +++ b/src/AKSRT/Widgets/WidgetForumTopicLists.php @@ -109,6 +109,9 @@ class WidgetForumTopicLists extends \WP_Widget { $page = max(1, $page); $style = sanitize_key((string) ($instance['style'] ?? 'mini')); $paginate = sanitize_key((string) ($instance['paginate'] ?? 'ajax')); + if (!in_array($paginate, ['none', 'ajax', 'number'], true)) { + $paginate = 'ajax'; + } $q = new \WP_Query(self::build_query_args($instance, $page)); $html = self::render_items_html($q, $style); if ($html === '' && $page === 1) { @@ -119,22 +122,26 @@ class WidgetForumTopicLists extends \WP_Widget { $max_pages = max(1, (int) $q->max_num_pages); $total = (int) $q->found_posts; $has_more = $page < $max_pages; + $base_qs = array_filter([ + 'count' => max(1, min(30, (int) ($instance['count'] ?? 8))), + 'orderby' => sanitize_key((string) ($instance['orderby'] ?? 'date')), + 'style' => $style, + 'plate_id' => (int) ($instance['plate_id'] ?? 0), + 'paginate' => $paginate, + ], static function ($v) { + return $v !== '' && $v !== null; + }); + $rest_base = add_query_arg($base_qs, rest_url('aksrt/v1/forum/frontend/widgets/topics')); $paginate_html = ''; if ($paginate === 'ajax' && $has_more) { - $next = add_query_arg( - array_filter([ - 'page' => $page + 1, - 'count' => max(1, min(30, (int) ($instance['count'] ?? 8))), - 'orderby' => sanitize_key((string) ($instance['orderby'] ?? 'date')), - 'style' => $style, - 'plate_id' => (int) ($instance['plate_id'] ?? 0), - 'paginate' => 'ajax', - ]), - rest_url('aksrt/v1/forum/frontend/widgets/topics') - ); + $next = add_query_arg(['page' => $page + 1], $rest_base); $paginate_html = function_exists('aksrt_get_ajax_next_paginate') ? aksrt_get_ajax_next_paginate($total, $page, max(1, (int) ($instance['count'] ?? 8)), $next) : ''; + } elseif ($paginate === 'number' && $max_pages > 1) { + $paginate_html = function_exists('aksrt_get_ajax_number_paginate') + ? aksrt_get_ajax_number_paginate($total, $page, max(1, (int) ($instance['count'] ?? 8)), $rest_base) + : '
'; } else { $paginate_html = '
'; } @@ -258,6 +265,7 @@ class WidgetForumTopicLists extends \WP_Widget { @@ -273,7 +281,7 @@ class WidgetForumTopicLists extends \WP_Widget { 'style' => sanitize_key((string) ($new_instance['style'] ?? 'mini')), 'plate_id' => max(0, (int) ($new_instance['plate_id'] ?? 0)), 'current_plate' => !empty($new_instance['current_plate']) ? 1 : 0, - 'paginate' => sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')), + 'paginate' => in_array(sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')), ['none', 'ajax', 'number'], true) ? sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) : 'ajax', ]; } } diff --git a/src/AKSRT/Widgets/WidgetPaidPosts.php b/src/AKSRT/Widgets/WidgetPaidPosts.php index 17b4ad7a..6a790ef3 100644 --- a/src/AKSRT/Widgets/WidgetPaidPosts.php +++ b/src/AKSRT/Widgets/WidgetPaidPosts.php @@ -137,17 +137,26 @@ class WidgetPaidPosts extends \WP_Widget { $max_pages = max(1, (int) $q->max_num_pages); $total = (int) $q->found_posts; $has_more = $page < $max_pages; + $base_qs = array_filter([ + 'count' => $count, + 'orderby' => sanitize_key((string) ($instance['orderby'] ?? 'date')), + 'cat' => max(0, (int) ($instance['cat'] ?? 0)), + 'limit_day' => max(0, (int) ($instance['limit_day'] ?? 0)), + 'paginate' => $paginate, + ], static function ($v) { + return $v !== '' && $v !== null; + }); + $rest_base = add_query_arg($base_qs, rest_url('aksrt/v1/widgets/paid-posts')); $paginate_html = ''; if ($paginate === 'ajax' && $has_more) { - $next = add_query_arg([ - 'page' => $page + 1, - 'count' => $count, - 'orderby' => sanitize_key((string) ($instance['orderby'] ?? 'date')), - 'paginate' => 'ajax', - ], rest_url('aksrt/v1/widgets/paid-posts')); + $next = add_query_arg(['page' => $page + 1], $rest_base); $paginate_html = function_exists('aksrt_get_ajax_next_paginate') ? aksrt_get_ajax_next_paginate($total, $page, $count, $next) : ''; + } elseif ($paginate === 'number' && $max_pages > 1) { + $paginate_html = function_exists('aksrt_get_ajax_number_paginate') + ? aksrt_get_ajax_number_paginate($total, $page, $count, $rest_base) + : '
'; } else { $paginate_html = '
'; } @@ -207,6 +216,7 @@ class WidgetPaidPosts extends \WP_Widget { @@ -235,7 +245,7 @@ class WidgetPaidPosts extends \WP_Widget { 'orderby' => $orderby, 'cat' => max(0, (int) ($new_instance['cat'] ?? 0)), 'limit_day' => max(0, (int) ($new_instance['limit_day'] ?? 0)), - 'paginate' => sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) === 'none' ? 'none' : 'ajax', + 'paginate' => in_array(sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')), ['none', 'ajax', 'number'], true) ? sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) : 'ajax', ]; } } diff --git a/src/AKSRT/Widgets/WidgetProductTab.php b/src/AKSRT/Widgets/WidgetProductTab.php index 6e7232dd..4b8ed47f 100644 --- a/src/AKSRT/Widgets/WidgetProductTab.php +++ b/src/AKSRT/Widgets/WidgetProductTab.php @@ -167,7 +167,7 @@ class WidgetProductTab extends \WP_Widget { 'tabs' => sanitize_textarea_field((string) ($new_instance['tabs'] ?? '')), 'per_page' => max(1, min(20, (int) ($new_instance['per_page'] ?? 8))), 'style' => sanitize_key((string) ($new_instance['style'] ?? 'default')), - 'paginate' => sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')), + 'paginate' => in_array(sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')), ['none', 'ajax', 'number'], true) ? sanitize_key((string) ($new_instance['paginate'] ?? 'ajax')) : 'ajax', ]; } }