refactor(autoload): migrate theme classes to Composer PSR-4

Move 288 types from global AKSRT_* + inc/classes manual requires into
namespace AKSRT\{Domain} under src/AKSRT/, wire composer.json psr-4,
and slim bootstrap to helpers/modules/hooks only. Split multi-class
widget/gateway files, update admin contract audit paths, and document
the layout in ADR/README.
This commit is contained in:
kate522 committed 2026-07-17 13:29:22 +08:00
1 parent 8f349b40fb
commit aaf458af1c
404 files changed
+13602 -7705

No files matched your search

+2 -2
View File
@@ -9,7 +9,7 @@ defined('ABSPATH') || exit;
get_header();
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
$forum = class_exists('\AKSRT\Forum\Forum') ? \AKSRT\Forum\Forum::get_instance() : null;
$current_user_id = get_current_user_id();
$board = get_queried_object();
$board_id = $board ? (int) $board->term_id : 0;
@@ -48,7 +48,7 @@ $board_url = !empty($board_data['url']) ? (string) $board_data['url'] : (is_wp_e
$nonce = wp_create_nonce('aksrt_public_nonce');
$max_pages = (int) ($view['pagination']['max_pages'] ?? 1);
$forum_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_forum_settings() : [];
$forum_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_forum_settings() : [];
$forum_names = $forum_settings['names'] ?? [];
$name_topic = $forum_names['posts'] ?? __('主题', 'aksrt');
$name_reply = $forum_names['comment'] ?? __('回复', 'aksrt');
+2 -2
View File
@@ -18,7 +18,7 @@ if (!is_user_logged_in()) {
exit;
}
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
$forum = class_exists('\AKSRT\Forum\Forum') ? \AKSRT\Forum\Forum::get_instance() : null;
$current_user_id = get_current_user_id();
$board_id = isset($_GET['board']) ? (int) $_GET['board'] : 0;
$draft_id = isset($_GET['draft']) ? (int) $_GET['draft'] : 0;
@@ -33,7 +33,7 @@ $view = $forum ? $forum->get_compose_view($current_user_id, ['board_id' => $boar
'capabilities' => [],
];
$forum_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_forum_settings() : [];
$forum_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_forum_settings() : [];
$title_placeholder = $forum_settings['other']['t_placeholder'] ?? __('请输入标题', 'aksrt');
$content_placeholder = $forum_settings['other']['c_placeholder'] ?? __('请输入内容', 'aksrt');
$title_maxlen = max(5, min(100, (int) ($forum_settings['other']['title_strlen_limit'] ?? 30)));
+2 -2
View File
@@ -16,7 +16,7 @@ if (!is_user_logged_in()) {
$topic_id = get_the_ID();
$user_id = get_current_user_id();
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
$forum = class_exists('\AKSRT\Forum\Forum') ? \AKSRT\Forum\Forum::get_instance() : null;
if (!$forum || !$forum->can_edit_topic($user_id, $topic_id)) {
wp_safe_redirect(get_permalink($topic_id));
@@ -74,7 +74,7 @@ $vote_options_raw = get_post_meta($topic_id, '_aksrt_vote_options', true) ?: [];
$vote_options_text = is_array($vote_options_raw) ? implode("\n", array_column($vote_options_raw, 'label')) : '';
// Settings & capabilities
$forum_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_forum_settings() : [];
$forum_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_forum_settings() : [];
$title_maxlen = max(5, min(100, (int) ($forum_settings['other']['title_strlen_limit'] ?? 30)));
$vote_max = (int) ($forum_settings['other']['vote_max'] ?? 8);
$caps = $forum->get_compose_capabilities($user_id);
+2 -2
View File
@@ -9,11 +9,11 @@ defined('ABSPATH') || exit;
get_header();
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
$forum = class_exists('\AKSRT\Forum\Forum') ? \AKSRT\Forum\Forum::get_instance() : null;
$term = get_queried_object();
$cat_id = $term ? (int) $term->term_id : 0;
$forum_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_forum_settings() : [];
$forum_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_forum_settings() : [];
$forum_names = $forum_settings['names'] ?? [];
$forum_name = $forum_names['forum'] ?? __('论坛', 'aksrt');
+2 -2
View File
@@ -9,7 +9,7 @@ defined('ABSPATH') || exit;
get_header();
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
$forum = class_exists('\AKSRT\Forum\Forum') ? \AKSRT\Forum\Forum::get_instance() : null;
$current_user_id = get_current_user_id();
$plate_id = get_queried_object_id();
$paged = max(1, (int) get_query_var('paged', 1));
@@ -47,7 +47,7 @@ $compose_url = (string) ($view['compose_url'] ?? (function_exists('aksrt_get_
$plate_url = !empty($board_data['url']) ? (string) $board_data['url'] : (string) get_permalink($plate_id);
$nonce = wp_create_nonce('aksrt_public_nonce');
$forum_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_forum_settings() : [];
$forum_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_forum_settings() : [];
$forum_names = $forum_settings['names'] ?? [];
$name_topic = $forum_names['posts'] ?? __('主题', 'aksrt');
$name_reply = $forum_names['comment'] ?? __('回复', 'aksrt');
+1 -1
View File
@@ -11,7 +11,7 @@ get_header();
$term = get_queried_object();
$paged = max(1, (int) get_query_var('paged'));
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
$forum = class_exists('\AKSRT\Forum\Forum') ? \AKSRT\Forum\Forum::get_instance() : null;
$view = $forum ? $forum->get_tag_archive_view([
'term_id' => $term->term_id,
'paged' => $paged,
+6 -6
View File
@@ -17,7 +17,7 @@ if (!have_posts()) {
the_post();
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
$forum = class_exists('\AKSRT\Forum\Forum') ? \AKSRT\Forum\Forum::get_instance() : null;
$current_user_id = get_current_user_id();
$topic_id = get_the_ID();
$view = $forum ? $forum->get_topic_view($topic_id, $current_user_id) : [
@@ -37,7 +37,7 @@ $visibility_options = $view['visibility_options'] ?? [];
$review_options = $view['review_options'] ?? [];
// Forum settings for names, breadcrumbs, reply
$forum_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_forum_settings() : [];
$forum_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_forum_settings() : [];
$forum_names = $forum_settings['names'] ?? [];
$forum_bc = $forum_settings['post_page'] ?? [];
$reply_settings = $forum_settings['reply'] ?? [];
@@ -86,8 +86,8 @@ if (empty($topic['can_view'])) :
<?php elseif ($deny_vis === 'pay' && is_user_logged_in()) : ?>
<?php
$viewer_id = get_current_user_id();
$price_info = class_exists('AKSRT_Forum')
? AKSRT_Forum::get_instance()->resolve_topic_pay_price($topic_id, $viewer_id)
$price_info = class_exists('\AKSRT\Forum\Forum')
? \AKSRT\Forum\Forum::get_instance()->resolve_topic_pay_price($topic_id, $viewer_id)
: ['amount' => (float) $pay_price, 'is_free' => false, 'label' => '', 'base' => (float) $pay_price];
$charge_amount = (float) ($price_info['amount'] ?? 0);
$is_free_vip = !empty($price_info['is_free']);
@@ -164,8 +164,8 @@ if (empty($topic['can_view'])) :
<?php elseif ($deny_vis === 'pay') : ?>
<?php
$viewer_id = get_current_user_id();
$price_info = class_exists('AKSRT_Forum')
? AKSRT_Forum::get_instance()->resolve_topic_pay_price($topic_id, $viewer_id)
$price_info = class_exists('\AKSRT\Forum\Forum')
? \AKSRT\Forum\Forum::get_instance()->resolve_topic_pay_price($topic_id, $viewer_id)
: ['amount' => (float) $pay_price, 'is_free' => false, 'is_vip_price' => false, 'base' => (float) $pay_price, 'label' => ''];
$charge_amount = (float) ($price_info['amount'] ?? 0);
$base_amount = (float) ($price_info['base'] ?? $charge_amount);
+5 -5
View File
@@ -22,7 +22,7 @@ $obk = '';
if (isset($_GET['obk'])) {
$obk = sanitize_text_field($_GET['obk']);
$oauth_data = AKSRT_Auth_Service::get_oauth_bind_context($obk);
$oauth_data = \AKSRT\Auth\Service::get_oauth_bind_context($obk);
}
if (! $oauth_data || ! is_array($oauth_data)) {
@@ -31,7 +31,7 @@ if (! $oauth_data || ! is_array($oauth_data)) {
$bind_error = __('绑定会话已过期,请重新使用第三方登录', 'aksrt');
}
} else {
$provider_name = AKSRT_Auth_Service::get_oauth_provider_name($oauth_data['provider'] ?? '');
$provider_name = \AKSRT\Auth\Service::get_oauth_provider_name($oauth_data['provider'] ?? '');
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['log'], $_POST['pwd']) && empty($bind_error)) {
@@ -40,10 +40,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['log'], $_POST['pwd'])
}
if ($oauth_data === null && $obk !== '') {
$oauth_data = AKSRT_Auth_Service::get_oauth_bind_context($obk);
$oauth_data = \AKSRT\Auth\Service::get_oauth_bind_context($obk);
}
$result = AKSRT_Auth_Service::bind_oauth_account($_POST, $oauth_data);
$result = \AKSRT\Auth\Service::bind_oauth_account($_POST, $oauth_data);
if (empty($result['success'])) {
$bind_error = $result['error'] ?? __('绑定失败,请稍后重试', 'aksrt');
$bind_verify_url = $result['verify_url'] ?? '';
@@ -126,7 +126,7 @@ get_header();
</button>
</form>
<?php if (class_exists('AKSRT_Settings') ? AKSRT_Settings::registration_enabled() : get_option('users_can_register')) :
<?php if (class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::registration_enabled() : get_option('users_can_register')) :
$register_url = aksrt_get_register_url();
$register_url = add_query_arg('obk', sanitize_text_field($_GET['obk']), $register_url);
?>
+4 -4
View File
@@ -75,11 +75,11 @@ if (function_exists('aksrt_archive_open_shell')) {
<?php foreach ($top_level as $cat) :
$cat_id = (int) $cat->term_id;
$cat_link = get_category_link($cat_id);
$cover_url = class_exists('AKSRT_Settings')
? AKSRT_Settings::get_category_cover_url($cat_id)
$cover_url = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_category_cover_url($cat_id)
: (get_template_directory_uri() . '/assets/img/placeholder.svg');
$desc = class_exists('AKSRT_Settings')
? AKSRT_Settings::get_category_recommend_desc($cat_id)
$desc = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_category_recommend_desc($cat_id)
: (string) $cat->description;
$children = $children_by_parent[$cat_id] ?? [];
?>
+2 -2
View File
@@ -14,10 +14,10 @@ defined('ABSPATH') || exit;
get_header();
// Read doc mode settings
$doc_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_docs_mode_settings() : [];
$doc_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_docs_mode_settings() : [];
$default_order = $doc_settings['default_order'] ?? 'menu_order';
$presenter = class_exists('AKSRT_Docs_Presenter') ? AKSRT_Docs_Presenter::get_instance() : null;
$presenter = class_exists('\AKSRT\Core\DocsPresenter') ? \AKSRT\Core\DocsPresenter::get_instance() : null;
// Get root-level pages
$pages = $presenter
+4 -4
View File
@@ -56,7 +56,7 @@ $need_vip = $gate_code === 'aksrt_need_vip';
$priced = function_exists('aksrt_get_user_pay_price') ? aksrt_get_user_pay_price($post) : null;
$price = is_array($priced) ? (float) ($priced['amount'] ?? 0) : (float) ($pay_meta['price'] ?? 0);
$pay_modo = is_array($priced) ? ((($priced['modo'] ?? '0') === 'points') ? 'points' : '0') : ((($pay_meta['pay_modo'] ?? '0') === 'points') ? 'points' : '0');
$order_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_order_settings() : [];
$order_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_order_settings() : [];
$free_logged_show = !empty($order_settings['free_logged_show']);
if ($price <= 0 && $free_logged_show && !is_user_logged_in()) {
$can_dl = false;
@@ -64,10 +64,10 @@ if ($price <= 0 && $free_logged_show && !is_user_logged_in()) {
$has_access = true; // free "access" but must login to download
}
$currency = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_currency_name() : __('积分', 'aksrt');
$currency = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_currency_name() : __('积分', 'aksrt');
$cash_symbol = '¥';
if (class_exists('AKSRT_Settings')) {
$paid_display = AKSRT_Settings::get_paid_content_settings();
if (class_exists('\AKSRT\Settings\Settings')) {
$paid_display = \AKSRT\Settings\Settings::get_paid_content_settings();
$cash_symbol = (string) ($paid_display['display']['currency_symbol'] ?? '¥');
}
$price_text = $price <= 0
+9 -9
View File
@@ -15,7 +15,7 @@ $per_page = 12;
$type_filter = isset($_GET['resource_type']) ? sanitize_key((string) $_GET['resource_type']) : '';
$resource_type_labels = function_exists('aksrt_get_pay_types') ? aksrt_get_pay_types() : [];
unset($resource_type_labels[AKSRT_Domain_Model::PAY_TYPE_READING]);
unset($resource_type_labels[\AKSRT\Core\DomainModel::PAY_TYPE_READING]);
if ($type_filter !== '' && !isset($resource_type_labels[$type_filter])) {
$type_filter = '';
@@ -31,8 +31,8 @@ $query_args = [
'ignore_sticky_posts' => true,
'meta_query' => [
[
'key' => AKSRT_Domain_Model::PAY_TYPE_KEY,
'value' => AKSRT_Domain_Model::PAY_TYPE_DOWNLOAD,
'key' => \AKSRT\Core\DomainModel::PAY_TYPE_KEY,
'value' => \AKSRT\Core\DomainModel::PAY_TYPE_DOWNLOAD,
'compare' => '=',
],
],
@@ -40,7 +40,7 @@ $query_args = [
if ($type_filter !== '') {
$query_args['meta_query'][] = [
'key' => AKSRT_Domain_Model::PAY_TYPE_KEY,
'key' => \AKSRT\Core\DomainModel::PAY_TYPE_KEY,
'value' => $type_filter,
];
}
@@ -52,15 +52,15 @@ $user_credits = 0;
$user_download_count = 0;
if ($is_logged_in) {
$uid = get_current_user_id();
if (class_exists('AKSRT_Credits')) {
$user_credits = AKSRT_Credits::balance($uid);
if (class_exists('\AKSRT\Credits\Credits')) {
$user_credits = \AKSRT\Credits\Credits::balance($uid);
}
$dl_meta = get_user_meta($uid, '_aksrt_downloaded_resources', true);
$user_download_count = is_array($dl_meta) ? count($dl_meta) : 0;
}
$currency_name = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_currency_name() : __('积分', 'aksrt');
$paid_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_paid_content_settings() : [];
$currency_name = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_currency_name() : __('积分', 'aksrt');
$paid_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_paid_content_settings() : [];
$dl_requires_login = !empty($paid_settings['download_login']);
?>
@@ -139,7 +139,7 @@ $dl_requires_login = !empty($paid_settings['download_login']);
<?php echo esc_html(get_the_date()); ?>
</span>
<?php
$dl_count = (int) get_post_meta(get_the_ID(), AKSRT_Domain_Model::RESOURCE_DOWNLOAD_COUNT_KEY, true);
$dl_count = (int) get_post_meta(get_the_ID(), \AKSRT\Core\DomainModel::RESOURCE_DOWNLOAD_COUNT_KEY, true);
if ($dl_count > 0) :
?>
<span class="aksrt-download-card__downloads">
+2 -2
View File
@@ -12,7 +12,7 @@ defined('ABSPATH') || exit;
get_header();
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
$forum = class_exists('\AKSRT\Forum\Forum') ? \AKSRT\Forum\Forum::get_instance() : null;
$current_user_id = get_current_user_id();
$view = $forum ? $forum->get_home_view($current_user_id) : [
'boards' => [],
@@ -36,7 +36,7 @@ $permissions = $view['permissions'] ?? [];
$applications = $view['applications'] ?? [];
$compose_url = aksrt_get_forum_compose_url();
$forum_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_forum_settings() : [];
$forum_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_forum_settings() : [];
$forum_names = $forum_settings['names'] ?? [];
$name_forum = $forum_names['forum'] ?? __('论坛', 'aksrt');
$name_plate = $forum_names['plate'] ?? __('版块', 'aksrt');
+5 -5
View File
@@ -19,8 +19,8 @@ if (!is_user_logged_in()) {
exit;
}
$messages_enabled = !class_exists('AKSRT_Settings') || AKSRT_Settings::message_enabled();
$pm_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::private_message_settings() : ['enabled' => false];
$messages_enabled = !class_exists('\AKSRT\Settings\Settings') || \AKSRT\Settings\Settings::message_enabled();
$pm_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::private_message_settings() : ['enabled' => false];
$pm_enabled = !empty($pm_settings['enabled']);
if (!$messages_enabled) :
@@ -114,9 +114,9 @@ foreach ($all_notifications as $n) {
}
}
if ($pm_enabled && class_exists('AKSRT_Private_Message')) {
if ($pm_enabled && class_exists('\AKSRT\Messages\PrivateMessage')) {
// conversation count prefers live PM conversations when available
$pm_tmp = AKSRT_Private_Message::get_instance();
$pm_tmp = \AKSRT\Messages\PrivateMessage::get_instance();
if (method_exists($pm_tmp, 'get_conversations')) {
$convs = $pm_tmp->get_conversations($user_id, 100);
if (is_array($convs)) {
@@ -196,7 +196,7 @@ if (!$messages_base) {
<section class="messages-center__content">
<?php if ($current_type === 'conversation' && $pm_enabled) :
$pm = class_exists('AKSRT_Private_Message') ? AKSRT_Private_Message::get_instance() : null;
$pm = class_exists('\AKSRT\Messages\PrivateMessage') ? \AKSRT\Messages\PrivateMessage::get_instance() : null;
$conversations = $pm ? $pm->get_conversations($user_id, 30) : [];
$pm_nonce = wp_create_nonce('aksrt_pm');
$pm_placeholder = (string) ($pm_settings['placeholder'] ?? __('请输入消息...', 'aksrt'));
+10 -10
View File
@@ -26,11 +26,11 @@ $tab = sanitize_key((string) ($_GET['tab'] ?? ''));
$status = sanitize_key((string) ($_GET['order_status'] ?? ''));
$tab_status_map = [
'pending' => AKSRT_Order::STATUS_PENDING,
'shipped' => AKSRT_Order::STATUS_DELIVERED,
'received' => AKSRT_Order::STATUS_COMPLETED,
'review' => AKSRT_Order::STATUS_PENDING_REVIEW,
'after' => AKSRT_Order::STATUS_REFUNDING,
'pending' => \AKSRT\Payment\Order::STATUS_PENDING,
'shipped' => \AKSRT\Payment\Order::STATUS_DELIVERED,
'received' => \AKSRT\Payment\Order::STATUS_COMPLETED,
'review' => \AKSRT\Payment\Order::STATUS_PENDING_REVIEW,
'after' => \AKSRT\Payment\Order::STATUS_REFUNDING,
];
if ($tab !== '' && isset($tab_status_map[$tab])) {
$status = $tab_status_map[$tab];
@@ -43,8 +43,8 @@ $orders_view = function_exists('aksrt_get_orders_page_view')
$orders = (array) ($orders_view['items'] ?? []);
$total_pages = max(1, (int) ($orders_view['total_pages'] ?? 1));
$shop = class_exists('AKSRT_Shop') ? AKSRT_Shop::get_instance() : null;
$shipping = class_exists('AKSRT_Shipping') ? AKSRT_Shipping::get_instance() : null;
$shop = class_exists('\AKSRT\Shop\Shop') ? \AKSRT\Shop\Shop::get_instance() : null;
$shipping = class_exists('\AKSRT\Payment\Shipping') ? \AKSRT\Payment\Shipping::get_instance() : null;
$tabs = [
'' => __('全部', 'aksrt'),
@@ -159,13 +159,13 @@ $tabs = [
<?php if (!empty($order['actions']['can_receipt'])) : ?>
<button type="button" class="btn-primary btn-sm" data-aksrt-order-receipt="<?php echo esc_attr($on); ?>"><?php esc_html_e('确认收货', 'aksrt'); ?></button>
<?php endif; ?>
<?php if ($os === AKSRT_Order::STATUS_PENDING_REVIEW) : ?>
<?php if ($os === \AKSRT\Payment\Order::STATUS_PENDING_REVIEW) : ?>
<button type="button" class="btn-primary btn-sm" data-aksrt-order-review="<?php echo esc_attr($on); ?>"><?php esc_html_e('去评价', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (!empty($order['actions']['can_cancel'])) : ?>
<button type="button" class="btn-ghost btn-sm" data-aksrt-order-cancel="<?php echo esc_attr($on); ?>"><?php esc_html_e('取消', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (in_array($os, [AKSRT_Order::STATUS_COMPLETED, AKSRT_Order::STATUS_PENDING_REVIEW], true)) : ?>
<?php if (in_array($os, [\AKSRT\Payment\Order::STATUS_COMPLETED, \AKSRT\Payment\Order::STATUS_PENDING_REVIEW], true)) : ?>
<button type="button" class="btn-outline btn-sm" data-aksrt-order-rebuy="<?php echo esc_attr($on); ?>"><?php esc_html_e('再次购买', 'aksrt'); ?></button>
<?php endif; ?>
<?php if (!empty($order['actions']['can_after_sale'])) : ?>
@@ -214,7 +214,7 @@ $tabs = [
<div class="aksrt-orders-page__field">
<label><?php esc_html_e('售后类型', 'aksrt'); ?></label>
<select name="type" class="aksrt-orders-page__select">
<?php foreach (AKSRT_After_Sale::get_valid_types() as $type_key => $type_label) : ?>
<?php foreach (\AKSRT\Payment\AfterSale::get_valid_types() as $type_key => $type_label) : ?>
<option value="<?php echo esc_attr($type_key); ?>"><?php echo esc_html($type_label); ?></option>
<?php endforeach; ?>
</select>
+3 -3
View File
@@ -18,7 +18,7 @@ if ($product_id <= 0) {
$product_id = (int) get_query_var('product_id', 0);
}
$shop = class_exists('AKSRT_Shop') ? AKSRT_Shop::get_instance() : null;
$shop = class_exists('\AKSRT\Shop\Shop') ? \AKSRT\Shop\Shop::get_instance() : null;
$product = function_exists('aksrt_get_product_page_view')
? aksrt_get_product_page_view($product_id)
: ($shop ? $shop->get_product_detail_view($product_id) : []);
@@ -31,8 +31,8 @@ $price_range = $product['price_range'] ?? [];
$params = $product['params'] ?? [];
$services = $product['services'] ?? [];
$pay_modo = $product['pay_modo'] ?? '0';
$scores = class_exists('AKSRT_Product_Review') ? AKSRT_Product_Review::get_instance()->get_product_scores($product_id) : [];
$reviews = class_exists('AKSRT_Product_Review') ? AKSRT_Product_Review::get_instance()->get_reviews($product_id, ['per_page' => 5]) : ['items' => [], 'total' => 0];
$scores = class_exists('\AKSRT\Shop\ProductReview') ? \AKSRT\Shop\ProductReview::get_instance()->get_product_scores($product_id) : [];
$reviews = class_exists('\AKSRT\Shop\ProductReview') ? \AKSRT\Shop\ProductReview::get_instance()->get_reviews($product_id, ['per_page' => 5]) : ['items' => [], 'total' => 0];
$author_id = (int) get_post_field('post_author', $product_id);
$author = $author_id > 0 ? get_userdata($author_id) : null;
?>
+3 -3
View File
@@ -17,7 +17,7 @@ defined('ABSPATH') || exit;
// ============================================
// 检测当前模式:设置密码 or 请求重置
// ============================================
$context = AKSRT_Auth_Service::get_reset_context($_GET);
$context = \AKSRT\Auth\Service::get_reset_context($_GET);
$mode = $context['mode'];
$errors = [];
$success = '';
@@ -34,7 +34,7 @@ if (!empty($context['error'])) {
// 模式1:请求重置密码(忘记密码表单提交)
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['aksrt_action']) && $_POST['aksrt_action'] === 'request_reset') {
$result = AKSRT_Auth_Service::request_password_reset($_POST);
$result = \AKSRT\Auth\Service::request_password_reset($_POST);
if (!empty($result['success'])) {
$success = $result['message'] ?? __('如果该账号存在,重置邮件已发送到注册邮箱', 'aksrt');
} else {
@@ -44,7 +44,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['aksrt_action']) && $_
// 模式2:设置新密码(从邮件链接进入)
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['aksrt_action']) && $_POST['aksrt_action'] === 'set_password') {
$result = AKSRT_Auth_Service::reset_password_with_token($_POST);
$result = \AKSRT\Auth\Service::reset_password_with_token($_POST);
if (!empty($result['success'])) {
$mode = 'success';
$success = $result['message'] ?? __('密码已设置成功!', 'aksrt');
+3 -3
View File
@@ -28,14 +28,14 @@ $total_earned = (float) ($revenue_view['total_earned'] ?? 0);
$total_withdrawn = (float) ($revenue_view['total_withdrawn'] ?? 0);
$records = $revenue_view['records'] ?? [];
$settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_withdrawal_settings() : [];
$settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_withdrawal_settings() : [];
$min_amount = (float) ($settings['min_amount'] ?? 50);
$fee_rate = (float) ($settings['service_charge_rate'] ?? 0);
$withdraw_text = (string) ($settings['text'] ?? '');
$withdrawals = [];
if (class_exists('AKSRT_Withdrawal')) {
$withdrawals = AKSRT_Withdrawal::get_instance()->get_user_withdrawals($user_id, ['limit' => 20]);
if (class_exists('\AKSRT\Payment\Withdrawal')) {
$withdrawals = \AKSRT\Payment\Withdrawal::get_instance()->get_user_withdrawals($user_id, ['limit' => 20]);
}
$per_page = 20;
+14 -14
View File
@@ -19,8 +19,8 @@ $tab_aliases = [
$tab_source = $requested_tab !== '' ? $requested_tab : $route_tab;
$tab = $tab_aliases[$tab_source] ?? 'signin';
$redirect_to = !empty($_GET['redirect_to']) ? esc_url_raw(wp_unslash((string) $_GET['redirect_to'])) : home_url();
$registration_open = class_exists('AKSRT_Settings') && AKSRT_Settings::registration_enabled();
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'close_signup') && AKSRT_Settings::close_signup()) {
$registration_open = class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::registration_enabled();
if (class_exists('\AKSRT\Settings\Settings') && method_exists('\AKSRT\Settings\Settings', 'close_signup') && \AKSRT\Settings\Settings::close_signup()) {
$registration_open = false;
}
@@ -32,12 +32,12 @@ $page_title = ($titles[$tab] ?? __('登录 / 注册', 'aksrt')) . ' - ' . get_bl
$interim = isset($_REQUEST['interim-login']);
if (class_exists('AKSRT_Settings') && AKSRT_Settings::close_sign() && !is_user_logged_in() && !$interim) {
if (class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::close_sign() && !is_user_logged_in() && !$interim) {
wp_safe_redirect(home_url('/'), 302);
exit;
}
$close_signin = class_exists('AKSRT_Settings') ? AKSRT_Settings::close_signin() : false;
$close_signin = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::close_signin() : false;
if ($close_signin && $tab === 'signin') {
$_SERVER['REQUEST_METHOD'] = 'GET';
}
@@ -60,12 +60,12 @@ remove_action('wp_footer', 'aksrt_render_footer_tabbar', 20);
remove_action('wp_footer', 'aksrt_render_float_buttons', 30);
$background_html = '';
$sign_ui = class_exists('AKSRT_Settings') ? AKSRT_Settings::sign_page_ui() : [];
$sign_ui = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::sign_page_ui() : [];
$card_position = $sign_ui['card_position'] ?? 'center';
$sign_show_logo = $sign_ui['show_logo'] ?? true;
$sign_show_header = !empty($sign_ui['show_header']);
$sign_theme_mode = $sign_ui['theme_mode'] ?? 'default';
if (class_exists('AKSRT_Settings')) {
if (class_exists('\AKSRT\Settings\Settings')) {
$bg_ids = $sign_ui['background'] ?? [];
if (is_array($bg_ids) && !empty($bg_ids)) {
$bg_url = wp_get_attachment_url((int) $bg_ids[array_rand($bg_ids)]);
@@ -85,8 +85,8 @@ if (class_exists('AKSRT_Settings')) {
$login_error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['log'], $_POST['pwd']) && $tab === 'signin') {
if (class_exists('AKSRT_Auth_Service')) {
$result = AKSRT_Auth_Service::login_user($_POST, false);
if (class_exists('\AKSRT\Auth\Service')) {
$result = \AKSRT\Auth\Service::login_user($_POST, false);
if (empty($result['success'])) {
$login_error = $result['error'] ?? __('登录失败', 'aksrt');
} else {
@@ -99,8 +99,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['log'], $_POST['pwd'])
$register_error = '';
$register_success = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['user_login'], $_POST['user_email']) && $tab === 'signup') {
if (class_exists('AKSRT_Auth_Service')) {
$result = AKSRT_Auth_Service::register_user($_POST, ['oauth_bind_data' => null, 'obk' => '']);
if (class_exists('\AKSRT\Auth\Service')) {
$result = \AKSRT\Auth\Service::register_user($_POST, ['oauth_bind_data' => null, 'obk' => '']);
if (!empty($result['success'])) {
if (!empty($result['verification_required'])) {
$register_success = sprintf(
@@ -201,8 +201,8 @@ $sign_css_ver = file_exists(get_template_directory() . '/assets/css/routes/sign.
<button type="submit" class="btn-submit"><?php esc_html_e('登录', 'aksrt'); ?></button>
</form>
<?php endif; ?>
<?php if (class_exists('AKSRT_OAuth')) : ?>
<?php $social = AKSRT_OAuth::get_instance()->render_social_buttons(); ?>
<?php if (class_exists('\AKSRT\Auth\OAuth')) : ?>
<?php $social = \AKSRT\Auth\OAuth::get_instance()->render_social_buttons(); ?>
<?php if ($social) : ?>
<div class="sign-oauth">
<div class="sign-oauth__divider"><span><?php esc_html_e('其他登录方式', 'aksrt'); ?></span></div>
@@ -244,7 +244,7 @@ $sign_css_ver = file_exists(get_template_directory() . '/assets/css/routes/sign.
</div>
</div>
<?php
$invite_cfg = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_invite_registration_config() : null;
$invite_cfg = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_invite_registration_config() : null;
if ($invite_cfg && ($invite_cfg['register_field'] ?? 'hidden') !== 'hidden') {
$mode = (string) $invite_cfg['register_field'];
$invit_hint = $mode === 'required'
@@ -265,7 +265,7 @@ $sign_css_ver = file_exists(get_template_directory() . '/assets/css/routes/sign.
<span><?php echo $agreement['label_html']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
</label>
<?php endif; ?>
<?php if (class_exists('AKSRT_Settings') && AKSRT_Settings::registration_requires_email_verification()) : ?>
<?php if (class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::registration_requires_email_verification()) : ?>
<p class="sign-hint"><?php esc_html_e('注册后需要完成邮箱验证。', 'aksrt'); ?></p>
<?php endif; ?>
<?php if (function_exists('aksrt_render_captcha')) aksrt_render_captcha('register'); ?>
+3 -3
View File
@@ -3,7 +3,7 @@
* Template Name: AKSRT - Special Page
*
* 专题聚合页模板 — 用于内容专题、活动页、产品介绍页等。
* 读取 AKSRT_Settings 中的 page_display.special 配置,支持 per-page meta 覆盖。
* 读取 \AKSRT\Settings\Settings 中的 page_display.special 配置,支持 per-page meta 覆盖。
*
* @package AKSRT
*/
@@ -15,8 +15,8 @@ get_header();
$post_id = get_the_ID();
// 从门面 getter 读取专题页设置(validated & sanitized)
$special = class_exists('AKSRT_Settings')
? AKSRT_Settings::get_special_page_settings()
$special = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_special_page_settings()
: [];
$defaults = [
+6 -6
View File
@@ -16,7 +16,7 @@ if (!is_user_logged_in()) {
}
$user_id = get_current_user_id();
$can_submit = class_exists('AKSRT_Front_Submit') && AKSRT_Front_Submit::get_instance()->can_submit($user_id);
$can_submit = class_exists('\AKSRT\Core\FrontSubmit') && \AKSRT\Core\FrontSubmit::get_instance()->can_submit($user_id);
if (!$can_submit) {
wp_redirect(home_url('/'));
@@ -38,8 +38,8 @@ get_header();
// Submit settings
$submit_settings = [];
if (class_exists('AKSRT_Settings')) {
$all = AKSRT_Settings::get_all();
if (class_exists('\AKSRT\Settings\Settings')) {
$all = \AKSRT\Settings\Settings::get_all();
$submit_settings = [
'enabled' => !empty($all['front_submit_enabled']),
'review_mode' => $all['front_submit_review_mode'] ?? 'pending',
@@ -68,8 +68,8 @@ if ($edit_post && taxonomy_exists('topics')) {
// §3.4 custom_filter: load dimension definitions for submit form
$custom_dimensions = [];
if (!empty($submit_settings['custom_filter_s']) && class_exists('AKSRT_Settings')) {
$filter_all = AKSRT_Settings::get_post_filter_settings();
if (!empty($submit_settings['custom_filter_s']) && class_exists('\AKSRT\Settings\Settings')) {
$filter_all = \AKSRT\Settings\Settings::get_post_filter_settings();
$custom_dimensions = $filter_all['custom_filter'];
}
@@ -280,7 +280,7 @@ if (file_exists($front_submit_path)) {
(string) filemtime($front_submit_path),
true
);
$ai_available = class_exists('AKSRT_AI') && AKSRT_AI::get_instance()->is_available();
$ai_available = class_exists('\AKSRT\Ai\AI') && \AKSRT\Ai\AI::get_instance()->is_available();
wp_localize_script('aksrt-front-submit', 'aksrtSubmitData', [
'ajaxUrl' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('aksrt_submit_nonce'),
+4 -4
View File
@@ -14,14 +14,14 @@ $redirect_url = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['verify_email_resend'])) {
$result = AKSRT_Auth_Service::resend_email_verification($_POST);
$result = \AKSRT\Auth\Service::resend_email_verification($_POST);
if (!empty($result['success'])) {
$verify_success = $result['message'] ?? __('验证邮件已重新发送,请注意查收。', 'aksrt');
} else {
$verify_error = $result['error'] ?? __('验证邮件发送失败,请稍后重试。', 'aksrt');
}
} elseif (isset($_POST['verify_email_submit'])) {
$result = AKSRT_Auth_Service::verify_email_code_submission($_POST);
$result = \AKSRT\Auth\Service::verify_email_code_submission($_POST);
if (!empty($result['success'])) {
$verify_success = $result['message'] ?? __('邮箱验证成功,即将进入你的账号。', 'aksrt');
$redirect_url = $result['redirect'] ?? '';
@@ -31,7 +31,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
}
$verify_context = AKSRT_Auth_Service::get_email_verification_context($_GET);
$verify_context = \AKSRT\Auth\Service::get_email_verification_context($_GET);
if ($verify_error === '' && !empty($verify_context['error'])) {
$verify_error = $verify_context['error'];
}
@@ -128,7 +128,7 @@ get_header();
// method 缺失(历史账号 / meta 被外部清理)→ 回退到设置默认值
$resend_method = in_array($verify_method, ['link', 'code'], true)
? $verify_method
: (class_exists('AKSRT_Settings') ? AKSRT_Settings::registration_verification_method() : 'link');
: (class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::registration_verification_method() : 'link');
?>
<?php if ($verify_email !== '') : ?>
<p class="auth-card__subtitle"><?php echo esc_html(sprintf(__('当前待验证邮箱:%s', 'aksrt'), $verify_email)); ?></p>
+5 -5
View File
@@ -25,8 +25,8 @@ if (function_exists('aksrt_render_post')) {
$mode = $args['mode'];␍
} elseif (function_exists('aksrt_get_post_flow') && aksrt_get_post_flow(get_the_ID()) === 'cms') {␍
$mode = 'grid-cms';␍
} elseif (class_exists('AKSRT_Settings')) {␍
$archive_layout = AKSRT_Settings::get_archive_layout();␍
} elseif (class_exists('\AKSRT\Settings\Settings')) {␍
$archive_layout = \AKSRT\Settings\Settings::get_archive_layout();␍
$mode = in_array($archive_layout, ['card', 'list', 'grid-cms'], true) ? $archive_layout : 'card';␍
}␍
␍
@@ -49,7 +49,7 @@ if (function_exists('aksrt_render_post')) {
␍
$args = isset($args) && is_array($args) ? $args : [];␍
␍
$lazy_cfg = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_lazyload_config() : ['enabled' => false, 'placeholder_url' => ''];␍
$lazy_cfg = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_lazyload_config() : ['enabled' => false, 'placeholder_url' => ''];␍
$lazy_on = !empty($lazy_cfg['enabled']);␍
$placeholder_url = !empty($lazy_cfg['placeholder_url']) ? (string) $lazy_cfg['placeholder_url'] : (get_template_directory_uri() . '/assets/img/placeholder.svg');␍
␍
@@ -59,8 +59,8 @@ if (is_string($forced_layout) && in_array($forced_layout, ['card', 'list', 'maso
$layout = $forced_layout;␍
} elseif (function_exists('aksrt_get_post_flow') && aksrt_get_post_flow(get_the_ID()) === 'cms') {␍
$layout = 'grid-cms';␍
} elseif (class_exists('AKSRT_Settings')) {␍
$layout = AKSRT_Settings::get_archive_layout();␍
} elseif (class_exists('\AKSRT\Settings\Settings')) {␍
$layout = \AKSRT\Settings\Settings::get_archive_layout();␍
}␍
␍
$post_id = get_the_ID();␍
+2 -2
View File
@@ -3,7 +3,7 @@
* Document Chapter Navigation
*
* Shows previous/next chapter navigation at the bottom of a document page.
* Uses AKSRT_Docs_Presenter for chapter resolution.
* Uses \AKSRT\Core\DocsPresenter for chapter resolution.
*
* @package AKSRT
*/
@@ -12,7 +12,7 @@ defined('ABSPATH') || exit;
$current_id = get_the_ID();
$presenter = class_exists('AKSRT_Docs_Presenter') ? AKSRT_Docs_Presenter::get_instance() : null;
$presenter = class_exists('\AKSRT\Core\DocsPresenter') ? \AKSRT\Core\DocsPresenter::get_instance() : null;
if ($presenter) {
$nav = $presenter->get_chapter_nav($current_id);
+3 -3
View File
@@ -3,7 +3,7 @@
* Docs Mode: Sidebar Navigation
*
* 文档模式侧边栏:显示文档目录树,当前章节高亮。
* Uses AKSRT_Docs_Presenter for tree construction.
* Uses \AKSRT\Core\DocsPresenter for tree construction.
*
* @package AKSRT
*/
@@ -14,7 +14,7 @@ $current_id = get_the_ID();
$parent_id = wp_get_post_parent_id($current_id);
$root_id = $parent_id ?: $current_id;
$presenter = class_exists('AKSRT_Docs_Presenter') ? AKSRT_Docs_Presenter::get_instance() : null;
$presenter = class_exists('\AKSRT\Core\DocsPresenter') ? \AKSRT\Core\DocsPresenter::get_instance() : null;
if ($presenter) {
$doc_pages = $presenter->get_flat_tree($root_id, 3);
@@ -30,7 +30,7 @@ if ($presenter) {
$root_page = get_post($root_id);
// Quick search for docs
$doc_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_docs_mode_settings() : [];
$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'); ?>">
+2 -2
View File
@@ -11,7 +11,7 @@ $page_title = get_the_title() ?: __('下载中心', 'aksrt');
$page_desc = get_the_excerpt() ?: __('浏览和下载本站提供的各类资源。', 'aksrt');
$current_filter = isset($_GET['resource_type']) ? sanitize_key((string) $_GET['resource_type']) : '';
$resource_type_labels = function_exists('aksrt_get_pay_types') ? aksrt_get_pay_types() : [];
unset($resource_type_labels[AKSRT_Domain_Model::PAY_TYPE_READING]);
unset($resource_type_labels[\AKSRT\Core\DomainModel::PAY_TYPE_READING]);
$resource_count_query = new WP_Query([
'post_type' => 'post',
@@ -20,7 +20,7 @@ $resource_count_query = new WP_Query([
'fields' => 'ids',
'meta_query' => [
[
'key' => AKSRT_Domain_Model::RESOURCE_MARKER_KEY,
'key' => \AKSRT\Core\DomainModel::RESOURCE_MARKER_KEY,
'value' => '1',
],
],
@@ -2,7 +2,7 @@
/**
* Download Permission Card
*
* Shows download status and actions from AKSRT_Download_State
* Shows download status and actions from \AKSRT\Content\DownloadState
* (Content_Visibility + cashier unlock — not per-download credits).
*
* @package AKSRT
@@ -27,8 +27,8 @@ $state = [
'need_vip' => false,
];
if (class_exists('AKSRT_Download_State')) {
$state = array_merge($state, AKSRT_Download_State::get_instance()->resolve($post_id));
if (class_exists('\AKSRT\Content\DownloadState')) {
$state = array_merge($state, \AKSRT\Content\DownloadState::get_instance()->resolve($post_id));
} elseif (function_exists('aksrt_can_download')) {
$gate = aksrt_can_download($post_id);
if (is_wp_error($gate)) {
@@ -16,7 +16,7 @@
*/
defined('ABSPATH') || exit;
if (class_exists('AKSRT_Settings') && !AKSRT_Settings::homepage_module_banner_enabled()) {
if (class_exists('\AKSRT\Settings\Settings') && !\AKSRT\Settings\Settings::homepage_module_banner_enabled()) {
return;
}
@@ -24,7 +24,7 @@ $show_dates = !isset($cfg['show_dates']) || !empty($cfg['show_dates']);
if (empty($cat_ids)) return;
// 懒加载配置
$lazy_cfg = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_lazyload_config() : ['enabled' => false, 'placeholder_url' => ''];
$lazy_cfg = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_lazyload_config() : ['enabled' => false, 'placeholder_url' => ''];
$lazy_on = !empty($lazy_cfg['enabled']);
$placeholder = $lazy_cfg['placeholder_url'] ?: (get_template_directory_uri() . '/assets/img/placeholder.svg');
@@ -35,13 +35,13 @@ foreach ($cat_ids as $idx => $cat_id) {
if (!$term || is_wp_error($term)) continue;
// 封面图
$cover_url = class_exists('AKSRT_Settings')
? AKSRT_Settings::get_category_cover_url($cat_id)
$cover_url = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_category_cover_url($cat_id)
: $placeholder;
// 分类描述(优先 term meta 推荐描述,其次原生 description)
$desc = class_exists('AKSRT_Settings')
? AKSRT_Settings::get_category_recommend_desc($cat_id)
$desc = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_category_recommend_desc($cat_id)
: (string) $term->description;
// 5 篇最新文章
+1 -1
View File
@@ -18,7 +18,7 @@ if (!is_array($cfg)) {
$hero_banners = function_exists('aksrt_get_banners') ? aksrt_get_banners(8, 'hero') : [];
$settings = function_exists('aksrt_get_all_settings') ? aksrt_get_all_settings() : [];
$search_cfg = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_header_components_search_config() : ['show' => false, 'keywords' => [], 'categories' => [], 'type_options' => []];
$search_cfg = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_header_components_search_config() : ['show' => false, 'keywords' => [], 'categories' => [], 'type_options' => []];
$show_search = !empty($search_cfg['show']) || !empty($cfg['with_search']);
$show_cards = !empty($settings['header_components_cards_enabled']);
$icon_cards = isset($settings['header_components_icon_cards']) ? (array) $settings['header_components_icon_cards'] : [];
+9 -9
View File
@@ -12,8 +12,8 @@ if (is_user_logged_in()) {
}
$oauth_providers = [];
if (class_exists('AKSRT_OAuth')) {
$oauth_providers = AKSRT_OAuth::get_instance()->get_auth_providers_data();
if (class_exists('\AKSRT\Auth\OAuth')) {
$oauth_providers = \AKSRT\Auth\OAuth::get_instance()->get_auth_providers_data();
}
$registration_open = true;
@@ -24,15 +24,15 @@ $invite_field_hint = '';
$invite_prefill = '';
$show_qrcode_tab = false;
if (class_exists('AKSRT_Settings')) {
$registration_open = AKSRT_Settings::registration_enabled();
if (method_exists('AKSRT_Settings', 'close_signup') && AKSRT_Settings::close_signup()) {
if (class_exists('\AKSRT\Settings\Settings')) {
$registration_open = \AKSRT\Settings\Settings::registration_enabled();
if (method_exists('\AKSRT\Settings\Settings', 'close_signup') && \AKSRT\Settings\Settings::close_signup()) {
$registration_open = false;
}
$email_verification = AKSRT_Settings::registration_requires_email_verification();
$close_signin = AKSRT_Settings::close_signin();
$email_verification = \AKSRT\Settings\Settings::registration_requires_email_verification();
$close_signin = \AKSRT\Settings\Settings::close_signin();
$invite_cfg = AKSRT_Settings::get_invite_registration_config();
$invite_cfg = \AKSRT\Settings\Settings::get_invite_registration_config();
$invite_field_mode = (string) ($invite_cfg['register_field'] ?? 'hidden');
$invite_field_hint = $invite_field_mode === 'required'
? (string) ($invite_cfg['must_desc'] ?? '')
@@ -57,7 +57,7 @@ $reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_p
$agreement = function_exists('aksrt_get_auth_agreement_view')
? aksrt_get_auth_agreement_view()
: ['enabled' => true, 'required' => true, 'label_html' => esc_html__('我已阅读并同意用户协议', 'aksrt'), 'field_name' => 'agree_terms'];
$logo_url = class_exists('AKSRT_Settings') ? AKSRT_Settings::user_logo_url() : '';
$logo_url = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::user_logo_url() : '';
?>
<div class="aksrt-modal-auth" id="aksrt-modal-auth" aria-hidden="true" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e('登录', 'aksrt'); ?>">
+4 -4
View File
@@ -22,8 +22,8 @@ $args = is_array($args ?? null) ? $args : [];
// Resolve style: explicit args > global setting.
$ph_style = array_key_exists('style', $args) ? $args['style'] : null;
if ($ph_style === null) {
$ph_style = class_exists('AKSRT_Settings')
? (AKSRT_Settings::get_other_page_settings()['header_style'] ?? '1')
$ph_style = class_exists('\AKSRT\Settings\Settings')
? (\AKSRT\Settings\Settings::get_other_page_settings()['header_style'] ?? '1')
: '1';
}
if ($ph_style === 'not') {
@@ -42,8 +42,8 @@ $ph_extra = (string) ($args['extra'] ?? '');
// Cover image: explicit args > global setting > post thumbnail.
$ph_cover = (string) ($args['cover'] ?? '');
if ($ph_cover === '' && class_exists('AKSRT_Settings')) {
$other = AKSRT_Settings::get_other_page_settings();
if ($ph_cover === '' && class_exists('\AKSRT\Settings\Settings')) {
$other = \AKSRT\Settings\Settings::get_other_page_settings();
$ph_cover = (string) ($other['header_cover_img'] ?? '');
}
if ($ph_cover === '' && has_post_thumbnail()) {
+8 -8
View File
@@ -41,12 +41,12 @@ $gate_blocked = is_wp_error($gate);
$gate_code = $gate_blocked ? $gate->get_error_code() : '';
$gate_data = $gate_blocked ? (array) $gate->get_error_data() : [];
$paid_settings = class_exists('AKSRT_Settings')
? AKSRT_Settings::get_paid_content_settings()
$paid_settings = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_paid_content_settings()
: ['download_credit' => true, 'download_captcha' => false];
$access = class_exists('AKSRT_Content_Visibility')
? AKSRT_Content_Visibility::get_post_access_state($post_id)
$access = class_exists('\AKSRT\Content\Visibility')
? \AKSRT\Content\Visibility::get_post_access_state($post_id)
: [];
$has_paid_access = !empty($access['has_paid_access']);
$priced = function_exists('aksrt_get_user_pay_price') ? aksrt_get_user_pay_price($post_id) : null;
@@ -60,7 +60,7 @@ $captcha_active = !empty($paid_settings['download_captcha']) || !empty($meta['re
if ($captcha_active && function_exists('aksrt_is_captcha_enabled_for') && !aksrt_is_captcha_enabled_for('download')) {
$captcha_active = false;
}
$balance = (int) ($gate_data['balance'] ?? (is_user_logged_in() && class_exists('AKSRT_Credits') ? AKSRT_Credits::balance(get_current_user_id()) : 0));
$balance = (int) ($gate_data['balance'] ?? (is_user_logged_in() && class_exists('\AKSRT\Credits\Credits') ? \AKSRT\Credits\Credits::balance(get_current_user_id()) : 0));
$login_url = (string) ($gate_data['login_url'] ?? wp_login_url(get_permalink($post_id)));
$vip_url = function_exists('aksrt_get_user_center_tab_url')
? aksrt_get_user_center_tab_url('credits')
@@ -134,10 +134,10 @@ $show_sales = !isset($meta['show_sales']) || !empty($meta['show_sales']);
$pay_type_badge = function_exists('aksrt_get_pay_type_badge') ? aksrt_get_pay_type_badge($pay_type) : '';
// 货币名称
$currency = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_currency_name() : __('积分', 'aksrt');
$currency = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_currency_name() : __('积分', 'aksrt');
$cash_symbol = '¥';
if (class_exists('AKSRT_Settings')) {
$paid_display = AKSRT_Settings::get_paid_content_settings();
if (class_exists('\AKSRT\Settings\Settings')) {
$paid_display = \AKSRT\Settings\Settings::get_paid_content_settings();
$cash_symbol = (string) ($paid_display['display']['currency_symbol'] ?? '¥');
}
$format_vip = static function (float $amount) use ($pay_modo, $currency, $cash_symbol): string {
+3 -3
View File
@@ -13,8 +13,8 @@
defined('ABSPATH') || exit;
if (class_exists('AKSRT_Settings')) {
$header_nav = AKSRT_Settings::get_header_nav_settings();
if (class_exists('\AKSRT\Settings\Settings')) {
$header_nav = \AKSRT\Settings\Settings::get_header_nav_settings();
if (empty($header_nav['search_enabled'])) {
return;
}
@@ -39,7 +39,7 @@ $search_placeholder = function_exists('aksrt_get_search_placeholder') ? aks
$search_hot_keywords = function_exists('aksrt_get_search_hot_keywords') ? aksrt_get_search_hot_keywords() : [];
$history_enabled = function_exists('aksrt_search_history_enabled') ? aksrt_search_history_enabled() : true;
$suggestions_enabled = function_exists('aksrt_search_suggestions_enabled') ? aksrt_search_suggestions_enabled() : false;
$popular_title = class_exists('AKSRT_Settings') ? AKSRT_Settings::search_popular_title() : __('热门搜索', 'aksrt');
$popular_title = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::search_popular_title() : __('热门搜索', 'aksrt');
?>
<div
id="tabbar-search-overlay"
+1 -1
View File
@@ -3,7 +3,7 @@
* Shared product card (archive / related / storefront).
*
* Expected args:
* - product: array from AKSRT_Shop::build_product_card_view()
* - product: array from \AKSRT\Shop\Shop::build_product_card_view()
* - show_sales: bool (optional)
* - sales_cfg: array (optional; used when show_sales not provided)
*
+3 -3
View File
@@ -43,7 +43,7 @@ $abs_fmt = $use_modified
$time_text = human_time_diff($rel_base, $now) . $rel_label;
$classes = trim('article-avatar ' . $extra_class);
$aksrt_pm_on = class_exists('AKSRT_Settings') && !empty(AKSRT_Settings::private_message_settings()['enabled']);
$aksrt_pm_on = class_exists('\AKSRT\Settings\Settings') && !empty(\AKSRT\Settings\Settings::private_message_settings()['enabled']);
$aksrt_msg_url = function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : '';
$login_url = function_exists('aksrt_get_login_url') ? aksrt_get_login_url() : wp_login_url(get_permalink());
$is_self = is_user_logged_in() && get_current_user_id() === $author_id;
@@ -115,8 +115,8 @@ $is_self = is_user_logged_in() && get_current_user_id() === $author_id;
</a>
<?php else : ?>
<?php
$aksrt_post_settings = class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_post_page_settings')
? AKSRT_Settings::get_post_page_settings()
$aksrt_post_settings = class_exists('\AKSRT\Settings\Settings') && method_exists('\AKSRT\Settings\Settings', 'get_post_page_settings')
? \AKSRT\Settings\Settings::get_post_page_settings()
: [];
$rewards_on = !empty($aksrt_post_settings['rewards_enabled'])
|| !empty($aksrt_post_settings['post_rewards_enabled'])
+1 -1
View File
@@ -18,7 +18,7 @@ extract($args, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_ext
$follow_sub = isset($_GET['follow_sub']) ? sanitize_key(wp_unslash($_GET['follow_sub'])) : 'following';
$follow_sub = in_array($follow_sub, ['following', 'followers'], true) ? $follow_sub : 'following';
$follow_instance = class_exists('AKSRT_Follow') ? AKSRT_Follow::get_instance() : null;
$follow_instance = class_exists('\AKSRT\User\Follow') ? \AKSRT\User\Follow::get_instance() : null;
$following_count = $follow_instance ? (int) $follow_instance->get_following_count((int) $user_id) : 0;
$follower_count = $follow_instance ? (int) $follow_instance->get_follower_count((int) $user_id) : 0;
$list = ['items' => [], 'total' => 0, 'total_pages' => 1];
+2 -2
View File
@@ -136,8 +136,8 @@ extract($args, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_ext
<?php
$product_page = max(1, isset($_GET['product_page']) ? (int) $_GET['product_page'] : 1);
$product_view = ['items' => [], 'total' => 0, 'max_pages' => 0];
if (class_exists('AKSRT_Shop')) {
$product_view = AKSRT_Shop::get_instance()->get_store_products((int) $user_id, $product_page, (int) $per_page);
if (class_exists('\AKSRT\Shop\Shop')) {
$product_view = \AKSRT\Shop\Shop::get_instance()->get_store_products((int) $user_id, $product_page, (int) $per_page);
}
$product_items = is_array($product_view['items'] ?? null) ? $product_view['items'] : [];
$product_max_pages = (int) ($product_view['max_pages'] ?? 0);
+3 -3
View File
@@ -47,11 +47,11 @@ $bg_url = $dashboard['background_url'] ?? '';
$is_own = !empty($dashboard['is_own_profile']);
$follower_count = (int) ($tab_counts['follow'] ?? 0);
if ($follower_count <= 0 && class_exists('AKSRT_Follow')) {
$follower_count = (int) AKSRT_Follow::get_instance()->get_follower_count($user_id);
if ($follower_count <= 0 && class_exists('\AKSRT\User\Follow')) {
$follower_count = (int) \AKSRT\User\Follow::get_instance()->get_follower_count($user_id);
}
$pm_enabled = class_exists('AKSRT_Settings') && !empty(AKSRT_Settings::private_message_settings()['enabled']);
$pm_enabled = class_exists('\AKSRT\Settings\Settings') && !empty(\AKSRT\Settings\Settings::private_message_settings()['enabled']);
$messages_url = function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : '';
$pm_url = ($pm_enabled && $messages_url !== '')
? add_query_arg('msg_type', 'conversation', $messages_url)
+1 -1
View File
@@ -12,7 +12,7 @@ get_header();
$term = get_queried_object();
$paged = max(1, (int) get_query_var('paged'));
$orderby = isset($_GET['shop_orderby']) ? sanitize_key(wp_unslash((string) $_GET['shop_orderby'])) : '';
$shop = class_exists('AKSRT_Shop') ? AKSRT_Shop::get_instance() : null;
$shop = class_exists('\AKSRT\Shop\Shop') ? \AKSRT\Shop\Shop::get_instance() : null;
$view = $shop ? $shop->get_product_archive_view([
'taxonomy' => 'aksrt_product_cat',
'term_id' => $term ? (int) $term->term_id : 0,
+1 -1
View File
@@ -12,7 +12,7 @@ get_header();
$term = get_queried_object();
$paged = max(1, (int) get_query_var('paged'));
$orderby = isset($_GET['shop_orderby']) ? sanitize_key(wp_unslash((string) $_GET['shop_orderby'])) : '';
$shop = class_exists('AKSRT_Shop') ? AKSRT_Shop::get_instance() : null;
$shop = class_exists('\AKSRT\Shop\Shop') ? \AKSRT\Shop\Shop::get_instance() : null;
$view = $shop ? $shop->get_product_archive_view([
'taxonomy' => 'aksrt_product_tag',
'term_id' => $term ? (int) $term->term_id : 0,
+2 -2
View File
@@ -2,8 +2,8 @@
/**
* Shortcode template: [aksrt_archive]
*
* 紧凑版文章归档(按年月分组)。供 AKSRT_Shortcodes::render_archive() 通过
* AKSRT_Templates::render_archive_shortcode() 以输出缓冲方式 include。
* 紧凑版文章归档(按年月分组)。供 \AKSRT\Core\Shortcodes::render_archive() 通过
* \AKSRT\Core\Templates::render_archive_shortcode() 以输出缓冲方式 include。
*
* 可用变量:$attrs(短代码属性)、$content。
*
+3 -3
View File
@@ -2,8 +2,8 @@
/**
* Shortcode template: [aksrt_profile]
*
* 当前登录用户的资料卡。供 AKSRT_Shortcodes::render_profile() 通过
* AKSRT_Templates::render_profile_shortcode() 以输出缓冲方式 include。
* 当前登录用户的资料卡。供 \AKSRT\Core\Shortcodes::render_profile() 通过
* \AKSRT\Core\Templates::render_profile_shortcode() 以输出缓冲方式 include。
*
* 可用变量:$attrs(短代码属性,支持 user="<ID 或 login>" 指定用户)、$content。
*
@@ -37,7 +37,7 @@ $home_url = function_exists('aksrt_get_user_home_url') ? aksrt_get_user_home_ur
$credits = function_exists('aksrt_user_credits') ? (int) aksrt_user_credits($user_id) : 0;
$post_count = (int) count_user_posts($user_id, 'post', true);
$bio = (string) get_the_author_meta('description', $user_id);
$show_credits = class_exists('AKSRT_Settings') ? AKSRT_Settings::credits_enabled() : true;
$show_credits = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::credits_enabled() : true;
?>
<div class="aksrt-profile-card aksrt-profile-card--shortcode">
<a class="aksrt-profile-card__avatar" href="<?php echo esc_url($home_url); ?>">