Pars
Pars

Reputation: 5262

Limit HTMLPurifier to accept specific tags

I am going to limit HTMLPurifier to only accept some specific HTML tags.

list of valid tags:

  1. <a>
  2. <img>
  3. <i>
  4. <b>

I read Configuration Documentation and HTML Allowed Elements

but there is not a good description and example.

if you have worked with this and limited some tags in HTML Purifier please give me an example.

thanks in advance.

Upvotes: 2

Views: 362

Answers (1)

Pars
Pars

Reputation: 5262

well, thanks everyone

I found the answer:
There's some example code here http://htmlpurifier.org/live/INSTALL

and to allow some specific tags:

$config->set('HTML.Allowed', 'b,a[href],i,img[src|alt]');

alt is also needed, as it is a required attribute by W3C spec.

Upvotes: 2

Related Questions