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>
140 lines
4.4 KiB
PHP
140 lines
4.4 KiB
PHP
<?php
|
|
/**
|
|
* Template Name: Jio - Categories
|
|
* Template Post Type: page
|
|
*
|
|
* 分类汇总页面:列出全站所有分类。
|
|
*
|
|
* 用法:在后台新建一个 Page,标题任意(默认显示页面标题,否则用"分类目录"),
|
|
* 模板选择 "Jio - Categories";或将 slug 设为 "categories" 自动匹配。
|
|
*
|
|
* @package Jio
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
get_header();
|
|
|
|
// ─── 数据准备 ─────────────────────────────────────────────
|
|
$all_terms = get_terms([
|
|
'taxonomy' => 'category',
|
|
'hide_empty' => false, // 全部展示,含 0 篇文章的分类
|
|
'orderby' => 'menu_order name',
|
|
'order' => 'ASC',
|
|
]);
|
|
if (is_wp_error($all_terms)) {
|
|
$all_terms = [];
|
|
}
|
|
|
|
$top_level = [];
|
|
$children_by_parent = [];
|
|
foreach ($all_terms as $term) {
|
|
if ((int) $term->parent === 0) {
|
|
$top_level[] = $term;
|
|
} else {
|
|
$children_by_parent[(int) $term->parent][] = $term;
|
|
}
|
|
}
|
|
|
|
$total_cats = count($all_terms);
|
|
$total_counts = wp_count_posts();
|
|
$total_posts = $total_counts && isset($total_counts->publish) ? (int) $total_counts->publish : 0;
|
|
|
|
$page_title = trim((string) get_the_title());
|
|
if ($page_title === '') {
|
|
$page_title = __('分类目录', 'jio');
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
if (function_exists('jio_archive_open_shell')) {
|
|
jio_archive_open_shell([
|
|
'main_class' => 'site-main container ',
|
|
'has_sidebar' => false,
|
|
'page_kind' => 'categories',
|
|
]);
|
|
}
|
|
?>
|
|
<div class="content-main content-main--page content-main--categories">
|
|
<?php if (function_exists('jio_breadcrumbs')) { jio_breadcrumbs(); } ?>
|
|
<?php
|
|
$cats_meta = sprintf(
|
|
/* translators: 1: total category count, 2: total published post count */
|
|
esc_html__('共 %1$d 个分类 · 共 %2$d 篇文章', 'jio'),
|
|
$total_cats,
|
|
$total_posts
|
|
);
|
|
get_template_part('templates/parts/page-header', null, [
|
|
'title' => esc_html($page_title),
|
|
'desc' => $cats_meta,
|
|
]);
|
|
?>
|
|
|
|
<?php if (!empty($top_level)) : ?>
|
|
<section class="jio-cats-grid" aria-label="<?php esc_attr_e('分类列表', 'jio'); ?>">
|
|
<?php foreach ($top_level as $cat) :
|
|
$cat_id = (int) $cat->term_id;
|
|
$cat_link = get_category_link($cat_id);
|
|
$cover_url = class_exists('\Jio\Settings\Settings')
|
|
? \Jio\Settings\Settings::get_category_cover_url($cat_id)
|
|
: (get_template_directory_uri() . '/assets/img/placeholder.svg');
|
|
$desc = class_exists('\Jio\Settings\Settings')
|
|
? \Jio\Settings\Settings::get_category_recommend_desc($cat_id)
|
|
: (string) $cat->description;
|
|
$children = $children_by_parent[$cat_id] ?? [];
|
|
?>
|
|
<article class="jio-cat-card">
|
|
<a class="jio-cat-card__cover"
|
|
href="<?php echo esc_url($cat_link); ?>"
|
|
style="background-image: url('<?php echo esc_url($cover_url); ?>');"
|
|
aria-label="<?php echo esc_attr($cat->name); ?>">
|
|
<span class="jio-cat-card__count-badge">
|
|
<?php printf(esc_html__('%d 篇', 'jio'), (int) $cat->count); ?>
|
|
</span>
|
|
</a>
|
|
|
|
<div class="jio-cat-card__body">
|
|
<h2 class="jio-cat-card__title">
|
|
<a href="<?php echo esc_url($cat_link); ?>"><?php echo esc_html($cat->name); ?></a>
|
|
</h2>
|
|
|
|
<?php if ($desc !== '') : ?>
|
|
<p class="jio-cat-card__desc"><?php echo esc_html(wp_trim_words(wp_strip_all_tags($desc), 40, '…')); ?></p>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($children)) : ?>
|
|
<ul class="jio-cat-card__children" aria-label="<?php esc_attr_e('子分类', 'jio'); ?>">
|
|
<?php foreach ($children as $child) : ?>
|
|
<li>
|
|
<a href="<?php echo esc_url(get_category_link((int) $child->term_id)); ?>">
|
|
<span class="jio-cat-card__child-name"><?php echo esc_html($child->name); ?></span>
|
|
<span class="jio-cat-card__child-count"><?php echo (int) $child->count; ?></span>
|
|
</a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php endif; ?>
|
|
</div>
|
|
</article>
|
|
<?php endforeach; ?>
|
|
</section>
|
|
<?php else : ?>
|
|
<div class="no-results jio-cats-empty">
|
|
<p><?php esc_html_e('暂无分类。', 'jio'); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<p class="jio-cats-footer">
|
|
<a class="btn-outline" href="<?php echo esc_url(home_url('/')); ?>">
|
|
<?php esc_html_e('返回首页', 'jio'); ?>
|
|
</a>
|
|
</p>
|
|
|
|
</div>
|
|
<?php
|
|
if (function_exists('jio_archive_close_shell')) {
|
|
jio_archive_close_shell(['has_sidebar' => false]);
|
|
}
|
|
|
|
get_footer();
|