20 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
32 function load(&$ts, $text, $force =
false)
35 if (empty($force) && $xoopsUserIsAdmin) {
40 $text = $ts->filterXss($text);
43 $text = XoopsPurifier::purify($text);
50 $config = parent::loadConfig(dirname(__FILE__));
51 if (!empty(
$config[
"patterns"])) {
52 foreach (
$config[
"patterns"] as $pattern) {
53 if (empty($pattern[
'search']))
55 $search[] = $pattern[
'search'];
56 $replace[] = $pattern[
'replace'];
60 $tags = array_map(
"trim",
$config[
"tags"]);
66 $tags[] =
"JAVASCRIPT";
67 foreach ($tags as $tag) {
68 $search[] =
"/<" . $tag .
"[^>]*?>.*?<\/" . $tag .
">/si";
69 $replace[] =
" [!" . strtoupper($tag) .
" FILTERED!] ";
72 $search[] =
"/<META[^>\/]*HTTP-EQUIV=(['\"])?REFRESH(\\1)[^>\/]*?\/>/si";
78 $search[] =
"/<IFRAME[^>\/]*SRC=(['\"])?([^>\/]*)(\\1)[^>\/]*?\/>/si";
79 $replace[] =
" [!IFRAME FILTERED! \\2] ";
80 $search[] =
"/<IFRAME[^>]*?>([^<]*)<\/IFRAME>/si";
81 $replace[] =
" [!IFRAME FILTERED! \\1] ";
83 $text = preg_replace($search, $replace, $text);