On the acs_stripTags.cfm,
you could make that quicker using one regex.

Something like:

<cfscript>
string=attributes.html;

for (i=1; i LTE ListLen(attributes.tags); i=i+1) {
HtmlTag = listGetAt(attributes.tag, i);

string = REReplaceNoCase(string, "<#HtmlTag#[^>]*>([^<]+?)</#HtmlTag#>",
"\1", "ALL");
}

caller.stripTagResult = string;
</cfscript>




______________________
steve oliver
cresco technologies, inc.
http://www.crescotech.com


-----Original Message-----
From: Gyrus [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, January 20, 2002 5:18 PM
To: CF-Talk
Subject: tag for sweeping HTML code, making safe, XHTML-compliant, etc.


I've just finished a custom tag I've been working on for a
bit, and wondered if anyone else would like to

(a) Try it out for themselves
(b) Point out any bugs I may have missed, make suggestions
(c) Use it for free / adapt it / etc.

The tag takes some HTML markup code, and does an extensive series of
checks on it to make sure it's safe, XHTML- compliant, etc.

I was inspired to it by using ezEdit in a site, where a
client pasted some copy in from Word and the DB got crammed with all
sorts of extraneous markup that bloated the DB and potentially broke the
display of the generated page. I was also looking to write a tag that
prevented, as far as possible, 'unsafe' code from being inserted into
the DB for inclusion in generated pages.

The main tag is called 'act_markupSweep.cfm'; there's a complementary
tag called 'act_stripTags.cfm' that's required by the main one (put both
in same folder). You can grab them at:

<http://www.tengai.co.uk/test/markupSweep.zip>

(Note that I've not used UDF's in implementing these as I'm still doing
a lot of pre-CF5 work.)

Areas that might need attention are the whole of 'act_stripTags.cfm'
(could be more compact?), a good few regexes in the main tag (see notes
in comments), and the XHTML tag lower-casing bit (see notes - this was
made hard to keep concise by having to leave quoted attributes inside
tags in their existing case). There are quite a few compromises; some of
the operations that need to be performed could be *a lot* more complex
than they are already if *all* eventualities are taken into account. I
just tried to make it work 99% of the time :)

If anyone likes it, has some suggestions, finds any bugs,
has done something similar much cleaner, or whatever, do
get in touch! Will obviously credit any input if I put it
up on the MM Developers Exchange - just wanted to run it
by list folks before sending it further...

cheers,

- Gyrus

[EMAIL PROTECTED]
work: http://www.tengai.co.uk
play: http://www.norlonto.net
PGP Key available



______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to