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:
1 parent
8f349b40fb
commit
aaf458af1c
404 files changed
+13602
-7705
No files matched your search
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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] ?? [];
|
||||
?>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
?>
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,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 = [
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user