feat(navigation): hard-switch to Zibll navigation and Font Awesome 5

This commit is contained in:
kate522 committed 2026-08-18 20:46:21 +08:00
1 parent 3c3ddac8be
commit a0b84977a2
630 files changed
+101647 -11293

No files matched your search

+68 -20
View File
@@ -12,12 +12,11 @@ if (!function_exists('aksrt_ajax_menu_search')) :
* AJAX: HTML panel for navbar inline search (history + hot + posts).
*/
function aksrt_ajax_menu_search(): void {
// Prefer public nonce; also accept no nonce for same-origin remote-box first paint like zibll.
if (!empty($_REQUEST['nonce'])) {
$nonce = sanitize_text_field(wp_unslash((string) $_REQUEST['nonce']));
if (!wp_verify_nonce($nonce, 'aksrt_public_nonce')) {
wp_die('0');
}
$nonce = isset($_REQUEST['nonce'])
? sanitize_text_field(wp_unslash((string) $_REQUEST['nonce']))
: '';
if (!wp_verify_nonce($nonce, 'aksrt_public_nonce')) {
wp_die('0');
}
if (!function_exists('aksrt_get_search_box')) {
@@ -56,26 +55,75 @@ if (!function_exists('aksrt_ajax_menu_search')) :
}
endif;
// Panel builder retained as thin alias for any external callers.
if (!function_exists('aksrt_get_menu_search_panel_html')) :
if (!function_exists('aksrt_ajax_search_box')) :
/**
* @return string Inner HTML (without dropdown wrapper).
* AJAX: full Zibll search box loaded into the footer shell on first open.
*/
function aksrt_get_menu_search_panel_html(): string {
if (!function_exists('aksrt_get_search_box')) {
return '';
function aksrt_ajax_search_box(): void {
$nonce = isset($_REQUEST['nonce'])
? sanitize_text_field(wp_unslash((string) $_REQUEST['nonce']))
: '';
if (!wp_verify_nonce($nonce, 'aksrt_public_nonce') || !function_exists('aksrt_get_search_box')) {
wp_die('0');
}
return (string) aksrt_get_search_box([
'show_form' => false,
'show_keywords' => true,
'show_history' => true,
'show_posts' => true,
echo aksrt_get_search_box([ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'show_form' => true,
'show_keywords' => !class_exists('\\AKSRT\\Settings\\Settings') || \AKSRT\Settings\Settings::hot_search_enabled(),
'show_history' => !class_exists('\\AKSRT\\Settings\\Settings') || \AKSRT\Settings\Settings::search_history_enabled(),
'show_posts' => !class_exists('\\AKSRT\\Settings\\Settings') || \AKSRT\Settings\Settings::search_posts_enabled(),
'show_type' => !class_exists('\\AKSRT\\Settings\\Settings') || (bool) \AKSRT\Settings\Settings::get_value('search_type', true),
'show_input_cat' => !class_exists('\\AKSRT\\Settings\\Settings') || \AKSRT\Settings\Settings::search_cat_enabled(),
]);
wp_die();
}
endif;
if (!function_exists('aksrt_footer_navbar_search')) :
/**
* Zibll footer search shell. The heavy search body is loaded once via remote-box.
*/
function aksrt_footer_navbar_search(): void {
$show_on_404 = class_exists('\\AKSRT\\Settings\\Settings')
? (bool) \AKSRT\Settings\Settings::get_value('404_search_s', true)
: true;
if (is_search() || (is_404() && $show_on_404)) {
return;
}
$remote = aksrt_get_remote_box([
'type' => 'load',
'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('aksrt_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 '<div class="mb20 search-close-box"><button type="button" class="but cir" data-toggle-class data-target=".navbar-search" aria-label="'
. esc_attr__('关闭搜索', 'aksrt') . '"><svg class="ic-close" aria-hidden="true"><use xlink:href="#icon-close"></use></svg></button></div>';
echo $remote; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '</div></div>';
}
endif;
if (!function_exists('aksrt_ajax_zibll_current_user_ping')) :
/** Satisfy the reference runtime's one-shot user-state refresh request. */
function aksrt_ajax_zibll_current_user_ping(): void {
wp_send_json_success([
'logged_in' => is_user_logged_in(),
'user_id' => get_current_user_id(),
]);
}
endif;
add_action('wp_ajax_aksrt_menu_search', 'aksrt_ajax_menu_search');
add_action('wp_ajax_nopriv_aksrt_menu_search', 'aksrt_ajax_menu_search');
// Alias for zibll-compatible remote-box query action name used in markup.
add_action('wp_ajax_menu_search', 'aksrt_ajax_menu_search');
add_action('wp_ajax_nopriv_menu_search', 'aksrt_ajax_menu_search');
add_action('wp_ajax_search_box', 'aksrt_ajax_search_box');
add_action('wp_ajax_nopriv_search_box', 'aksrt_ajax_search_box');
add_action('wp_ajax_get_current_user', 'aksrt_ajax_zibll_current_user_ping');
add_action('wp_ajax_nopriv_get_current_user', 'aksrt_ajax_zibll_current_user_ping');
add_action('wp_footer', 'aksrt_footer_navbar_search', 10);