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(){
- +
- +
- +
-

+
+ + +
+

@@ -4669,7 +4673,7 @@ window.pjaxLoaded = function(){
@@ -4678,7 +4682,7 @@ window.pjaxLoaded = function(){ + placeholder="">
@@ -6379,11 +6383,12 @@ function argon_update_themeoptions(){ argon_update_option('argon_email_blog_name'); argon_update_option('argon_email_footer_text'); - // 保存社交链接为数组 + // 保存社交链接为数组(自动补全完整 URL) $social_links = array( - 'twitter' => isset($_POST['argon_email_social_twitter']) ? sanitize_url($_POST['argon_email_social_twitter']) : '', - 'github' => isset($_POST['argon_email_social_github']) ? sanitize_url($_POST['argon_email_social_github']) : '', - 'weibo' => isset($_POST['argon_email_social_weibo']) ? sanitize_url($_POST['argon_email_social_weibo']) : '' + 'twitter' => argon_normalize_social_url('twitter', isset($_POST['argon_email_social_twitter']) ? sanitize_text_field($_POST['argon_email_social_twitter']) : ''), + 'github' => argon_normalize_social_url('github', isset($_POST['argon_email_social_github']) ? sanitize_text_field($_POST['argon_email_social_github']) : ''), + 'weibo' => argon_normalize_social_url('weibo', isset($_POST['argon_email_social_weibo']) ? sanitize_text_field($_POST['argon_email_social_weibo']) : ''), + 'bilibili' => argon_normalize_social_url('bilibili', isset($_POST['argon_email_social_bilibili']) ? sanitize_text_field($_POST['argon_email_social_bilibili']) : '') ); update_option('argon_email_social_links', $social_links);