refactor: 清理孤立代码
- 删除未使用的邮件模板类型(user_register, password_reset, general) - 删除 style.css 中未使用的 .shortcode-todo 样式(约30行) - 保留 todo_urge 邮件类型(有实际使用) - 减少约 120 行冗余代码
This commit is contained in:
@@ -113,44 +113,6 @@ function argon_get_email_types() {
|
|||||||
'theme_color' => __('主题色', 'argon'),
|
'theme_color' => __('主题色', 'argon'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'user_register' => array(
|
|
||||||
'name' => __('用户注册', 'argon'),
|
|
||||||
'description' => __('新用户注册成功后发送的欢迎邮件', 'argon'),
|
|
||||||
'default_subject' => '[{{blog_name}}] 注册成功',
|
|
||||||
'default_content' => '<h2 style="margin: 0 0 20px 0; font-size: 18px; font-weight: 600; color: {{theme_color}};">欢迎加入 {{blog_name}}</h2>
|
|
||||||
<p style="margin: 0 0 16px 0; color: #525f7f; line-height: 1.6;"><strong>{{user_name}}</strong>,您好:</p>
|
|
||||||
<p style="margin: 0 0 20px 0; color: #525f7f; line-height: 1.6;">您的账户已创建成功,现在可以登录使用了。</p>
|
|
||||||
<p style="margin: 0;">
|
|
||||||
<a href="{{login_url}}" style="display: inline-block; background: {{theme_color}}; color: #ffffff; padding: 10px 20px; border-radius: 4px; text-decoration: none; font-size: 14px;">立即登录</a>
|
|
||||||
</p>',
|
|
||||||
'placeholders' => array(
|
|
||||||
'blog_name' => __('博客名称', 'argon'),
|
|
||||||
'user_name' => __('用户名', 'argon'),
|
|
||||||
'user_email' => __('用户邮箱', 'argon'),
|
|
||||||
'login_url' => __('登录链接', 'argon'),
|
|
||||||
'register_date' => __('注册时间', 'argon'),
|
|
||||||
'theme_color' => __('主题色', 'argon'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'password_reset' => array(
|
|
||||||
'name' => __('密码重置', 'argon'),
|
|
||||||
'description' => __('用户请求重置密码时发送的邮件', 'argon'),
|
|
||||||
'default_subject' => '[{{blog_name}}] 密码重置请求',
|
|
||||||
'default_content' => '<h2 style="margin: 0 0 20px 0; font-size: 18px; font-weight: 600; color: {{theme_color}};">密码重置请求</h2>
|
|
||||||
<p style="margin: 0 0 16px 0; color: #525f7f; line-height: 1.6;"><strong>{{user_name}}</strong>,您好:</p>
|
|
||||||
<p style="margin: 0 0 20px 0; color: #525f7f; line-height: 1.6;">我们收到了您的密码重置请求,请点击下方按钮重置密码。如果这不是您本人的操作,请忽略此邮件。</p>
|
|
||||||
<p style="margin: 0 0 20px 0;">
|
|
||||||
<a href="{{reset_url}}" style="display: inline-block; background: {{theme_color}}; color: #ffffff; padding: 10px 20px; border-radius: 4px; text-decoration: none; font-size: 14px;">重置密码</a>
|
|
||||||
</p>
|
|
||||||
<p style="margin: 0; color: #8898aa; font-size: 12px;">此链接将在 24 小时后失效。</p>',
|
|
||||||
'placeholders' => array(
|
|
||||||
'blog_name' => __('博客名称', 'argon'),
|
|
||||||
'user_name' => __('用户名', 'argon'),
|
|
||||||
'user_email' => __('用户邮箱', 'argon'),
|
|
||||||
'reset_url' => __('重置链接', 'argon'),
|
|
||||||
'theme_color' => __('主题色', 'argon'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'todo_urge' => array(
|
'todo_urge' => array(
|
||||||
'name' => __('TODO 提醒', 'argon'),
|
'name' => __('TODO 提醒', 'argon'),
|
||||||
'description' => __('访客催促作者完成 TODO 时发送的邮件', 'argon'),
|
'description' => __('访客催促作者完成 TODO 时发送的邮件', 'argon'),
|
||||||
@@ -172,20 +134,6 @@ function argon_get_email_types() {
|
|||||||
'theme_color' => __('主题色', 'argon'),
|
'theme_color' => __('主题色', 'argon'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'general' => array(
|
|
||||||
'name' => __('通用邮件', 'argon'),
|
|
||||||
'description' => __('其他类型的通用邮件模板', 'argon'),
|
|
||||||
'default_subject' => '[{{blog_name}}] {{subject}}',
|
|
||||||
'default_content' => '<h2 style="margin: 0 0 20px 0; font-size: 18px; font-weight: 600; color: {{theme_color}};">{{title}}</h2>
|
|
||||||
<div style="margin: 0; color: #525f7f; line-height: 1.6;">{{content}}</div>',
|
|
||||||
'placeholders' => array(
|
|
||||||
'blog_name' => __('博客名称', 'argon'),
|
|
||||||
'subject' => __('邮件主题', 'argon'),
|
|
||||||
'title' => __('内容标题', 'argon'),
|
|
||||||
'content' => __('邮件内容', 'argon'),
|
|
||||||
'theme_color' => __('主题色', 'argon'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// 允许通过 filter 扩展邮件类型
|
// 允许通过 filter 扩展邮件类型
|
||||||
@@ -539,21 +487,6 @@ function argon_get_sample_email_vars($type) {
|
|||||||
'reply_date' => date_i18n(get_option('date_format') . ' ' . get_option('time_format')),
|
'reply_date' => date_i18n(get_option('date_format') . ' ' . get_option('time_format')),
|
||||||
));
|
));
|
||||||
|
|
||||||
case 'user_register':
|
|
||||||
return array_merge($common, array(
|
|
||||||
'user_name' => '新用户',
|
|
||||||
'user_email' => 'newuser@example.com',
|
|
||||||
'login_url' => wp_login_url(),
|
|
||||||
'register_date' => date_i18n(get_option('date_format') . ' ' . get_option('time_format')),
|
|
||||||
));
|
|
||||||
|
|
||||||
case 'password_reset':
|
|
||||||
return array_merge($common, array(
|
|
||||||
'user_name' => '用户名',
|
|
||||||
'user_email' => 'user@example.com',
|
|
||||||
'reset_url' => home_url('/wp-login.php?action=rp&key=sample_key'),
|
|
||||||
));
|
|
||||||
|
|
||||||
case 'todo_urge':
|
case 'todo_urge':
|
||||||
return array_merge($common, array(
|
return array_merge($common, array(
|
||||||
'todo_content' => '这是一个示例 TODO 任务内容',
|
'todo_content' => '这是一个示例 TODO 任务内容',
|
||||||
@@ -561,13 +494,8 @@ function argon_get_sample_email_vars($type) {
|
|||||||
'urge_time' => date_i18n(get_option('date_format') . ' ' . get_option('time_format')),
|
'urge_time' => date_i18n(get_option('date_format') . ' ' . get_option('time_format')),
|
||||||
));
|
));
|
||||||
|
|
||||||
case 'general':
|
|
||||||
default:
|
default:
|
||||||
return array_merge($common, array(
|
return $common;
|
||||||
'subject' => '示例邮件主题',
|
|
||||||
'title' => '示例标题',
|
|
||||||
'content' => '<p>这是通用邮件模板的示例内容。您可以在这里放置任何 HTML 内容。</p>',
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6404,7 +6404,7 @@ function argon_update_themeoptions(){
|
|||||||
update_option('argon_email_social_links', $social_links);
|
update_option('argon_email_social_links', $social_links);
|
||||||
|
|
||||||
// 保存邮件模板配置
|
// 保存邮件模板配置
|
||||||
$email_types = array('comment_notify', 'spam_notify', 'reply_notify', 'user_register', 'password_reset', 'todo_urge', 'general');
|
$email_types = array('comment_notify', 'spam_notify', 'reply_notify', 'todo_urge');
|
||||||
foreach ($email_types as $type) {
|
foreach ($email_types as $type) {
|
||||||
// 保存启用状态
|
// 保存启用状态
|
||||||
argon_update_option_checkbox('argon_email_template_' . $type . '_enabled');
|
argon_update_option_checkbox('argon_email_template_' . $type . '_enabled');
|
||||||
|
|||||||
42
style.css
42
style.css
@@ -6761,48 +6761,6 @@ html.darkmode #post_comment.post-comment-force-privatemode-off .comment-post-pri
|
|||||||
|
|
||||||
/*短代码适配*/
|
/*短代码适配*/
|
||||||
|
|
||||||
/*短代<E79FAD>?checkbox*/
|
|
||||||
|
|
||||||
.shortcode-todo {
|
|
||||||
|
|
||||||
cursor: default;
|
|
||||||
|
|
||||||
margin: 3px 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.shortcode-todo .custom-control-input {
|
|
||||||
|
|
||||||
pointer-events: none;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.shortcode-todo * {
|
|
||||||
|
|
||||||
cursor: default !important;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.shortcode-todo .custom-control-label span {
|
|
||||||
|
|
||||||
transform: translateY(-2.5px);
|
|
||||||
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
cursor: text !important;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.shortcode-todo.inline {
|
|
||||||
|
|
||||||
display: inline-block;
|
|
||||||
|
|
||||||
margin-right: 10px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*短代<E79FAD>?警告与折叠块*/
|
/*短代<E79FAD>?警告与折叠块*/
|
||||||
|
|
||||||
.admonition,
|
.admonition,
|
||||||
|
|||||||
Reference in New Issue
Block a user