Make WordPress Core

Ticket #37210: class.phpmailer_5.2.14.diff

File class.phpmailer_5.2.14.diff, 4.1 KB (added by sfpt, 9 years ago)

Diff between upstream and wordpress for class-phpmailer

  • /home/sergio/workspace/

    old new  
    943943            }
    944944        }
    945945        return false;
    946     }
    947 
    948     /**
    949      * Parse and validate a string containing one or more RFC822-style comma-separated email addresses
    950      * of the form "display name <address>" into an array of name/address pairs.
    951      * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available.
    952      * Note that quotes in the name part are removed.
    953      * @param string $addrstr The address list string
    954      * @param bool $useimap Whether to use the IMAP extension to parse the list
    955      * @return array
    956      * @link http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
    957      */
    958     public function parseAddresses($addrstr, $useimap = true)
    959     {
    960         $addresses = array();
    961         if ($useimap and function_exists('imap_rfc822_parse_adrlist')) {
    962             //Use this built-in parser if it's available
    963             $list = imap_rfc822_parse_adrlist($addrstr, '');
    964             foreach ($list as $address) {
    965                 if ($address->host != '.SYNTAX-ERROR.') {
    966                     if ($this->validateAddress($address->mailbox . '@' . $address->host)) {
    967                         $addresses[] = array(
    968                             'name' => (property_exists($address, 'personal') ? $address->personal : ''),
    969                             'address' => $address->mailbox . '@' . $address->host
    970                         );
    971                     }
    972                 }
    973             }
    974         } else {
    975             //Use this simpler parser
    976             $list = explode(',', $addrstr);
    977             foreach ($list as $address) {
    978                 $address = trim($address);
    979                 //Is there a separate name part?
    980                 if (strpos($address, '<') === false) {
    981                     //No separate name, just use the whole thing
    982                     if ($this->validateAddress($address)) {
    983                         $addresses[] = array(
    984                             'name' => '',
    985                             'address' => $address
    986                         );
    987                     }
    988                 } else {
    989                     list($name, $email) = explode('<', $address);
    990                     $email = trim(str_replace('>', '', $email));
    991                     if ($this->validateAddress($email)) {
    992                         $addresses[] = array(
    993                             'name' => trim(str_replace(array('"', "'"), '', $name)),
    994                             'address' => $email
    995                         );
    996                     }
    997                 }
    998             }
    999         }
    1000         return $addresses;
    1001946    }
    1002947
    1003948    /**
     
    14751420    public function getSMTPInstance()
    14761421    {
    14771422        if (!is_object($this->smtp)) {
     1423                        require_once( 'class-smtp.php' );
    14781424            $this->smtp = new SMTP;
    14791425        }
    14801426        return $this->smtp;
     
    21762122        }
    21772123        //If lines are too long, and we're not already using an encoding that will shorten them,
    21782124        //change to quoted-printable transfer encoding for the body part only
    2179         if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) {
     2125        if (self::hasLineLongerThanMax($this->Body)) {
    21802126            $bodyEncoding = 'quoted-printable';
    21812127        }
    21822128
    21832129        $altBodyEncoding = $this->Encoding;
    21842130        $altBodyCharSet = $this->CharSet;
    2185         //Can we do a 7-bit downgrade?
     2131         //Can we do a 7-bit downgrade?
    21862132        if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
    21872133            $altBodyEncoding = '7bit';
    21882134            //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
    21892135            $altBodyCharSet = 'us-ascii';
    2190         }
     2136         }
    21912137        //If lines are too long, and we're not already using an encoding that will shorten them,
    21922138        //change to quoted-printable transfer encoding for the alt body part only
    21932139        if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) {