Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
97 lines
4.2 KiB
PHP
97 lines
4.2 KiB
PHP
<?php
|
|
/**
|
|
* User center settings: OAuth binding list.
|
|
*
|
|
* Expects extracted $context vars.
|
|
*
|
|
* @package Jio
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$oauth = class_exists('\Jio\Auth\OAuth') ? \Jio\Auth\OAuth::get_instance() : null;
|
|
$oauth_data = $oauth ? $oauth->get_frontend_bindings_data($user_id) : ['bindings' => [], 'available' => []];
|
|
$binding_name_map = [
|
|
'github' => 'GitHub',
|
|
'gitee' => 'Gitee',
|
|
'qq' => 'QQ',
|
|
'google' => 'Google',
|
|
'weibo' => '微博',
|
|
'weixin' => '微信',
|
|
'weixingzh' => '微信公众号',
|
|
];
|
|
$binding_rows = [];
|
|
foreach ((array) ($oauth_data['bindings'] ?? []) as $binding) {
|
|
$key = sanitize_key((string) ($binding['provider'] ?? $binding['key'] ?? $binding['name'] ?? ''));
|
|
if (!$key) {
|
|
continue;
|
|
}
|
|
// Reference parity: the provider type (clogin_ prefix stripped) drives the
|
|
// .social-login-item brand colour, matching zibll's binding list.
|
|
$icon_type = str_starts_with($key, 'clogin_') ? substr($key, 7) : $key;
|
|
$binding_rows[$key] = [
|
|
'key' => $key,
|
|
'name' => (string) ($binding['label'] ?? $binding_name_map[$key] ?? $binding['name'] ?? ucfirst($key)),
|
|
'icon' => $binding['icon'] ?? '',
|
|
'icon_type' => $icon_type,
|
|
'is_bound' => true,
|
|
'url' => '',
|
|
];
|
|
}
|
|
foreach ((array) ($oauth_data['available'] ?? []) as $binding) {
|
|
$key = sanitize_key((string) ($binding['provider'] ?? $binding['key'] ?? $binding['name'] ?? ''));
|
|
if (!$key) {
|
|
continue;
|
|
}
|
|
$icon_type = str_starts_with($key, 'clogin_') ? substr($key, 7) : $key;
|
|
$binding_rows[$key] = [
|
|
'key' => $key,
|
|
'name' => (string) ($binding['label'] ?? $binding_name_map[$key] ?? $binding['name'] ?? ucfirst($key)),
|
|
'icon' => $binding['icon'] ?? '',
|
|
'icon_type' => $icon_type,
|
|
'is_bound' => false,
|
|
'url' => $binding['start_url'] ?? $binding['url'] ?? '',
|
|
];
|
|
}
|
|
?>
|
|
<div class="jio-account-settings__section jio-account-settings__section--social">
|
|
<div class="jio-account-settings__heading">
|
|
<div>
|
|
<h3 class="title-h-left"><b><?php esc_html_e('绑定社交账号', 'jio'); ?></b></h3>
|
|
<p><?php esc_html_e('绑定社交账号,您可更安全、更快速的登录本站', 'jio'); ?></p>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (!empty($binding_rows)) : ?>
|
|
<?php if (function_exists('jio_render_captcha')) : ?>
|
|
<div class="binding-captcha" data-jio-oauth-bind-captcha><?php jio_render_captcha('bind'); ?></div>
|
|
<?php endif; ?>
|
|
<div class="jio-account-list jio-account-list--social">
|
|
<?php foreach ($binding_rows as $binding) : ?>
|
|
<?php if (!empty($binding['is_bound'])) : ?>
|
|
<div class="jio-account-row binding-item">
|
|
<span class="social-login-item circular <?php echo esc_attr($binding['icon_type']); ?>"><?php echo $binding['icon']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
|
|
<span class="jio-account-row__social-name"><?php echo esc_html($binding['name']); ?></span>
|
|
<span class="binding-status">
|
|
<i class="fa fas fa-check-circle badge__icon" aria-hidden="true"></i>
|
|
<?php esc_html_e('已绑定', 'jio'); ?>
|
|
</span>
|
|
<button type="button" class="but hollow c-yellow jio-account-row__action binding-unbind-btn" data-provider="<?php echo esc_attr($binding['key']); ?>">
|
|
<?php esc_html_e('解绑', 'jio'); ?>
|
|
</button>
|
|
</div>
|
|
<?php else : ?>
|
|
<a href="<?php echo esc_url($binding['url']); ?>" class="jio-account-row binding-item binding-item--linkable" target="_self" data-provider="<?php echo esc_attr($binding['key']); ?>" data-bind-start-url="<?php echo esc_url($binding['url']); ?>">
|
|
<span class="social-login-item circular <?php echo esc_attr($binding['icon_type']); ?>"><?php echo $binding['icon']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
|
|
<span class="jio-account-row__social-name"><?php echo esc_html($binding['name']); ?></span>
|
|
<span class="binding-status binding-status--idle"><?php esc_html_e('未绑定', 'jio'); ?></span>
|
|
<span class="but hollow c-blue jio-account-row__action"><?php esc_html_e('绑定', 'jio'); ?></span>
|
|
</a>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php else : ?>
|
|
<p class="settings-empty"><?php esc_html_e('暂无可用的第三方登录服务', 'jio'); ?></p>
|
|
<?php endif; ?>
|
|
</div>
|