summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-02 22:08:51 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-02 22:08:51 +0100
commit5360ec9851787e98a491edb7bccf0beb2bc7dd4b (patch)
treebd75e5a6fe41de356e91f8ce73197b0a20fbe0a2 /lib
parent3b5c9676589d6b4a3f97f60a8ddd62f755134367 (diff)
bug get_html_translation_table sur PHP < 5.3.4
Corrige https://github.com/marienfressinaud/FreshRSS/issues/337
Diffstat (limited to 'lib')
-rw-r--r--lib/lib_rss.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index ae3e4808d..4f98ed14a 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -91,10 +91,17 @@ function timestamptodate ($t, $hour = true) {
function html_only_entity_decode($text) {
static $htmlEntitiesOnly = null;
if ($htmlEntitiesOnly === null) {
- $htmlEntitiesOnly = array_flip(array_diff(
- get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES, 'UTF-8'), //Decode HTML entities
- get_html_translation_table(HTML_SPECIALCHARS, ENT_NOQUOTES, 'UTF-8') //Preserve XML entities
- ));
+ if (version_compare(PHP_VERSION, '5.3.4') >= 0) {
+ $htmlEntitiesOnly = array_flip(array_diff(
+ get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES, 'UTF-8'), //Decode HTML entities
+ get_html_translation_table(HTML_SPECIALCHARS, ENT_NOQUOTES, 'UTF-8') //Preserve XML entities
+ ));
+ } else {
+ $htmlEntitiesOnly = array_map('utf8_encode', array_flip(array_diff(
+ get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES), //Decode HTML entities
+ get_html_translation_table(HTML_SPECIALCHARS, ENT_NOQUOTES) //Preserve XML entities
+ )));
+ }
}
return strtr($text, $htmlEntitiesOnly);
}