From 82607ffc8b4ec37c7b90d026f03e67f629bc5b0c Mon Sep 17 00:00:00 2001 From: nanhaoluo <3075912108@qq.com> Date: Thu, 15 Jan 2026 15:22:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=86=20TODO=20=E6=8F=90=E9=86=92?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E7=BA=B3=E5=85=A5=E6=A8=A1=E6=9D=BF=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 todo_urge 邮件类型 - 支持自定义 TODO 提醒邮件的主题和内容 - 可用占位符:todo_content、todo_id、urge_time 等 - 修改 argon_ajax_urge_todo 函数使用新的邮件模板系统 --- email-templates/base.php | 26 ++++++++++++++++++++++++++ functions.php | 24 +++++++----------------- settings.php | 2 +- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/email-templates/base.php b/email-templates/base.php index 4d550e9..9cb8fe8 100644 --- a/email-templates/base.php +++ b/email-templates/base.php @@ -97,6 +97,25 @@ function argon_get_email_types() { 'theme_color' => __('主题色', 'argon'), ), ), + 'todo_urge' => array( + 'name' => __('TODO 提醒', 'argon'), + 'description' => __('访客催促作者完成 TODO 时发送的邮件', 'argon'), + 'default_subject' => '[{{blog_name}}] 有人催你完成 TODO', + 'default_content' => '
📝 {{todo_content}}
+快去完成吧!
+前往博客', + 'placeholders' => array( + 'blog_name' => __('博客名称', 'argon'), + 'blog_url' => __('博客链接', 'argon'), + 'todo_content' => __('TODO 内容', 'argon'), + 'todo_id' => __('TODO ID', 'argon'), + 'urge_time' => __('提醒时间', 'argon'), + 'theme_color' => __('主题色', 'argon'), + ), + ), 'general' => array( 'name' => __('通用邮件', 'argon'), 'description' => __('其他类型的通用邮件模板', 'argon'), @@ -445,6 +464,13 @@ function argon_get_sample_email_vars($type) { 'reset_url' => home_url('/wp-login.php?action=rp&key=sample_key'), )); + case 'todo_urge': + return array_merge($common, array( + 'todo_content' => '这是一个示例 TODO 任务内容', + 'todo_id' => 'sample_todo_id', + 'urge_time' => date_i18n(get_option('date_format') . ' ' . get_option('time_format')), + )); + case 'general': default: return array_merge($common, array( diff --git a/functions.php b/functions.php index 5bbebdb..49f2fed 100644 --- a/functions.php +++ b/functions.php @@ -3754,25 +3754,15 @@ function argon_ajax_urge_todo() { wp_send_json_error(__('TODO 不存在', 'argon')); } - // 使用主题内置的邮件发送接口 + // 使用邮件模板系统发送 $admin_email = get_option('admin_email'); - $site_name = get_bloginfo('name'); - $site_url = get_bloginfo('url'); + $vars = array( + 'todo_content' => $todo_content, + 'todo_id' => $id, + 'urge_time' => date_i18n(get_option('date_format') . ' ' . get_option('time_format')), + ); - $subject = '[' . $site_name . '] ' . __('有人催你完成 TODO', 'argon'); - $html = ' -📝 ' . esc_html($todo_content) . '
-' . __('快去完成吧!', 'argon') . '
-' . __('来自', 'argon') . ' ' . $site_name . '
-