$this->_htmlBody->setCharset($charset);
$this->_htmlBody->setContents($body);
if ($alternative) {
- $this->setBody(Horde_Text_Filter::filter($body, 'html2text', array('wrap' => false)), $charset);
+ $this->setBody(Horde_Text_Filter::filter($body, 'Html2text', array('wrap' => false)), $charset);
}
}
* Parameters:
* <pre>
* charset - (string) The charset to use for html_entity_decode() calls.
- * width - (integer) The wrapping width.
- * wrap - (boolean) Whether to wrap the text or not.
+ * width - (integer) The wrapping width. Set to 0 to not wrap.
* </pre>
*
* Copyright 2004-2010 The Horde Project (http://www.horde.org/)
*/
protected $_params = array(
'charset' => 'UTF-8',
- 'width' => 70,
- 'wrap' => true
+ 'width' => 75
);
/**
$text = preg_replace(array("/\s*\n{3,}/", "/ +\n/"), array("\n\n", "\n"), $text);
/* Wrap the text to a readable format. */
- if ($this->_params['wrap']) {
+ if ($this->_params['width']) {
$text = wordwrap($text, $this->_params['width']);
}
continue;
}
- if ($this->_params['wrap']) {
+ if ($this->_params['width']) {
$tmp = array();
foreach (explode("\n", $val['text']) as $val2) {
$tmp = array_merge($tmp, explode("\n", wordwrap($val2, $this->_params['width'] - (2 * $val['level']))));
require dirname(__FILE__) . '/../../../../lib/Horde/Text/Filter/Base.php';
require dirname(__FILE__) . '/../../../../lib/Horde/Text/Filter/Html2text.php';
$html = file_get_contents(dirname(__FILE__) . '/fixtures/html2text.html');
-echo Horde_Text_Filter::filter($html, 'html2text', array('charset' => 'UTF-8'));
+echo Horde_Text_Filter::filter($html, 'Html2text', array('charset' => 'UTF-8'));
?>
--EXPECT--
</ul>
EOT;
-echo Horde_Text_Filter::filter($html, 'html2text', array('width' => 50));
+echo Horde_Text_Filter::filter($html, 'Html2text', array('wrap' => 50));
echo "\n\n";
-echo Horde_Text_Filter::filter($html, 'html2text', array('wrap' => false));
+echo Horde_Text_Filter::filter($html, 'Html2text', array('wrap' => false));
?>
--EXPECT--
array('<p> </p>', '<p><!--begin_signature-->' . $imp_compose->text2html($sig) . '<!--end_signature--></p>'),
$msg);
} else {
- $msg = Horde_Text_Filter::filter($msg, 'html2text', array('charset' => Horde_Nls::getCharset(), 'wrap' => false));
+ $msg = Horde_Text_Filter::filter($msg, 'Html2text', array('charset' => Horde_Nls::getCharset(), 'wrap' => false));
}
}
$result = new stdClass;
// Need to replace line endings or else IE won't display line endings
// properly.
- $result->text = str_replace("\n", "\r\n", Horde_Text_Filter::filter($this->_vars->text, 'html2text', array('charset' => Horde_Nls::getCharset(), 'wrap' => false)));
+ $result->text = str_replace("\n", "\r\n", Horde_Text_Filter::filter($this->_vars->text, 'Html2text', array('charset' => Horde_Nls::getCharset())));
return $result;
}
if (!empty($options['html'])) {
$body_html = $body;
- $body = Horde_Text_Filter::filter($body, 'html2text', array('wrap' => false, 'charset' => $charset));
+ $body = Horde_Text_Filter::filter($body, 'Html2text', array('wrap' => false, 'charset' => $charset));
}
/* Get trailer message (if any). */
$ptext = $pmime->getContents();
$ptext = Horde_String::convertCharset($ptext, $pmime->getCharset());
if ($pmime->getType() == 'text/html') {
- $ptext = Horde_Text_Filter::filter($ptext, 'html2text', array('charset' => Horde_Nls::getCharset()));
+ $ptext = Horde_Text_Filter::filter($ptext, 'Html2text', array('charset' => Horde_Nls::getCharset()));
}
$this->_build = $oldbuild;
* text. */
if (($_SESSION['imp']['view'] == 'mimp') ||
(!$inline && Horde_Util::getFormData('convert_text'))) {
- $data = Horde_Text_Filter::filter($data, 'html2text', array('charset' => Horde_Nls::getCharset(), 'wrap' => false));
+ $data = Horde_Text_Filter::filter($data, 'Html2text', array('charset' => Horde_Nls::getCharset(), 'wrap' => false));
// Filter bad language.
return array(
$type = Horde_Util::getFormData('type', 'plain');
if (!empty($last_type) && $last_type != $type) {
$content = ($type == 'plain')
- ? Horde_Text_Filter::filter($content, 'html2text', array('charset' => Horde_Nls::getCharset()))
+ ? Horde_Text_Filter::filter($content, 'Html2text', array('charset' => Horde_Nls::getCharset()))
: nl2br(htmlspecialchars(htmlspecialchars($content)));
}
$stationery = array('n' => $name, 't' => $type, 'c' => $content);