Welcome! » Log In » Create A New Profile

Skip Tags in HTML Code

Posted by Cam C 
Cam C
Skip Tags in HTML Code
November 07, 2011 12:27PM

Hey everyone,

I've been doing some searching and haven't found anything solid on this and just thought I'd ask.

I'm allowing my users to edit email templates. The email templates are html so I'm happy to use htmlpurifier to strip out all scripts and non compliant html code.

However, I do have special tags that get replaced when the email gets sent out. They're all surrounded by square brackets. Ex: [CONTENT] [UNSUBSCRIBE]

These tags are placed in displayable html <pre><![CDATA[<div>[CONTENT]</div>]]></pre> as well in links <pre><![CDATA[ <a href="[UNSUBSCRIBE]">Unsubscribe</a> ]]></pre>

Does anyone know of a way to have htmlpurifier not convert the square brackets? If I run href="[UNSUBSCRIBE]" through the purifier I get href="%5BUNSUBSCRIBE%5B"

Thanks for any info on this.

Re: Skip Tags in HTML Code
November 07, 2011 12:30PM

Unfortunately not. Can you do the transformation before running HTML Purifier?

Cam C
Re: Skip Tags in HTML Code
November 07, 2011 12:48PM

I was worried about that.

Unfortunately the different work flows done on the html code requires the purification to be done before any transformation.

However, thinking about it more, I could just do the transformation on the converted tags. It's not perfect as there could be a false positive transformation, but that shouldn't be very likely.

Re: Skip Tags in HTML Code
November 07, 2011 12:51PM

Yeah, that sounds best.

Sorry, you do not have permission to post/reply in this forum.