1

Topic: no_deprecated_attr

I'm a bit confused about no_deprecated_attr.

In the documentation, it says:
 

no_deprecated_attr
  Allow deprecated attributes or transform them; see section 3.4.6

  0 - allow  ^
  1 - transform, but name attributes for a and map are retained  *
  2 - transform

But in section 3.4.6, it says:

If $config["no_deprecated_attr"] is 0, then deprecated attributes (see appendix in section 5.2) are removed

So does 0 allow deprecated attributes or remove them?

My config array looks like this:

$config = array('safe' => 1, 'no_deprecated_attr' => 0);

but regardless of the value I assign to no_deprecated_attr, the underline tag <u> is getting transformed.

I tested this on the demo site by setting "safe" to 1 and "no_deprecated_attr" to all three possible values, and my test text (test <u>underline</u>) was always transformed.

Do I need to specify somewhere which elements not to transform?

The crux of my problem is that I want to use safe mode, but allow the <u> tag without transforming it. Is this possible?

Thank you for any assistance.

Nick,
Hotaru CMS

2

Re: no_deprecated_attr

Thank you, Nick, for pointing out the mistake in the documentation. Section 3.4.6 should read "... are not transofrmed ...". I will correct this soon.

* * *

The problem you are seeing with the handling of the 'u' element is unrelated to "no_deprecated_attr"; that $config parameter is for attributes and not elements. htmLawed has another $config parameter, "make_tag_strict", which is used to allow/prevent transformation of non-XHTML-Strict elements like 'u' to 'span'. By default, tag/element transformation is enabled. To not have 'u' transformed, set the parameter to '0'. Note that removal of certain tags/elements completely is set through the $config parameter "elements".

Perhaps enabling tag transformation by default was a bad choice, but at this point, when htmLawed is in use by many people, I cannot change this default behavior.

3

Re: no_deprecated_attr

Thank you patnaik, that worked perfectly and was under my nose all the time!

If you're curious as to why I wanted to prevent transformation, it's because I'm using htmLawed as a custom filter for Inspekt (http://funkatron.com/inspekt/user_docs/).

I use it like this:

$content = $cage->post->getHtmLawed('content'); // custom Inspekt filter

$allowable_tags = "<b><i><u>";
echo strip_tags($content, $allowable_tags);

Since I'm unable to pass $allowable_tags directly to my custom Inspekt filter, I have htmLawed sanitize the form data and then strip tags except for the ones I want to retain.

Now, with make_tag_strict set to 0, that works as expected.

Thanks again for your help.