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

📄 headers.php

📁 一、修改产品详细页面的附件块 二、添加上浏览历史模块 三、在后台加入自定义首页、自定义页头、自定义页脚内容功能 四、在后台修改网站全局CSS样式文件功能 五、在后台修改每个模块的模板内容功能
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/** * Swift Mailer MIME Library Headers component * 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";/** * Contains and constructs the headers for a MIME document * @package Swift_Message * @author Chris Corbyn <chris@w3style.co.uk> */class Swift_Message_Headers{  /**   * Headers which may contain email addresses, and therefore should take notice when encoding   * @var array headers   */  protected $emailContainingHeaders = array(    "To", "From", "Reply-To", "Cc", "Bcc", "Return-Path", "Sender");  /**   * The encoding format used for the body of the document   * @var string format   */  protected $encoding = "Q";  /**   * The charset used in the headers   * @var string   */  protected $charset = false;  /**   * A collection of headers   * @var array headers   */  protected $headers = array();  /**   * A container of references to the headers   * @var array   */  protected $lowerHeaders = array();  /**   * Attributes appended to headers   * @var array   */  protected $attributes = array();  /**   * If QP or Base64 encoding should be forced   * @var boolean   */  protected $forceEncoding = false;  /**   * The language used in the headers (doesn't really matter much)   * @var string   */  protected $language = "en-us";  /**   * Cached, pre-built headers   * @var string   */  protected $cached = array();  /**   * The line ending used in the headers   * @var string   */  protected $LE = "\r\n";    /**   * Set the line ending character to use   * @param string The line ending sequence   * @return boolean   */  public function setLE($le)  {    if (in_array($le, array("\r", "\n", "\r\n")))    {      foreach (array_keys($this->cached) as $k) $this->cached[$k] = null;      $this->LE = $le;      return true;    }    else return false;  }  /**   * Get the line ending sequence   * @return string   */  public function getLE()  {    return $this->LE;  }  /**   * Reset the cache state in these headers   */  public function uncacheAll()  {    foreach (array_keys($this->cached) as $k)    {      $this->cached[$k] = null;    }  }  /**   * Add a header or change an existing header value   * @param string The header name, for example "From" or "Subject"   * @param string The value to be inserted into the header.  This is safe from header injection.   */  public function set($name, $value)  {    $lname = strtolower($name);    if (!isset($this->lowerHeaders[$lname]))    {      $this->headers[$name] = null;      $this->lowerHeaders[$lname] =& $this->headers[$name];    }    $this->cached[$lname] = null;    Swift_ClassLoader::load("Swift_Message_Encoder");    if (is_array($value))    {      foreach ($value as $v)      {        if (!$this->getCharset() && Swift_Message_Encoder::instance()->isUTF8($v))        {          $this->setCharset("utf-8");          break;        }      }    }    elseif ($value !== null)    {      if (!$this->getCharset() && Swift_Message_Encoder::instance()->isUTF8($value))      {        $this->setCharset("utf-8");      }    }    if (!is_array($value) && $value !== null) $this->lowerHeaders[$lname] = (string) $value;    else $this->lowerHeaders[$lname] = $value;  }  /**   * Get the value at a given header   * @param string The name of the header, for example "From" or "Subject"   * @return string   * @throws Swift_Message_MimeException If no such header exists   * @see hasHeader   */  public function get($name)  {    $lname = strtolower($name);    if ($this->has($name))    {      return $this->lowerHeaders[$lname];    }  }  /**   * Remove a header from the list   * @param string The name of the header   */  public function remove($name)  {    $lname = strtolower($name);    if ($this->has($name))    {      unset($this->headers[$name]);      unset($this->lowerHeaders[$lname]);      unset($this->cached[$lname]);      if (isset($this->attributes[$lname])) unset($this->attributes[$lname]);    }  }  /**   * Just fetch the array containing the headers   * @return array   */  public function getList()  {    return $this->headers;  }  /**   * Check if a header has been set or not   * @param string The name of the header, for example "From" or "Subject"   * @return boolean   */  public function has($name)  {    $lname = strtolower($name);    return (array_key_exists($lname, $this->lowerHeaders) && $this->lowerHeaders[$lname] !== null);  }  /**   * Set the language used in the headers to $lang (e.g. en-us, en-gb, sv etc)   * @param string The language to use   */  public function setLanguage($lang)  {    $this->language = (string) $lang;  }  /**   * Get the language used in the headers to $lang (e.g. en-us, en-gb, sv etc)   * @return string   */  public function getLanguage()  {    return $this->language;  }  /**   * Set the charset used in the headers   * @param string The charset name   */  public function setCharset($charset)  {    $this->charset = (string) $charset;  }  /**   * Get the current charset used   * @return string   */  public function getCharset()  {    return $this->charset;  }  /**   * Specify the encoding to use for the headers if characters outside the 7-bit-printable ascii range are found   * This encoding will never be used if only 7-bit-printable characters are found in the headers.   * Possible values are:   *  - QP   *  - Q   *  - Quoted-Printable   *  - B   *  - Base64   * NOTE: Q, QP, Quoted-Printable are all the same; as are B and Base64   * @param string The encoding format to use   * @return boolean   */  public function setEncoding($encoding)  {    switch (strtolower($encoding))    {      case "qp": case "q": case "quoted-printable":      $this->encoding = "Q";      return true;      case "base64": case "b":      $this->encoding = "B";      return true;      default: return false;    }  }  /**   * Get the encoding format used in this document   * @return string   */  public function getEncoding()  {    return $this->encoding;  }  /**   * Turn on or off forced header encoding   * @param boolean On/Off   */  public function forceEncoding($force=true)  {    $this->forceEncoding = (boolean) $force;  }  /**   * Set an attribute in a major header   * For example $headers->setAttribute("Content-Type", "format", "flowed")   * @param string The main header these values exist in   * @param string The name for this value   * @param string The value to set   * @throws Swift_Message_MimeException If no such header exists   */  public function setAttribute($header, $name, $value)  {    $name = strtolower($name);    $lheader = strtolower($header);    $this->cached[$lheader] = null;    if (!$this->has($header))    {      throw new Swift_Message_MimeException(      "Cannot set attribute '" . $name . "' for header '" . $header . "' as the header does not exist. " .      "Consider using Swift_Message_Headers-&gt;has() to check.");    }    else    {      Swift_ClassLoader::load("Swift_Message_Encoder");      if (!$this->getCharset() && Swift_Message_Encoder::instance()->isUTF8($value)) $this->setCharset("utf-8");      if (!isset($this->attributes[$lheader])) $this->attributes[$lheader] = array();

⌨️ 快捷键说明

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