Microweber\Utils\Format::clean_html PHP Method

clean_html() public method

public clean_html ( $var, $do_not_strip_tags = false )
    public function clean_html($var, $do_not_strip_tags = false)
    {
        if (is_array($var)) {
            foreach ($var as $key => $val) {
                $output[$key] = $this->clean_html($val, $do_not_strip_tags);
            }
        } else {
            $var = $this->strip_unsafe($var);
            $purifier = new \HTMLPurifier();
            $var = $purifier->purify($var);
            // $var = htmlentities($var, ENT_QUOTES, 'UTF-8');
            $var = str_ireplace('<script>', '', $var);
            $var = str_ireplace('</script>', '', $var);
            $var = str_replace('<?', '&lt;?', $var);
            $var = str_replace('?>', '?&gt;', $var);
            $var = str_ireplace('<module', '&lt;module', $var);
            $var = str_ireplace('<Microweber', '&lt;Microweber', $var);
            $var = str_ireplace("52\\", '', $var);
            if ($do_not_strip_tags == false) {
                $var = strip_tags(trim($var));
            }
            $output = $var;
            return $output;
        }
        if (isset($output)) {
            return $output;
        }
    }