From e01490a0f85668f69536707c69cc186632dabefd Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Thu, 22 Jan 2026 13:41:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=82=AE=E4=BB=B6=E7=A4=BE=E4=BA=A4?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E6=94=AF=E6=8C=81=20Bilibili=20=E5=92=8C?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在邮件设置中添加 Bilibili 社交链接输入框 - 实现社交链接自动补全功能(支持只填写用户名/UID) - 添加 argon_normalize_social_url() 函数处理链接标准化 - 更新邮件模板基础文件支持 Bilibili 显示 - 支持的平台:Twitter、GitHub、微博、Bilibili、Facebook、Instagram --- email-templates/base.php | 5 +---- functions.php | 47 ++++++++++++++++++++++++++++++++++++++++ settings.php | 25 ++++++++++++--------- 3 files changed, 63 insertions(+), 14 deletions(-) diff --git a/email-templates/base.php b/email-templates/base.php index d915ebd..4dd46f1 100644 --- a/email-templates/base.php +++ b/email-templates/base.php @@ -65,8 +65,6 @@ function argon_get_email_types() {
审核信息
识别结果:疑似不当内容
识别理由:{{ai_spam_reason}}
-AI 模型:{{ai_model}}
-服务提供商:{{ai_provider}}
识别码:{{ai_detection_code}}
如果您认为这是误判,请通过识别码查询详细信息或联系网站管理员申诉。
@@ -80,8 +78,6 @@ function argon_get_email_types() { 'commenter_name' => __('评论者名称', 'argon'), 'comment_content' => __('评论内容', 'argon'), 'ai_spam_reason' => __('AI 识别理由', 'argon'), - 'ai_model' => __('AI 模型', 'argon'), - 'ai_provider' => __('AI 服务提供商', 'argon'), 'ai_detection_code' => __('AI 识别码', 'argon'), 'query_url' => __('查询链接', 'argon'), 'unsubscribe_url' => __('退订链接', 'argon'), @@ -276,6 +272,7 @@ function argon_get_email_base_template($include_unsubscribe = false) { 'twitter' => 'Twitter', 'github' => 'GitHub', 'weibo' => '微博', + 'bilibili' => 'Bilibili', 'facebook' => 'Facebook', 'instagram' => 'Instagram' ); diff --git a/functions.php b/functions.php index 34b8992..aea7d75 100644 --- a/functions.php +++ b/functions.php @@ -8090,3 +8090,50 @@ function argon_spam_detection_trash_comment() { } } add_action('wp_ajax_argon_spam_detection_trash_comment', 'argon_spam_detection_trash_comment'); + +// ========================================================================== +// 邮件社交链接自动补全 +// ========================================================================== + +/** + * 标准化社交链接 URL + * 支持输入完整 URL 或仅用户名/UID,自动补全为完整链接 + * + * @param string $platform 平台名称 (twitter, github, weibo, bilibili) + * @param string $input 用户输入(完整 URL 或用户名/UID) + * @return string 标准化后的完整 URL,如果输入为空则返回空字符串 + */ +function argon_normalize_social_url($platform, $input) { + $input = trim($input); + + // 如果输入为空,直接返回 + if (empty($input)) { + return ''; + } + + // 如果已经是完整 URL,直接返回 + if (preg_match('/^https?:\/\//i', $input)) { + return esc_url($input); + } + + // 根据平台补全 URL + $base_urls = [ + 'twitter' => 'https://twitter.com/', + 'github' => 'https://github.com/', + 'weibo' => 'https://weibo.com/', + 'bilibili' => 'https://space.bilibili.com/', + 'facebook' => 'https://facebook.com/', + 'instagram' => 'https://instagram.com/' + ]; + + if (!isset($base_urls[$platform])) { + // 未知平台,返回原始输入 + return esc_url($input); + } + + // 移除可能的 @ 符号前缀 + $username = ltrim($input, '@'); + + // 构建完整 URL + return esc_url($base_urls[$platform] . $username); +} diff --git a/settings.php b/settings.php index 1892168..a16867f 100644 --- a/settings.php +++ b/settings.php @@ -4621,17 +4621,21 @@ window.pjaxLoaded = function(){