Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Using Chtmlpurifier Safeiframe

$
0
0
Yii version:1.1.13 (just in case it matters)

I am trying to allow YouTube iFrame code in blog posts.

//Allow HTML target attribute and YouTube iFrame
$content = $data->content;
$p = new CHtmlPurifier();
$p->options = array(
	'Attr.AllowedFrameTargets'=> array('_blank'), 
	'HTML.Allowed'=> 'p,a[href|target],strong,em,br',
	'HTML.SafeIframe'=> true,
	'URI.SafeIframeRegexp'=>'%^http://(www.youtube.com/embed/)%',
);
$content = $p->purify($content);


The YouTube iFrame code
<iframe width="560" height="315" src="http://www.youtube.com/embed/aXPP2SQuGSM?rel=0" frameborder="0" allowfullscreen></iframe>
does not get rendered into the post.

What am I doing wrong?

Thanks.

Viewing all articles
Browse latest Browse all 18717

Trending Articles