protected function Html2Text::converter in Swift Mailer 7
2 calls to Html2Text::converter()
- Html2Text::convert in includes/
classes/ Html2Text.inc - Html2Text::convertBlockquotes in includes/
classes/ Html2Text.inc - Helper function for BLOCKQUOTE body conversion.
File
- includes/
classes/ Html2Text.inc, line 347
Class
Code
protected function converter(&$text) {
$this
->convertBlockquotes($text);
$this
->convertPre($text);
$text = preg_replace($this->search, $this->replace, $text);
$text = preg_replace_callback($this->callbackSearch, array(
$this,
'pregCallback',
), $text);
$text = strip_tags($text);
$text = preg_replace($this->entSearch, $this->entReplace, $text);
$text = html_entity_decode($text, ENT_QUOTES, self::ENCODING);
// Remove unknown/unhandled entities (this cannot be done in search-and-replace block)
$text = preg_replace('/&([a-zA-Z0-9]{2,6}|#[0-9]{2,4});/', '', $text);
// Convert "|+|amp|+|" into "&", need to be done after handling of unknown entities
// This properly handles situation of """ in input string
$text = str_replace('|+|amp|+|', '&', $text);
// Normalise empty lines
$text = preg_replace("/\n\\s+\n/", "\n\n", $text);
$text = preg_replace("/[\n]{3,}/", "\n\n", $text);
// remove leading empty lines (can be produced by eg. P tag on the beginning)
$text = ltrim($text, "\n");
if ($this->options['width'] > 0) {
$text = wordwrap($text, $this->options['width']);
}
}