Ticket #18493: enhanced_emails_merge.patch
File enhanced_emails_merge.patch, 33.0 KB (added by , 12 years ago) |
---|
-
wp-includes/email_templates/email-comment-notify.php
Property changes on: wp-includes\email_templates ___________________________________________________________________ Added: bugtraq:number + true
1 <?php 2 if ( 'comment' == $comment_type ) { 3 $html_message .= '<table style="margin-top:1em;"> 4 <tr> 5 <td style="width:75px;" width="75" rowspan="3"> 6 <div style="width:60px;height:60px;background-color: #ffffff; border: 1px solid #ececec; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;"> 7 <a style="margin:5px 0 0 5px;display:block;">' . get_avatar( $comment->comment_author_email, 50 ) . '</a> 8 </div></td> 9 <td height="12" style="height:12px;padding-top:2px;">Author: <strong>' . $comment->comment_author . '</strong></td> 10 </tr> 11 <tr><td style="font-size:10px;padding-left:45px;vertical-align:top">IP: ' . $comment->comment_author_IP; 12 if ( $comment->comment_author_domain ) { $html_message .= ', <a href="#" style="color:#21759b;text-decoration:none;">' . $comment->comment_author_domain . '</a>'; } 13 $html_message .= '</td></tr> 14 <tr><td>Email: <a href="mailto:' . $comment->comment_author_email . '" style="color:#21759b;text-decoration:none;">' . $comment->comment_author_email . '</a></td></tr> 15 </table> 16 <table style="margin-top:15px;"> 17 <tr><td style="line-height:150%;">URL: <a href="' . $comment->comment_author_url . '" style="color:#21759b;text-decoration:none;">' . $comment->comment_author_url . '</a></td></tr> 18 <tr><td style="line-height:150%;">Whois: <a href="http://whois.arin.net/rest/ip/' . $comment->comment_author_IP . '" style="color:#21759b;text-decoration:none;">http://whois.arin.net/rest/ip/' . $comment->comment_author_IP . '</a></td></tr> 19 </table>'; 20 } elseif ( 'trackback' == $comment_type ) { 21 $html_message .= '<table style="margin-top:15px;"> 22 <tr><td>Website: <a href="' . $comment->comment_author . '" style="color:#21759b;text-decoration:none;">' . $comment->comment_author . '</a></td></tr> 23 <tr><td style="font-size:10px;padding-left:45px;vertical-align:top">IP: ' . $comment->comment_author_IP; 24 if ( $comment->comment_author_domain ) { $html_message .= ', <a href="' . $comment->comment_author_domain . '" style="color:#21759b;text-decoration:none;">' . $comment->comment_author_domain . '</a>';} 25 $html_message .= '</td></tr> 26 </table> 27 <table style="margin-top:15px;"> 28 <tr><td style="line-height:150%;">URL: <a href="' . $comment->comment_author_url . '" style="color:#21759b;text-decoration:none;">' . $comment->comment_author_url . '</a></td></tr> 29 </table>'; 30 } elseif ( 'pingback' == $comment_type ) { 31 $html_message .= '<table style="margin-top:15px;"> 32 <tr><td>Website: <a href="' . $comment->comment_author . '" style="color:#21759b;text-decoration:none;">' . $comment->comment_author . '</a></td></tr> 33 <tr><td style="font-size:10px;padding-left:45px;vertical-align:top">IP: ' . $comment->comment_author_IP; 34 if ( $comment->comment_author_domain ) { $html_message .= ', <a href="#" style="color:#21759b;text-decoration:none;">' . $comment->comment_author_domain .'</a><';} 35 $html_message .= '</td></tr> 36 </table> 37 <table style="margin-top:15px;"> 38 <tr><td style="line-height:150%;">URL: <a href="' . $comment->comment_author_url . '" style="color:#21759b;text-decoration:none;">' . $comment->comment_author_url . '</a></td></tr> 39 </table>'; 40 } 41 $html_message .= '<div style="line-height:170%;padding: 2em; margin: 1em 0 1em 0;background-color: #ffffff; border: 1px solid #ececec; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;" id="EemailsContent">'; 42 if ( 'pingback' == $comment_type ) $html_message .= '[...] '; 43 $html_message .= wp_specialchars_decode( $comment->comment_content ); 44 if ( 'pingback' == $comment_type ) $html_message .= ' [...]'; 45 $html_message .= ' </div> 46 <table> 47 <tr><td style="line-height:150%;">Context: <a href="' . get_permalink( $comment->comment_post_ID ) . '" style="color:#21759b;text-decoration:none;">' . get_permalink( $comment->comment_post_ID ) . '</a></td></tr>'; 48 if ( isset( $moderation_message ) ) { 49 $html_message .= ' <tr><td style="line-height:150%;">' . $moderation_message . '</td></tr>'; 50 } 51 $html_message .= ' </table>'; 52 if ( ! empty( $action_links ) ) $html_message .= get_email_action_links( $action_links, $action_links_label ); 53 ?> 54 No newline at end of file -
wp-includes/email_templates/email-newblog.php
1 <?php 2 $html_message .= '<div style="line-height:170%;padding: 2em; margin: 1em 0 1em 0;background-color: #ffffff; border: 1px solid #ececec; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;" id="EemailsContent"> 3 Your new WordPress blog has been successfully set up at:<br /> 4 <a href="' . site_url() . '" style="color:#21759b;text-decoration:none;">' . site_url() . '</a> 5 <p style="margin:2em 0 0 0">You can log in to the administrator account with the following information:<br /> 6 Username: <strong>admin</strong><br /> 7 Password: the password you chose during the install</p> 8 </div>'; 9 if ( ! empty( $action_links ) ) $html_message .= get_email_action_links( $action_links, $action_links_label ); 10 $html_message .= '<p style="margin-top:15px;line-height:170%;">We hope you enjoy your new blog. Thanks! <br />'; 11 ?> 12 No newline at end of file -
wp-includes/email_templates/email-newuser-admin.php
1 <?php 2 $html_message .= '<div style="line-height:170%;padding: 2em; margin: 1em 0 1em 0;background-color: #ffffff; border: 1px solid #ececec; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;" id="EemailsContent"> 3 <p style="margin:2em 0 0.8em 0">A new user - <strong>' . $user->display_name . '</strong>, has just registered on your site.</p> 4 <p style="margin:2em 0 0.8em 0"> 5 Username: <strong>' . $user->user_login . '</strong><br /> 6 Email: <strong style="text-decoration:none !important;">' . $user->user_email . '</strong><br /></p> 7 </div>'; 8 if ( ! empty( $action_links ) ) $html_message .= get_email_action_links( $action_links, $action_links_label ); 9 ?> 10 No newline at end of file -
wp-includes/email_templates/email-newuser-user.php
1 <?php 2 $html_message .= '<div style="line-height:170%;padding: 2em; margin: 1em 0 1em 0;background-color: #ffffff; border: 1px solid #ececec; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;" id="EemailsContent"> 3 Howdy, ' . $user->user_login . '! 4 <p style="margin:30px 0 10 0">Your account has been successfully created and is ready to use!</p> 5 <p style="margin:30px 0 10 0">You can log in to your account with the following information:<br /> 6 Username: <strong>' . $user->user_login . '</strong><br /> 7 Password: <strong>' . $user_password . '</strong><br /></p> 8 </div>'; 9 if ( ! empty( $action_links ) ) $html_message .= get_email_action_links( $action_links, $action_links_label ); 10 ?> 11 No newline at end of file -
wp-includes/email_templates/email-passwordchange-admin.php
1 <?php 2 $html_message .= '<div style="line-height:170%;padding: 30px; margin: 15px 0 15px 0;background-color: #ffffff; border: 1px solid #ececec; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;" id="EemailsContent"> 3 <p style="margin:2em 0 0.8em 0">The password was reset and changed for the following user:</p> 4 <p style="margin:2em 0 0.8em 0"> 5 Username: <strong>' . $user->user_login . '</strong><br /> 6 Email: <strong>' . $user->user_email . '</strong><br /></p> 7 </div>'; 8 if ( ! empty( $action_links ) ) $html_message .= get_email_action_links( $action_links, $action_links_label ); 9 ?> 10 No newline at end of file -
wp-includes/email_templates/email.php
1 <?php $html_message .= wp_specialchars_decode( $message ); ?> 2 No newline at end of file -
wp-includes/email_templates/email_layout.php
1 <?php 2 3 function get_email_header() { 4 return '<h1 style="margin:0;padding:0;color:#21759b;font-size:20px;font-weight:bold;font-family:Arial;line-height:22px;"> 5 ' . $content_title . ' 6 </h1>'; 7 } 8 9 function get_email_footer() { 10 return ' 11 -- The WordPress Team <br /> 12 <a href="http://wordpress.org" style="color:#21759b;text-decoration:none;">http://wordpress.org</a>'; 13 } 14 15 function get_email_action_links( $action_links, $action_links_label ) { 16 $links = array(); 17 18 foreach ($action_links as $link) { 19 $links[] = '<a href="' . $link['link'] . '" style="color:#' . $link['color'] . ';text-decoration:none;margin: 0 10px;font-weight:bold; font-size: 14px">' . $link['text'] . '</a>'; 20 } 21 22 if ( ! empty ( $links ) ) 23 $links = $label . implode(' | ',$links); 24 25 return '<table> 26 <tr><td style="line-height:200%;">' . $links . '</td></tr> 27 </table>'; 28 } 29 30 $html_message = '<!DOCTYPE html> 31 <html> 32 <head> 33 <title></title> 34 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 35 <meta name="viewport" content="width=device-width,user-scalable=no" /> 36 <style type="text/css"> 37 @media only screen and (max-device-width: 320px) { 38 #EemailsMainContainer { 39 width:320px !important; 40 margin:0 5px 5px 5px !important; 41 } 42 #EemailsWpLogo { 43 margin:10px !important; 44 } 45 #EemailsInnerContainer { 46 padding:10px !important; 47 } 48 #EemailsContent { 49 padding:10px !important; 50 } 51 #EemailsMainContainer { 52 font-size:11px !important; 53 } 54 } 55 @media only screen and (min-device-width: 320px) and (max-device-width: 1000px) { 56 #EemailsMainContainer { 57 width:auto !important; 58 margin:0 10px 10px 10px !important; 59 } 60 } 61 </style> 62 </head> 63 <body> 64 <div style="max-width:650px;margin:0 0.7em 1em 0.7em;color:#000000;font-family:Arial;font-size:12px;" id="EemailsMainContainer"> 65 <a href="' . site_url() . '" style="border:0;"><img src="' . ABSPATH . WPINC . '/images/wp_logo_email.jpg" alt="WordPress" style="margin:1em;border:0" id="EemailsWpLogo" /></a> 66 <div style="padding: 2em; margin: 0; background-color: #f5f5f5; border: 1px solid #ececec; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;" id="EemailsInnerContainer">'; 67 if ( $include_header ) $html_message .= get_email_header(); 68 include( $template ); 69 if ( $include_footer ) $html_message .= get_email_footer(); 70 $html_message .= ' 71 </div> 72 </div> 73 </body> 74 </html>'; 75 ?> 76 77 No newline at end of file -
wp-includes/functions.php
4580 4580 @header( 'X-Frame-Options: SAMEORIGIN' ); 4581 4581 } 4582 4582 4583 /** 4584 * Compiles the template name based on the arguments and locate the files 4585 * 4586 * @param string $slug email template slug 4587 * @param string $event email template event (optional) 4588 * @param string $name email template name (optional) 4589 */ 4590 function get_email_template( $slug, $event = null , $name = null ) { 4591 do_action( "get_email_template_{$slug}", $slug, $event, $name ); 4592 $directories = apply_filters( 'email-template-directories', array( 4593 '', // Blank is the default template directories that we want to check first 4594 ) ); 4595 $templates = array(); 4596 foreach ( $directories as $dir ) { 4597 $dir_slug = empty( $dir )? $slug : path_join( $dir, $slug ); 4598 4599 if ( isset( $event ) && isset( $name ) ) 4600 $templates[] = "{$dir_slug}-{$event}-{$name}.php"; 4601 4602 if ( isset( $event ) ) 4603 $templates[] = "{$dir_slug}-{$event}.php"; 4604 4605 $templates[] = "{$dir_slug}.php"; 4606 } 4607 4608 return locate_email_template( $templates ); 4609 } 4610 4611 /** 4612 * Locate the email template 4613 * 4614 * @param array $template_names an array of file templates by priority 4615 * @return string location where the template was found 4616 */ 4617 function locate_email_template( $template_names ) { 4618 $located = ''; 4619 foreach ( (array) $template_names as $template_name ) { 4620 if ( !$template_name ) 4621 continue; 4622 if ( file_exists( get_stylesheet_directory() . '/' . $template_name ) ) { 4623 $located = array( get_stylesheet_directory() . '/' . $template_name, get_stylesheet_directory() ); 4624 break; 4625 } else if ( file_exists( get_template_directory() . '/' . $template_name ) ) { 4626 $located = array( get_template_directory() . '/' . $template_name, get_template_directory() ); 4627 break; 4628 } else if ( file_exists( ABSPATH . WPINC . '/email_templates/' . $template_name ) ) { 4629 $located = array( $template_name, ABSPATH . WPINC . '/email_templates' ); 4630 break; 4631 } 4632 } 4633 4634 return $located; 4635 } 4636 4583 4637 ?> -
wp-includes/pluggable.php
Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: wp-includes\images\wp_logo_email.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream
180 180 * However, you can set the content type of the email by using the 181 181 * 'wp_mail_content_type' filter. 182 182 * 183 * If $message is an array, the key of each is used to add as an attachment 184 * with the value used as the body. The 'text/plain' element is used as the 185 * text version of the body, with the 'text/html' element used as the HTML 186 * version of the body. All other types are added as attachments. 187 * 183 188 * The default charset is based on the charset used on the blog. The charset can 184 189 * be set using the 'wp_mail_charset' filter. 185 190 * … … 196 201 * 197 202 * @param string|array $to Array or comma-separated list of email addresses to send message. 198 203 * @param string $subject Email subject 199 * @param string $message Message contents204 * @param string|array $message Message contents 200 205 * @param string|array $headers Optional. Additional headers. 201 206 * @param string|array $attachments Optional. Files to attach. 207 * @param array $args Optional. E-mail options. 202 208 * @return bool Whether the email contents were sent successfully. 203 209 */ 204 function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { 210 function wp_mail( $to, $subject, $message, $headers = '', $attachments = array(), $args = array() ) { 211 212 // Default args 213 $defaults = array ( 214 'template' => 'email', 215 'template_args' => array(), 216 'content_title' => '', 217 'action_links' => array(), 218 'include_header' => true, 219 'include_footer' => true, 220 ); 221 $args = wp_parse_args( $args, $defaults ); 222 205 223 // Compact the input, apply the filters, and extract them back out 206 224 extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) ); 207 225 226 // Extract the arguments, and then the template arguments 227 extract( $args, EXTR_SKIP ); 228 extract( $template_args, EXTR_SKIP ); 229 230 // Get template folder and file name 231 $template_data = get_email_template($args['template-slug'], $args['template-event'], $args['template-name']); 232 $template = $template_data[0]; // template name for email layout 233 234 $html_message = ''; 235 236 include( $template_data[1] . '/email_layout.php' ); 237 238 $message = array( 239 'text/plain' => $message, 240 'text/html' => $html_message 241 ); 242 208 243 if ( !is_array($attachments) ) 209 244 $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) ); 210 245 … … 267 302 } 268 303 break; 269 304 case 'content-type': 305 if ( is_array($message) ) { 306 // Multipart email, ignore the content-type header 307 break; 308 } 270 309 if ( strpos( $content, ';' ) !== false ) { 271 310 list( $type, $charset ) = explode( ';', $content ); 272 311 $content_type = trim( $type ); … … 350 389 } 351 390 } 352 391 392 // If we don't have a charset from the input headers 393 if ( !isset( $charset ) ) 394 $charset = get_bloginfo( 'charset' ); 395 396 // Set the content-type and charset 397 $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset ); 398 353 399 // Set mail's subject and body 354 400 $phpmailer->Subject = $subject; 355 $phpmailer->Body = $message;356 401 402 if ( is_string($message) ) { 403 $phpmailer->Body = $message; 404 405 // Set Content-Type and charset 406 // If we don't have a content-type from the input headers 407 if ( !isset( $content_type ) ) 408 $content_type = 'text/plain'; 409 410 $content_type = apply_filters( 'wp_mail_content_type', $content_type ); 411 412 $phpmailer->ContentType = $content_type; 413 414 // Set whether it's plaintext, depending on $content_type 415 if ( 'text/html' == $content_type ) 416 $phpmailer->IsHTML( true ); 417 418 // For backwards compatibility, new multipart emails should use 419 // the array style $message. This never really worked well anyway 420 if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) ) 421 $phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) ); 422 } 423 elseif ( is_array($message) ) { 424 foreach ($message as $type => $bodies) { 425 foreach ((array) $bodies as $body) { 426 if ($type === 'text/html') { 427 $phpmailer->Body = $body; 428 } 429 elseif ($type === 'text/plain') { 430 $phpmailer->AltBody = $body; 431 } 432 else { 433 $phpmailer->AddAttachment($body, '', 'base64', $type); 434 } 435 } 436 } 437 } 438 357 439 // Add any CC and BCC recipients 358 440 if ( !empty( $cc ) ) { 359 441 foreach ( (array) $cc as $recipient ) { … … 394 476 // Set to use PHP's mail() 395 477 $phpmailer->IsMail(); 396 478 397 // Set Content-Type and charset398 // If we don't have a content-type from the input headers399 if ( !isset( $content_type ) )400 $content_type = 'text/plain';401 402 $content_type = apply_filters( 'wp_mail_content_type', $content_type );403 404 $phpmailer->ContentType = $content_type;405 406 // Set whether it's plaintext, depending on $content_type407 if ( 'text/html' == $content_type )408 $phpmailer->IsHTML( true );409 410 // If we don't have a charset from the input headers411 if ( !isset( $charset ) )412 $charset = get_bloginfo( 'charset' );413 414 // Set the content-type and charset415 $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );416 417 479 // Set custom headers 418 480 if ( !empty( $headers ) ) { 419 481 foreach( (array) $headers as $name => $content ) { 420 482 $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) ); 421 483 } 422 423 if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )424 $phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );425 484 } 426 485 427 486 if ( !empty( $attachments ) ) { … … 986 1045 return false; 987 1046 988 1047 // The author moderated a comment on his own post 989 if ( $post->post_author == get_current_user_id() )990 return false;1048 //if ( $post->post_author == get_current_user_id() ) 1049 // return false; 991 1050 992 1051 // If there's no email to send the comment to 993 1052 if ( '' == $author->user_email ) … … 998 1057 // The blogname option is escaped with esc_html on the way into the database in sanitize_option 999 1058 // we want to reverse this for the plain text arena of emails. 1000 1059 $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 1001 1060 $eemail_args = array(); 1002 1061 if ( empty( $comment_type ) ) $comment_type = 'comment'; 1003 1062 1063 $eemail_args['template_args'] = array( 1064 'comment' => $comment, 1065 'comment_type' => $comment_type 1066 ); 1067 1004 1068 if ('comment' == $comment_type) { 1005 1069 $notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n"; 1006 1070 /* translators: 1: comment author, 2: author IP, 3: author domain */ … … 1010 1074 $notify_message .= sprintf( __('Whois : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n"; 1011 1075 $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; 1012 1076 $notify_message .= __('You can see all comments on this post here: ') . "\r\n"; 1077 $eemail_args['content_title'] = sprintf( __( '"%s" - new comment' ), $post->post_title ); 1013 1078 /* translators: 1: blog name, 2: post title */ 1014 1079 $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title ); 1015 1080 } elseif ('trackback' == $comment_type) { … … 1019 1084 $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; 1020 1085 $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; 1021 1086 $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n"; 1087 $eemail_args['content_title'] = sprintf( __( '"%s" - new trackback' ), $post->post_title ); 1022 1088 /* translators: 1: blog name, 2: post title */ 1023 1089 $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title ); 1024 1090 } elseif ('pingback' == $comment_type) { … … 1028 1094 $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; 1029 1095 $notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n"; 1030 1096 $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n"; 1097 $eemail_args['content_title'] = sprintf( __( '"%s" - new pingback' ), $post->post_title ); 1031 1098 /* translators: 1: blog name, 2: post title */ 1032 1099 $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); 1033 1100 } 1034 1101 $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; 1035 1102 $notify_message .= sprintf( __('Permalink: %s'), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n"; 1036 if ( EMPTY_TRASH_DAYS ) 1103 1104 $eemail_args['action_links'] = array(); 1105 if ( EMPTY_TRASH_DAYS ) { 1037 1106 $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n"; 1038 else 1107 $eemail_args['action_links'][] = array('link'=>admin_url("comment.php?action=trash&c=$comment_id"),'color'=>'c23031','text'=>__('Trash it')); 1108 } 1109 else { 1039 1110 $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n"; 1111 $eemail_args['action_links'][] = array('link'=>admin_url("comment.php?action=delete&c=$comment_id"),'color'=>'c23031','text'=>__('Delete it')); 1112 } 1040 1113 $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n"; 1114 $eemail_args['action_links'][] = array('link'=>admin_url("comment.php?action=spam&c=$comment_id"),'color'=>'d2b12e','text'=>__('Mark as spam')); 1041 1115 1042 1116 $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); 1043 1117 … … 1060 1134 $notify_message = apply_filters('comment_notification_text', $notify_message, $comment_id); 1061 1135 $subject = apply_filters('comment_notification_subject', $subject, $comment_id); 1062 1136 $message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id); 1063 1064 @wp_mail( $author->user_email, $subject, $notify_message, $message_headers ); 1065 1137 $eemail_args['template-slug'] = 'email'; 1138 $eemail_args['template-event'] = 'comment'; 1139 $eemail_args['template-name'] = 'notify'; 1140 @eemails_wp_mail( $author->user_email, $subject, $notify_message, $message_headers, array(), $eemail_args ); 1066 1141 return true; 1067 1142 } 1068 1143 endif; … … 1082 1157 1083 1158 if ( 0 == get_option( 'moderation_notify' ) ) 1084 1159 return true; 1085 1160 1086 1161 $comment = get_comment($comment_id); 1087 1162 $post = get_post($comment->comment_post_ID); 1088 1163 $user = get_userdata( $post->post_author ); … … 1097 1172 // The blogname option is escaped with esc_html on the way into the database in sanitize_option 1098 1173 // we want to reverse this for the plain text arena of emails. 1099 1174 $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 1175 1176 $eemail_args = array(); 1100 1177 1178 $comment_type = $comment->comment_type; 1179 if ( empty( $comment_type ) ) $comment_type = 'comment'; 1180 1181 $eemail_args['template_args'] = array( 1182 'comment' => $comment, 1183 'comment_type' => $comment_type 1184 ); 1101 1185 switch ($comment->comment_type) 1102 1186 { 1103 1187 case 'trackback': … … 1106 1190 $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 1107 1191 $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; 1108 1192 $notify_message .= __('Trackback excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; 1193 $eemail_args['content_title'] = sprintf( __( '"%s" - new trackback awaiting approval' ), $post->post_title ); 1109 1194 break; 1110 1195 case 'pingback': 1111 1196 $notify_message = sprintf( __('A new pingback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n"; … … 1113 1198 $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 1114 1199 $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; 1115 1200 $notify_message .= __('Pingback excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; 1201 $eemail_args['content_title'] = sprintf( __( '"%s" - new pingback awaiting approval' ), $post->post_title ); 1116 1202 break; 1117 1203 default: //Comments 1118 1204 $notify_message = sprintf( __('A new comment on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n"; … … 1122 1208 $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; 1123 1209 $notify_message .= sprintf( __('Whois : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n"; 1124 1210 $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; 1211 $eemail_args['content_title'] = sprintf( __( '"%s" - new comment awaiting approval' ), $post->post_title ); 1125 1212 break; 1126 1213 } 1127 1214 1215 $eemail_args['action_links'] = array(array('link'=>admin_url("comment.php?action=approve&c=$comment_id"),'color'=>'3ca757','text'=>__('Approve it'))); 1216 1128 1217 $notify_message .= sprintf( __('Approve it: %s'), admin_url("comment.php?action=approve&c=$comment_id") ) . "\r\n"; 1129 if ( EMPTY_TRASH_DAYS ) 1218 if ( EMPTY_TRASH_DAYS ) { 1130 1219 $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n"; 1131 else 1220 $eemail_args['action_links'][] = array('link'=>admin_url("comment.php?action=trash&c=$comment_id"),'color'=>'c23031','text'=>__('Trash it')); 1221 } 1222 else { 1132 1223 $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n"; 1224 $eemail_args['action_links'][] = array('link'=>admin_url("comment.php?action=delete&c=$comment_id"),'color'=>'c23031','text'=>__('Delete it')); 1225 } 1226 1133 1227 $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n"; 1134 1228 $eemail_args['action_links'][] = array('link'=>admin_url("comment.php?action=spam&c=$comment_id"),'color'=>'d2b12e','text'=>__('Mark as spam')); 1229 1230 $eemail_args['template_args']['moderation_message'] = sprintf( _n('Currently %s comment is waiting for approval. ', 1231 'Currently %s comments are waiting for approval.', $comments_waiting), number_format_i18n($comments_waiting) ) . ' <a href="' . admin_url("edit-comments.php?comment_status=moderated") . '" style="color:#21759b;text-decoration:none;">Please visit the moderation panel.</a>'; 1135 1232 $notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:', 1136 1233 'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n"; 1137 1234 $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n"; … … 1142 1239 $notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id); 1143 1240 $subject = apply_filters('comment_moderation_subject', $subject, $comment_id); 1144 1241 $message_headers = apply_filters('comment_moderation_headers', $message_headers); 1145 1242 1243 $eemail_args['template-slug'] = 'email'; 1244 $eemail_args['template-event'] = 'comment'; 1245 $eemail_args['template-name'] = 'notify'; 1146 1246 foreach ( $email_to as $email ) 1147 @ wp_mail($email, $subject, $notify_message, $message_headers);1247 @eemails_wp_mail($email, $subject, $notify_message, $message_headers, array(), $eemail_args); 1148 1248 1149 1249 return true; 1150 1250 } … … 1162 1262 // send a copy of password change notification to the admin 1163 1263 // but check to see if it's the admin whose password we're changing, and skip this 1164 1264 if ( $user->user_email != get_option('admin_email') ) { 1265 $eemails_args = array(); 1165 1266 $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; 1166 1267 // The blogname option is escaped with esc_html on the way into the database in sanitize_option 1167 1268 // we want to reverse this for the plain text arena of emails. 1168 1269 $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 1169 wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message); 1270 $eemail_args['template'] = 'email-passwordchange-admin'; 1271 $eemail_args['template_args'] = array('user' => $user); 1272 $eemail_args['action_links'] = array( 1273 array('link'=>admin_url("user-edit.php?user_id=".$user->ID),'color'=>'d2b12e','text'=>__('Edit user')), 1274 array('link'=>admin_url("users.php"),'color'=>'3ca757','text'=>__('See all users')) 1275 ); 1276 eemails_wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message, '', array(), $eemail_args); 1170 1277 } 1171 1278 } 1172 1279 endif; … … 1194 1301 $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 1195 1302 $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; 1196 1303 1197 @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message); 1304 $eemail_args['template-slug'] = 'email'; 1305 $eemail_args['template-event'] = 'newuser'; 1306 $eemail_args['template-name'] = 'admin'; 1307 $eemail_args['template_args'] = array('user' => $user); 1308 $eemail_args['action_links'] = array( 1309 array('link'=>admin_url("user-edit.php?user_id=".$user->ID),'color'=>'d2b12e','text'=>__('Edit user')), 1310 array('link'=>admin_url("users.php"),'color'=>'3ca757','text'=>__('See all users')) 1311 ); 1312 @eemails_wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message, '', array(), $eemail_args); 1198 1313 1199 1314 if ( empty($plaintext_pass) ) 1200 1315 return; 1201 1316 1317 $eemail_args['template_args']["user_password"] = $plaintext_pass; 1318 $eemail_args['action_links'] = array(); 1319 $eemail_args['template-slug'] = 'email'; 1320 $eemail_args['template-event'] = 'newuser'; 1321 $eemail_args['template-name'] = 'user'; 1202 1322 $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; 1203 1323 $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; 1204 1324 $message .= wp_login_url() . "\r\n"; 1205 1325 1206 wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);1326 eemails_wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message, '', array(), $eemail_args); 1207 1327 1208 1328 } 1209 1329 endif;