Make WordPress Core


Ignore:
Timestamp:
06/14/2007 02:25:30 AM (19 years ago)
Author:
ryan
Message:

Trim empty lines. Nothing but newline.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-phpmailer.php

    r5682 r5700  
    114114     */
    115115    var $Sendmail          = "/usr/sbin/sendmail";
    116    
     116
    117117    /**
    118118     * Path to PHPMailer plugins.  This is now only useful if the SMTP class
     
    223223    var $LE              = "\n";
    224224    /**#@-*/
    225    
     225
    226226    /////////////////////////////////////////////////
    227227    // VARIABLE METHODS
     
    383383        return $result;
    384384    }
    385    
     385
    386386    /**
    387387     * Sends mail using the $Sendmail program. 
     
    403403        fputs($mail, $header);
    404404        fputs($mail, $body);
    405        
     405
    406406        $result = pclose($mail) >> 8 & 0xFF;
    407407        if($result != 0)
     
    549549                else
    550550                    $this->smtp->Hello($this->ServerHostname());
    551        
     551
    552552                if($this->SMTPAuth)
    553553                {
     
    605605        }
    606606        $this->language = $PHPMAILER_LANG;
    607    
     607
    608608        return true;
    609609    }
     
    630630        return $addr_str;
    631631    }
    632    
     632
    633633    /**
    634634     * Formats an address correctly.
     
    727727        return $message;
    728728    }
    729    
     729
    730730    /**
    731731     * Set the body wrapping.
     
    736736        if($this->WordWrap < 1)
    737737            return;
    738            
     738
    739739        switch($this->message_type)
    740740        {
     
    757757    function CreateHeader() {
    758758        $result = "";
    759        
     759
    760760        // Set the boundaries
    761761        $uniq_id = md5(uniqid(time()));
     
    768768        else
    769769            $result .= $this->HeaderLine("Return-Path", trim($this->Sender));
    770        
     770
    771771        // To be created automatically by mail()
    772772        if($this->Mailer != "mail")
     
    798798        $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
    799799        $result .= $this->HeaderLine("X-Priority", $this->Priority);
    800        
     800
    801801        if($this->ConfirmReadingTo != "")
    802802        {
     
    866866                $result .= $this->GetBoundary($this->boundary[1], "",
    867867                                              "text/html", "");
    868                
     868
    869869                $result .= $this->EncodeString($this->Body, $this->Encoding);
    870870                $result .= $this->LE.$this->LE;
    871    
     871
    872872                $result .= $this->EndBoundary($this->boundary[1]);
    873873                break;
     
    879879                $result .= $this->EncodeString($this->Body, $this->Encoding);
    880880                $result .= $this->LE;
    881      
     881
    882882                $result .= $this->AttachAll();
    883883                break;
     
    888888                                   "multipart/alternative", $this->LE,
    889889                                   $this->boundary[2], $this->LE.$this->LE);
    890    
     890
    891891                // Create text body
    892892                $result .= $this->GetBoundary($this->boundary[2], "",
     
    895895                $result .= $this->EncodeString($this->AltBody, $this->Encoding);
    896896                $result .= $this->LE.$this->LE;
    897    
     897
    898898                // Create the HTML body
    899899                $result .= $this->GetBoundary($this->boundary[2], "",
    900900                                              "text/html", "") . $this->LE;
    901    
     901
    902902                $result .= $this->EncodeString($this->Body, $this->Encoding);
    903903                $result .= $this->LE.$this->LE;
    904904
    905905                $result .= $this->EndBoundary($this->boundary[2]);
    906                
     906
    907907                $result .= $this->AttachAll();
    908908                break;
     
    930930        $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding);
    931931        $result .= $this->LE;
    932        
     932
    933933        return $result;
    934934    }
    935    
     935
    936936    /**
    937937     * Returns the end of a message boundary.
     
    941941        return $this->LE . "--" . $boundary . "--" . $this->LE;
    942942    }
    943    
     943
    944944    /**
    945945     * Sets the message type.
     
    10441044            $disposition = $this->attachment[$i][6];
    10451045            $cid         = $this->attachment[$i][7];
    1046            
     1046
    10471047            $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
    10481048            $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
     
    10741074        return join("", $mime);
    10751075    }
    1076    
     1076
    10771077    /**
    10781078     * Encodes attachment in requested format.  Returns an
     
    11361136    function EncodeHeader ($str, $position = 'text') {
    11371137      $x = 0;
    1138      
     1138
    11391139      switch (strtolower($position)) {
    11401140        case 'phrase':
     
    11781178      $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
    11791179      $encoded = trim(str_replace("\n", $this->LE, $encoded));
    1180      
     1180
    11811181      return $encoded;
    11821182    }
    1183    
     1183
    11841184    /**
    11851185     * Encode string to quoted-printable. 
     
    12271227            break;
    12281228        }
    1229        
     1229
    12301230        // Replace every spaces to _ (more readable than =20)
    12311231        $encoded = str_replace(" ", "_", $encoded);
     
    12571257        $this->attachment[$cur][7] = 0;
    12581258    }
    1259    
     1259
    12601260    /**
    12611261     * Adds an embedded attachment.  This can include images, sounds, and
     
    12731273    function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64",
    12741274                              $type = "application/octet-stream") {
    1275    
     1275
    12761276        if(!@is_file($path))
    12771277        {
     
    12941294        $this->attachment[$cur][6] = "inline";
    12951295        $this->attachment[$cur][7] = $cid;
    1296    
     1296
    12971297        return true;
    12981298    }
    1299    
     1299
    13001300    /**
    13011301     * Returns true if an inline attachment is present.
     
    13131313            }
    13141314        }
    1315        
     1315
    13161316        return $result;
    13171317    }
     
    14111411        return $result;
    14121412    }
    1413    
     1413
    14141414    /**
    14151415     * Returns the appropriate server variable.  Should work with both
     
    14291429                $_SERVER = $HTTP_ENV_VARS; // must be Apache
    14301430        }
    1431        
     1431
    14321432        if(isset($_SERVER[$varName]))
    14331433            return $_SERVER[$varName];
     
    14601460        if(count($this->language) < 1)
    14611461            $this->SetLanguage("en"); // set the default language
    1462    
     1462
    14631463        if(isset($this->language[$key]))
    14641464            return $this->language[$key];
     
    14661466            return "Language string failed to load: " . $key;
    14671467    }
    1468    
     1468
    14691469    /**
    14701470     * Returns true if an error occurred.
Note: See TracChangeset for help on using the changeset viewer.