Make WordPress Core

Ticket #25239: 25239.6.patch

File 25239.6.patch, 4.1 KB (added by desmith, 8 years ago)
  • wp-includes/link-template.php

    diff -ru wordpress.461/wp-includes/link-template.php wordpress/wp-includes/link-template.php
    old new  
    40264026         */
    40274027        return apply_filters( 'get_avatar_data', $args, $id_or_email );
    40284028}
     4029
     4030/**
     4031 * Retrieve the domain name for the current site, with leading www. stripped.
     4032 * Intended for use in sending emails.
     4033 *
     4034 * @since 4.7.0
     4035 *
     4036 * @return string Domain name for the current site, with leading www. stripped.
     4037 */
     4038function get_email_domain() {
     4039        $dom = parse_url( get_home_url( get_current_blog_id() ), PHP_URL_HOST );
     4040        $result = preg_replace( '#^www\.#', '', strtolower( $dom ));
     4041        /**
     4042         * Filters the email domain name.
     4043         *
     4044         * @since 4.7.0
     4045         *
     4046         * @param string $result   Email domain.
     4047         */
     4048        return apply_filters( 'get_email_domain', $result );
     4049}
  • wp-includes/ms-functions.php

    diff -ru wordpress.461/wp-includes/ms-functions.php wordpress/wp-includes/ms-functions.php
    old new  
    797797        $activate_url = esc_url($activate_url);
    798798        $admin_email = get_site_option( 'admin_email' );
    799799        if ( $admin_email == '' )
    800                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     800                $admin_email = 'support@' . get_email_domain();
    801801        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    802802        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    803803        $message = sprintf(
     
    890890        // Send email with activation link.
    891891        $admin_email = get_site_option( 'admin_email' );
    892892        if ( $admin_email == '' )
    893                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     893                $admin_email = 'support@' . get_email_domain();
    894894        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    895895        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    896896        $message = sprintf(
     
    14921492        $admin_email = get_site_option( 'admin_email' );
    14931493
    14941494        if ( $admin_email == '' )
    1495                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1495                $admin_email = 'support@' . get_email_domain();
    14961496
    14971497        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    14981498        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
     
    15701570        $admin_email = get_site_option( 'admin_email' );
    15711571
    15721572        if ( $admin_email == '' )
    1573                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1573                $admin_email = 'support@' . get_email_domain();
    15741574
    15751575        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    15761576        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
  • wp-includes/pluggable.php

    diff -ru wordpress.461/wp-includes/pluggable.php wordpress/wp-includes/pluggable.php
    old new  
    322322         */
    323323
    324324        if ( !isset( $from_email ) ) {
    325                 // Get the site domain and get rid of www.
    326                 $sitename = strtolower( $_SERVER['SERVER_NAME'] );
    327                 if ( substr( $sitename, 0, 4 ) == 'www.' ) {
    328                         $sitename = substr( $sitename, 4 );
    329                 }
    330 
    331                 $from_email = 'wordpress@' . $sitename;
     325                $from_email = 'wordpress@' . get_email_domain();
    332326        }
    333327
    334328        /**
     
    14661460                $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
    14671461        }
    14681462
    1469         $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
     1463        $wp_email = 'wordpress@' . get_email_domain();
    14701464
    14711465        if ( '' == $comment->comment_author ) {
    14721466                $from = "From: \"$blogname\" <$wp_email>";