+ '/<(a) [^>]*href=("|\')([^"\']+)\2[^>]*>(.*?)<\/a>/i',
+ //
+ '/<(th)[^>]*>(.*?)<\/th>/i', // and |
+ );
+
@@ -468 +470,4 @@
-
+
+ // Replace known html entities
+ $text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
+
@@ -470,0 +476 @@
+ $text = preg_replace_callback($this->callback_search, array('html2text', '_preg_callback'), $text);
@@ -546 +552 @@
- $text = preg_replace('/]*>.*<\/pre>/ismU', '
' . $result . '
', $text);
+ $text = preg_replace('/]*>.*<\/pre>/ismU', '
' . $result . '
', $text, 1);
@@ -548,0 +555,38 @@
+
+ /**
+ * Callback function for preg_replace_callback use.
+ *
+ * @param array PREG matches
+ * @return string
+ * @access private
+ */
+ function _preg_callback($matches)
+ {
+ switch($matches[1])
+ {
+ case 'b':
+ case 'strong':
+ return $this->_strtoupper($matches[2]);
+ case 'hr':
+ return $this->_strtoupper("\t\t". $matches[2] ."\n");
+ case 'h':
+ return $this->_strtoupper("\n\n". $matches[2] ."\n\n");
+ case 'a':
+ return $this->_build_link_list($matches[3], $matches[4]);
+ }
+ }
+
+ /**
+ * Strtoupper multibyte wrapper function
+ *
+ * @param string
+ * @return string
+ * @access private
+ */
+ function _strtoupper($str)
+ {
+ if (function_exists('mb_strtoupper'))
+ return mb_strtoupper($str);
+ else
+ return strtoupper($str);
+ }