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>
161 lines
8.6 KiB
PHP
161 lines
8.6 KiB
PHP
<?php
|
|
/**
|
|
* legacy-contract search results template.
|
|
*
|
|
* @package Jio
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
global $wp_query;
|
|
|
|
$search_query = trim(wp_strip_all_tags(get_search_query(false)));
|
|
$search_type = function_exists('jio_get_search_form_type') ? jio_get_search_form_type() : 'post';
|
|
$search_types = function_exists('jio_get_search_type_options') ? jio_get_search_type_options() : ['post' => __('文章', 'jio')];
|
|
$search_category = isset($_REQUEST['trem']) ? absint(wp_unslash($_REQUEST['trem'])) : 0;
|
|
$search_user = isset($_REQUEST['user']) ? absint(wp_unslash($_REQUEST['user'])) : 0;
|
|
$paged = max(1, (int) get_query_var('paged'));
|
|
$history_value = $search_query . ($search_type !== '' ? '&type=' . $search_type : '');
|
|
|
|
if ($search_query !== '' && function_exists('jio_save_history_search')) {
|
|
jio_save_history_search($history_value);
|
|
}
|
|
|
|
$user_query = null;
|
|
if ($search_type === 'user' && $search_query !== '') {
|
|
$user_page = max(1, isset($_REQUEST['user_paged']) ? absint(wp_unslash($_REQUEST['user_paged'])) : 1);
|
|
$orderby = isset($_REQUEST['orderby']) ? sanitize_key(wp_unslash($_REQUEST['orderby'])) : 'name';
|
|
$orderby = in_array($orderby, ['name', 'registered'], true) ? $orderby : 'name';
|
|
$user_query = new WP_User_Query([
|
|
'search' => '*' . $search_query . '*',
|
|
'search_columns' => ['user_email', 'user_nicename', 'display_name', 'user_login'],
|
|
'count_total' => true,
|
|
'number' => 12,
|
|
'paged' => $user_page,
|
|
'orderby' => $orderby === 'registered' ? 'user_registered' : 'display_name',
|
|
'order' => 'DESC',
|
|
]);
|
|
}
|
|
|
|
$search_total = $user_query instanceof WP_User_Query ? (int) $user_query->get_total() : (int) $wp_query->found_posts;
|
|
if ($search_query !== '' && $search_total > 0 && $paged <= 1 && function_exists('jio_update_search_keywords')) {
|
|
jio_update_search_keywords($history_value);
|
|
}
|
|
|
|
get_header();
|
|
|
|
if (is_active_sidebar('all_top_fluid') || is_active_sidebar('search_top_fluid')) {
|
|
echo '<div class="fluid-widget-wrap">';
|
|
if (is_active_sidebar('all_top_fluid')) dynamic_sidebar('all_top_fluid');
|
|
if (is_active_sidebar('search_top_fluid')) dynamic_sidebar('search_top_fluid');
|
|
echo '</div>';
|
|
}
|
|
?>
|
|
<main class="container">
|
|
<div class="content-wrap">
|
|
<div class="content-layout">
|
|
<?php if (is_active_sidebar('search_top_content')) dynamic_sidebar('search_top_content'); ?>
|
|
<?php
|
|
$search_args = [
|
|
'class' => 'main-search page-search-box',
|
|
'show_posts' => false,
|
|
'in_cat' => $search_category,
|
|
'in_type' => $search_type,
|
|
'in_user' => $search_user,
|
|
's' => $search_query,
|
|
];
|
|
echo '<div class="jio-panel"' . ($paged < 2 ? ' win-ajax-replace="search"' : '') . '>';
|
|
if (function_exists('jio_get_main_search')) jio_get_main_search($search_args, true);
|
|
echo '</div>';
|
|
|
|
$base_url = add_query_arg(['s' => $search_query, 'user' => $search_user], home_url('/'));
|
|
$tab_nav = '';
|
|
foreach ($search_types as $key => $label) {
|
|
if ($search_type === $key) {
|
|
$tab_nav .= '<li class="active"><a class="focus-color" href="javascript:;">' . esc_html($label) . '</a></li>';
|
|
} else {
|
|
$route_title = $search_query . ' ' . __('搜索', 'jio') . $label . ' - ' . get_bloginfo('name');
|
|
$tab_nav .= '<li><a ajax-replace="true" route="1" route-title="' . esc_attr($route_title) . '" class="ajax-next" href="' . esc_url(add_query_arg('type', $key, $base_url)) . '">' . esc_html($label) . '</a></li>';
|
|
}
|
|
}
|
|
$tab_nav = '<div class="list-inline scroll-x mini-scrollbar tab-nav-theme">' . $tab_nav . '</div>';
|
|
$search_scope_parts = [];
|
|
if ($search_user > 0) {
|
|
$filtered_user = get_userdata($search_user);
|
|
if ($filtered_user) {
|
|
$user_home = function_exists('jio_get_user_home_url') ? jio_get_user_home_url($search_user) : get_author_posts_url($search_user);
|
|
$search_scope_parts[] = __('用户', 'jio') . ' <a class="focus-color" href="' . esc_url($user_home) . '"><b>' . esc_html($filtered_user->display_name) . '</b></a>';
|
|
}
|
|
}
|
|
if ($search_category > 0) {
|
|
$filtered_term = get_term($search_category);
|
|
if ($filtered_term && !is_wp_error($filtered_term)) {
|
|
$term_url = get_term_link($filtered_term);
|
|
if (!is_wp_error($term_url)) {
|
|
$taxonomy = get_taxonomy($filtered_term->taxonomy);
|
|
$taxonomy_label = $taxonomy && !empty($taxonomy->labels->singular_name) ? $taxonomy->labels->singular_name : __('分类', 'jio');
|
|
$search_scope_parts[] = esc_html($taxonomy_label) . ' <a class="focus-color" href="' . esc_url($term_url) . '"><b>' . esc_html($filtered_term->name) . '</b></a>';
|
|
}
|
|
}
|
|
}
|
|
$description = ($search_scope_parts ? sprintf(__('在%s中,', 'jio'), implode(__('、', 'jio'), $search_scope_parts)) : '')
|
|
. sprintf(
|
|
__('搜索 %1$s ,共找到 %2$s 个%3$s', 'jio'),
|
|
'<b class="search-key focus-color">' . esc_html($search_query) . '</b>',
|
|
'<b class="focus-color">' . esc_html(number_format_i18n($search_total)) . '</b>',
|
|
esc_html($search_types[$search_type] ?? __('内容', 'jio'))
|
|
);
|
|
?>
|
|
<?php if ($search_query === '') : ?>
|
|
<div class="jio-panel search-content"><?php echo function_exists('jio_get_ajax_null') ? jio_get_ajax_null(__('请输入搜索关键词', 'jio'), 60, 'null-search.svg', 300) : '<div class="ajax-item text-center muted-2-color padding-20">' . esc_html__('请输入搜索关键词', 'jio') . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
|
|
<?php else : ?>
|
|
<div class="ajaxpager search-page-ajaxpager">
|
|
<div class="ajax-item-header type-<?php echo esc_attr($search_type); ?>">
|
|
<div class="search-desc-text mb10 mt10 muted-2-color"><?php echo wp_kses_post($description); ?></div>
|
|
<div class="search-tab-header jio-panel relative padding-h10"><div><?php echo $tab_nav; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div><div class="search-tab-filter"><?php echo function_exists('jio_get_search_tab_nav_filter') ? jio_get_search_tab_nav_filter($search_type) : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div></div>
|
|
</div>
|
|
<?php if ($user_query instanceof WP_User_Query && $user_query->get_results()) : ?>
|
|
<?php foreach ($user_query->get_results() as $result_user) :
|
|
$user_id = (int) $result_user->ID;
|
|
?>
|
|
<?php echo function_exists('jio_author_minicard') ? jio_author_minicard($user_id, 'ajax-item', false, $search_query) : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
|
<?php endforeach; ?>
|
|
<?php
|
|
if (function_exists('jio_get_ajax_next_paginate')) {
|
|
$user_next_url = add_query_arg([
|
|
's' => $search_query,
|
|
'type' => 'user',
|
|
'orderby' => $orderby,
|
|
'user_paged' => $user_page + 1,
|
|
], home_url('/'));
|
|
echo jio_get_ajax_next_paginate($search_total, $user_page, 12, $user_next_url, 'text-center theme-pagination ajax-pag', 'next-page ajax-next'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
}
|
|
?>
|
|
<?php elseif ($search_type === 'post' && $wp_query->have_posts()) : ?>
|
|
<?php
|
|
$config = function_exists('jio_archive_get_render_config') ? jio_archive_get_render_config(['context' => 'search', 'highlight_query' => $search_query, 'no_margin' => false]) : ['context' => 'search', 'mode' => 'list'];
|
|
jio_render_post_list(array_merge($config, ['skip_wrapper' => true]), $wp_query);
|
|
?>
|
|
<?php jio_render_pagination($wp_query, ['query_context' => 'search', 'render_config' => $config]); ?>
|
|
<?php else : ?>
|
|
<?php echo function_exists('jio_get_ajax_null')
|
|
? jio_get_ajax_null($search_type === 'user' ? __('未找到相关用户', 'jio') : __('暂无内容', 'jio'), $search_type === 'user' ? 75 : 100, $search_type === 'user' ? 'null-user.svg' : 'null-post.svg')
|
|
: '<div class="ajax-item text-center muted-2-color padding-20">' . esc_html($search_type === 'user' ? __('未找到相关用户', 'jio') : __('暂无内容', 'jio')) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
|
<?php endif; ?>
|
|
<div class="post_ajax_loader search-loader"><?php echo function_exists('jio_render_placeholder') ? jio_render_placeholder('list', 6) : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- 固定骨架结构。 ?></div>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (is_active_sidebar('search_bottom_content')) dynamic_sidebar('search_bottom_content'); ?>
|
|
</div>
|
|
</div>
|
|
<?php get_sidebar(); ?>
|
|
</main>
|
|
<?php
|
|
if (is_active_sidebar('search_bottom_fluid') || is_active_sidebar('all_bottom_fluid')) {
|
|
echo '<div class="fluid-widget-wrap">';
|
|
if (is_active_sidebar('search_bottom_fluid')) dynamic_sidebar('search_bottom_fluid');
|
|
if (is_active_sidebar('all_bottom_fluid')) dynamic_sidebar('all_bottom_fluid');
|
|
echo '</div>';
|
|
}
|
|
get_footer();
|