当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Mime_Part::setHeaderCharset方法代码示例

本文整理汇总了PHP中Horde_Mime_Part::setHeaderCharset方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Part::setHeaderCharset方法的具体用法?PHP Horde_Mime_Part::setHeaderCharset怎么用?PHP Horde_Mime_Part::setHeaderCharset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Mime_Part的用法示例。


在下文中一共展示了Horde_Mime_Part::setHeaderCharset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createMimePart

 /**
  * Generates a Horde_Mime_Part object, in accordance with RFC 3156, that
  * contains a public key.
  *
  * @return Horde_Mime_Part  Object that contains the armored public key.
  */
 public function createMimePart()
 {
     $part = new Horde_Mime_Part();
     $part->setType('application/pgp-keys');
     $part->setHeaderCharset('UTF-8');
     $part->setDescription(Horde_Pgp_Translation::t("PGP Public Key"));
     $part->setContents(strval($this), array('encoding' => '7bit'));
     return $part;
 }
开发者ID:horde,项目名称:horde,代码行数:15,代码来源:PublicKey.php

示例2: publicKeyPart

 /**
  * Generate a Horde_Mime_Part object that contains a public key (RFC
  * 3156 [7]).
  *
  * @param mixed $key  The public key.
  *
  * @return Horde_Mime_Part  An object that contains the public key.
  */
 public function publicKeyPart($key)
 {
     $key = Horde_Pgp_Element_PublicKey::create($key);
     $part = new Horde_Mime_Part();
     $part->setType('application/pgp-keys');
     $part->setHeaderCharset('UTF-8');
     $part->setDescription(Horde_Crypt_Translation::t("PGP Public Key"));
     $part->setContents(strval($key), array('encoding' => '7bit'));
     return $part;
 }
开发者ID:horde,项目名称:horde,代码行数:18,代码来源:Mime.php

示例3: publicKeyMIMEPart

 /**
  * Generates a Horde_Mime_Part object, in accordance with RFC 3156, that
  * contains a public key.
  *
  * @param string $key  The public key.
  *
  * @return Horde_Mime_Part  An object that contains the public key.
  */
 public function publicKeyMIMEPart($key)
 {
     $part = new Horde_Mime_Part();
     $part->setType('application/pgp-keys');
     $part->setHeaderCharset('UTF-8');
     $part->setDescription(Horde_Crypt_Translation::t("PGP Public Key"));
     $part->setContents($key, array('encoding' => '7bit'));
     return $part;
 }
开发者ID:horde,项目名称:horde,代码行数:17,代码来源:Pgp.php

示例4: encryptMIMEPart

 /**
  * Encrypt a MIME part using S/MIME. This produces S/MIME Version 3.2
  * compatible data (see RFC 5751 [3.3]).
  *
  * @param Horde_Mime_Part $mime_part  The object to encrypt.
  * @param array $params               The parameters required for
  *                                    encryption.
  *
  * @return Horde_Mime_Part  An encrypted MIME part object.
  * @throws Horde_Crypt_Exception
  */
 public function encryptMIMEPart($mime_part, $params = array())
 {
     /* Sign the part as a message */
     $message = $this->encrypt($mime_part->toString(array('headers' => true, 'canonical' => true)), $params);
     $msg = new Horde_Mime_Part();
     $msg->setCharset($this->_params['email_charset']);
     $msg->setHeaderCharset('UTF-8');
     $msg->setDescription(Horde_Crypt_Translation::t("S/MIME Encrypted Message"));
     $msg->setDisposition('inline');
     $msg->setType('application/pkcs7-mime');
     $msg->setContentTypeParameter('smime-type', 'enveloped-data');
     $msg->setContents(substr($message, strpos($message, "\n\n") + 2), array('encoding' => 'base64'));
     return $msg;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:25,代码来源:Smime.php

示例5: _addAttachment

 /**
  * Adds an attachment to the outgoing compose message.
  *
  * @param string $atc_file  Temporary file containing attachment contents.
  * @param integer $bytes    Size of data, in bytes.
  * @param string $filename  Filename of data.
  * @param string $type      MIME type of data.
  *
  * @return IMP_Compose_Attachment  Attachment object.
  * @throws IMP_Compose_Exception
  */
 protected function _addAttachment($atc_file, $bytes, $filename, $type)
 {
     global $conf, $injector;
     $atc = new Horde_Mime_Part();
     $atc->setBytes($bytes);
     /* Try to determine the MIME type from 1) the extension and
      * then 2) analysis of the file (if available). */
     if (strlen($filename)) {
         $atc->setName($filename);
         if ($type == 'application/octet-stream') {
             $type = Horde_Mime_Magic::filenameToMIME($filename, false);
         }
     }
     $atc->setType($type);
     if ($atc->getType() == 'application/octet-stream' || $atc->getPrimaryType() == 'text') {
         $analyze = Horde_Mime_Magic::analyzeFile($atc_file, empty($conf['mime']['magic_db']) ? null : $conf['mime']['magic_db'], array('nostrip' => true));
         $atc->setCharset('UTF-8');
         if ($analyze) {
             $ctype = new Horde_Mime_Headers_ContentParam('Content-Type', $analyze);
             $atc->setType($ctype->value);
             if (isset($ctype->params['charset'])) {
                 $atc->setCharset($ctype->params['charset']);
             }
         }
     } else {
         $atc->setHeaderCharset('UTF-8');
     }
     $atc_ob = new IMP_Compose_Attachment($this, $atc, $atc_file);
     /* Check for attachment size limitations. */
     $size_limit = null;
     if ($atc_ob->linked) {
         if (!empty($conf['compose']['link_attach_size_limit'])) {
             $linked = true;
             $size_limit = 'link_attach_size_limit';
         }
     } elseif (!empty($conf['compose']['attach_size_limit'])) {
         $linked = false;
         $size_limit = 'attach_size_limit';
     }
     if (!is_null($size_limit)) {
         $total_size = $conf['compose'][$size_limit] - $bytes;
         foreach ($this as $val) {
             if ($val->linked == $linked) {
                 $total_size -= $val->getPart()->getBytes();
             }
         }
         if ($total_size < 0) {
             throw new IMP_Compose_Exception(strlen($filename) ? sprintf(_("Attached file \"%s\" exceeds the attachment size limits. File NOT attached."), $filename) : _("Attached file exceeds the attachment size limits. File NOT attached."));
         }
     }
     try {
         $injector->getInstance('Horde_Core_Hooks')->callHook('compose_attachment', 'imp', array($atc_ob));
     } catch (Horde_Exception_HookNotSet $e) {
     }
     $this->_atc[$atc_ob->id] = $atc_ob;
     $this->changed = 'changed';
     return $atc_ob;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:69,代码来源:Compose.php


注:本文中的Horde_Mime_Part::setHeaderCharset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。