Welcome! » Log In » Create A New Profile

rel="follow" permitted

Posted by MurphyWalker 
rel="follow" permitted
January 28, 2012 05:49AM

Hello, I am new to htmlpurifier and I am facing an issue, apparently not discussed here (not found, sorry): I've got it running ok with the HTML.Nofollow directive but if users add in the source code rel="follow" the filter is uneffective.

require_once LIB_PATH . 'htmlpurifier/HTMLPurifier.auto.php';

            $config = HTMLPurifier_Config::createDefault();
			$config->set('HTML.Nofollow', true);
			$config->set('HTML.Allowed', 'b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style]');
            $config->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
            $config->set('Cache.SerializerPath', ABS_PATH . 'oc-content/uploads');
            $purifier = new HTMLPurifier($config);

Thanks

Re: rel="follow" permitted
January 28, 2012 08:46AM

Works for me. What input are you testing with?

Re: rel="follow" permitted
January 28, 2012 08:52AM

Thank you for the fast follow up.

Example this code:

<a rel="follow" href="http://google.com">test</a>

the result will be:

<a href="http://google.com">test</a>
Re: rel="follow" permitted
January 28, 2012 08:59AM
ezyang@javelin:~/Dev/htmlpurifier$ cat test.php
<?php
include_once 'library/HTMLPurifier.auto.php';

            $config = HTMLPurifier_Config::createDefault();
			$config->set('HTML.Nofollow', true);
			$config->set('HTML.Allowed', 'b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style]');
            $config->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
            $purifier = new HTMLPurifier($config);
            echo $purifier->purify('<a rel="follow" href="http://google.com">test</a>');
ezyang@javelin:~/Dev/htmlpurifier$ php test.php
<a href="http://google.com" rel="nofollow">test</a>
Re: rel="follow" permitted
January 28, 2012 09:02AM

UPDATE

Sorry, but I can't explain how. Now, after doing some other test, it is working as expected.

Thank you for your patience

Luca

Re: rel="follow" permitted
January 28, 2012 09:11AM

Protip: The best way to get attention for a bug is to writeup a full, executable piece of code. That way, you can be sure you didn't mess up either ;-)

Author:
Your Email:

Subject:

HTML input is enabled. Make sure you escape all HTML and angled brackets with &lt; and &gt;.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

<pre><![CDATA[
Place code here
]]></pre>

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}

Message: