-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfixhs.cfc
35 lines (30 loc) · 1.05 KB
/
fixhs.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<cfcomponent>
<cffunction name="init">
<cfset this.version = "1.0.0">
<cfreturn this>
</cffunction>
<cffunction name="$hashStruct" returntype="string" access="public" output="false">
<cfargument name="args" type="struct" required="true">
<cfreturn Hash(structToList(arguments.args))>
</cffunction>
<cffunction name="structToList" returntype="string" access="public" output="false">
<cfargument name="s" type="struct" required="true">
<cfscript>
/**
* Converts struct into delimited key/value list.
*
* @param s Structure. (Required)
* @param delim List delimeter. Defaults to a comma. (Optional)
* @return Returns a string.
* @author Greg Nettles ([email protected])
* @version 2, July 25, 2006
*/
var delim = "&";
var i = 0;
var newArray = structKeyArray(arguments.s);
if (arrayLen(arguments) gt 1) delim = arguments[2];
for(i=1;i lte structCount(arguments.s);i=i+1) newArray[i] = newArray[i] & "=" & arguments.s[newArray[i]];
return arraytoList(newArray,delim);
</cfscript>
</cffunction>
</cfcomponent>