From: Andrew Dolgov Date: Mon, 22 Jun 2009 09:56:49 +0000 (+0400) Subject: strip_tags_long: use htmlpurifier to properly reformat html content X-Git-Tag: 1.3.4~54 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=f45a286b8d62f710b519a98c7d4b75a0c34d5d10;p=tt-rss.git strip_tags_long: use htmlpurifier to properly reformat html content --- diff --git a/functions.php b/functions.php index 6a8e8562..8e98d487 100644 --- a/functions.php +++ b/functions.php @@ -106,6 +106,7 @@ require_once "lib/simplepie/simplepie.inc"; require_once "lib/magpierss/rss_fetch.inc"; require_once 'lib/magpierss/rss_utils.inc'; + require_once 'lib/htmlpurifier/library/HTMLPurifier.auto.php'; /** * Print a timestamped debug message. @@ -3550,9 +3551,20 @@ } } + function strip_tags_long($string, $allowed) { + + $config = HTMLPurifier_Config::createDefault(); + + $config->set('HTML', 'Allowed', $allowed); + $purifier = new HTMLPurifier($config); + + return $purifier->purify($string); + + } + // http://ru2.php.net/strip-tags - function strip_tags_long($textstring, $allowed){ +/* function strip_tags_long($textstring, $allowed){ while($textstring != strip_tags($textstring, $allowed)) { while (strlen($textstring) != 0) @@ -3569,7 +3581,7 @@ $textstring = $safetext; } return $textstring; - } +} */ function sanitize_rss($link, $str, $force_strip_tags = false) { @@ -3577,11 +3589,12 @@ if (get_pref($link, "STRIP_UNSAFE_TAGS") || $force_strip_tags) { +// $res = strip_tags_long($res, +// "