'GitHub', 'gitee' => 'Gitee', 'qq' => 'QQ', 'google' => 'Google', 'weibo' => 'Weibo', 'weixin' => 'WeChat', 'baidu' => 'Baidu', 'alipay' => 'Alipay', ]; $icons = [ 'github' => aksrt_brand_icon('github'), 'gitee' => aksrt_brand_icon('gitee'), 'qq' => aksrt_brand_icon('qq'), 'google' => aksrt_brand_icon('google'), 'weibo' => aksrt_brand_icon('weibo'), 'weixin' => aksrt_brand_icon('weixin'), 'baidu' => aksrt_brand_icon('baidu'), 'alipay' => aksrt_brand_icon('alipay'), ]; $bindings = []; foreach ($bound_list as $binding) { if (in_array($binding, ['github', 'gitee', 'qq', 'google', 'weibo', 'weixin', 'baidu', 'alipay'], true) && !empty($providers[$binding]['enabled'])) { $bindings[] = [ 'key' => $binding, 'name' => $platform_names[$binding] ?? ucfirst($binding), 'icon' => $icons[$binding] ?? '', ]; } } $available = []; foreach (['github', 'gitee', 'qq', 'google', 'weibo', 'weixin', 'baidu', 'alipay'] as $key) { if (in_array($key, $bound_list, true)) continue; if (empty($providers[$key]['enabled']) || empty($providers[$key]['client_id'])) continue; $url = $this->get_auth_url($key, 'bind'); if (empty($url)) continue; $available[] = [ 'key' => $key, 'name' => $platform_names[$key], 'icon' => $icons[$key] ?? '', 'url' => esc_url($url), ]; } return [ 'bindings' => $bindings, 'available' => $available, ]; } public function profile_bindings(WP_User $user): void { $bindings = get_user_meta($user->ID, 'aksrt_oauth_bindings', true) ?: []; if (empty($bindings)) return; $unbind_nonce = wp_create_nonce('aksrt_oauth_unbind'); ?>
| ✓ |