mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Trim empty lines. Nothing but newline.
git-svn-id: https://develop.svn.wordpress.org/trunk@5700 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -159,17 +159,17 @@ endif;
|
||||
if ( !function_exists( 'wp_mail' ) ) :
|
||||
function wp_mail( $to, $subject, $message, $headers = '' ) {
|
||||
global $phpmailer;
|
||||
|
||||
|
||||
// (Re)create it, if it's gone missing
|
||||
if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) {
|
||||
require_once ABSPATH . WPINC . '/class-phpmailer.php';
|
||||
require_once ABSPATH . WPINC . '/class-smtp.php';
|
||||
$phpmailer = new PHPMailer();
|
||||
}
|
||||
|
||||
|
||||
// Compact the input, apply the filters, and extract them back out
|
||||
extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers' ) ) );
|
||||
|
||||
|
||||
// Default headers
|
||||
if ( empty( $headers ) ) {
|
||||
$headers = array(
|
||||
@@ -180,18 +180,18 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
|
||||
// string headers and an array of headers.
|
||||
$tempheaders = (array) explode( "\n", $headers );
|
||||
$headers = array();
|
||||
|
||||
|
||||
// If it's actually got contents
|
||||
if ( !empty( $tempheaders ) ) {
|
||||
// Iterate through the raw headers
|
||||
foreach ( $tempheaders as $header ) {
|
||||
// Explode them out
|
||||
list( $name, $content ) = explode( ':', trim( $header ), 2 );
|
||||
|
||||
|
||||
// Cleanup crew
|
||||
$name = trim( $name );
|
||||
$content = trim( $content );
|
||||
|
||||
|
||||
// Mainly for legacy -- process a From: header if it's there
|
||||
if ( $name == 'From' ) {
|
||||
if ( strpos( '<', $content ) !== false ) {
|
||||
@@ -199,7 +199,7 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
|
||||
$from_name = substr( $content, 0, strpos( '<', $content ) - 1 );
|
||||
$from_name = str_replace( '"', '', $from_name );
|
||||
$from_name = trim( $from_name );
|
||||
|
||||
|
||||
$from_email = substr( $content, strpos( '<', $content ) + 1 );
|
||||
$from_email = str_replace( '>', '', $from_email );
|
||||
$from_email = trim( $from_email );
|
||||
@@ -221,7 +221,7 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Empty out the values that may be set
|
||||
$phpmailer->ClearAddresses();
|
||||
$phpmailer->ClearAllRecipients();
|
||||
@@ -230,13 +230,13 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
|
||||
$phpmailer->ClearCCs();
|
||||
$phpmailer->ClearCustomHeaders();
|
||||
$phpmailer->ClearReplyTos();
|
||||
|
||||
|
||||
// From email and name
|
||||
// If we don't have a name from the input headers
|
||||
if ( !isset( $from_name ) ) {
|
||||
$from_name = 'WordPress';
|
||||
}
|
||||
|
||||
|
||||
// If we don't have an email from the input headers
|
||||
if ( !isset( $from_email ) ) {
|
||||
// Get the site domain and get rid of www.
|
||||
@@ -244,58 +244,58 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
|
||||
if ( substr( $sitename, 0, 4 ) == 'www.' ) {
|
||||
$sitename = substr( $sitename, 4 );
|
||||
}
|
||||
|
||||
|
||||
$from_email = 'wordpress@' . $sitename;
|
||||
}
|
||||
|
||||
|
||||
// Set the from name and email
|
||||
$phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
|
||||
$phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
|
||||
|
||||
|
||||
// Set destination address
|
||||
$phpmailer->AddAddress( $to );
|
||||
|
||||
|
||||
// Set mail's subject and body
|
||||
$phpmailer->Subject = $subject;
|
||||
$phpmailer->Body = $message;
|
||||
|
||||
|
||||
// Set to use PHP's mail()
|
||||
$phpmailer->IsMail();
|
||||
|
||||
|
||||
// Set Content-Type and charset
|
||||
// If we don't have a content-type from the input headers
|
||||
if ( !isset( $content_type ) ) {
|
||||
$content_type = 'text/plain';
|
||||
}
|
||||
|
||||
|
||||
// Set whether it's plaintext or not, depending on $content_type
|
||||
if ( $content_type == 'text/html' ) {
|
||||
$phpmailer->IsHTML( true );
|
||||
} else {
|
||||
$phpmailer->IsHTML( false );
|
||||
}
|
||||
|
||||
|
||||
// If we don't have a charset from the input headers
|
||||
if ( !isset( $charset ) ) {
|
||||
$charset = get_bloginfo( 'charset' );
|
||||
}
|
||||
|
||||
|
||||
// Set the content-type and charset
|
||||
$phpmailer->ContentType = apply_filters( 'wp_mail_content_type', 'text/plain' );
|
||||
$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
|
||||
|
||||
|
||||
// Set custom headers
|
||||
if ( !empty( $headers ) ) {
|
||||
foreach ( $headers as $name => $content ) {
|
||||
$phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
|
||||
|
||||
|
||||
// Send!
|
||||
$result = @$phpmailer->Send();
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
endif;
|
||||
@@ -533,7 +533,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
|
||||
$message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id);
|
||||
|
||||
@wp_mail($user->user_email, $subject, $notify_message, $message_headers);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
endif;
|
||||
@@ -549,7 +549,7 @@ function wp_notify_moderator($comment_id) {
|
||||
|
||||
if( get_option( "moderation_notify" ) == 0 )
|
||||
return true;
|
||||
|
||||
|
||||
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user