refactor: rename the theme brand and every identifier from AKSRT to Jio
Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5b16bc6e15
commit
35bb96e82f
997 files changed
+28216
-28188
No files matched your search
@@ -2,14 +2,14 @@
|
||||
/**
|
||||
* legacy 9.0 article-list configuration and image resolution.
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_renderer_defaults')) {
|
||||
if (!function_exists('jio_renderer_defaults')) {
|
||||
/** @return array<string,mixed> */
|
||||
function aksrt_renderer_defaults(): array {
|
||||
function jio_renderer_defaults(): array {
|
||||
return [
|
||||
'type' => 'auto',
|
||||
'no_author' => false,
|
||||
@@ -30,21 +30,21 @@ if (!function_exists('aksrt_renderer_defaults')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_config')) {
|
||||
if (!function_exists('jio_renderer_config')) {
|
||||
/**
|
||||
* Resolve the one canonical legacy list/card decision matrix.
|
||||
*
|
||||
* @param array<string,mixed> $args Caller arguments.
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
function aksrt_renderer_config(array $args = []): array {
|
||||
function jio_renderer_config(array $args = []): array {
|
||||
$has_no_margin = array_key_exists('no_margin', $args);
|
||||
$args = wp_parse_args($args, aksrt_renderer_defaults());
|
||||
$list = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::get_post_list_style_settings()
|
||||
$args = wp_parse_args($args, jio_renderer_defaults());
|
||||
$list = class_exists('\Jio\Settings\Settings')
|
||||
? \Jio\Settings\Settings::get_post_list_style_settings()
|
||||
: [];
|
||||
$thumb = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::get_post_thumb_settings()
|
||||
$thumb = class_exists('\Jio\Settings\Settings')
|
||||
? \Jio\Settings\Settings::get_post_thumb_settings()
|
||||
: [];
|
||||
|
||||
$list_type = sanitize_key((string) ($list['list_type'] ?? 'thumb'));
|
||||
@@ -86,12 +86,12 @@ if (!function_exists('aksrt_renderer_config')) {
|
||||
$args['badge_types'] = (array) ($list['list_badge_show'] ?? ['pay', 'cat', 'tag']);
|
||||
$args['mult_thumb_cat'] = (array) ($list['mult_thumb_cat'] ?? []);
|
||||
$args['thumb'] = $thumb;
|
||||
$args['allow_conditional_layout'] = aksrt_is_show_sidebar() || wp_is_mobile();
|
||||
$page = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::get_post_page_settings()
|
||||
$args['allow_conditional_layout'] = jio_is_show_sidebar() || wp_is_mobile();
|
||||
$page = class_exists('\Jio\Settings\Settings')
|
||||
? \Jio\Settings\Settings::get_post_page_settings()
|
||||
: [];
|
||||
$comments = class_exists('\AKSRT\Settings\Settings')
|
||||
? \AKSRT\Settings\Settings::get_comment_display_settings()
|
||||
$comments = class_exists('\Jio\Settings\Settings')
|
||||
? \Jio\Settings\Settings::get_comment_display_settings()
|
||||
: [];
|
||||
$args['show_like'] = !array_key_exists('like_enabled', $page) || !empty($page['like_enabled']);
|
||||
$args['close_comments'] = !empty($comments['close_comments']);
|
||||
@@ -100,8 +100,8 @@ if (!function_exists('aksrt_renderer_config')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_highlight_text')) {
|
||||
function aksrt_renderer_highlight_text(string $text, string $query): string {
|
||||
if (!function_exists('jio_renderer_highlight_text')) {
|
||||
function jio_renderer_highlight_text(string $text, string $query): string {
|
||||
$text = wp_strip_all_tags($text);
|
||||
$query = trim($query);
|
||||
if ($query === '' || $text === '') {
|
||||
@@ -125,9 +125,9 @@ if (!function_exists('aksrt_renderer_highlight_text')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_title_markup')) {
|
||||
function aksrt_renderer_title_markup(array $data, array $cfg): string {
|
||||
$title = aksrt_renderer_highlight_text((string) $data['title'], (string) ($cfg['highlight_query'] ?? ''));
|
||||
if (!function_exists('jio_renderer_title_markup')) {
|
||||
function jio_renderer_title_markup(array $data, array $cfg): string {
|
||||
$title = jio_renderer_highlight_text((string) $data['title'], (string) ($cfg['highlight_query'] ?? ''));
|
||||
if ((string) ($data['subtitle'] ?? '') !== '') {
|
||||
$title .= '<span class="focus-color"> ' . esc_html((string) $data['subtitle']) . '</span>';
|
||||
}
|
||||
@@ -135,21 +135,21 @@ if (!function_exists('aksrt_renderer_title_markup')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_excerpt_markup')) {
|
||||
function aksrt_renderer_excerpt_markup(array $data, array $cfg): string {
|
||||
return aksrt_renderer_highlight_text((string) $data['excerpt'], (string) ($cfg['highlight_query'] ?? ''));
|
||||
if (!function_exists('jio_renderer_excerpt_markup')) {
|
||||
function jio_renderer_excerpt_markup(array $data, array $cfg): string {
|
||||
return jio_renderer_highlight_text((string) $data['excerpt'], (string) ($cfg['highlight_query'] ?? ''));
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_curated_images')) {
|
||||
if (!function_exists('jio_renderer_curated_images')) {
|
||||
/** @return string[] */
|
||||
function aksrt_renderer_curated_images(int $post_id, string $size): array {
|
||||
$raw = class_exists('\AKSRT\Core\PostMetaBox')
|
||||
? (string) \AKSRT\Core\PostMetaBox::get_meta_value($post_id, 'featured_slide', '')
|
||||
function jio_renderer_curated_images(int $post_id, string $size): array {
|
||||
$raw = class_exists('\Jio\Core\PostMetaBox')
|
||||
? (string) \Jio\Core\PostMetaBox::get_meta_value($post_id, 'featured_slide', '')
|
||||
: '';
|
||||
$images = [];
|
||||
foreach (array_filter(preg_split('/[\s,]+/', $raw) ?: []) as $token) {
|
||||
$image = aksrt_renderer_sized_image((string) $token, $size);
|
||||
$image = jio_renderer_sized_image((string) $token, $size);
|
||||
if ($image !== '') {
|
||||
$images[] = $image;
|
||||
}
|
||||
@@ -158,8 +158,8 @@ if (!function_exists('aksrt_renderer_curated_images')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_sized_image')) {
|
||||
function aksrt_renderer_sized_image(string $image, string $size): string {
|
||||
if (!function_exists('jio_renderer_sized_image')) {
|
||||
function jio_renderer_sized_image(string $image, string $size): string {
|
||||
$image = trim($image);
|
||||
if ($image === '') {
|
||||
return '';
|
||||
@@ -184,16 +184,16 @@ if (!function_exists('aksrt_renderer_sized_image')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_content_images')) {
|
||||
if (!function_exists('jio_renderer_content_images')) {
|
||||
/** @return string[] */
|
||||
function aksrt_renderer_content_images(int $post_id, string $size): array {
|
||||
function jio_renderer_content_images(int $post_id, string $size): array {
|
||||
$content = strip_shortcodes((string) get_post_field('post_content', $post_id, 'raw'));
|
||||
if ($content === '' || !preg_match_all('/<img.*?(?: |\t|\r|\n)?src=[\'\"]?(.+?)[\'\"]?(?:(?: |\t|\r|\n)+.*?)?>/sim', $content, $matches)) {
|
||||
return [];
|
||||
}
|
||||
$images = [];
|
||||
foreach ((array) ($matches[1] ?? []) as $image) {
|
||||
$sized = aksrt_renderer_sized_image((string) $image, $size);
|
||||
$sized = jio_renderer_sized_image((string) $image, $size);
|
||||
if ($sized !== '') {
|
||||
$images[] = $sized;
|
||||
}
|
||||
@@ -202,55 +202,55 @@ if (!function_exists('aksrt_renderer_content_images')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_category_image')) {
|
||||
function aksrt_renderer_category_image(int $post_id, string $size): string {
|
||||
if (!function_exists('jio_renderer_category_image')) {
|
||||
function jio_renderer_category_image(int $post_id, string $size): string {
|
||||
foreach ((array) get_the_category($post_id) as $category) {
|
||||
$attachment_id = (int) get_term_meta((int) $category->term_id, 'aksrt_category_cover_id', true);
|
||||
$attachment_id = (int) get_term_meta((int) $category->term_id, 'jio_category_cover_id', true);
|
||||
if ($attachment_id > 0) {
|
||||
return aksrt_renderer_sized_image((string) $attachment_id, $size);
|
||||
return jio_renderer_sized_image((string) $attachment_id, $size);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_spare_image')) {
|
||||
function aksrt_renderer_spare_image(array $thumb): string {
|
||||
if (!function_exists('jio_renderer_spare_image')) {
|
||||
function jio_renderer_spare_image(array $thumb): string {
|
||||
$images = array_values(array_filter((array) ($thumb['spare_thumbnail'] ?? [])));
|
||||
return $images ? (string) $images[array_rand($images)] : '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_resolve_images')) {
|
||||
if (!function_exists('jio_renderer_resolve_images')) {
|
||||
/** @return array{primary:string,gallery:string[],slides:string[],has_real:bool,is_slide:bool,video_url:string} */
|
||||
function aksrt_renderer_resolve_images(int $post_id, array $cfg): array {
|
||||
function jio_renderer_resolve_images(int $post_id, array $cfg): array {
|
||||
$thumb = (array) ($cfg['thumb'] ?? []);
|
||||
$size = (string) ($thumb['thumb_postfirstimg_size'] ?? 'medium');
|
||||
$slides = aksrt_renderer_curated_images($post_id, $size);
|
||||
$gallery = aksrt_renderer_content_images($post_id, $size);
|
||||
$video_url = class_exists('\AKSRT\Core\PostMetaBox')
|
||||
? esc_url_raw((string) \AKSRT\Core\PostMetaBox::get_meta_value($post_id, 'featured_video', ''))
|
||||
$slides = jio_renderer_curated_images($post_id, $size);
|
||||
$gallery = jio_renderer_content_images($post_id, $size);
|
||||
$video_url = class_exists('\Jio\Core\PostMetaBox')
|
||||
? esc_url_raw((string) \Jio\Core\PostMetaBox::get_meta_value($post_id, 'featured_video', ''))
|
||||
: '';
|
||||
|
||||
$thumbnail_id = (int) get_post_thumbnail_id($post_id);
|
||||
$primary = $thumbnail_id > 0 ? aksrt_renderer_sized_image((string) $thumbnail_id, $size) : '';
|
||||
$primary = $thumbnail_id > 0 ? jio_renderer_sized_image((string) $thumbnail_id, $size) : '';
|
||||
if ($primary === '') {
|
||||
$primary = class_exists('\AKSRT\Core\PostMetaBox')
|
||||
? esc_url_raw((string) \AKSRT\Core\PostMetaBox::get_meta_value($post_id, 'thumbnail_url', ''))
|
||||
$primary = class_exists('\Jio\Core\PostMetaBox')
|
||||
? esc_url_raw((string) \Jio\Core\PostMetaBox::get_meta_value($post_id, 'thumbnail_url', ''))
|
||||
: '';
|
||||
}
|
||||
if ($primary === '' && !empty($thumb['thumb_postfirstimg_s']) && !empty($gallery[0])) {
|
||||
$primary = (string) $gallery[0];
|
||||
}
|
||||
if ($primary === '' && !empty($thumb['thumb_catimg_s'])) {
|
||||
$primary = aksrt_renderer_category_image($post_id, $size);
|
||||
$primary = jio_renderer_category_image($post_id, $size);
|
||||
}
|
||||
$has_real = $primary !== '';
|
||||
if ($primary === '') {
|
||||
$primary = aksrt_renderer_spare_image($thumb);
|
||||
$primary = jio_renderer_spare_image($thumb);
|
||||
}
|
||||
if ($primary === '') {
|
||||
$primary = (string) aksrt_get_lazy_thumb();
|
||||
$primary = (string) jio_get_lazy_thumb();
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
/**
|
||||
* legacy 9.0 article-list DOM contract.
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_renderer_list')) {
|
||||
function aksrt_renderer_list(array $data, array $cfg): string {
|
||||
if (!function_exists('jio_renderer_list')) {
|
||||
function jio_renderer_list(array $data, array $cfg): string {
|
||||
$classes = ['posts-item', 'list', 'ajax-item'];
|
||||
if ((string) ($cfg['style'] ?? '') !== '') {
|
||||
$classes[] = (string) $cfg['style'];
|
||||
@@ -24,17 +24,17 @@ if (!function_exists('aksrt_renderer_list')) {
|
||||
}
|
||||
$classes[] = ($cfg['style'] ?? '') === 'style2' ? 'flex xx' : 'flex';
|
||||
|
||||
$title = '<h2 class="item-heading' . (!empty($cfg['heading_bold']) ? ' font-bold' : '') . '"><a' . (!empty($cfg['target_blank']) ? ' target="_blank"' : '') . ' href="' . esc_url((string) $data['permalink']) . '">' . aksrt_renderer_title_markup($data, $cfg) . '</a></h2>';
|
||||
$title = '<h2 class="item-heading' . (!empty($cfg['heading_bold']) ? ' font-bold' : '') . '"><a' . (!empty($cfg['target_blank']) ? ' target="_blank"' : '') . ' href="' . esc_url((string) $data['permalink']) . '">' . jio_renderer_title_markup($data, $cfg) . '</a></h2>';
|
||||
$excerpt_class = ($cfg['style'] ?? '') === 'style2' ? 'text-ellipsis-2' : 'text-ellipsis';
|
||||
$excerpt = '<div class="item-excerpt muted-color ' . $excerpt_class . ' mb6">' . aksrt_renderer_excerpt_markup($data, $cfg) . '</div>';
|
||||
$thumb = aksrt_renderer_thumb($data, $cfg);
|
||||
$mult = aksrt_renderer_mult_thumb($data, $cfg);
|
||||
$excerpt = '<div class="item-excerpt muted-color ' . $excerpt_class . ' mb6">' . jio_renderer_excerpt_markup($data, $cfg) . '</div>';
|
||||
$thumb = jio_renderer_thumb($data, $cfg);
|
||||
$mult = jio_renderer_mult_thumb($data, $cfg);
|
||||
$graphic = '';
|
||||
if ($thumb !== '' && empty($data['is_mult_thumb'])) {
|
||||
$graphic = '<div class="post-graphic' . (($cfg['img_position'] ?? 'left') === 'right' ? ' order1' : '') . '">' . $thumb . '</div>';
|
||||
}
|
||||
$badges = aksrt_renderer_badges($data, $cfg);
|
||||
$meta = aksrt_renderer_meta($data, $cfg, false);
|
||||
$badges = jio_renderer_badges($data, $cfg);
|
||||
$meta = jio_renderer_meta($data, $cfg, false);
|
||||
$html = '<posts class="' . esc_attr(implode(' ', $classes)) . '">';
|
||||
if (($cfg['style'] ?? '') === 'style2') {
|
||||
$html .= $title . '<div class="flex">' . $graphic . '<div class="item-body flex xx flex1 jsb">';
|
||||
@@ -49,32 +49,32 @@ if (!function_exists('aksrt_renderer_list')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_card')) {
|
||||
function aksrt_renderer_card(array $data, array $cfg): string {
|
||||
if (!function_exists('jio_renderer_card')) {
|
||||
function jio_renderer_card(array $data, array $cfg): string {
|
||||
$classes = ['posts-item', 'card', 'ajax-item'];
|
||||
if ((string) ($cfg['style'] ?? '') !== '') {
|
||||
$classes[] = (string) $cfg['style'];
|
||||
}
|
||||
$title = '<h2 class="item-heading' . (!empty($cfg['heading_bold']) ? ' font-bold' : '') . '"><a' . (!empty($cfg['target_blank']) ? ' target="_blank"' : '') . ' href="' . esc_url((string) $data['permalink']) . '">' . aksrt_renderer_title_markup($data, $cfg) . '</a></h2>';
|
||||
$title = '<h2 class="item-heading' . (!empty($cfg['heading_bold']) ? ' font-bold' : '') . '"><a' . (!empty($cfg['target_blank']) ? ' target="_blank"' : '') . ' href="' . esc_url((string) $data['permalink']) . '">' . jio_renderer_title_markup($data, $cfg) . '</a></h2>';
|
||||
|
||||
$html = '<posts class="' . esc_attr(implode(' ', $classes)) . '">';
|
||||
$html .= aksrt_renderer_thumb($data, $cfg);
|
||||
$html .= jio_renderer_thumb($data, $cfg);
|
||||
$html .= '<div class="item-body">' . $title;
|
||||
$html .= aksrt_renderer_badges($data, $cfg);
|
||||
$html .= aksrt_renderer_meta($data, $cfg, true);
|
||||
$html .= jio_renderer_badges($data, $cfg);
|
||||
$html .= jio_renderer_meta($data, $cfg, true);
|
||||
return $html . '</div></posts>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_mini')) {
|
||||
function aksrt_renderer_mini(array $data, array $cfg = []): string {
|
||||
if (!function_exists('jio_renderer_mini')) {
|
||||
function jio_renderer_mini(array $data, array $cfg = []): string {
|
||||
$target = !empty($cfg['target_blank']) ? ' target="_blank"' : '';
|
||||
$thumb = '';
|
||||
$show_thumb = !array_key_exists('show_thumb', $cfg) || !empty($cfg['show_thumb']);
|
||||
$show_meta = !array_key_exists('show_meta', $cfg) || !empty($cfg['show_meta']);
|
||||
if ($show_thumb && (string) $data['primary'] !== '') {
|
||||
$default_attr = empty($data['has_real']) ? ' data-thumb="default"' : '';
|
||||
$thumb = '<div class="mr10"><div class="item-thumbnail"><a' . $target . ' href="' . esc_url((string) $data['permalink']) . '"><img' . $default_attr . aksrt_get_lazy_attr('lazy_posts_thumb', (string) $data['primary'], 'fit-cover radius8') . ' alt="' . esc_attr((string) $data['title']) . '"></a></div></div>';
|
||||
$thumb = '<div class="mr10"><div class="item-thumbnail"><a' . $target . ' href="' . esc_url((string) $data['permalink']) . '"><img' . $default_attr . jio_get_lazy_attr('lazy_posts_thumb', (string) $data['primary'], 'fit-cover radius8') . ' alt="' . esc_attr((string) $data['title']) . '"></a></div></div>';
|
||||
}
|
||||
$number = '';
|
||||
if (!empty($cfg['show_number'])) {
|
||||
@@ -93,11 +93,11 @@ if (!function_exists('aksrt_renderer_mini')) {
|
||||
$show_time = !empty($cfg['show_time']);
|
||||
if (!empty($cfg['show_author'])) {
|
||||
$author_value = $show_time ? (string) $data['time_ago'] : (string) $data['author_name'];
|
||||
$meta_left = '<item class="meta-author flex ac">' . aksrt_get_avatar_box((int) $data['author_id'], 'avatar-mini') . '<span class="ml6">' . esc_html($author_value) . '</span></item>';
|
||||
$meta_left = '<item class="meta-author flex ac">' . jio_get_avatar_box((int) $data['author_id'], 'avatar-mini') . '<span class="ml6">' . esc_html($author_value) . '</span></item>';
|
||||
} else {
|
||||
$meta_left = $show_time ? '<item title="' . esc_attr((string) $data['time_title']) . '" class="icon-circle mln3">' . esc_html((string) $data['time_ago']) . '</item>' : '';
|
||||
}
|
||||
$pay = aksrt_renderer_pay_badge($data, true);
|
||||
$pay = jio_renderer_pay_badge($data, true);
|
||||
if ($meta_left === '') {
|
||||
$meta_left = $pay;
|
||||
$pay = '';
|
||||
@@ -105,7 +105,7 @@ if (!function_exists('aksrt_renderer_mini')) {
|
||||
if ($meta_left === '') {
|
||||
$meta_left = '<item></item>';
|
||||
}
|
||||
$meta_right = $pay . '<item class="meta-view">' . aksrt_renderer_svg_icon('view') . esc_html(aksrt_renderer_meta_number((int) $data['views'])) . '</item>';
|
||||
$meta_right = $pay . '<item class="meta-view">' . jio_renderer_svg_icon('view') . esc_html(jio_renderer_meta_number((int) $data['views'])) . '</item>';
|
||||
$meta = '<div class="item-meta muted-2-color flex jsb ac' . (!$show_thumb ? ' mt6' : '') . '">' . $meta_left . '<div class="meta-right">' . $meta_right . '</div></div>';
|
||||
}
|
||||
$class = trim('posts-mini ' . (string) ($cfg['class'] ?? ''));
|
||||
@@ -113,31 +113,31 @@ if (!function_exists('aksrt_renderer_mini')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_render_post')) {
|
||||
function aksrt_render_post(array $args = []): string {
|
||||
$cfg = aksrt_renderer_config($args);
|
||||
$data = aksrt_renderer_collect_post_data($cfg);
|
||||
if (!function_exists('jio_render_post')) {
|
||||
function jio_render_post(array $args = []): string {
|
||||
$cfg = jio_renderer_config($args);
|
||||
$data = jio_renderer_collect_post_data($cfg);
|
||||
if (!$data) {
|
||||
return '';
|
||||
}
|
||||
return ($cfg['mode'] ?? 'list') === 'card'
|
||||
? aksrt_renderer_card($data, $cfg)
|
||||
: aksrt_renderer_list($data, $cfg);
|
||||
? jio_renderer_card($data, $cfg)
|
||||
: jio_renderer_list($data, $cfg);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_render_post_list')) {
|
||||
if (!function_exists('jio_render_post_list')) {
|
||||
/**
|
||||
* Render the canonical article stream.
|
||||
*
|
||||
* @param array<string,mixed> $args legacy-shaped list arguments.
|
||||
* @param WP_Query|null $query Optional custom query.
|
||||
*/
|
||||
function aksrt_render_post_list(array $args = [], ?WP_Query $query = null, bool $echo = true): string {
|
||||
$cfg = aksrt_renderer_config($args);
|
||||
function jio_render_post_list(array $args = [], ?WP_Query $query = null, bool $echo = true): string {
|
||||
$cfg = jio_renderer_config($args);
|
||||
$has_posts = $query instanceof WP_Query ? $query->have_posts() : have_posts();
|
||||
if (!$has_posts) {
|
||||
$html = aksrt_get_null(__('暂无内容', 'aksrt'), 100, 'null-post.svg');
|
||||
$html = jio_get_null(__('暂无内容', 'jio'), 100, 'null-post.svg');
|
||||
if ($echo) {
|
||||
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
return '';
|
||||
@@ -161,13 +161,13 @@ if (!function_exists('aksrt_render_post_list')) {
|
||||
if ($query instanceof WP_Query) {
|
||||
while ($query->have_posts()) {
|
||||
$query->the_post();
|
||||
$html .= aksrt_render_post($cfg);
|
||||
$html .= jio_render_post($cfg);
|
||||
}
|
||||
wp_reset_postdata();
|
||||
} else {
|
||||
while (have_posts()) {
|
||||
the_post();
|
||||
$html .= aksrt_render_post($cfg);
|
||||
$html .= jio_render_post($cfg);
|
||||
}
|
||||
}
|
||||
$html .= $append_inner_html;
|
||||
@@ -183,21 +183,21 @@ if (!function_exists('aksrt_render_post_list')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_render_mini_list')) {
|
||||
function aksrt_render_mini_list(WP_Query $query, array $args = [], bool $echo = true): string {
|
||||
$cfg = aksrt_renderer_config($args);
|
||||
if (!function_exists('jio_render_mini_list')) {
|
||||
function jio_render_mini_list(WP_Query $query, array $args = [], bool $echo = true): string {
|
||||
$cfg = jio_renderer_config($args);
|
||||
// The reference mini rows follow the site's list ordering time source.
|
||||
$cfg['time_source'] = $cfg['list_orderby'] === 'modified' ? 'modified' : 'date';
|
||||
$html = '';
|
||||
$number = max(0, (int) ($args['number_offset'] ?? 0));
|
||||
while ($query->have_posts()) {
|
||||
$query->the_post();
|
||||
$data = aksrt_renderer_collect_post_data($cfg);
|
||||
$data = jio_renderer_collect_post_data($cfg);
|
||||
if (!$data) {
|
||||
continue;
|
||||
}
|
||||
$number++;
|
||||
$html .= aksrt_renderer_mini($data, array_merge($cfg, ['number_offset' => $number]));
|
||||
$html .= jio_renderer_mini($data, array_merge($cfg, ['number_offset' => $number]));
|
||||
}
|
||||
wp_reset_postdata();
|
||||
if ($echo) {
|
||||
@@ -208,7 +208,7 @@ if (!function_exists('aksrt_render_mini_list')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_render_placeholder')) {
|
||||
if (!function_exists('jio_render_placeholder')) {
|
||||
/**
|
||||
* 骨架屏占位,1:1 对齐参考主题 `zib_get_post_placeholder()`。
|
||||
*
|
||||
@@ -226,7 +226,7 @@ if (!function_exists('aksrt_render_placeholder')) {
|
||||
* @param string $mode list|card|mini|mini_thumb。
|
||||
* @param int $count 重复数量,1–12。
|
||||
*/
|
||||
function aksrt_render_placeholder(string $mode = 'list', int $count = 3): string {
|
||||
function jio_render_placeholder(string $mode = 'list', int $count = 3): string {
|
||||
$count = max(1, min(12, $count));
|
||||
if ($mode === 'mini') {
|
||||
$item = '<div class="posts-mini"><div class="placeholder k1"></div></div>';
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
/**
|
||||
* legacy 9.0 article-list data and markup fragments.
|
||||
*
|
||||
* @package AKSRT
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_renderer_collect_post_data')) {
|
||||
if (!function_exists('jio_renderer_collect_post_data')) {
|
||||
/** @return array<string,mixed> */
|
||||
function aksrt_renderer_collect_post_data(array $cfg): array {
|
||||
function jio_renderer_collect_post_data(array $cfg): array {
|
||||
$post_id = (int) get_the_ID();
|
||||
if ($post_id <= 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$images = aksrt_renderer_resolve_images($post_id, $cfg);
|
||||
$images = jio_renderer_resolve_images($post_id, $cfg);
|
||||
$categories = get_the_category($post_id) ?: [];
|
||||
$tags = get_the_tags($post_id) ?: [];
|
||||
$content_images = (array) $images['gallery'];
|
||||
@@ -60,10 +60,10 @@ if (!function_exists('aksrt_renderer_collect_post_data')) {
|
||||
: (string) get_the_modified_time('Y-m-d H:i:s', $post_id);
|
||||
$time_timestamp = strtotime($time_value) ?: (int) get_the_time('U', $post_id);
|
||||
|
||||
$subtitle = class_exists('\AKSRT\Core\PostMetaBox')
|
||||
? (string) \AKSRT\Core\PostMetaBox::get_meta_value($post_id, 'subtitle', '')
|
||||
$subtitle = class_exists('\Jio\Core\PostMetaBox')
|
||||
? (string) \Jio\Core\PostMetaBox::get_meta_value($post_id, 'subtitle', '')
|
||||
: '';
|
||||
$pay_meta = aksrt_get_pay_meta($post_id);
|
||||
$pay_meta = jio_get_pay_meta($post_id);
|
||||
if (!is_array($pay_meta)) {
|
||||
$pay_meta = [];
|
||||
}
|
||||
@@ -88,15 +88,15 @@ if (!function_exists('aksrt_renderer_collect_post_data')) {
|
||||
'author_id' => $author_id,
|
||||
'author_name' => $author instanceof WP_User ? $author->display_name : '',
|
||||
'time_title' => $time_value,
|
||||
'time_ago' => human_time_diff($time_timestamp, current_time('timestamp')) . __('前', 'aksrt'),
|
||||
'views' => (int) aksrt_get_post_views($post_id),
|
||||
'likes' => (int) aksrt_get_post_likes($post_id),
|
||||
'time_ago' => human_time_diff($time_timestamp, current_time('timestamp')) . __('前', 'jio'),
|
||||
'views' => (int) jio_get_post_views($post_id),
|
||||
'likes' => (int) jio_get_post_likes($post_id),
|
||||
'comments' => (int) get_comments_number($post_id),
|
||||
'comments_open' => comments_open($post_id),
|
||||
'comments_link' => get_comments_link($post_id),
|
||||
'post_type' => (string) get_post_type($post_id),
|
||||
'is_sticky' => is_sticky($post_id),
|
||||
'resource_badge' => (string) aksrt_resource_card_badge_text($post_id),
|
||||
'resource_badge' => (string) jio_resource_card_badge_text($post_id),
|
||||
'pay_meta' => $pay_meta,
|
||||
'pay_type' => sanitize_key((string) ($pay_meta['pay_type'] ?? 'no')),
|
||||
'pay_limit' => (int) ($pay_meta['pay_limit'] ?? 0),
|
||||
@@ -104,8 +104,8 @@ if (!function_exists('aksrt_renderer_collect_post_data')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_thumb')) {
|
||||
function aksrt_renderer_thumb(array $data, array $cfg): string {
|
||||
if (!function_exists('jio_renderer_thumb')) {
|
||||
function jio_renderer_thumb(array $data, array $cfg): string {
|
||||
if (!empty($data['is_no_thumb']) || (string) $data['primary'] === '') {
|
||||
return '';
|
||||
}
|
||||
@@ -120,20 +120,20 @@ if (!function_exists('aksrt_renderer_thumb')) {
|
||||
if ($has_video_thumb) {
|
||||
$muted = !empty($cfg['thumb']['list_thumb_video_mute_s']);
|
||||
$content .= '<div class="video-thumb-box" video-url="' . esc_url((string) $data['video_url']) . '" data-volume="' . ($muted ? 'none' : '100') . '">';
|
||||
$content .= '<div class="img-thumb"><img' . $default_attr . aksrt_get_lazy_attr('lazy_posts_thumb', (string) $data['primary'], 'fit-cover radius8') . ' alt="' . esc_attr((string) $data['title']) . '"></div>';
|
||||
$content .= '<div class="img-thumb"><img' . $default_attr . jio_get_lazy_attr('lazy_posts_thumb', (string) $data['primary'], 'fit-cover radius8') . ' alt="' . esc_attr((string) $data['title']) . '"></div>';
|
||||
$content .= '<div class="video-thumb"></div></div>';
|
||||
$format_icon = '<i class="fa fas fa-play-circle em12 mt6 c-white opacity8" aria-hidden="true"></i>';
|
||||
} elseif ($has_slides) {
|
||||
$single_slide = count((array) $data['slides']) === 1;
|
||||
$slide_image_class = 'radius8' . (aksrt_is_lazy('lazy_sider') ? ' swiper-lazy' : '');
|
||||
$content .= '<div class="relative aksrt-slider"><div class="new-swiper item-thumbnail' . ($is_contain ? ' gradient-background' : '') . ($single_slide ? ' swiper-container-initialized' : '') . '" data-loop="true" data-effect="slide" data-autoplay="1" data-interval="4000"><div class="swiper-wrapper">';
|
||||
$slide_image_class = 'radius8' . (jio_is_lazy('lazy_sider') ? ' swiper-lazy' : '');
|
||||
$content .= '<div class="relative jio-slider"><div class="new-swiper item-thumbnail' . ($is_contain ? ' gradient-background' : '') . ($single_slide ? ' swiper-container-initialized' : '') . '" data-loop="true" data-effect="slide" data-autoplay="1" data-interval="4000"><div class="swiper-wrapper">';
|
||||
foreach ((array) $data['slides'] as $image) {
|
||||
$content .= '<div class="swiper-slide' . ($is_contain ? ' gradient-bg' : '') . '"' . ($is_contain ? ' data-opacity="0.2"' : '') . '><a' . $target . ' href="' . esc_url((string) $data['permalink']) . '"><img' . aksrt_get_lazy_attr('lazy_sider', (string) $image, $slide_image_class) . ' alt="' . esc_attr((string) $data['title']) . '"></a></div>';
|
||||
$content .= '<div class="swiper-slide' . ($is_contain ? ' gradient-bg' : '') . '"' . ($is_contain ? ' data-opacity="0.2"' : '') . '><a' . $target . ' href="' . esc_url((string) $data['permalink']) . '"><img' . jio_get_lazy_attr('lazy_sider', (string) $image, $slide_image_class) . ' alt="' . esc_attr((string) $data['title']) . '"></a></div>';
|
||||
}
|
||||
$content .= '</div>' . ($single_slide ? '' : '<div class="swiper-pagination kaoyou"></div>') . '</div></div>';
|
||||
$format_icon = '<badge class="b-black opacity8 mt6"><i class="fa fas fa-image mr3" aria-hidden="true"></i>' . count((array) $data['slides']) . '</badge>';
|
||||
} else {
|
||||
$content .= '<a' . $target . ' href="' . esc_url((string) $data['permalink']) . '"><img' . $default_attr . aksrt_get_lazy_attr('lazy_posts_thumb', (string) $data['primary'], 'fit-cover radius8') . ' alt="' . esc_attr((string) $data['title']) . '"></a>';
|
||||
$content .= '<a' . $target . ' href="' . esc_url((string) $data['permalink']) . '"><img' . $default_attr . jio_get_lazy_attr('lazy_posts_thumb', (string) $data['primary'], 'fit-cover radius8') . ' alt="' . esc_attr((string) $data['title']) . '"></a>';
|
||||
$format = get_post_format((int) $data['post_id']);
|
||||
if ((string) $data['video_url'] !== '') {
|
||||
$format_icon = '<i class="fa fas fa-play-circle em12 mt6 c-white opacity8" aria-hidden="true"></i>';
|
||||
@@ -148,7 +148,7 @@ if (!function_exists('aksrt_renderer_thumb')) {
|
||||
$content .= '<div class="abs-center right-top">' . $format_icon . '</div>';
|
||||
}
|
||||
if (!empty($data['is_sticky'])) {
|
||||
$content .= '<badge class="img-badge left jb-red">' . esc_html__('置顶', 'aksrt') . '</badge>';
|
||||
$content .= '<badge class="img-badge left jb-red">' . esc_html__('置顶', 'jio') . '</badge>';
|
||||
}
|
||||
|
||||
$fit = $is_contain && !$has_slides ? ' contain gradient-bg' : '';
|
||||
@@ -157,8 +157,8 @@ if (!function_exists('aksrt_renderer_thumb')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_mult_thumb')) {
|
||||
function aksrt_renderer_mult_thumb(array $data, array $cfg): string {
|
||||
if (!function_exists('jio_renderer_mult_thumb')) {
|
||||
function jio_renderer_mult_thumb(array $data, array $cfg): string {
|
||||
if (empty($data['is_mult_thumb'])) {
|
||||
return '';
|
||||
}
|
||||
@@ -170,16 +170,16 @@ if (!function_exists('aksrt_renderer_mult_thumb')) {
|
||||
if ($index === 3 && (int) ($data['gallery_count'] ?? 0) > 4) {
|
||||
$badge = '<div class="abs-center right-top"><badge class="b-black mr6 mt6 em09"><i class="fa fas fa-image mr3" aria-hidden="true"></i>+' . ((int) $data['gallery_count'] - 4) . '</badge></div>';
|
||||
}
|
||||
$html .= '<span>' . $badge . '<img' . aksrt_get_lazy_attr('lazy_posts_thumb', (string) $image, 'fit-cover radius8') . ' alt=""></span>';
|
||||
$html .= '<span>' . $badge . '<img' . jio_get_lazy_attr('lazy_posts_thumb', (string) $image, 'fit-cover radius8') . ' alt=""></span>';
|
||||
}
|
||||
return $html . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_pay_badge')) {
|
||||
function aksrt_renderer_pay_badge(array $data, bool $compact = false): string {
|
||||
if (!function_exists('jio_renderer_pay_badge')) {
|
||||
function jio_renderer_pay_badge(array $data, bool $compact = false): string {
|
||||
if ($compact) {
|
||||
return aksrt_renderer_compact_pay_badge((array) ($data['pay_meta'] ?? []));
|
||||
return jio_renderer_compact_pay_badge((array) ($data['pay_meta'] ?? []));
|
||||
}
|
||||
if ((string) $data['resource_badge'] === '') {
|
||||
return '';
|
||||
@@ -187,22 +187,22 @@ if (!function_exists('aksrt_renderer_pay_badge')) {
|
||||
$is_vip = (int) ($data['pay_limit'] ?? 0) > 0 || (string) ($data['pay_type'] ?? '') === 'vip';
|
||||
$vip_level = max(1, min(2, (int) ($data['pay_limit'] ?? 1)));
|
||||
$class = $is_vip ? 'jb-vip' . $vip_level : 'c-yellow';
|
||||
$type_labels = function_exists('aksrt_get_pay_types') ? aksrt_get_pay_types() : [];
|
||||
$title = (string) ($type_labels[(string) ($data['pay_type'] ?? '')] ?? __('付费内容', 'aksrt'));
|
||||
$icon = $is_vip ? aksrt_renderer_vip_icon($vip_level) : '';
|
||||
$type_labels = function_exists('jio_get_pay_types') ? jio_get_pay_types() : [];
|
||||
$title = (string) ($type_labels[(string) ($data['pay_type'] ?? '')] ?? __('付费内容', 'jio'));
|
||||
$icon = $is_vip ? jio_renderer_vip_icon($vip_level) : '';
|
||||
$tooltip = $is_vip ? ' data-toggle="tooltip" title="' . esc_attr($title) . '"' : '';
|
||||
return '<a rel="nofollow" href="' . esc_url((string) $data['permalink']) . '#posts-pay"' . $tooltip . ' class="meta-pay but ' . esc_attr($is_vip ? $class : 'jb-yellow') . '">' . $icon . esc_html((string) $data['resource_badge']) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_compact_pay_badge')) {
|
||||
if (!function_exists('jio_renderer_compact_pay_badge')) {
|
||||
/** Compact article meta uses the published price and a type icon, not the large tag's text. */
|
||||
function aksrt_renderer_compact_pay_badge(array $meta): string {
|
||||
function jio_renderer_compact_pay_badge(array $meta): string {
|
||||
$types = [
|
||||
'reading' => [__('付费阅读', 'aksrt'), 'fa fas fa-book'],
|
||||
'download' => [__('付费资源', 'aksrt'), 'fa fas fa-download'],
|
||||
'gallery' => [__('付费图片', 'aksrt'), 'fa far fa-file-image'],
|
||||
'video' => [__('付费视频', 'aksrt'), 'fa fas fa-play-circle'],
|
||||
'reading' => [__('付费阅读', 'jio'), 'fa fas fa-book'],
|
||||
'download' => [__('付费资源', 'jio'), 'fa fas fa-download'],
|
||||
'gallery' => [__('付费图片', 'jio'), 'fa far fa-file-image'],
|
||||
'video' => [__('付费视频', 'jio'), 'fa fas fa-play-circle'],
|
||||
];
|
||||
$type = (string) ($meta['pay_type'] ?? 'no');
|
||||
if (!isset($types[$type])) {
|
||||
@@ -210,22 +210,22 @@ if (!function_exists('aksrt_renderer_compact_pay_badge')) {
|
||||
}
|
||||
[$title, $type_icon] = $types[$type];
|
||||
$points = ($meta['pay_modo'] ?? '0') === 'points';
|
||||
$price = $points ? (string) max(0, (int) ($meta['points_price'] ?? 0)) : aksrt_format_price((string) ($meta['price'] ?? '0.00'));
|
||||
$icon = aksrt_icon_markup($type_icon, 'mr3');
|
||||
$price = $points ? (string) max(0, (int) ($meta['points_price'] ?? 0)) : jio_format_price((string) ($meta['price'] ?? '0.00'));
|
||||
$icon = jio_icon_markup($type_icon, 'mr3');
|
||||
$class = 'c-yellow';
|
||||
if ($price === '0') {
|
||||
$title = str_replace(__('付费', 'aksrt'), __('免费', 'aksrt'), $title);
|
||||
$label = esc_html__('免费', 'aksrt');
|
||||
$title = str_replace(__('付费', 'jio'), __('免费', 'jio'), $title);
|
||||
$label = esc_html__('免费', 'jio');
|
||||
} else {
|
||||
$level = max(0, min(2, (int) ($meta['pay_limit'] ?? 0)));
|
||||
$vip = \AKSRT\Settings\Settings::get_payment_vip_settings();
|
||||
$vip = \Jio\Settings\Settings::get_payment_vip_settings();
|
||||
if ($level > 0 && !empty($vip['enabled'])) {
|
||||
$class = 'jb-vip' . $level;
|
||||
$icon = aksrt_renderer_vip_icon($level);
|
||||
$label = esc_html__('会员专属', 'aksrt');
|
||||
$icon = jio_renderer_vip_icon($level);
|
||||
$label = esc_html__('会员专属', 'jio');
|
||||
} else {
|
||||
$display = \AKSRT\Settings\Settings::get_paid_content_settings()['display'];
|
||||
$mark = $points ? aksrt_icon_markup('zibsvg-points', 'points-mark') : esc_html((string) ($display['currency_symbol'] ?? '¥'));
|
||||
$display = \Jio\Settings\Settings::get_paid_content_settings()['display'];
|
||||
$mark = $points ? jio_icon_markup('zibsvg-points', 'points-mark') : esc_html((string) ($display['currency_symbol'] ?? '¥'));
|
||||
$label = '<span class="em09">' . $mark . '</span>' . esc_html($price);
|
||||
}
|
||||
}
|
||||
@@ -233,24 +233,24 @@ if (!function_exists('aksrt_renderer_compact_pay_badge')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_vip_icon')) {
|
||||
function aksrt_renderer_vip_icon(int $level): string {
|
||||
$settings = \AKSRT\Settings\Settings::get_payment_vip_settings();
|
||||
if (!function_exists('jio_renderer_vip_icon')) {
|
||||
function jio_renderer_vip_icon(int $level): string {
|
||||
$settings = \Jio\Settings\Settings::get_payment_vip_settings();
|
||||
$url = (string) ($settings['levels'][$level]['img_icon'] ?? '');
|
||||
if ($url === '') {
|
||||
$url = get_template_directory_uri() . '/assets/img/user/vip/vip-' . $level . '.svg';
|
||||
}
|
||||
$name = (string) ($settings['levels'][$level]['name'] ?? 'VIP');
|
||||
return '<img' . aksrt_get_lazy_attr('lazy_other', $url, 'img-icon mr3') . ' data-toggle="tooltip" title="' . esc_attr($name) . '" alt="' . esc_attr($name) . '">';
|
||||
return '<img' . jio_get_lazy_attr('lazy_other', $url, 'img-icon mr3') . ' data-toggle="tooltip" title="' . esc_attr($name) . '" alt="' . esc_attr($name) . '">';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_badges')) {
|
||||
function aksrt_renderer_badges(array $data, array $cfg): string {
|
||||
if (!function_exists('jio_renderer_badges')) {
|
||||
function jio_renderer_badges(array $data, array $cfg): string {
|
||||
$items = [];
|
||||
$types = (array) ($cfg['badge_types'] ?? []);
|
||||
if (in_array('pay', $types, true)) {
|
||||
$pay = aksrt_renderer_pay_badge($data);
|
||||
$pay = jio_renderer_pay_badge($data);
|
||||
if ($pay !== '') {
|
||||
$items[] = $pay;
|
||||
}
|
||||
@@ -258,34 +258,34 @@ if (!function_exists('aksrt_renderer_badges')) {
|
||||
if (empty($cfg['is_category']) && in_array('cat', $types, true)) {
|
||||
$colors = ['c-blue', 'c-yellow', 'c-green', 'c-purple', 'c-red'];
|
||||
foreach (array_slice((array) $data['categories'], 0, 3) as $index => $category) {
|
||||
$items[] = '<a class="but ' . esc_attr($colors[$index % count($colors)]) . '" title="' . esc_attr__('查看更多分类文章', 'aksrt') . '" href="' . esc_url(get_category_link($category->term_id)) . '"><i class="fa fas fa-folder-open" aria-hidden="true"></i>' . esc_html($category->name) . '</a>';
|
||||
$items[] = '<a class="but ' . esc_attr($colors[$index % count($colors)]) . '" title="' . esc_attr__('查看更多分类文章', 'jio') . '" href="' . esc_url(get_category_link($category->term_id)) . '"><i class="fa fas fa-folder-open" aria-hidden="true"></i>' . esc_html($category->name) . '</a>';
|
||||
}
|
||||
}
|
||||
if (empty($cfg['is_tag']) && in_array('tag', $types, true)) {
|
||||
$tags = (array) $data['tags'];
|
||||
usort($tags, static fn($left, $right): int => (int) $right->count <=> (int) $left->count);
|
||||
foreach (array_slice($tags, 0, 3) as $tag) {
|
||||
$items[] = '<a class="but" title="' . esc_attr__('查看此标签更多文章', 'aksrt') . '" href="' . esc_url(get_tag_link($tag->term_id)) . '"># ' . esc_html($tag->name) . '</a>';
|
||||
$items[] = '<a class="but" title="' . esc_attr__('查看此标签更多文章', 'jio') . '" href="' . esc_url(get_tag_link($tag->term_id)) . '"># ' . esc_html($tag->name) . '</a>';
|
||||
}
|
||||
}
|
||||
return $items ? '<div class="item-tags scroll-x no-scrollbar mb6">' . implode('', $items) . '</div>' : '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_meta_number')) {
|
||||
function aksrt_renderer_meta_number(int $number): string {
|
||||
return (string) aksrt_format_number($number);
|
||||
if (!function_exists('jio_renderer_meta_number')) {
|
||||
function jio_renderer_meta_number(int $number): string {
|
||||
return (string) jio_format_number($number);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_svg_icon')) {
|
||||
function aksrt_renderer_svg_icon(string $name): string {
|
||||
return aksrt_icon_markup('zibsvg-' . $name);
|
||||
if (!function_exists('jio_renderer_svg_icon')) {
|
||||
function jio_renderer_svg_icon(string $name): string {
|
||||
return jio_icon_markup('zibsvg-' . $name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_renderer_meta')) {
|
||||
function aksrt_renderer_meta(array $data, array $cfg, bool $is_card = false): string {
|
||||
if (!function_exists('jio_renderer_meta')) {
|
||||
function jio_renderer_meta(array $data, array $cfg, bool $is_card = false): string {
|
||||
$show_time = !empty($cfg['show_time']);
|
||||
$meta_left = '';
|
||||
if (empty($cfg['no_author']) && !empty($cfg['show_author'])) {
|
||||
@@ -295,7 +295,7 @@ if (!function_exists('aksrt_renderer_meta')) {
|
||||
$time = $show_time
|
||||
? '<span title="' . esc_attr((string) $data['time_title']) . '" class="' . ($is_card ? 'ml6' : 'icon-circle') . '">' . esc_html((string) $data['time_ago']) . '</span>'
|
||||
: '';
|
||||
$avatar = aksrt_get_avatar_box((int) $data['author_id'], 'avatar-mini');
|
||||
$avatar = jio_get_avatar_box((int) $data['author_id'], 'avatar-mini');
|
||||
$meta_left = '<item class="meta-author flex ac">' . $avatar . $name . $time . '</item>';
|
||||
} elseif ($show_time) {
|
||||
$meta_left = '<item title="' . esc_attr((string) $data['time_title']) . '" class="icon-circle mln3">' . esc_html((string) $data['time_ago']) . '</item>';
|
||||
@@ -303,11 +303,11 @@ if (!function_exists('aksrt_renderer_meta')) {
|
||||
|
||||
$right = '';
|
||||
if (!empty($data['comments_open']) && empty($cfg['close_comments'])) {
|
||||
$right .= '<item class="meta-comm"><a rel="nofollow" data-toggle="tooltip" title="' . esc_attr__('去评论', 'aksrt') . '" href="' . esc_url((string) $data['comments_link']) . '">' . aksrt_renderer_svg_icon('comment') . esc_html(aksrt_renderer_meta_number((int) $data['comments'])) . '</a></item>';
|
||||
$right .= '<item class="meta-comm"><a rel="nofollow" data-toggle="tooltip" title="' . esc_attr__('去评论', 'jio') . '" href="' . esc_url((string) $data['comments_link']) . '">' . jio_renderer_svg_icon('comment') . esc_html(jio_renderer_meta_number((int) $data['comments'])) . '</a></item>';
|
||||
}
|
||||
$right .= '<item class="meta-view">' . aksrt_renderer_svg_icon('view') . esc_html(aksrt_renderer_meta_number((int) $data['views'])) . '</item>';
|
||||
$right .= '<item class="meta-view">' . jio_renderer_svg_icon('view') . esc_html(jio_renderer_meta_number((int) $data['views'])) . '</item>';
|
||||
if (!empty($cfg['show_like']) && (string) ($data['post_type'] ?? '') === 'post') {
|
||||
$right .= '<item class="meta-like">' . aksrt_renderer_svg_icon('like') . esc_html(aksrt_renderer_meta_number((int) $data['likes'])) . '</item>';
|
||||
$right .= '<item class="meta-like">' . jio_renderer_svg_icon('like') . esc_html(jio_renderer_meta_number((int) $data['likes'])) . '</item>';
|
||||
}
|
||||
|
||||
return '<div class="item-meta muted-2-color flex jsb ac">' . $meta_left . '<div class="meta-right">' . $right . '</div></div>';
|
||||
|
||||
Reference in new issue
Block a user