Small performance optimization

pull/5248/head
Aleksander Machniak 9 years ago
parent ca9ad75d96
commit afd090672c

@ -270,6 +270,10 @@ class rcube_text2html
if (empty($table)) {
$table = get_html_translation_table(HTML_SPECIALCHARS);
unset($table['?']);
// replace some whitespace characters
$table["\r"] = '';
$table["\t"] = ' ';
}
// skip signature separator
@ -277,12 +281,9 @@ class rcube_text2html
return '--' . $this->config['space'];
}
// replace HTML special characters
// replace HTML special and whitespace characters
$text = strtr($text, $table);
// replace some whitespace characters
$text = str_replace(array("\r", "\t"), array('', ' '), $text);
$nbsp = $this->config['space'];
// replace spaces with non-breaking spaces

@ -46,6 +46,7 @@ class Framework_Text2Html extends PHPUnit_Framework_TestCase
$data[] = array(">aaaa\n>aaaa", "<blockquote>aaaa<br>aaaa</blockquote>", $options);
$data[] = array(">aaaa \n>bbbb\ncccc dddd", "<blockquote>>aaaa_<<br>bbbb</blockquote>>cccc_dddd<", $options);
$data[] = array("aaaa-bbbb/cccc", ">aaaa-bbbb/cccc<", $options);
$data[] = array("aaaa-bbbb\r\tcccc", ">aaaa-bbbb____cccc<", $options);
$options['flowed'] = true;

Loading…
Cancel
Save