fix(users): keep management inside center
This commit is contained in:
1 parent
c3bfd12c69
commit
ce2b266890
44 files changed
+194
-2584
No files matched your search
@@ -1,116 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: AKSRT - 文档导航
|
||||
* Template Post Type: page
|
||||
*
|
||||
* Zibll pages/documentnav.php 1:1 — category accordion + search + AJAX posts.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use AKSRT\Core\DocumentNav;
|
||||
|
||||
$post_id = (int) get_queried_object_id();
|
||||
$opt = class_exists(DocumentNav::class)
|
||||
? DocumentNav::get_options($post_id)
|
||||
: ['cat' => 0, 'initial_content' => 'updated_posts'];
|
||||
$one_cat = (int) ($opt['cat'] ?? 0);
|
||||
$initial = (string) ($opt['initial_content'] ?? 'updated_posts');
|
||||
|
||||
get_header();
|
||||
?>
|
||||
<main class="container page-template-documentnav">
|
||||
<div class="content-wrap">
|
||||
<div class="content-layout">
|
||||
<div class="theme-box radius8 main-bg main-shadow box-body mb20">
|
||||
<h1 class="article-title"><?php echo esc_html(get_the_title() ?: __('文档导航', 'aksrt')); ?></h1>
|
||||
</div>
|
||||
|
||||
<div class="row document-nav-row">
|
||||
<div class="col-sm-4 document-nav-aside">
|
||||
<div class="theme-box zib-widget dosc-nav document-nav">
|
||||
<?php
|
||||
if ($one_cat > 0 && class_exists(DocumentNav::class)) {
|
||||
$open = true;
|
||||
echo DocumentNav::render_panels($one_cat, 'accordion', 'panel', $open); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
} elseif (current_user_can('edit_pages')) {
|
||||
echo '<p class="muted-2-color box-body">' . esc_html__('请在页面设置中选择一级分类。', 'aksrt') . '</p>';
|
||||
} else {
|
||||
echo '<p class="muted-2-color box-body">' . esc_html__('暂无文档分类', 'aksrt') . '</p>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8 document-nav-main" role="main">
|
||||
<div class="theme-box zib-widget document-search relative-h">
|
||||
<form class="document-search-form" action="javascript:;" method="get">
|
||||
<div class="line-form">
|
||||
<input type="search" name="s" class="line-form-input document-search-input" placeholder="<?php esc_attr_e('搜索文档…', 'aksrt'); ?>" autocomplete="off" required minlength="2">
|
||||
<button type="submit" class="abs-right null" aria-label="<?php esc_attr_e('搜索', 'aksrt'); ?>">
|
||||
<i class="fa fa-search" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="history-search mt10">
|
||||
<div>
|
||||
<?php
|
||||
if (class_exists(DocumentNav::class)) {
|
||||
echo DocumentNav::get_instance()->history_buttons_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-loading absolute main-bg flex jc" hidden>
|
||||
<i class="loading mr10 em12" aria-hidden="true"></i> <?php esc_html_e('正在搜索', 'aksrt'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="document-nav-container" data-one-cat="<?php echo (int) $one_cat; ?>">
|
||||
<?php
|
||||
if ($initial === 'page_content') {
|
||||
while (have_posts()) {
|
||||
the_post();
|
||||
echo '<div class="nopw-sm box-body theme-box radius8 main-bg main-shadow">';
|
||||
echo '<article class="article wp-posts-content">';
|
||||
the_content();
|
||||
echo '</article></div>';
|
||||
}
|
||||
} elseif ($one_cat > 0 && class_exists(DocumentNav::class)) {
|
||||
$args = [
|
||||
'cat' => $one_cat,
|
||||
'order' => 'DESC',
|
||||
'orderby' => 'modified',
|
||||
'posts_per_page' => 12,
|
||||
'no_found_rows' => true,
|
||||
'ignore_sticky_posts' => true,
|
||||
'post_status' => 'publish',
|
||||
];
|
||||
if ($initial === 'date_posts') {
|
||||
$args['orderby'] = 'date';
|
||||
} elseif ($initial === 'views_posts') {
|
||||
$args['orderby'] = 'meta_value_num';
|
||||
$args['meta_key'] = 'aksrt_post_views';
|
||||
}
|
||||
$q = new WP_Query($args);
|
||||
echo DocumentNav::render_posts_html($q); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
} else {
|
||||
echo '<div class="zib-widget"><p class="muted-2-color text-center">' . esc_html__('请配置文档分类', 'aksrt') . '</p></div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (comments_open() || get_comments_number()) {
|
||||
comments_template();
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php get_sidebar(); ?>
|
||||
</main>
|
||||
<?php
|
||||
get_footer();
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: AKSRT - 网址导航
|
||||
* Template Post Type: page
|
||||
*
|
||||
* Zibll pages/links.php 1:1 — multi-category bookmarks, search cover, submit modal.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$post_id = (int) get_queried_object_id();
|
||||
$s = function_exists('aksrt_get_page_links_settings')
|
||||
? aksrt_get_page_links_settings($post_id)
|
||||
: [];
|
||||
|
||||
get_header();
|
||||
?>
|
||||
<main class="container page-content-default page-template-links">
|
||||
<div class="content-wrap">
|
||||
<div class="content-layout">
|
||||
<?php
|
||||
while (have_posts()) :
|
||||
the_post();
|
||||
|
||||
// Optional page header (style 1 / 2 / 3 via existing page meta).
|
||||
if (function_exists('aksrt_get_page_header_html')) {
|
||||
echo aksrt_get_page_header_html($post_id); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
} else {
|
||||
$header_style = (string) get_post_meta($post_id, 'page_header_style', true);
|
||||
if ($header_style !== 'not') {
|
||||
echo '<div class="theme-box radius8 main-bg main-shadow box-body mb20"><h1 class="article-title">' . esc_html(get_the_title()) . '</h1></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('aksrt_link_get_search_cover')) {
|
||||
echo aksrt_link_get_search_cover($post_id); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
$links_html = function_exists('aksrt_page_links_html') ? aksrt_page_links_html($post_id) : '';
|
||||
$content_s = !empty($s['content_s']);
|
||||
$position = (string) ($s['content_position'] ?? 'top');
|
||||
|
||||
if ($position !== 'top') {
|
||||
echo $links_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
if ($content_s) {
|
||||
echo '<div class="zib-widget"><article class="article wp-posts-content">';
|
||||
the_content();
|
||||
wp_link_pages([
|
||||
'before' => '<p class="text-center post-nav-links radius8 padding-6">',
|
||||
'after' => '</p>',
|
||||
]);
|
||||
echo '</article></div>';
|
||||
}
|
||||
|
||||
if ($position === 'top') {
|
||||
echo $links_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
endwhile;
|
||||
|
||||
if (comments_open() || get_comments_number()) {
|
||||
comments_template();
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php get_sidebar(); ?>
|
||||
</main>
|
||||
<?php
|
||||
if (!empty($s['submit_s']) && function_exists('aksrt_submit_links_modal')) {
|
||||
echo aksrt_submit_links_modal([ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'title' => (string) ($s['submit_title'] ?? __('申请入驻', 'aksrt')),
|
||||
'dec' => (string) ($s['submit_dec'] ?? ''),
|
||||
'sign' => !empty($s['submit_sign_s']),
|
||||
'cats' => (array) ($s['submit_cats'] ?? []),
|
||||
]);
|
||||
}
|
||||
|
||||
get_footer();
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: AKSRT - Orders
|
||||
* Template Post Type: page
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$target = function_exists('aksrt_get_user_center_url')
|
||||
? aksrt_get_user_center_url('orders')
|
||||
: home_url('/profile/?tab=orders');
|
||||
|
||||
if (!is_user_logged_in()) {
|
||||
$login_url = function_exists('aksrt_get_login_url') ? aksrt_get_login_url() : wp_login_url($target);
|
||||
wp_safe_redirect($login_url);
|
||||
exit;
|
||||
}
|
||||
|
||||
$raw = [
|
||||
'status' => $_GET['order_status'] ?? '',
|
||||
'type' => $_GET['order_type'] ?? '',
|
||||
'order_number' => $_GET['order_number'] ?? '',
|
||||
'page' => $_GET['order_page'] ?? 1,
|
||||
];
|
||||
$query = \AKSRT\Payment\OrderCenterQuery::from_array($raw);
|
||||
$params = array_merge(['tab' => 'orders'], $query->url_values());
|
||||
|
||||
wp_safe_redirect(add_query_arg($params, $target), 302);
|
||||
exit;
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Template Name: AKSRT - Revenue
|
||||
* Template Post Type: page
|
||||
*
|
||||
* Legacy revenue route canonicalizes to the private user-center tab.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$target = function_exists('aksrt_get_user_center_tab_url')
|
||||
? aksrt_get_user_center_tab_url('revenue')
|
||||
: home_url('/profile/?tab=revenue');
|
||||
$rev_page = isset($_GET['rev_page']) ? max(1, (int) $_GET['rev_page']) : 1;
|
||||
if ($rev_page > 1) {
|
||||
$target = add_query_arg('rev_page', $rev_page, $target);
|
||||
}
|
||||
|
||||
if (!is_user_logged_in()) {
|
||||
wp_safe_redirect(aksrt_get_login_url($target));
|
||||
exit;
|
||||
}
|
||||
|
||||
wp_safe_redirect($target);
|
||||
exit;
|
||||
@@ -29,9 +29,6 @@ if ($presenter) {
|
||||
|
||||
$root_page = get_post($root_id);
|
||||
|
||||
// Quick search for docs
|
||||
$doc_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_docs_mode_settings() : [];
|
||||
$show_search = !empty($doc_settings['toc_enabled']);
|
||||
?>
|
||||
<aside class="aksrt-doc-sidebar" role="navigation" aria-label="<?php esc_attr_e('文档导航', 'aksrt'); ?>">
|
||||
<div class="aksrt-doc-sidebar__header">
|
||||
@@ -41,12 +38,10 @@ $show_search = !empty($doc_settings['toc_enabled']);
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php if ($show_search) : ?>
|
||||
<div class="aksrt-doc-sidebar__search">
|
||||
<input type="text" class="aksrt-doc-sidebar__search-input" placeholder="<?php esc_attr_e('搜索文档...', 'aksrt'); ?>" aria-label="<?php esc_attr_e('搜索文档', 'aksrt'); ?>">
|
||||
<i class="fas fa-search aksrt-doc-sidebar__search-icon"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($doc_pages)) : ?>
|
||||
<ul class="aksrt-doc-sidebar__nav">
|
||||
|
||||
@@ -17,11 +17,12 @@ if (!function_exists('aksrt_render_profile_pagination')) {
|
||||
* @param int $current 当前页
|
||||
* @param string $param URL 参数名
|
||||
*/
|
||||
function aksrt_render_profile_pagination($total_pages, $current, $param) {
|
||||
function aksrt_render_profile_pagination($total_pages, $current, $param, $base_url = '') {
|
||||
if ($total_pages <= 1) {
|
||||
return;
|
||||
}
|
||||
$base = remove_query_arg($param);
|
||||
$base = $base_url !== '' ? $base_url : remove_query_arg($param);
|
||||
$base = remove_query_arg($param, $base);
|
||||
$base = add_query_arg($param, '%#%', $base);
|
||||
$links = paginate_links([
|
||||
'base' => $base,
|
||||
|
||||
Reference in new issue
Block a user