Welcome! » Log In » Create A New Profile

Fckeditor + Html Purifier

Posted by baldi 
Fckeditor + Html Purifier
November 05, 2007 08:49AM

Just another problem, i want allow some css-properties like style. fckeditor creates this code <pre><![CDATA[<span style="font-weight: bold;">test</span>]]></pre>

after parsing it with html purifier it's <pre><![CDATA[<span>test</span>]]></pre>

php-code <pre><![CDATA[ function checkEntry($string) { require_once '../htmlpurifier/library/HTMLPurifier.auto.php'; $config = HTMLPurifier_Config::createDefault(); $config->set('HTML', 'TidyLevel', 'none'); $config->set('HTML', 'AllowedElements', 'font,u,strong,a,img,p,br,span'); $config->set('HTML', 'AllowedAttributes', '*.style');

//$purifier = new HTMLPurifier(); $purifier = new HTMLPurifier($config); $string2 = $purifier->purify($string); return $string2; } ]]></pre>

Re: Fckeditor + Html Purifier
November 05, 2007 08:53AM

Make sure magic quotes is not on.

Re: Fckeditor + Html Purifier
November 05, 2007 09:21AM

ok, now it works.

the information that magic_quotes must be off should be written in the INSTALL file.

Re: Fckeditor + Html Purifier
November 05, 2007 09:24AM

If I ever get around to writing a FAQ, this will be the thing I'll put in. The thing is, dealing with magic quotes is not HTML Purifier's responsibility.

Author:
Your Email:

Subject:

HTML input is enabled. Make sure you escape all HTML and angled brackets with < and >.

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: