Component (UDFLibrary)
Only the functions and data members that are accessible from your location are displayed
Hintuser-defined function library
public
ARRAYOFSTRUCTSTOQUERY
arrayOfStructsToQuery
Converts an array of structs to a query object.
Public Function arrayOfStructsToQuery
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
arrayObjecttruearraynullArray object to convert
return typequery
URLREMOVE
urlRemove
Returns a URL query string with a param removed.
Public Function urlRemove
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
queryStringfalsestringnull
paramNamefalsestringnull
return typestring
ISODATEFORMAT
isoDateFormat
Returns a date formatted to ISO 8601 standards.
Public Function isoDateFormat
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
dttruestringnullDate to format.
tztruestringnullTimezone - Eastern, Central, Mountain, Pacific, GMT, or UTC.
return typestring
QUERYTOSTRUCT
queryToStruct
Given a query object, converts a single column into a structure.
Public Function queryToStruct
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
queryObjecttruequerynullQuery object to convert
keyNameColumntruestringnullColumn name to use as struct keys.
keyValueColumntruestringnullColumn name to use as struct values.
return typestruct
QUERYTOARRAYOFOBJECTS
queryToArrayOfObjects
Converts a ColdFusion query object to an array of objects.
Public Function queryToArrayOfObjects
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
queryObjecttruequerynullQuery object to convert.
objectTypetruestringnullType of object to create (component, java, etc.).
objectPathtruestringnullFully qualified package and CFC/class name of object to create. Column names from query object must be exposed as public properties.
return typearray
FILTERARRAYOFOBJECTS
filterArrayOfObjects
Filters a ColdFusion array of objects per given filter criteria.
Public Function filterArrayOfObjects
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
objectArraytruearraynullArray of objects to filter.
objectPathtruestringnullFully qualified package and CFC/class name of object to filter.
filtertruestringnullColumn level filters to apply; multiple filters separated by semicolon; implied logical operator for multiple filters is OR.
return typearray
GETURLPARAMVALUE
getUrlParamValue
Given a full or partial URL string and URL param name, extracts the value of that URL param.
Public Function getUrlParamValue
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
urltruestringnullFull or partial URL string or query string.
paramNametruestringnullName of the URL param to extract.
return typestring
XHTMLPARAGRAPHFORMAT
Public Function xhtmlParagraphFormat
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strTextBlocktruestringnull
classfalsestring
return typestring
NVPTOSTRUCT
nvpToStruct
Converts a string of name/value pairs (such as a URL query string) to a struct.
Public Function nvpToStruct
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strtruestringnullName/value pair string to parse.
return typestruct
INITCAP
initCap
Returns initCap'ed string
Public Function initCap
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strtruestringnull
return typestring
COMBINEARRAYS
combineArrays
Combines two arrays into one.
Public Function combineArrays
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
a1truearraynullFirst array.
a2truearraynullSecond array.
return typearray
ADDRESSFORMAT
addressFormat
Takes an address struct and returns a formatted HTML address.
Public Function addressFormat
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
stAddresstruestructnullStruct containing contact/address info.
return typestring
FORMATFILESIZE
formatFileSize
Returns formatted file size
Public Function formatFileSize
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
fileSizetrueNumericnull
return typestring
EXTRACTANDREPLACETOKENS
extractAndReplaceTokens
From a given string, extracts tokens surrounded by delimiters, replace tokens with matching struct key values, and return the string.
Public Function extractAndReplaceTokens
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strtruestringnullString to parse.
delimitertruestring@@Delimiter char(s) surrounding the tokens
variablesStructfalsestructStruct from which to get the values to replace tokens.
return typestring
REMOVEARRAYDUPLICATES
removeArrayDuplicates
Returns the same array but duplicates will be removed
Public Function removeArrayDuplicates
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
inputArraytruearraynull
optionalObjectNamefalsestringnullUse dot notation (MyObj.XMLText)
return typearray
CLEANEMAILSTRING
cleanEmailString
Tries to clean a string of bad email addresses.
Public Function cleanEmailString
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strfalsestringnull
return typestring
PERIODSAGO
periodsAgo
Returns a string indicating how long ago the provided date was, e.g., 3 weeks ago, 4 days ago.
Public Function periodsAgo
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
fromDatetruedatenullPrior date from which time periods should be calculated.
formatfalsestringlongWhether to use 'long' format (3 weeks ago) or 'short' (3w).
return typestring
PARSENUMBER
parseNumber
Tries to parse a number out of a string.
Public Function parseNumber
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strfalsestringnullString to parse.
sidefalsestringnullTry to parse from the left, or the right?
return typeany
CENTERIMAGEINBOX
centerImageInBox
Returns a given image tag centered in a div of given dimensions and background CSS class.
Public Function centerImageInBox
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
imgTagfalsestringThe HTML image tag to center in a div
imgfalsestringThe image to center in a div
widthtruenumeric100Div width
heighttruenumeric100Div height
cssClassfalseanyblackCSS class that will apply background color to the container div
return typestring
EXTRACTTOKENS
extractTokens
Extracts tokens surrounded by delimiters from a string and returns them in an array.
Public Function extractTokens
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strtruestringnullString to parse.
delimitertruestring@@Delimiter char(s) surrounding the tokens
removeDupesfalseBooleantrueIndicates whether to remove dupe tokens from the result.
return typearray
ZEROPAD
zeroPad
Zero-pad a number string.
Public Function zeroPad
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
numfalsestringnullNumber to zero-pad.
lenfalsenumericnullFinal desired length of number.
return typestring
HASHBINARY
hashBinary
Function to create an MD5 checksum of a binary Byte array similar to md5sum command on linux. This is useful for creating md5 sums of jpg/png images for integrity verification
Public Function hashBinary
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
byteArraytrueBinarynull
algorithmfalsestringMD5Any algorithm supported by java MessageDigest - eg: MD5, SHA-1,SHA-256, SHA-384, and SHA-512. Reference: http://java.sun.com/javase/6/docs/technotes/guides/security/StandardNames.html#MessageDigest
return typestring
GETSITEID
getSiteId
Returns the request.siteid or 0.
Public Function getSiteId
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
return typeany
PHONEFORMAT
phoneFormat
Formats a string as a phone number.
Public Function phoneFormat
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
phonetruestringnullPhone number to format.
maskfalsestring(xxx) xxx-xxxs=seconds,m=minutes,h=hours,d=days
return typestring
STRIPTAGS
Public Function stripTags
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
sourcetruestringnull
actionfalsestringstrip
tagListfalsestring
return typestring
TRUNCWORDSAFE
truncWordSafe
Truncates a string to WITHIN given length, without cutting words, adding an ellipsis at the end as necessary.
Public Function truncWordSafe
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strtruestringnullString to truncate.
maxLengthtruenumericnullNew length to apply to the string.
ellipsisfalsestring...Ellipsis characters. Default is '...'.
return typestring
CHECKURL
checkUrl
Connect to a URL to determine if it is available. not working!
Public Function checkUrl
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
urltruestringnullURL to test.
timeoutfalsenumeric30Number of seconds to wait for a response.
return typeboolean
BUSINESSDAYSADD
businessDaysAdd
Given a date and integer, adds that number of business days.
Public Function businessDaysAdd
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
datetruedatenullBase date.
numbertruenumericnullNumber of business days to add.
return typedatetime
LISTREMOVEDUPES
listRemoveDupes
Removes duplicates from a list.
Public Function listRemoveDupes
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
listfalsestringnull
delimfalsestring,
return typestring
PARSEURL
parseUrl
Parses a Url and returns a struct with keys defining the information in the Uri.
Public Function parseUrl
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
sUrlfalsestringnull
return typestruct
CLEANSTRING
cleanString
Tries to clean a string of bad, unprintable characters.
Public Function cleanString
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strfalsestringnull
return typestring
ISOTODATE
isoToDate
Converts an ISO 8601 date/time stamp with optional dashes to a ColdFusion date/time string.
Public Function isoToDate
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
isoDatetruestringnullISO 8601 date/time stamp.
return typeany
ELAPSEDTIMEFORMAT
Public Function elapsedTimeFormat
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
timetrueanynull
return typestring
CLEANDATE
cleanDate
Tries to clean a date/time string and convert to date object.
Public Function cleanDate
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strfalsestringnull
return typeany
INIT
Public Function init
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
return typeUDFLibrary
LISTFIX
listFix
Given a list, a delimiterm and a null value, this will return a list fixed so that cf wont skip over null list items.
Public Function listFix
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
listtruestringnullA list
delimtrueany,The list delimiter
nulltrueany-The value you want for any null items in the list
return typestring
COMBINEQUERIES
combineQueries
Combines two query objects into one. The two queries must have an identical column structure.
Public Function combineQueries
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
q1truequerynullFirst query object.
q2truequerynullSecond query object.
return typequery
CLEANFILENAME
cleanFilename
Removes unwanted characters from filenames.
Public Function cleanFilename
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strfalsestringnull
return typestring
CAMELCASETOLIST
camelCaseToList
Takes a camel-case formatted string and converts to a list.
Public Function camelCaseToList
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strtruestringnullString value in camel case into which delimiters will be inserted.
delimiterfalsestring,Delimiter.
return typestring
NUMBERTOWORDS
numberToWords
Converts a number to words
Public Function numberToWords
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
numtrueNumericnull
capFirstfalsebooleantrue
return typestring
REPLACEURLWITHHTMLLINKS
replaceURLWithHTMLLinks
Replaces urls in a given string with html hyperlinks
Public Function replaceURLWithHTMLLinks
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strtruestringnull
return typestring
CAPFIRST
Public Function capFirst
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strtruestringnull
return typestring
QUERYTOARRAYOFSTRUCTS
queryToArrayOfStructs
Converts a ColdFusion query object to an array of structs.
Public Function queryToArrayOfStructs
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
queryObjecttruequerynullQuery object to convert
return typearray
TIMESPANTOSTRUCT
timespanToStruct
Given a number of seconds, minutes, hours, or days, returns a struct of time components.
Public Function timespanToStruct
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
timespantruenumericnullThe number of seconds, minutes, hours, or days to convert.
maskfalsestringss=seconds,m=minutes,h=hours,d=days
return typestruct
LISTCOMPARE
listCompare
Compares one list against another to find the elements in the first list that don't exist in the second list.
Public Function listCompare
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
list1truestringnullFull list of delimited values.
list2truestringnullDelimited list of values you want to compare to List1.
delim1falsestring,Delimiter used for List1. Default is the comma.
delim2falsestring,Delimiter used for List2. Default is the comma.
delim3falsestring,Delimiter to use for the list returned by the function. Default is the comma.
return typestring
SETOBJECTFROMSTRUCT
setObjectFromStruct
Sets an object's properties from a form or other structure.
Public Function setObjectFromStruct
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
objtrueanynullObject into which struct settings will be placed.
structtruestructnullStruct to place into object.
return typevoid
TRUNCATE
truncate
Truncates a string to a set length, adding an ellipsis at the end as necessary.
Public Function truncate
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strtruestringnullString to truncate.
maxLengthtruenumericnullNew length to apply to the string.
unitsfalsestringcharactersLength is applied to words, sentences, or chars (characters).
ellipsisfalsestring...Ellipsis characters. Default is '...'.
return typestring
REPLACEDATESINSTRING
replaceDatesInString
Replaces date tokens in string with actual date values.
Public Function replaceDatesInString
source:/home/alisonme/public_html/UDFLibrary.cfc
arguments
labelnamerequiredtypedefaulthint
strfalsestringnullString to parse.
dtfalsedatenullDate to replace.
return typestring