Ticket #18493: enhanced_emails_merge.2.patch

File enhanced_emails_merge.2.patch, 32.9 KB (added by wojtek.szkutnik, 21 months ago)

fixed eemails references

  • 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 
     3function 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 
     9function 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 
     15function 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

     
    45804580        @header( 'X-Frame-Options: SAMEORIGIN' ); 
    45814581} 
    45824582 
     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 */ 
     4590function 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 */ 
     4617function 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 
    45834637?> 
  • 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
    
     
    180180 * However, you can set the content type of the email by using the 
    181181 * 'wp_mail_content_type' filter. 
    182182 * 
     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 * 
    183188 * The default charset is based on the charset used on the blog. The charset can 
    184189 * be set using the 'wp_mail_charset' filter. 
    185190 * 
     
    196201 * 
    197202 * @param string|array $to Array or comma-separated list of email addresses to send message. 
    198203 * @param string $subject Email subject 
    199  * @param string $message Message contents 
     204 * @param string|array $message Message contents 
    200205 * @param string|array $headers Optional. Additional headers. 
    201206 * @param string|array $attachments Optional. Files to attach. 
     207 * @param array $args Optional. E-mail options. 
    202208 * @return bool Whether the email contents were sent successfully. 
    203209 */ 
    204 function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { 
     210function 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         
    205223        // Compact the input, apply the filters, and extract them back out 
    206224        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         
    208243        if ( !is_array($attachments) ) 
    209244                $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) ); 
    210245 
     
    267302                                                } 
    268303                                                break; 
    269304                                        case 'content-type': 
     305                                                if ( is_array($message) ) { 
     306                                                        // Multipart email, ignore the content-type header 
     307                                                        break; 
     308                                                } 
    270309                                                if ( strpos( $content, ';' ) !== false ) { 
    271310                                                        list( $type, $charset ) = explode( ';', $content ); 
    272311                                                        $content_type = trim( $type ); 
     
    350389                } 
    351390        } 
    352391 
     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 
    353399        // Set mail's subject and body 
    354400        $phpmailer->Subject = $subject; 
    355         $phpmailer->Body    = $message; 
    356401 
     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 
    357439        // Add any CC and BCC recipients 
    358440        if ( !empty( $cc ) ) { 
    359441                foreach ( (array) $cc as $recipient ) { 
     
    394476        // Set to use PHP's mail() 
    395477        $phpmailer->IsMail(); 
    396478 
    397         // Set Content-Type and charset 
    398         // If we don't have a content-type from the input headers 
    399         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_type 
    407         if ( 'text/html' == $content_type ) 
    408                 $phpmailer->IsHTML( true ); 
    409  
    410         // If we don't have a charset from the input headers 
    411         if ( !isset( $charset ) ) 
    412                 $charset = get_bloginfo( 'charset' ); 
    413  
    414         // Set the content-type and charset 
    415         $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset ); 
    416  
    417479        // Set custom headers 
    418480        if ( !empty( $headers ) ) { 
    419481                foreach( (array) $headers as $name => $content ) { 
    420482                        $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) ); 
    421483                } 
    422  
    423                 if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) ) 
    424                         $phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) ); 
    425484        } 
    426485 
    427486        if ( !empty( $attachments ) ) { 
     
    9861045                return false; 
    9871046 
    9881047        // 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; 
    9911050 
    9921051        // If there's no email to send the comment to 
    9931052        if ( '' == $author->user_email ) 
     
    9981057        // The blogname option is escaped with esc_html on the way into the database in sanitize_option 
    9991058        // we want to reverse this for the plain text arena of emails. 
    10001059        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 
    1001  
     1060        $eemail_args = array(); 
    10021061        if ( empty( $comment_type ) ) $comment_type = 'comment'; 
    10031062 
     1063        $eemail_args['template_args'] = array( 
     1064                'comment' => $comment, 
     1065                 'comment_type' => $comment_type 
     1066        ); 
     1067         
    10041068        if ('comment' == $comment_type) { 
    10051069                $notify_message  = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n"; 
    10061070                /* translators: 1: comment author, 2: author IP, 3: author domain */ 
     
    10101074                $notify_message .= sprintf( __('Whois  : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n"; 
    10111075                $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; 
    10121076                $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 ); 
    10131078                /* translators: 1: blog name, 2: post title */ 
    10141079                $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title ); 
    10151080        } elseif ('trackback' == $comment_type) { 
     
    10191084                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n"; 
    10201085                $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; 
    10211086                $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 ); 
    10221088                /* translators: 1: blog name, 2: post title */ 
    10231089                $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title ); 
    10241090        } elseif ('pingback' == $comment_type) { 
     
    10281094                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n"; 
    10291095                $notify_message .= __('Excerpt: ') . "\r\n" . sprintf('[...] %s [...]', $comment->comment_content ) . "\r\n\r\n"; 
    10301096                $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 ); 
    10311098                /* translators: 1: blog name, 2: post title */ 
    10321099                $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); 
    10331100        } 
    10341101        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; 
    10351102        $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 ) { 
    10371106                $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 { 
    10391110                $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        } 
    10401113        $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')); 
    10411115 
    10421116        $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); 
    10431117 
     
    10601134        $notify_message = apply_filters('comment_notification_text', $notify_message, $comment_id); 
    10611135        $subject = apply_filters('comment_notification_subject', $subject, $comment_id); 
    10621136        $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        @wp_mail( $author->user_email, $subject, $notify_message, $message_headers, array(), $eemail_args ); 
    10661141        return true; 
    10671142} 
    10681143endif; 
     
    10821157 
    10831158        if ( 0 == get_option( 'moderation_notify' ) ) 
    10841159                return true; 
    1085  
     1160                 
    10861161        $comment = get_comment($comment_id); 
    10871162        $post = get_post($comment->comment_post_ID); 
    10881163        $user = get_userdata( $post->post_author ); 
     
    10971172        // The blogname option is escaped with esc_html on the way into the database in sanitize_option 
    10981173        // we want to reverse this for the plain text arena of emails. 
    10991174        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); 
     1175         
     1176        $eemail_args = array(); 
    11001177 
     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        ); 
    11011185        switch ($comment->comment_type) 
    11021186        { 
    11031187                case 'trackback': 
     
    11061190                        $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 
    11071191                        $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n"; 
    11081192                        $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 ); 
    11091194                        break; 
    11101195                case 'pingback': 
    11111196                        $notify_message  = sprintf( __('A new pingback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n"; 
     
    11131198                        $notify_message .= sprintf( __('Website : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; 
    11141199                        $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n"; 
    11151200                        $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 ); 
    11161202                        break; 
    11171203                default: //Comments 
    11181204                        $notify_message  = sprintf( __('A new comment on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n"; 
     
    11221208                        $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n"; 
    11231209                        $notify_message .= sprintf( __('Whois  : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n"; 
    11241210                        $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 ); 
    11251212                        break; 
    11261213        } 
    11271214 
     1215        $eemail_args['action_links'] = array(array('link'=>admin_url("comment.php?action=approve&c=$comment_id"),'color'=>'3ca757','text'=>__('Approve it'))); 
     1216                                                                                                                                                                                                                                                                                    
    11281217        $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 ) { 
    11301219                $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 { 
    11321223                $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                 
    11331227        $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>'; 
    11351232        $notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:', 
    11361233                'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n"; 
    11371234        $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n"; 
     
    11421239        $notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id); 
    11431240        $subject = apply_filters('comment_moderation_subject', $subject, $comment_id); 
    11441241        $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'; 
    11461246        foreach ( $email_to as $email ) 
    1147                 @wp_mail($email, $subject, $notify_message, $message_headers); 
     1247                @wp_mail($email, $subject, $notify_message, $message_headers, array(), $eemail_args); 
    11481248 
    11491249        return true; 
    11501250} 
     
    11621262        // send a copy of password change notification to the admin 
    11631263        // but check to see if it's the admin whose password we're changing, and skip this 
    11641264        if ( $user->user_email != get_option('admin_email') ) { 
     1265                $eemails_args = array(); 
    11651266                $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; 
    11661267                // The blogname option is escaped with esc_html on the way into the database in sanitize_option 
    11671268                // we want to reverse this for the plain text arena of emails. 
    11681269                $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                wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message, '', array(), $eemail_args); 
    11701277        } 
    11711278} 
    11721279endif; 
     
    11941301        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 
    11951302        $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; 
    11961303 
    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        @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message, '', array(), $eemail_args); 
    11981313 
    11991314        if ( empty($plaintext_pass) ) 
    12001315                return; 
    12011316 
     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';  
    12021322        $message  = sprintf(__('Username: %s'), $user_login) . "\r\n"; 
    12031323        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n"; 
    12041324        $message .= wp_login_url() . "\r\n"; 
    12051325 
    1206         wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message); 
     1326        wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message, '', array(), $eemail_args); 
    12071327 
    12081328} 
    12091329endif;