1 <?php 2 /** 3 * Copyright 2014-2017 Horde LLC (http://www.horde.org/) 4 * 5 * See the enclosed file LICENSE for license information (LGPL). If you 6 * did not receive this file, see http://www.horde.org/licenses/lgpl21. 7 * 8 * @category Horde 9 * @copyright 2014-2017 Horde LLC 10 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 11 * @package Mime 12 */ 13 14 /** 15 * Quoted-printable utility methods. 16 * 17 * @author Michael Slusarz <slusarz@horde.org> 18 * @category Horde 19 * @copyright 2014-2017 Horde LLC 20 * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 21 * @package Mime 22 * @since 2.5.0 23 */ 24 class Horde_Mime_QuotedPrintable 25 { 26 /** 27 * Decodes quoted-printable data. 28 * 29 * @param string $data The Q-P data to decode. 30 * 31 * @return string The decoded text. 32 */ 33 public static function decode($data) 34 { 35 return quoted_printable_decode($data); 36 } 37 38 /** 39 * Encodes text via quoted-printable encoding. 40 * 41 * @param string $text The text to encode (UTF-8). 42 * @param string $eol The EOL sequence to use. 43 * @param integer $wrap Wrap a line at this many characters. 44 * 45 * @return string The quoted-printable encoded string. 46 */ 47 public static function encode($text, $eol = "\n", $wrap = 76) 48 { 49 $fp = fopen('php://temp', 'r+'); 50 stream_filter_append( 51 $fp, 52 'convert.quoted-printable-encode', 53 STREAM_FILTER_WRITE, 54 array( 55 'line-break-chars' => $eol, 56 'line-length' => $wrap 57 ) 58 ); 59 fwrite($fp, $text); 60 rewind($fp); 61 $out = stream_get_contents($fp); 62 fclose($fp); 63 64 return $out; 65 } 66 67 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body