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


PHP rcube_mime::wordwrap方法代码示例

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


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

示例1: rc_wordwrap

function rc_wordwrap($string, $width = 75, $break = "\n", $cut = false, $charset = null)
{
    return rcube_mime::wordwrap($string, $width, $break, $cut, $charset);
}
开发者ID:noikiy,项目名称:roundcubemail,代码行数:4,代码来源:bc.php

示例2: sign_message

 /**
  * Handler for message signing
  *
  * @param Mail_mime Original message
  * @param int       Encryption mode
  *
  * @return enigma_error On error returns error object
  */
 function sign_message(&$message, $mode = null)
 {
     $mime = new enigma_mime_message($message, enigma_mime_message::PGP_SIGNED);
     $from = $mime->getFromAddress();
     // find private key
     $key = $this->find_key($from, true);
     if (empty($key)) {
         return new enigma_error(enigma_error::KEYNOTFOUND);
     }
     // check if we have password for this key
     $passwords = $this->get_passwords();
     $pass = $passwords[$key->id];
     if ($pass === null) {
         // ask for password
         $error = array('missing' => array($key->id => $key->name));
         return new enigma_error(enigma_error::BADPASS, '', $error);
     }
     $key->password = $pass;
     // select mode
     switch ($mode) {
         case self::SIGN_MODE_BODY:
             $pgp_mode = Crypt_GPG::SIGN_MODE_CLEAR;
             break;
         case self::SIGN_MODE_MIME:
             $pgp_mode = Crypt_GPG::SIGN_MODE_DETACHED;
             break;
             /*
                     case self::SIGN_MODE_SEPARATE:
                         $pgp_mode = Crypt_GPG::SIGN_MODE_NORMAL;
                         break;
             */
         /*
                 case self::SIGN_MODE_SEPARATE:
                     $pgp_mode = Crypt_GPG::SIGN_MODE_NORMAL;
                     break;
         */
         default:
             if ($mime->isMultipart()) {
                 $pgp_mode = Crypt_GPG::SIGN_MODE_DETACHED;
             } else {
                 $pgp_mode = Crypt_GPG::SIGN_MODE_CLEAR;
             }
     }
     // get message body
     if ($pgp_mode == Crypt_GPG::SIGN_MODE_CLEAR) {
         // in this mode we'll replace text part
         // with the one containing signature
         $body = $message->getTXTBody();
         $text_charset = $message->getParam('text_charset');
         $line_length = $this->rc->config->get('line_length', 72);
         // We can't use format=flowed for signed messages
         if (strpos($text_charset, 'format=flowed')) {
             list($charset, $params) = explode(';', $text_charset);
             $body = rcube_mime::unfold_flowed($body);
             $body = rcube_mime::wordwrap($body, $line_length, "\r\n", false, $charset);
             $text_charset = str_replace(";\r\n format=flowed", '', $text_charset);
         }
     } else {
         // here we'll build PGP/MIME message
         $body = $mime->getOrigBody();
     }
     // sign the body
     $result = $this->pgp_sign($body, $key, $pgp_mode);
     if ($result !== true) {
         if ($result->getCode() == enigma_error::BADPASS) {
             // ask for password
             $error = array('bad' => array($key->id => $key->name));
             return new enigma_error(enigma_error::BADPASS, '', $error);
         }
         return $result;
     }
     // replace message body
     if ($pgp_mode == Crypt_GPG::SIGN_MODE_CLEAR) {
         $message->setTXTBody($body);
         $message->setParam('text_charset', $text_charset);
     } else {
         $mime->addPGPSignature($body);
         $message = $mime;
     }
 }
开发者ID:jimjag,项目名称:roundcubemail,代码行数:88,代码来源:enigma_engine.php

示例3: rcmail_wrap_and_quote

 function rcmail_wrap_and_quote($text, $length = 72)
 {
     // Rebuild the message body with a maximum of $max chars, while keeping quoted message.
     $max = max(75, $length + 8);
     $lines = preg_split('/\\r?\\n/', trim($text));
     $out = '';
     foreach ($lines as $line) {
         // don't wrap already quoted lines
         if ($line[0] == '>') {
             $line = '>' . rtrim($line);
         } else {
             if (mb_strlen($line) > $max) {
                 $newline = '';
                 foreach (explode("\n", rcube_mime::wordwrap($line, $length - 2)) as $l) {
                     if (strlen($l)) {
                         $newline .= '> ' . $l . "\n";
                     } else {
                         $newline .= ">\n";
                     }
                 }
                 $line = rtrim($newline);
             } else {
                 $line = '> ' . $line;
             }
         }
         // Append the line
         $out .= $line . "\n";
     }
     return rtrim($out, "\n");
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:30,代码来源:yetiforce.php

示例4: rc_wordwrap

function rc_wordwrap($string, $width = 75, $break = "\n", $cut = false, $charset = null)
{
    _deprecation_warning(__FUNCTION__);
    return rcube_mime::wordwrap($string, $width, $break, $cut, $charset);
}
开发者ID:JotapePinheiro,项目名称:roundcubemail,代码行数:5,代码来源:bc.php


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