⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 message.php

📁 一、修改产品详细页面的附件块 二、添加上浏览历史模块 三、在后台加入自定义首页、自定义页头、自定义页脚内容功能 四、在后台修改网站全局CSS样式文件功能 五、在后台修改每个模块的模板内容功能
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/** * Swift Mailer Message Component * Composes MIME 1.0 messages meeting various RFC standards * Deals with attachments, embedded images, multipart bodies, forwarded messages... * Please read the LICENSE file * @copyright Chris Corbyn <chris@w3style.co.uk> * @author Chris Corbyn <chris@w3style.co.uk> * @package Swift_Message * @license GNU Lesser General Public License */require_once dirname(__FILE__) . "/ClassLoader.php";Swift_ClassLoader::load("Swift_Address");Swift_ClassLoader::load("Swift_Message_Mime");Swift_ClassLoader::load("Swift_Message_Image");Swift_ClassLoader::load("Swift_Message_Part");/** * Swift Message class * @package Swift_Message * @author Chris Corbyn <chris@w3style.co.uk> */class Swift_Message extends Swift_Message_Mime{  /**   * Constant from a high priority message (pretty meaningless)   */  const PRIORITY_HIGH = 1;  /**   * Constant for a low priority message   */  const PRIORITY_LOW = 5;  /**   * Constant for a normal priority message   */  const PRIORITY_NORMAL = 3;  /**   * The MIME warning for client not supporting multipart content   * @var string   */  protected $mimeWarning = null;  /**   * References which point to the parent MIME documents of the various parts   * @var array   */  protected $parentRefs = array("alternative" => null, "mixed" => null, "related" => null);  /**   * Lists of references for all alternative parts   * @var array   */  protected $alternativeRefs = array();  /**   * List of references for all mixed parts   * @var array   */  protected $mixedRefs = array();  /**   * List of references for all related parts   * @var array   */  protected $relatedRefs = array();  /**   * The version of the library (Swift) if known.   * @var string   */  protected $libVersion = "";    public function __construct($subject="", $body=null, $type="text/plain", $encoding=null, $charset=null)  {    parent::__construct();    if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get"))    {      date_default_timezone_set(@date_default_timezone_get());    }    $this->setReturnPath(null);    $this->setTo("");    $this->setFrom("");    $this->setCc(null);    $this->setBcc(null);    $this->setReplyTo(null);    $this->setSubject($subject);    $this->setDate(time());    if (defined("Swift::VERSION"))    {      $this->libVersion = Swift::VERSION;      $this->headers->set("X-LibVersion", $this->libVersion);    }    $this->headers->set("MIME-Version", "1.0");    $this->setContentType($type);	    $this->setCharset($charset);    $this->setFlowed(true);    $this->setEncoding($encoding);        foreach (array_keys($this->parentRefs) as $key)    {      $this->parentRefs[$key] = $this;    }        $this->setMimeWarning(    "This is a message in multipart MIME format.  Your mail client should not be displaying this. " .    "Consider upgrading your mail client to view this message correctly."    );        if ($body !== null)    {      $this->setData($body);      if ($charset === null)      {        Swift_ClassLoader::load("Swift_Message_Encoder");        if (Swift_Message_Encoder::instance()->isUTF8($body)) $this->setCharset("utf-8");        else $this->setCharset("iso-8859-1");      }    }  }  /**   * Get the level in the MIME hierarchy at which this section should appear.   * @return string   */  public function getLevel()  {    return Swift_Message_Mime::LEVEL_TOP;  }  /**   * Set the message id literally.   * Unless you know what you are doing you should be using generateId() rather than this method,   * otherwise you may break compliancy with RFC 2822.   * @param string The message ID string.   */  public function setId($id)  {    $this->headers->set("Message-ID", $id);  }  /**   * Create a RFC 2822 compliant message id, optionally based upon $idstring.   * The message ID includes information about the current time, the server and some random characters.   * @param string An optional string the base the ID on   * @return string The generated message ID, including the <> quotes.   * @author Cristian Rodriguez <judas.iscariote@flyspray.org>   */  public function generateId($idstring=null)  {    $midparams =  array(      "utctime" => gmstrftime("%Y%m%d%H%M%S"),      "pid" => getmypid(),      "randint" => mt_rand(),      "customstr" => (preg_match("/^(?<!\\.)[a-z0-9\\.]+(?!\\.)\$/iD", $idstring) ? $idstring : "swift") ,      "hostname" => (isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : php_uname("n")),    );    $this->setId(vsprintf("<%s.%d.%d.%s@%s>", $midparams));    return $this->getId();  }  /**   * Get the generated message ID for this message, including the <> quotes.   * If generated automatically, or using generateId() this method returns a RFC2822 compliant Message-ID.   * @return string   * @author Cristian Rodriguez <judas.iscariote@flyspray.org>   */  public function getId()  {    return $this->headers->has("Message-ID") ? $this->headers->get("Message-ID") : null;  }  /**   * Set the address in the Return-Path: header   * @param string The bounce-detect address   */  public function setReturnPath($address)  {    if ($address instanceof Swift_Address) $address = $address->build(true);    $this->headers->set("Return-Path", $address);  }  /**   * Return the address used in the Return-Path: header   * @return string   * @param boolean Return the address for SMTP command   */  public function getReturnPath($smtp=false)  {    if ($this->headers->has("Return-Path"))    {      if (!$smtp) return $this->headers->get("Return-Path");      else      {        $path = $this->headers->get("Return-Path");        if (strpos($path, ">") > strpos($path, "<")) return substr($path, ($start = strpos($path, "<")), ($start + strrpos($path, ">") + 1));        else return "<" . $path . ">";      }    }  }  /**   * Set the address in the From: header   * @param string The address to set as From   */  public function setFrom($from)  {    if ($from instanceof Swift_Address) $from = $from->build();    $this->headers->set("From", $from);  }  /**   * Get the address used in the From: header   * @return string   */  public function getFrom()  {    if ($this->headers->has("From")) return $this->headers->get("From");  }  /**   * Set the list of recipients in the To: header   * @param mixed An array or a string   */  public function setTo($to)  {    if ($to)    {      if (!is_array($to)) $to = array($to);      foreach ($to as $key => $value)      {        if ($value instanceof Swift_Address) $to[$key] = $value->build();      }    }    $this->headers->set("To", $to);  }  /**   * Return the list of recipients in the To: header   * @return array   */  public function getTo()  {    if ($this->headers->has("To"))    {      $to = $this->headers->get("To");      if ($to == "") return array();      else return (array) $to;    }  }  /**   * Set the list of recipients in the Reply-To: header   * @param mixed An array or a string   */  public function setReplyTo($replyto)  {    if ($replyto)    {      if (!is_array($replyto)) $replyto = array($replyto);      foreach ($replyto as $key => $value)      {        if ($value instanceof Swift_Address) $replyto[$key] = $value->build();      }    }    $this->headers->set("Reply-To", $replyto);  }  /**   * Return the list of recipients in the Reply-To: header   * @return array   */  public function getReplyTo()  {    if ($this->headers->has("Reply-To"))    {      $reply_to = $this->headers->get("Reply-To");      if ($reply_to == "") return array();      else return (array) $reply_to;    }  }  /**   * Set the list of recipients in the Cc: header   * @param mixed An array or a string   */  public function setCc($cc)  {    if ($cc)    {      if (!is_array($cc)) $cc = array($cc);      foreach ($cc as $key => $value)      {        if ($value instanceof Swift_Address) $cc[$key] = $value->build();      }    }    $this->headers->set("Cc", $cc);  }  /**   * Return the list of recipients in the Cc: header   * @return array   */  public function getCc()  {    if ($this->headers->has("Cc"))    {      $cc = $this->headers->get("Cc");      if ($cc == "") return array();      else return (array) $cc;    }  }  /**   * Set the list of recipients in the Bcc: header   * @param mixed An array or a string   */  public function setBcc($bcc)  {    if ($bcc)    {      if (!is_array($bcc)) $bcc = array($bcc);      foreach ($bcc as $key => $value)      {        if ($value instanceof Swift_Address) $bcc[$key] = $value->build();      }    }    $this->headers->set("Bcc", $bcc);  }  /**   * Return the list of recipients in the Bcc: header   * @return array   */  public function getBcc()  {    if ($this->headers->has("Bcc"))    {      $bcc = $this->headers->get("Bcc");      if ($bcc == "") return array();      else return (array) $bcc;    }  }  /**   * Set the subject in the headers   * @param string The subject of the email   */  public function setSubject($subject)  {    $this->headers->set("Subject", $subject);  }  /**   * Get the current subject used in the headers   * @return string   */  public function getSubject()  {    return $this->headers->get("Subject");  }  /**   * Set the date in the headers in RFC 2822 format   * @param int The time as a UNIX timestamp   */  public function setDate($date)  {    $this->headers->set("Date", date("r", $date));  }  /**   * Get the date as it looks in the headers   * @return string   */  public function getDate()  {    return strtotime($this->headers->get("Date"));  }  /**   * Set the charset of the document   * @param string The charset used   */  public function setCharset($charset)  {    $this->headers->setAttribute("Content-Type", "charset", $charset);    if (($this->getEncoding() == "7bit") && (strtolower($charset) == "utf-8" || strtolower($charset) == "utf8")) $this->setEncoding("8bit");  }  /**   * Get the charset used in the document   * Returns null if none is set   * @return string   */  public function getCharset()  {    if ($this->headers->hasAttribute("Content-Type", "charset"))    {      return $this->headers->getAttribute("Content-Type", "charset");    }    else    {      return null;    }  }  /**   * Set the "format" attribute to flowed   * @param boolean On or Off   */  public function setFlowed($flowed=true)  {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -