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;
}
}