<?php
/**
 * Created by PhpStorm.
 * User: stanley-king
 * Date: 16/5/7
 * Time: 下午6:49
 */

class text_filter
{
    static public function filter_script($input)
    {
        return preg_replace('/<script\s*[^>]*>[\s\S]*<\/script>/i', '', $input);
    }

    static public function filter_html($input)
    {
        $input = self::filter_script($input);
        $input = strip_tags($input);
        $input = trim($input);

        return $input;
    }

    static public function filter_input($input)
    {
        $input = self::filter_html($input);
        return $input;
        //return DFAFilter::instance()->filter($input);
    }

    //过滤敏感词
    static public function filter_sensitive_word($input)
    {
        $input = self::filter_html($input);
        return DFAFilter::instance()->filter($input);
    }
}
