Welcome! » Log In » Create A New Profile

How Can I use css attributes

Posted by krasho 
How Can I use css attributes
November 14, 2016 10:39AM

Hello.

I want to create this DIV

<div style="display: flex">
  <p> testing </p>
</div>

When I save the data I use this function:

function sanitizeDataWithHtmlpurifier($data)
{
	require_once "vendor/htmlpurifier/library/HTMLPurifier.auto.php";

	$config = HTMLPurifier_Config::createDefault();
	$purifier = new HTMLPurifier($config);
	return $purifier->purify($data);

}

Te result after use te function is:

<div style="display: flex">
  <p> testing </p>
</div>

How Can I create a special filter or to allow use this tag?

Thanks

Re: How Can I use css attributes
November 14, 2016 11:01AM

HTML Purifier's rule for 'display' doesn't support flex. You'll have to override the CSS (get a copy of CSSDefinition and then override the display definition; look at CSSDefinition.php for ideas).

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: