Created
February 28, 2012 16:27
-
-
Save orangexception/1933472 to your computer and use it in GitHub Desktop.
Things could get grimmy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction name= "grimRequestStructure" | |
output= "false" | |
access= "private" | |
hint= "I convert valid html escaped strings into their code format."> | |
<cfargument name= "stTarget" /> | |
<cfargument name= "bDuplicate" | |
required= "false" | |
default= "true" | |
hint= "I toggle duplicating the stTarget. If set to false, I simply override values in stTarget." /> | |
<cfscript> | |
var sKey= ""; | |
var stCopy= stTarget; | |
if( bDuplicate ) | |
stCopy= duplicate( stTarget ); | |
for( sKey in stTarget ) { | |
if( IsStruct( stCopy[ sKey ] ) ) { | |
stCopy[ sKey ]= grimRequestStructure( stCopy[ sKey ] ); | |
} | |
else if ( IsSimpleValue( stCopy[ sKey ] ) ) { | |
stCopy[ sKey ]= REReplace( stCopy[ sKey ] , | |
"<" , | |
'<' , | |
"all" ); | |
stCopy[ sKey ]= REReplace( stCopy[ sKey ] , | |
">" , | |
'>' , | |
"all" ); | |
stCopy[ sKey ]= REReplace( stCopy[ sKey ] , | |
"&" , | |
'&' , | |
"all" ); | |
stCopy[ sKey ]= REReplace( stCopy[ sKey ] , | |
""" , | |
'"' , | |
"all" ); | |
} | |
} | |
return stCopy; | |
</cfscript> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment