<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>SafeIframe not working out of box</title>
        <description>It seems like SafeIframes is not turned on out of the box, and I haven't been able to figure out where it needs to be turned on. The INSTALL doc doesn't say where the configuration settings are located?

Here is the input value:


&amp;lt;iframe width=&quot;420&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/rEM6KBcsWGU?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen&amp;gt;&amp;lt;/iframe&amp;gt;


Here's my php:


require_once '../htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);

$dirty_html = $_POST['EmbedCode'];
$clean_html = $purifier-&amp;gt;purify($dirty_html);
$_cEmbedCode = mysql_real_escape_string($clean_html);


HTMLpurifier is deleting the entire input.</description>
        <link>http://htmlpurifier.org/phorum/read.php?3,6237,6237#msg-6237</link>
        <lastBuildDate>Wed, 19 Jun 2013 19:15:54 -0400</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6237,6246#msg-6246</guid>
            <title>Re: SafeIframe not working out of box</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6237,6246#msg-6246</link>
            <description><![CDATA[<p>D'oh! OK -- for the next guy, here's the code that works to activate SafeIframe, which goes on your php:</p>

<pre>
require_once '../htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config-&gt;set('HTML.SafeIframe', true);
$config-&gt;set('URI.SafeIframeRegexp','%^http://(www.youtube.com/embed/|player.vimeo.com/video/)%');
$purifier = new HTMLPurifier($config);
</pre>

<p>I'd like to suggest adding the following to the documentation:</p>

<p>Here: <a href="http://htmlpurifier.org/live/configdoc/plain.html#HTML.SafeIframe">http://htmlpurifier.org/live/configdoc/plain.html#HTML.SafeIframe</a>
add this as example to insert in user's php:
$config-&gt;set('HTML.SafeIframe', true);</p>

<p>and here: <a href="http://htmlpurifier.org/live/configdoc/plain.html#URI.SafeIframeRegexp">http://htmlpurifier.org/live/configdoc/plain.html#URI.SafeIframeRegexp</a>
add this as example to insert in user's php:
$config-&gt;set('URI.SafeIframeRegexp','%^http://(www.youtube.com/embed/|player.vimeo.com/video/)%');</p>

<p>Thanks!!!</p>]]></description>
            <dc:creator>jimbursch</dc:creator>
            <category>Support</category>
            <pubDate>Wed, 07 Mar 2012 09:20:18 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6237,6245#msg-6245</guid>
            <title>Re: SafeIframe not working out of box</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6237,6245#msg-6245</link>
            <description><![CDATA[<p>That's because you've got the wrong name. It's <a href="/live/configdoc/plain.html#URI.SafeIframeRegexp">%URI.SafeIframeRegexp</a></p>]]></description>
            <dc:creator>Ambush Commander</dc:creator>
            <category>Support</category>
            <pubDate>Tue, 06 Mar 2012 22:25:06 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6237,6244#msg-6244</guid>
            <title>Re: SafeIframe not working out of box</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6237,6244#msg-6244</link>
            <description><![CDATA[<p>I'm trying this:</p>

<pre>
require_once '../htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config-&gt;set('HTML.SafeIframe', true);
$config-&gt;set('URI.IframeWhitelistRegexp','%^<a href="http://www.youtube.com/embed/%25">http://www.youtube.com/embed/%</a>');
$purifier = new HTMLPurifier($config);
</pre>

<p>and getting this:</p>

<p>Warning: Cannot set undefined directive URI.IframeWhitelistRegexp to value in /home/jimbursch/mymindshare.com/b/htmlpurifier/library/HTMLPurifier/Config.php on line 693</p>]]></description>
            <dc:creator>jimbursch</dc:creator>
            <category>Support</category>
            <pubDate>Tue, 06 Mar 2012 19:08:11 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6237,6243#msg-6243</guid>
            <title>Re: SafeIframe not working out of box</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6237,6243#msg-6243</link>
            <description><![CDATA[<p>So, it looks like I need a regex that will allow: 
</p>

<pre>
src="<a href="http://www.youtube.com/embed/rEM6KBcsWGU?rel=0">http://www.youtube.com/embed/rEM6KBcsWGU?rel=0</a>"
</pre>

<p>That's the important part that's getting stripped out.</p>

<p>I suck at regex.</p>]]></description>
            <dc:creator>jimbursch</dc:creator>
            <category>Support</category>
            <pubDate>Tue, 06 Mar 2012 18:24:11 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6237,6242#msg-6242</guid>
            <title>Re: SafeIframe not working out of box</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6237,6242#msg-6242</link>
            <description><![CDATA[<p>I was hoping the regexs were provided by htmlpurifier -- I thought that was what was in URI.SafeIframeRegexp.</p>

<p>Pardon my ignorance.</p>]]></description>
            <dc:creator>jimbursch</dc:creator>
            <category>Support</category>
            <pubDate>Tue, 06 Mar 2012 18:11:29 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6237,6241#msg-6241</guid>
            <title>Re: SafeIframe not working out of box</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6237,6241#msg-6241</link>
            <description><![CDATA[<p>What regexes have you tried?</p>]]></description>
            <dc:creator>Ambush Commander</dc:creator>
            <category>Support</category>
            <pubDate>Tue, 06 Mar 2012 18:08:19 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6237,6240#msg-6240</guid>
            <title>Re: SafeIframe not working out of box</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6237,6240#msg-6240</link>
            <description><![CDATA[<p>I'm making a little progress in solving my problem.</p>

<p>My first mistake was looking for configuration settings in the htmlpurifier files. I have learned that settings are done in the php on my page, so I added $config-&gt;set('HTML.SafeIframe', true); to my php:</p>

<pre>
require_once '../htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config-&gt;set('HTML.SafeIframe', true);
$purifier = new HTMLPurifier($config);
</pre>

<p>Which now turns this:</p>

<pre>
&lt;iframe width="420" height="315" src="<a href="http://www.youtube.com/embed/rEM6KBcsWGU?rel=0">http://www.youtube.com/embed/rEM6KBcsWGU?rel=0</a>" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
</pre>

<p>into this:</p>

<pre>
&lt;iframe width="420" height="315" frameborder="0"&gt;&lt;/iframe&gt;
</pre>

<p>So I'm making progress, but I haven't solved my problem. Next I believe I need to set URI.SafeIframeRegexp, but I don't know how to do that correctly.</p>]]></description>
            <dc:creator>jimbursch</dc:creator>
            <category>Support</category>
            <pubDate>Tue, 06 Mar 2012 13:09:44 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6237,6237#msg-6237</guid>
            <title>SafeIframe not working out of box</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6237,6237#msg-6237</link>
            <description><![CDATA[<p>It seems like SafeIframes is not turned on out of the box, and I haven't been able to figure out where it needs to be turned on. The INSTALL doc doesn't say where the configuration settings are located?</p>

<p>Here is the input value:</p>

<pre>
&lt;iframe width="420" height="315" src="<a href="http://www.youtube.com/embed/rEM6KBcsWGU?rel=0">http://www.youtube.com/embed/rEM6KBcsWGU?rel=0</a>" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
</pre>

<p>Here's my php:</p>

<pre>
require_once '../htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);

$dirty_html = $_POST['EmbedCode'];
$clean_html = $purifier-&gt;purify($dirty_html);
$_cEmbedCode = mysql_real_escape_string($clean_html);
</pre>

<p>HTMLpurifier is deleting the entire input.</p>]]></description>
            <dc:creator>jimbursch</dc:creator>
            <category>Support</category>
            <pubDate>Mon, 05 Mar 2012 09:59:04 -0500</pubDate>
        </item>
    </channel>
</rss>
