Add youtube embed for htmlpurifier so that it works with ckeditor?

22 Views Asked by At

I have tried multiple solutions, but nothing seems to work for me.

This is my current code:

      > $config = \HTMLPurifier_Config::createDefault();
        $config->set(
                'HTML.ForbiddenElements',
                'script',
        );
        $config->set('HTML.AllowedElements', array(
            'b','i', 'u', 'blockquote', 'div', 'a', 'img', 'hr',  'p', 'span', 'table', 'tr', 'td', 'th', 'strong','strong', 'em', 'a'
        ));

        $config->set('HTML.AllowedAttributes', array(
            'href', 'style', 'src', 'alt', 'width', 'height', 
        ));


        $purifier = new \HTMLPurifier($config);
        $clean_html = $purifier->purify(html_entity_decode($text));

I am trying to integrate it with the Embed youtube option from ckeditor. Tried this solution, but it did not work HTMLPurifier iframe Vimeo and Youtube video

Any help will be appreciated, thank you.

0

There are 0 best solutions below