<?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 for me</title>
        <description>Hi,

Thanks for HTMLPurifier!

I've been trying to get iframes to go through but haven't been successful. Here's a snippet of the code:


                                $CI =&amp;amp; CI_Base::get_instance();
                                $CI-&amp;gt;load-&amp;gt;library('HTMLPurifier');
                                $oConfig = HTMLPurifier_Config::createDefault();
                                $oConfig-&amp;gt;set('Cache', 'SerializerPath', rtrim($CI-&amp;gt;config-&amp;gt;item('cache_path'), &quot;/&quot;));
                                $oConfig-&amp;gt;set('HTML', 'DefinitionRev', 3); // Increment this number if you change any configs so that the cache is refreshed
                                $oConfig-&amp;gt;set('HTML.SafeIframe', true);
/*                                $oConfig-&amp;gt;set('URI.IframeWhitelistRegexp', array(
                                  '/^https?:\/\/www\.youtube\.com\/embed\/[a-zA-Z0-9]+$/',
                                  '/^https?:\/\/player\.vimeo\.com\/video\/[0-9]+$/'
                                ));*/
                                $oConfig-&amp;gt;set('URI.IframeWhitelistRegexp', array('%%'));



I incremented DefinitionRev as instructed. I'm loading it with CodeIgniter. And you can see my commented-out attempt at a whitelist.

Thanks so much for any help!</description>
        <link>http://htmlpurifier.org/phorum/read.php?3,6224,6224#msg-6224</link>
        <lastBuildDate>Tue, 21 May 2013 20:57:20 -0400</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6224,6231#msg-6231</guid>
            <title>Re: SafeIframe not working for me</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6224,6231#msg-6231</link>
            <description><![CDATA[<p>Can you post your full code to reproduce? Do you have magic quotes turned on?</p>]]></description>
            <dc:creator>Ambush Commander</dc:creator>
            <category>Support</category>
            <pubDate>Sat, 25 Feb 2012 12:34:04 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6224,6230#msg-6230</guid>
            <title>Re: SafeIframe not working for me</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6224,6230#msg-6230</link>
            <description><![CDATA[<p>Still not working. I also tried the regex from the documentation that was supposed to match YouTube and Vimeo.</p>]]></description>
            <dc:creator>Brett W. Thompson</dc:creator>
            <category>Support</category>
            <pubDate>Sat, 25 Feb 2012 12:05:58 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6224,6229#msg-6229</guid>
            <title>Re: SafeIframe not working for me</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6224,6229#msg-6229</link>
            <description><![CDATA[<p>Actually, I think I may have misdiagnosed your original regex; it should have been an always match regex. What happens if you don't put it in an array?</p>]]></description>
            <dc:creator>Ambush Commander</dc:creator>
            <category>Support</category>
            <pubDate>Thu, 23 Feb 2012 17:57:59 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6224,6228#msg-6228</guid>
            <title>Re: SafeIframe not working for me</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6224,6228#msg-6228</link>
            <description><![CDATA[<p>Thanks for the reply!</p>

<p>I tried this:</p>

<pre>
                                $oConfig-&gt;set('HTML.SafeIframe', true);
                                $oConfig-&gt;set('URI.IframeWhitelistRegexp', '/^https?:\/\/player\.vimeo\.com\/video\/[0-9]+.*$/');
</pre>

<p>I'm trying to match:</p>

<pre>
&lt;iframe src="<a href="http://player.vimeo.com/video/20452240?title=0&amp;amp;byline=0&amp;amp;portrait=0&amp;amp;color=ffffff">http://player.vimeo.com/video/20452240?title=0&amp;amp;byline=0&amp;amp;portrait=0&amp;amp;color=ffffff</a>" width="640" height="424" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen&gt;&lt;/iframe&gt;
</pre>

<p>Still it's getting removed.</p>]]></description>
            <dc:creator>brettwthompson</dc:creator>
            <category>Support</category>
            <pubDate>Thu, 23 Feb 2012 17:53:43 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6224,6227#msg-6227</guid>
            <title>Re: SafeIframe not working for me</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6224,6227#msg-6227</link>
            <description><![CDATA[<p>Array is not a valid value. You need to combine the regexes manually. (This is arguably a UI bug but it is technically nontrivial to combine PHP regexes.)</p>]]></description>
            <dc:creator>Ambush Commander</dc:creator>
            <category>Support</category>
            <pubDate>Thu, 23 Feb 2012 17:47:15 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6224,6226#msg-6226</guid>
            <title>Re: SafeIframe not working for me</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6224,6226#msg-6226</link>
            <description><![CDATA[<p>Thanks for your reply.</p>

<p>I have the following now:</p>

<pre>

                                $CI =&amp; CI_Base::get_instance();
                                $CI-&gt;load-&gt;library('HTMLPurifier');
                                $oConfig = HTMLPurifier_Config::createDefault();
                                $oConfig-&gt;set('Cache', 'SerializerPath', rtrim($CI-&gt;config-&gt;item('cache_path'), "/"));
//                              $oConfig-&gt;set('HTML', 'DefinitionRev', 3); // Increment this number if you change any configs so that the cache is refreshed
                                $oConfig-&gt;set('HTML.SafeIframe', true);
                                $oConfig-&gt;set('URI.IframeWhitelistRegexp', array(
                                  '/^https?:\/\/www\.youtube\.com\/embed\/[a-zA-Z0-9]+$/',
                                  '/^https?:\/\/player\.vimeo\.com\/video\/[0-9]+$/'
                                ));
</pre>

<p>but it still strips out an iframe from Vimeo.</p>

<p>Any help most appreciated.</p>]]></description>
            <dc:creator>brettwthompson</dc:creator>
            <category>Support</category>
            <pubDate>Thu, 23 Feb 2012 17:45:01 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6224,6225#msg-6225</guid>
            <title>Re: SafeIframe not working for me</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6224,6225#msg-6225</link>
            <description><![CDATA[<p>You don't need DefinitionRev since you're not doing any fancy custom config (I don't know where you got that from.)</p>

<p>The current regex you are passing only allows iframes with an EMPTY URL parameter.</p>]]></description>
            <dc:creator>Ambush Commander</dc:creator>
            <category>Support</category>
            <pubDate>Thu, 23 Feb 2012 15:45:07 -0500</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6224,6224#msg-6224</guid>
            <title>SafeIframe not working for me</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6224,6224#msg-6224</link>
            <description><![CDATA[<p>Hi,</p>

<p>Thanks for HTMLPurifier!</p>

<p>I've been trying to get iframes to go through but haven't been successful. Here's a snippet of the code:</p>

<pre>
                                $CI =&amp; CI_Base::get_instance();
                                $CI-&gt;load-&gt;library('HTMLPurifier');
                                $oConfig = HTMLPurifier_Config::createDefault();
                                $oConfig-&gt;set('Cache', 'SerializerPath', rtrim($CI-&gt;config-&gt;item('cache_path'), "/"));
                                $oConfig-&gt;set('HTML', 'DefinitionRev', 3); // Increment this number if you change any configs so that the cache is refreshed
                                $oConfig-&gt;set('HTML.SafeIframe', true);
/*                                $oConfig-&gt;set('URI.IframeWhitelistRegexp', array(
                                  '/^https?:\/\/www\.youtube\.com\/embed\/[a-zA-Z0-9]+$/',
                                  '/^https?:\/\/player\.vimeo\.com\/video\/[0-9]+$/'
                                ));*/
                                $oConfig-&gt;set('URI.IframeWhitelistRegexp', array('%%'));

</pre>

<p>I incremented DefinitionRev as instructed. I'm loading it with CodeIgniter. And you can see my commented-out attempt at a whitelist.</p>

<p>Thanks so much for any help!</p>]]></description>
            <dc:creator>brettwthompson</dc:creator>
            <category>Support</category>
            <pubDate>Thu, 23 Feb 2012 15:08:40 -0500</pubDate>
        </item>
    </channel>
</rss>
