The theme was renamed Zibll/子比 → AKSRT → Jio, but upstream branding survived the sweeps in CSS classes, the SVG sprite prefix, a persisted widget field ID, JS events, admin Vue class names, test infrastructure and docblocks. Renames: - zib-widget / zib-widget-wrap / zib-slider → jio-widget-box / jio-widget-box-wrap / jio-slider-box (jio-widget is taken by the modern widget shell, jio-box-* by the card primitives) - zib-partners-scroll + zps-* → jio-partners-scroll + jps-* - zib-combo-info-card + zci-* → jio-combo-info-card + jci-* - zibsvg- → jiosvg-, including the exported picker helpers and the fa-zibsvg- family-prefix guard - zibpay_type → pay_type; the dual-read fallback in PostQuery collapses to a single key - [zibajax="submit"] dropped (no PHP emitter); zib_ajax.success → jio_ajax.success - aks-* admin Vue classes → jio-* - zib_palette() → palette() User-facing vendor traces are gone: the floating "more" button default no longer ships a zibll.com link or 子比主题 marketing copy, the notice widget ships no preset promo entries, and the four 官网教程 links are removed from the post-list admin schema. Test infrastructure renamed to neutral names (docker-compose.reference.yml, Caddyfile, article-baseline.json, modern-widgets-contract.test.cjs) with their DB/volume/env/slug identifiers following. Kept intentionally, documented in tests/fixtures/README.md: the golden fixture reference fingerprint (a SHA-256 record of an external directory, read by validate-widget-golden / generate-widget-golden-fixture / audit-widget-system), the doesNotMatch guards that prove the old tokens are gone, and the reference theme's own meta key in the visual fixtures. No backward-compat or data migration: saved widget configs holding old icon keys or the old field ID silently lose them, per the project's rewrite-over-compatibility rule. Verified: 132/132 node contract tests, php tests/widget-system/run.php (146 assertions), audit-admin-contracts, audit-psr4-paths and validate-widget-golden all green; tracked bundles regenerated and in sync. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
97 lines
4.1 KiB
PHP
97 lines
4.1 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;
|
|
}
|
|
// The provider type (clogin_ prefix stripped) drives the
|
|
// .social-login-item brand colour.
|
|
$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>
|