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>
118 lines
4.7 KiB
PHP
118 lines
4.7 KiB
PHP
<?php
|
|
/**
|
|
* Layout-2 menu search remote panel (legacy menu_search / legacy).
|
|
*
|
|
* @package Jio
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
if (!function_exists('jio_ajax_menu_search')) :
|
|
/**
|
|
* AJAX: HTML panel for navbar inline search (history + hot + posts).
|
|
*/
|
|
function jio_ajax_menu_search(): void {
|
|
$nonce = isset($_REQUEST['nonce'])
|
|
? sanitize_text_field(wp_unslash((string) $_REQUEST['nonce']))
|
|
: '';
|
|
if (!wp_verify_nonce($nonce, 'jio_public_nonce')) {
|
|
wp_die('0');
|
|
}
|
|
|
|
if (!function_exists('jio_get_search_box')) {
|
|
wp_die('0');
|
|
}
|
|
|
|
$show_keywords = true;
|
|
$show_history = true;
|
|
$show_posts = true;
|
|
if (class_exists('\Jio\Settings\Settings')) {
|
|
$show_keywords = method_exists('\Jio\Settings\Settings', 'hot_search_enabled')
|
|
? (bool) \Jio\Settings\Settings::hot_search_enabled()
|
|
: true;
|
|
$show_history = method_exists('\Jio\Settings\Settings', 'search_history_enabled')
|
|
? (bool) \Jio\Settings\Settings::search_history_enabled()
|
|
: true;
|
|
$show_posts = method_exists('\Jio\Settings\Settings', 'search_posts_enabled')
|
|
? (bool) \Jio\Settings\Settings::search_posts_enabled()
|
|
: !empty(\Jio\Settings\Settings::get_value('search_posts', true));
|
|
}
|
|
|
|
$search = jio_get_search_box([
|
|
'show_form' => false,
|
|
'show_keywords' => $show_keywords,
|
|
'show_history' => $show_history,
|
|
'show_posts' => $show_posts,
|
|
]);
|
|
|
|
if ($search === '' || $search === null) {
|
|
wp_die('0');
|
|
}
|
|
|
|
// legacy contract: outer dropdown + inner .search-input.
|
|
echo '<div class="dropdown-menu hover-show-con">' . $search . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
wp_die();
|
|
}
|
|
endif;
|
|
|
|
if (!function_exists('jio_ajax_search_box')) :
|
|
/**
|
|
* AJAX: full legacy search box loaded into the footer shell on first open.
|
|
*/
|
|
function jio_ajax_search_box(): void {
|
|
$nonce = isset($_REQUEST['nonce'])
|
|
? sanitize_text_field(wp_unslash((string) $_REQUEST['nonce']))
|
|
: '';
|
|
if (!wp_verify_nonce($nonce, 'jio_public_nonce') || !function_exists('jio_get_search_box')) {
|
|
wp_die('0');
|
|
}
|
|
|
|
echo jio_get_search_box([ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
'show_form' => true,
|
|
'show_keywords' => !class_exists('\\Jio\\Settings\\Settings') || \Jio\Settings\Settings::hot_search_enabled(),
|
|
'show_history' => !class_exists('\\Jio\\Settings\\Settings') || \Jio\Settings\Settings::search_history_enabled(),
|
|
'show_posts' => !class_exists('\\Jio\\Settings\\Settings') || \Jio\Settings\Settings::search_posts_enabled(),
|
|
'show_type' => !class_exists('\\Jio\\Settings\\Settings') || (bool) \Jio\Settings\Settings::get_value('search_type', true),
|
|
'show_input_cat' => !class_exists('\\Jio\\Settings\\Settings') || \Jio\Settings\Settings::search_cat_enabled(),
|
|
]);
|
|
wp_die();
|
|
}
|
|
endif;
|
|
|
|
if (!function_exists('jio_footer_navbar_search')) :
|
|
/**
|
|
* legacy footer search shell. The heavy search body is loaded once via remote-box.
|
|
*/
|
|
function jio_footer_navbar_search(): void {
|
|
$show_on_404 = class_exists('\\Jio\\Settings\\Settings')
|
|
? (bool) \Jio\Settings\Settings::get_value('404_search_s', true)
|
|
: true;
|
|
if (is_search() || (is_404() && $show_on_404)) {
|
|
return;
|
|
}
|
|
|
|
$remote = jio_get_remote_box([
|
|
'type' => 'click',
|
|
'class' => '',
|
|
'loader' => '<div class="search-input"><p><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i></p><p class="placeholder k2"></p><p class="placeholder t1"></p><p><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i></p><p class="placeholder k1"></p><p class="placeholder t1"></p><p></p><p class="placeholder k1" style="height:80px;"></p></div>',
|
|
'query' => [
|
|
'action' => 'search_box',
|
|
'nonce' => wp_create_nonce('jio_public_nonce'),
|
|
],
|
|
]);
|
|
|
|
echo '<div mini-touch="nav_search" touch-direction="top" class="main-search fixed-body main-bg box-body navbar-search nopw-sm">';
|
|
echo '<div class="container">';
|
|
echo $remote; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
echo '<div class="mb20 search-close-box"><button type="button" class="but cir" data-toggle-class data-target=".navbar-search" aria-label="'
|
|
. esc_attr__('关闭搜索', 'jio') . '"><svg class="ic-close" aria-hidden="true"><use xlink:href="#icon-close"></use></svg></button></div>';
|
|
echo '</div></div>';
|
|
}
|
|
endif;
|
|
|
|
add_action('wp_ajax_menu_search', 'jio_ajax_menu_search');
|
|
add_action('wp_ajax_nopriv_menu_search', 'jio_ajax_menu_search');
|
|
add_action('wp_ajax_search_box', 'jio_ajax_search_box');
|
|
add_action('wp_ajax_nopriv_search_box', 'jio_ajax_search_box');
|
|
add_action('wp_footer', 'jio_footer_navbar_search', 10);
|