|
rel="follow" permitted January 28, 2012 05:49AM |
Registered: 1 year ago Posts: 3 |
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 |
Admin Registered: 6 years ago Posts: 2,640 |
|
Re: rel="follow" permitted January 28, 2012 08:52AM |
Registered: 1 year ago Posts: 3 |
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 |
Admin Registered: 6 years ago Posts: 2,640 |
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 |
Registered: 1 year ago Posts: 3 |
|
Re: rel="follow" permitted January 28, 2012 09:11AM |
Admin Registered: 6 years ago Posts: 2,640 |