Pressbooks\Modules\Export\Epub\Epub3::isScripted PHP Метод

isScripted() защищенный Метод

Check for existence of scripting elements
protected isScripted ( string $html ) : boolean
$html string
Результат boolean
    protected function isScripted($html)
    {
        if (preg_match('/<script[^>]*>.*?<\\/script>/is', $html)) {
            return true;
        }
        try {
            $doc = new \DOMDocument();
            $doc->loadHTML($html);
            foreach ($doc->getElementsByTagname('*') as $element) {
                foreach (iterator_to_array($element->attributes) as $name => $attribute) {
                    if (in_array($name, $this->javaScriptEvents)) {
                        return true;
                    }
                }
            }
        } catch (\Exception $e) {
            error_log($e);
        }
        return false;
    }