Add payvip/check-in/wallet/badges strips, guest OAuth strip, confirm signout modal + REST check-in wiring for zibll header parity.
544 lines
28 KiB
PHP
544 lines
28 KiB
PHP
<?php
|
|
/**
|
|
* Site header: navigation, reading progress, search, and mobile navigation.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$aksrt_header_settings = class_exists('\AKSRT\Settings\Settings')
|
|
? \AKSRT\Settings\Settings::get_header_nav_settings()
|
|
: [
|
|
'fixed' => true,
|
|
'search_enabled' => true,
|
|
'user_menu' => true,
|
|
'publish_btn' => true,
|
|
'mobile_drawer' => true,
|
|
'nav_style' => 'default',
|
|
'max_width' => 1200,
|
|
'scroll_down_hide' => false,
|
|
'layout' => '2',
|
|
'mobile_layout' => 'center',
|
|
'mobile_align' => 'left',
|
|
];
|
|
|
|
$aksrt_initial_theme_mode = '';
|
|
if (class_exists('\AKSRT\Settings\Settings') && method_exists('\AKSRT\Settings\Settings', 'initial_theme_mode')) {
|
|
$aksrt_initial_theme_mode = \AKSRT\Settings\Settings::initial_theme_mode();
|
|
}
|
|
$aksrt_has_initial_theme = in_array($aksrt_initial_theme_mode, ['dark', 'light'], true);
|
|
|
|
$aksrt_body_classes = ['header-nav-style-' . $aksrt_header_settings['nav_style']];
|
|
// Zibll contract: body.nav-fixed drives top padding + hero pull-under-nav.
|
|
if (!empty($aksrt_header_settings['fixed'])) {
|
|
$aksrt_body_classes[] = 'nav-fixed';
|
|
}
|
|
|
|
if ($aksrt_initial_theme_mode === 'dark') {
|
|
$aksrt_body_classes[] = 'theme-dark';
|
|
$aksrt_body_classes[] = 'dark-theme';
|
|
} elseif ($aksrt_initial_theme_mode === 'light') {
|
|
$aksrt_body_classes[] = 'white-theme';
|
|
}
|
|
if (!$aksrt_header_settings['fixed']) {
|
|
$aksrt_body_classes[] = 'has-static-nav';
|
|
}
|
|
if (!empty($aksrt_header_settings['scroll_down_hide'])) {
|
|
$aksrt_body_classes[] = 'scroll-down-hide';
|
|
}
|
|
$aksrt_body_classes[] = 'header-layout-' . $aksrt_header_settings['layout'];
|
|
$aksrt_body_classes[] = 'mobile-header-' . $aksrt_header_settings['mobile_layout'];
|
|
$aksrt_body_classes[] = 'mobile-nav-' . $aksrt_header_settings['mobile_align'];
|
|
|
|
// 全局背景系统
|
|
$aksrt_bg_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_global_background_settings() : [];
|
|
$aksrt_bg_styles = [];
|
|
if (!empty($aksrt_bg_settings['bg_color'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-color:' . sanitize_hex_color($aksrt_bg_settings['bg_color']);
|
|
}
|
|
if (!empty($aksrt_bg_settings['bg_image'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-image:url(' . esc_url($aksrt_bg_settings['bg_image']) . ')';
|
|
$aksrt_bg_styles[] = '--aksrt-bg-size:' . sanitize_key($aksrt_bg_settings['bg_size'] ?: '100%');
|
|
$aksrt_bg_styles[] = '--aksrt-bg-position:' . sanitize_text_field($aksrt_bg_settings['bg_position'] ?: 'center center');
|
|
$aksrt_bg_styles[] = '--aksrt-bg-repeat:' . sanitize_key($aksrt_bg_settings['bg_repeat'] ?: 'no-repeat');
|
|
$aksrt_bg_styles[] = '--aksrt-bg-attachment:' . sanitize_key($aksrt_bg_settings['bg_attachment'] ?: 'fixed');
|
|
}
|
|
if (!empty($aksrt_bg_settings['bg_dark_color'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-dark-color:' . sanitize_hex_color($aksrt_bg_settings['bg_dark_color']);
|
|
}
|
|
if (!empty($aksrt_bg_settings['bg_dark_image'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-dark-image:url(' . esc_url($aksrt_bg_settings['bg_dark_image']) . ')';
|
|
}
|
|
if (!empty($aksrt_bg_settings['bg_overlay'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-overlay-color:' . sanitize_text_field($aksrt_bg_settings['bg_overlay_color'] ?: 'rgba(0, 0, 0, 0.3)');
|
|
}
|
|
if (!empty($aksrt_bg_settings['page_bg_color'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-page-bg-color:' . sanitize_hex_color($aksrt_bg_settings['page_bg_color']);
|
|
}
|
|
if (!empty($aksrt_bg_settings['page_bg_image'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-page-bg-image:url(' . esc_url($aksrt_bg_settings['page_bg_image']) . ')';
|
|
}
|
|
if (!empty($aksrt_bg_styles)) {
|
|
$aksrt_body_classes[] = 'aksrt-bg-body';
|
|
if (!empty($aksrt_bg_settings['bg_overlay'])) {
|
|
$aksrt_body_classes[] = 'aksrt-bg-overlay';
|
|
}
|
|
}
|
|
?><!DOCTYPE html>
|
|
<html lang="<?php echo esc_attr(str_replace('_', '-', get_bloginfo('language'))); ?>"<?php echo $aksrt_initial_theme_mode === 'dark' ? ' class="dark"' : ''; ?><?php echo $aksrt_has_initial_theme ? ' data-theme="' . esc_attr($aksrt_initial_theme_mode) . '"' : ''; ?>>
|
|
<head>
|
|
<meta charset="<?php bloginfo('charset'); ?>">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0, viewport-fit=cover">
|
|
<?php wp_head(); ?>
|
|
</head>
|
|
<body <?php body_class($aksrt_body_classes); ?><?php echo !empty($aksrt_bg_styles) ? ' style="' . esc_attr(implode(';', $aksrt_bg_styles)) . '"' : ''; ?><?php echo $aksrt_has_initial_theme ? ' data-theme="' . esc_attr($aksrt_initial_theme_mode) . '"' : ''; ?>>
|
|
<?php wp_body_open(); ?>
|
|
|
|
<div id="aksrt-bg-vars" hidden <?php echo !empty($aksrt_bg_styles) ? "style=\"" . esc_attr(implode(';', $aksrt_bg_styles)) . "\"" : ""; ?>></div>
|
|
|
|
<?php
|
|
// Fluid widget zones are rendered by page templates (homepage/single/archive)
|
|
// so they only appear once and stay in zibll order (after header-slider).
|
|
$aksrt_site_name = get_bloginfo('name');
|
|
$aksrt_brand_name = function_exists('aksrt_get_site_logo_text') ? aksrt_get_site_logo_text() : $aksrt_site_name;
|
|
$aksrt_brand_name = $aksrt_brand_name !== '' ? $aksrt_brand_name : $aksrt_site_name;
|
|
$aksrt_brand_logo_html = '';
|
|
$aksrt_logo_url = function_exists('aksrt_get_site_logo_url') ? trim((string) aksrt_get_site_logo_url()) : '';
|
|
$aksrt_logo_dark_url = function_exists('aksrt_get_site_logo_dark_url') ? trim((string) aksrt_get_site_logo_dark_url()) : '';
|
|
$aksrt_logo_width = function_exists('aksrt_get_site_logo_width') ? aksrt_get_site_logo_width() : 150;
|
|
$aksrt_search_state = function_exists('aksrt_get_search_form_state')
|
|
? aksrt_get_search_form_state()
|
|
: [
|
|
'type' => 'post',
|
|
'types' => ['post' => __('文章', 'aksrt')],
|
|
'category_id' => 0,
|
|
'category_enabled' => false,
|
|
'categories' => [],
|
|
];
|
|
$aksrt_search_placeholder = function_exists('aksrt_get_search_placeholder') ? aksrt_get_search_placeholder() : __('开启精彩搜索', 'aksrt');
|
|
$aksrt_search_type = $aksrt_search_state['type'];
|
|
$aksrt_search_type_options = $aksrt_search_state['types'];
|
|
$aksrt_search_category_enabled = !empty($aksrt_search_state['category_enabled']);
|
|
$aksrt_search_category_id = (int) ($aksrt_search_state['category_id'] ?? 0);
|
|
$aksrt_search_categories = is_array($aksrt_search_state['categories'] ?? null) ? $aksrt_search_state['categories'] : [];
|
|
$aksrt_search_hot_keywords = function_exists('aksrt_get_search_hot_keywords') ? aksrt_get_search_hot_keywords() : [];
|
|
$aksrt_brand_logo_src = '';
|
|
$aksrt_mobile_menu_location = has_nav_menu('mobile') ? 'mobile' : 'primary';
|
|
$aksrt_show_user_entry = !empty($aksrt_header_settings['user_menu']);
|
|
$aksrt_current_user = wp_get_current_user();
|
|
$aksrt_user_credit = function_exists('aksrt_user_credits') && is_user_logged_in() ? (int) aksrt_user_credits(get_current_user_id()) : 0;
|
|
$aksrt_currency_name = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_currency_name() : __('积分', 'aksrt');
|
|
$aksrt_orders_url = function_exists('aksrt_get_orders_page_url') ? aksrt_get_orders_page_url() : '';
|
|
$aksrt_publish_url = function_exists('aksrt_get_new_post_url') ? aksrt_get_new_post_url() : '';
|
|
if ($aksrt_publish_url === '') {
|
|
$aksrt_publish_url = admin_url('post-new.php');
|
|
}
|
|
$aksrt_messages_url = function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : '';
|
|
$aksrt_unread_count = (is_user_logged_in() && function_exists('aksrt_get_user_unread_notification_count'))
|
|
? (int) aksrt_get_user_unread_notification_count(get_current_user_id())
|
|
: 0;
|
|
$aksrt_user_desc = is_user_logged_in()
|
|
? (string) get_user_meta(get_current_user_id(), 'description', true)
|
|
: '';
|
|
if ($aksrt_user_desc === '' && is_user_logged_in()) {
|
|
$aksrt_user_desc = (string) $aksrt_current_user->user_email;
|
|
}
|
|
$aksrt_vip_badge_html = (is_user_logged_in() && function_exists('aksrt_render_vip_badge'))
|
|
? aksrt_render_vip_badge(get_current_user_id(), 'sm')
|
|
: '';
|
|
$aksrt_theme_settings_url = function_exists('aksrt_get_admin_settings_url')
|
|
? aksrt_get_admin_settings_url('')
|
|
: admin_url('admin.php?page=aksrt-settings');
|
|
$aksrt_theme_toggle_positions = class_exists('\AKSRT\Settings\Settings')
|
|
? \AKSRT\Settings\Settings::get_theme_mode_button_positions()
|
|
: ['pc_nav', 'm_menu'];
|
|
$aksrt_can_publish = !empty($aksrt_header_settings['publish_btn']) && (
|
|
current_user_can('manage_options')
|
|
|| (class_exists('\AKSRT\Core\FrontSubmit') && \AKSRT\Core\FrontSubmit::get_instance()->can_submit())
|
|
);
|
|
$aksrt_show_header_slide = function_exists('aksrt_header_slide_is_show')
|
|
? aksrt_header_slide_is_show()
|
|
: false;
|
|
// Dual class contract: keep site-nav/* while aligning navbar/navbar-top with zibll.
|
|
$aksrt_nav_classes = [
|
|
'site-nav',
|
|
'navbar',
|
|
'navbar-top',
|
|
'site-nav--' . $aksrt_header_settings['nav_style'],
|
|
$aksrt_header_settings['fixed'] ? 'site-nav--fixed' : 'site-nav--static',
|
|
];
|
|
$aksrt_nav_styles = [];
|
|
if ((int) $aksrt_header_settings['max_width'] > 0) {
|
|
$aksrt_nav_styles[] = '--nav-max-width:' . (int) $aksrt_header_settings['max_width'] . 'px';
|
|
}
|
|
$aksrt_logo_parts = [];
|
|
if ($aksrt_logo_url !== '' || $aksrt_logo_dark_url !== '') {
|
|
$aksrt_logo_more = $aksrt_logo_width > 0
|
|
? 'style="height:36px;width:auto;max-width:' . max(36, (int) $aksrt_logo_width) . 'px"'
|
|
: 'style="height:36px;width:auto"';
|
|
$aksrt_logo_html = function_exists('aksrt_get_adaptive_theme_img')
|
|
? aksrt_get_adaptive_theme_img($aksrt_logo_url, $aksrt_logo_dark_url, $aksrt_brand_name, $aksrt_logo_more)
|
|
: '';
|
|
if ($aksrt_logo_html !== '') {
|
|
$aksrt_logo_parts[] = $aksrt_logo_html;
|
|
}
|
|
$aksrt_brand_logo_src = $aksrt_logo_url !== '' ? $aksrt_logo_url : $aksrt_logo_dark_url;
|
|
}
|
|
$aksrt_has_brand_logo = !empty($aksrt_logo_parts);
|
|
if ($aksrt_has_brand_logo) {
|
|
$aksrt_brand_logo_html = implode('', $aksrt_logo_parts);
|
|
}
|
|
$aksrt_brand_mark = strtoupper(substr(preg_replace('/\s+/', '', wp_strip_all_tags($aksrt_brand_name)), 0, 1));
|
|
if ($aksrt_brand_mark === '') {
|
|
$aksrt_brand_mark = 'A';
|
|
}
|
|
$aksrt_brand_class = 'site-brand';
|
|
if ($aksrt_has_brand_logo) {
|
|
$aksrt_brand_class .= ' site-brand--has-logo';
|
|
}
|
|
$aksrt_brand_drawer_class = $aksrt_brand_class . ' site-brand--drawer';
|
|
$aksrt_header_classes = [
|
|
'header',
|
|
'header-layout-' . $aksrt_header_settings['layout'],
|
|
];
|
|
// Fixed state lives on body.nav-fixed (zibll); nav keeps site-nav--fixed.
|
|
if ($aksrt_show_header_slide) {
|
|
$aksrt_header_classes[] = 'show-slide';
|
|
}
|
|
if (!empty($aksrt_header_settings['scroll_down_hide']) && !empty($aksrt_header_settings['fixed'])) {
|
|
$aksrt_header_classes[] = 'scroll-down-hide';
|
|
}
|
|
?>
|
|
<header class="<?php echo esc_attr(implode(' ', array_map('sanitize_html_class', $aksrt_header_classes))); ?>">
|
|
<nav class="<?php echo esc_attr(implode(' ', $aksrt_nav_classes)); ?> <?php echo esc_attr($aksrt_header_settings['mobile_layout']); ?>"<?php echo !empty($aksrt_nav_styles) ? ' style="' . esc_attr(implode(';', $aksrt_nav_styles)) . '"' : ''; ?> data-aksrt-shell="site-nav">
|
|
<div class="container-fluid container-header">
|
|
<div class="site-nav__row navbar-collapse">
|
|
<a href="<?php echo esc_url(home_url('/')); ?>" class="<?php echo esc_attr($aksrt_brand_class); ?> navbar-brand" aria-label="<?php echo esc_attr($aksrt_brand_name); ?>">
|
|
<?php if ($aksrt_has_brand_logo) : ?>
|
|
<span class="site-brand__media navbar-logo"><?php echo $aksrt_brand_logo_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
|
|
<span class="screen-reader-text"><?php echo esc_html($aksrt_brand_name); ?></span>
|
|
<?php else : ?>
|
|
<span class="site-brand__logo" aria-hidden="true"><?php echo esc_html($aksrt_brand_mark); ?></span>
|
|
<span class="site-brand__name"><?php echo esc_html($aksrt_brand_name); ?></span>
|
|
<?php endif; ?>
|
|
</a>
|
|
|
|
<?php if (has_nav_menu('primary')) : ?>
|
|
<?php
|
|
wp_nav_menu([
|
|
'theme_location' => 'primary',
|
|
'container' => false,
|
|
'menu_class' => 'nav-desktop navbar-nav',
|
|
'fallback_cb' => false,
|
|
'depth' => 3,
|
|
]);
|
|
?>
|
|
<?php endif; ?>
|
|
|
|
<div class="nav-actions nav-actions--primary">
|
|
<?php if (!empty($aksrt_header_settings['search_enabled'])) : ?>
|
|
<button
|
|
type="button"
|
|
class="icon-btn main-search-btn nav-search-toggle"
|
|
id="site-nav-search-toggle"
|
|
aria-label="<?php esc_attr_e('打开搜索', 'aksrt'); ?>"
|
|
aria-controls="tabbar-search-overlay"
|
|
aria-expanded="false"
|
|
data-toggle-class
|
|
data-target=".navbar-search"
|
|
>
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
|
|
</button>
|
|
<form role="search" method="get" class="nav-searchbox nav-searchbox--desktop" action="<?php echo esc_url(home_url('/')); ?>" data-aksrt-search-form="desktop" data-default-search-type="<?php echo esc_attr($aksrt_search_type); ?>" data-default-category="<?php echo esc_attr((string) $aksrt_search_category_id); ?>">
|
|
<input type="hidden" name="aksrt_search_type" value="<?php echo esc_attr($aksrt_search_type); ?>">
|
|
<?php if ($aksrt_search_category_enabled) : ?>
|
|
<input type="hidden" name="aksrt_category" value="<?php echo esc_attr((string) $aksrt_search_category_id); ?>">
|
|
<?php endif; ?>
|
|
<label class="screen-reader-text" for="site-nav-search-s"><?php esc_html_e('搜索', 'aksrt'); ?></label>
|
|
<input class="nav-searchbox__input" type="search" id="site-nav-search-s" name="s" value="<?php echo esc_attr(get_search_query()); ?>" placeholder="<?php echo esc_attr($aksrt_search_placeholder); ?>">
|
|
<button type="submit" class="nav-searchbox__submit"><?php esc_html_e('搜索', 'aksrt'); ?></button>
|
|
</form>
|
|
<?php endif; ?>
|
|
|
|
<div class="nav-actions__cta">
|
|
<?php if ($aksrt_can_publish) : ?>
|
|
<a class="btn-primary" href="<?php echo esc_url($aksrt_publish_url); ?>">
|
|
<i class="fas fa-pen-nib" aria-hidden="true"></i>
|
|
<span><?php esc_html_e('发布', 'aksrt'); ?></span>
|
|
</a>
|
|
<?php endif; ?>
|
|
|
|
<?php if (in_array('pc_nav', $aksrt_theme_toggle_positions, true)) : ?>
|
|
<button type="button" class="btn-outline theme-toggle-desktop" id="theme-toggle-desktop" title="<?php esc_attr_e('切换亮暗色', 'aksrt'); ?>">
|
|
<i class="fas fa-adjust" aria-hidden="true"></i>
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php if ($aksrt_show_user_entry) : ?>
|
|
<?php if (is_user_logged_in()) : ?>
|
|
<div class="nav-user">
|
|
<button type="button" class="nav-user__toggle navbar-avatar" id="user-menu-toggle" aria-expanded="false" aria-controls="user-dropdown">
|
|
<?php echo get_avatar(get_current_user_id(), 36, '', esc_attr($aksrt_current_user->display_name), ['loading' => 'lazy']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
|
<?php if ($aksrt_unread_count > 0) : ?>
|
|
<span class="nav-user__dot aksrt-notification-badge" aria-hidden="true"></span>
|
|
<?php endif; ?>
|
|
</button>
|
|
<div class="user-dropdown sub-user-box" id="user-dropdown">
|
|
<div class="user-dropdown__profile user-info">
|
|
<?php echo get_avatar(get_current_user_id(), 44, '', esc_attr($aksrt_current_user->display_name), ['loading' => 'lazy']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
|
<div class="user-dropdown__meta">
|
|
<div class="user-dropdown__name">
|
|
<?php echo esc_html($aksrt_current_user->display_name ?: $aksrt_current_user->user_login); ?>
|
|
<?php echo $aksrt_vip_badge_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
|
</div>
|
|
<div class="user-dropdown__email muted-2-color text-ellipsis"><?php echo esc_html($aksrt_user_desc); ?></div>
|
|
</div>
|
|
<a class="user-dropdown__msg" href="<?php echo esc_url($aksrt_messages_url); ?>" title="<?php esc_attr_e('消息中心', 'aksrt'); ?>" aria-label="<?php esc_attr_e('消息中心', 'aksrt'); ?>">
|
|
<i class="fas fa-bell" aria-hidden="true"></i>
|
|
<?php if ($aksrt_unread_count > 0) : ?>
|
|
<span class="user-dropdown__badge aksrt-notification-badge"><?php echo esc_html((string) min(99, $aksrt_unread_count)); ?></span>
|
|
<?php endif; ?>
|
|
</a>
|
|
</div>
|
|
|
|
<?php
|
|
if (function_exists('aksrt_header_payvip_bar')) {
|
|
echo aksrt_header_payvip_bar(get_current_user_id()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
}
|
|
if (function_exists('aksrt_header_user_checkin_btn')) {
|
|
$checkin = aksrt_header_user_checkin_btn(get_current_user_id());
|
|
if ($checkin !== '') {
|
|
echo '<div class="mt6 em09" style="padding:2px;">' . $checkin . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
}
|
|
}
|
|
if (function_exists('aksrt_header_user_wallet_mini')) {
|
|
echo '<div class="mt6" style="padding:2px;">' . aksrt_header_user_wallet_mini(get_current_user_id()) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
} else {
|
|
?>
|
|
<div class="user-dropdown__credits">
|
|
<i class="fas fa-coins" aria-hidden="true"></i>
|
|
<span class="user-dropdown__credits-label"><?php echo esc_html($aksrt_currency_name); ?></span>
|
|
<span class="user-dropdown__credits-value"><?php echo esc_html(number_format_i18n($aksrt_user_credit)); ?></span>
|
|
</div>
|
|
<?php
|
|
}
|
|
if (function_exists('aksrt_header_user_badges_row')) {
|
|
echo aksrt_header_user_badges_row(get_current_user_id()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
}
|
|
?>
|
|
|
|
|
|
<div class="user-dropdown__sep"></div>
|
|
|
|
<div class="user-dropdown__actions header-user-href">
|
|
<a class="user-dropdown__action" href="<?php echo esc_url(aksrt_get_user_center_url()); ?>">
|
|
<span class="user-dropdown__action-icon is-blue"><i class="fas fa-user" aria-hidden="true"></i></span>
|
|
<span><?php esc_html_e('用户中心', 'aksrt'); ?></span>
|
|
</a>
|
|
<a class="user-dropdown__action" href="<?php echo esc_url($aksrt_orders_url); ?>">
|
|
<span class="user-dropdown__action-icon is-purple"><i class="fas fa-shopping-bag" aria-hidden="true"></i></span>
|
|
<span><?php esc_html_e('我的订单', 'aksrt'); ?></span>
|
|
</a>
|
|
<?php if ($aksrt_can_publish) : ?>
|
|
<a class="user-dropdown__action" href="<?php echo esc_url($aksrt_publish_url); ?>">
|
|
<span class="user-dropdown__action-icon is-green"><i class="fas fa-pen" aria-hidden="true"></i></span>
|
|
<span><?php esc_html_e('发布内容', 'aksrt'); ?></span>
|
|
</a>
|
|
<?php endif; ?>
|
|
<a class="user-dropdown__action is-danger" href="javascript:;" data-toggle="modal" data-target="#modal_signout">
|
|
<span class="user-dropdown__action-icon is-red"><i class="fas fa-sign-out-alt" aria-hidden="true"></i></span>
|
|
<span><?php esc_html_e('退出登录', 'aksrt'); ?></span>
|
|
</a>
|
|
</div>
|
|
|
|
<?php if (current_user_can('manage_options')) : ?>
|
|
<div class="user-dropdown__sep"></div>
|
|
<div class="user-dropdown__actions header-user-href user-dropdown__actions--admin">
|
|
<a class="user-dropdown__action" href="<?php echo esc_url($aksrt_theme_settings_url); ?>">
|
|
<span class="user-dropdown__action-icon is-yellow"><i class="fas fa-sliders-h" aria-hidden="true"></i></span>
|
|
<span><?php esc_html_e('主题设置', 'aksrt'); ?></span>
|
|
</a>
|
|
<a class="user-dropdown__action" href="<?php echo esc_url(admin_url()); ?>">
|
|
<span class="user-dropdown__action-icon is-yellow"><i class="fas fa-cog" aria-hidden="true"></i></span>
|
|
<span><?php esc_html_e('后台管理', 'aksrt'); ?></span>
|
|
</a>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php else : ?>
|
|
<div class="nav-user nav-user--guest">
|
|
<button type="button" class="nav-user__toggle navbar-avatar signin-loader" id="user-menu-toggle" aria-expanded="false" aria-controls="user-dropdown">
|
|
<span class="nav-user__guest-avatar" aria-hidden="true"><i class="fas fa-user"></i></span>
|
|
</button>
|
|
<div class="user-dropdown sub-user-box" id="user-dropdown">
|
|
<div class="user-dropdown__guest-title"><?php esc_html_e('欢迎来到本站', 'aksrt'); ?></div>
|
|
<div class="user-dropdown__actions header-user-href">
|
|
<a class="user-dropdown__action signin-loader" href="javascript:;">
|
|
<span class="user-dropdown__action-icon is-blue"><i class="fas fa-sign-in-alt" aria-hidden="true"></i></span>
|
|
<span><?php esc_html_e('登录', 'aksrt'); ?></span>
|
|
</a>
|
|
<?php if (get_option('users_can_register')) : ?>
|
|
<a class="user-dropdown__action signup-loader" href="javascript:;">
|
|
<span class="user-dropdown__action-icon is-green"><i class="fas fa-user-plus" aria-hidden="true"></i></span>
|
|
<span><?php esc_html_e('注册', 'aksrt'); ?></span>
|
|
</a>
|
|
<?php endif; ?>
|
|
<a class="user-dropdown__action" href="<?php echo esc_url(wp_lostpassword_url(home_url('/'))); ?>">
|
|
<span class="user-dropdown__action-icon is-purple"><i class="fas fa-key" aria-hidden="true"></i></span>
|
|
<span><?php esc_html_e('找回密码', 'aksrt'); ?></span>
|
|
</a>
|
|
</div>
|
|
|
|
<?php
|
|
if (class_exists('\AKSRT\Auth\OAuth') && method_exists(\AKSRT\Auth\OAuth::get_instance(), 'render_social_buttons')) {
|
|
$oauth_html = (string) \AKSRT\Auth\OAuth::get_instance()->render_social_buttons(__('快速登录', 'aksrt'));
|
|
if ($oauth_html !== '') {
|
|
echo '<div class="social_loginbar mt10">' . $oauth_html . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
}
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($aksrt_header_settings['mobile_drawer'])) : ?>
|
|
<button type="button" class="icon-btn nav-toggle" id="nav-toggle" aria-expanded="false" aria-controls="nav-drawer">
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 12h18"/><path d="M3 6h18"/><path d="M3 18h18"/></svg>
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
<?php if (function_exists('aksrt_render_signout_modal')) { aksrt_render_signout_modal(); } ?>
|
|
|
|
|
|
<?php if (!empty($aksrt_header_settings['mobile_drawer'])) : ?>
|
|
<div class="mobile-header nav-drawer-backdrop" id="nav-drawer-backdrop" aria-hidden="true"></div>
|
|
<div class="mobile-header nav-drawer" id="nav-drawer" data-aksrt-shell="nav-drawer" role="dialog" aria-modal="true" aria-labelledby="nav-drawer-title" aria-hidden="true">
|
|
<nav class="mobile-navbar">
|
|
<div class="nav-drawer__head">
|
|
<a href="<?php echo esc_url(home_url('/')); ?>" id="nav-drawer-title" class="<?php echo esc_attr($aksrt_brand_drawer_class); ?> navbar-brand" aria-label="<?php echo esc_attr($aksrt_brand_name); ?>">
|
|
<?php if ($aksrt_has_brand_logo) : ?>
|
|
<span class="site-brand__media navbar-logo"><?php echo $aksrt_brand_logo_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
|
|
<span class="screen-reader-text"><?php echo esc_html($aksrt_brand_name); ?></span>
|
|
<?php else : ?>
|
|
<span class="site-brand__logo" aria-hidden="true"><?php echo esc_html($aksrt_brand_mark); ?></span>
|
|
<span class="site-brand__name"><?php echo esc_html($aksrt_brand_name); ?></span>
|
|
<?php endif; ?>
|
|
</a>
|
|
<button type="button" class="icon-btn" id="nav-drawer-close" aria-label="<?php esc_attr_e('关闭菜单', 'aksrt'); ?>">
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
|
</button>
|
|
</div>
|
|
|
|
<?php if (!empty($aksrt_header_settings['search_enabled'])) : ?>
|
|
<div class="nav-drawer__search">
|
|
<form role="search" method="get" class="nav-searchbox nav-searchbox--drawer" action="<?php echo esc_url(home_url('/')); ?>" data-aksrt-search-form="drawer" data-default-search-type="<?php echo esc_attr($aksrt_search_type); ?>" data-default-category="<?php echo esc_attr((string) $aksrt_search_category_id); ?>">
|
|
<input type="hidden" name="aksrt_search_type" value="<?php echo esc_attr($aksrt_search_type); ?>">
|
|
<?php if ($aksrt_search_category_enabled) : ?>
|
|
<input type="hidden" name="aksrt_category" value="<?php echo esc_attr((string) $aksrt_search_category_id); ?>">
|
|
<?php endif; ?>
|
|
<div class="nav-searchbox__field">
|
|
<span class="nav-searchbox__icon" aria-hidden="true">
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
|
|
</span>
|
|
<label class="screen-reader-text" for="nav-drawer-search-s"><?php esc_html_e('搜索', 'aksrt'); ?></label>
|
|
<input class="nav-searchbox__input" type="search" id="nav-drawer-search-s" name="s" value="<?php echo esc_attr(get_search_query()); ?>" placeholder="<?php echo esc_attr($aksrt_search_placeholder); ?>">
|
|
<button type="submit" class="nav-searchbox__submit"><?php esc_html_e('搜索', 'aksrt'); ?></button>
|
|
</div>
|
|
</form>
|
|
<?php if (!empty($aksrt_search_type_options)) : ?>
|
|
<div class="nav-searchbox__meta">
|
|
<div class="nav-searchbox__types" aria-label="<?php esc_attr_e('搜索类型', 'aksrt'); ?>">
|
|
<?php foreach ($aksrt_search_type_options as $type_key => $type_label) : ?>
|
|
<button type="button" class="nav-searchbox__type<?php echo $aksrt_search_type === $type_key ? ' is-active' : ''; ?>" data-search-type="<?php echo esc_attr($type_key); ?>"><?php echo esc_html($type_label); ?></button>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php if ($aksrt_search_category_enabled && !empty($aksrt_search_categories)) : ?>
|
|
<div class="nav-searchbox__category-wrap">
|
|
<label class="screen-reader-text" for="nav-drawer-search-category"><?php esc_html_e('默认分类', 'aksrt'); ?></label>
|
|
<select class="nav-searchbox__category" id="nav-drawer-search-category" data-search-category-select>
|
|
<option value="0"><?php esc_html_e('全部分类', 'aksrt'); ?></option>
|
|
<?php foreach ($aksrt_search_categories as $search_category) : ?>
|
|
<option value="<?php echo esc_attr((string) $search_category->term_id); ?>"<?php selected($aksrt_search_category_id, (int) $search_category->term_id); ?>><?php echo esc_html($search_category->name); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php aksrt_render_search_hot_keywords($aksrt_search_hot_keywords, 'aksrt-search-hot-keywords'); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="nav-drawer__menu">
|
|
<?php
|
|
if (has_nav_menu($aksrt_mobile_menu_location)) {
|
|
wp_nav_menu(
|
|
[
|
|
'theme_location' => $aksrt_mobile_menu_location,
|
|
'container' => false,
|
|
'menu_class' => '',
|
|
'fallback_cb' => false,
|
|
'depth' => 2,
|
|
]
|
|
);
|
|
} else {
|
|
echo '<a href="' . esc_url(home_url('/')) . '">' . esc_html__('首页', 'aksrt') . '</a>';
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="nav-actions__cta nav-actions__cta--drawer">
|
|
<?php if ($aksrt_can_publish) : ?>
|
|
<div class="nav-drawer__publish">
|
|
<a class="btn-primary" href="<?php echo esc_url($aksrt_publish_url); ?>">
|
|
<i class="fas fa-pen-nib" aria-hidden="true"></i>
|
|
<span><?php esc_html_e('发布内容', 'aksrt'); ?></span>
|
|
</a>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (in_array('m_menu', $aksrt_theme_toggle_positions, true)) : ?>
|
|
<div class="nav-drawer__theme-toggle">
|
|
<button type="button" class="btn-outline theme-toggle-mobile" id="theme-toggle-mobile" title="<?php esc_attr_e('切换亮暗色', 'aksrt'); ?>">
|
|
<i class="fas fa-adjust" aria-hidden="true"></i>
|
|
<span><?php esc_html_e('切换主题', 'aksrt'); ?></span>
|
|
</button>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($aksrt_show_user_entry && !is_user_logged_in()) : ?>
|
|
<div class="nav-drawer__auth">
|
|
<a class="btn-outline" href="<?php echo esc_url(aksrt_get_login_url()); ?>"><?php esc_html_e('登录', 'aksrt'); ?></a>
|
|
<?php if (get_option('users_can_register')) : ?>
|
|
<a class="btn-primary" href="<?php echo esc_url(aksrt_get_register_url()); ?>"><?php esc_html_e('注册', 'aksrt'); ?></a>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (is_active_sidebar('mobile_nav_fluid')) : ?>
|
|
<div class="nav-drawer__widgets">
|
|
<?php dynamic_sidebar('mobile_nav_fluid'); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="fixed-body"></div>
|
|
</nav>
|
|
</div>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
// Zibll contract: header slider sits after </header> (+ mobile drawer), before page fluid/main.
|
|
if (function_exists('aksrt_header_slide')) {
|
|
aksrt_header_slide();
|
|
}
|
|
?>
|