summaryrefslogtreecommitdiff
path: root/program/lib/html2text.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-01-21 07:55:09 +0000
committeralecpl <alec@alec.pl>2009-01-21 07:55:09 +0000
commit755900cd6aef3e9808dfd76c797904a2c8b08bed (patch)
tree9e0b9256ba6f8cdd41db2a565f8d1ff3ff292e52 /program/lib/html2text.php
parente1c2e7271e28101edbb97b317455048ab30071f1 (diff)
- Fix html entities replacement (related to r2186)
Diffstat (limited to 'program/lib/html2text.php')
-rw-r--r--program/lib/html2text.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/program/lib/html2text.php b/program/lib/html2text.php
index e2a5b241e..b00c28abc 100644
--- a/program/lib/html2text.php
+++ b/program/lib/html2text.php
@@ -176,7 +176,6 @@ class html2text
'/&(bull|#149|#8226);/i', // Bullet
'/&(pound|#163);/i', // Pound sign
'/&(euro|#8364);/i', // Euro sign
- '/&[^&;]+;/i', // Unknown/unhandled entities
'/[ ]{2,}/' // Runs of spaces, post-handling
);
@@ -220,7 +219,6 @@ class html2text
'*',
'£',
'EUR', // Euro sign. € ?
- '', // Unknown/unhandled entities
' ' // Runs of spaces, post-handling
);
@@ -475,6 +473,9 @@ class html2text
// Replace known html entities
$text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');
+ // Remove unknown/unhandled entities (this cannot be done in search-and-replace block)
+ $text = preg_replace('/&[^&;]+;/i', '', $text);
+
// Strip any other HTML tags
$text = strip_tags($text, $this->allowed_tags);