feat(frontend): replace article system with Zibll 9.0
This commit is contained in:
+93
-227
@@ -11,177 +11,92 @@ class PostDisplay {
|
||||
|
||||
public static function get_post_list_style_settings(): array {
|
||||
$settings = Settings::get_all();
|
||||
|
||||
// post_card_style storage key mirrors Zibll list_type.
|
||||
$list_type = sanitize_key((string) ($settings['post_card_style'] ?? 'thumb'));
|
||||
$allowed_list_types = ['thumb', 'compact', 'large_thumb', 'multi_thumb', 'text', 'thumb_if_has', 'card', 'standard'];
|
||||
|
||||
if (!in_array($list_type, $allowed_list_types, true)) {
|
||||
$list_type = sanitize_key((string) ($settings['list_type'] ?? 'thumb'));
|
||||
if (!in_array($list_type, ['text', 'thumb', 'thumb_if_has', 'card'], true)) {
|
||||
$list_type = 'thumb';
|
||||
}
|
||||
// Historical aliases → Zibll list_type tokens.
|
||||
if ($list_type === 'standard') {
|
||||
$list_type = 'thumb';
|
||||
}
|
||||
// Non-Zibll extras stay list-mode variants (never force card grid).
|
||||
if (in_array($list_type, ['compact', 'large_thumb', 'multi_thumb'], true)) {
|
||||
// Keep token for CSS hooks; render as list.
|
||||
}
|
||||
|
||||
// Zibll: only list_type=card is card mode; thumb/text/thumb_if_has are list.
|
||||
$render_mode_map = [
|
||||
'thumb' => 'list',
|
||||
'compact' => 'list',
|
||||
'large_thumb' => 'list',
|
||||
'multi_thumb' => 'list',
|
||||
'text' => 'list',
|
||||
'thumb_if_has' => 'list',
|
||||
'card' => 'card',
|
||||
];
|
||||
$list_option = is_array($settings['list_list_option'] ?? null) ? $settings['list_list_option'] : [];
|
||||
$list_style = sanitize_key((string) ($list_option['style'] ?? 'null'));
|
||||
$list_style = $list_style === 'style2' ? 'style2' : 'null';
|
||||
$list_position = sanitize_key((string) ($list_option['img_position'] ?? 'left'));
|
||||
$list_position = $list_position === 'right' ? 'right' : 'left';
|
||||
|
||||
$sticky_pages_raw = $settings['sticky_s'] ?? null;
|
||||
if (is_array($sticky_pages_raw)) {
|
||||
$allowed_pages = ['home', 'cat', 'tag'];
|
||||
$sticky_pages = array_values(array_intersect(array_map('sanitize_key', $sticky_pages_raw), $allowed_pages));
|
||||
} else {
|
||||
$sticky_pages = ['home', 'cat'];
|
||||
}
|
||||
$card_option = is_array($settings['list_card_option'] ?? null) ? $settings['list_card_option'] : [];
|
||||
$card_style = sanitize_key((string) ($card_option['style'] ?? 'null'));
|
||||
$card_style = $card_style === 'style3' ? 'style3' : 'null';
|
||||
|
||||
$badge_types_raw = $settings['list_badge_show'] ?? null;
|
||||
if (is_array($badge_types_raw)) {
|
||||
$allowed_types = ['pay', 'cat', 'tag'];
|
||||
$badge_types = array_values(array_intersect(array_map('sanitize_key', $badge_types_raw), $allowed_types));
|
||||
} else {
|
||||
$badge_types = ['pay', 'cat', 'tag'];
|
||||
}
|
||||
$sticky_pages = is_array($settings['sticky_s'] ?? null)
|
||||
? array_values(array_intersect(array_map('sanitize_key', $settings['sticky_s']), ['home', 'cat', 'tag']))
|
||||
: ['home', 'cat'];
|
||||
$badge_types = is_array($settings['list_badge_show'] ?? null)
|
||||
? array_values(array_intersect(array_map('sanitize_key', $settings['list_badge_show']), ['pay', 'cat', 'tag']))
|
||||
: ['pay', 'cat', 'tag'];
|
||||
$card_cat_ids = is_array($settings['list_card_cat'] ?? null)
|
||||
? array_values(array_filter(array_map('intval', $settings['list_card_cat'])))
|
||||
: [];
|
||||
|
||||
$show_author = array_key_exists('post_list_author', $settings)
|
||||
? !empty($settings['post_list_author'])
|
||||
: (!isset($settings['post_show_author']) || !empty($settings['post_show_author']));
|
||||
|
||||
$show_date = array_key_exists('post_list_time', $settings)
|
||||
? !empty($settings['post_list_time'])
|
||||
: (!isset($settings['post_show_date']) || !empty($settings['post_show_date']));
|
||||
|
||||
$target_blank = array_key_exists('target_blank', $settings)
|
||||
? !empty($settings['target_blank'])
|
||||
: !empty($settings['post_target_blank']);
|
||||
|
||||
$ajax_trigger = '';
|
||||
if (array_key_exists('ajax_trigger', $settings)) {
|
||||
$ajax_trigger = sanitize_text_field((string) $settings['ajax_trigger']);
|
||||
} elseif (array_key_exists('ajax_trigger_text', $settings)) {
|
||||
$ajax_trigger = sanitize_text_field((string) $settings['ajax_trigger_text']);
|
||||
}
|
||||
|
||||
$ajax_nomore = '';
|
||||
if (array_key_exists('ajax_nomore', $settings)) {
|
||||
$ajax_nomore = sanitize_text_field((string) $settings['ajax_nomore']);
|
||||
} elseif (array_key_exists('ajax_nomore_text', $settings)) {
|
||||
$ajax_nomore = sanitize_text_field((string) $settings['ajax_nomore_text']);
|
||||
}
|
||||
|
||||
$list_style = sanitize_key((string) ($settings['list_list_style'] ?? ''));
|
||||
if (!in_array($list_style, ['', 'style2'], true)) {
|
||||
$list_style = '';
|
||||
}
|
||||
|
||||
$card_variant = sanitize_key((string) ($settings['list_card_style'] ?? ''));
|
||||
if (!in_array($card_variant, ['', 'style3'], true)) {
|
||||
$card_variant = '';
|
||||
}
|
||||
|
||||
$card_cat_ids = [];
|
||||
if (is_array($settings['list_card_cat'] ?? null)) {
|
||||
$card_cat_ids = array_values(array_filter(array_map('intval', $settings['list_card_cat'])));
|
||||
}
|
||||
$time_source = sanitize_key((string) ($settings['post_time_source'] ?? 'modified'));
|
||||
$mobile_meta = sanitize_key((string) ($settings['list_meta_show'] ?? 'like'));
|
||||
$list_show_type = sanitize_key((string) ($settings['list_show_type'] ?? 'separate'));
|
||||
$list_orderby = sanitize_key((string) ($settings['list_orderby'] ?? 'modified'));
|
||||
|
||||
return [
|
||||
// Zibll list_type (storage: post_card_style).
|
||||
'list_type' => $list_type,
|
||||
// Base mode from list_type only (surface card overrides applied by resolver).
|
||||
'render_mode' => $render_mode_map[$list_type] ?? 'list',
|
||||
// List item subtype token for text/thumb_if_has class hooks (not card variant).
|
||||
'list_type_token' => $list_type,
|
||||
// List mode visual variant (Zibll list_list_option.style).
|
||||
'list_style' => $list_style,
|
||||
// Card mode visual variant (Zibll list_card_option.style).
|
||||
'card_variant' => $card_variant,
|
||||
// Back-compat aliases used by older callers (prefer list_type / card_variant).
|
||||
'card_style' => $list_type,
|
||||
'show_author' => $show_author,
|
||||
'show_date' => $show_date,
|
||||
'show_views' => !isset($settings['post_show_views']) || !empty($settings['post_show_views']),
|
||||
'show_category' => !isset($settings['post_show_category']) || !empty($settings['post_show_category']),
|
||||
'show_comments' => !isset($settings['post_meta_comments']) || !empty($settings['post_meta_comments']),
|
||||
'show_likes' => !isset($settings['post_meta_likes']) || !empty($settings['post_meta_likes']),
|
||||
'badge_types' => $badge_types,
|
||||
'badge_show' => !empty($badge_types),
|
||||
'sticky_pages' => $sticky_pages,
|
||||
'sticky_enabled' => !empty($sticky_pages),
|
||||
'target_blank' => $target_blank,
|
||||
'heading_bold' => !empty($settings['item_heading_bold']),
|
||||
'mobile_meta' => in_array(sanitize_key((string) ($settings['list_meta_show'] ?? 'like')), ['view', 'like', 'comm'], true) ? sanitize_key((string) ($settings['list_meta_show'] ?? 'like')) : 'like',
|
||||
'list_show_type' => in_array(sanitize_key((string) ($settings['list_show_type'] ?? 'separate')), ['separate', 'no_margin'], true) ? sanitize_key((string) ($settings['list_show_type'] ?? 'separate')) : 'separate',
|
||||
'excerpt_length' => max(20, min(500, (int) ($settings['post_excerpt_length'] ?? 120))),
|
||||
'ias_max' => max(0, min(10, (int) ($settings['ias_max'] ?? 3))),
|
||||
'paging_ajax' => self::is_list_paging_ajax($settings),
|
||||
'paging_ajax_ias' => self::is_list_paging_ajax_ias($settings),
|
||||
'ajax_trigger_text' => $ajax_trigger,
|
||||
'ajax_nomore_text' => $ajax_nomore,
|
||||
'list_orderby' => in_array(sanitize_key((string) ($settings['list_orderby'] ?? 'modified')), ['modified', 'date', 'default'], true) ? sanitize_key((string) ($settings['list_orderby'] ?? 'modified')) : 'modified',
|
||||
'columns' => max(1, min(3, (int) ($settings['post_list_columns'] ?? 1))),
|
||||
'per_page' => max(4, min(48, (int) ($settings['post_list_per_page'] ?? 12))),
|
||||
'list_img_position' => in_array(sanitize_key((string) ($settings['list_list_img_position'] ?? 'left')), ['left', 'right'], true) ? sanitize_key((string) ($settings['list_list_img_position'] ?? 'left')) : 'left',
|
||||
'list_scale' => max(50, min(200, (int) ($settings['list_list_scale'] ?? 70))),
|
||||
'card_scale' => max(20, min(200, (int) ($settings['list_card_scale'] ?? 70))),
|
||||
'card_home' => !empty($settings['list_card_home']),
|
||||
'card_cat' => !empty($card_cat_ids),
|
||||
'card_cat_ids' => $card_cat_ids,
|
||||
'card_tag' => !empty($settings['list_card_tag']),
|
||||
'card_author' => !empty($settings['list_card_author']),
|
||||
'list_type' => $list_type,
|
||||
'list_orderby' => in_array($list_orderby, ['date', 'modified', 'default'], true) ? $list_orderby : 'modified',
|
||||
'post_time_source' => $time_source === 'date' ? 'date' : 'modified',
|
||||
'sticky_s' => $sticky_pages,
|
||||
'target_blank' => !empty($settings['target_blank']),
|
||||
'item_heading_bold' => !empty($settings['item_heading_bold']),
|
||||
'post_list_author' => !array_key_exists('post_list_author', $settings) || !empty($settings['post_list_author']),
|
||||
'post_list_time' => !array_key_exists('post_list_time', $settings) || !empty($settings['post_list_time']),
|
||||
'paging_ajax_s' => (string) ($settings['paging_ajax_s'] ?? '1') === '1',
|
||||
'paging_ajax_ias_s' => !array_key_exists('paging_ajax_ias_s', $settings) || !empty($settings['paging_ajax_ias_s']),
|
||||
'ias_max' => max(0, min(10, (int) ($settings['ias_max'] ?? 3))),
|
||||
'list_meta_show' => in_array($mobile_meta, ['view', 'like', 'comm'], true) ? $mobile_meta : 'like',
|
||||
'list_badge_show' => $badge_types,
|
||||
'list_show_type' => in_array($list_show_type, ['separate', 'no_margin'], true) ? $list_show_type : 'separate',
|
||||
'list_card_home' => !empty($settings['list_card_home']),
|
||||
'list_card_tag' => !empty($settings['list_card_tag']),
|
||||
'list_card_author' => !empty($settings['list_card_author']),
|
||||
'list_card_cat' => $card_cat_ids,
|
||||
'list_list_option' => [
|
||||
'style' => $list_style,
|
||||
'img_position' => $list_position,
|
||||
'scale' => max(50, min(200, (int) ($list_option['scale'] ?? 70))),
|
||||
],
|
||||
'list_card_option' => [
|
||||
'style' => $card_style,
|
||||
'scale' => max(20, min(200, (int) ($card_option['scale'] ?? 70))),
|
||||
],
|
||||
'mult_thumb_cat' => is_array($settings['mult_thumb_cat'] ?? null) ? array_values(array_filter(array_map('intval', $settings['mult_thumb_cat']))) : [],
|
||||
'ajax_trigger' => wp_kses_post((string) ($settings['ajax_trigger'] ?? '<i class="fa fa-angle-right"></i>加载更多')),
|
||||
'ajax_nomore' => wp_kses_post((string) ($settings['ajax_nomore'] ?? '没有更多内容了')),
|
||||
];
|
||||
}
|
||||
|
||||
public static function get_post_thumb_settings(): array {
|
||||
$settings = Settings::get_all();
|
||||
$priority_raw = (string) ($settings['thumb_priority'] ?? 'featured,attachment,resource,custom');
|
||||
$priority = preg_split('/[\s,]+/', strtolower($priority_raw)) ?: [];
|
||||
$priority = array_values(array_unique(array_filter(array_map('sanitize_key', $priority))));
|
||||
$allowed_sources = ['featured', 'attachment', 'resource', 'custom', 'category_cover', 'post_first_img'];
|
||||
$priority = array_values(array_filter($priority, static function (string $source) use ($allowed_sources): bool {
|
||||
return in_array($source, $allowed_sources, true);
|
||||
}));
|
||||
|
||||
if (empty($priority)) {
|
||||
$priority = ['featured', 'attachment', 'resource', 'custom'];
|
||||
public static function get_post_thumb_settings(): array {
|
||||
$settings = Settings::get_all();
|
||||
$spare_settings = array_key_exists('spare_thumbnail', $settings)
|
||||
? (array) $settings['spare_thumbnail']
|
||||
: [['img' => get_template_directory_uri() . '/assets/img/thumbnail.svg']];
|
||||
$spare = [];
|
||||
foreach ($spare_settings as $item) {
|
||||
$url = is_array($item) ? (string) ($item['img'] ?? '') : '';
|
||||
if ($url !== '') {
|
||||
$spare[] = esc_url_raw($url);
|
||||
}
|
||||
}
|
||||
|
||||
$fallback = sanitize_key((string) ($settings['thumb_fallback'] ?? 'placeholder'));
|
||||
if (!in_array($fallback, ['placeholder', 'hide', 'random'], true)) {
|
||||
$fallback = 'placeholder';
|
||||
}
|
||||
|
||||
$aspect_ratio = (string) ($settings['thumb_aspect_ratio'] ?? '16:9');
|
||||
if (!in_array($aspect_ratio, ['16:9', '4:3', '1:1', 'auto'], true)) {
|
||||
$aspect_ratio = '16:9';
|
||||
}
|
||||
|
||||
$fit = sanitize_key((string) ($settings['list_thumb_fit'] ?? ''));
|
||||
return [
|
||||
'priority' => $priority,
|
||||
'fallback' => $fallback,
|
||||
'spare_images' => is_array($settings['thumb_spare_images'] ?? null) ? $settings['thumb_spare_images'] : [],
|
||||
'aspect_ratio' => $aspect_ratio,
|
||||
'multi_enabled' => !empty($settings['thumb_multi_enabled']),
|
||||
'multi_count' => max(2, min(6, (int) ($settings['thumb_multi_count'] ?? 3))),
|
||||
'fit' => in_array(sanitize_key((string) ($settings['list_thumb_fit'] ?? 'cover')), ['cover', 'contain'], true) ? sanitize_key((string) ($settings['list_thumb_fit'] ?? 'cover')) : 'cover',
|
||||
'slides_s' => !isset($settings['list_thumb_slides_s']) || !empty($settings['list_thumb_slides_s']),
|
||||
'video_s' => !isset($settings['list_thumb_video_s']) || !empty($settings['list_thumb_video_s']),
|
||||
'video_mute_s' => !isset($settings['list_thumb_video_mute_s']) || !empty($settings['list_thumb_video_mute_s']),
|
||||
'postfirstimg_s' => !isset($settings['thumb_postfirstimg_s']) || !empty($settings['thumb_postfirstimg_s']),
|
||||
'catimg_s' => !isset($settings['thumb_catimg_s']) || !empty($settings['thumb_catimg_s']),
|
||||
'postfirstimg_size'=> in_array(sanitize_key((string) ($settings['thumb_postfirstimg_size'] ?? 'medium')), ['thumbnail', 'medium', 'large', 'full'], true) ? sanitize_key((string) ($settings['thumb_postfirstimg_size'] ?? 'medium')) : 'medium',
|
||||
'mult_thumb_cat_ids' => is_array($settings['mult_thumb_cat'] ?? null) ? array_map('intval', $settings['mult_thumb_cat']) : [],
|
||||
'list_thumb_slides_s' => !array_key_exists('list_thumb_slides_s', $settings) || !empty($settings['list_thumb_slides_s']),
|
||||
'list_thumb_video_s' => !array_key_exists('list_thumb_video_s', $settings) || !empty($settings['list_thumb_video_s']),
|
||||
'list_thumb_video_mute_s' => !array_key_exists('list_thumb_video_mute_s', $settings) || !empty($settings['list_thumb_video_mute_s']),
|
||||
'thumb_postfirstimg_s' => !array_key_exists('thumb_postfirstimg_s', $settings) || !empty($settings['thumb_postfirstimg_s']),
|
||||
'thumb_catimg_s' => !array_key_exists('thumb_catimg_s', $settings) || !empty($settings['thumb_catimg_s']),
|
||||
'list_thumb_fit' => $fit === 'contain' ? 'contain' : '',
|
||||
'thumb_postfirstimg_size' => in_array(sanitize_key((string) ($settings['thumb_postfirstimg_size'] ?? 'medium')), ['thumbnail', 'medium', 'large', 'full'], true) ? sanitize_key((string) ($settings['thumb_postfirstimg_size'] ?? 'medium')) : 'medium',
|
||||
'spare_thumbnail' => $spare,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -262,30 +177,15 @@ class PostDisplay {
|
||||
$maxheight = 1000;
|
||||
}
|
||||
|
||||
// Related: split Zibll display style (img/list/text) from query source (category/tag/random).
|
||||
// Legacy post_related_type held either style (img|list|text) or source (category|tag|random).
|
||||
$raw_related_type = sanitize_key((string) ($settings['post_related_type'] ?? ''));
|
||||
$raw_related_style = sanitize_key((string) ($settings['post_related_style'] ?? ''));
|
||||
$raw_related_source = sanitize_key((string) ($settings['post_related_source'] ?? ''));
|
||||
$related_style = sanitize_key((string) ($settings['post_related_type'] ?? 'img'));
|
||||
if (!in_array($related_style, ['img', 'list', 'text'], true)) {
|
||||
$related_style = 'img';
|
||||
}
|
||||
|
||||
$related_style = 'img';
|
||||
if (in_array($raw_related_style, ['img', 'list', 'text'], true)) {
|
||||
$related_style = $raw_related_style;
|
||||
} elseif (in_array($raw_related_type, ['img', 'list', 'text'], true)) {
|
||||
$related_style = $raw_related_type;
|
||||
}
|
||||
|
||||
$related_source = 'category';
|
||||
if (in_array($raw_related_source, ['category', 'tag', 'random'], true)) {
|
||||
$related_source = $raw_related_source;
|
||||
} elseif (in_array($raw_related_type, ['category', 'tag', 'random'], true)) {
|
||||
$related_source = $raw_related_type;
|
||||
}
|
||||
|
||||
$related_orderby = sanitize_key((string) ($settings['post_related_orderby'] ?? 'views'));
|
||||
if (!in_array($related_orderby, ['rand', 'relevance', 'date', 'views', 'modified'], true)) {
|
||||
$related_orderby = 'views';
|
||||
}
|
||||
$related_orderby = sanitize_key((string) ($settings['post_related_orderby'] ?? 'views'));
|
||||
if (!in_array($related_orderby, ['modified', 'date', 'views', 'like', 'comment_count', 'favorite', 'rand'], true)) {
|
||||
$related_orderby = 'views';
|
||||
}
|
||||
|
||||
return [
|
||||
'toc_enabled' => !isset($settings['post_toc_enabled']) || !empty($settings['post_toc_enabled']),
|
||||
@@ -317,15 +217,11 @@ class PostDisplay {
|
||||
'lightbox_full' => !isset($settings['post_lightbox_full']) || !empty($settings['post_lightbox_full']),
|
||||
'lightbox_down' => !empty($settings['post_lightbox_down']),
|
||||
'lightbox_play' => !empty($settings['post_lightbox_play']),
|
||||
'related_enabled' => !isset($settings['post_related_enabled']) || !empty($settings['post_related_enabled']),
|
||||
'related_count' => max(1, min(20, (int) ($settings['post_related_count'] ?? 6))),
|
||||
// Display style (Zibll img/list/text) + query source (category/tag/random).
|
||||
'related_style' => $related_style,
|
||||
'related_source' => $related_source,
|
||||
// Legacy alias: older code treated related_type as source.
|
||||
'related_type' => $related_source,
|
||||
'related_orderby' => $related_orderby,
|
||||
'related_title' => sanitize_text_field((string) ($settings['post_related_title'] ?? '相关推荐')),
|
||||
'related_enabled' => !isset($settings['post_related_s']) || !empty($settings['post_related_s']),
|
||||
'related_count' => max(4, min(12, (int) ($settings['post_related_n'] ?? 6))),
|
||||
'related_style' => $related_style,
|
||||
'related_orderby' => $related_orderby,
|
||||
'related_title' => sanitize_text_field((string) ($settings['related_title'] ?? '相关推荐')),
|
||||
'like_enabled' => !isset($settings['post_like_enabled']) || !empty($settings['post_like_enabled']),
|
||||
'favorite_enabled' => !isset($settings['post_favorite_enabled']) || !empty($settings['post_favorite_enabled']),
|
||||
// Canonical + legacy share.
|
||||
@@ -534,42 +430,21 @@ class PostDisplay {
|
||||
}
|
||||
|
||||
public static function apply_list_per_page($query): void {
|
||||
if (is_admin() || !$query->is_main_query()) {
|
||||
return;
|
||||
}
|
||||
if (!$query->is_archive() && !$query->is_search() && !$query->is_home()) {
|
||||
return;
|
||||
}
|
||||
$s = Settings::get_all();
|
||||
$per_page = max(4, min(48, (int) ($s['post_list_per_page'] ?? 12)));
|
||||
if ($per_page !== 12) {
|
||||
$query->set('posts_per_page', $per_page);
|
||||
}
|
||||
unset($query);
|
||||
}
|
||||
|
||||
public static function get_archive_layout(): string {
|
||||
$settings = self::get_post_list_style_settings();
|
||||
return $settings['render_mode'];
|
||||
return ($settings['list_type'] ?? 'thumb') === 'card' ? 'card' : 'list';
|
||||
}
|
||||
|
||||
public static function get_post_pagination_mode(): string {
|
||||
$settings = Settings::get_all();
|
||||
|
||||
// Zibll: paging_ajax_s '1' = ajax append, '0' = numeric buttons.
|
||||
if (array_key_exists('paging_ajax_s', $settings)) {
|
||||
$ajax = self::is_list_paging_ajax($settings);
|
||||
if (!$ajax) {
|
||||
return 'numbered';
|
||||
}
|
||||
return self::is_list_paging_ajax_ias($settings) ? 'infinite' : 'load_more';
|
||||
if (!self::is_list_paging_ajax($settings)) {
|
||||
return 'numbered';
|
||||
}
|
||||
|
||||
// Temporary bridge for installs still holding the previous schema key only.
|
||||
$mode = (string) ($settings['post_pagination_mode'] ?? 'numbered');
|
||||
if ($mode === 'numeric') {
|
||||
$mode = 'numbered';
|
||||
}
|
||||
return in_array($mode, ['numbered', 'load_more', 'infinite'], true) ? $mode : 'numbered';
|
||||
return self::is_list_paging_ajax_ias($settings) ? 'infinite' : 'load_more';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -579,12 +454,7 @@ class PostDisplay {
|
||||
*/
|
||||
public static function is_list_paging_ajax(?array $settings = null): bool {
|
||||
$settings = $settings ?? Settings::get_all();
|
||||
if (!array_key_exists('paging_ajax_s', $settings)) {
|
||||
// Fallback from previous 3-mode key.
|
||||
$mode = (string) ($settings['post_pagination_mode'] ?? 'numbered');
|
||||
return in_array($mode, ['load_more', 'infinite', 'ajax'], true);
|
||||
}
|
||||
$raw = $settings['paging_ajax_s'];
|
||||
$raw = $settings['paging_ajax_s'] ?? '1';
|
||||
if (is_bool($raw)) {
|
||||
return $raw;
|
||||
}
|
||||
@@ -601,11 +471,7 @@ class PostDisplay {
|
||||
if (!self::is_list_paging_ajax($settings)) {
|
||||
return false;
|
||||
}
|
||||
if (!array_key_exists('paging_ajax_ias_s', $settings)) {
|
||||
$mode = (string) ($settings['post_pagination_mode'] ?? '');
|
||||
return $mode === 'infinite';
|
||||
}
|
||||
return !empty($settings['paging_ajax_ias_s']);
|
||||
return !array_key_exists('paging_ajax_ias_s', $settings) || !empty($settings['paging_ajax_ias_s']);
|
||||
}
|
||||
|
||||
public static function get_comment_pagination_mode(): string {
|
||||
|
||||
Reference in New Issue
Block a user