예제 #1
0
파일: Part.php 프로젝트: x59/horde-mime
 /**
  * Encodes the contents of the part as necessary for transport.
  *
  * @param resource $fp      A stream containing the data to encode.
  * @param string $encoding  The encoding to use.
  *
  * @return resource  A new file resource with the encoded data.
  */
 protected function _transferEncode($fp, $encoding)
 {
     $this->_temp['transferEncodeClose'] = true;
     switch ($encoding) {
         case 'base64':
             /* Base64 Encoding: See RFC 2045, section 6.8 */
             return $this->_writeStream($fp, array('filter' => array('convert.base64-encode' => array('line-break-chars' => $this->getEOL(), 'line-length' => 76))));
         case 'quoted-printable':
             // PHP Bug 65776 - Must normalize the EOL characters.
             stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol');
             $stream = new Horde_Stream_Existing(array('stream' => $fp));
             $stream->stream = $this->_writeStream($stream->stream, array('filter' => array('horde_eol' => array('eol' => $stream->getEOL()))));
             /* Quoted-Printable Encoding: See RFC 2045, section 6.7 */
             return $this->_writeStream($fp, array('filter' => array('convert.quoted-printable-encode' => array_filter(array('line-break-chars' => $stream->getEOL(), 'line-length' => 76)))));
         default:
             $this->_temp['transferEncodeClose'] = false;
             return $fp;
     }
 }
예제 #2
0
파일: Part.php 프로젝트: evltuma/moodle
 /**
  * Encodes the contents of the part as necessary for transport.
  *
  * @param resource $fp      A stream containing the data to encode.
  * @param string $encoding  The encoding to use.
  *
  * @return resource  A new file resource with the encoded data.
  */
 protected function _transferEncode($fp, $encoding)
 {
     $this->_temp['transferEncodeClose'] = true;
     switch ($encoding) {
         case 'base64':
             /* Base64 Encoding: See RFC 2045, section 6.8 */
             return $this->_writeStream($fp, array('filter' => array('convert.base64-encode' => array('line-break-chars' => $this->getEOL(), 'line-length' => 76))));
         case 'quoted-printable':
             $stream = new Horde_Stream_Existing(array('stream' => $fp));
             /* Quoted-Printable Encoding: See RFC 2045, section 6.7 */
             return $this->_writeStream($fp, array('filter' => array('convert.quoted-printable-encode' => array_filter(array('line-break-chars' => $stream->getEOL(), 'line-length' => 76)))));
         default:
             $this->_temp['transferEncodeClose'] = false;
             return $fp;
     }
 }