voku\helper\AntiXSS::_js_removal PHP Method

_js_removal() private method

Callback method for xss_clean() to sanitize tags. This limits the PCRE backtracks, making it more performance friendly and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in PHP 5.2+ on image tag heavy strings.
private _js_removal ( array $match, string $search ) : string
$match array
$search string
return string
    private function _js_removal($match, $search)
    {
        if (!$match[0]) {
            return '';
        }
        $replacer = preg_replace('#' . $search . '=.*?(?:(?:alert|prompt|confirm)(?:\\((\')*|&\\#40;)|javascript:|view-source:|livescript:|wscript:|vbscript:|mocha:|charset=|window\\.|document\\.|\\.cookie|<script|<xss|base64\\s*,)#si', '', $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1])));
        return str_ireplace($match[1], $replacer, $match[0]);
    }