diff --git a/docs/categories/all.md b/docs/categories/all.md new file mode 100644 index 000000000..439c2ef70 --- /dev/null +++ b/docs/categories/all.md @@ -0,0 +1,801 @@ +# All CFML Functions + +- abs [abs](../functions/abs.md) +- acos [acos](../functions/acos.md) +- addSOAPRequestHeader [addsoaprequestheader](../functions/addsoaprequestheader.md) +- addSOAPResponseHeader [addsoapresponseheader](../functions/addsoapresponseheader.md) +- ajaxLink [ajaxlink](../functions/ajaxlink.md) +- ajaxOnLoad [ajaxonload](../functions/ajaxonload.md) +- applicationStartTime [applicationstarttime](../functions/applicationstarttime.md) +- applicationStop [applicationstop](../functions/applicationstop.md) +- argon2CheckHash [argon2checkhash](../functions/argon2checkhash.md) +- array [array](../functions/array.md) +- arrayAppend [arrayappend](../functions/arrayappend.md) +- arrayAvg [arrayavg](../functions/arrayavg.md) +- arrayClear [arrayclear](../functions/arrayclear.md) +- arrayContains [arraycontains](../functions/arraycontains.md) +- arrayContainsNoCase [arraycontainsnocase](../functions/arraycontainsnocase.md) +- arrayDelete [arraydelete](../functions/arraydelete.md) +- arrayDeleteAt [arraydeleteat](../functions/arraydeleteat.md) +- arrayDeleteNoCase [arraydeletenocase](../functions/arraydeletenocase.md) +- arrayEach [arrayeach](../functions/arrayeach.md) +- arrayEvery [arrayevery](../functions/arrayevery.md) +- arrayFilter [arrayfilter](../functions/arrayfilter.md) +- arrayFind [arrayfind](../functions/arrayfind.md) +- arrayFindAll [arrayfindall](../functions/arrayfindall.md) +- arrayFindAllNoCase [arrayfindallnocase](../functions/arrayfindallnocase.md) +- arrayFindNoCase [arrayfindnocase](../functions/arrayfindnocase.md) +- arrayFirst [arrayfirst](../functions/arrayfirst.md) +- arrayGetMetadata [arraygetmetadata](../functions/arraygetmetadata.md) +- arrayIndexExists [arrayindexexists](../functions/arrayindexexists.md) +- arrayInsertAt [arrayinsertat](../functions/arrayinsertat.md) +- arrayIsDefined [arrayisdefined](../functions/arrayisdefined.md) +- arrayIsEmpty [arrayisempty](../functions/arrayisempty.md) +- arrayLast [arraylast](../functions/arraylast.md) +- arrayLen [arraylen](../functions/arraylen.md) +- arrayMap [arraymap](../functions/arraymap.md) +- arrayMax [arraymax](../functions/arraymax.md) +- arrayMedian [arraymedian](../functions/arraymedian.md) +- arrayMerge [arraymerge](../functions/arraymerge.md) +- arrayMid [arraymid](../functions/arraymid.md) +- arrayMin [arraymin](../functions/arraymin.md) +- arrayNew [arraynew](../functions/arraynew.md) +- arrayPop [arraypop](../functions/arraypop.md) +- arrayPrepend [arrayprepend](../functions/arrayprepend.md) +- arrayPush [arraypush](../functions/arraypush.md) +- arrayReduce [arrayreduce](../functions/arrayreduce.md) +- arrayReduceRight [arrayreduceright](../functions/arrayreduceright.md) +- arrayResize [arrayresize](../functions/arrayresize.md) +- arrayReverse [arrayreverse](../functions/arrayreverse.md) +- arraySet [arrayset](../functions/arrayset.md) +- arraySetMetadata [arraysetmetadata](../functions/arraysetmetadata.md) +- arrayShift [arrayshift](../functions/arrayshift.md) +- arraySlice [arrayslice](../functions/arrayslice.md) +- arraySome [arraysome](../functions/arraysome.md) +- arraySort [arraysort](../functions/arraysort.md) +- arraySplice [arraysplice](../functions/arraysplice.md) +- arraySum [arraysum](../functions/arraysum.md) +- arraySwap [arrayswap](../functions/arrayswap.md) +- arrayToList [arraytolist](../functions/arraytolist.md) +- arrayToStruct [arraytostruct](../functions/arraytostruct.md) +- arrayUnshift [arrayunshift](../functions/arrayunshift.md) +- asc [asc](../functions/asc.md) +- asin [asin](../functions/asin.md) +- atn [atn](../functions/atn.md) +- beat [beat](../functions/beat.md) +- binaryDecode [binarydecode](../functions/binarydecode.md) +- binaryEncode [binaryencode](../functions/binaryencode.md) +- bitAnd [bitand](../functions/bitand.md) +- bitMaskClear [bitmaskclear](../functions/bitmaskclear.md) +- bitMaskRead [bitmaskread](../functions/bitmaskread.md) +- bitMaskSet [bitmaskset](../functions/bitmaskset.md) +- bitNot [bitnot](../functions/bitnot.md) +- bitOr [bitor](../functions/bitor.md) +- bitShln [bitshln](../functions/bitshln.md) +- bitShrn [bitshrn](../functions/bitshrn.md) +- bitXor [bitxor](../functions/bitxor.md) +- booleanFormat [booleanformat](../functions/booleanformat.md) +- bundleInfo [bundleinfo](../functions/bundleinfo.md) +- cacheClear [cacheclear](../functions/cacheclear.md) +- cacheCount [cachecount](../functions/cachecount.md) +- cacheDelete [cachedelete](../functions/cachedelete.md) +- cacheGet [cacheget](../functions/cacheget.md) +- cacheGetAll [cachegetall](../functions/cachegetall.md) +- cacheGetAllIds [cachegetallids](../functions/cachegetallids.md) +- cacheGetDefaultCacheName [cachegetdefaultcachename](../functions/cachegetdefaultcachename.md) +- cacheGetEngineProperties [cachegetengineproperties](../functions/cachegetengineproperties.md) +- cacheGetMetadata [cachegetmetadata](../functions/cachegetmetadata.md) +- cacheGetProperties [cachegetproperties](../functions/cachegetproperties.md) +- cacheGetSession [cachegetsession](../functions/cachegetsession.md) +- cacheIdExists [cacheidexists](../functions/cacheidexists.md) +- cacheKeyExists [cachekeyexists](../functions/cachekeyexists.md) +- cachePut [cacheput](../functions/cacheput.md) +- cacheRegionExists [cacheregionexists](../functions/cacheregionexists.md) +- cacheRegionNew [cacheregionnew](../functions/cacheregionnew.md) +- cacheRegionRemove [cacheregionremove](../functions/cacheregionremove.md) +- cacheRemove [cacheremove](../functions/cacheremove.md) +- cacheRemoveAll [cacheremoveall](../functions/cacheremoveall.md) +- cacheSetProperties [cachesetproperties](../functions/cachesetproperties.md) +- callStackDump [callstackdump](../functions/callstackdump.md) +- callStackGet [callstackget](../functions/callstackget.md) +- canonicalize [canonicalize](../functions/canonicalize.md) +- ceiling [ceiling](../functions/ceiling.md) +- cfusion_Decrypt [cfusion_decrypt](../functions/cfusion_decrypt.md) +- cfusion_Encrypt [cfusion_encrypt](../functions/cfusion_encrypt.md) +- charsetDecode [charsetdecode](../functions/charsetdecode.md) +- charsetEncode [charsetencode](../functions/charsetencode.md) +- chr [chr](../functions/chr.md) +- cJustify [cjustify](../functions/cjustify.md) +- clearTimeZone [cleartimezone](../functions/cleartimezone.md) +- collectionEach [collectioneach](../functions/collectioneach.md) +- collectionEvery [collectionevery](../functions/collectionevery.md) +- collectionFilter [collectionfilter](../functions/collectionfilter.md) +- collectionMap [collectionmap](../functions/collectionmap.md) +- collectionReduce [collectionreduce](../functions/collectionreduce.md) +- collectionSome [collectionsome](../functions/collectionsome.md) +- compare [compare](../functions/compare.md) +- compareNoCase [comparenocase](../functions/comparenocase.md) +- componentCacheClear [componentcacheclear](../functions/componentcacheclear.md) +- componentCacheList [componentcachelist](../functions/componentcachelist.md) +- componentInfo [componentinfo](../functions/componentinfo.md) +- compress [compress](../functions/compress.md) +- configImport [configimport](../functions/configimport.md) +- contractPath [contractpath](../functions/contractpath.md) +- cos [cos](../functions/cos.md) +- createDate [createdate](../functions/createdate.md) +- createDateTime [createdatetime](../functions/createdatetime.md) +- createDynamicProxy [createdynamicproxy](../functions/createdynamicproxy.md) +- createEncryptedJWT [createencryptedjwt](../functions/createencryptedjwt.md) +- createGUID [createguid](../functions/createguid.md) +- createObject [createobject](../functions/createobject.md) +- createODBCDate [createodbcdate](../functions/createodbcdate.md) +- createODBCDateTime [createodbcdatetime](../functions/createodbcdatetime.md) +- createODBCTime [createodbctime](../functions/createodbctime.md) +- createSignedJWT [createsignedjwt](../functions/createsignedjwt.md) +- createTime [createtime](../functions/createtime.md) +- createTimespan [createtimespan](../functions/createtimespan.md) +- createUniqueID [createuniqueid](../functions/createuniqueid.md) +- createUUID [createuuid](../functions/createuuid.md) +- csrfGenerateToken [csrfgeneratetoken](../functions/csrfgeneratetoken.md) +- csrfVerifyToken [csrfverifytoken](../functions/csrfverifytoken.md) +- ctCacheClear [ctcacheclear](../functions/ctcacheclear.md) +- ctCacheList [ctcachelist](../functions/ctcachelist.md) +- datasourceFlushMetacache [datasourceflushmetacache](../functions/datasourceflushmetacache.md) +- dateAdd [dateadd](../functions/dateadd.md) +- dateCompare [datecompare](../functions/datecompare.md) +- dateConvert [dateconvert](../functions/dateconvert.md) +- dateDiff [datediff](../functions/datediff.md) +- dateFormat [dateformat](../functions/dateformat.md) +- datePart [datepart](../functions/datepart.md) +- dateTimeFormat [datetimeformat](../functions/datetimeformat.md) +- day [day](../functions/day.md) +- dayOfWeek [dayofweek](../functions/dayofweek.md) +- dayOfWeekAsString [dayofweekasstring](../functions/dayofweekasstring.md) +- dayOfWeekShortAsString [dayofweekshortasstring](../functions/dayofweekshortasstring.md) +- dayOfYear [dayofyear](../functions/dayofyear.md) +- daysInMonth [daysinmonth](../functions/daysinmonth.md) +- daysInYear [daysinyear](../functions/daysinyear.md) +- de [de](../functions/de.md) +- decimalFormat [decimalformat](../functions/decimalformat.md) +- decodeForHTML [decodeforhtml](../functions/decodeforhtml.md) +- decodeFromURL [decodefromurl](../functions/decodefromurl.md) +- decrementValue [decrementvalue](../functions/decrementvalue.md) +- decrypt [decrypt](../functions/decrypt.md) +- decryptBinary [decryptbinary](../functions/decryptbinary.md) +- deleteClientVariable [deleteclientvariable](../functions/deleteclientvariable.md) +- deserialize [deserialize](../functions/deserialize.md) +- deserializeAvro [deserializeavro](../functions/deserializeavro.md) +- deserializeJSON [deserializejson](../functions/deserializejson.md) +- deserializeProtobuf [deserializeprotobuf](../functions/deserializeprotobuf.md) +- deserializeXML [deserializexml](../functions/deserializexml.md) +- directoryCopy [directorycopy](../functions/directorycopy.md) +- directoryCreate [directorycreate](../functions/directorycreate.md) +- directoryDelete [directorydelete](../functions/directorydelete.md) +- directoryExists [directoryexists](../functions/directoryexists.md) +- directoryList [directorylist](../functions/directorylist.md) +- directoryRename [directoryrename](../functions/directoryrename.md) +- dollarFormat [dollarformat](../functions/dollarformat.md) +- dotnetToCFType [dotnettocftype](../functions/dotnettocftype.md) +- duplicate [duplicate](../functions/duplicate.md) +- each [each](../functions/each.md) +- echo [echo](../functions/echo.md) +- empty [empty](../functions/empty.md) +- encodeFor [encodefor](../functions/encodefor.md) +- encodeForCSS [encodeforcss](../functions/encodeforcss.md) +- encodeForDN [encodefordn](../functions/encodefordn.md) +- encodeForHTML [encodeforhtml](../functions/encodeforhtml.md) +- encodeForHTMLAttribute [encodeforhtmlattribute](../functions/encodeforhtmlattribute.md) +- encodeForJavaScript [encodeforjavascript](../functions/encodeforjavascript.md) +- encodeForLDAP [encodeforldap](../functions/encodeforldap.md) +- encodeForURL [encodeforurl](../functions/encodeforurl.md) +- encodeForXML [encodeforxml](../functions/encodeforxml.md) +- encodeForXMLAttribute [encodeforxmlattribute](../functions/encodeforxmlattribute.md) +- encodeForXPath [encodeforxpath](../functions/encodeforxpath.md) +- encrypt [encrypt](../functions/encrypt.md) +- encryptBinary [encryptbinary](../functions/encryptbinary.md) +- entityDelete [entitydelete](../functions/entitydelete.md) +- entityLoad [entityload](../functions/entityload.md) +- entityLoadByExample [entityloadbyexample](../functions/entityloadbyexample.md) +- entityLoadByPK [entityloadbypk](../functions/entityloadbypk.md) +- entityMerge [entitymerge](../functions/entitymerge.md) +- entityNameArray [entitynamearray](../functions/entitynamearray.md) +- entityNameList [entitynamelist](../functions/entitynamelist.md) +- entityNew [entitynew](../functions/entitynew.md) +- entityReload [entityreload](../functions/entityreload.md) +- entitySave [entitysave](../functions/entitysave.md) +- entityToQuery [entitytoquery](../functions/entitytoquery.md) +- esapiDecode [esapidecode](../functions/esapidecode.md) +- esapiEncode [esapiencode](../functions/esapiencode.md) +- evaluate [evaluate](../functions/evaluate.md) +- exceptionKeyExists [exceptionkeyexists](../functions/exceptionkeyexists.md) +- exp [exp](../functions/exp.md) +- expandPath [expandpath](../functions/expandpath.md) +- extensionExists [extensionexists](../functions/extensionexists.md) +- extensionList [extensionlist](../functions/extensionlist.md) +- extract [extract](../functions/extract.md) +- fileAppend [fileappend](../functions/fileappend.md) +- fileClose [fileclose](../functions/fileclose.md) +- fileCopy [filecopy](../functions/filecopy.md) +- fileDelete [filedelete](../functions/filedelete.md) +- fileExists [fileexists](../functions/fileexists.md) +- fileGetMimeType [filegetmimetype](../functions/filegetmimetype.md) +- fileIsEOF [fileiseof](../functions/fileiseof.md) +- fileMove [filemove](../functions/filemove.md) +- fileOpen [fileopen](../functions/fileopen.md) +- fileRead [fileread](../functions/fileread.md) +- fileReadBinary [filereadbinary](../functions/filereadbinary.md) +- fileReadLine [filereadline](../functions/filereadline.md) +- fileSeek [fileseek](../functions/fileseek.md) +- fileSetAccessMode [filesetaccessmode](../functions/filesetaccessmode.md) +- fileSetAttribute [filesetattribute](../functions/filesetattribute.md) +- fileSetLastModified [filesetlastmodified](../functions/filesetlastmodified.md) +- fileSkipBytes [fileskipbytes](../functions/fileskipbytes.md) +- fileUpload [fileupload](../functions/fileupload.md) +- fileUploadAll [fileuploadall](../functions/fileuploadall.md) +- fileWrite [filewrite](../functions/filewrite.md) +- fileWriteLine [filewriteline](../functions/filewriteline.md) +- find [find](../functions/find.md) +- findNoCase [findnocase](../functions/findnocase.md) +- findOneOf [findoneof](../functions/findoneof.md) +- firstDayOfMonth [firstdayofmonth](../functions/firstdayofmonth.md) +- fix [fix](../functions/fix.md) +- floor [floor](../functions/floor.md) +- formatBaseN [formatbasen](../functions/formatbasen.md) +- generateArgon2Hash [generateargon2hash](../functions/generateargon2hash.md) +- generateBCryptHash [generatebcrypthash](../functions/generatebcrypthash.md) +- generateGraphQLModels [generategraphqlmodels](../functions/generategraphqlmodels.md) +- generatePBKDFKey [generatepbkdfkey](../functions/generatepbkdfkey.md) +- generateSCryptHash [generatescrypthash](../functions/generatescrypthash.md) +- generateSecretKey [generatesecretkey](../functions/generatesecretkey.md) +- getApplicationMetadata [getapplicationmetadata](../functions/getapplicationmetadata.md) +- getApplicationSettings [getapplicationsettings](../functions/getapplicationsettings.md) +- getAuthUser [getauthuser](../functions/getauthuser.md) +- getBaseTagData [getbasetagdata](../functions/getbasetagdata.md) +- getBaseTagList [getbasetaglist](../functions/getbasetaglist.md) +- getBaseTemplatePath [getbasetemplatepath](../functions/getbasetemplatepath.md) +- getBuiltinFunction [getbuiltinfunction](../functions/getbuiltinfunction.md) +- getCanonicalPath [getcanonicalpath](../functions/getcanonicalpath.md) +- getClassPath [getclasspath](../functions/getclasspath.md) +- getClientVariablesList [getclientvariableslist](../functions/getclientvariableslist.md) +- getComponentMetadata [getcomponentmetadata](../functions/getcomponentmetadata.md) +- getContextRoot [getcontextroot](../functions/getcontextroot.md) +- getCpuUsage [getcpuusage](../functions/getcpuusage.md) +- getCurrentContext [getcurrentcontext](../functions/getcurrentcontext.md) +- getCurrentTemplatePath [getcurrenttemplatepath](../functions/getcurrenttemplatepath.md) +- getDirectoryFromPath [getdirectoryfrompath](../functions/getdirectoryfrompath.md) +- getEncoding [getencoding](../functions/getencoding.md) +- getException [getexception](../functions/getexception.md) +- getFileFromPath [getfilefrompath](../functions/getfilefrompath.md) +- getFileInfo [getfileinfo](../functions/getfileinfo.md) +- getFreeSpace [getfreespace](../functions/getfreespace.md) +- getFunctionCalledName [getfunctioncalledname](../functions/getfunctioncalledname.md) +- getFunctionData [getfunctiondata](../functions/getfunctiondata.md) +- getFunctionKeywords [getfunctionkeywords](../functions/getfunctionkeywords.md) +- getFunctionList [getfunctionlist](../functions/getfunctionlist.md) +- getGatewayHelper [getgatewayhelper](../functions/getgatewayhelper.md) +- getGraphQLClient [getgraphqlclient](../functions/getgraphqlclient.md) +- getHTTPRequestData [gethttprequestdata](../functions/gethttprequestdata.md) +- getHTTPTimeString [gethttptimestring](../functions/gethttptimestring.md) +- getK2ServerDocCount [getk2serverdoccount](../functions/getk2serverdoccount.md) +- getK2ServerDocCountLimit [getk2serverdoccountlimit](../functions/getk2serverdoccountlimit.md) +- getLocale [getlocale](../functions/getlocale.md) +- getLocaleCountry [getlocalecountry](../functions/getlocalecountry.md) +- getLocaleDisplayName [getlocaledisplayname](../functions/getlocaledisplayname.md) +- getLocaleInfo [getlocaleinfo](../functions/getlocaleinfo.md) +- getLocaleLanguage [getlocalelanguage](../functions/getlocalelanguage.md) +- getLocalhostIP [getlocalhostip](../functions/getlocalhostip.md) +- getLuceeID [getluceeid](../functions/getluceeid.md) +- getMemoryUsage [getmemoryusage](../functions/getmemoryusage.md) +- getMetadata [getmetadata](../functions/getmetadata.md) +- getMetricData [getmetricdata](../functions/getmetricdata.md) +- getNumericDate [getnumericdate](../functions/getnumericdate.md) +- getPageContext [getpagecontext](../functions/getpagecontext.md) +- getPrinterInfo [getprinterinfo](../functions/getprinterinfo.md) +- getPrinterList [getprinterlist](../functions/getprinterlist.md) +- getProfileSections [getprofilesections](../functions/getprofilesections.md) +- getProfileString [getprofilestring](../functions/getprofilestring.md) +- getReadableImageFormats [getreadableimageformats](../functions/getreadableimageformats.md) +- getSafeHTML [getsafehtml](../functions/getsafehtml.md) +- getSOAPRequest [getsoaprequest](../functions/getsoaprequest.md) +- getSOAPRequestHeader [getsoaprequestheader](../functions/getsoaprequestheader.md) +- getSOAPResponse [getsoapresponse](../functions/getsoapresponse.md) +- getSOAPResponseHeader [getsoapresponseheader](../functions/getsoapresponseheader.md) +- getSystemFreeMemory [getsystemfreememory](../functions/getsystemfreememory.md) +- getSystemTotalMemory [getsystemtotalmemory](../functions/getsystemtotalmemory.md) +- getTagData [gettagdata](../functions/gettagdata.md) +- getTagList [gettaglist](../functions/gettaglist.md) +- getTempDirectory [gettempdirectory](../functions/gettempdirectory.md) +- getTempFile [gettempfile](../functions/gettempfile.md) +- getTemplatePath [gettemplatepath](../functions/gettemplatepath.md) +- getTickCount [gettickcount](../functions/gettickcount.md) +- getTimeZone [gettimezone](../functions/gettimezone.md) +- getTimezoneInfo [gettimezoneinfo](../functions/gettimezoneinfo.md) +- getToken [gettoken](../functions/gettoken.md) +- getTotalSpace [gettotalspace](../functions/gettotalspace.md) +- getUserRoles [getuserroles](../functions/getuserroles.md) +- getVariable [getvariable](../functions/getvariable.md) +- getVFSMetadata [getvfsmetadata](../functions/getvfsmetadata.md) +- getWriteableImageFormats [getwriteableimageformats](../functions/getwriteableimageformats.md) +- hash [hash](../functions/hash.md) +- hash40 [hash40](../functions/hash40.md) +- hmac [hmac](../functions/hmac.md) +- hour [hour](../functions/hour.md) +- htmlCodeFormat [htmlcodeformat](../functions/htmlcodeformat.md) +- htmlEditFormat [htmleditformat](../functions/htmleditformat.md) +- htmlParse [htmlparse](../functions/htmlparse.md) +- iIf [iif](../functions/iif.md) +- imageAddBorder [imageaddborder](../functions/imageaddborder.md) +- imageBlur [imageblur](../functions/imageblur.md) +- imageCaptcha [imagecaptcha](../functions/imagecaptcha.md) +- imageClearRect [imageclearrect](../functions/imageclearrect.md) +- imageCopy [imagecopy](../functions/imagecopy.md) +- imageCreateCaptcha [imagecreatecaptcha](../functions/imagecreatecaptcha.md) +- imageCrop [imagecrop](../functions/imagecrop.md) +- imageDrawArc [imagedrawarc](../functions/imagedrawarc.md) +- imageDrawBeveledRect [imagedrawbeveledrect](../functions/imagedrawbeveledrect.md) +- imageDrawCubicCurve [imagedrawcubiccurve](../functions/imagedrawcubiccurve.md) +- imageDrawImage [imagedrawimage](../functions/imagedrawimage.md) +- imageDrawLine [imagedrawline](../functions/imagedrawline.md) +- imageDrawLines [imagedrawlines](../functions/imagedrawlines.md) +- imageDrawOval [imagedrawoval](../functions/imagedrawoval.md) +- imageDrawPoint [imagedrawpoint](../functions/imagedrawpoint.md) +- imageDrawQuadraticCurve [imagedrawquadraticcurve](../functions/imagedrawquadraticcurve.md) +- imageDrawRect [imagedrawrect](../functions/imagedrawrect.md) +- imageDrawRoundRect [imagedrawroundrect](../functions/imagedrawroundrect.md) +- imageDrawText [imagedrawtext](../functions/imagedrawtext.md) +- imageFilter [imagefilter](../functions/imagefilter.md) +- imageFilterColorMap [imagefiltercolormap](../functions/imagefiltercolormap.md) +- imageFilterCurves [imagefiltercurves](../functions/imagefiltercurves.md) +- imageFilterKernel [imagefilterkernel](../functions/imagefilterkernel.md) +- imageFilterWarpGrid [imagefilterwarpgrid](../functions/imagefilterwarpgrid.md) +- imageFlip [imageflip](../functions/imageflip.md) +- imageFonts [imagefonts](../functions/imagefonts.md) +- imageFormats [imageformats](../functions/imageformats.md) +- imageGetBlob [imagegetblob](../functions/imagegetblob.md) +- imageGetBufferedImage [imagegetbufferedimage](../functions/imagegetbufferedimage.md) +- imageGetEXIFMetadata [imagegetexifmetadata](../functions/imagegetexifmetadata.md) +- imageGetEXIFTag [imagegetexiftag](../functions/imagegetexiftag.md) +- imageGetHeight [imagegetheight](../functions/imagegetheight.md) +- imageGetIPTCMetadata [imagegetiptcmetadata](../functions/imagegetiptcmetadata.md) +- imageGetIPTCtag [imagegetiptctag](../functions/imagegetiptctag.md) +- imageGetMetadata [imagegetmetadata](../functions/imagegetmetadata.md) +- imageGetWidth [imagegetwidth](../functions/imagegetwidth.md) +- imageGrayScale [imagegrayscale](../functions/imagegrayscale.md) +- imageInfo [imageinfo](../functions/imageinfo.md) +- imageMakeColorTransparent [imagemakecolortransparent](../functions/imagemakecolortransparent.md) +- imageMakeTranslucent [imagemaketranslucent](../functions/imagemaketranslucent.md) +- imageNegative [imagenegative](../functions/imagenegative.md) +- imageNew [imagenew](../functions/imagenew.md) +- imageOverlay [imageoverlay](../functions/imageoverlay.md) +- imagePaste [imagepaste](../functions/imagepaste.md) +- imageRead [imageread](../functions/imageread.md) +- imageReadBase64 [imagereadbase64](../functions/imagereadbase64.md) +- imageResize [imageresize](../functions/imageresize.md) +- imageRotate [imagerotate](../functions/imagerotate.md) +- imageRotateDrawingAxis [imagerotatedrawingaxis](../functions/imagerotatedrawingaxis.md) +- imageScaleTofit [imagescaletofit](../functions/imagescaletofit.md) +- imageSetAntialiasing [imagesetantialiasing](../functions/imagesetantialiasing.md) +- imageSetBackgroundColor [imagesetbackgroundcolor](../functions/imagesetbackgroundcolor.md) +- imageSetDrawingAlpha [imagesetdrawingalpha](../functions/imagesetdrawingalpha.md) +- imageSetDrawingColor [imagesetdrawingcolor](../functions/imagesetdrawingcolor.md) +- imageSetDrawingStroke [imagesetdrawingstroke](../functions/imagesetdrawingstroke.md) +- imageSetDrawingTransparency [imagesetdrawingtransparency](../functions/imagesetdrawingtransparency.md) +- imageSharpen [imagesharpen](../functions/imagesharpen.md) +- imageShear [imageshear](../functions/imageshear.md) +- imageShearDrawingAxis [imagesheardrawingaxis](../functions/imagesheardrawingaxis.md) +- imageTranslate [imagetranslate](../functions/imagetranslate.md) +- imageTranslateDrawingAxis [imagetranslatedrawingaxis](../functions/imagetranslatedrawingaxis.md) +- imageWrite [imagewrite](../functions/imagewrite.md) +- imageWriteBase64 [imagewritebase64](../functions/imagewritebase64.md) +- imageXORDrawingMode [imagexordrawingmode](../functions/imagexordrawingmode.md) +- incrementValue [incrementvalue](../functions/incrementvalue.md) +- inputBaseN [inputbasen](../functions/inputbasen.md) +- insert [insert](../functions/insert.md) +- int [int](../functions/int.md) +- invalidateOauthAccesstoken [invalidateoauthaccesstoken](../functions/invalidateoauthaccesstoken.md) +- invoke [invoke](../functions/invoke.md) +- isArray [isarray](../functions/isarray.md) +- isBinary [isbinary](../functions/isbinary.md) +- isBoolean [isboolean](../functions/isboolean.md) +- isClosure [isclosure](../functions/isclosure.md) +- isCustomFunction [iscustomfunction](../functions/iscustomfunction.md) +- isDate [isdate](../functions/isdate.md) +- isDateObject [isdateobject](../functions/isdateobject.md) +- isDDX [isddx](../functions/isddx.md) +- isDebugMode [isdebugmode](../functions/isdebugmode.md) +- isDefined [isdefined](../functions/isdefined.md) +- isEmpty [isempty](../functions/isempty.md) +- isFileObject [isfileobject](../functions/isfileobject.md) +- isImage [isimage](../functions/isimage.md) +- isImageFile [isimagefile](../functions/isimagefile.md) +- isInstanceOf [isinstanceof](../functions/isinstanceof.md) +- isIPInRange [isipinrange](../functions/isipinrange.md) +- isIPV6 [isipv6](../functions/isipv6.md) +- isJSON [isjson](../functions/isjson.md) +- isK2ServerABroker [isk2serverabroker](../functions/isk2serverabroker.md) +- isK2ServerDocCountExceeded [isk2serverdoccountexceeded](../functions/isk2serverdoccountexceeded.md) +- isK2ServerOnline [isk2serveronline](../functions/isk2serveronline.md) +- isLeapYear [isleapyear](../functions/isleapyear.md) +- isLocalhost [islocalhost](../functions/islocalhost.md) +- isNotMap [isnotmap](../functions/isnotmap.md) +- isNull [isnull](../functions/isnull.md) +- isNumeric [isnumeric](../functions/isnumeric.md) +- isNumericDate [isnumericdate](../functions/isnumericdate.md) +- isObject [isobject](../functions/isobject.md) +- isPDFArchive [ispdfarchive](../functions/ispdfarchive.md) +- isPDFFile [ispdffile](../functions/ispdffile.md) +- isPDFObject [ispdfobject](../functions/ispdfobject.md) +- isQuery [isquery](../functions/isquery.md) +- isSafeHTML [issafehtml](../functions/issafehtml.md) +- isSimpleValue [issimplevalue](../functions/issimplevalue.md) +- isSOAPRequest [issoaprequest](../functions/issoaprequest.md) +- isSpreadsheetFile [isspreadsheetfile](../functions/isspreadsheetfile.md) +- isSpreadsheetObject [isspreadsheetobject](../functions/isspreadsheetobject.md) +- isStruct [isstruct](../functions/isstruct.md) +- isUserInAnyRole [isuserinanyrole](../functions/isuserinanyrole.md) +- isUserInRole [isuserinrole](../functions/isuserinrole.md) +- isUserLoggedIn [isuserloggedin](../functions/isuserloggedin.md) +- isValid [isvalid](../functions/isvalid.md) +- isValidOauthAccesstoken [isvalidoauthaccesstoken](../functions/isvalidoauthaccesstoken.md) +- isVideoFile [isvideofile](../functions/isvideofile.md) +- isWDDX [iswddx](../functions/iswddx.md) +- isXML [isxml](../functions/isxml.md) +- isXMLAttribute [isxmlattribute](../functions/isxmlattribute.md) +- isXMLDoc [isxmldoc](../functions/isxmldoc.md) +- isXMLElem [isxmlelem](../functions/isxmlelem.md) +- isXMLNode [isxmlnode](../functions/isxmlnode.md) +- isXMLRoot [isxmlroot](../functions/isxmlroot.md) +- isZipFile [iszipfile](../functions/iszipfile.md) +- javaCast [javacast](../functions/javacast.md) +- jsStringFormat [jsstringformat](../functions/jsstringformat.md) +- lCase [lcase](../functions/lcase.md) +- left [left](../functions/left.md) +- len [len](../functions/len.md) +- listAppend [listappend](../functions/listappend.md) +- listAvg [listavg](../functions/listavg.md) +- listChangeDelims [listchangedelims](../functions/listchangedelims.md) +- listCompact [listcompact](../functions/listcompact.md) +- listContains [listcontains](../functions/listcontains.md) +- listContainsNoCase [listcontainsnocase](../functions/listcontainsnocase.md) +- listDeleteAt [listdeleteat](../functions/listdeleteat.md) +- listEach [listeach](../functions/listeach.md) +- listEvery [listevery](../functions/listevery.md) +- listFilter [listfilter](../functions/listfilter.md) +- listFind [listfind](../functions/listfind.md) +- listFindNoCase [listfindnocase](../functions/listfindnocase.md) +- listFirst [listfirst](../functions/listfirst.md) +- listGetAt [listgetat](../functions/listgetat.md) +- listIndexExists [listindexexists](../functions/listindexexists.md) +- listInsertAt [listinsertat](../functions/listinsertat.md) +- listItemTrim [listitemtrim](../functions/listitemtrim.md) +- listLast [listlast](../functions/listlast.md) +- listLen [listlen](../functions/listlen.md) +- listMap [listmap](../functions/listmap.md) +- listPrepend [listprepend](../functions/listprepend.md) +- listQualify [listqualify](../functions/listqualify.md) +- listReduce [listreduce](../functions/listreduce.md) +- listReduceRight [listreduceright](../functions/listreduceright.md) +- listRemoveDuplicates [listremoveduplicates](../functions/listremoveduplicates.md) +- listRest [listrest](../functions/listrest.md) +- listSetAt [listsetat](../functions/listsetat.md) +- listSome [listsome](../functions/listsome.md) +- listSort [listsort](../functions/listsort.md) +- listToArray [listtoarray](../functions/listtoarray.md) +- listTrim [listtrim](../functions/listtrim.md) +- listValueCount [listvaluecount](../functions/listvaluecount.md) +- listValueCountNoCase [listvaluecountnocase](../functions/listvaluecountnocase.md) +- lJustify [ljustify](../functions/ljustify.md) +- location [location](../functions/location.md) +- log [log](../functions/log.md) +- log10 [log10](../functions/log10.md) +- lsCurrencyFormat [lscurrencyformat](../functions/lscurrencyformat.md) +- lsDateFormat [lsdateformat](../functions/lsdateformat.md) +- lsDateTimeFormat [lsdatetimeformat](../functions/lsdatetimeformat.md) +- lsDayOfWeek [lsdayofweek](../functions/lsdayofweek.md) +- lsEuroCurrencyFormat [lseurocurrencyformat](../functions/lseurocurrencyformat.md) +- lsIsCurrency [lsiscurrency](../functions/lsiscurrency.md) +- lsIsDate [lsisdate](../functions/lsisdate.md) +- lsIsNumeric [lsisnumeric](../functions/lsisnumeric.md) +- lsNumberFormat [lsnumberformat](../functions/lsnumberformat.md) +- lsParseCurrency [lsparsecurrency](../functions/lsparsecurrency.md) +- lsParseDateTime [lsparsedatetime](../functions/lsparsedatetime.md) +- lsParseEuroCurrency [lsparseeurocurrency](../functions/lsparseeurocurrency.md) +- lsParseNumber [lsparsenumber](../functions/lsparsenumber.md) +- lsTimeFormat [lstimeformat](../functions/lstimeformat.md) +- lsWeek [lsweek](../functions/lsweek.md) +- lTrim [ltrim](../functions/ltrim.md) +- manifestRead [manifestread](../functions/manifestread.md) +- max [max](../functions/max.md) +- metaphone [metaphone](../functions/metaphone.md) +- mid [mid](../functions/mid.md) +- millisecond [millisecond](../functions/millisecond.md) +- min [min](../functions/min.md) +- minute [minute](../functions/minute.md) +- month [month](../functions/month.md) +- monthAsString [monthasstring](../functions/monthasstring.md) +- monthShortAsString [monthshortasstring](../functions/monthshortasstring.md) +- newLine [newline](../functions/newline.md) +- now [now](../functions/now.md) +- nowServer [nowserver](../functions/nowserver.md) +- nullValue [nullvalue](../functions/nullvalue.md) +- numberFormat [numberformat](../functions/numberformat.md) +- objectEquals [objectequals](../functions/objectequals.md) +- objectLoad [objectload](../functions/objectload.md) +- objectSave [objectsave](../functions/objectsave.md) +- onApplicationEnd [onapplicationend](../functions/onapplicationend.md) +- onApplicationStart [onapplicationstart](../functions/onapplicationstart.md) +- onError [onerror](../functions/onerror.md) +- onMissingMethod [onmissingmethod](../functions/onmissingmethod.md) +- onMissingTemplate [onmissingtemplate](../functions/onmissingtemplate.md) +- onRequest [onrequest](../functions/onrequest.md) +- onRequestEnd [onrequestend](../functions/onrequestend.md) +- onRequestStart [onrequeststart](../functions/onrequeststart.md) +- onServerStart [onserverstart](../functions/onserverstart.md) +- onSessionEnd [onsessionend](../functions/onsessionend.md) +- onSessionStart [onsessionstart](../functions/onsessionstart.md) +- ormClearSession [ormclearsession](../functions/ormclearsession.md) +- ormCloseAllSessions [ormcloseallsessions](../functions/ormcloseallsessions.md) +- ormCloseSession [ormclosesession](../functions/ormclosesession.md) +- ormEvictCollection [ormevictcollection](../functions/ormevictcollection.md) +- ormEvictEntity [ormevictentity](../functions/ormevictentity.md) +- ormEvictQueries [ormevictqueries](../functions/ormevictqueries.md) +- ormExecuteQuery [ormexecutequery](../functions/ormexecutequery.md) +- ormFlush [ormflush](../functions/ormflush.md) +- ormFlushAll [ormflushall](../functions/ormflushall.md) +- ormGetSession [ormgetsession](../functions/ormgetsession.md) +- ormGetSessionFactory [ormgetsessionfactory](../functions/ormgetsessionfactory.md) +- ormIndex [ormindex](../functions/ormindex.md) +- ormIndexPurge [ormindexpurge](../functions/ormindexpurge.md) +- ormReload [ormreload](../functions/ormreload.md) +- ormSearch [ormsearch](../functions/ormsearch.md) +- ormSearchOffline [ormsearchoffline](../functions/ormsearchoffline.md) +- pagePoolClear [pagepoolclear](../functions/pagepoolclear.md) +- pagePoolList [pagepoollist](../functions/pagepoollist.md) +- paragraphFormat [paragraphformat](../functions/paragraphformat.md) +- parameterExists [parameterexists](../functions/parameterexists.md) +- parseDateTime [parsedatetime](../functions/parsedatetime.md) +- parseNumber [parsenumber](../functions/parsenumber.md) +- pi [pi](../functions/pi.md) +- precisionEvaluate [precisionevaluate](../functions/precisionevaluate.md) +- preserveSingleQuotes [preservesinglequotes](../functions/preservesinglequotes.md) +- quarter [quarter](../functions/quarter.md) +- query [query](../functions/query.md) +- queryAddColumn [queryaddcolumn](../functions/queryaddcolumn.md) +- queryAddRow [queryaddrow](../functions/queryaddrow.md) +- queryAppend [queryappend](../functions/queryappend.md) +- queryClear [queryclear](../functions/queryclear.md) +- queryColumnArray [querycolumnarray](../functions/querycolumnarray.md) +- queryColumnCount [querycolumncount](../functions/querycolumncount.md) +- queryColumnData [querycolumndata](../functions/querycolumndata.md) +- queryColumnExists [querycolumnexists](../functions/querycolumnexists.md) +- queryColumnList [querycolumnlist](../functions/querycolumnlist.md) +- queryConvertForGrid [queryconvertforgrid](../functions/queryconvertforgrid.md) +- queryCurrentRow [querycurrentrow](../functions/querycurrentrow.md) +- queryDeleteColumn [querydeletecolumn](../functions/querydeletecolumn.md) +- queryDeleteRow [querydeleterow](../functions/querydeleterow.md) +- queryEach [queryeach](../functions/queryeach.md) +- queryEvery [queryevery](../functions/queryevery.md) +- queryExecute [queryexecute](../functions/queryexecute.md) +- queryFilter [queryfilter](../functions/queryfilter.md) +- queryGetCell [querygetcell](../functions/querygetcell.md) +- queryGetResult [querygetresult](../functions/querygetresult.md) +- queryGetRow [querygetrow](../functions/querygetrow.md) +- queryInsertAt [queryinsertat](../functions/queryinsertat.md) +- queryKeyExists [querykeyexists](../functions/querykeyexists.md) +- queryMap [querymap](../functions/querymap.md) +- queryNew [querynew](../functions/querynew.md) +- queryPrepend [queryprepend](../functions/queryprepend.md) +- queryRecordCount [queryrecordcount](../functions/queryrecordcount.md) +- queryReduce [queryreduce](../functions/queryreduce.md) +- queryReverse [queryreverse](../functions/queryreverse.md) +- queryRowData [queryrowdata](../functions/queryrowdata.md) +- queryRowSwap [queryrowswap](../functions/queryrowswap.md) +- querySetCell [querysetcell](../functions/querysetcell.md) +- querySetRow [querysetrow](../functions/querysetrow.md) +- querySlice [queryslice](../functions/queryslice.md) +- querySome [querysome](../functions/querysome.md) +- querySort [querysort](../functions/querysort.md) +- quotedValueList [quotedvaluelist](../functions/quotedvaluelist.md) +- rand [rand](../functions/rand.md) +- randomize [randomize](../functions/randomize.md) +- randRange [randrange](../functions/randrange.md) +- reEscape [reescape](../functions/reescape.md) +- reFind [refind](../functions/refind.md) +- reFindNoCase [refindnocase](../functions/refindnocase.md) +- releaseCOMObject [releasecomobject](../functions/releasecomobject.md) +- reMatch [rematch](../functions/rematch.md) +- reMatchNoCase [rematchnocase](../functions/rematchnocase.md) +- removeCachedQuery [removecachedquery](../functions/removecachedquery.md) +- removeChars [removechars](../functions/removechars.md) +- render [render](../functions/render.md) +- repeatString [repeatstring](../functions/repeatstring.md) +- replace [replace](../functions/replace.md) +- replaceList [replacelist](../functions/replacelist.md) +- replaceListNoCase [replacelistnocase](../functions/replacelistnocase.md) +- replaceNoCase [replacenocase](../functions/replacenocase.md) +- reReplace [rereplace](../functions/rereplace.md) +- reReplaceNoCase [rereplacenocase](../functions/rereplacenocase.md) +- restDeleteApplication [restdeleteapplication](../functions/restdeleteapplication.md) +- restInitApplication [restinitapplication](../functions/restinitapplication.md) +- restSetResponse [restsetresponse](../functions/restsetresponse.md) +- reverse [reverse](../functions/reverse.md) +- right [right](../functions/right.md) +- rJustify [rjustify](../functions/rjustify.md) +- round [round](../functions/round.md) +- rTrim [rtrim](../functions/rtrim.md) +- runAsync [runasync](../functions/runasync.md) +- sanitizeHtml [sanitizehtml](../functions/sanitizehtml.md) +- second [second](../functions/second.md) +- sendGatewayMessage [sendgatewaymessage](../functions/sendgatewaymessage.md) +- serialize [serialize](../functions/serialize.md) +- serializeAvro [serializeavro](../functions/serializeavro.md) +- serializeJSON [serializejson](../functions/serializejson.md) +- serializeProtobuf [serializeprotobuf](../functions/serializeprotobuf.md) +- serializeXML [serializexml](../functions/serializexml.md) +- sessionGetMetadata [sessiongetmetadata](../functions/sessiongetmetadata.md) +- sessionInvalidate [sessioninvalidate](../functions/sessioninvalidate.md) +- sessionRotate [sessionrotate](../functions/sessionrotate.md) +- sessionstartTime [sessionstarttime](../functions/sessionstarttime.md) +- setEncoding [setencoding](../functions/setencoding.md) +- setLocale [setlocale](../functions/setlocale.md) +- setProfileString [setprofilestring](../functions/setprofilestring.md) +- setTimeZone [settimezone](../functions/settimezone.md) +- setVariable [setvariable](../functions/setvariable.md) +- sgn [sgn](../functions/sgn.md) +- sin [sin](../functions/sin.md) +- sizeOf [sizeof](../functions/sizeof.md) +- sleep [sleep](../functions/sleep.md) +- soundEx [soundex](../functions/soundex.md) +- spanExcluding [spanexcluding](../functions/spanexcluding.md) +- spanIncluding [spanincluding](../functions/spanincluding.md) +- spreadsheetAddAutoFilter [spreadsheetaddautofilter](../functions/spreadsheetaddautofilter.md) +- spreadsheetAddColumn [spreadsheetaddcolumn](../functions/spreadsheetaddcolumn.md) +- spreadsheetAddFreezePane [spreadsheetaddfreezepane](../functions/spreadsheetaddfreezepane.md) +- spreadsheetAddimage [spreadsheetaddimage](../functions/spreadsheetaddimage.md) +- spreadsheetAddInfo [spreadsheetaddinfo](../functions/spreadsheetaddinfo.md) +- spreadsheetAddPagebreaks [spreadsheetaddpagebreaks](../functions/spreadsheetaddpagebreaks.md) +- spreadsheetAddRow [spreadsheetaddrow](../functions/spreadsheetaddrow.md) +- spreadsheetAddRows [spreadsheetaddrows](../functions/spreadsheetaddrows.md) +- spreadsheetAddSplitPane [spreadsheetaddsplitpane](../functions/spreadsheetaddsplitpane.md) +- spreadsheetCreateSheet [spreadsheetcreatesheet](../functions/spreadsheetcreatesheet.md) +- spreadsheetDeleteColumn [spreadsheetdeletecolumn](../functions/spreadsheetdeletecolumn.md) +- spreadsheetDeleteColumns [spreadsheetdeletecolumns](../functions/spreadsheetdeletecolumns.md) +- spreadsheetDeleteRow [spreadsheetdeleterow](../functions/spreadsheetdeleterow.md) +- spreadsheetDeleteRows [spreadsheetdeleterows](../functions/spreadsheetdeleterows.md) +- spreadsheetFormatCell [spreadsheetformatcell](../functions/spreadsheetformatcell.md) +- spreadsheetFormatCellRange [spreadsheetformatcellrange](../functions/spreadsheetformatcellrange.md) +- spreadsheetFormatColumn [spreadsheetformatcolumn](../functions/spreadsheetformatcolumn.md) +- spreadsheetFormatColumns [spreadsheetformatcolumns](../functions/spreadsheetformatcolumns.md) +- spreadsheetFormatRow [spreadsheetformatrow](../functions/spreadsheetformatrow.md) +- spreadsheetFormatRows [spreadsheetformatrows](../functions/spreadsheetformatrows.md) +- spreadsheetGetCellComment [spreadsheetgetcellcomment](../functions/spreadsheetgetcellcomment.md) +- spreadsheetGetCellFormula [spreadsheetgetcellformula](../functions/spreadsheetgetcellformula.md) +- spreadsheetGetCellValue [spreadsheetgetcellvalue](../functions/spreadsheetgetcellvalue.md) +- spreadsheetGetColumnCount [spreadsheetgetcolumncount](../functions/spreadsheetgetcolumncount.md) +- spreadsheetInfo [spreadsheetinfo](../functions/spreadsheetinfo.md) +- spreadsheetMergeCells [spreadsheetmergecells](../functions/spreadsheetmergecells.md) +- spreadsheetNew [spreadsheetnew](../functions/spreadsheetnew.md) +- spreadsheetRead [spreadsheetread](../functions/spreadsheetread.md) +- spreadsheetReadBinary [spreadsheetreadbinary](../functions/spreadsheetreadbinary.md) +- spreadsheetRemoveSheet [spreadsheetremovesheet](../functions/spreadsheetremovesheet.md) +- spreadsheetSetActiveSheet [spreadsheetsetactivesheet](../functions/spreadsheetsetactivesheet.md) +- spreadsheetSetActiveSheetNumber [spreadsheetsetactivesheetnumber](../functions/spreadsheetsetactivesheetnumber.md) +- spreadsheetSetCellComment [spreadsheetsetcellcomment](../functions/spreadsheetsetcellcomment.md) +- spreadsheetSetCellFormula [spreadsheetsetcellformula](../functions/spreadsheetsetcellformula.md) +- spreadsheetSetCellValue [spreadsheetsetcellvalue](../functions/spreadsheetsetcellvalue.md) +- spreadsheetSetColumnWidth [spreadsheetsetcolumnwidth](../functions/spreadsheetsetcolumnwidth.md) +- spreadsheetSetFooter [spreadsheetsetfooter](../functions/spreadsheetsetfooter.md) +- spreadsheetSetHeader [spreadsheetsetheader](../functions/spreadsheetsetheader.md) +- spreadsheetSetRowHeight [spreadsheetsetrowheight](../functions/spreadsheetsetrowheight.md) +- spreadsheetShiftColumns [spreadsheetshiftcolumns](../functions/spreadsheetshiftcolumns.md) +- spreadsheetShiftRows [spreadsheetshiftrows](../functions/spreadsheetshiftrows.md) +- spreadsheetwrite [spreadsheetwrite](../functions/spreadsheetwrite.md) +- sqr [sqr](../functions/sqr.md) +- sslCertificateInstall [sslcertificateinstall](../functions/sslcertificateinstall.md) +- sslCertificateList [sslcertificatelist](../functions/sslcertificatelist.md) +- storeAddACL [storeaddacl](../functions/storeaddacl.md) +- storeGetACL [storegetacl](../functions/storegetacl.md) +- storeGetMetadata [storegetmetadata](../functions/storegetmetadata.md) +- storeSetACL [storesetacl](../functions/storesetacl.md) +- storeSetMetadata [storesetmetadata](../functions/storesetmetadata.md) +- stringEach [stringeach](../functions/stringeach.md) +- stringEvery [stringevery](../functions/stringevery.md) +- stringFilter [stringfilter](../functions/stringfilter.md) +- stringLen [stringlen](../functions/stringlen.md) +- stringMap [stringmap](../functions/stringmap.md) +- stringReduce [stringreduce](../functions/stringreduce.md) +- stringReduceRight [stringreduceright](../functions/stringreduceright.md) +- stringSome [stringsome](../functions/stringsome.md) +- stringSort [stringsort](../functions/stringsort.md) +- stripCR [stripcr](../functions/stripcr.md) +- structAppend [structappend](../functions/structappend.md) +- structClear [structclear](../functions/structclear.md) +- structCopy [structcopy](../functions/structcopy.md) +- structCount [structcount](../functions/structcount.md) +- structDelete [structdelete](../functions/structdelete.md) +- structEach [structeach](../functions/structeach.md) +- structEquals [structequals](../functions/structequals.md) +- structEvery [structevery](../functions/structevery.md) +- structFilter [structfilter](../functions/structfilter.md) +- structFind [structfind](../functions/structfind.md) +- structFindKey [structfindkey](../functions/structfindkey.md) +- structFindValue [structfindvalue](../functions/structfindvalue.md) +- structGet [structget](../functions/structget.md) +- structGetMetadata [structgetmetadata](../functions/structgetmetadata.md) +- structInsert [structinsert](../functions/structinsert.md) +- structIsCaseSensitive [structiscasesensitive](../functions/structiscasesensitive.md) +- structIsEmpty [structisempty](../functions/structisempty.md) +- structIsOrdered [structisordered](../functions/structisordered.md) +- structKeyArray [structkeyarray](../functions/structkeyarray.md) +- structKeyExists [structkeyexists](../functions/structkeyexists.md) +- structKeyList [structkeylist](../functions/structkeylist.md) +- structKeyTranslate [structkeytranslate](../functions/structkeytranslate.md) +- structListNew [structlistnew](../functions/structlistnew.md) +- structMap [structmap](../functions/structmap.md) +- structNew [structnew](../functions/structnew.md) +- structReduce [structreduce](../functions/structreduce.md) +- structSetMetadata [structsetmetadata](../functions/structsetmetadata.md) +- structSome [structsome](../functions/structsome.md) +- structSort [structsort](../functions/structsort.md) +- structToSorted [structtosorted](../functions/structtosorted.md) +- structUpdate [structupdate](../functions/structupdate.md) +- structValueArray [structvaluearray](../functions/structvaluearray.md) +- systemCacheClear [systemcacheclear](../functions/systemcacheclear.md) +- systemOutput [systemoutput](../functions/systemoutput.md) +- tan [tan](../functions/tan.md) +- threadJoin [threadjoin](../functions/threadjoin.md) +- threadTerminate [threadterminate](../functions/threadterminate.md) +- throw [throw](../functions/throw.md) +- timeFormat [timeformat](../functions/timeformat.md) +- toBase64 [tobase64](../functions/tobase64.md) +- toBinary [tobinary](../functions/tobinary.md) +- toNumeric [tonumeric](../functions/tonumeric.md) +- toScript [toscript](../functions/toscript.md) +- toString [tostring](../functions/tostring.md) +- trace [trace](../functions/trace.md) +- transactionCommit [transactioncommit](../functions/transactioncommit.md) +- transactionRollback [transactionrollback](../functions/transactionrollback.md) +- transactionSetSavepoint [transactionsetsavepoint](../functions/transactionsetsavepoint.md) +- trim [trim](../functions/trim.md) +- trueFalseFormat [truefalseformat](../functions/truefalseformat.md) +- uCase [ucase](../functions/ucase.md) +- ucFirst [ucfirst](../functions/ucfirst.md) +- unserializeJava [unserializejava](../functions/unserializejava.md) +- urlDecode [urldecode](../functions/urldecode.md) +- urlEncode [urlencode](../functions/urlencode.md) +- urlEncodedFormat [urlencodedformat](../functions/urlencodedformat.md) +- urlSessionFormat [urlsessionformat](../functions/urlsessionformat.md) +- val [val](../functions/val.md) +- valueArray [valuearray](../functions/valuearray.md) +- valueList [valuelist](../functions/valuelist.md) +- verifyBCryptHash [verifybcrypthash](../functions/verifybcrypthash.md) +- verifyClient [verifyclient](../functions/verifyclient.md) +- verifyEncryptedJWT [verifyencryptedjwt](../functions/verifyencryptedjwt.md) +- verifySCryptHash [verifyscrypthash](../functions/verifyscrypthash.md) +- verifySignedJWT [verifysignedjwt](../functions/verifysignedjwt.md) +- webserviceNew [webservicenew](../functions/webservicenew.md) +- week [week](../functions/week.md) +- wrap [wrap](../functions/wrap.md) +- writeBody [writebody](../functions/writebody.md) +- writeDump [writedump](../functions/writedump.md) +- writeLog [writelog](../functions/writelog.md) +- writeOutput [writeoutput](../functions/writeoutput.md) +- wsGetAllChannels [wsgetallchannels](../functions/wsgetallchannels.md) +- wsGetSubscribers [wsgetsubscribers](../functions/wsgetsubscribers.md) +- wsPublish [wspublish](../functions/wspublish.md) +- wsSendMessage [wssendmessage](../functions/wssendmessage.md) +- xmlChildPos [xmlchildpos](../functions/xmlchildpos.md) +- xmlClear [xmlclear](../functions/xmlclear.md) +- xmlDeleteAt [xmldeleteat](../functions/xmldeleteat.md) +- xmlElemNew [xmlelemnew](../functions/xmlelemnew.md) +- xmlFormat [xmlformat](../functions/xmlformat.md) +- xmlGetNodeType [xmlgetnodetype](../functions/xmlgetnodetype.md) +- xmlHasChild [xmlhaschild](../functions/xmlhaschild.md) +- xmlNew [xmlnew](../functions/xmlnew.md) +- xmlParse [xmlparse](../functions/xmlparse.md) +- xmlSearch [xmlsearch](../functions/xmlsearch.md) +- xmlTransform [xmltransform](../functions/xmltransform.md) +- xmlUpdate [xmlupdate](../functions/xmlupdate.md) +- xmlValidate [xmlvalidate](../functions/xmlvalidate.md) +- year [year](../functions/year.md) +- yesNoFormat [yesnoformat](../functions/yesnoformat.md) diff --git a/docs/categories/array-functions.md b/docs/categories/array-functions.md new file mode 100644 index 000000000..39ca8ec32 --- /dev/null +++ b/docs/categories/array-functions.md @@ -0,0 +1,56 @@ +# Array Functions + +- arrayAppend [arrayAppend](../functions/arrayappend.md) +- arrayAvg [arrayAvg](../functions/arrayavg.md) +- arrayClear [arrayClear](../functions/arrayclear.md) +- arrayContains [arrayContains](../functions/arraycontains.md) +- arrayContainsNoCase [arrayContainsNoCase](../functions/arraycontainsnocase.md) +- arrayDelete [arrayDelete](../functions/arraydelete.md) +- arrayDeleteAt [arrayDeleteAt](../functions/arraydeleteat.md) +- arrayDeleteNoCase [arrayDeleteNoCase](../functions/arraydeletenocase.md) +- arrayEach [arrayEach](../functions/arrayeach.md) +- arrayEvery [arrayEvery](../functions/arrayevery.md) +- arrayFilter [arrayFilter](../functions/arrayfilter.md) +- arrayFind [arrayFind](../functions/arrayfind.md) +- arrayFindAll [arrayFindAll](../functions/arrayfindall.md) +- arrayFindAllNoCase [arrayFindAllNoCase](../functions/arrayfindallnocase.md) +- arrayFindNoCase [arrayFindNoCase](../functions/arrayfindnocase.md) +- arrayFirst [arrayFirst](../functions/arrayfirst.md) +- arrayGetMetadata [arrayGetMetadata](../functions/arraygetmetadata.md) +- arrayIndexExists [arrayIndexExists](../functions/arrayindexexists.md) +- arrayInsertAt [arrayInsertAt](../functions/arrayinsertat.md) +- arrayIsDefined [arrayIsDefined](../functions/arrayisdefined.md) +- arrayIsEmpty [arrayIsEmpty](../functions/arrayisempty.md) +- arrayLast [arrayLast](../functions/arraylast.md) +- arrayLen [arrayLen](../functions/arraylen.md) +- arrayMap [arrayMap](../functions/arraymap.md) +- arrayMax [arrayMax](../functions/arraymax.md) +- arrayMedian [arrayMedian](../functions/arraymedian.md) +- arrayMerge [arrayMerge](../functions/arraymerge.md) +- arrayMid [arrayMid](../functions/arraymid.md) +- arrayMin [arrayMin](../functions/arraymin.md) +- arrayNew [arrayNew](../functions/arraynew.md) +- arrayPop [arrayPop](../functions/arraypop.md) +- arrayPrepend [arrayPrepend](../functions/arrayprepend.md) +- arrayPush [arrayPush](../functions/arraypush.md) +- arrayReduce [arrayReduce](../functions/arrayreduce.md) +- arrayResize [arrayResize](../functions/arrayresize.md) +- arrayReverse [arrayReverse](../functions/arrayreverse.md) +- arraySet [arraySet](../functions/arrayset.md) +- arrayShift [arrayShift](../functions/arrayshift.md) +- arraySetMetadata [arraySetMetadata](../functions/arraysetmetadata.md) +- arraySlice [arraySlice](../functions/arrayslice.md) +- arraySome [arraySome](../functions/arraysome.md) +- arraySort [arraySort](../functions/arraysort.md) +- arraySplice [arraySplice](../functions/arraysplice.md) +- arraySum [arraySum](../functions/arraysum.md) +- arraySwap [arraySwap](../functions/arrayswap.md) +- arrayToList [arrayToList](../functions/arraytolist.md) +- arrayToStruct [arrayToStruct](../functions/arraytostruct.md) +- arrayUnshift [arrayUnshift](../functions/arrayunshift.md) +- isArray [isArray](../functions/isarray.md) +- javaCast [javacast](../functions/javacast.md) +- listToArray [listToArray](../functions/listtoarray.md) +- queryColumnArray [queryColumnArray](../functions/querycolumnarray.md) +- structKeyArray [structKeyArray](../functions/structkeyarray.md) +- valueArray [valueArray](../functions/valuearray.md) diff --git a/docs/categories/cache-functions.md b/docs/categories/cache-functions.md new file mode 100644 index 000000000..af7380083 --- /dev/null +++ b/docs/categories/cache-functions.md @@ -0,0 +1,21 @@ +# Cache Functions + +- cacheClear [cacheClear](../functions/cacheclear.md) +- cacheCount [cacheCount](../functions/cachecount.md) +- cacheDelete [cacheDelete](../functions/cachedelete.md) +- cacheGet [cacheGet](../functions/cacheget.md) +- cacheGetAll [cacheGetAll](../functions/cachegetall.md) +- cacheGetAllIds [cacheGetAllIds](../functions/cachegetallids.md) +- cacheGetDefaultCacheName [cacheGetDefaultCacheName](../functions/cachegetdefaultcachename.md) +- cacheGetEngineProperties [cacheGetEngineProperties](../functions/cachegetengineproperties.md) +- cacheGetMetadata [cacheGetMetadata](../functions/cachegetmetadata.md) +- cacheGetProperties [cacheGetProperties](../functions/cachegetproperties.md) +- cacheGetSession [cacheGetSession](../functions/cachegetsession.md) +- cacheIdExists [cacheIdExists](../functions/cacheidexists.md) +- cachePut [cachePut](../functions/cacheput.md) +- cacheRegionExists [cacheRegionExists](../functions/cacheregionexists.md) +- cacheRegionNew [cacheRegionNew](../functions/cacheregionnew.md) +- cacheRegionRemove [cacheRegionRemove](../functions/cacheregionremove.md) +- cacheRemove [cacheRemove](../functions/cacheremove.md) +- cacheRemoveAll [cacheRemoveAll](../functions/cacheremoveall.md) +- cacheSetProperties [cacheSetProperties](../functions/cachesetproperties.md) diff --git a/docs/categories/cf10.md b/docs/categories/cf10.md new file mode 100644 index 000000000..74862ac0d --- /dev/null +++ b/docs/categories/cf10.md @@ -0,0 +1,65 @@ +# ColdFusion 10 New Functions and Tags + +- arrayEach [arrayEach](../functions/arrayeach.md) +- arrayFilter [arrayFilter](../functions/arrayfilter.md) +- arrayFindAll [arrayFindAll](../functions/arrayfindall.md) +- arrayFindAllNoCase [arrayFindAllNoCase](../functions/arrayfindallnocase.md) +- arraySlice [arraySlice](../functions/arrayslice.md) +- cacheIdExists [cacheIdExists](../functions/cacheidexists.md) +- cacheRegionExists [cacheRegionExists](../functions/cacheregionexists.md) +- cacheRegionNew [cacheRegionNew](../functions/cacheregionnew.md) +- cacheRegionRemove [cacheRegionRemove](../functions/cacheregionremove.md) +- cacheRemoveAll [cacheRemoveAll](../functions/cacheremoveall.md) +- callStackDump [callStackDump](../functions/callstackdump.md) +- callStackGet [callStackGet](../functions/callstackget.md) +- canonicalize [canonicalize](../functions/canonicalize.md) +- cfexchangeconversation [cfexchangeconversation](../tags/cfexchangeconversation.md) +- cfexchangefolder [cfexchangefolder](../tags/cfexchangefolder.md) +- cfwebsocket [cfwebsocket](../tags/cfwebsocket.md) +- csrfGenerateToken [csrfGenerateToken](../functions/csrfgeneratetoken.md) +- csrfVerifyToken [csrfVerifyToken](../functions/csrfverifytoken.md) +- dateTimeFormat [dateTimeFormat](../functions/datetimeformat.md) +- decodeForHTML [decodeForHTML](../functions/decodeforhtml.md) +- decodeFromURL [decodeFromURL](../functions/decodefromurl.md) +- directoryCopy [directoryCopy](../functions/directorycopy.md) +- encodeForCSS [encodeForCSS](../functions/encodeforcss.md) +- encodeForDN [encodeForDN](../functions/encodefordn.md) +- encodeForHTML [encodeForHTML](../functions/encodeforhtml.md) +- encodeForHTMLAttribute [encodeForHTMLAttribute](../functions/encodeforhtmlattribute.md) +- encodeForJavaScript [encodeForJavaScript](../functions/encodeforjavascript.md) +- encodeForURL [encodeForURL](../functions/encodeforurl.md) +- encodeForXML [encodeForXML](../functions/encodeforxml.md) +- fileGetMimeType [fileGetMimeType](../functions/filegetmimetype.md) +- getApplicationMetadata [getApplicationMetadata](../functions/getapplicationmetadata.md) +- getCpuUsage [getCpuUsage](../functions/getcpuusage.md) +- getFreeSpace [getFreeSpace](../functions/getfreespace.md) +- getSystemFreeMemory [getSystemFreeMemory](../functions/getsystemfreememory.md) +- getSystemTotalMemory [getSystemTotalMemory](../functions/getsystemtotalmemory.md) +- getTotalSpace [getTotalSpace](../functions/gettotalspace.md) +- hmac [hmac](../functions/hmac.md) +- imageCreateCaptcha [imageCreateCaptcha](../functions/imagecreatecaptcha.md) +- imageMakeColorTransparent [imageMakeColorTransparent](../functions/imagemakecolortransparent.md) +- imageMakeTranslucent [imageMakeTranslucent](../functions/imagemaketranslucent.md) +- invoke [invoke](../functions/invoke.md) +- isClosure [isClosure](../functions/isclosure.md) +- listFilter [listFilter](../functions/listfilter.md) +- listRemoveDuplicates [listRemoveDuplicates](../functions/listremoveduplicates.md) +- lsDateTimeFormat [lsDateTimeFormat](../functions/lsdatetimeformat.md) +- ormIndex [ormIndex](../functions/ormindex.md) +- ormIndexPurge [ormIndexPurge](../functions/ormindexpurge.md) +- ormSearch [ormSearch](../functions/ormsearch.md) +- ormSearchOffline [ormSearchOffline](../functions/ormsearchoffline.md) +- reEscape [reEscape](../functions/reescape.md) +- removeCachedQuery [removeCachedQuery](../functions/removecachedquery.md) +- restDeleteApplication [restDeleteApplication](../functions/restdeleteapplication.md) +- restInitApplication [restInitApplication](../functions/restinitapplication.md) +- restSetResponse [restSetResponse](../functions/restsetresponse.md) +- sessionGetMetadata [sessionGetMetadata](../functions/sessiongetmetadata.md) +- sessionInvalidate [sessionInvalidate](../functions/sessioninvalidate.md) +- sessionRotate [sessionRotate](../functions/sessionrotate.md) +- structEach [structEach](../functions/structeach.md) +- structFilter [structFilter](../functions/structfilter.md) +- wsGetAllChannels [wsGetAllChannels](../functions/wsgetallchannels.md) +- wsGetSubscribers [wsGetSubscribers](../functions/wsgetsubscribers.md) +- wsPublish [wsPublish](../functions/wspublish.md) +- wsSendMessage [wsSendMessage](../functions/wssendmessage.md) diff --git a/docs/categories/cf11.md b/docs/categories/cf11.md new file mode 100644 index 000000000..fb82b2971 --- /dev/null +++ b/docs/categories/cf11.md @@ -0,0 +1,34 @@ +# ColdFusion 11 New Functions and Tags + +- arrayMap [arrayMap](../functions/arraymap.md) +- arrayReduce [arrayReduce](../functions/arrayreduce.md) +- cf_socialplugin [cf_socialplugin](../tags/cf_socialplugin.md) +- cfclient [cfclient](../tags/cfclient.md) +- cfclientsettings [cfclientsettings](../tags/cfclientsettings.md) +- cfhtmltopdf [cfhtmltopdf](../tags/cfhtmltopdf.md) +- cfhtmltopdfitem [cfhtmltopdfitem](../tags/cfhtmltopdfitem.md) +- cfimapfilter [cfimapfilter](../tags/cfimapfilter.md) +- cfoauth [cfoauth](../tags/cfoauth.md) +- deserialize [deserialize](../functions/deserialize.md) +- deserializeXML [deserializeXML](../functions/deserializexml.md) +- encodeForLDAP [encodeForLDAP](../functions/encodeforldap.md) +- encodeForXMLAttribute [encodeForXMLAttribute](../functions/encodeforxmlattribute.md) +- encodeForXPath [encodeForXPath](../functions/encodeforxpath.md) +- generatePBKDFKey [generatePBKDFKey](../functions/generatepbkdfkey.md) +- getSafeHTML [getSafeHTML](../functions/getsafehtml.md) +- imageGetMetadata [imageGetMetadata](../functions/imagegetmetadata.md) +- invalidateOauthAccesstoken [invalidateOauthAccesstoken](../functions/invalidateoauthaccesstoken.md) +- isFileObject [isFileObject](../functions/isfileobject.md) +- isSafeHTML [isSafeHTML](../functions/issafehtml.md) +- isValidOauthAccesstoken [isValidOauthAccesstoken](../functions/isvalidoauthaccesstoken.md) +- listEach [listEach](../functions/listeach.md) +- listMap [listMap](../functions/listmap.md) +- listReduce [listReduce](../functions/listreduce.md) +- queryExecute [queryExecute](../functions/queryexecute.md) +- queryGetRow [queryGetRow](../functions/querygetrow.md) +- serialize [serialize](../functions/serialize.md) +- serializeXML [serializeXML](../functions/serializexml.md) +- spreadsheetAddAutoFilter [spreadsheetAddAutoFilter](../functions/spreadsheetaddautofilter.md) +- spreadsheetAddPagebreaks [spreadsheetAddPagebreaks](../functions/spreadsheetaddpagebreaks.md) +- structMap [structMap](../functions/structmap.md) +- structReduce [structReduce](../functions/structreduce.md) diff --git a/docs/categories/cf2016.md b/docs/categories/cf2016.md new file mode 100644 index 000000000..2292e8dd0 --- /dev/null +++ b/docs/categories/cf2016.md @@ -0,0 +1,25 @@ +# ColdFusion 2016 New Functions and Tags + +- arrayContainsNoCase [arrayContainsNoCase](../functions/arraycontainsnocase.md) +- arrayDeleteNoCase [arrayDeleteNoCase](../functions/arraydeletenocase.md) +- arrayGetMetadata [arrayGetMetadata](../functions/arraygetmetadata.md) +- arraySetMetadata [arraySetMetadata](../functions/arraysetmetadata.md) +- booleanFormat [booleanFormat](../functions/booleanformat.md) +- encodeFor [encodeFor](../functions/encodefor.md) +- exceptionKeyExists [exceptionKeyExists](../functions/exceptionkeyexists.md) +- floor [floor](../functions/floor.md) +- getCanonicalPath [getCanonicalPath](../functions/getcanonicalpath.md) +- isDateObject [isDateObject](../functions/isdateobject.md) +- isPDFArchive [isPDFArchive](../functions/ispdfarchive.md) +- queryEach [queryEach](../functions/queryeach.md) +- queryFilter [queryFilter](../functions/queryfilter.md) +- queryKeyExists [queryKeyExists](../functions/querykeyexists.md) +- queryMap [queryMap](../functions/querymap.md) +- queryReduce [queryReduce](../functions/queryreduce.md) +- querySort [querySort](../functions/querysort.md) +- replaceListNoCase [replaceListNoCase](../functions/replacelistnocase.md) +- spreadsheetGetColumnCount [spreadsheetGetColumnCount](../functions/spreadsheetgetcolumncount.md) +- structGetMetadata [structGetMetadata](../functions/structgetmetadata.md) +- structSetMetadata [structSetMetadata](../functions/structsetmetadata.md) +- structToSorted [structToSorted](../functions/structtosorted.md) +- valueArray [valueArray](../functions/valuearray.md) diff --git a/docs/categories/cf2018.md b/docs/categories/cf2018.md new file mode 100644 index 000000000..509cb5553 --- /dev/null +++ b/docs/categories/cf2018.md @@ -0,0 +1,24 @@ +# ColdFusion 2018 New Functions and Tags + +- arrayEvery [arrayEvery](../functions/arrayevery.md) +- arrayFirst [arrayFirst](../functions/arrayfirst.md) +- arrayLast [arrayLast](../functions/arraylast.md) +- arraySome [arraySome](../functions/arraysome.md) +- arraySplice [arraySplice](../functions/arraysplice.md) +- cacheGetEngineProperties [cacheGetEngineProperties](../functions/cachegetengineproperties.md) +- queryAppend [queryAppend](../functions/queryappend.md) +- queryClear [queryClear](../functions/queryclear.md) +- queryDeleteColumn [queryDeleteColumn](../functions/querydeletecolumn.md) +- queryDeleteRow [queryDeleteRow](../functions/querydeleterow.md) +- queryEvery [queryEvery](../functions/queryevery.md) +- queryInsertAt [queryInsertAt](../functions/queryinsertat.md) +- queryPrepend [queryPrepend](../functions/queryprepend.md) +- queryRecordCount [queryRecordCount](../functions/queryrecordcount.md) +- queryReverse [queryReverse](../functions/queryreverse.md) +- queryRowSwap [queryRowSwap](../functions/queryrowswap.md) +- querySlice [querySlice](../functions/queryslice.md) +- querySome [querySome](../functions/querysome.md) +- runAsync [runAsync](../functions/runasync.md) +- structEvery [structEvery](../functions/structevery.md) +- structIsOrdered [structIsOrdered](../functions/structisordered.md) +- structSome [structSome](../functions/structsome.md) diff --git a/docs/categories/cf2021.md b/docs/categories/cf2021.md new file mode 100644 index 000000000..621ac8b56 --- /dev/null +++ b/docs/categories/cf2021.md @@ -0,0 +1,26 @@ +# ColdFusion 2021 New Functions and Tags + +- arrayPop [arrayPop](../functions/arraypop.md) +- arrayPush [arrayPush](../functions/arraypush.md) +- arrayReduceRight [arrayReduceRight](../functions/arrayreduceright.md) +- arrayShift [arrayShift](../functions/arrayshift.md) +- arrayUnshift [arrayUnshift](../functions/arrayunshift.md) +- cfjava [cfjava](../tags/cfjava.md) +- clearTimeZone [clearTimeZone](../functions/cleartimezone.md) +- generateBCryptHash [generateBCryptHash](../functions/generatebcrypthash.md) +- generateSCryptHash [generateSCryptHash](../functions/generatescrypthash.md) +- getTimeZone [getTimeZone](../functions/gettimezone.md) +- listReduceRight [listReduceRight](../functions/listreduceright.md) +- millisecond [millisecond](../functions/millisecond.md) +- setTimeZone [setTimeZone](../functions/settimezone.md) +- stringEach [stringEach](../functions/stringeach.md) +- stringEvery [stringEvery](../functions/stringevery.md) +- stringFilter [stringFilter](../functions/stringfilter.md) +- stringMap [stringMap](../functions/stringmap.md) +- stringReduce [stringReduce](../functions/stringreduce.md) +- stringReduceRight [stringReduceRight](../functions/stringreduceright.md) +- stringSome [stringSome](../functions/stringsome.md) +- stringSort [stringSort](../functions/stringsort.md) +- structIsCaseSensitive [structIsCaseSensitive](../functions/structiscasesensitive.md) +- verifyBCryptHash [verifyBCryptHash](../functions/verifybcrypthash.md) +- verifySCryptHash [verifySCryptHash](../functions/verifyscrypthash.md) diff --git a/docs/categories/cf2023.md b/docs/categories/cf2023.md new file mode 100644 index 000000000..c895e71b9 --- /dev/null +++ b/docs/categories/cf2023.md @@ -0,0 +1,16 @@ +# ColdFusion 2023 New Functions and Tags + +- createEncryptedJWT [createEncryptedJWT](../functions/createencryptedjwt.md) +- createSignedJWT [createSignedJWT](../functions/createsignedjwt.md) +- deserializeAvro [deserializeAvro](../functions/deserializeavro.md) +- deserializeProtobuf [deserializeProtobuf](../functions/deserializeprotobuf.md) +- generateGraphQLModels [generateGraphQLModels](../functions/generategraphqlmodels.md) +- getGraphQLClient [getGraphQLClient](../functions/getgraphqlclient.md) +- serializeAvro [serializeAvro](../functions/serializeavro.md) +- serializeProtobuf [serializeProtobuf](../functions/serializeprotobuf.md) +- verifyEncryptedJWT [verifyEncryptedJWT](../functions/verifyencryptedjwt.md) +- verifySignedJWT [verifySignedJWT](../functions/verifysignedjwt.md) +- xmlClear [xmlClear](../functions/xmlclear.md) +- xmlDeleteAt [xmlDeleteAt](../functions/xmldeleteat.md) +- xmlHasChild [xmlHasChild](../functions/xmlhaschild.md) +- xmlUpdate [xmlUpdate](../functions/xmlupdate.md) diff --git a/docs/categories/cf4.md b/docs/categories/cf4.md new file mode 100644 index 000000000..b121123f7 --- /dev/null +++ b/docs/categories/cf4.md @@ -0,0 +1,56 @@ +# ColdFusion 4 New Functions and Tags + +- acos [acos](../functions/acos.md) +- asin [asin](../functions/asin.md) +- atn [atn](../functions/atn.md) +- cfassociate [cfassociate](../tags/cfassociate.md) +- cfcache [cfcache](../tags/cfcache.md) +- cfcase [cfcase](../tags/cfcase.md) +- cfcatch [cfcatch](../tags/cfcatch.md) +- cfcollection [cfcollection](../tags/cfcollection.md) +- cfdefaultcase [cfdefaultcase](../tags/cfdefaultcase.md) +- cfhttpparam [cfhttpparam](../tags/cfhttpparam.md) +- cflock [cflock](../tags/cflock.md) +- cfprocparam [cfprocparam](../tags/cfprocparam.md) +- cfprocresult [cfprocresult](../tags/cfprocresult.md) +- cfregistry [cfregistry](../tags/cfregistry.md) +- cfscript [cfscript](../tags/cfscript.md) +- cfstoredproc [cfstoredproc](../tags/cfstoredproc.md) +- cfswitch [cfswitch](../tags/cfswitch.md) +- cfthrow [cfthrow](../tags/cfthrow.md) +- cftry [cftry](../tags/cftry.md) +- cfwddx [cfwddx](../tags/cfwddx.md) +- createUUID [createUUID](../functions/createuuid.md) +- dateConvert [dateConvert](../functions/dateconvert.md) +- decrypt [decrypt](../functions/decrypt.md) +- directoryExists [directoryExists](../functions/directoryexists.md) +- encrypt [encrypt](../functions/encrypt.md) +- getBaseTagData [getBaseTagData](../functions/getbasetagdata.md) +- getBaseTemplatePath [getBaseTemplatePath](../functions/getbasetemplatepath.md) +- getCurrentTemplatePath [getCurrentTemplatePath](../functions/getcurrenttemplatepath.md) +- getProfileString [getProfileString](../functions/getprofilestring.md) +- getTickCount [getTickCount](../functions/gettickcount.md) +- getTimezoneInfo [getTimezoneInfo](../functions/gettimezoneinfo.md) +- isDebugMode [isDebugMode](../functions/isdebugmode.md) +- isStruct [isStruct](../functions/isstruct.md) +- listQualify [listQualify](../functions/listqualify.md) +- listSort [listSort](../functions/listsort.md) +- listToArray [listToArray](../functions/listtoarray.md) +- listValueCount [listValueCount](../functions/listvaluecount.md) +- listValueCountNoCase [listValueCountNoCase](../functions/listvaluecountnocase.md) +- lsEuroCurrencyFormat [lsEuroCurrencyFormat](../functions/lseurocurrencyformat.md) +- lsParseEuroCurrency [lsParseEuroCurrency](../functions/lsparseeurocurrency.md) +- queryAddColumn [queryAddColumn](../functions/queryaddcolumn.md) +- reFindNoCase [reFindNoCase](../functions/refindnocase.md) +- reReplaceNoCase [reReplaceNoCase](../functions/rereplacenocase.md) +- setProfileString [setProfileString](../functions/setprofilestring.md) +- structClear [structClear](../functions/structclear.md) +- structCopy [structCopy](../functions/structcopy.md) +- structCount [structCount](../functions/structcount.md) +- structDelete [structDelete](../functions/structdelete.md) +- structFind [structFind](../functions/structfind.md) +- structInsert [structInsert](../functions/structinsert.md) +- structIsEmpty [structIsEmpty](../functions/structisempty.md) +- structKeyArray [structKeyArray](../functions/structkeyarray.md) +- structKeyList [structKeyList](../functions/structkeylist.md) +- writeOutput [writeOutput](../functions/writeoutput.md) diff --git a/docs/categories/cf45.md b/docs/categories/cf45.md new file mode 100644 index 000000000..f9e40b622 --- /dev/null +++ b/docs/categories/cf45.md @@ -0,0 +1,24 @@ +# ColdFusion 4.5 New Functions and Tags + +- cfexecute [cfexecute](../tags/cfexecute.md) +- cfmailparam [cfmailparam](../tags/cfmailparam.md) +- cfprocessingdirective [cfprocessingdirective](../tags/cfprocessingdirective.md) +- cfqueryparam [cfqueryparam](../tags/cfqueryparam.md) +- cfrethrow [cfrethrow](../tags/cfrethrow.md) +- cfservlet [cfservlet](../tags/cfservlet.md) +- cfservletparam [cfservletparam](../tags/cfservletparam.md) +- cfsilent [cfsilent](../tags/cfsilent.md) +- createObject [createObject](../functions/createobject.md) +- duplicate [duplicate](../functions/duplicate.md) +- getFunctionList [getFunctionList](../functions/getfunctionlist.md) +- getHTTPTimeString [getHTTPTimeString](../functions/gethttptimestring.md) +- getMetricData [getMetricData](../functions/getmetricdata.md) +- hash [hash](../functions/hash.md) +- isBinary [isBinary](../functions/isbinary.md) +- javaCast [javaCast](../functions/javacast.md) +- jsStringFormat [jsStringFormat](../functions/jsstringformat.md) +- toBase64 [toBase64](../functions/tobase64.md) +- toBinary [toBinary](../functions/tobinary.md) +- toString [toString](../functions/tostring.md) +- urlDecode [urlDecode](../functions/urldecode.md) +- xmlFormat [xmlFormat](../functions/xmlformat.md) diff --git a/docs/categories/cf5.md b/docs/categories/cf5.md new file mode 100644 index 000000000..973d928f6 --- /dev/null +++ b/docs/categories/cf5.md @@ -0,0 +1,8 @@ +# ColdFusion 5 New Functions and Tags + +- cfdump [cfdump](../tags/cfdump.md) +- cfflush [cfflush](../tags/cfflush.md) +- cflog [cflog](../tags/cflog.md) +- cfsavecontent [cfsavecontent](../tags/cfsavecontent.md) +- getHTTPRequestData [getHTTPRequestData](../functions/gethttprequestdata.md) +- isCustomFunction [isCustomFunction](../functions/iscustomfunction.md) diff --git a/docs/categories/cf6.md b/docs/categories/cf6.md new file mode 100644 index 000000000..b76391b19 --- /dev/null +++ b/docs/categories/cf6.md @@ -0,0 +1,36 @@ +# ColdFusion 6 New Functions and Tags + +- cfargument [cfargument](../tags/cfargument.md) +- cfchart [cfchart](../tags/cfchart.md) +- cfchartdata [cfchartdata](../tags/cfchartdata.md) +- cfchartseries [cfchartseries](../tags/cfchartseries.md) +- cfcomponent [cfcomponent](../tags/cfcomponent.md) +- cffunction [cffunction](../tags/cffunction.md) +- cfimport [cfimport](../tags/cfimport.md) +- cfinvoke [cfinvoke](../tags/cfinvoke.md) +- cfinvokeargument [cfinvokeargument](../tags/cfinvokeargument.md) +- cflogin [cflogin](../tags/cflogin.md) +- cfloginuser [cfloginuser](../tags/cfloginuser.md) +- cflogout [cflogout](../tags/cflogout.md) +- cfobjectcache [cfobjectcache](../tags/cfobjectcache.md) +- cfproperty [cfproperty](../tags/cfproperty.md) +- cfreturn [cfreturn](../tags/cfreturn.md) +- cftrace [cftrace](../tags/cftrace.md) +- cfxml [cfxml](../tags/cfxml.md) +- createDateTime [createDateTime](../functions/createdatetime.md) +- getAuthUser [getAuthUser](../functions/getauthuser.md) +- getEncoding [getEncoding](../functions/getencoding.md) +- getK2ServerDocCount [getK2ServerDocCount](../functions/getk2serverdoccount.md) +- getK2ServerDocCountLimit [getK2ServerDocCountLimit](../functions/getk2serverdoccountlimit.md) +- getMetadata [getMetadata](../functions/getmetadata.md) +- getPageContext [getPageContext](../functions/getpagecontext.md) +- getProfileSections [getProfileSections](../functions/getprofilesections.md) +- isK2ServerABroker [isK2ServerABroker](../functions/isk2serverabroker.md) +- isK2ServerDocCountExceeded [isK2ServerDocCountExceeded](../functions/isk2serverdoccountexceeded.md) +- isK2ServerOnline [isK2ServerOnline](../functions/isk2serveronline.md) +- isObject [isObject](../functions/isobject.md) +- isUserInRole [isUserInRole](../functions/isuserinrole.md) +- isXMLDoc [isXMLDoc](../functions/isxmldoc.md) +- isXMLElem [isXMLElem](../functions/isxmlelem.md) +- isXMLRoot [isXMLRoot](../functions/isxmlroot.md) +- xmlSearch [xmlSearch](../functions/xmlsearch.md) diff --git a/docs/categories/cf7.md b/docs/categories/cf7.md new file mode 100644 index 000000000..197ee8f94 --- /dev/null +++ b/docs/categories/cf7.md @@ -0,0 +1,39 @@ +# ColdFusion 7 New Functions and Tags + +- addSOAPRequestHeader [addSOAPRequestHeader](../functions/addsoaprequestheader.md) +- addSOAPResponseHeader [addSOAPResponseHeader](../functions/addsoapresponseheader.md) +- binaryDecode [binaryDecode](../functions/binarydecode.md) +- binaryEncode [binaryEncode](../functions/binaryencode.md) +- cfcalendar [cfcalendar](../tags/cfcalendar.md) +- cfdocument [cfdocument](../tags/cfdocument.md) +- cfdocumentitem [cfdocumentitem](../tags/cfdocumentitem.md) +- cfdocumentsection [cfdocumentsection](../tags/cfdocumentsection.md) +- cfformgroup [cfformgroup](../tags/cfformgroup.md) +- cfformitem [cfformitem](../tags/cfformitem.md) +- cfntauthenticate [cfntauthenticate](../tags/cfntauthenticate.md) +- cfreportparam [cfreportparam](../tags/cfreportparam.md) +- cftextarea [cftextarea](../tags/cftextarea.md) +- cftimer [cftimer](../tags/cftimer.md) +- charsetDecode [charsetDecode](../functions/charsetdecode.md) +- charsetEncode [charsetEncode](../functions/charsetencode.md) +- generateSecretKey [generateSecretKey](../functions/generatesecretkey.md) +- getContextRoot [getContextRoot](../functions/getcontextroot.md) +- getGatewayHelper [getGatewayHelper](../functions/getgatewayhelper.md) +- getLocaleDisplayName [getLocaleDisplayName](../functions/getlocaledisplayname.md) +- getSOAPRequest [getSOAPRequest](../functions/getsoaprequest.md) +- getSOAPRequestHeader [getSOAPRequestHeader](../functions/getsoaprequestheader.md) +- getSOAPResponse [getSOAPResponse](../functions/getsoapresponse.md) +- getSOAPResponseHeader [getSOAPResponseHeader](../functions/getsoapresponseheader.md) +- isSOAPRequest [isSOAPRequest](../functions/issoaprequest.md) +- isValid [isValid](../functions/isvalid.md) +- isXML [isXML](../functions/isxml.md) +- isXMLAttribute [isXMLAttribute](../functions/isxmlattribute.md) +- isXMLNode [isXMLNode](../functions/isxmlnode.md) +- onApplicationEnd [onApplicationEnd](../functions/onapplicationend.md) +- onApplicationStart [onApplicationStart](../functions/onapplicationstart.md) +- onError [onError](../functions/onerror.md) +- onRequest [onRequest](../functions/onrequest.md) +- onRequestEnd [onRequestEnd](../functions/onrequestend.md) +- onRequestStart [onRequestStart](../functions/onrequeststart.md) +- onSessionEnd [onSessionEnd](../functions/onsessionend.md) +- onSessionStart [onSessionStart](../functions/onsessionstart.md) diff --git a/docs/categories/cf8.md b/docs/categories/cf8.md new file mode 100644 index 000000000..ca8edb04a --- /dev/null +++ b/docs/categories/cf8.md @@ -0,0 +1,125 @@ +# ColdFusion 8 New Functions and Tags + +- ajaxLink [ajaxLink](../functions/ajaxlink.md) +- ajaxOnLoad [ajaxOnLoad](../functions/ajaxonload.md) +- arrayIsDefined [arrayIsDefined](../functions/arrayisdefined.md) +- cfajaximport [cfajaximport](../tags/cfajaximport.md) +- cfajaxproxy [cfajaxproxy](../tags/cfajaxproxy.md) +- cfdbinfo [cfdbinfo](../tags/cfdbinfo.md) +- cfdiv [cfdiv](../tags/cfdiv.md) +- cfexchangecalendar [cfexchangecalendar](../tags/cfexchangecalendar.md) +- cfexchangeconnection [cfexchangeconnection](../tags/cfexchangeconnection.md) +- cfexchangecontact [cfexchangecontact](../tags/cfexchangecontact.md) +- cfexchangefilter [cfexchangefilter](../tags/cfexchangefilter.md) +- cfexchangemail [cfexchangemail](../tags/cfexchangemail.md) +- cfexchangetask [cfexchangetask](../tags/cfexchangetask.md) +- cffeed [cffeed](../tags/cffeed.md) +- cfimage [cfimage](../tags/cfimage.md) +- cfinterface [cfinterface](../tags/cfinterface.md) +- cflayout [cflayout](../tags/cflayout.md) +- cflayoutarea [cflayoutarea](../tags/cflayoutarea.md) +- cfmenu [cfmenu](../tags/cfmenu.md) +- cfmenuitem [cfmenuitem](../tags/cfmenuitem.md) +- cfpdf [cfpdf](../tags/cfpdf.md) +- cfpdfform [cfpdfform](../tags/cfpdfform.md) +- cfpdfformparam [cfpdfformparam](../tags/cfpdfformparam.md) +- cfpdfparam [cfpdfparam](../tags/cfpdfparam.md) +- cfpdfsubform [cfpdfsubform](../tags/cfpdfsubform.md) +- cfpod [cfpod](../tags/cfpod.md) +- cfpresentation [cfpresentation](../tags/cfpresentation.md) +- cfpresentationslide [cfpresentationslide](../tags/cfpresentationslide.md) +- cfpresenter [cfpresenter](../tags/cfpresenter.md) +- cfprint [cfprint](../tags/cfprint.md) +- cfsprydataset [cfsprydataset](../tags/cfsprydataset.md) +- cfthread [cfthread](../tags/cfthread.md) +- cftooltip [cftooltip](../tags/cftooltip.md) +- cfwindow [cfwindow](../tags/cfwindow.md) +- cfzip [cfzip](../tags/cfzip.md) +- cfzipparam [cfzipparam](../tags/cfzipparam.md) +- deserializeJSON [deserializeJSON](../functions/deserializejson.md) +- dotnetToCFType [dotnetToCFType](../functions/dotnettocftype.md) +- fileClose [fileClose](../functions/fileclose.md) +- fileCopy [fileCopy](../functions/filecopy.md) +- fileDelete [fileDelete](../functions/filedelete.md) +- fileIsEOF [fileIsEOF](../functions/fileiseof.md) +- fileMove [fileMove](../functions/filemove.md) +- fileOpen [fileOpen](../functions/fileopen.md) +- fileRead [fileRead](../functions/fileread.md) +- fileReadBinary [fileReadBinary](../functions/filereadbinary.md) +- fileReadLine [fileReadLine](../functions/filereadline.md) +- fileSetAccessMode [fileSetAccessMode](../functions/filesetaccessmode.md) +- fileSetAttribute [fileSetAttribute](../functions/filesetattribute.md) +- fileSetLastModified [fileSetLastModified](../functions/filesetlastmodified.md) +- fileWrite [fileWrite](../functions/filewrite.md) +- fileWriteLine [fileWriteLine](../functions/filewriteline.md) +- getComponentMetadata [getComponentMetadata](../functions/getcomponentmetadata.md) +- getFileInfo [getFileInfo](../functions/getfileinfo.md) +- getPrinterInfo [getPrinterInfo](../functions/getprinterinfo.md) +- getPrinterList [getPrinterList](../functions/getprinterlist.md) +- getReadableImageFormats [getReadableImageFormats](../functions/getreadableimageformats.md) +- getUserRoles [getUserRoles](../functions/getuserroles.md) +- getWriteableImageFormats [getWriteableImageFormats](../functions/getwriteableimageformats.md) +- imageAddBorder [imageAddBorder](../functions/imageaddborder.md) +- imageBlur [imageBlur](../functions/imageblur.md) +- imageClearRect [imageClearRect](../functions/imageclearrect.md) +- imageCopy [imageCopy](../functions/imagecopy.md) +- imageCrop [imageCrop](../functions/imagecrop.md) +- imageDrawArc [imageDrawArc](../functions/imagedrawarc.md) +- imageDrawBeveledRect [imageDrawBeveledRect](../functions/imagedrawbeveledrect.md) +- imageDrawCubicCurve [imageDrawCubicCurve](../functions/imagedrawcubiccurve.md) +- imageDrawLine [imageDrawLine](../functions/imagedrawline.md) +- imageDrawLines [imageDrawLines](../functions/imagedrawlines.md) +- imageDrawOval [imageDrawOval](../functions/imagedrawoval.md) +- imageDrawPoint [imageDrawPoint](../functions/imagedrawpoint.md) +- imageDrawQuadraticCurve [imageDrawQuadraticCurve](../functions/imagedrawquadraticcurve.md) +- imageDrawRect [imageDrawRect](../functions/imagedrawrect.md) +- imageDrawRoundRect [imageDrawRoundRect](../functions/imagedrawroundrect.md) +- imageDrawText [imageDrawText](../functions/imagedrawtext.md) +- imageFlip [imageFlip](../functions/imageflip.md) +- imageGetBlob [imageGetBlob](../functions/imagegetblob.md) +- imageGetBufferedImage [imageGetBufferedImage](../functions/imagegetbufferedimage.md) +- imageGetEXIFMetadata [imageGetEXIFMetadata](../functions/imagegetexifmetadata.md) +- imageGetEXIFTag [imageGetEXIFTag](../functions/imagegetexiftag.md) +- imageGetHeight [imageGetHeight](../functions/imagegetheight.md) +- imageGetIPTCMetadata [imageGetIPTCMetadata](../functions/imagegetiptcmetadata.md) +- imageGetIPTCtag [imageGetIPTCtag](../functions/imagegetiptctag.md) +- imageGetWidth [imageGetWidth](../functions/imagegetwidth.md) +- imageGrayScale [imageGrayScale](../functions/imagegrayscale.md) +- imageInfo [imageInfo](../functions/imageinfo.md) +- imageNegative [imageNegative](../functions/imagenegative.md) +- imageNew [imageNew](../functions/imagenew.md) +- imageOverlay [imageOverlay](../functions/imageoverlay.md) +- imagePaste [imagePaste](../functions/imagepaste.md) +- imageRead [imageRead](../functions/imageread.md) +- imageReadBase64 [imageReadBase64](../functions/imagereadbase64.md) +- imageResize [imageResize](../functions/imageresize.md) +- imageRotate [imageRotate](../functions/imagerotate.md) +- imageRotateDrawingAxis [imageRotateDrawingAxis](../functions/imagerotatedrawingaxis.md) +- imageScaleTofit [imageScaleTofit](../functions/imagescaletofit.md) +- imageSetAntialiasing [imageSetAntialiasing](../functions/imagesetantialiasing.md) +- imageSetBackgroundColor [imageSetBackgroundColor](../functions/imagesetbackgroundcolor.md) +- imageSetDrawingColor [imageSetDrawingColor](../functions/imagesetdrawingcolor.md) +- imageSetDrawingStroke [imageSetDrawingStroke](../functions/imagesetdrawingstroke.md) +- imageSetDrawingTransparency [imageSetDrawingTransparency](../functions/imagesetdrawingtransparency.md) +- imageSharpen [imageSharpen](../functions/imagesharpen.md) +- imageShear [imageShear](../functions/imageshear.md) +- imageShearDrawingAxis [imageShearDrawingAxis](../functions/imagesheardrawingaxis.md) +- imageTranslate [imageTranslate](../functions/imagetranslate.md) +- imageTranslateDrawingAxis [imageTranslateDrawingAxis](../functions/imagetranslatedrawingaxis.md) +- imageWrite [imageWrite](../functions/imagewrite.md) +- imageWriteBase64 [imageWriteBase64](../functions/imagewritebase64.md) +- imageXORDrawingMode [imageXORDrawingMode](../functions/imagexordrawingmode.md) +- isDDX [isDDX](../functions/isddx.md) +- isImage [isImage](../functions/isimage.md) +- isImageFile [isImageFile](../functions/isimagefile.md) +- isInstanceOf [isInstanceOf](../functions/isinstanceof.md) +- isJSON [isJSON](../functions/isjson.md) +- isPDFFile [isPDFFile](../functions/ispdffile.md) +- isPDFObject [isPDFObject](../functions/ispdfobject.md) +- isUserInAnyRole [isUserInAnyRole](../functions/isuserinanyrole.md) +- isUserLoggedIn [isUserLoggedIn](../functions/isuserloggedin.md) +- onMissingMethod [onMissingMethod](../functions/onmissingmethod.md) +- onMissingTemplate [onMissingTemplate](../functions/onmissingtemplate.md) +- reMatch [reMatch](../functions/rematch.md) +- reMatchNoCase [reMatchNoCase](../functions/rematchnocase.md) +- serializeJSON [serializeJSON](../functions/serializejson.md) diff --git a/docs/categories/cf9.md b/docs/categories/cf9.md new file mode 100644 index 000000000..64f07c904 --- /dev/null +++ b/docs/categories/cf9.md @@ -0,0 +1,72 @@ +# ColdFusion 9 New Functions and Tags + +- applicationStop [applicationStop](../functions/applicationstop.md) +- arrayContains [arrayContains](../functions/arraycontains.md) +- arrayFind [arrayFind](../functions/arrayfind.md) +- arrayFindNoCase [arrayFindNoCase](../functions/arrayfindnocase.md) +- cacheGet [cacheGet](../functions/cacheget.md) +- cacheGetAllIds [cacheGetAllIds](../functions/cachegetallids.md) +- cacheGetMetadata [cacheGetMetadata](../functions/cachegetmetadata.md) +- cacheGetProperties [cacheGetProperties](../functions/cachegetproperties.md) +- cachePut [cachePut](../functions/cacheput.md) +- cacheRemove [cacheRemove](../functions/cacheremove.md) +- cacheSetProperties [cacheSetProperties](../functions/cachesetproperties.md) +- cfcontinue [cfcontinue](../tags/cfcontinue.md) +- cffileupload [cffileupload](../tags/cffileupload.md) +- cffinally [cffinally](../tags/cffinally.md) +- cfimap [cfimap](../tags/cfimap.md) +- cfmap [cfmap](../tags/cfmap.md) +- cfmapitem [cfmapitem](../tags/cfmapitem.md) +- cfmediaplayer [cfmediaplayer](../tags/cfmediaplayer.md) +- cfmessagebox [cfmessagebox](../tags/cfmessagebox.md) +- cfprogressbar [cfprogressbar](../tags/cfprogressbar.md) +- cfsharepoint [cfsharepoint](../tags/cfsharepoint.md) +- cfspreadsheet [cfspreadsheet](../tags/cfspreadsheet.md) +- directoryCreate [directoryCreate](../functions/directorycreate.md) +- directoryDelete [directoryDelete](../functions/directorydelete.md) +- directoryList [directoryList](../functions/directorylist.md) +- directoryRename [directoryRename](../functions/directoryrename.md) +- entityDelete [entityDelete](../functions/entitydelete.md) +- entityLoad [entityLoad](../functions/entityload.md) +- entityLoadByExample [entityLoadByExample](../functions/entityloadbyexample.md) +- entityLoadByPK [entityLoadByPK](../functions/entityloadbypk.md) +- entityMerge [entityMerge](../functions/entitymerge.md) +- entityNew [entityNew](../functions/entitynew.md) +- entityReload [entityReload](../functions/entityreload.md) +- entitySave [entitySave](../functions/entitysave.md) +- entityToQuery [entityToQuery](../functions/entitytoquery.md) +- fileSeek [fileSeek](../functions/fileseek.md) +- fileSkipBytes [fileSkipBytes](../functions/fileskipbytes.md) +- getFunctionCalledName [getFunctionCalledName](../functions/getfunctioncalledname.md) +- getVFSMetadata [getVFSMetadata](../functions/getvfsmetadata.md) +- isIPV6 [isIPV6](../functions/isipv6.md) +- isNull [isNull](../functions/isnull.md) +- isSpreadsheetFile [isSpreadsheetFile](../functions/isspreadsheetfile.md) +- isSpreadsheetObject [isSpreadsheetObject](../functions/isspreadsheetobject.md) +- location [location](../functions/location.md) +- objectEquals [objectEquals](../functions/objectequals.md) +- objectLoad [objectLoad](../functions/objectload.md) +- objectSave [objectSave](../functions/objectsave.md) +- onServerStart [onServerStart](../functions/onserverstart.md) +- ormClearSession [ormClearSession](../functions/ormclearsession.md) +- ormCloseSession [ormCloseSession](../functions/ormclosesession.md) +- ormEvictCollection [ormEvictCollection](../functions/ormevictcollection.md) +- ormEvictEntity [ormEvictEntity](../functions/ormevictentity.md) +- ormEvictQueries [ormEvictQueries](../functions/ormevictqueries.md) +- ormExecuteQuery [ormExecuteQuery](../functions/ormexecutequery.md) +- ormFlush [ormFlush](../functions/ormflush.md) +- ormGetSession [ormGetSession](../functions/ormgetsession.md) +- ormGetSessionFactory [ormGetSessionFactory](../functions/ormgetsessionfactory.md) +- ormReload [ormReload](../functions/ormreload.md) +- spreadsheetAddRow [spreadsheetAddRow](../functions/spreadsheetaddrow.md) +- spreadsheetAddRows [spreadsheetAddRows](../functions/spreadsheetaddrows.md) +- spreadsheetFormatCell [spreadsheetFormatCell](../functions/spreadsheetformatcell.md) +- spreadsheetFormatColumn [spreadsheetFormatColumn](../functions/spreadsheetformatcolumn.md) +- spreadsheetFormatColumns [spreadsheetFormatColumns](../functions/spreadsheetformatcolumns.md) +- spreadsheetFormatRow [spreadsheetFormatRow](../functions/spreadsheetformatrow.md) +- spreadsheetFormatRows [spreadsheetFormatRows](../functions/spreadsheetformatrows.md) +- spreadsheetNew [spreadsheetNew](../functions/spreadsheetnew.md) +- throw [throw](../functions/throw.md) +- trace [trace](../functions/trace.md) +- writeDump [writeDump](../functions/writedump.md) +- writeLog [writeLog](../functions/writelog.md) diff --git a/docs/categories/collection-functions.md b/docs/categories/collection-functions.md new file mode 100644 index 000000000..be088b750 --- /dev/null +++ b/docs/categories/collection-functions.md @@ -0,0 +1,8 @@ +# Collection Functions + +- collectionSome [collectionSome](../functions/collectionsome.md) +- collectionEvery [collectionEvery](../functions/collectionevery.md) +- collectionEach [collectionEach](../functions/collectioneach.md) +- collectionFilter [collectionFilter](../functions/collectionfilter.md) +- collectionMap [collectionMap](../functions/collectionmap.md) +- collectionReduce [collectionReduce](../functions/collectionreduce.md) diff --git a/docs/categories/conversion-functions.md b/docs/categories/conversion-functions.md new file mode 100644 index 000000000..4c03772d6 --- /dev/null +++ b/docs/categories/conversion-functions.md @@ -0,0 +1,28 @@ +# Conversion Functions + +- arrayToList [arrayToList](../functions/arraytolist.md) +- binaryDecode [binaryDecode](../functions/binarydecode.md) +- binaryEncode [binaryEncode](../functions/binaryencode.md) +- charsetDecode [charsetDecode](../functions/charsetdecode.md) +- charsetEncode [charsetEncode](../functions/charsetencode.md) +- deserializeJSON [deserializeJSON](../functions/deserializejson.md) +- dotnetToCFType [dotNetToCFType](../functions/dotnettocftype.md) +- entityToQuery [entityToQuery](../functions/entitytoquery.md) +- hash [hash](../functions/hash.md) +- hmac [hmac](../functions/hmac.md) +- htmlParse [HTMLParse](../functions/htmlparse.md) +- lCase [lCase](../functions/lcase.md) +- listToArray [listToArray](../functions/listtoarray.md) +- parseNumber [parseNumber](../functions/parsenumber.md) +- serializeJSON [serializeJSON](../functions/serializejson.md) +- toBase64 [toBase64](../functions/tobase64.md) +- toBinary [toBinary](../functions/tobinary.md) +- toScript [toScript](../functions/toscript.md) +- toString [toString](../functions/tostring.md) +- urlDecode [URLDecode](../functions/urldecode.md) +- urlEncode [URLEncode](../functions/urlencode.md) +- urlEncodedFormat [URLEncodedFormat](../functions/urlencodedformat.md) +- val [val](../functions/val.md) +- xmlFormat [XMLFormat](../functions/xmlformat.md) +- xmlParse [XMLParse](../functions/xmlparse.md) +- xmlTransform [XMLTransform](../functions/xmltransform.md) diff --git a/docs/categories/database-tags.md b/docs/categories/database-tags.md new file mode 100644 index 000000000..4bf1fe48e --- /dev/null +++ b/docs/categories/database-tags.md @@ -0,0 +1,10 @@ +# Database Tags + +- cfdbinfo [cfdbinfo](../tags/cfdbinfo.md) +- cfinsert [cfinsert](../tags/cfinsert.md) +- cfprocparam [cfprocparam](../tags/cfprocparam.md) +- cfprocresult [cfprocresult](../tags/cfprocresult.md) +- cfquery [cfquery](../tags/cfquery.md) +- cfqueryparam [cfqueryparam](../tags/cfqueryparam.md) +- cfstoredproc [cfstoredproc](../tags/cfstoredproc.md) +- cfupdate [cfupdate](../tags/cfupdate.md) diff --git a/docs/categories/date-and-time-functions.md b/docs/categories/date-and-time-functions.md new file mode 100644 index 000000000..708064863 --- /dev/null +++ b/docs/categories/date-and-time-functions.md @@ -0,0 +1,51 @@ +# Date and Time Functions + +- clearTimeZone [clearTimezone](../functions/cleartimezone.md) +- createDate [createDate](../functions/createdate.md) +- createDateTime [createDateTime](../functions/createdatetime.md) +- createODBCDate [createODBCDate](../functions/createodbcdate.md) +- createODBCDateTime [createODBCDateTime](../functions/createodbcdatetime.md) +- createODBCTime [createODBCTime](../functions/createodbctime.md) +- createTime [createTime](../functions/createtime.md) +- createTimespan [createTimespan](../functions/createtimespan.md) +- dateAdd [dateAdd](../functions/dateadd.md) +- dateCompare [dateCompare](../functions/datecompare.md) +- dateConvert [dateConvert](../functions/dateconvert.md) +- dateDiff [dateDiff](../functions/datediff.md) +- dateFormat [dateFormat](../functions/dateformat.md) +- datePart [datePart](../functions/datepart.md) +- dateTimeFormat [dateTimeFormat](../functions/datetimeformat.md) +- day [day](../functions/day.md) +- dayOfWeek [dayOfWeek](../functions/dayofweek.md) +- dayOfWeekAsString [dayOfWeekAsString](../functions/dayofweekasstring.md) +- dayOfWeekShortAsString [dayOfWeekShortAsString](../functions/dayofweekshortasstring.md) +- dayOfYear [dayOfYear](../functions/dayofyear.md) +- daysInMonth [daysInMonth](../functions/daysinmonth.md) +- daysInYear [daysInYear](../functions/daysinyear.md) +- firstDayOfMonth [firstDayOfMonth](../functions/firstdayofmonth.md) +- getHTTPTimeString [getHTTPTimeString](../functions/gethttptimestring.md) +- getNumericDate [getNumericDate](../functions/getnumericdate.md) +- getTickCount [getTickCount](../functions/gettickcount.md) +- getTimeZone [getTimezone](../functions/gettimezone.md) +- getTimezoneInfo [getTimezoneInfo](../functions/gettimezoneinfo.md) +- hour [hour](../functions/hour.md) +- isDate [isDate](../functions/isdate.md) +- isDateObject [isDateObject](../functions/isdateobject.md) +- isLeapYear [isLeapYear](../functions/isleapyear.md) +- isNumericDate [isNumericDate](../functions/isnumericdate.md) +- lsDateFormat [LSDateFormat](../functions/lsdateformat.md) +- lsDayOfWeek [LSDayOfWeek](../functions/lsdayofweek.md) +- lsIsDate [LSIsDate](../functions/lsisdate.md) +- lsParseDateTime [LSParseDateTime](../functions/lsparsedatetime.md) +- lsTimeFormat [LSTimeFormat](../functions/lstimeformat.md) +- minute [minute](../functions/minute.md) +- month [month](../functions/month.md) +- monthAsString [monthAsString](../functions/monthasstring.md) +- monthShortAsString [monthShortAsString](../functions/monthshortasstring.md) +- now [now](../functions/now.md) +- parseDateTime [parseDateTime](../functions/parsedatetime.md) +- quarter [quarter](../functions/quarter.md) +- second [second](../functions/second.md) +- setTimeZone [setTimezone](../functions/settimezone.md) +- timeFormat [timeFormat](../functions/timeformat.md) +- year [year](../functions/year.md) diff --git a/docs/categories/decision-functions.md b/docs/categories/decision-functions.md new file mode 100644 index 000000000..f904a8e02 --- /dev/null +++ b/docs/categories/decision-functions.md @@ -0,0 +1,53 @@ +# Decision Functions + +- directoryExists [directoryExists](../functions/directoryexists.md) +- fileExists [fileExists](../functions/fileexists.md) +- fileIsEOF [fileIsEOF](../functions/fileiseof.md) +- iIf [iIf](../functions/iif.md) +- isArray [isArray](../functions/isarray.md) +- isBinary [isBinary](../functions/isbinary.md) +- isBoolean [isBoolean](../functions/isboolean.md) +- isClosure [isClosure](../functions/isclosure.md) +- isCustomFunction [isCustomFunction](../functions/iscustomfunction.md) +- isDate [isDate](../functions/isdate.md) +- isDateObject [isDateObject](../functions/isdateobject.md) +- isDebugMode [isDebugMode](../functions/isdebugmode.md) +- isDDX [isDDX](../functions/isddx.md) +- isDefined [isDefined](../functions/isdefined.md) +- isFileObject [isFileObject](../functions/isfileobject.md) +- isInstanceOf [isInstanceOf](../functions/isinstanceof.md) +- isIPV6 [isIPv6](../functions/isipv6.md) +- isJSON [isJSON](../functions/isjson.md) +- isLeapYear [isLeapYear](../functions/isleapyear.md) +- isLocalhost [isLocalHost](../functions/islocalhost.md) +- isNull [isNull](../functions/isnull.md) +- isNumeric [isNumeric](../functions/isnumeric.md) +- isNumericDate [isNumericDate](../functions/isnumericdate.md) +- isObject [isObject](../functions/isobject.md) +- isPDFArchive [isPDFArchive](../functions/ispdfarchive.md) +- isPDFFile [isPDFFile](../functions/ispdffile.md) +- isPDFObject [isPDFObject](../functions/ispdfobject.md) +- isQuery [isQuery](../functions/isquery.md) +- isSafeHTML [isSafeHTML](../functions/issafehtml.md) +- isSimpleValue [isSimpleValue](../functions/issimplevalue.md) +- isSOAPRequest [isSoapRequest](../functions/issoaprequest.md) +- isSpreadsheetFile [isSpreadsheetFile](../functions/isspreadsheetfile.md) +- isSpreadsheetObject [isSpreadsheetObject](../functions/isspreadsheetobject.md) +- isStruct [isStruct](../functions/isstruct.md) +- isUserInAnyRole [isUserInAnyRole](../functions/isuserinanyrole.md) +- isUserInRole [isUserInRole](../functions/isuserinrole.md) +- isUserLoggedIn [isUserLoggedIn](../functions/isuserloggedin.md) +- isValid [isValid](../functions/isvalid.md) +- isWDDX [isWDDX](../functions/iswddx.md) +- isXML [isXML](../functions/isxml.md) +- isXMLAttribute [isXmlAttribute](../functions/isxmlattribute.md) +- isXMLDoc [isXmlDoc](../functions/isxmldoc.md) +- isXMLElem [isXmlElem](../functions/isxmlelem.md) +- isXMLNode [isXmlNode](../functions/isxmlnode.md) +- isXMLRoot [isXmlRoot](../functions/isxmlroot.md) +- lsIsCurrency [lsIsCurrency](../functions/lsiscurrency.md) +- lsIsDate [lsIsDate](../functions/lsisdate.md) +- lsIsNumeric [lsIsNumeric](../functions/lsisnumeric.md) +- structIsEmpty [structIsEmpty](../functions/structisempty.md) +- structKeyExists [structKeyExists](../functions/structkeyexists.md) +- yesNoFormat [yesNoFormat](../functions/yesnoformat.md) diff --git a/docs/categories/filesystem-functions.md b/docs/categories/filesystem-functions.md new file mode 100644 index 000000000..310169855 --- /dev/null +++ b/docs/categories/filesystem-functions.md @@ -0,0 +1,39 @@ +# Filesystem Functions + +- directoryCopy [directorycopy](../functions/directorycopy.md) +- directoryCreate [directorycreate](../functions/directorycreate.md) +- directoryDelete [directorydelete](../functions/directorydelete.md) +- directoryExists [directoryexists](../functions/directoryexists.md) +- directoryList [directorylist](../functions/directorylist.md) +- directoryRename [directoryrename](../functions/directoryrename.md) +- expandPath [expandPath](../functions/expandpath.md) +- fileClose [fileClose](../functions/fileclose.md) +- fileCopy [fileCopy](../functions/filecopy.md) +- fileDelete [fileDelete](../functions/filedelete.md) +- fileExists [fileExists](../functions/fileexists.md) +- fileGetMimeType [fileGetMimeType](../functions/filegetmimetype.md) +- fileIsEOF [fileIsEOF](../functions/fileiseof.md) +- fileMove [fileMove](../functions/filemove.md) +- fileOpen [fileOpen](../functions/fileopen.md) +- fileRead [fileRead](../functions/fileread.md) +- fileReadBinary [fileReadBinary](../functions/filereadbinary.md) +- fileReadLine [fileReadLine](../functions/filereadline.md) +- fileSeek [fileSeek](../functions/fileseek.md) +- fileSetAccessMode [fileSetAccessMode](../functions/filesetaccessmode.md) +- fileSetAttribute [fileSetAttribute](../functions/filesetattribute.md) +- fileSetLastModified [fileSetLastModified](../functions/filesetlastmodified.md) +- fileSkipBytes [fileSkipBytes](../functions/fileskipbytes.md) +- fileUpload [fileUpload](../functions/fileupload.md) +- fileUploadAll [fileUploadAll](../functions/fileuploadall.md) +- fileWrite [fileWrite](../functions/filewrite.md) +- fileWriteLine [fileWriteLine](../functions/filewriteline.md) +- getCurrentTemplatePath [getCurrentTemplatePath](../functions/getcurrenttemplatepath.md) +- getDirectoryFromPath [getDirectoryFromPath](../functions/getdirectoryfrompath.md) +- getFileFromPath [getFileFromPath](../functions/getfilefrompath.md) +- getFileInfo [getFileInfo](../functions/getfileinfo.md) +- getProfileSections [getProfileSections](../functions/getprofilesections.md) +- getProfileString [getProfileString](../functions/getprofilestring.md) +- getTempDirectory [getTempDirectory](../functions/gettempdirectory.md) +- getTempFile [getTempFile](../functions/gettempfile.md) +- isVideoFile [isVideoFile](../functions/isvideofile.md) +- isZipFile [isZipFile](../functions/iszipfile.md) diff --git a/docs/categories/formatting-functions.md b/docs/categories/formatting-functions.md new file mode 100644 index 000000000..1606c020a --- /dev/null +++ b/docs/categories/formatting-functions.md @@ -0,0 +1,33 @@ +# Formatting Functions + +- booleanFormat [booleanFormat](../functions/booleanformat.md) +- canonicalize [canonicalize](../functions/canonicalize.md) +- cJustify [cJustify](../functions/cjustify.md) +- dateFormat [dateFormat](../functions/dateformat.md) +- dateTimeFormat [dateTimeFormat](../functions/datetimeformat.md) +- decimalFormat [decimalFormat](../functions/decimalformat.md) +- dollarFormat [dollarFormat](../functions/dollarformat.md) +- formatBaseN [formatBaseN](../functions/formatbasen.md) +- htmlCodeFormat [htmlCodeFormat](../functions/htmlcodeformat.md) +- htmlEditFormat [htmlEditFormat](../functions/htmleditformat.md) +- lJustify [lJustify](../functions/ljustify.md) +- lsCurrencyFormat [lsCurrencyFormat](../functions/lscurrencyformat.md) +- lsDateFormat [lsDateFormat](../functions/lsdateformat.md) +- lsEuroCurrencyFormat [lsEuroCurrencyFormat](../functions/lseurocurrencyformat.md) +- lsIsCurrency [lsIsCurrency](../functions/lsiscurrency.md) +- lsIsDate [lsIsDate](../functions/lsisdate.md) +- lsNumberFormat [lsNumberFormat](../functions/lsnumberformat.md) +- lsParseCurrency [LSParseCurrency](../functions/lsparsecurrency.md) +- lsParseDateTime [LSParseDateTime](../functions/lsparsedatetime.md) +- lsParseEuroCurrency [LSParseEuroCurrency](../functions/lsparseeurocurrency.md) +- lsParseNumber [LSParseNumber](../functions/lsparsenumber.md) +- lsTimeFormat [lsTimeFormat](../functions/lstimeformat.md) +- numberFormat [numberFormat](../functions/numberformat.md) +- paragraphFormat [paragraphFormat](../functions/paragraphformat.md) +- rJustify [rJustify](../functions/rjustify.md) +- stripCR [stripCR](../functions/stripcr.md) +- timeFormat [timeFormat](../functions/timeformat.md) +- urlEncodedFormat [urlEncodedFormat](../functions/urlencodedformat.md) +- urlSessionFormat [urlSessionFormat](../functions/urlsessionformat.md) +- xmlFormat [xmlFormat](../functions/xmlformat.md) +- yesNoFormat [yesNoFormat](../functions/yesnoformat.md) diff --git a/docs/categories/functions.md b/docs/categories/functions.md new file mode 100644 index 000000000..8056f8f21 --- /dev/null +++ b/docs/categories/functions.md @@ -0,0 +1,808 @@ +# All CFML Functions + +- abs [abs](../functions/abs.md) +- acos [acos](../functions/acos.md) +- addSOAPRequestHeader [addsoaprequestheader](../functions/addsoaprequestheader.md) +- addSOAPResponseHeader [addsoapresponseheader](../functions/addsoapresponseheader.md) +- ajaxLink [ajaxlink](../functions/ajaxlink.md) +- ajaxOnLoad [ajaxonload](../functions/ajaxonload.md) +- applicationStartTime [applicationstarttime](../functions/applicationstarttime.md) +- applicationStop [applicationstop](../functions/applicationstop.md) +- argon2CheckHash [argon2checkhash](../functions/argon2checkhash.md) +- array [array](../functions/array.md) +- arrayAppend [arrayappend](../functions/arrayappend.md) +- arrayAvg [arrayavg](../functions/arrayavg.md) +- arrayClear [arrayclear](../functions/arrayclear.md) +- arrayContains [arraycontains](../functions/arraycontains.md) +- arrayContainsNoCase [arraycontainsnocase](../functions/arraycontainsnocase.md) +- arrayDelete [arraydelete](../functions/arraydelete.md) +- arrayDeleteAt [arraydeleteat](../functions/arraydeleteat.md) +- arrayDeleteNoCase [arraydeletenocase](../functions/arraydeletenocase.md) +- arrayEach [arrayeach](../functions/arrayeach.md) +- arrayEvery [arrayevery](../functions/arrayevery.md) +- arrayFilter [arrayfilter](../functions/arrayfilter.md) +- arrayFind [arrayfind](../functions/arrayfind.md) +- arrayFindAll [arrayfindall](../functions/arrayfindall.md) +- arrayFindAllNoCase [arrayfindallnocase](../functions/arrayfindallnocase.md) +- arrayFindNoCase [arrayfindnocase](../functions/arrayfindnocase.md) +- arrayFirst [arrayfirst](../functions/arrayfirst.md) +- arrayGetMetadata [arraygetmetadata](../functions/arraygetmetadata.md) +- arrayIndexExists [arrayindexexists](../functions/arrayindexexists.md) +- arrayInsertAt [arrayinsertat](../functions/arrayinsertat.md) +- arrayIsDefined [arrayisdefined](../functions/arrayisdefined.md) +- arrayIsEmpty [arrayisempty](../functions/arrayisempty.md) +- arrayLast [arraylast](../functions/arraylast.md) +- arrayLen [arraylen](../functions/arraylen.md) +- arrayMap [arraymap](../functions/arraymap.md) +- arrayMax [arraymax](../functions/arraymax.md) +- arrayMedian [arraymedian](../functions/arraymedian.md) +- arrayMerge [arraymerge](../functions/arraymerge.md) +- arrayMid [arraymid](../functions/arraymid.md) +- arrayMin [arraymin](../functions/arraymin.md) +- arrayNew [arraynew](../functions/arraynew.md) +- arrayPop [arraypop](../functions/arraypop.md) +- arrayPrepend [arrayprepend](../functions/arrayprepend.md) +- arrayPush [arraypush](../functions/arraypush.md) +- arrayRange [arrayrange](../functions/arrayrange.md) +- arrayReduce [arrayreduce](../functions/arrayreduce.md) +- arrayReduceRight [arrayreduceright](../functions/arrayreduceright.md) +- arrayResize [arrayresize](../functions/arrayresize.md) +- arrayReverse [arrayreverse](../functions/arrayreverse.md) +- arraySet [arrayset](../functions/arrayset.md) +- arraySetMetadata [arraysetmetadata](../functions/arraysetmetadata.md) +- arrayShift [arrayshift](../functions/arrayshift.md) +- arraySlice [arrayslice](../functions/arrayslice.md) +- arraySome [arraysome](../functions/arraysome.md) +- arraySort [arraysort](../functions/arraysort.md) +- arraySplice [arraysplice](../functions/arraysplice.md) +- arraySum [arraysum](../functions/arraysum.md) +- arraySwap [arrayswap](../functions/arrayswap.md) +- arrayToList [arraytolist](../functions/arraytolist.md) +- arrayToStruct [arraytostruct](../functions/arraytostruct.md) +- arrayUnshift [arrayunshift](../functions/arrayunshift.md) +- asc [asc](../functions/asc.md) +- ascii [ascii](../functions/ascii.md) +- asin [asin](../functions/asin.md) +- atn [atn](../functions/atn.md) +- beat [beat](../functions/beat.md) +- binaryDecode [binarydecode](../functions/binarydecode.md) +- binaryEncode [binaryencode](../functions/binaryencode.md) +- bitAnd [bitand](../functions/bitand.md) +- bitMaskClear [bitmaskclear](../functions/bitmaskclear.md) +- bitMaskRead [bitmaskread](../functions/bitmaskread.md) +- bitMaskSet [bitmaskset](../functions/bitmaskset.md) +- bitNot [bitnot](../functions/bitnot.md) +- bitOr [bitor](../functions/bitor.md) +- bitShln [bitshln](../functions/bitshln.md) +- bitShrn [bitshrn](../functions/bitshrn.md) +- bitXor [bitxor](../functions/bitxor.md) +- booleanFormat [booleanformat](../functions/booleanformat.md) +- bundleInfo [bundleinfo](../functions/bundleinfo.md) +- cacheClear [cacheclear](../functions/cacheclear.md) +- cacheCount [cachecount](../functions/cachecount.md) +- cacheDelete [cachedelete](../functions/cachedelete.md) +- cacheGet [cacheget](../functions/cacheget.md) +- cacheGetAll [cachegetall](../functions/cachegetall.md) +- cacheGetAllIds [cachegetallids](../functions/cachegetallids.md) +- cacheGetDefaultCacheName [cachegetdefaultcachename](../functions/cachegetdefaultcachename.md) +- cacheGetEngineProperties [cachegetengineproperties](../functions/cachegetengineproperties.md) +- cacheGetMetadata [cachegetmetadata](../functions/cachegetmetadata.md) +- cacheGetProperties [cachegetproperties](../functions/cachegetproperties.md) +- cacheGetSession [cachegetsession](../functions/cachegetsession.md) +- cacheIdExists [cacheidexists](../functions/cacheidexists.md) +- cacheKeyExists [cachekeyexists](../functions/cachekeyexists.md) +- cachePut [cacheput](../functions/cacheput.md) +- cacheRegionExists [cacheregionexists](../functions/cacheregionexists.md) +- cacheRegionNew [cacheregionnew](../functions/cacheregionnew.md) +- cacheRegionRemove [cacheregionremove](../functions/cacheregionremove.md) +- cacheRemove [cacheremove](../functions/cacheremove.md) +- cacheRemoveAll [cacheremoveall](../functions/cacheremoveall.md) +- cacheSetProperties [cachesetproperties](../functions/cachesetproperties.md) +- callStackDump [callstackdump](../functions/callstackdump.md) +- callStackGet [callstackget](../functions/callstackget.md) +- canonicalize [canonicalize](../functions/canonicalize.md) +- ceiling [ceiling](../functions/ceiling.md) +- cfusion_Decrypt [cfusion_decrypt](../functions/cfusion_decrypt.md) +- cfusion_Encrypt [cfusion_encrypt](../functions/cfusion_encrypt.md) +- charsetDecode [charsetdecode](../functions/charsetdecode.md) +- charsetEncode [charsetencode](../functions/charsetencode.md) +- chr [chr](../functions/chr.md) +- cJustify [cjustify](../functions/cjustify.md) +- clearTimeZone [cleartimezone](../functions/cleartimezone.md) +- collectionEach [collectioneach](../functions/collectioneach.md) +- collectionEvery [collectionevery](../functions/collectionevery.md) +- collectionFilter [collectionfilter](../functions/collectionfilter.md) +- collectionMap [collectionmap](../functions/collectionmap.md) +- collectionReduce [collectionreduce](../functions/collectionreduce.md) +- collectionSome [collectionsome](../functions/collectionsome.md) +- compare [compare](../functions/compare.md) +- compareNoCase [comparenocase](../functions/comparenocase.md) +- componentCacheClear [componentcacheclear](../functions/componentcacheclear.md) +- componentCacheList [componentcachelist](../functions/componentcachelist.md) +- componentInfo [componentinfo](../functions/componentinfo.md) +- compress [compress](../functions/compress.md) +- configImport [configimport](../functions/configimport.md) +- contractPath [contractpath](../functions/contractpath.md) +- cos [cos](../functions/cos.md) +- createDate [createdate](../functions/createdate.md) +- createDateTime [createdatetime](../functions/createdatetime.md) +- createDynamicProxy [createdynamicproxy](../functions/createdynamicproxy.md) +- createEncryptedJWT [createencryptedjwt](../functions/createencryptedjwt.md) +- createGUID [createguid](../functions/createguid.md) +- createObject [createobject](../functions/createobject.md) +- createODBCDate [createodbcdate](../functions/createodbcdate.md) +- createODBCDateTime [createodbcdatetime](../functions/createodbcdatetime.md) +- createODBCTime [createodbctime](../functions/createodbctime.md) +- createSignedJWT [createsignedjwt](../functions/createsignedjwt.md) +- createTime [createtime](../functions/createtime.md) +- createTimespan [createtimespan](../functions/createtimespan.md) +- createUniqueID [createuniqueid](../functions/createuniqueid.md) +- createUUID [createuuid](../functions/createuuid.md) +- csrfGenerateToken [csrfgeneratetoken](../functions/csrfgeneratetoken.md) +- csrfVerifyToken [csrfverifytoken](../functions/csrfverifytoken.md) +- ctCacheClear [ctcacheclear](../functions/ctcacheclear.md) +- ctCacheList [ctcachelist](../functions/ctcachelist.md) +- datasourceFlushMetacache [datasourceflushmetacache](../functions/datasourceflushmetacache.md) +- dateAdd [dateadd](../functions/dateadd.md) +- dateCompare [datecompare](../functions/datecompare.md) +- dateConvert [dateconvert](../functions/dateconvert.md) +- dateDiff [datediff](../functions/datediff.md) +- dateFormat [dateformat](../functions/dateformat.md) +- datePart [datepart](../functions/datepart.md) +- dateTimeFormat [datetimeformat](../functions/datetimeformat.md) +- day [day](../functions/day.md) +- dayOfWeek [dayofweek](../functions/dayofweek.md) +- dayOfWeekAsString [dayofweekasstring](../functions/dayofweekasstring.md) +- dbpoolclear [dbpoolclear](../functions/dbpoolclear.md) +- dayOfWeekShortAsString [dayofweekshortasstring](../functions/dayofweekshortasstring.md) +- dayOfYear [dayofyear](../functions/dayofyear.md) +- daysInMonth [daysinmonth](../functions/daysinmonth.md) +- daysInYear [daysinyear](../functions/daysinyear.md) +- de [de](../functions/de.md) +- decimalFormat [decimalformat](../functions/decimalformat.md) +- decodeForHTML [decodeforhtml](../functions/decodeforhtml.md) +- decodeFromURL [decodefromurl](../functions/decodefromurl.md) +- decrementValue [decrementvalue](../functions/decrementvalue.md) +- decrypt [decrypt](../functions/decrypt.md) +- decryptBinary [decryptbinary](../functions/decryptbinary.md) +- deleteClientVariable [deleteclientvariable](../functions/deleteclientvariable.md) +- deserialize [deserialize](../functions/deserialize.md) +- deserializeAvro [deserializeavro](../functions/deserializeavro.md) +- deserializeJSON [deserializejson](../functions/deserializejson.md) +- deserializeProtobuf [deserializeprotobuf](../functions/deserializeprotobuf.md) +- deserializeXML [deserializexml](../functions/deserializexml.md) +- directoryCopy [directorycopy](../functions/directorycopy.md) +- directoryCreate [directorycreate](../functions/directorycreate.md) +- directoryDelete [directorydelete](../functions/directorydelete.md) +- directoryExists [directoryexists](../functions/directoryexists.md) +- directoryList [directorylist](../functions/directorylist.md) +- directoryRename [directoryrename](../functions/directoryrename.md) +- dollarFormat [dollarformat](../functions/dollarformat.md) +- dotnetToCFType [dotnettocftype](../functions/dotnettocftype.md) +- duplicate [duplicate](../functions/duplicate.md) +- each [each](../functions/each.md) +- echo [echo](../functions/echo.md) +- empty [empty](../functions/empty.md) +- encodeFor [encodefor](../functions/encodefor.md) +- encodeForCSS [encodeforcss](../functions/encodeforcss.md) +- encodeForDN [encodefordn](../functions/encodefordn.md) +- encodeForHTML [encodeforhtml](../functions/encodeforhtml.md) +- encodeForHTMLAttribute [encodeforhtmlattribute](../functions/encodeforhtmlattribute.md) +- encodeForJavaScript [encodeforjavascript](../functions/encodeforjavascript.md) +- encodeForLDAP [encodeforldap](../functions/encodeforldap.md) +- encodeForURL [encodeforurl](../functions/encodeforurl.md) +- encodeForXML [encodeforxml](../functions/encodeforxml.md) +- encodeForXMLAttribute [encodeforxmlattribute](../functions/encodeforxmlattribute.md) +- encodeForXPath [encodeforxpath](../functions/encodeforxpath.md) +- encrypt [encrypt](../functions/encrypt.md) +- encryptBinary [encryptbinary](../functions/encryptbinary.md) +- entityDelete [entitydelete](../functions/entitydelete.md) +- entityLoad [entityload](../functions/entityload.md) +- entityLoadByExample [entityloadbyexample](../functions/entityloadbyexample.md) +- entityLoadByPK [entityloadbypk](../functions/entityloadbypk.md) +- entityMerge [entitymerge](../functions/entitymerge.md) +- entityNameArray [entitynamearray](../functions/entitynamearray.md) +- entityNameList [entitynamelist](../functions/entitynamelist.md) +- entityNew [entitynew](../functions/entitynew.md) +- entityReload [entityreload](../functions/entityreload.md) +- entitySave [entitysave](../functions/entitysave.md) +- entityToQuery [entitytoquery](../functions/entitytoquery.md) +- esapiDecode [esapidecode](../functions/esapidecode.md) +- esapiEncode [esapiencode](../functions/esapiencode.md) +- evaluate [evaluate](../functions/evaluate.md) +- exceptionKeyExists [exceptionkeyexists](../functions/exceptionkeyexists.md) +- exp [exp](../functions/exp.md) +- expandPath [expandpath](../functions/expandpath.md) +- extensionExists [extensionexists](../functions/extensionexists.md) +- extensionList [extensionlist](../functions/extensionlist.md) +- extract [extract](../functions/extract.md) +- fileAppend [fileappend](../functions/fileappend.md) +- fileClose [fileclose](../functions/fileclose.md) +- fileCopy [filecopy](../functions/filecopy.md) +- fileDelete [filedelete](../functions/filedelete.md) +- fileExists [fileexists](../functions/fileexists.md) +- fileGetMimeType [filegetmimetype](../functions/filegetmimetype.md) +- fileIsEOF [fileiseof](../functions/fileiseof.md) +- fileMove [filemove](../functions/filemove.md) +- fileOpen [fileopen](../functions/fileopen.md) +- fileRead [fileread](../functions/fileread.md) +- fileReadBinary [filereadbinary](../functions/filereadbinary.md) +- fileReadLine [filereadline](../functions/filereadline.md) +- fileSeek [fileseek](../functions/fileseek.md) +- fileSetAccessMode [filesetaccessmode](../functions/filesetaccessmode.md) +- fileSetAttribute [filesetattribute](../functions/filesetattribute.md) +- fileSetLastModified [filesetlastmodified](../functions/filesetlastmodified.md) +- fileSkipBytes [fileskipbytes](../functions/fileskipbytes.md) +- fileUpload [fileupload](../functions/fileupload.md) +- fileUploadAll [fileuploadall](../functions/fileuploadall.md) +- fileWrite [filewrite](../functions/filewrite.md) +- fileWriteLine [filewriteline](../functions/filewriteline.md) +- find [find](../functions/find.md) +- findNoCase [findnocase](../functions/findnocase.md) +- findOneOf [findoneof](../functions/findoneof.md) +- firstDayOfMonth [firstdayofmonth](../functions/firstdayofmonth.md) +- fix [fix](../functions/fix.md) +- floor [floor](../functions/floor.md) +- formatBaseN [formatbasen](../functions/formatbasen.md) +- generateArgon2Hash [generateargon2hash](../functions/generateargon2hash.md) +- generateBCryptHash [generatebcrypthash](../functions/generatebcrypthash.md) +- generateGraphQLModels [generategraphqlmodels](../functions/generategraphqlmodels.md) +- generatePBKDFKey [generatepbkdfkey](../functions/generatepbkdfkey.md) +- generateSCryptHash [generatescrypthash](../functions/generatescrypthash.md) +- generateSecretKey [generatesecretkey](../functions/generatesecretkey.md) +- getApplicationMetadata [getapplicationmetadata](../functions/getapplicationmetadata.md) +- getApplicationSettings [getapplicationsettings](../functions/getapplicationsettings.md) +- getAuthUser [getauthuser](../functions/getauthuser.md) +- getBaseTagData [getbasetagdata](../functions/getbasetagdata.md) +- getBaseTagList [getbasetaglist](../functions/getbasetaglist.md) +- getBaseTemplatePath [getbasetemplatepath](../functions/getbasetemplatepath.md) +- getBuiltinFunction [getbuiltinfunction](../functions/getbuiltinfunction.md) +- getCanonicalPath [getcanonicalpath](../functions/getcanonicalpath.md) +- getClassPath [getclasspath](../functions/getclasspath.md) +- getClientVariablesList [getclientvariableslist](../functions/getclientvariableslist.md) +- getComponentMetadata [getcomponentmetadata](../functions/getcomponentmetadata.md) +- getContextRoot [getcontextroot](../functions/getcontextroot.md) +- getCpuUsage [getcpuusage](../functions/getcpuusage.md) +- getCurrentContext [getcurrentcontext](../functions/getcurrentcontext.md) +- getCurrentTemplatePath [getcurrenttemplatepath](../functions/getcurrenttemplatepath.md) +- getDirectoryFromPath [getdirectoryfrompath](../functions/getdirectoryfrompath.md) +- getEncoding [getencoding](../functions/getencoding.md) +- getException [getexception](../functions/getexception.md) +- getFileFromPath [getfilefrompath](../functions/getfilefrompath.md) +- getFileInfo [getfileinfo](../functions/getfileinfo.md) +- getFreeSpace [getfreespace](../functions/getfreespace.md) +- getFunctionCalledName [getfunctioncalledname](../functions/getfunctioncalledname.md) +- getFunctionData [getfunctiondata](../functions/getfunctiondata.md) +- getFunctionKeywords [getfunctionkeywords](../functions/getfunctionkeywords.md) +- getFunctionList [getfunctionlist](../functions/getfunctionlist.md) +- getGatewayHelper [getgatewayhelper](../functions/getgatewayhelper.md) +- getGraphQLClient [getgraphqlclient](../functions/getgraphqlclient.md) +- getHTTPRequestData [gethttprequestdata](../functions/gethttprequestdata.md) +- getHTTPTimeString [gethttptimestring](../functions/gethttptimestring.md) +- getK2ServerDocCount [getk2serverdoccount](../functions/getk2serverdoccount.md) +- getK2ServerDocCountLimit [getk2serverdoccountlimit](../functions/getk2serverdoccountlimit.md) +- getLocale [getlocale](../functions/getlocale.md) +- getLocaleCountry [getlocalecountry](../functions/getlocalecountry.md) +- getLocaleDisplayName [getlocaledisplayname](../functions/getlocaledisplayname.md) +- getLocaleInfo [getlocaleinfo](../functions/getlocaleinfo.md) +- getLocaleLanguage [getlocalelanguage](../functions/getlocalelanguage.md) +- getLocalhostIP [getlocalhostip](../functions/getlocalhostip.md) +- getLuceeID [getluceeid](../functions/getluceeid.md) +- getMemoryUsage [getmemoryusage](../functions/getmemoryusage.md) +- getMetadata [getmetadata](../functions/getmetadata.md) +- getMetricData [getmetricdata](../functions/getmetricdata.md) +- getNumericDate [getnumericdate](../functions/getnumericdate.md) +- getPageContext [getpagecontext](../functions/getpagecontext.md) +- getPrinterInfo [getprinterinfo](../functions/getprinterinfo.md) +- getPrinterList [getprinterlist](../functions/getprinterlist.md) +- getProfileSections [getprofilesections](../functions/getprofilesections.md) +- getProfileString [getprofilestring](../functions/getprofilestring.md) +- getReadableImageFormats [getreadableimageformats](../functions/getreadableimageformats.md) +- getSafeHTML [getsafehtml](../functions/getsafehtml.md) +- getSOAPRequest [getsoaprequest](../functions/getsoaprequest.md) +- getSOAPRequestHeader [getsoaprequestheader](../functions/getsoaprequestheader.md) +- getSOAPResponse [getsoapresponse](../functions/getsoapresponse.md) +- getSOAPResponseHeader [getsoapresponseheader](../functions/getsoapresponseheader.md) +- getSystemFreeMemory [getsystemfreememory](../functions/getsystemfreememory.md) +- getSystemTotalMemory [getsystemtotalmemory](../functions/getsystemtotalmemory.md) +- getTagData [gettagdata](../functions/gettagdata.md) +- getTagList [gettaglist](../functions/gettaglist.md) +- getTempDirectory [gettempdirectory](../functions/gettempdirectory.md) +- getTempFile [gettempfile](../functions/gettempfile.md) +- getTemplatePath [gettemplatepath](../functions/gettemplatepath.md) +- getTickCount [gettickcount](../functions/gettickcount.md) +- getTimeZone [gettimezone](../functions/gettimezone.md) +- getTimezoneInfo [gettimezoneinfo](../functions/gettimezoneinfo.md) +- getToken [gettoken](../functions/gettoken.md) +- getTotalSpace [gettotalspace](../functions/gettotalspace.md) +- getUserRoles [getuserroles](../functions/getuserroles.md) +- getVariable [getvariable](../functions/getvariable.md) +- getVFSMetadata [getvfsmetadata](../functions/getvfsmetadata.md) +- getWriteableImageFormats [getwriteableimageformats](../functions/getwriteableimageformats.md) +- hash [hash](../functions/hash.md) +- hash40 [hash40](../functions/hash40.md) +- hmac [hmac](../functions/hmac.md) +- hour [hour](../functions/hour.md) +- htmlCodeFormat [htmlcodeformat](../functions/htmlcodeformat.md) +- htmlEditFormat [htmleditformat](../functions/htmleditformat.md) +- htmlParse [htmlparse](../functions/htmlparse.md) +- iIf [iif](../functions/iif.md) +- imageAddBorder [imageaddborder](../functions/imageaddborder.md) +- imageBlur [imageblur](../functions/imageblur.md) +- imageCaptcha [imagecaptcha](../functions/imagecaptcha.md) +- imageClearRect [imageclearrect](../functions/imageclearrect.md) +- imageCopy [imagecopy](../functions/imagecopy.md) +- imageCreateCaptcha [imagecreatecaptcha](../functions/imagecreatecaptcha.md) +- imageCrop [imagecrop](../functions/imagecrop.md) +- imageDrawArc [imagedrawarc](../functions/imagedrawarc.md) +- imageDrawBeveledRect [imagedrawbeveledrect](../functions/imagedrawbeveledrect.md) +- imageDrawCubicCurve [imagedrawcubiccurve](../functions/imagedrawcubiccurve.md) +- imageDrawImage [imagedrawimage](../functions/imagedrawimage.md) +- imageDrawLine [imagedrawline](../functions/imagedrawline.md) +- imageDrawLines [imagedrawlines](../functions/imagedrawlines.md) +- imageDrawOval [imagedrawoval](../functions/imagedrawoval.md) +- imageDrawPoint [imagedrawpoint](../functions/imagedrawpoint.md) +- imageDrawQuadraticCurve [imagedrawquadraticcurve](../functions/imagedrawquadraticcurve.md) +- imageDrawRect [imagedrawrect](../functions/imagedrawrect.md) +- imageDrawRoundRect [imagedrawroundrect](../functions/imagedrawroundrect.md) +- imageDrawText [imagedrawtext](../functions/imagedrawtext.md) +- imageFilter [imagefilter](../functions/imagefilter.md) +- imageFilterColorMap [imagefiltercolormap](../functions/imagefiltercolormap.md) +- imageFilterCurves [imagefiltercurves](../functions/imagefiltercurves.md) +- imageFilterKernel [imagefilterkernel](../functions/imagefilterkernel.md) +- imageFilterWarpGrid [imagefilterwarpgrid](../functions/imagefilterwarpgrid.md) +- imageFlip [imageflip](../functions/imageflip.md) +- imageFonts [imagefonts](../functions/imagefonts.md) +- imageFormats [imageformats](../functions/imageformats.md) +- imageGetBlob [imagegetblob](../functions/imagegetblob.md) +- imageGetBufferedImage [imagegetbufferedimage](../functions/imagegetbufferedimage.md) +- imageGetEXIFMetadata [imagegetexifmetadata](../functions/imagegetexifmetadata.md) +- imageGetEXIFTag [imagegetexiftag](../functions/imagegetexiftag.md) +- imageGetHeight [imagegetheight](../functions/imagegetheight.md) +- imageGetIPTCMetadata [imagegetiptcmetadata](../functions/imagegetiptcmetadata.md) +- imageGetIPTCtag [imagegetiptctag](../functions/imagegetiptctag.md) +- imageGetMetadata [imagegetmetadata](../functions/imagegetmetadata.md) +- imageGetWidth [imagegetwidth](../functions/imagegetwidth.md) +- imageGrayScale [imagegrayscale](../functions/imagegrayscale.md) +- imageInfo [imageinfo](../functions/imageinfo.md) +- imageMakeColorTransparent [imagemakecolortransparent](../functions/imagemakecolortransparent.md) +- imageMakeTranslucent [imagemaketranslucent](../functions/imagemaketranslucent.md) +- imageNegative [imagenegative](../functions/imagenegative.md) +- imageNew [imagenew](../functions/imagenew.md) +- imageOverlay [imageoverlay](../functions/imageoverlay.md) +- imagePaste [imagepaste](../functions/imagepaste.md) +- imageRead [imageread](../functions/imageread.md) +- imageReadBase64 [imagereadbase64](../functions/imagereadbase64.md) +- imageResize [imageresize](../functions/imageresize.md) +- imageRotate [imagerotate](../functions/imagerotate.md) +- imageRotateDrawingAxis [imagerotatedrawingaxis](../functions/imagerotatedrawingaxis.md) +- imageScaleTofit [imagescaletofit](../functions/imagescaletofit.md) +- imageSetAntialiasing [imagesetantialiasing](../functions/imagesetantialiasing.md) +- imageSetBackgroundColor [imagesetbackgroundcolor](../functions/imagesetbackgroundcolor.md) +- imageSetDrawingAlpha [imagesetdrawingalpha](../functions/imagesetdrawingalpha.md) +- imageSetDrawingColor [imagesetdrawingcolor](../functions/imagesetdrawingcolor.md) +- imageSetDrawingStroke [imagesetdrawingstroke](../functions/imagesetdrawingstroke.md) +- imageSetDrawingTransparency [imagesetdrawingtransparency](../functions/imagesetdrawingtransparency.md) +- imageSharpen [imagesharpen](../functions/imagesharpen.md) +- imageShear [imageshear](../functions/imageshear.md) +- imageShearDrawingAxis [imagesheardrawingaxis](../functions/imagesheardrawingaxis.md) +- imageTranslate [imagetranslate](../functions/imagetranslate.md) +- imageTranslateDrawingAxis [imagetranslatedrawingaxis](../functions/imagetranslatedrawingaxis.md) +- imageWrite [imagewrite](../functions/imagewrite.md) +- imageWriteBase64 [imagewritebase64](../functions/imagewritebase64.md) +- imageXORDrawingMode [imagexordrawingmode](../functions/imagexordrawingmode.md) +- incrementValue [incrementvalue](../functions/incrementvalue.md) +- inputBaseN [inputbasen](../functions/inputbasen.md) +- insert [insert](../functions/insert.md) +- int [int](../functions/int.md) +- invalidateOauthAccesstoken [invalidateoauthaccesstoken](../functions/invalidateoauthaccesstoken.md) +- invoke [invoke](../functions/invoke.md) +- isArray [isarray](../functions/isarray.md) +- isBinary [isbinary](../functions/isbinary.md) +- isBoolean [isboolean](../functions/isboolean.md) +- isClosure [isclosure](../functions/isclosure.md) +- isCustomFunction [iscustomfunction](../functions/iscustomfunction.md) +- isDate [isdate](../functions/isdate.md) +- isDateObject [isdateobject](../functions/isdateobject.md) +- isDDX [isddx](../functions/isddx.md) +- isDebugMode [isdebugmode](../functions/isdebugmode.md) +- isDefined [isdefined](../functions/isdefined.md) +- isEmpty [isempty](../functions/isempty.md) +- isFileObject [isfileobject](../functions/isfileobject.md) +- isImage [isimage](../functions/isimage.md) +- isImageFile [isimagefile](../functions/isimagefile.md) +- isInstanceOf [isinstanceof](../functions/isinstanceof.md) +- isinthread [isinthread](../functions/isinthread.md) +- isIPInRange [isipinrange](../functions/isipinrange.md) +- isIPV6 [isipv6](../functions/isipv6.md) +- isJSON [isjson](../functions/isjson.md) +- isK2ServerABroker [isk2serverabroker](../functions/isk2serverabroker.md) +- isK2ServerDocCountExceeded [isk2serverdoccountexceeded](../functions/isk2serverdoccountexceeded.md) +- isK2ServerOnline [isk2serveronline](../functions/isk2serveronline.md) +- isLeapYear [isleapyear](../functions/isleapyear.md) +- isLocalhost [islocalhost](../functions/islocalhost.md) +- isNotMap [isnotmap](../functions/isnotmap.md) +- isNull [isnull](../functions/isnull.md) +- isNumeric [isnumeric](../functions/isnumeric.md) +- isNumericDate [isnumericdate](../functions/isnumericdate.md) +- isObject [isobject](../functions/isobject.md) +- isPDFArchive [ispdfarchive](../functions/ispdfarchive.md) +- isPDFFile [ispdffile](../functions/ispdffile.md) +- isPDFObject [ispdfobject](../functions/ispdfobject.md) +- isQuery [isquery](../functions/isquery.md) +- isSafeHTML [issafehtml](../functions/issafehtml.md) +- isSimpleValue [issimplevalue](../functions/issimplevalue.md) +- isSOAPRequest [issoaprequest](../functions/issoaprequest.md) +- isSpreadsheetFile [isspreadsheetfile](../functions/isspreadsheetfile.md) +- isSpreadsheetObject [isspreadsheetobject](../functions/isspreadsheetobject.md) +- isStruct [isstruct](../functions/isstruct.md) +- isUserInAnyRole [isuserinanyrole](../functions/isuserinanyrole.md) +- isUserInRole [isuserinrole](../functions/isuserinrole.md) +- isUserLoggedIn [isuserloggedin](../functions/isuserloggedin.md) +- isValid [isvalid](../functions/isvalid.md) +- isValidOauthAccesstoken [isvalidoauthaccesstoken](../functions/isvalidoauthaccesstoken.md) +- isVideoFile [isvideofile](../functions/isvideofile.md) +- isWDDX [iswddx](../functions/iswddx.md) +- isXML [isxml](../functions/isxml.md) +- isXMLAttribute [isxmlattribute](../functions/isxmlattribute.md) +- isXMLDoc [isxmldoc](../functions/isxmldoc.md) +- isXMLElem [isxmlelem](../functions/isxmlelem.md) +- isXMLNode [isxmlnode](../functions/isxmlnode.md) +- isXMLRoot [isxmlroot](../functions/isxmlroot.md) +- isZipFile [iszipfile](../functions/iszipfile.md) +- javaCast [javacast](../functions/javacast.md) +- jsStringFormat [jsstringformat](../functions/jsstringformat.md) +- lCase [lcase](../functions/lcase.md) +- left [left](../functions/left.md) +- len [len](../functions/len.md) +- listAppend [listappend](../functions/listappend.md) +- listAvg [listavg](../functions/listavg.md) +- listChangeDelims [listchangedelims](../functions/listchangedelims.md) +- listCompact [listcompact](../functions/listcompact.md) +- listContains [listcontains](../functions/listcontains.md) +- listContainsNoCase [listcontainsnocase](../functions/listcontainsnocase.md) +- listDeleteAt [listdeleteat](../functions/listdeleteat.md) +- listEach [listeach](../functions/listeach.md) +- listEvery [listevery](../functions/listevery.md) +- listFilter [listfilter](../functions/listfilter.md) +- listFind [listfind](../functions/listfind.md) +- listFindNoCase [listfindnocase](../functions/listfindnocase.md) +- listFirst [listfirst](../functions/listfirst.md) +- listGetAt [listgetat](../functions/listgetat.md) +- listIndexExists [listindexexists](../functions/listindexexists.md) +- listInsertAt [listinsertat](../functions/listinsertat.md) +- listItemTrim [listitemtrim](../functions/listitemtrim.md) +- listLast [listlast](../functions/listlast.md) +- listLen [listlen](../functions/listlen.md) +- listMap [listmap](../functions/listmap.md) +- listPrepend [listprepend](../functions/listprepend.md) +- listQualify [listqualify](../functions/listqualify.md) +- listReduce [listreduce](../functions/listreduce.md) +- listReduceRight [listreduceright](../functions/listreduceright.md) +- listRemoveDuplicates [listremoveduplicates](../functions/listremoveduplicates.md) +- listRest [listrest](../functions/listrest.md) +- listSetAt [listsetat](../functions/listsetat.md) +- listSome [listsome](../functions/listsome.md) +- listSort [listsort](../functions/listsort.md) +- listToArray [listtoarray](../functions/listtoarray.md) +- listTrim [listtrim](../functions/listtrim.md) +- listValueCount [listvaluecount](../functions/listvaluecount.md) +- listValueCountNoCase [listvaluecountnocase](../functions/listvaluecountnocase.md) +- lJustify [ljustify](../functions/ljustify.md) +- location [location](../functions/location.md) +- log [log](../functions/log.md) +- log10 [log10](../functions/log10.md) +- lsCurrencyFormat [lscurrencyformat](../functions/lscurrencyformat.md) +- lsDateFormat [lsdateformat](../functions/lsdateformat.md) +- lsDateTimeFormat [lsdatetimeformat](../functions/lsdatetimeformat.md) +- lsDayOfWeek [lsdayofweek](../functions/lsdayofweek.md) +- lsEuroCurrencyFormat [lseurocurrencyformat](../functions/lseurocurrencyformat.md) +- lsIsCurrency [lsiscurrency](../functions/lsiscurrency.md) +- lsIsDate [lsisdate](../functions/lsisdate.md) +- lsIsNumeric [lsisnumeric](../functions/lsisnumeric.md) +- lsNumberFormat [lsnumberformat](../functions/lsnumberformat.md) +- lsParseCurrency [lsparsecurrency](../functions/lsparsecurrency.md) +- lsParseDateTime [lsparsedatetime](../functions/lsparsedatetime.md) +- lsParseEuroCurrency [lsparseeurocurrency](../functions/lsparseeurocurrency.md) +- lsParseNumber [lsparsenumber](../functions/lsparsenumber.md) +- lsTimeFormat [lstimeformat](../functions/lstimeformat.md) +- lsWeek [lsweek](../functions/lsweek.md) +- lTrim [ltrim](../functions/ltrim.md) +- manifestRead [manifestread](../functions/manifestread.md) +- max [max](../functions/max.md) +- metaphone [metaphone](../functions/metaphone.md) +- mid [mid](../functions/mid.md) +- millisecond [millisecond](../functions/millisecond.md) +- min [min](../functions/min.md) +- minute [minute](../functions/minute.md) +- month [month](../functions/month.md) +- monthAsString [monthasstring](../functions/monthasstring.md) +- monthShortAsString [monthshortasstring](../functions/monthshortasstring.md) +- newLine [newline](../functions/newline.md) +- now [now](../functions/now.md) +- nowServer [nowserver](../functions/nowserver.md) +- nullValue [nullvalue](../functions/nullvalue.md) +- numberFormat [numberformat](../functions/numberformat.md) +- objectEquals [objectequals](../functions/objectequals.md) +- objectLoad [objectload](../functions/objectload.md) +- objectSave [objectsave](../functions/objectsave.md) +- onApplicationEnd [onapplicationend](../functions/onapplicationend.md) +- onApplicationStart [onapplicationstart](../functions/onapplicationstart.md) +- onError [onerror](../functions/onerror.md) +- onMissingMethod [onmissingmethod](../functions/onmissingmethod.md) +- onMissingTemplate [onmissingtemplate](../functions/onmissingtemplate.md) +- onRequest [onrequest](../functions/onrequest.md) +- onRequestEnd [onrequestend](../functions/onrequestend.md) +- onRequestStart [onrequeststart](../functions/onrequeststart.md) +- onServerStart [onserverstart](../functions/onserverstart.md) +- onSessionEnd [onsessionend](../functions/onsessionend.md) +- onSessionStart [onsessionstart](../functions/onsessionstart.md) +- ormClearSession [ormclearsession](../functions/ormclearsession.md) +- ormCloseAllSessions [ormcloseallsessions](../functions/ormcloseallsessions.md) +- ormCloseSession [ormclosesession](../functions/ormclosesession.md) +- ormEvictCollection [ormevictcollection](../functions/ormevictcollection.md) +- ormEvictEntity [ormevictentity](../functions/ormevictentity.md) +- ormEvictQueries [ormevictqueries](../functions/ormevictqueries.md) +- ormExecuteQuery [ormexecutequery](../functions/ormexecutequery.md) +- ormFlush [ormflush](../functions/ormflush.md) +- ormFlushAll [ormflushall](../functions/ormflushall.md) +- ormGetSession [ormgetsession](../functions/ormgetsession.md) +- ormGetSessionFactory [ormgetsessionfactory](../functions/ormgetsessionfactory.md) +- ormIndex [ormindex](../functions/ormindex.md) +- ormIndexPurge [ormindexpurge](../functions/ormindexpurge.md) +- ormReload [ormreload](../functions/ormreload.md) +- ormSearch [ormsearch](../functions/ormsearch.md) +- ormSearchOffline [ormsearchoffline](../functions/ormsearchoffline.md) +- pagePoolClear [pagepoolclear](../functions/pagepoolclear.md) +- pagePoolList [pagepoollist](../functions/pagepoollist.md) +- paragraphFormat [paragraphformat](../functions/paragraphformat.md) +- parameterExists [parameterexists](../functions/parameterexists.md) +- parseDateTime [parsedatetime](../functions/parsedatetime.md) +- parseNumber [parsenumber](../functions/parsenumber.md) +- pi [pi](../functions/pi.md) +- precisionEvaluate [precisionevaluate](../functions/precisionevaluate.md) +- preserveSingleQuotes [preservesinglequotes](../functions/preservesinglequotes.md) +- quarter [quarter](../functions/quarter.md) +- query [query](../functions/query.md) +- queryAddColumn [queryaddcolumn](../functions/queryaddcolumn.md) +- queryAddRow [queryaddrow](../functions/queryaddrow.md) +- queryAppend [queryappend](../functions/queryappend.md) +- queryClear [queryclear](../functions/queryclear.md) +- queryColumnArray [querycolumnarray](../functions/querycolumnarray.md) +- queryColumnCount [querycolumncount](../functions/querycolumncount.md) +- queryColumnData [querycolumndata](../functions/querycolumndata.md) +- queryColumnExists [querycolumnexists](../functions/querycolumnexists.md) +- queryColumnList [querycolumnlist](../functions/querycolumnlist.md) +- queryConvertForGrid [queryconvertforgrid](../functions/queryconvertforgrid.md) +- queryCurrentRow [querycurrentrow](../functions/querycurrentrow.md) +- queryDeleteColumn [querydeletecolumn](../functions/querydeletecolumn.md) +- queryDeleteRow [querydeleterow](../functions/querydeleterow.md) +- queryEach [queryeach](../functions/queryeach.md) +- queryEvery [queryevery](../functions/queryevery.md) +- queryExecute [queryexecute](../functions/queryexecute.md) +- queryFilter [queryfilter](../functions/queryfilter.md) +- queryGetCell [querygetcell](../functions/querygetcell.md) +- queryGetResult [querygetresult](../functions/querygetresult.md) +- queryGetRow [querygetrow](../functions/querygetrow.md) +- queryInsertAt [queryinsertat](../functions/queryinsertat.md) +- queryKeyExists [querykeyexists](../functions/querykeyexists.md) +- querylazy [querylazy](../functions/querylazy.md) +- queryMap [querymap](../functions/querymap.md) +- queryNew [querynew](../functions/querynew.md) +- queryPrepend [queryprepend](../functions/queryprepend.md) +- queryRecordCount [queryrecordcount](../functions/queryrecordcount.md) +- queryReduce [queryreduce](../functions/queryreduce.md) +- queryReverse [queryreverse](../functions/queryreverse.md) +- queryRowData [queryrowdata](../functions/queryrowdata.md) +- queryRowSwap [queryrowswap](../functions/queryrowswap.md) +- querySetCell [querysetcell](../functions/querysetcell.md) +- querySetRow [querysetrow](../functions/querysetrow.md) +- querySlice [queryslice](../functions/queryslice.md) +- querySome [querysome](../functions/querysome.md) +- querySort [querysort](../functions/querysort.md) +- quotedValueList [quotedvaluelist](../functions/quotedvaluelist.md) +- rand [rand](../functions/rand.md) +- randomize [randomize](../functions/randomize.md) +- randRange [randrange](../functions/randrange.md) +- reEscape [reescape](../functions/reescape.md) +- reFind [refind](../functions/refind.md) +- reFindNoCase [refindnocase](../functions/refindnocase.md) +- releaseCOMObject [releasecomobject](../functions/releasecomobject.md) +- reMatch [rematch](../functions/rematch.md) +- reMatchNoCase [rematchnocase](../functions/rematchnocase.md) +- removeCachedQuery [removecachedquery](../functions/removecachedquery.md) +- removeChars [removechars](../functions/removechars.md) +- render [render](../functions/render.md) +- repeatString [repeatstring](../functions/repeatstring.md) +- replace [replace](../functions/replace.md) +- replaceList [replacelist](../functions/replacelist.md) +- replaceListNoCase [replacelistnocase](../functions/replacelistnocase.md) +- replaceNoCase [replacenocase](../functions/replacenocase.md) +- reReplace [rereplace](../functions/rereplace.md) +- reReplaceNoCase [rereplacenocase](../functions/rereplacenocase.md) +- restDeleteApplication [restdeleteapplication](../functions/restdeleteapplication.md) +- restInitApplication [restinitapplication](../functions/restinitapplication.md) +- restSetResponse [restsetresponse](../functions/restsetresponse.md) +- reverse [reverse](../functions/reverse.md) +- right [right](../functions/right.md) +- rJustify [rjustify](../functions/rjustify.md) +- round [round](../functions/round.md) +- rTrim [rtrim](../functions/rtrim.md) +- runAsync [runasync](../functions/runasync.md) +- sanitizeHtml [sanitizehtml](../functions/sanitizehtml.md) +- second [second](../functions/second.md) +- sendGatewayMessage [sendgatewaymessage](../functions/sendgatewaymessage.md) +- serialize [serialize](../functions/serialize.md) +- serializeAvro [serializeavro](../functions/serializeavro.md) +- serializeJSON [serializejson](../functions/serializejson.md) +- serializeProtobuf [serializeprotobuf](../functions/serializeprotobuf.md) +- serializeXML [serializexml](../functions/serializexml.md) +- sessionGetMetadata [sessiongetmetadata](../functions/sessiongetmetadata.md) +- sessionInvalidate [sessioninvalidate](../functions/sessioninvalidate.md) +- sessionRotate [sessionrotate](../functions/sessionrotate.md) +- sessionstartTime [sessionstarttime](../functions/sessionstarttime.md) +- setEncoding [setencoding](../functions/setencoding.md) +- setLocale [setlocale](../functions/setlocale.md) +- setProfileString [setprofilestring](../functions/setprofilestring.md) +- setTimeZone [settimezone](../functions/settimezone.md) +- setVariable [setvariable](../functions/setvariable.md) +- sgn [sgn](../functions/sgn.md) +- sin [sin](../functions/sin.md) +- sizeOf [sizeof](../functions/sizeof.md) +- sleep [sleep](../functions/sleep.md) +- soundEx [soundex](../functions/soundex.md) +- spanExcluding [spanexcluding](../functions/spanexcluding.md) +- spanIncluding [spanincluding](../functions/spanincluding.md) +- spreadsheetAddAutoFilter [spreadsheetaddautofilter](../functions/spreadsheetaddautofilter.md) +- spreadsheetAddColumn [spreadsheetaddcolumn](../functions/spreadsheetaddcolumn.md) +- spreadsheetAddFreezePane [spreadsheetaddfreezepane](../functions/spreadsheetaddfreezepane.md) +- spreadsheetAddimage [spreadsheetaddimage](../functions/spreadsheetaddimage.md) +- spreadsheetAddInfo [spreadsheetaddinfo](../functions/spreadsheetaddinfo.md) +- spreadsheetAddPagebreaks [spreadsheetaddpagebreaks](../functions/spreadsheetaddpagebreaks.md) +- spreadsheetAddRow [spreadsheetaddrow](../functions/spreadsheetaddrow.md) +- spreadsheetAddRows [spreadsheetaddrows](../functions/spreadsheetaddrows.md) +- spreadsheetAddSplitPane [spreadsheetaddsplitpane](../functions/spreadsheetaddsplitpane.md) +- spreadsheetCreateSheet [spreadsheetcreatesheet](../functions/spreadsheetcreatesheet.md) +- spreadsheetDeleteColumn [spreadsheetdeletecolumn](../functions/spreadsheetdeletecolumn.md) +- spreadsheetDeleteColumns [spreadsheetdeletecolumns](../functions/spreadsheetdeletecolumns.md) +- spreadsheetDeleteRow [spreadsheetdeleterow](../functions/spreadsheetdeleterow.md) +- spreadsheetDeleteRows [spreadsheetdeleterows](../functions/spreadsheetdeleterows.md) +- spreadsheetFormatCell [spreadsheetformatcell](../functions/spreadsheetformatcell.md) +- spreadsheetFormatCellRange [spreadsheetformatcellrange](../functions/spreadsheetformatcellrange.md) +- spreadsheetFormatColumn [spreadsheetformatcolumn](../functions/spreadsheetformatcolumn.md) +- spreadsheetFormatColumns [spreadsheetformatcolumns](../functions/spreadsheetformatcolumns.md) +- spreadsheetFormatRow [spreadsheetformatrow](../functions/spreadsheetformatrow.md) +- spreadsheetFormatRows [spreadsheetformatrows](../functions/spreadsheetformatrows.md) +- spreadsheetGetCellComment [spreadsheetgetcellcomment](../functions/spreadsheetgetcellcomment.md) +- spreadsheetGetCellFormula [spreadsheetgetcellformula](../functions/spreadsheetgetcellformula.md) +- spreadsheetGetCellValue [spreadsheetgetcellvalue](../functions/spreadsheetgetcellvalue.md) +- spreadsheetGetColumnCount [spreadsheetgetcolumncount](../functions/spreadsheetgetcolumncount.md) +- spreadsheetInfo [spreadsheetinfo](../functions/spreadsheetinfo.md) +- spreadsheetMergeCells [spreadsheetmergecells](../functions/spreadsheetmergecells.md) +- spreadsheetNew [spreadsheetnew](../functions/spreadsheetnew.md) +- spreadsheetRead [spreadsheetread](../functions/spreadsheetread.md) +- spreadsheetReadBinary [spreadsheetreadbinary](../functions/spreadsheetreadbinary.md) +- spreadsheetRemoveSheet [spreadsheetremovesheet](../functions/spreadsheetremovesheet.md) +- spreadsheetSetActiveSheet [spreadsheetsetactivesheet](../functions/spreadsheetsetactivesheet.md) +- spreadsheetSetActiveSheetNumber [spreadsheetsetactivesheetnumber](../functions/spreadsheetsetactivesheetnumber.md) +- spreadsheetSetCellComment [spreadsheetsetcellcomment](../functions/spreadsheetsetcellcomment.md) +- spreadsheetSetCellFormula [spreadsheetsetcellformula](../functions/spreadsheetsetcellformula.md) +- spreadsheetSetCellValue [spreadsheetsetcellvalue](../functions/spreadsheetsetcellvalue.md) +- spreadsheetSetColumnWidth [spreadsheetsetcolumnwidth](../functions/spreadsheetsetcolumnwidth.md) +- spreadsheetSetFooter [spreadsheetsetfooter](../functions/spreadsheetsetfooter.md) +- spreadsheetSetHeader [spreadsheetsetheader](../functions/spreadsheetsetheader.md) +- spreadsheetSetRowHeight [spreadsheetsetrowheight](../functions/spreadsheetsetrowheight.md) +- spreadsheetShiftColumns [spreadsheetshiftcolumns](../functions/spreadsheetshiftcolumns.md) +- spreadsheetShiftRows [spreadsheetshiftrows](../functions/spreadsheetshiftrows.md) +- spreadsheetwrite [spreadsheetwrite](../functions/spreadsheetwrite.md) +- sqr [sqr](../functions/sqr.md) +- sslCertificateInstall [sslcertificateinstall](../functions/sslcertificateinstall.md) +- sslCertificateList [sslcertificatelist](../functions/sslcertificatelist.md) +- storeAddACL [storeaddacl](../functions/storeaddacl.md) +- storeGetACL [storegetacl](../functions/storegetacl.md) +- storeGetMetadata [storegetmetadata](../functions/storegetmetadata.md) +- storeSetACL [storesetacl](../functions/storesetacl.md) +- storeSetMetadata [storesetmetadata](../functions/storesetmetadata.md) +- stringEach [stringeach](../functions/stringeach.md) +- stringEvery [stringevery](../functions/stringevery.md) +- stringFilter [stringfilter](../functions/stringfilter.md) +- stringLen [stringlen](../functions/stringlen.md) +- stringMap [stringmap](../functions/stringmap.md) +- stringReduce [stringreduce](../functions/stringreduce.md) +- stringReduceRight [stringreduceright](../functions/stringreduceright.md) +- stringSome [stringsome](../functions/stringsome.md) +- stringSort [stringsort](../functions/stringsort.md) +- stripCR [stripcr](../functions/stripcr.md) +- structAppend [structappend](../functions/structappend.md) +- structClear [structclear](../functions/structclear.md) +- structCopy [structcopy](../functions/structcopy.md) +- structCount [structcount](../functions/structcount.md) +- structDelete [structdelete](../functions/structdelete.md) +- structEach [structeach](../functions/structeach.md) +- structEquals [structequals](../functions/structequals.md) +- structEvery [structevery](../functions/structevery.md) +- structFilter [structfilter](../functions/structfilter.md) +- structFind [structfind](../functions/structfind.md) +- structFindKey [structfindkey](../functions/structfindkey.md) +- structFindValue [structfindvalue](../functions/structfindvalue.md) +- structGet [structget](../functions/structget.md) +- structGetMetadata [structgetmetadata](../functions/structgetmetadata.md) +- structInsert [structinsert](../functions/structinsert.md) +- structIsCaseSensitive [structiscasesensitive](../functions/structiscasesensitive.md) +- structIsEmpty [structisempty](../functions/structisempty.md) +- structIsOrdered [structisordered](../functions/structisordered.md) +- structKeyArray [structkeyarray](../functions/structkeyarray.md) +- structKeyExists [structkeyexists](../functions/structkeyexists.md) +- structKeyList [structkeylist](../functions/structkeylist.md) +- structKeyTranslate [structkeytranslate](../functions/structkeytranslate.md) +- structListNew [structlistnew](../functions/structlistnew.md) +- structMap [structmap](../functions/structmap.md) +- structNew [structnew](../functions/structnew.md) +- structReduce [structreduce](../functions/structreduce.md) +- structSetMetadata [structsetmetadata](../functions/structsetmetadata.md) +- structSome [structsome](../functions/structsome.md) +- structSort [structsort](../functions/structsort.md) +- structToQueryString [structtoquerystring](../functions/structtoquerystring.md) +- structToSorted [structtosorted](../functions/structtosorted.md) +- structUpdate [structupdate](../functions/structupdate.md) +- structValueArray [structvaluearray](../functions/structvaluearray.md) +- systemCacheClear [systemcacheclear](../functions/systemcacheclear.md) +- systemOutput [systemoutput](../functions/systemoutput.md) +- tan [tan](../functions/tan.md) +- threadJoin [threadjoin](../functions/threadjoin.md) +- threadNew [threadnew](../functions/threadnew.md) +- threadTerminate [threadterminate](../functions/threadterminate.md) +- throw [throw](../functions/throw.md) +- timeFormat [timeformat](../functions/timeformat.md) +- toBase64 [tobase64](../functions/tobase64.md) +- toBinary [tobinary](../functions/tobinary.md) +- toNumeric [tonumeric](../functions/tonumeric.md) +- toScript [toscript](../functions/toscript.md) +- toString [tostring](../functions/tostring.md) +- trace [trace](../functions/trace.md) +- transactionCommit [transactioncommit](../functions/transactioncommit.md) +- transactionRollback [transactionrollback](../functions/transactionrollback.md) +- transactionSetSavepoint [transactionsetsavepoint](../functions/transactionsetsavepoint.md) +- trim [trim](../functions/trim.md) +- trueFalseFormat [truefalseformat](../functions/truefalseformat.md) +- uCase [ucase](../functions/ucase.md) +- ucFirst [ucfirst](../functions/ucfirst.md) +- unserializeJava [unserializejava](../functions/unserializejava.md) +- urlDecode [urldecode](../functions/urldecode.md) +- urlEncode [urlencode](../functions/urlencode.md) +- urlEncodedFormat [urlencodedformat](../functions/urlencodedformat.md) +- urlSessionFormat [urlsessionformat](../functions/urlsessionformat.md) +- val [val](../functions/val.md) +- valueArray [valuearray](../functions/valuearray.md) +- valueList [valuelist](../functions/valuelist.md) +- verifyBCryptHash [verifybcrypthash](../functions/verifybcrypthash.md) +- verifyClient [verifyclient](../functions/verifyclient.md) +- verifyEncryptedJWT [verifyencryptedjwt](../functions/verifyencryptedjwt.md) +- verifySCryptHash [verifyscrypthash](../functions/verifyscrypthash.md) +- verifySignedJWT [verifysignedjwt](../functions/verifysignedjwt.md) +- webserviceNew [webservicenew](../functions/webservicenew.md) +- week [week](../functions/week.md) +- wrap [wrap](../functions/wrap.md) +- writeBody [writebody](../functions/writebody.md) +- writeDump [writedump](../functions/writedump.md) +- writeLog [writelog](../functions/writelog.md) +- writeOutput [writeoutput](../functions/writeoutput.md) +- wsGetAllChannels [wsgetallchannels](../functions/wsgetallchannels.md) +- wsGetSubscribers [wsgetsubscribers](../functions/wsgetsubscribers.md) +- wsPublish [wspublish](../functions/wspublish.md) +- wsSendMessage [wssendmessage](../functions/wssendmessage.md) +- xmlChildPos [xmlchildpos](../functions/xmlchildpos.md) +- xmlClear [xmlclear](../functions/xmlclear.md) +- xmlDeleteAt [xmldeleteat](../functions/xmldeleteat.md) +- xmlElemNew [xmlelemnew](../functions/xmlelemnew.md) +- xmlFormat [xmlformat](../functions/xmlformat.md) +- xmlGetNodeType [xmlgetnodetype](../functions/xmlgetnodetype.md) +- xmlHasChild [xmlhaschild](../functions/xmlhaschild.md) +- xmlNew [xmlnew](../functions/xmlnew.md) +- xmlParse [xmlparse](../functions/xmlparse.md) +- xmlSearch [xmlsearch](../functions/xmlsearch.md) +- xmlTransform [xmltransform](../functions/xmltransform.md) +- xmlUpdate [xmlupdate](../functions/xmlupdate.md) +- xmlValidate [xmlvalidate](../functions/xmlvalidate.md) +- year [year](../functions/year.md) +- yesNoFormat [yesnoformat](../functions/yesnoformat.md) diff --git a/docs/categories/guides.md b/docs/categories/guides.md new file mode 100644 index 000000000..d64909819 --- /dev/null +++ b/docs/categories/guides.md @@ -0,0 +1,2 @@ +# All CFML Guides + diff --git a/docs/categories/image-functions.md b/docs/categories/image-functions.md new file mode 100644 index 000000000..97fb1bdbe --- /dev/null +++ b/docs/categories/image-functions.md @@ -0,0 +1,57 @@ +# Image Manipulation Functions + +- getReadableImageFormats [getReadableImageFormats](../functions/getreadableimageformats.md) +- getWriteableImageFormats [getWriteableImageFormats](../functions/getwriteableimageformats.md) +- imageAddBorder [imageAddBorder](../functions/imageaddborder.md) +- imageBlur [imageBlur](../functions/imageblur.md) +- imageClearRect [imageClearRect](../functions/imageclearrect.md) +- imageCopy [imageCopy](../functions/imagecopy.md) +- imageCrop [imageCrop](../functions/imagecrop.md) +- imageDrawArc [imageDrawArc](../functions/imagedrawarc.md) +- imageDrawBeveledRect [imageDrawBeveledRect](../functions/imagedrawbeveledrect.md) +- imageDrawCubicCurve [imageDrawCubicCurve](../functions/imagedrawcubiccurve.md) +- imageDrawLine [imageDrawLine](../functions/imagedrawline.md) +- imageDrawLines [imageDrawLines](../functions/imagedrawlines.md) +- imageDrawOval [imageDrawOval](../functions/imagedrawoval.md) +- imageDrawPoint [imageDrawPoint](../functions/imagedrawpoint.md) +- imageDrawQuadraticCurve [imageDrawQuadraticCurve](../functions/imagedrawquadraticcurve.md) +- imageDrawRect [imageDrawRect](../functions/imagedrawrect.md) +- imageDrawRoundRect [imageDrawRoundRect](../functions/imagedrawroundrect.md) +- imageDrawText [imageDrawText](../functions/imagedrawtext.md) +- imageFlip [imageFlip](../functions/imageflip.md) +- imageGetBlob [imageGetBlob](../functions/imagegetblob.md) +- imageGetBufferedImage [imageGetBufferedImage](../functions/imagegetbufferedimage.md) +- imageGetEXIFMetadata [imageGetExifMetaData](../functions/imagegetexifmetadata.md) +- imageGetEXIFTag [imageGetExifTag](../functions/imagegetexiftag.md) +- imageGetHeight [imageGetHeight](../functions/imagegetheight.md) +- imageGetIPTCMetadata [ImageGetIptcMetaData](../functions/imagegetiptcmetadata.md) +- imageGetIPTCtag [imageGetIPTCtag](../functions/imagegetiptctag.md) +- imageGetWidth [imageGetWidth](../functions/imagegetwidth.md) +- imageGrayScale [imageGrayScale](../functions/imagegrayscale.md) +- imageInfo [imageInfo](../functions/imageinfo.md) +- imageNegative [imageNegative](../functions/imagenegative.md) +- imageNew [imageNew](../functions/imagenew.md) +- imageOverlay [imageOverlay](../functions/imageoverlay.md) +- imagePaste [imagePaste](../functions/imagepaste.md) +- imageRead [imageRead](../functions/imageread.md) +- imageReadBase64 [imageReadBase64](../functions/imagereadbase64.md) +- imageResize [imageResize](../functions/imageresize.md) +- imageRotate [imageRotate](../functions/imagerotate.md) +- imageRotateDrawingAxis [imageRotateDrawingAxis](../functions/imagerotatedrawingaxis.md) +- imageScaleTofit [imageScaleToFit](../functions/imagescaletofit.md) +- imageSetAntialiasing [imageSetAntiAliasing](../functions/imagesetantialiasing.md) +- imageSetBackgroundColor [imageSetBackgroundColor](../functions/imagesetbackgroundcolor.md) +- imageSetDrawingColor [imageSetDrawingColor](../functions/imagesetdrawingcolor.md) +- imageSetDrawingStroke [imageSetDrawingStroke](../functions/imagesetdrawingstroke.md) +- imageSetDrawingTransparency [imageSetDrawingTransparency](../functions/imagesetdrawingtransparency.md) +- imageSharpen [imageSharpen](../functions/imagesharpen.md) +- imageShear [imageShear](../functions/imageshear.md) +- imageShearDrawingAxis [imageShearDrawingAxis](../functions/imagesheardrawingaxis.md) +- imageTranslate [imageTranslate](../functions/imagetranslate.md) +- imageTranslateDrawingAxis [imageTranslateDrawingAxis](../functions/imagetranslatedrawingaxis.md) +- imageWrite [imageWrite](../functions/imagewrite.md) +- imageWriteBase64 [imageWriteBase64](../functions/imagewritebase64.md) +- imageXORDrawingMode [imageXORDrawingMode](../functions/imagexordrawingmode.md) +- isImage [isImage](../functions/isimage.md) +- isImageFile [isImageFile](../functions/isimagefile.md) +- spreadsheetAddimage [spreadsheetAddImage](../functions/spreadsheetaddimage.md) diff --git a/docs/categories/list-functions.md b/docs/categories/list-functions.md new file mode 100644 index 000000000..e6204e319 --- /dev/null +++ b/docs/categories/list-functions.md @@ -0,0 +1,41 @@ +# List Functions + +- arrayToList [arrayToList](../functions/arraytolist.md) +- listAppend [listAppend](../functions/listappend.md) +- listAvg [listAvg](../functions/listavg.md) +- listChangeDelims [listChangeDelims](../functions/listchangedelims.md) +- listCompact [listCompact](../functions/listcompact.md) +- listContains [listContains](../functions/listcontains.md) +- listContainsNoCase [listContainsNoCase](../functions/listcontainsnocase.md) +- listDeleteAt [listDeleteAt](../functions/listdeleteat.md) +- listEach [listEach](../functions/listeach.md) +- listEvery [listEvery](../functions/listevery.md) +- listFilter [listFilter](../functions/listfilter.md) +- listFind [listFind](../functions/listfind.md) +- listFindNoCase [listFindNoCase](../functions/listfindnocase.md) +- listFirst [listFirst](../functions/listfirst.md) +- listGetAt [listGetAt](../functions/listgetat.md) +- listIndexExists [listIndexExists](../functions/listindexexists.md) +- listInsertAt [listInsertAt](../functions/listinsertat.md) +- listItemTrim [listItemTrim](../functions/listitemtrim.md) +- listLast [listLast](../functions/listlast.md) +- listLen [listLen](../functions/listlen.md) +- listMap [listMap](../functions/listmap.md) +- listPrepend [listPrepend](../functions/listprepend.md) +- listQualify [listQualify](../functions/listqualify.md) +- listReduce [listReduce](../functions/listreduce.md) +- listReduceRight [listReduceRight](../functions/listreduceright.md) +- listRemoveDuplicates [listRemoveDuplicates](../functions/listremoveduplicates.md) +- listRest [listRest](../functions/listrest.md) +- listSetAt [listSetAt](../functions/listsetat.md) +- listSome [listSome](../functions/listsome.md) +- listSort [listSort](../functions/listsort.md) +- listToArray [listToArray](../functions/listtoarray.md) +- listTrim [listTrim](../functions/listtrim.md) +- listValueCount [listValueCount](../functions/listvaluecount.md) +- listValueCountNoCase [listValueCountNoCase](../functions/listvaluecountnocase.md) +- quotedValueList [quotedValueList](../functions/quotedvaluelist.md) +- replaceList [replaceList](../functions/replacelist.md) +- replaceListNoCase [replaceListNoCase](../functions/replacelistnocase.md) +- structKeyList [structKeyList](../functions/structkeylist.md) +- valueList [valueList](../functions/valuelist.md) diff --git a/docs/categories/lucee5.md b/docs/categories/lucee5.md new file mode 100644 index 000000000..3d460e3c2 --- /dev/null +++ b/docs/categories/lucee5.md @@ -0,0 +1,13 @@ +# Lucee 5 New Functions and Tags + +- bundleInfo [bundleInfo](../functions/bundleinfo.md) +- cacheRegionExists [cacheRegionExists](../functions/cacheregionexists.md) +- cacheRegionNew [cacheRegionNew](../functions/cacheregionnew.md) +- cacheRegionRemove [cacheRegionRemove](../functions/cacheregionremove.md) +- generatePBKDFKey [generatePBKDFKey](../functions/generatepbkdfkey.md) +- getLocaleInfo [getLocaleInfo](../functions/getlocaleinfo.md) +- imageCaptcha [imageCaptcha](../functions/imagecaptcha.md) +- manifestRead [manifestRead](../functions/manifestread.md) +- render [render](../functions/render.md) +- sanitizeHtml [sanitizeHtml](../functions/sanitizehtml.md) +- webserviceNew [webserviceNew](../functions/webservicenew.md) diff --git a/docs/categories/lucee6.md b/docs/categories/lucee6.md new file mode 100644 index 000000000..a0e52db96 --- /dev/null +++ b/docs/categories/lucee6.md @@ -0,0 +1,13 @@ +# Lucee 6 New Functions and Tags + +- arraySplice [arraySplice](../functions/arraysplice.md) +- queryInsertAt [queryInsertAt](../functions/queryinsertat.md) +- queryReverse [queryReverse](../functions/queryreverse.md) +- queryRowSwap [queryRowSwap](../functions/queryrowswap.md) +- stringEach [stringEach](../functions/stringeach.md) +- stringEvery [stringEvery](../functions/stringevery.md) +- stringFilter [stringFilter](../functions/stringfilter.md) +- stringMap [stringMap](../functions/stringmap.md) +- stringReduce [stringReduce](../functions/stringreduce.md) +- stringSome [stringSome](../functions/stringsome.md) +- stringSort [stringSort](../functions/stringsort.md) diff --git a/docs/categories/math-functions.md b/docs/categories/math-functions.md new file mode 100644 index 000000000..158c2581b --- /dev/null +++ b/docs/categories/math-functions.md @@ -0,0 +1,41 @@ +# Math Functions + +- abs [abs](../functions/abs.md) +- acos [aCos](../functions/acos.md) +- arrayAvg [arrayAvg](../functions/arrayavg.md) +- arraySum [arraySum](../functions/arraysum.md) +- asin [aSin](../functions/asin.md) +- atn [atn](../functions/atn.md) +- bitAnd [bitAnd](../functions/bitand.md) +- bitMaskClear [bitMaskClear](../functions/bitmaskclear.md) +- bitMaskRead [bitMaskRead](../functions/bitmaskread.md) +- bitMaskSet [bitMaskSet](../functions/bitmaskset.md) +- bitNot [bitNot](../functions/bitnot.md) +- bitOr [bitOr](../functions/bitor.md) +- bitShln [bitSHLN](../functions/bitshln.md) +- bitShrn [bitSHRN](../functions/bitshrn.md) +- bitXor [bitXor](../functions/bitxor.md) +- ceiling [ceiling](../functions/ceiling.md) +- cos [cos](../functions/cos.md) +- decrementValue [decrementValue](../functions/decrementvalue.md) +- exp [exp](../functions/exp.md) +- fix [fix](../functions/fix.md) +- floor [floor](../functions/floor.md) +- formatBaseN [formatBaseN](../functions/formatbasen.md) +- incrementValue [incrementValue](../functions/incrementvalue.md) +- inputBaseN [inputBaseN](../functions/inputbasen.md) +- int [int](../functions/int.md) +- log [log](../functions/log.md) +- log10 [log10](../functions/log10.md) +- max [max](../functions/max.md) +- min [min](../functions/min.md) +- pi [pi](../functions/pi.md) +- precisionEvaluate [precisionEvaluate](../functions/precisionevaluate.md) +- rand [rand](../functions/rand.md) +- randomize [randomize](../functions/randomize.md) +- randRange [randRange](../functions/randrange.md) +- round [round](../functions/round.md) +- sgn [sgn](../functions/sgn.md) +- sin [sin](../functions/sin.md) +- sqr [sqr](../functions/sqr.md) +- tan [tan](../functions/tan.md) diff --git a/docs/categories/orm-functions.md b/docs/categories/orm-functions.md new file mode 100644 index 000000000..0083e6126 --- /dev/null +++ b/docs/categories/orm-functions.md @@ -0,0 +1,25 @@ +# ORM Functions + +- entityDelete [entityDelete](../functions/entitydelete.md) +- entityLoad [entityLoad](../functions/entityload.md) +- entityLoadByExample [entityLoadByExample](../functions/entityloadbyexample.md) +- entityLoadByPK [entityLoadByPK](../functions/entityloadbypk.md) +- entityMerge [entityMerge](../functions/entitymerge.md) +- entityNameArray [entityNameArray](../functions/entitynamearray.md) +- entityNameList [entityNameList](../functions/entitynamelist.md) +- entityNew [entityNew](../functions/entitynew.md) +- entityReload [entityReload](../functions/entityreload.md) +- entitySave [entitySave](../functions/entitysave.md) +- entityToQuery [entityToQuery](../functions/entitytoquery.md) +- ormClearSession [ORMClearSession](../functions/ormclearsession.md) +- ormCloseAllSessions [ORMCloseAllSessions](../functions/ormcloseallsessions.md) +- ormCloseSession [ORMCloseSession](../functions/ormclosesession.md) +- ormEvictCollection [ORMEvictCollection](../functions/ormevictcollection.md) +- ormEvictEntity [ORMEvictEntity](../functions/ormevictentity.md) +- ormEvictQueries [ORMEvictQueries](../functions/ormevictqueries.md) +- ormExecuteQuery [ORMExecuteQuery](../functions/ormexecutequery.md) +- ormFlush [ORMFlush](../functions/ormflush.md) +- ormFlushAll [ORMFlushAll](../functions/ormflushall.md) +- ormGetSession [ORMGetSession](../functions/ormgetsession.md) +- ormGetSessionFactory [ORMGetSessionFactory](../functions/ormgetsessionfactory.md) +- ormReload [ORMReload](../functions/ormreload.md) diff --git a/docs/categories/protocol-tags.md b/docs/categories/protocol-tags.md new file mode 100644 index 000000000..22d35d89b --- /dev/null +++ b/docs/categories/protocol-tags.md @@ -0,0 +1,22 @@ +# Network Protocol Tags + +- cfajaximport [cfajaximport](../tags/cfajaximport.md) +- cfajaxproxy [cfajaxproxy](../tags/cfajaxproxy.md) +- cfexchangecalendar [cfexchangecalendar](../tags/cfexchangecalendar.md) +- cfexchangeconnection [cfexchangeconnection](../tags/cfexchangeconnection.md) +- cfexchangecontact [cfexchangecontact](../tags/cfexchangecontact.md) +- cfexchangefilter [cfexchangefilter](../tags/cfexchangefilter.md) +- cfexchangemail [cfexchangemail](../tags/cfexchangemail.md) +- cfexchangetask [cfexchangetask](../tags/cfexchangetask.md) +- cffeed [cffeed](../tags/cffeed.md) +- cfftp [cfftp](../tags/cfftp.md) +- cfhttp [cfhttp](../tags/cfhttp.md) +- cfhttpparam [cfhttpparam](../tags/cfhttpparam.md) +- cfimap [cfimap](../tags/cfimap.md) +- cfldap [cfldap](../tags/cfldap.md) +- cfmail [cfmail](../tags/cfmail.md) +- cfmailparam [cfmailparam](../tags/cfmailparam.md) +- cfmailpart [cfmailpart](../tags/cfmailpart.md) +- cfpop [cfpop](../tags/cfpop.md) +- cfsharepoint [cfsharepoint](../tags/cfsharepoint.md) +- cfwebsocket [cfwebsocket](../tags/cfwebsocket.md) diff --git a/docs/categories/query-functions.md b/docs/categories/query-functions.md new file mode 100644 index 000000000..168148946 --- /dev/null +++ b/docs/categories/query-functions.md @@ -0,0 +1,43 @@ +# Query Manipulation Functions + +- entityToQuery [entityToQuery](../functions/entitytoquery.md) +- isQuery [isQuery](../functions/isquery.md) +- ormExecuteQuery [ORMExecuteQuery](../functions/ormexecutequery.md) +- query [query](../functions/query.md) +- queryAddColumn [queryAddColumn](../functions/queryaddcolumn.md) +- queryAddRow [queryAddRow](../functions/queryaddrow.md) +- queryAppend [queryAppend](../functions/queryappend.md) +- queryClear [queryclear](../functions/queryclear.md) +- queryColumnArray [queryColumnArray](../functions/querycolumnarray.md) +- queryColumnCount [queryColumnCount](../functions/querycolumncount.md) +- queryColumnData [queryColumnData](../functions/querycolumndata.md) +- queryColumnExists [queryColumnExists](../functions/querycolumnexists.md) +- queryColumnList [queryColumnList](../functions/querycolumnlist.md) +- queryConvertForGrid [queryConvertForGrid](../functions/queryconvertforgrid.md) +- queryCurrentRow [queryCurrentRow](../functions/querycurrentrow.md) +- queryDeleteColumn [queryDeleteColumn](../functions/querydeletecolumn.md) +- queryDeleteRow [queryDeleteRow](../functions/querydeleterow.md) +- queryEach [queryEach](../functions/queryeach.md) +- queryEvery [queryEvery](../functions/queryevery.md) +- queryExecute [queryExecute](../functions/queryexecute.md) +- queryFilter [queryFilter](../functions/queryfilter.md) +- queryGetCell [queryGetCell](../functions/querygetcell.md) +- queryGetResult [queryGetResult](../functions/querygetresult.md) +- queryGetRow [queryGetRow](../functions/querygetrow.md) +- queryInsertAt [queryInsertAt](../functions/queryinsertat.md) +- queryKeyExists [queryKeyExists](../functions/querykeyexists.md) +- queryMap [queryMap](../functions/querymap.md) +- queryNew [queryNew](../functions/querynew.md) +- queryPrepend [queryPrepend](../functions/queryprepend.md) +- queryRecordCount [queryRecordCount](../functions/queryrecordcount.md) +- queryReduce [queryReduce](../functions/queryreduce.md) +- queryReverse [queryReverse](../functions/queryreverse.md) +- queryRowData [queryRowData](../functions/queryrowdata.md) +- queryRowSwap [queryRowSwap](../functions/queryrowswap.md) +- querySetCell [querySetCell](../functions/querysetcell.md) +- querySlice [querySlice](../functions/queryslice.md) +- querySome [querySome](../functions/querysome.md) +- querySort [querySort](../functions/querysort.md) +- quotedValueList [quotedValueList](../functions/quotedvaluelist.md) +- valueArray [valueArray](../functions/valuearray.md) +- valueList [valueList](../functions/valuelist.md) diff --git a/docs/categories/security-functions.md b/docs/categories/security-functions.md new file mode 100644 index 000000000..1e867f5bc --- /dev/null +++ b/docs/categories/security-functions.md @@ -0,0 +1,39 @@ +# Security Functions + +- binaryDecode [binaryDecode](../functions/binarydecode.md) +- binaryEncode [binaryEncode](../functions/binaryencode.md) +- createEncryptedJWT [createEncryptedJWT](../functions/createencryptedjwt.md) +- createSignedJWT [createSignedJWT](../functions/createsignedjwt.md) +- csrfGenerateToken [csrfGenerateToken](../functions/csrfgeneratetoken.md) +- csrfVerifyToken [csrfVerifyToken](../functions/csrfverifytoken.md) +- decrypt [decrypt](../functions/decrypt.md) +- decryptBinary [decryptBinary](../functions/decryptbinary.md) +- encodeFor [encodeFor](../functions/encodefor.md) +- encodeForCSS [encodeForCSS](../functions/encodeforcss.md) +- encodeForDN [encodeForDN](../functions/encodefordn.md) +- encodeForHTML [encodeForHTML](../functions/encodeforhtml.md) +- encodeForHTMLAttribute [encodeForHTMLAttribute](../functions/encodeforhtmlattribute.md) +- encodeForJavaScript [encodeForJavaScript](../functions/encodeforjavascript.md) +- encodeForLDAP [encodeForLDAP](../functions/encodeforldap.md) +- encodeForURL [encodeForURL](../functions/encodeforurl.md) +- encodeForXML [encodeForXML](../functions/encodeforxml.md) +- encodeForXMLAttribute [encodeForXMLAttribute](../functions/encodeforxmlattribute.md) +- encodeForXPath [encodeForXPath](../functions/encodeforxpath.md) +- encrypt [encrypt](../functions/encrypt.md) +- encryptBinary [encryptBinary](../functions/encryptbinary.md) +- generatePBKDFKey [generatePBKDFKey](../functions/generatepbkdfkey.md) +- generateSecretKey [generateSecretKey](../functions/generatesecretkey.md) +- getAuthUser [getAuthUser](../functions/getauthuser.md) +- getTempDirectory [getTempDirectory](../functions/gettempdirectory.md) +- getTempFile [getTempFile](../functions/gettempfile.md) +- getUserRoles [getUserRoles](../functions/getuserroles.md) +- hash [hash](../functions/hash.md) +- hmac [hmac](../functions/hmac.md) +- isUserInAnyRole [isUserInAnyRole](../functions/isuserinanyrole.md) +- isUserInRole [isUserInRole](../functions/isuserinrole.md) +- isUserLoggedIn [isUserLoggedIn](../functions/isuserloggedin.md) +- sslCertificateInstall [SSLCertificateInstall](../functions/sslcertificateinstall.md) +- sslCertificateList [SSLCertificateList](../functions/sslcertificatelist.md) +- verifyClient [verifyClient](../functions/verifyclient.md) +- verifyEncryptedJWT [verifyEncryptedJWT](../functions/verifyencryptedjwt.md) +- verifySignedJWT [verifySignedJWT](../functions/verifysignedjwt.md) diff --git a/docs/categories/spreadsheet-functions.md b/docs/categories/spreadsheet-functions.md new file mode 100644 index 000000000..6b23822f5 --- /dev/null +++ b/docs/categories/spreadsheet-functions.md @@ -0,0 +1,43 @@ +# Spreadsheet Manipulation Functions + +- isSpreadsheetFile [isSpreadsheetFile](../functions/isspreadsheetfile.md) +- isSpreadsheetObject [isSpreadsheetObject](../functions/isspreadsheetobject.md) +- spreadsheetAddAutoFilter [spreadsheetAddAutofilter](../functions/spreadsheetaddautofilter.md) +- spreadsheetAddColumn [spreadsheetAddColumn](../functions/spreadsheetaddcolumn.md) +- spreadsheetAddFreezePane [spreadsheetAddFreezePane](../functions/spreadsheetaddfreezepane.md) +- spreadsheetAddimage [spreadsheetAddImage](../functions/spreadsheetaddimage.md) +- spreadsheetAddInfo [spreadsheetAddInfo](../functions/spreadsheetaddinfo.md) +- spreadsheetAddRow [spreadsheetAddRow](../functions/spreadsheetaddrow.md) +- spreadsheetAddRows [spreadsheetAddRows](../functions/spreadsheetaddrows.md) +- spreadsheetAddSplitPane [spreadsheetAddSplitPane](../functions/spreadsheetaddsplitpane.md) +- spreadsheetCreateSheet [spreadsheetCreateSheet](../functions/spreadsheetcreatesheet.md) +- spreadsheetDeleteColumn [spreadsheetDeleteColumn](../functions/spreadsheetdeletecolumn.md) +- spreadsheetDeleteColumns [spreadsheetDeleteColumns](../functions/spreadsheetdeletecolumns.md) +- spreadsheetDeleteRow [spreadsheetDeleteRow](../functions/spreadsheetdeleterow.md) +- spreadsheetDeleteRows [spreadsheetDeleteRows](../functions/spreadsheetdeleterows.md) +- spreadsheetFormatCell [spreadsheetFormatCell](../functions/spreadsheetformatcell.md) +- spreadsheetFormatColumn [spreadsheetFormatColumn](../functions/spreadsheetformatcolumn.md) +- spreadsheetFormatColumns [spreadsheetFormatColumns](../functions/spreadsheetformatcolumns.md) +- spreadsheetFormatRow [spreadsheetFormatRow](../functions/spreadsheetformatrow.md) +- spreadsheetFormatRows [spreadsheetFormatRows](../functions/spreadsheetformatrows.md) +- spreadsheetGetCellComment [spreadsheetGetCellComment](../functions/spreadsheetgetcellcomment.md) +- spreadsheetGetCellFormula [spreadsheetGetCellFormula](../functions/spreadsheetgetcellformula.md) +- spreadsheetGetCellValue [spreadsheetGetCellValue](../functions/spreadsheetgetcellvalue.md) +- spreadsheetInfo [spreadsheetInfo](../functions/spreadsheetinfo.md) +- spreadsheetMergeCells [spreadsheetMergeCells](../functions/spreadsheetmergecells.md) +- spreadsheetNew [spreadsheetNew](../functions/spreadsheetnew.md) +- spreadsheetRead [spreadsheetRead](../functions/spreadsheetread.md) +- spreadsheetReadBinary [spreadsheetReadBinary](../functions/spreadsheetreadbinary.md) +- spreadsheetSetActiveSheet [spreadsheetSetActiveSheet](../functions/spreadsheetsetactivesheet.md) +- spreadsheetSetActiveSheetNumber [spreadsheetSetActiveSheetNumber](../functions/spreadsheetsetactivesheetnumber.md) +- spreadsheetSetCellComment [spreadsheetSetCellComment](../functions/spreadsheetsetcellcomment.md) +- spreadsheetSetCellFormula [spreadsheetSetCellFormula](../functions/spreadsheetsetcellformula.md) +- spreadsheetSetCellValue [spreadsheetSetCellValue](../functions/spreadsheetsetcellvalue.md) +- spreadsheetSetColumnWidth [spreadsheetSetColumnWidth](../functions/spreadsheetsetcolumnwidth.md) +- spreadsheetSetFooter [spreadsheetSetFooter](../functions/spreadsheetsetfooter.md) +- spreadsheetSetHeader [spreadsheetSetHeader](../functions/spreadsheetsetheader.md) +- spreadsheetSetRowHeight [spreadsheetSetRowHeight](../functions/spreadsheetsetrowheight.md) +- spreadsheetShiftColumns [spreadsheetShiftColumns](../functions/spreadsheetshiftcolumns.md) +- spreadsheetShiftRows [spreadsheetShiftRows](../functions/spreadsheetshiftrows.md) +- spreadsheetwrite [spreadsheetWrite](../functions/spreadsheetwrite.md) +- spreadsheetGetColumnCount [spreadsheetGetColumnCount](../functions/spreadsheetgetcolumncount.md) diff --git a/docs/categories/string-functions.md b/docs/categories/string-functions.md new file mode 100644 index 000000000..290b72d45 --- /dev/null +++ b/docs/categories/string-functions.md @@ -0,0 +1,72 @@ +# String Functions + +- asc [asc](../functions/asc.md) +- binaryDecode [binaryDecode](../functions/binarydecode.md) +- binaryEncode [binaryEncode](../functions/binaryencode.md) +- chr [chr](../functions/chr.md) +- cJustify [cJustify](../functions/cjustify.md) +- compare [compare](../functions/compare.md) +- compareNoCase [compareNoCase](../functions/comparenocase.md) +- dayOfWeekAsString [dayOfWeekAsString](../functions/dayofweekasstring.md) +- find [find](../functions/find.md) +- findNoCase [findNoCase](../functions/findnocase.md) +- findOneOf [findOneOf](../functions/findoneof.md) +- formatBaseN [formatBaseN](../functions/formatbasen.md) +- htmlCodeFormat [HTMLCodeFormat](../functions/htmlcodeformat.md) +- htmlEditFormat [HTMLEditFormat](../functions/htmleditformat.md) +- insert [insert](../functions/insert.md) +- javaCast [javacast](../functions/javacast.md) +- jsStringFormat [jsStringFormat](../functions/jsstringformat.md) +- lCase [lCase](../functions/lcase.md) +- left [left](../functions/left.md) +- len [len](../functions/len.md) +- listAvg [listAvg](../functions/listavg.md) +- listCompact [listCompact](../functions/listcompact.md) +- listEvery [listEvery](../functions/listevery.md) +- listFind [listFind](../functions/listfind.md) +- listFindNoCase [listFindNoCase](../functions/listfindnocase.md) +- listIndexExists [listIndexExists](../functions/listindexexists.md) +- listItemTrim [listItemTrim](../functions/listitemtrim.md) +- listSome [listSome](../functions/listsome.md) +- listValueCount [listValueCount](../functions/listvaluecount.md) +- listValueCountNoCase [listValueCountNoCase](../functions/listvaluecountnocase.md) +- lJustify [lJustify](../functions/ljustify.md) +- lTrim [lTrim](../functions/ltrim.md) +- mid [mid](../functions/mid.md) +- paragraphFormat [paragraphFormat](../functions/paragraphformat.md) +- reFind [REFind](../functions/refind.md) +- reFindNoCase [REFindNoCase](../functions/refindnocase.md) +- reMatch [REmatch](../functions/rematch.md) +- reMatchNoCase [REMatchNoCase](../functions/rematchnocase.md) +- removeChars [removeChars](../functions/removechars.md) +- repeatString [repeatString](../functions/repeatstring.md) +- replace [replace](../functions/replace.md) +- replaceList [replaceList](../functions/replacelist.md) +- replaceNoCase [replaceNoCase](../functions/replacenocase.md) +- reReplace [REReplace](../functions/rereplace.md) +- reReplaceNoCase [REReplaceNoCase](../functions/rereplacenocase.md) +- reverse [reverse](../functions/reverse.md) +- right [right](../functions/right.md) +- rJustify [rJustify](../functions/rjustify.md) +- rTrim [rTrim](../functions/rtrim.md) +- spanExcluding [spanExcluding](../functions/spanexcluding.md) +- spanIncluding [spanIncluding](../functions/spanincluding.md) +- stringEach [stringEach](../functions/stringeach.md) +- stringEvery [stringEvery](../functions/stringevery.md) +- stringFilter [stringFilter](../functions/stringfilter.md) +- stringLen [stringLen](../functions/stringlen.md) +- stringMap [stringMap](../functions/stringmap.md) +- stringReduce [stringReduce](../functions/stringreduce.md) +- stringSome [stringSome](../functions/stringsome.md) +- stringSort [stringSort](../functions/stringsort.md) +- stripCR [stripCR](../functions/stripcr.md) +- toBase64 [toBase64](../functions/tobase64.md) +- toBinary [toBinary](../functions/tobinary.md) +- toString [toString](../functions/tostring.md) +- trim [trim](../functions/trim.md) +- uCase [uCase](../functions/ucase.md) +- urlDecode [URLDecode](../functions/urldecode.md) +- urlEncodedFormat [URLEncodedFormat](../functions/urlencodedformat.md) +- val [val](../functions/val.md) +- wrap [wrap](../functions/wrap.md) +- xmlFormat [XMLFormat](../functions/xmlformat.md) diff --git a/docs/categories/struct-functions.md b/docs/categories/struct-functions.md new file mode 100644 index 000000000..dfe8e11e8 --- /dev/null +++ b/docs/categories/struct-functions.md @@ -0,0 +1,35 @@ +# Structure Functions + +- isStruct [isStruct](../functions/isstruct.md) +- structAppend [structAppend](../functions/structappend.md) +- structClear [structClear](../functions/structclear.md) +- structCopy [structCopy](../functions/structcopy.md) +- structCount [structCount](../functions/structcount.md) +- structDelete [structDelete](../functions/structdelete.md) +- structEach [structEach](../functions/structeach.md) +- structEquals [structEquals](../functions/structequals.md) +- structEvery [structEvery](../functions/structevery.md) +- structFilter [structFilter](../functions/structfilter.md) +- structFind [structFind](../functions/structfind.md) +- structFindKey [structFindKey](../functions/structfindkey.md) +- structFindValue [structFindValue](../functions/structfindvalue.md) +- structGet [structGet](../functions/structget.md) +- structGetMetadata [structGetMetadata](../functions/structgetmetadata.md) +- structInsert [structInsert](../functions/structinsert.md) +- structIsCaseSensitive [structIsCaseSensitive](../functions/structiscasesensitive.md) +- structIsEmpty [structIsEmpty](../functions/structisempty.md) +- structIsOrdered [structIsOrdered](../functions/structisordered.md) +- structKeyArray [structKeyArray](../functions/structkeyarray.md) +- structKeyExists [structKeyExists](../functions/structkeyexists.md) +- structKeyList [structKeyList](../functions/structkeylist.md) +- structKeyTranslate [structKeyTranslate](../functions/structkeytranslate.md) +- structListNew [structListNew](../functions/structlistnew.md) +- structMap [structMap](../functions/structmap.md) +- structNew [structNew](../functions/structnew.md) +- structReduce [structReduce](../functions/structreduce.md) +- structSetMetadata [structSetMetadata](../functions/structsetmetadata.md) +- structSome [structSome](../functions/structsome.md) +- structSort [structSort](../functions/structsort.md) +- structToSorted [structToSorted](../functions/structtosorted.md) +- structUpdate [structUpdate](../functions/structupdate.md) +- structValueArray [structValueArray](../functions/structvaluearray.md) diff --git a/docs/categories/system-tags.md b/docs/categories/system-tags.md new file mode 100644 index 000000000..e12f9eb2b --- /dev/null +++ b/docs/categories/system-tags.md @@ -0,0 +1,9 @@ +# System Tags + +- cfdirectory [cfdirectory](../tags/cfdirectory.md) +- cffile [cffile](../tags/cffile.md) +- cffileupload [cffileupload](../tags/cffileupload.md) +- cfregistry [cfregistry](../tags/cfregistry.md) +- cfschedule [cfschedule](../tags/cfschedule.md) +- cfzip [cfzip](../tags/cfzip.md) +- cfzipparam [cfzipparam](../tags/cfzipparam.md) diff --git a/docs/categories/tags.md b/docs/categories/tags.md new file mode 100644 index 000000000..99e7b4fd7 --- /dev/null +++ b/docs/categories/tags.md @@ -0,0 +1,172 @@ +# All CFML Tags + +- cf_socialplugin [cf_socialplugin](../tags/cf_socialplugin.md) +- cfabort [cfabort](../tags/cfabort.md) +- cfadmin [cfadmin](../tags/cfadmin.md) +- cfajaximport [cfajaximport](../tags/cfajaximport.md) +- cfajaxproxy [cfajaxproxy](../tags/cfajaxproxy.md) +- cfapplet [cfapplet](../tags/cfapplet.md) +- cfapplication [cfapplication](../tags/cfapplication.md) +- cfargument [cfargument](../tags/cfargument.md) +- cfassociate [cfassociate](../tags/cfassociate.md) +- cfbreak [cfbreak](../tags/cfbreak.md) +- cfcache [cfcache](../tags/cfcache.md) +- cfcalendar [cfcalendar](../tags/cfcalendar.md) +- cfcase [cfcase](../tags/cfcase.md) +- cfcatch [cfcatch](../tags/cfcatch.md) +- cfchart [cfchart](../tags/cfchart.md) +- cfchartdata [cfchartdata](../tags/cfchartdata.md) +- cfchartseries [cfchartseries](../tags/cfchartseries.md) +- cfclient [cfclient](../tags/cfclient.md) +- cfclientsettings [cfclientsettings](../tags/cfclientsettings.md) +- cfcol [cfcol](../tags/cfcol.md) +- cfcollection [cfcollection](../tags/cfcollection.md) +- cfcomponent [cfcomponent](../tags/cfcomponent.md) +- cfcontent [cfcontent](../tags/cfcontent.md) +- cfcontinue [cfcontinue](../tags/cfcontinue.md) +- cfcookie [cfcookie](../tags/cfcookie.md) +- cfdbinfo [cfdbinfo](../tags/cfdbinfo.md) +- cfdefaultcase [cfdefaultcase](../tags/cfdefaultcase.md) +- cfdirectory [cfdirectory](../tags/cfdirectory.md) +- cfdiv [cfdiv](../tags/cfdiv.md) +- cfdocument [cfdocument](../tags/cfdocument.md) +- cfdocumentitem [cfdocumentitem](../tags/cfdocumentitem.md) +- cfdocumentsection [cfdocumentsection](../tags/cfdocumentsection.md) +- cfdump [cfdump](../tags/cfdump.md) +- cfelse [cfelse](../tags/cfelse.md) +- cfelseif [cfelseif](../tags/cfelseif.md) +- cferror [cferror](../tags/cferror.md) +- cfexchangecalendar [cfexchangecalendar](../tags/cfexchangecalendar.md) +- cfexchangeconnection [cfexchangeconnection](../tags/cfexchangeconnection.md) +- cfexchangecontact [cfexchangecontact](../tags/cfexchangecontact.md) +- cfexchangeconversation [cfexchangeconversation](../tags/cfexchangeconversation.md) +- cfexchangefilter [cfexchangefilter](../tags/cfexchangefilter.md) +- cfexchangefolder [cfexchangefolder](../tags/cfexchangefolder.md) +- cfexchangemail [cfexchangemail](../tags/cfexchangemail.md) +- cfexchangetask [cfexchangetask](../tags/cfexchangetask.md) +- cfexecute [cfexecute](../tags/cfexecute.md) +- cfexit [cfexit](../tags/cfexit.md) +- cffeed [cffeed](../tags/cffeed.md) +- cffile [cffile](../tags/cffile.md) +- cffileupload [cffileupload](../tags/cffileupload.md) +- cffinally [cffinally](../tags/cffinally.md) +- cfflush [cfflush](../tags/cfflush.md) +- cfform [cfform](../tags/cfform.md) +- cfformgroup [cfformgroup](../tags/cfformgroup.md) +- cfformitem [cfformitem](../tags/cfformitem.md) +- cfforward [cfforward](../tags/cfforward.md) +- cfftp [cfftp](../tags/cfftp.md) +- cffunction [cffunction](../tags/cffunction.md) +- cfgrid [cfgrid](../tags/cfgrid.md) +- cfgridcolumn [cfgridcolumn](../tags/cfgridcolumn.md) +- cfgridrow [cfgridrow](../tags/cfgridrow.md) +- cfgridupdate [cfgridupdate](../tags/cfgridupdate.md) +- cfheader [cfheader](../tags/cfheader.md) +- cfhtmlbody [cfhtmlbody](../tags/cfhtmlbody.md) +- cfhtmlhead [cfhtmlhead](../tags/cfhtmlhead.md) +- cfhtmltopdf [cfhtmltopdf](../tags/cfhtmltopdf.md) +- cfhtmltopdfitem [cfhtmltopdfitem](../tags/cfhtmltopdfitem.md) +- cfhttp [cfhttp](../tags/cfhttp.md) +- cfhttpparam [cfhttpparam](../tags/cfhttpparam.md) +- cfif [cfif](../tags/cfif.md) +- cfimage [cfimage](../tags/cfimage.md) +- cfimap [cfimap](../tags/cfimap.md) +- cfimapfilter [cfimapfilter](../tags/cfimapfilter.md) +- cfimport [cfimport](../tags/cfimport.md) +- cfinclude [cfinclude](../tags/cfinclude.md) +- cfindex [cfindex](../tags/cfindex.md) +- cfinput [cfinput](../tags/cfinput.md) +- cfinsert [cfinsert](../tags/cfinsert.md) +- cfinterface [cfinterface](../tags/cfinterface.md) +- cfinvoke [cfinvoke](../tags/cfinvoke.md) +- cfinvokeargument [cfinvokeargument](../tags/cfinvokeargument.md) +- cfjava [cfjava](../tags/cfjava.md) +- cflayout [cflayout](../tags/cflayout.md) +- cflayoutarea [cflayoutarea](../tags/cflayoutarea.md) +- cfldap [cfldap](../tags/cfldap.md) +- cflocation [cflocation](../tags/cflocation.md) +- cflock [cflock](../tags/cflock.md) +- cflog [cflog](../tags/cflog.md) +- cflogin [cflogin](../tags/cflogin.md) +- cfloginuser [cfloginuser](../tags/cfloginuser.md) +- cflogout [cflogout](../tags/cflogout.md) +- cfloop [cfloop](../tags/cfloop.md) +- cfmail [cfmail](../tags/cfmail.md) +- cfmailparam [cfmailparam](../tags/cfmailparam.md) +- cfmailpart [cfmailpart](../tags/cfmailpart.md) +- cfmap [cfmap](../tags/cfmap.md) +- cfmapitem [cfmapitem](../tags/cfmapitem.md) +- cfmediaplayer [cfmediaplayer](../tags/cfmediaplayer.md) +- cfmenu [cfmenu](../tags/cfmenu.md) +- cfmenuitem [cfmenuitem](../tags/cfmenuitem.md) +- cfmessagebox [cfmessagebox](../tags/cfmessagebox.md) +- cfmodule [cfmodule](../tags/cfmodule.md) +- cfntauthenticate [cfntauthenticate](../tags/cfntauthenticate.md) +- cfoauth [cfoauth](../tags/cfoauth.md) +- cfobject [cfobject](../tags/cfobject.md) +- cfobjectcache [cfobjectcache](../tags/cfobjectcache.md) +- cfoutput [cfoutput](../tags/cfoutput.md) +- cfpageencoding [cfpageencoding](../tags/cfpageencoding.md) +- cfparam [cfparam](../tags/cfparam.md) +- cfpdf [cfpdf](../tags/cfpdf.md) +- cfpdfform [cfpdfform](../tags/cfpdfform.md) +- cfpdfformparam [cfpdfformparam](../tags/cfpdfformparam.md) +- cfpdfparam [cfpdfparam](../tags/cfpdfparam.md) +- cfpdfsubform [cfpdfsubform](../tags/cfpdfsubform.md) +- cfpod [cfpod](../tags/cfpod.md) +- cfpop [cfpop](../tags/cfpop.md) +- cfpresentation [cfpresentation](../tags/cfpresentation.md) +- cfpresentationslide [cfpresentationslide](../tags/cfpresentationslide.md) +- cfpresenter [cfpresenter](../tags/cfpresenter.md) +- cfprint [cfprint](../tags/cfprint.md) +- cfprocessingdirective [cfprocessingdirective](../tags/cfprocessingdirective.md) +- cfprocparam [cfprocparam](../tags/cfprocparam.md) +- cfprocresult [cfprocresult](../tags/cfprocresult.md) +- cfprogressbar [cfprogressbar](../tags/cfprogressbar.md) +- cfproperty [cfproperty](../tags/cfproperty.md) +- cfquery [cfquery](../tags/cfquery.md) +- cfqueryparam [cfqueryparam](../tags/cfqueryparam.md) +- cfregistry [cfregistry](../tags/cfregistry.md) +- cfreport [cfreport](../tags/cfreport.md) +- cfreportparam [cfreportparam](../tags/cfreportparam.md) +- cfrethrow [cfrethrow](../tags/cfrethrow.md) +- cfretry [cfretry](../tags/cfretry.md) +- cfreturn [cfreturn](../tags/cfreturn.md) +- cfsavecontent [cfsavecontent](../tags/cfsavecontent.md) +- cfschedule [cfschedule](../tags/cfschedule.md) +- cfscript [cfscript](../tags/cfscript.md) +- cfsearch [cfsearch](../tags/cfsearch.md) +- cfselect [cfselect](../tags/cfselect.md) +- cfservlet [cfservlet](../tags/cfservlet.md) +- cfservletparam [cfservletparam](../tags/cfservletparam.md) +- cfset [cfset](../tags/cfset.md) +- cfsetting [cfsetting](../tags/cfsetting.md) +- cfsharepoint [cfsharepoint](../tags/cfsharepoint.md) +- cfsilent [cfsilent](../tags/cfsilent.md) +- cfsleep [cfsleep](../tags/cfsleep.md) +- cfslider [cfslider](../tags/cfslider.md) +- cfspreadsheet [cfspreadsheet](../tags/cfspreadsheet.md) +- cfsprydataset [cfsprydataset](../tags/cfsprydataset.md) +- cfstopwatch [cfstopwatch](../tags/cfstopwatch.md) +- cfstoredproc [cfstoredproc](../tags/cfstoredproc.md) +- cfswitch [cfswitch](../tags/cfswitch.md) +- cftable [cftable](../tags/cftable.md) +- cftextarea [cftextarea](../tags/cftextarea.md) +- cftextinput [cftextinput](../tags/cftextinput.md) +- cfthread [cfthread](../tags/cfthread.md) +- cfthrow [cfthrow](../tags/cfthrow.md) +- cftimer [cftimer](../tags/cftimer.md) +- cftooltip [cftooltip](../tags/cftooltip.md) +- cftrace [cftrace](../tags/cftrace.md) +- cftransaction [cftransaction](../tags/cftransaction.md) +- cftree [cftree](../tags/cftree.md) +- cftreeitem [cftreeitem](../tags/cftreeitem.md) +- cftry [cftry](../tags/cftry.md) +- cfupdate [cfupdate](../tags/cfupdate.md) +- cfwddx [cfwddx](../tags/cfwddx.md) +- cfwebsocket [cfwebsocket](../tags/cfwebsocket.md) +- cfwhile [cfwhile](../tags/cfwhile.md) +- cfwindow [cfwindow](../tags/cfwindow.md) +- cfxml [cfxml](../tags/cfxml.md) +- cfzip [cfzip](../tags/cfzip.md) +- cfzipparam [cfzipparam](../tags/cfzipparam.md) diff --git a/docs/categories/ui-tags.md b/docs/categories/ui-tags.md new file mode 100644 index 000000000..2817cf706 --- /dev/null +++ b/docs/categories/ui-tags.md @@ -0,0 +1,27 @@ +# UI Tags + +- cfdiv [cfdiv](../tags/cfdiv.md) +- cfform [cfform](../tags/cfform.md) +- cfformgroup [cfformgroup](../tags/cfformgroup.md) +- cfformitem [cfformitem](../tags/cfformitem.md) +- cfgrid [cfgrid](../tags/cfgrid.md) +- cfgridcolumn [cfgridcolumn](../tags/cfgridcolumn.md) +- cfgridrow [cfgridrow](../tags/cfgridrow.md) +- cfgridupdate [cfgridupdate](../tags/cfgridupdate.md) +- cfinput [cfinput](../tags/cfinput.md) +- cflayout [cflayout](../tags/cflayout.md) +- cflayoutarea [cflayoutarea](../tags/cflayoutarea.md) +- cfmap [cfmap](../tags/cfmap.md) +- cfmapitem [cfmapitem](../tags/cfmapitem.md) +- cfmenu [cfmenu](../tags/cfmenu.md) +- cfmenuitem [cfmenuitem](../tags/cfmenuitem.md) +- cfpod [cfpod](../tags/cfpod.md) +- cfprogressbar [cfprogressbar](../tags/cfprogressbar.md) +- cfselect [cfselect](../tags/cfselect.md) +- cftable [cftable](../tags/cftable.md) +- cftextarea [cftextarea](../tags/cftextarea.md) +- cftextinput [cftextinput](../tags/cftextinput.md) +- cftooltip [cftooltip](../tags/cftooltip.md) +- cftree [cftree](../tags/cftree.md) +- cftreeitem [cftreeitem](../tags/cftreeitem.md) +- cfwindow [cfwindow](../tags/cfwindow.md) diff --git a/docs/functions/abs.md b/docs/functions/abs.md new file mode 100644 index 000000000..cf4f16734 --- /dev/null +++ b/docs/functions/abs.md @@ -0,0 +1,26 @@ +# abs + + Absolute-value function. The absolute value of a number is + the number without its sign. + +```javascript +abs(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Absolute Value of -4.3 + +```javascript +abs(-4.3) +``` + +### Expected Result: 4.3 diff --git a/docs/functions/acos.md b/docs/functions/acos.md new file mode 100644 index 000000000..d5efffb9f --- /dev/null +++ b/docs/functions/acos.md @@ -0,0 +1,25 @@ +# acos + + Returns the angle whose cosine is the value passed as the argument. + +```javascript +acos(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | The value to be converted into an angle. Must be between -1 and 1. | + +## Angle Cosine of 0.3 + +```javascript +acos(0.3) +``` + +### Expected Result: 1.266103672779 diff --git a/docs/functions/addsoaprequestheader.md b/docs/functions/addsoaprequestheader.md new file mode 100644 index 000000000..0170b3799 --- /dev/null +++ b/docs/functions/addsoaprequestheader.md @@ -0,0 +1,28 @@ +# addSOAPRequestHeader + +Adds a SOAP header to a web service request before making the request. + +```javascript +addSOAPRequestHeader(webservice, namespace, name, value, mustUnderstand) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| webservice | string | Yes | | A webservice object as returned from the cfobject tag
or the createobject function | +| namespace | string | Yes | | Namespace for the SOAP header | +| name | string | Yes | | Name of SOAP header | +| value | string | Yes | | the value for the SOAP header; this can be a CFML XML value. | +| mustUnderstand | boolean | No | false | The mustUnderstand attribute indicates whether processing of the header is optional or mandatory.
This basically translates to the node trying to find an appropriate handler that matches the header
and proceed with processing the message in a manner consistent with its specification. If it can't find an appropriate handler
it must return an error and stop further processing. If mustUnderstand is set to `true`
the node is not allowed to ignore it. | + +## Set the username header as a string + +```javascript +/ws = createObject("webservice", "http://localhost/soapheaders/headerservice.cfc?WSDL"); +addSOAPRequestHeader(ws, "http://mynamespace/", "username", "tom", false); +``` diff --git a/docs/functions/addsoapresponseheader.md b/docs/functions/addsoapresponseheader.md new file mode 100644 index 000000000..3b0f11250 --- /dev/null +++ b/docs/functions/addsoapresponseheader.md @@ -0,0 +1,30 @@ +# addSOAPResponseHeader + +Adds a SOAP response header to a web service response. Call only from within a CFC web service function that is processing a request as a SOAP web service. + +```javascript +addSOAPResponseHeader(namespace, name, value [, mustUnderstand]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| namespace | string | Yes | | A webservice object as returned from the cfobject tag or the createobject function | +| name | string | Yes | | Name of the SOAP header | +| value | string | Yes | | Value of the SOAP header | +| mustUnderstand | boolean | No | | The mustUnderstand attribute indicates whether processing of the header is optional or mandatory.
This basically translates to the node trying to find an appropriate handler that matches the header
and proceed with processing the message in a manner consistent with its specification. If it can't find an appropriate handler
it must return an error and stop further processing. If mustUnderstand is set to `true`
the node is not allowed to ignore it. | + +## Set the username header as a string and get the first header as an object (string) and as XML + +```javascript +ws = createObject("webservice", "http://localhost/soapheaders/headerservice.cfc?WSDL"); +addSOAPRequestHeader(ws, "http://mynamespace/", "username", "tom", false); +ret = ws.echo_me("argument"); +header = getSOAPResponseHeader(ws, "http://www.tomj.org/myns", "returnheader"); +XMLheader = getSOAPResponseHeader(ws, "http://www.tomj.org/myns", "returnheader", true); +``` diff --git a/docs/functions/ajaxlink.md b/docs/functions/ajaxlink.md new file mode 100644 index 000000000..2de54f123 --- /dev/null +++ b/docs/functions/ajaxlink.md @@ -0,0 +1,17 @@ +# ajaxLink + +Causes an HTML href attribute to display link results in the current Ajax container. + +```javascript +ajaxLink(url) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| url | string | Yes | | The URL of the link. | diff --git a/docs/functions/ajaxonload.md b/docs/functions/ajaxonload.md new file mode 100644 index 000000000..f6f02022e --- /dev/null +++ b/docs/functions/ajaxonload.md @@ -0,0 +1,17 @@ +# ajaxOnLoad + +Causes the specified JavaScript function to run when the page loads. + +```javascript +ajaxOnLoad(functionName) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| functionName | string | Yes | | The name of the function to run when the page loads. | diff --git a/docs/functions/applicationstarttime.md b/docs/functions/applicationstarttime.md new file mode 100644 index 000000000..6d4f976f6 --- /dev/null +++ b/docs/functions/applicationstarttime.md @@ -0,0 +1,11 @@ +# applicationStartTime + +Provides information about the time when the current application scope was created. + +```javascript +applicationStartTime() +``` + +```javascript +returns date +``` diff --git a/docs/functions/applicationstop.md b/docs/functions/applicationstop.md new file mode 100644 index 000000000..9ce51ffc1 --- /dev/null +++ b/docs/functions/applicationstop.md @@ -0,0 +1,23 @@ +# applicationStop + +Stops current application + +```javascript +applicationStop() +``` + +```javascript +returns void +``` + +## Basic applicationStop usage. + +Halt the application. + +```javascript +var applicationRequiresHalt = true; +if(applicationRequiresHalt) applicationStop(); +writeOutput("Still Running"); +``` + +### Expected Result: // We don't expect anything to happen after the application has been stopped. diff --git a/docs/functions/argon2checkhash.md b/docs/functions/argon2checkhash.md new file mode 100644 index 000000000..b54e2dcc4 --- /dev/null +++ b/docs/functions/argon2checkhash.md @@ -0,0 +1,30 @@ +# argon2CheckHash + +Verify the Argon2 hash of an input. + +```javascript +argon2CheckHash(string, hash [, variant]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| input | string | Yes | | The string input to test against the hash. | | +| hash | string | Yes | | An Argon2 hash value | | +| variant | string | No | Argon2i | | /Users/garethedwards/development/github/cfdocs/docs/functions/argon2checkhash.md|Argon2id | + +## Show a passing and failing Argon2 hash check + +```javascript +hashedValue = GenerateArgon2Hash("CFDocs.org"); +dump(hashedValue); +check1 = Argon2CheckHash( "CFDocs.org", hashedValue); +dump( check1 ); +check2 = Argon2CheckHash( "DifferentInput", hashedValue); +dump( check2 ); +``` diff --git a/docs/functions/array.md b/docs/functions/array.md new file mode 100644 index 000000000..d78825aa2 --- /dev/null +++ b/docs/functions/array.md @@ -0,0 +1,35 @@ +# array + +Creates a new array populated with any arguments that have been passed to the function. + +```javascript +array() +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| values | any | No | | One or more values that can be used in the initialization of the array. | + +## Example + +Creates and dump a new array. + +```javascript +exampleArray = Array("example-string", 1, {structExample = "value"}, [1,2,3]); +dump(exampleArray); +``` + +## Inline Array Notation Example + +Creates and dump a new array. + +```javascript +exampleArray = ["example-string", 1, {structExample = "value"}, [1,2,3]]; +dump(exampleArray); +``` diff --git a/docs/functions/arrayappend.md b/docs/functions/arrayappend.md new file mode 100644 index 000000000..8fe3c936a --- /dev/null +++ b/docs/functions/arrayappend.md @@ -0,0 +1,61 @@ +# arrayAppend + +Appends an element to the end of an array. + +```javascript +arrayAppend(array, value [, merge]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.append(value [, merge]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array to which the element should be appended. | +| value | any | Yes | | The element to append. Can be any type. | +| merge | boolean | No | NO | CF10+ When true appends array elements individually to the specified array. When false (default), the new array is appended as a single element. | + +## Append a value to an array + +Uses the arrayAppend function to append a value to the end of the array + +```javascript +someArray = [1,2,3]; +arrayAppend(someArray, 4); +writeOutput(serializeJSON(someArray)); +``` + +### Expected Result: [1,2,3,4] + +## Append a value to an array using the Array member function + +CF11+ Lucee4.5+ Invoking the append function on an array is the same as running arrayAppend. + +```javascript +someArray = [1,2,3]; +someArray.append(4); +writeOutput(serializeJSON(someArray)); +``` + +### Expected Result: [1,2,3,4] + +## Append more than one item + +CF10+ You can merge two arrays when third parameter is set to true. + +```javascript +someArray = [1,2,3]; +ArrayAppend(someArray,[4,5,6],true); +writeDump(serializeJSON(someArray)); +``` + +### Expected Result: [1,2,3,4,5,6] diff --git a/docs/functions/arrayavg.md b/docs/functions/arrayavg.md new file mode 100644 index 000000000..5c74543f1 --- /dev/null +++ b/docs/functions/arrayavg.md @@ -0,0 +1,47 @@ +# arrayAvg + + Calculates the average of the values in an array. + All elements in the array must contain values that can be + automatically converted to numeric. + +```javascript +arrayAvg(array) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someArray.avg() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | An array which to determine average | + +## Average value of an array + +Uses the arrayAvg function to get average value of an array + +```javascript +numberArray = [1,2,3]; +writeOutput(arrayAvg(numberArray)); +``` + +### Expected Result: 2 + +## Average value of an array using the Array member function + +CF11+ Lucee4.5+ Uses the avg member function is the same as running arrayAvg. + +```javascript +numberArray = [1,2,3]; +writeOutput(numberArray.avg()); +``` + +### Expected Result: 2 diff --git a/docs/functions/arrayclear.md b/docs/functions/arrayclear.md new file mode 100644 index 000000000..aa19ece64 --- /dev/null +++ b/docs/functions/arrayclear.md @@ -0,0 +1,56 @@ +# arrayClear + + Removes all elements from an array. + +```javascript +arrayClear(array) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.clear() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | An array name or variable name | + +## Clear the value of an array + +Uses the arrayClear function to clear the value of an array + +```javascript +someArray = ["Red", "White", "Green", "Blue", "Pink"]; +writeOutput(arrayClear(someArray)); +``` + +### Expected Result: Yes + +## Clear the value of an array + +Lucee4.5+ To clear the value of an array + +```javascript +someArray = ["Red", "White", "Green", "Blue", "Pink"]; +writeOutput(arrayClear(someArray)); +``` + +### Expected Result: true + +## Clear value of an array using member function + +CF11+ Uses the member function is the same as running arrayClear. + +```javascript +numberArray = [1,2,3]; +writeOutput(numberArray.Clear()); +``` + +### Expected Result: Yes diff --git a/docs/functions/arraycontains.md b/docs/functions/arraycontains.md new file mode 100644 index 000000000..556d85f79 --- /dev/null +++ b/docs/functions/arraycontains.md @@ -0,0 +1,81 @@ +# arrayContains + +Used to determine if a value is in the given array, case-sensitive. Adobe CF and OpenBD return boolean. Lucee / Railo returns the numeric index if the value is found, 0 if not. + +```javascript +arrayContains(array, value) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.contains(value) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array in which to search. | +| value | any | Yes | | The value to search for in the array. | +| substringMatch | any | No | false | Lucee4.5+ If set to true then a substring match will also return an array position. This will only work with simple values. Passing true with complex objects will throw an exception. | + +## Array Contains + +CF9+ + +```javascript +someArray = [1,2,3]; +writeDump(arrayContains(someArray,2)); +``` + +### Expected Result: true + +## Array Contains (member function) + +CF10+ + +```javascript +someArray = [1,2,3]; +writeDump(someArray.contains(2)); +``` + +### Expected Result: true + +## Array Contains + +Lucee4.5+ + +```javascript +someArray = [1,2,3]; +writeDump(arrayContains(someArray,2)); +``` + +### Expected Result: 2 + +## Array Contains (member function) + +Lucee4.5+ + +```javascript +someArray = [1,2,3]; +writeDump(someArray.contains(2)); +``` + +### Expected Result: 2 + +## Substring Search + +Lucee4.5+ + +```javascript +words = [ 'hello' , 'world' ]; +positionOfSubstring = arrayContains( words, 'el', true ); +writeDump(positionOfSubstring); +``` + +### Expected Result: 1 diff --git a/docs/functions/arraycontainsnocase.md b/docs/functions/arraycontainsnocase.md new file mode 100644 index 000000000..edf9d80a7 --- /dev/null +++ b/docs/functions/arraycontainsnocase.md @@ -0,0 +1,41 @@ +# arrayContainsNoCase + +Used to determine if a value is in the given array, case insensitive. + +```javascript +arrayContainsNoCase(array, value) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.containsNoCase(value) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | +| value | any | Yes | | | + +## Basic example + +CF2016+ + +```javascript +writeOutput(arrayContainsNoCase(["first", "SECOND"], "First")); +``` + +## Member function syntax + +Lucee4+ CF2021+ + +```javascript +arrayWithStrings = ["first", "SECOND"]; +writeOutput(arrayWithStrings.containsNoCase("FIrst")); +``` diff --git a/docs/functions/arraydelete.md b/docs/functions/arraydelete.md new file mode 100644 index 000000000..1dbcb17a6 --- /dev/null +++ b/docs/functions/arraydelete.md @@ -0,0 +1,67 @@ +# arrayDelete + +Deletes the first element in an array that matches the value of `value`. +The search is case-sensitive. +Returns `true` if the element was found and removed. +The array will be resized, so that the deleted element doesn't leave a gap. + +```javascript +arrayDelete(array, value) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.delete(value) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| array | array | Yes | | | | +| value | any | Yes | | A value for which to search. Case-sensitive. | | +| scope | string | No | one | Lucee4.5+ remove one (default) or all occurrences of the value | /Users/garethedwards/development/github/cfdocs/docs/functions/arraydelete.md|all | + +## Delete an element from an array + +Uses the arrayDelete function to delete an element from an array + +```javascript +arr = ['apple', 'orange', 'pear', 'apple']; +arrayDelete(arr, 'apple'); + +writeDump(arr); +``` + +### Expected Result: ['orange','pear','apple'] + +## Delete an element from an array using the Array member function + +CF11+ Lucee4.5+ Invoking the delete function on an array is the same as running arrayDelete. + +```javascript +arr = ['apple', 'orange', 'pear', 'apple']; +arr.delete('apple'); + +writeDump(arr); +``` + +### Expected Result: ['orange','pear','apple'] + +## Use of scope parameter + +Lucee4.5+ Use scope to remove one or all occurrences of the value + +```javascript +arr = ['apple', 'orange', 'pear', 'apple']; +arr.delete('apple', 'all'); + +writeDump(arr); +``` + +### Expected Result: ['orange','pear'] diff --git a/docs/functions/arraydeleteat.md b/docs/functions/arraydeleteat.md new file mode 100644 index 000000000..fab892670 --- /dev/null +++ b/docs/functions/arraydeleteat.md @@ -0,0 +1,49 @@ +# arrayDeleteAt + +Deletes the element at `index` from an array +The array will be resized, so that the deleted element doesn't leave a gap. + +```javascript +arrayDeleteAt(array, index) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.deleteAt(index) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array that the element will be deleted from. | +| index | numeric | Yes | | The numeric index of the element. Remember that ColdFusion arrays start at 1 not 0. | + +## Simple example for arrayDeleteAt function + +Uses the arrayDeleteAt function to delete the value in specific position + +```javascript +someArray = ["Red", "White", "Green", "Blue", "Pink"]; +arrayDeleteAt(someArray, 3); +writeOutput(serializeJSON(someArray)); +``` + +### Expected Result: ["Red", "White", "Blue", "Pink"] + +## Simple example with member function + +CF11+ Lucee4.5+ Uses the member function is the same as running arrayDeleteAt. + +```javascript +someArray = ["Red", "White", "Green", "Blue", "Pink"]; +someArray.DeleteAt(2); +writeOutput(serializeJSON(someArray)); +``` + +### Expected Result: ["Red", "Green", "Blue", "Pink"] diff --git a/docs/functions/arraydeletenocase.md b/docs/functions/arraydeletenocase.md new file mode 100644 index 000000000..e9bb1a0a3 --- /dev/null +++ b/docs/functions/arraydeletenocase.md @@ -0,0 +1,38 @@ +# arrayDeleteNoCase + +Deletes the first element in an array that matches the value of `value`. The search is case insensitive. Returns `true` if the element was found and removed. The array will be resized, so that the deleted element doesn't leave a gap. + +```javascript +arrayDeleteNoCase(array, value) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.deleteNoCase(value) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| array | array | Yes | | | | +| value | any | Yes | | A value for which to search. Case insensitive. | | +| scope | string | No | one | Lucee5.1+ Remove one (default) or all occurrences of the value. | /Users/garethedwards/development/github/cfdocs/docs/functions/arraydeletenocase.md|all | + +## Delete an element from an array + +Deletes the first `apple` element from the array `arr`. + +```javascript +arr = ['apple', 'orange', 'pear', 'Apple']; +arrayDeleteNoCase(arr, 'Apple'); + +writeDump(arr); +``` + +### Expected Result: ['orange','pear','Apple'] diff --git a/docs/functions/arrayeach.md b/docs/functions/arrayeach.md new file mode 100644 index 000000000..d4b7c2438 --- /dev/null +++ b/docs/functions/arrayeach.md @@ -0,0 +1,55 @@ +# arrayEach + +Used to iterate over an array and run the function closure for each item in the array. + +```javascript +arrayEach(array, function(item, [index, [array]]){} [, parallel] [, maxThreads]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someArray.each(function(item, [index, [array]]){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | +| callback | function | Yes | | Closure or a function reference that will be called for each of the iteration. | +| parallel | boolean | No | false | Lucee4.5+ CF2021+ Specifies whether the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ CF2021+ The maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| value | any | No | The value for the current iteration +| index | numeric | No | The current index for the iteration +| array | array | No | A reference of the original array + +## Simple Example + +```javascript +letters = ["a","b","c","d"]; +arrayEach(letters, function(element,index) { + writeOutput("#index#:#element#;"); +}); +``` + +### Expected Result: 1:a;2:b;3:c;4:d; + +## Member Function Example + +```javascript +a = ["a","b","c"]; +a.each(function(element,index,array){ + writeOutput("#index#:#element#;"); +}); +``` + +### Expected Result: 1:a;2:b;3:c; diff --git a/docs/functions/arrayevery.md b/docs/functions/arrayevery.md new file mode 100644 index 000000000..f489e3097 --- /dev/null +++ b/docs/functions/arrayevery.md @@ -0,0 +1,48 @@ +# arrayEvery + +returns true if every closure returns true, otherwise false + +```javascript +arrayEvery(array array, function(item, [index, [array]]) closure, [boolean parallel], [number maxThreads]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.every(function(item, [index, [array]]) closure, [boolean parallel], [number maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | +| closure | function | Yes | | A function / closure with the signature: `boolean function (any item, [numeric index], [array array])` | +| parallel | boolean | No | false | Lucee4.5+ When `true` the items can be executed in parallel | +| maxThreads | boolean | No | 20 | Lucee4.5+ The number of threads to use when `parallel=true` | + +## Example for positive result + +Checks whether all items in an array are greater than 2 and outputs true because all of them fulfill the requirement. + +```javascript +array = [4, 5, 6, 7]; +writeOutput(arrayEvery(array, function(value) { return value gt 2; })); +``` + +### Expected Result: YES + +## Example for negative result + +Checks whether all items in an array are greater than 2 and outputs false because some of them do not fulfill the requirement. + +```javascript +array = [1, 2, 3, 4]; +writeOutput(arrayEvery(array, function(value) { return value gt 2; })); +``` + +### Expected Result: NO diff --git a/docs/functions/arrayfilter.md b/docs/functions/arrayfilter.md new file mode 100644 index 000000000..bbd80ad18 --- /dev/null +++ b/docs/functions/arrayfilter.md @@ -0,0 +1,63 @@ +# arrayFilter + +Used to filter an array to items for which the closure function returns true. + +```javascript +arrayFilter(array, function(item [,index, array]){} [, parallel] [, maxThreads]) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +someArray.filter(function(item [,index, array]){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | +| callback | boolean | Yes | | Closure or a function reference that will be called for each of the iteration. Returns true if the array element should be included in the filtered array. Support for passing the original array to the closure function added in CF11 Update 5. | +| parallel | boolean | No | false | Lucee4.5+ true if the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ the maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| value | any | No | The value for the current iteration +| index | numeric | No | The current index for the iteration +| array | array | No | A reference of the original array + +## Simple numeric comparison + +Take an array of struct items and use arrayFilter to return ones of a rating 3 and higher. + +```javascript +fruitArray = [{'fruit'='apple', 'rating'=4}, {'fruit'='banana', 'rating'=1}, {'fruit'='orange', 'rating'=5}, {'fruit'='mango', 'rating'=2}, {'fruit'='kiwi', 'rating'=3}]; + +favoriteFruits = arrayFilter(fruitArray, function(item){ + return item.rating >= 3; +}); +writedump(serializeJSON(favoriteFruits)); +``` + +### Expected Result: [{"fruit":"apple","rating":4},{"fruit":"orange","rating":5},{"fruit":"kiwi","rating":3}] + +## Using a member function + +This is the same example as above, but using a member function on the array instead of a standalone function. + +```javascript +fruitArray = [{'fruit'='apple', 'rating'=4}, {'fruit'='banana', 'rating'=1}, {'fruit'='orange', 'rating'=5}, {'fruit'='mango', 'rating'=2}, {'fruit'='kiwi', 'rating'=3}]; + +favoriteFruits = fruitArray.filter(function(item){ + return item.rating >= 3; +}); +writedump(serializeJSON(favoriteFruits)); +``` + +### Expected Result: [{"fruit":"apple","rating":4},{"fruit":"orange","rating":5},{"fruit":"kiwi","rating":3}] diff --git a/docs/functions/arrayfind.md b/docs/functions/arrayfind.md new file mode 100644 index 000000000..11c1d7b45 --- /dev/null +++ b/docs/functions/arrayfind.md @@ -0,0 +1,69 @@ +# arrayFind + +These functions searches the array for the specified value. Returns the index in the array of the first match, or 0 if there is no match. + +```javascript +arrayFind(array, value) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someArray.find(value) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array you are searching. | +| value | any | Yes | | The value you are looking for in the array. CF10+ or Lucee4.5+ support passing a closure function in this argument as well. | + +## Find an "apple" in an array of fruit + +Returns the index of the element "apple" in the array + +```javascript +writeOutput( arrayFind( ["orange","pineapple","apple"], "apple" )); +``` + +### Expected Result: 3 + +## Member Functions: Find an "apple" in an array of fruit + +Calls the find member function of the array object. Requires CF11+ or Lucee4.5+ + +```javascript +fruit = [ "orange", "pineapple", "apple" ]; +writeOutput( fruit.find( "apple" ) ); +``` + +### Expected Result: 3 + +## arrayFind is case-sensitive + +Case-sensitive so "Apple" is not in the array, returns 0. Use arrayFindNoCase for case insensitive matching. + +```javascript +writeOutput( arrayFind(["orange","pineapple","apple"], "Apple") ); +``` + +### Expected Result: 0 + +## Using arrayFind with a closure / callback function + +CF10+ Lucee4.5+ The arrayFind function passes each array value into the supplied function. The function returns a boolean, `true` if you found what you are looking for. The result of the arrayFind function is the index of the first matching array element found, or `0` if not found. Use arrayFindAll to return an array of all found item indexes. + +```javascript +a = [5,4,3,2,1]; +pos = arrayFind(a, function(item) { + return item == 2; +}); +writeOutput(pos); +``` + +### Expected Result: 4 diff --git a/docs/functions/arrayfindall.md b/docs/functions/arrayfindall.md new file mode 100644 index 000000000..0a6baabfb --- /dev/null +++ b/docs/functions/arrayfindall.md @@ -0,0 +1,59 @@ +# arrayFindAll + +Searches an array for all positions of a specified value. The function searches for simple values such as strings and numbers or for complex objects such as structures. When the second parameter is a simple value, string searches are case-sensitive + +```javascript +arrayFindAll(array, value or callback) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +someArray.findAll(value or callback) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The source array to search through | +| value or callback | any | No | | If string, case-sensitive value to search for; if callback, use signature function (item, index, array) : boolean | + +## List all courses with participants + +```javascript +courses = [{ + name: "Getting started with ColdFusion", + participants: [] +},{ + name: "Caching in ColdFusion", + participants: [{ + name: "John Doe", + age: 45 + },{ + name: "Jane Doe", + age: 46 + }] +},{ + name: "Changeover to Lucee", + participants: [] +},{ + name: "Update ColdFusion", + participants: [{ + name: "Arthur Dent", + age: 42 + }] +}]; + +chosenCourses = arrayFindAll(courses,function(course) { + return arrayLen(course.participants); +}); + +writeOutput(ArrayToList(chosenCourses)); +``` + +### Expected Result: 2,4 diff --git a/docs/functions/arrayfindallnocase.md b/docs/functions/arrayfindallnocase.md new file mode 100644 index 000000000..0ced1db30 --- /dev/null +++ b/docs/functions/arrayfindallnocase.md @@ -0,0 +1,36 @@ +# arrayFindAllNoCase + +Searches an array for all positions of a specified value. The function searches for simple values such as strings and numbers or for complex objects such as structures. When the second parameter is a simple value, string searches are case-sensitive + +```javascript +arrayFindAllNoCase(array, value or callback) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +someArray.findAllNoCase(value or callback) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The source array to search through | +| value or callback | variableName | Yes | | If string, case insensitive value to search for; if callback, use signature function (item, index, array) : boolean | + +## Script Syntax + +Find the positions of a given string within a provided array regardless of case. + +```javascript +var fruitArray = ['apple','banana','apple','orange','kiwi']; +var applePositions = arrayFindAllNoCase(fruitArray, 'APPLE'); +writeDump(applePositions); +``` + +### Expected Result: [1,3]. diff --git a/docs/functions/arrayfindnocase.md b/docs/functions/arrayfindnocase.md new file mode 100644 index 000000000..45f81d083 --- /dev/null +++ b/docs/functions/arrayfindnocase.md @@ -0,0 +1,55 @@ +# arrayFindNoCase + +These functions performs a case-insensitive search in the array for the specified value. Returns the array index of the first match; 0 if not found. + +```javascript +arrayFindNoCase(array, value or callback) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someArray.findNoCase(value or callback) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array to search | +| value or callback | any | Yes | | The value you are looking for in the array. | + +## Find an "Apple" in an array of fruit + +Returns the index of the element "Apple" in the array + +```javascript +writeOutput( arrayFindNoCase(["orange","pineapple","apple"], "Apple" ) ); +``` + +### Expected Result: 3 + +## arrayFind is not Case Sensitive + +Not case sensitive so "Apple" will be found in the array, returns 1. Use arrayFind for case sensitive matching. + +```javascript +writeOutput( arrayFindNoCase(["orange","pineapple","apple"], "Apple") ); +``` + +### Expected Result: 1 + +## Member Functions: Find an "Apple" in an array of fruit + +Calls the findNoCase member function of the array object. Requires CF11+ or Lucee4.5+ + +```javascript +fruit = ["orange","pineapple","apple"]; +writeOutput( fruit.findNoCase("Apple") ); +``` + +### Expected Result: 3 diff --git a/docs/functions/arrayfirst.md b/docs/functions/arrayfirst.md new file mode 100644 index 000000000..bbde678c4 --- /dev/null +++ b/docs/functions/arrayfirst.md @@ -0,0 +1,45 @@ +# arrayFirst + +Returns the first item from an array. + +```javascript +arrayFirst(array) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +array.first() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | + +## Member Function + +Use the member function to return the first item from an array + +```javascript +someArray = [1,2,3,4]; +WriteOutput(someArray.first()); +``` + +### Expected Result: 1 + +## Non-Member Function + +Return the first item from an array + +```javascript +seinfeldArray = ["Jerry","Elaine","Kramer","George"]; +WriteOutput(arrayFirst(seinfeldArray)); +``` + +### Expected Result: "Jerry" diff --git a/docs/functions/arraygetmetadata.md b/docs/functions/arraygetmetadata.md new file mode 100644 index 000000000..883852924 --- /dev/null +++ b/docs/functions/arraygetmetadata.md @@ -0,0 +1,64 @@ +# arrayGetMetadata + +Gets metadata for items of an array and indicates the array type. + +```javascript +arrayGetMetadata(array) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +someArray.getMetadata() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array for which to get the metadata. | + +## Simple Example + +```javascript +// Create an array +arrayList = ["apple", "pineapple", "mango"]; + +// Fetch meta data +data = arrayGetMetadata(arrayList); + +// Print array type +writeOutput(data.type); +``` + +### Expected Result: synchronized + +## Member Function Example + +```javascript +// Create an array +arrayList = ["apple", "pineapple", "mango"]; + +// Fetch meta data +data = arrayList.getMetadata(); + +// Print array type +writeOutput(data.type); +``` + +### Expected Result: synchronized + +## Dump Metadata of Typed Array (Member syntax) + +CF2018+ Return struct has a new key called `dimensions` and can also have a defined datatype. Supported datatypes are String, Numeric, Boolean, Date, Array, Struct, Query, Component, [Component name], Binary, and Function. + +```javascript +arr = arrayNew['String'](1); +writeOutput(serializeJson(arr.getMetadata())); +``` + +### Expected Result: {"dimensions":1,"datatype":"String","type":"synchronized"} diff --git a/docs/functions/arrayindexexists.md b/docs/functions/arrayindexexists.md new file mode 100644 index 000000000..5adb17ff3 --- /dev/null +++ b/docs/functions/arrayindexexists.md @@ -0,0 +1,87 @@ +# arrayIndexExists + +Returns whether there exists an item in the array at the selected index. + +```javascript +arrayIndexExists(array, index) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +array.indexExists(index) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | +| index | numeric | Yes | | | + +## Standard function call when checking for an existing element + +In this example, the index we are checking exists in the array so the check returns true. + +```javascript +myArray=[]; +myArray[1]='one'; +myArray[2]='two'; +myArray[3]='three'; +myArray[4]='four'; +myArray[5]='five'; +result = arrayIndexExists(myArray, 3); +writeOutput(result); +``` + +### Expected Result: true + +## Standard function call when checking for a nonexisting element + +In this example, there is no element at the index we're checking so the check returns false. + +```javascript +myArray=[]; +myArray[1]='one'; +myArray[2]='two'; +// no element at index 3 +myArray[4]='four'; +myArray[5]='five'; +result = arrayIndexExists(myArray, 3); +writeOutput(result); +``` + +### Expected Result: false + +## Standard function call when checking an empty array + +In this example, the array we are searching is empty so the check returns false. + +```javascript +myArray=[]; +result = arrayIndexExists(myArray, 3); +writeOutput(result); +``` + +### Expected Result: false + +## Member function syntax + +In this example, the index we are checking exists in the array so the check returns true. + +```javascript +myArray=[]; +myArray[1]='one'; +myArray[2]='two'; +myArray[3]='three'; +myArray[4]='four'; +myArray[5]='five'; +result = myArray.indexExists(3); +writeOutput(result); +``` + +### Expected Result: true diff --git a/docs/functions/arrayinsertat.md b/docs/functions/arrayinsertat.md new file mode 100644 index 000000000..b281367e0 --- /dev/null +++ b/docs/functions/arrayinsertat.md @@ -0,0 +1,37 @@ +# arrayInsertAt + +Inserts a value at the specified position in the array. If the element is inserted before the end of the array, ColdFusion shifts the positions of all elements with a higher index to make room. + +```javascript +arrayInsertAt(array, position, value) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.insertAt(position, value) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array which will have the new element inserted. | +| position | numeric | Yes | | The numerical index in the array where the new element will be inserted.
Must be less than or equal to the length of the array.
Remember ColdFusion arrays start at 1 not 0. | +| value | any | Yes | | The new element to insert. | + +## Insert an Item in an Array at Position 2 + +Inserts the number 4 at position 2 + +```javascript +someArray = [1,2,3]; +arrayInsertAt(someArray, 2, 4); +writeOutput(serializeJSON(someArray)); +``` + +### Expected Result: [1,4,2,3] diff --git a/docs/functions/arrayisdefined.md b/docs/functions/arrayisdefined.md new file mode 100644 index 000000000..271a0f31c --- /dev/null +++ b/docs/functions/arrayisdefined.md @@ -0,0 +1,76 @@ +# arrayIsDefined + +Determines whether an array element is defined in a given index. + +```javascript +arrayIsDefined(array, index) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.isDefined(index) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | string | Yes | | The array object | +| index | numeric | Yes | | The index to check. | + +## Simple example + +CF8+ To check an array element is define or not + +```javascript +someArray = [1,2,3,4,5]; +writeOutput(arrayIsDefined(someArray, 3)); +``` + +### Expected Result: Yes + +## Simple example + +Lucee4.5+ To check an array element is define or not + +```javascript +someArray = [1,2,3,4,5]; +writeOutput(arrayIsDefined(someArray, 6)); +``` + +### Expected Result: false + +## Simple example with two dimensional array + +CF8+ To check an array element is define or not + +```javascript +FirstArray = [1,2,3]; +secondArray = [11,12,13]; +combineArray = arrayNew(2); +arrayAppend(combineArray, firstArray); +arrayAppend(combineArray, secondArray); +writeOutput(arrayIsDefined(combineArray, 3)); +``` + +### Expected Result: No + +## Simple example with two dimensional array + +Lucee4.5+ To check an array element is define or not + +```javascript +FirstArray = [1,2,3]; +secondArray = [11,12,13]; +combineArray = arrayNew(2); +arrayAppend(combineArray, firstArray); +arrayAppend(combineArray, secondArray); +writeOutput(arrayIsDefined(combineArray, 2)); +``` + +### Expected Result: true diff --git a/docs/functions/arrayisempty.md b/docs/functions/arrayisempty.md new file mode 100644 index 000000000..e68f3bc68 --- /dev/null +++ b/docs/functions/arrayisempty.md @@ -0,0 +1,70 @@ +# arrayIsEmpty + +Determines whether an array is empty. Equivalent to arrayLen(). + Calling this function on an array with 10 undefined elements + will return false. + CF MX: this function can be used on XML objects. + +```javascript +arrayIsEmpty(array) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.isEmpty() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | An array name or variable name | + +## Simple example for arrayIsEmpty function + +To check an array is empty or not + +```javascript +someArray = [1,2,3,4,5]; +writeOutput(arrayIsEmpty(someArray)); +``` + +### Expected Result: No + +## Simple example for arrayIsEmpty function + +Lucee4.5+ To check an array is empty or not + +```javascript +someArray = [1,2,3,4,5]; +writeOutput(arrayIsEmpty(someArray)); +``` + +### Expected Result: false + +## Simple example with member function + +CF11+ Uses the member function is the same as running arrayIsEmpty. + +```javascript +numberArray = arrayNew(1); +writeOutput(numberArray.isEmpty()); +``` + +### Expected Result: Yes + +## Simple example with member function + +Lucee4.5+ Uses the member function is the same as running arrayIsEmpty. + +```javascript +numberArray = arrayNew(1); +writeOutput(numberArray.isEmpty()); +``` + +### Expected Result: true diff --git a/docs/functions/arraylast.md b/docs/functions/arraylast.md new file mode 100644 index 000000000..2d7b63b9a --- /dev/null +++ b/docs/functions/arraylast.md @@ -0,0 +1,35 @@ +# arrayLast + +Returns the last item from an array. Throws an error if the array is empty. + +```javascript +arrayLast(array) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +array.last() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | + +## Show the last element of an array + +Uses the arrayLast function to retrieve the last element of an array + +```javascript +someArray = ["first", "second", "third"]; +lastOne=arrayLast(someArray); +writeOutput(lastOne); +``` + +### Expected Result: "third" diff --git a/docs/functions/arraylen.md b/docs/functions/arraylen.md new file mode 100644 index 000000000..8a045aea5 --- /dev/null +++ b/docs/functions/arraylen.md @@ -0,0 +1,46 @@ +# arrayLen + +Determines the number of elements in an array. + CF MX: this function can be used on child XML objects. + +```javascript +arrayLen(array) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someArray.len() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | An array which to determine length | + +## Simple example for arrayLen function + +Uses the arrayLen function to get the total length of an array + +```javascript +numberArray = [1,2,3,4]; +writeOutput(arrayLen(numberArray)); +``` + +### Expected Result: 4 + +## Total length of an array using the member function + +CF11+ Lucee4.5+ Uses the len member function is the same as running arrayLen. + +```javascript +colorArray = ['Green','red','blue']; +writeOutput(colorArray.len()); +``` + +### Expected Result: 3 diff --git a/docs/functions/arraymap.md b/docs/functions/arraymap.md new file mode 100644 index 000000000..eadd282d6 --- /dev/null +++ b/docs/functions/arraymap.md @@ -0,0 +1,45 @@ +# arrayMap + +Iterates over every entry of the array and calls the closure function to work on the element of the array. The returned value will be set at the same index in a new array and the new array will be returned + +```javascript +arrayMap(array, function(item [,index, array]){} [, parallel] [, maxThreads]) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +someArray.map(function(item [,index, array]){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The input array | +| callback | any | Yes | | Closure or a function reference that will be called for each of the iteration. | +| parallel | boolean | No | false | Lucee4.5+ true if the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ the maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| value | any | No | The value for the current iteration +| index | numeric | No | The current index for the iteration +| array | array | No | A reference of the original array + +## Script Syntax + +```javascript +complexData = [ {a: 4}, {a: 18}, {a: 51} ]; +newArray = arrayMap( complexData, function(item){ + return item.a; +}); +writeDump(newArray); +``` + +### Expected Result: [4, 18, 51] diff --git a/docs/functions/arraymax.md b/docs/functions/arraymax.md new file mode 100644 index 000000000..2c5b11848 --- /dev/null +++ b/docs/functions/arraymax.md @@ -0,0 +1,59 @@ +# arrayMax + + Returns the largest numeric value in an array. If the array + parameter value is an empty array, returns zero. + All elements must contain values that can be automatically + converted to numeric values. + +```javascript +arrayMax(array) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someArray.max() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | An array or variable name | + +## Simple example with empty array + +To get the largest numeric value of an array + +```javascript +someArray = arrayNew(1); +writeOutput(arrayMax(someArray)); +``` + +### Expected Result: 0 + +## Get largest numeric value of an array + +Uses the arrayMax function to get the largest numeric value of an array + +```javascript +someArray = [23,45,87,1,4]; +writeOutput(arrayMax(someArray)); +``` + +### Expected Result: 87 + +## Get largest numeric value of an array using member function + +CF11+ Lucee4.5+ + +```javascript +someArray = [23,45,0,1,4]; +writeOutput(someArray.max()); +``` + +### Expected Result: 45 diff --git a/docs/functions/arraymedian.md b/docs/functions/arraymedian.md new file mode 100644 index 000000000..79fce895b --- /dev/null +++ b/docs/functions/arraymedian.md @@ -0,0 +1,35 @@ +# arrayMedian + +Calculates the Median value of items in an array. All elements in the array must contain values that can be converted to numeric. + +```javascript +arrayMedian(array) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +array.median() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | + +## Calculates the Median value + +Uses the arrayMedian function to calculate the Median value + +```javascript +someArray = [1,2,2]; +m=arrayMedian(someArray); +writeOutput(m); +``` + +### Expected Result: 2 diff --git a/docs/functions/arraymerge.md b/docs/functions/arraymerge.md new file mode 100644 index 000000000..3f54f8a74 --- /dev/null +++ b/docs/functions/arraymerge.md @@ -0,0 +1,66 @@ +# arrayMerge + +This function creates a new array with data from the two passed arrays. To add all the data from one array into another without creating a new array see the built in function ArrayAppend(arr1, arr2, true). + +```javascript +arrayMerge(array1, array2 [, leaveIndex]) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +array1.merge(array2 [, leaveIndex]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array1 | array | Yes | | | +| array2 | array | Yes | | | +| leaveIndex | boolean | No | | | + +## Standard function syntax + +Lucee4.5+ Merge two arrays resulting in a single re-indexed array. All elements of both arrays are preserved. + +```javascript +fruit = ['apple','banana','orange']; +veggies = ['tomato','carrot','corn','peas','peppers']; +healthyFoods = arrayMerge(fruit, veggies); +writeOutput(arrayToList(healthyFoods)); +``` + +### Expected Result: apple,banana,orange,tomato,carrot,corn,peas,peppers + +## Member function syntax + +Lucee4.5+ Merge two arrays resulting in a single re-indexed array. All elements of both arrays are preserved. + +```javascript +fruit = ['apple','banana','orange']; +veggies = ['tomato','carrot','corn','peas','peppers']; +healthyFoods = fruit.merge(veggies); +writeOutput(arrayToList(healthyFoods)); +``` + +### Expected Result: apple,banana,orange,tomato,carrot,corn,peas,peppers + +## Example where leaveIndex parameter is true + +Lucee4.5+ Merge two arrays resulting in a single re-indexed array. Where the both arrays have elements in the same position, only values from the first array are included in the result. Valid using standard or member function syntax. + +Note how the first three elements of the veggies array are not merged because the fruit array already has values for elements 1-3. + +```javascript +fruit = ['apple','banana','orange']; +veggies = ['tomato','carrot','corn','peas','peppers']; +healthyFoods = arrayMerge(fruit, veggies, true); +writeOutput(arrayToList(healthyFoods)); +``` + +### Expected Result: apple,banana,orange,peas,peppers diff --git a/docs/functions/arraymid.md b/docs/functions/arraymid.md new file mode 100644 index 000000000..a543ba0d4 --- /dev/null +++ b/docs/functions/arraymid.md @@ -0,0 +1,49 @@ +# arrayMid + +Extracts a sub array from an existing array. + +```javascript +arrayMid(array, start [, count]) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +array.mid(start [, count]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | Array to extract data from | +| start | numeric | Yes | | The position of the first element to retrieve | +| count | numeric | No | | The number of elements to extract. If not set, all elements up to the end of the array will be returned. | + +## Using only the start parameter + +Lucee4.5+ Extract elements from an array starting with element 5 and ending with the last element of the array. + +```javascript +vehicles = ['Mustang','Nova','Celica','Camry','Tacoma','Tundra','Ram','F-250']; +trucks = arrayMid(vehicles, 5); +writeOutput(arrayToList(trucks)); +``` + +### Expected Result: Tacoma,Tundra,Ram,F-250 + +## Using the count parameter to specify the number of elements to include + +Lucee4.5+ Extract 4 elements from an array starting with element 3. + +```javascript +vehicles = ['Mustang','Nova','Celica','Camry','Tacoma','Tundra','Ram','F-250']; +toyotas = arrayMid(vehicles, 3, 4); +writeOutput(arrayToList(toyotas)); +``` + +### Expected Result: Celica,Camry,Tacoma,Tundra diff --git a/docs/functions/arraymin.md b/docs/functions/arraymin.md new file mode 100644 index 000000000..10f744411 --- /dev/null +++ b/docs/functions/arraymin.md @@ -0,0 +1,59 @@ +# arrayMin + + Returns the smallest numeric value in an array. If the array + parameter value is an empty array, returns zero. + All elements must contain values that can be automatically + converted to numeric values. + +```javascript +arrayMin(array) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someArray.min() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | An array or variable name | + +## Simple example with empty array + +To get the smallest numeric value of an array + +```javascript +someArray = arrayNew(1); +writeOutput(arrayMin(someArray)); +``` + +### Expected Result: 0 + +## Get smallest numeric value of an array + +Uses the arrayMin function to get the smallest numeric value of an array + +```javascript +someArray = [23,45,87,2,4]; +writeOutput(arrayMin(someArray)); +``` + +### Expected Result: 2 + +## Get smallest numeric value of an array using member function + +CF11+ Lucee4.5+ + +```javascript +someArray = [23,45,99,1,4]; +writeOutput(someArray.Min()); +``` + +### Expected Result: 1 diff --git a/docs/functions/arraynew.md b/docs/functions/arraynew.md new file mode 100644 index 000000000..cf13b1df5 --- /dev/null +++ b/docs/functions/arraynew.md @@ -0,0 +1,92 @@ +# arrayNew + +Creates an array of 1-3 dimensions. Index array elements with square brackets: [ ]. CFML arrays expand dynamically as data is added. + +```javascript +arrayNew(dimension [, isSynchronized]) +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| dimension | numeric | Yes | 1 | | +| isSynchronized | boolean | No | YES | CF2016+ Lucee5.1+ When true creates a synchronized array. Unsynchronized arrays are not thread safe so they should not be used within shared scopes (application, session, etc). According to the CF2016 Performance whitepaper: Unsynchronized arrays are about 93% faster due to lock avoidance. | + +## Create the One dimensional array + +Uses the arrayNew function to create the new array + +```javascript +newArray = arrayNew(1); +someArray = arraySet(newArray, 1, 4, "All is well"); +writeOutput( serializeJSON(newArray) ); +``` + +### Expected Result: ["All is well", "All is well", "All is well", "All is well"] + +## Create the Two dimensional array + +Uses the arrayNew function to create the new array + +```javascript +newArray = arrayNew(2); +newArray[1][1] = "First value"; +newArray[1][1] = "First value"; +newArray[1][2] = "First value"; +newArray[2][1] = "Second value"; +newArray[2][2] = "Second value"; +writeOutput( serializeJSON(newArray) ); +``` + +### Expected Result: [["First value", "First value"],["Second value", "Second value"]] + +## Create unsynchronized array + +CF2016+ Uses the arrayNew function to create the new unsynchronized array + +```javascript +newArray = arrayNew(1, false); +newArray.append("one"); +writeOutput( serializeJSON(newArray) ); +``` + +### Expected Result: ["one"] + +## Create an array using implicit notation + +CF8+ Instead of using arrayNew you can also create an array using square brackets. + +```javascript +newArray = ["one","two"]; +writeOutput( serializeJSON(newArray) ); +``` + +### Expected Result: ["one", "two"] + +## Create an array with data type + +CF2018+ When using data types on array creation, items are converted if possible, otherwise an error is thrown. + +```javascript +typedArray = arrayNew['boolean'](1); +typedArray[1] = true; +typedArray[2] = 'true'; +typedArray[3] = 1; +typedArray[4] = '1'; +typedArray[5] = 'yes'; + +typelessArray = arrayNew(1); +typelessArray[1] = true; +typelessArray[2] = 'true'; +typelessArray[3] = 1; +typelessArray[4] = '1'; +typelessArray[5] = 'yes'; +writeOutput(serializeJSON([typedArray,typelessArray])); +``` + +### Expected Result: [[true,true,true,true,null,true],[true,"true",1,"1",null,"yes"]] diff --git a/docs/functions/arraypop.md b/docs/functions/arraypop.md new file mode 100644 index 000000000..c61fd9bc5 --- /dev/null +++ b/docs/functions/arraypop.md @@ -0,0 +1,47 @@ +# arrayPop + +Removes the last element from an array and returns the removed element. This will cause an exception on an empty array. + +```javascript +arrayPop(array) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +array.pop() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array whose last element is removed. | + +## Remove the last value from an array + +This is the full function version of arrayPop to remove the last value of an array. + +```javascript +arr=[1,2,42]; +p=arrayPop(array=arr); +writeOutput(p); +``` + +### Expected Result: 42 + +## Member function version. + +Using the member function. This version also works in ACF2018. + +```javascript +arr=[1,2,42]; +p=arr.pop(); +writeOutput(p); +``` + +### Expected Result: 42 diff --git a/docs/functions/arrayprepend.md b/docs/functions/arrayprepend.md new file mode 100644 index 000000000..4d0cb13fa --- /dev/null +++ b/docs/functions/arrayprepend.md @@ -0,0 +1,50 @@ +# arrayPrepend + +Inserts an array element at the beginning of an array + and shifts the positions of the existing elements to + make room. + +```javascript +arrayPrepend(array, value) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.prepend(value) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | +| value | any | Yes | | | + +## Prepend a value to an array + +Uses the arrayPrepend function to prepend a value to the beginning of an array and shifts the positions of the existing elements. + +```javascript +someArray = [3,2,1]; +arrayPrepend(someArray, 4); +writeDump(someArray); +``` + +### Expected Result: [4,3,2,1] + +## Prepend a value to an array using the Array member function + +CF11+ Lucee4.5+ Invoking the prepend function on an array is the same as running arrayPrepend. + +```javascript +doctorArray = ['Eccleston','Tennant','Smith','Capaldi']; +doctorArray.prepend('Hurt'); +writeDump(doctorArray); +``` + +### Expected Result: ['Hurt','Eccleston','Tennant','Smith','Capaldi'] diff --git a/docs/functions/arraypush.md b/docs/functions/arraypush.md new file mode 100644 index 000000000..2a96ea311 --- /dev/null +++ b/docs/functions/arraypush.md @@ -0,0 +1,60 @@ +# arrayPush + +Adds an element or an object to the end of an array, then returns the size of the modified array. + +```javascript +arrayPush(array, value) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +array.push(value) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | Array to which a value or object is to be added. | +| value | any | Yes | | The value or object to be added to the array. | + +## Push a value onto an array + +This is the full function version of arrayPush to push a value onto the end of the array. + +```javascript +arr=[1,2,3]; +arrayPush(array=arr,value=42); +writeOutput('This array has ' & arrayLen(arr) & ' elements.'); +``` + +### Expected Result: This array has 4 elements. + +## Member function version. + +Using the member function. This version also works in ACF2018. + +```javascript +arr=[1,2,3]; +al=arr.push(42); +writeOutput('This array has ' & al & ' elements.'); +``` + +### Expected Result: This array has 4 elements. + +## Push an object onto an array. + +This demonstrates pushing an object onto an array. + +```javascript +arr=[ [1],['two'],[{a:3}]]; +al=arr.push([42]); +writeOutput('This array has ' & al & ' elements.'); +``` + +### Expected Result: This array has 4 elements. diff --git a/docs/functions/arrayrange.md b/docs/functions/arrayrange.md new file mode 100644 index 000000000..c73e123a9 --- /dev/null +++ b/docs/functions/arrayrange.md @@ -0,0 +1,42 @@ +# arrayRange + +Build an array out of a range of numbers or using our range syntax: {start}..{end} or using the from and to arguments + +```javascript +arrayRange(from, to) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript + +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| from | numeric | Yes | 1 | The initial index, defaults to 1 or you can use the {start}..{end} notation. | +| to | numeric | Yes | | The last index item, or defaults to the from value. | + +## Create an array of sequential numbers using the string syntax. + +```javascript +arr = arrayRange( "2..5" ); +writeOutput('This array has ' & arrayLen(arr) & ' elements.'); +``` + +### Expected Result: This array has 4 elements. + +## Create an array of sequential numbers using the string syntax. + +```javascript +arr = arrayRange( 5, 10 ); +writeOutput('This array has ' & arrayLen(arr) & ' elements.'); +``` + +### Expected Result: This array has 6 elements. diff --git a/docs/functions/arrayreduce.md b/docs/functions/arrayreduce.md new file mode 100644 index 000000000..6e71364b3 --- /dev/null +++ b/docs/functions/arrayreduce.md @@ -0,0 +1,46 @@ +# arrayReduce + +Iterates over every entry of the array and calls the closure to work on the elements of the array. This function will reduce the array to a single value and will return the value. + +```javascript +arrayReduce(array, function(result, item [,index, array]){} [, initialValue]) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +someArray.reduce(function(result, item [,index, array]){} [, initialValue]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | the input array | +| callback | any | Yes | | Closure or a function reference that will be called for each of the iteration. | +| initialValue | any | No | | Initial value which will be used for the reduce operation. | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| result | any | No | The result of the reduce operation after the previous iteration +| value | any | No | The value for the current iteration +| index | numeric | No | The current index for the iteration +| array | array | No | A reference of the original array + +## Simple arrayReduce Example + +Sum each `a` element in the array + +```javascript +complexData = [ {a: 4}, {a: 18}, {a: 51} ];sum = arrayReduce( complexData, function(prev, element){ + return prev + element.a; +}, 0 ); +writeOutput(sum); +``` + +### Expected Result: 73 diff --git a/docs/functions/arrayreduceright.md b/docs/functions/arrayreduceright.md new file mode 100644 index 000000000..31e1a4474 --- /dev/null +++ b/docs/functions/arrayreduceright.md @@ -0,0 +1,46 @@ +# arrayReduceRight + +This function iterates over every element of the array and calls the closure to work on that element. It will reduce the array to a single value, from the right to the left, and return it. +NOTE:This function is not available in Lucee 5.x or lower. Potentially use `reverse()` instead. + +```javascript +arrayReduceRight(array, function(result, item [,index, [array]]){} [, initialValue]) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +someArray.reduceRight(function(result, item [,index, [array]]){} [, initialValue]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The input array. | +| callback | any | Yes | | Closure or a function reference that will be called for each iteration. | +| initialValue | any | No | | Initial value which will be used for the reduce operation. | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| result | any | No | The result of the reduce operation after the previous iteration. +| item | any | No | The value for the current iteration's item. +| index | numeric | No | The current index for the iteration +| array | array | No | A reference of the original array + +## Simple arrayReduceRight Example + +Demonstrate how the function works from right to left. + +```javascript +myArray=["a","b","c","d"]; +newArray=arrayReduceRight(myArray,function(prev,next,idx,arr){ return prev & next & idx },""); +writedump(newArray); +``` + +### Expected Result: d4c3b2a1 diff --git a/docs/functions/arrayresize.md b/docs/functions/arrayresize.md new file mode 100644 index 000000000..535ac6e03 --- /dev/null +++ b/docs/functions/arrayresize.md @@ -0,0 +1,36 @@ +# arrayResize + +Resets an array to a specified minimum number of elements. + This can improve performance, if used to size an array to its + expected maximum. For more than 500 elements, use arrayResize + immediately after using the ArrayNew tag. + +```javascript +arrayResize(array, size) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.resize(size) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | +| size | numeric | Yes | | | + +## Tag Syntax + +```javascript + + + + +``` diff --git a/docs/functions/arrayreverse.md b/docs/functions/arrayreverse.md new file mode 100644 index 000000000..bf4a89ff9 --- /dev/null +++ b/docs/functions/arrayreverse.md @@ -0,0 +1,55 @@ +# arrayReverse + +Returns an array with all of the elements reversed. The value in [0] within the input array will then exist in [n] in the output array, where n is the amount of elements in the array minus one. + +```javascript +arrayReverse(array) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +array.reverse() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array to reverse | + +## Reverse an Array + +Creates a new array with reversed positions + +```javascript +myArray = [1,2,3]; +myArrayReversed = arrayReverse(myArray); +writeOutput( serializeJSON( myArrayReversed ) ); +``` + +### Expected Result: [3,2,1] + +## Reverse an Array via Member Function + +```javascript +myArray = [1,2,3]; +writeOutput( serializeJSON( myArray.reverse() ) ); +``` + +### Expected Result: [3,2,1] + +## Reverse an Array using array slice syntax + +Reverse an Array using array slice syntax adding in ColdFusion 2018 + +```javascript +myArray = [1,2,3]; +writeOutput( serializeJSON( myArray[::-1] ) ); +``` + +### Expected Result: [3,2,1] diff --git a/docs/functions/arrayset.md b/docs/functions/arrayset.md new file mode 100644 index 000000000..f354efb0f --- /dev/null +++ b/docs/functions/arrayset.md @@ -0,0 +1,39 @@ +# arraySet + +In a one-dimensional array, sets the elements in a specified + index range to a value. Useful for initializing an array after + a call to arrayNew. + +```javascript +arraySet(array, start, end, value) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.set(start, end, value) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | +| start | numeric | Yes | | | +| end | numeric | Yes | | | +| value | any | Yes | | | + +## Tag Syntax + +```javascript + + + +#ArrayToList(myNewArray,', ')# +``` + +### Expected Result: Initial Value, Initial Value, Initial Value, Initial Value, Initial Value, Initial Value diff --git a/docs/functions/arraysetmetadata.md b/docs/functions/arraysetmetadata.md new file mode 100644 index 000000000..c0284e95c --- /dev/null +++ b/docs/functions/arraysetmetadata.md @@ -0,0 +1,37 @@ +# arraySetMetadata + +Sets metadata for items of an array. Useful when using serializeJSON with ambiguous data. + +```javascript +arraySetMetadata(array, metadata) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someArray.setMetadata(metadata) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array for which to set the metadata. | +| metadata | struct | Yes | | The metadata struct to set. | + +## Serialize an array to JSON + +Outputs serialized JSON for an array containing various data types + +```javascript +inputs = ["2016.02", 42.0, "Yes", "No", "32830", {"t1": "Yes"}, ["1","yes","3",false,"null","null"]]; +metadata = {items: ["numeric", "integer", "string", "boolean", "string", {t1: {type:"string",ignore:true}}, {items: ["integer","boolean","string","string","string","null"]}]}; +arraySetMetadata(inputs,metadata); +writeOutput(serializeJSON(inputs)); +``` + +### Expected Result: [2016.02,42.0,"Yes",false,"32830",{},[1,true,"3","false","null","null"]] diff --git a/docs/functions/arrayshift.md b/docs/functions/arrayshift.md new file mode 100644 index 000000000..52534013b --- /dev/null +++ b/docs/functions/arrayshift.md @@ -0,0 +1,47 @@ +# arrayShift + +Removes the first element from an array and returns the removed element. This method changes the length of the array. If used on an empty array, an exception will be thrown. + +```javascript +arrayShift(array) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +array.shift() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | An array of elements from which the first will be removed and returned. | + +## Example with simple values + +Take an array of numbers and shift the first one off. + +```javascript +arr = [ 1, 2, 3 ]; +el = arrayShift(arr); +writeOutput( el ); +``` + +### Expected Result: 1 + +## Using a member function + +This is the same example as above, but using a member function on the array instead of a standalone function. + +```javascript +arr = [ 1, 2, 3 ]; +el = arr.shift(); +writeOutput( el ); +``` + +### Expected Result: 1 diff --git a/docs/functions/arrayslice.md b/docs/functions/arrayslice.md new file mode 100644 index 000000000..d25d6e9cf --- /dev/null +++ b/docs/functions/arrayslice.md @@ -0,0 +1,67 @@ +# arraySlice + +Returns a new array, from the start position up to the count of elements. + +```javascript +arraySlice(array, offset, length) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +someArray.slice(offset, length) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | Name of the array that you want to slice | +| offset | numeric | Yes | | Specifies the position from which to slice the array. Negative value indicates that the array is sliced, with sequence starting from array's end. | +| length | numeric | No | | Maximum elements to slice | + +## Simple arraySlice Example + +```javascript +array = [1, 2, 3, 4, 5, 6, 7, 8]; +newArray = arraySlice(array, 2, 3); +writedump(newArray) +``` + +### Expected Result: [2,3,4] + +## arraySlice with no length specified + +```javascript +array = [1, 2, 3, 4, 5, 6, 7, 8]; +newArray = arraySlice(array, 4); +writedump(newArray) +``` + +### Expected Result: [4,5,6,7,8] + +## arraySlice using a negative offset + +```javascript +array = [1, 2, 3, 4, 5, 6, 7, 8]; +newArray = arraySlice(array, -5, 3); +writedump(newArray) +``` + +### Expected Result: [4,5,6] + +## Slice an array using member function + +CF11+ calling the slice member function on an array. + +```javascript +array = [1, 2, 3, 4, 5, 6, 7, 8]; +newArray = array.slice(2, 3); +writedump(newArray) +``` + +### Expected Result: [2,3,4] diff --git a/docs/functions/arraysome.md b/docs/functions/arraysome.md new file mode 100644 index 000000000..e3c3d5ac4 --- /dev/null +++ b/docs/functions/arraysome.md @@ -0,0 +1,67 @@ +# arraySome + +Calls a given closure/function with every element in a given array and returns true if one of the closure calls returns true + +```javascript +arraySome(array, function(item [,index, array]){} [, parallel] [, maxThreads]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.some(function(item [,index, array]){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | Array to iterate | +| callback | boolean | Yes | | Closure or a function reference that will be called for each of the iteration. | +| parallel | boolean | No | | Lucee4.5+ Execute closures parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ Maximum number of threads executed, ignored when argument "parallel" is set to false | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| value | any | No | The value for the current iteration +| index | numeric | No | The current index for the iteration +| array | array | No | A reference of the original array + +## Simple Example + +```javascript +// Create an array +arrayList = ["apple", "pineapple", "mango", "apricot"]; + +// Match some +result = arraySome(arrayList, function(fruit) { + return fruit.startsWith("a"); +}); + +// Print result +writeOutput((result ? "Some" : "No") & " matches were found!"); +``` + +### Expected Result: Some matches were found! + +## Member Function Example + +```javascript +// Create an array +arrayList = ["apple", "pineapple", "mango", "apricot"]; + +// Match some +result = arrayList.some(function(fruit) { + return fruit.endsWith("a"); +}); + +// Print result +writeOutput((result ? "Some" : "No") & " matches were found!"); +``` + +### Expected Result: No matches were found! diff --git a/docs/functions/arraysort.md b/docs/functions/arraysort.md new file mode 100644 index 000000000..9ba08bd43 --- /dev/null +++ b/docs/functions/arraysort.md @@ -0,0 +1,132 @@ +# arraySort + +Sorts array elements. + +```javascript +arraySort(array, sortType [, sortOrder [, localeSensitive ]]) +or +arraySort(array, callback) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.sort(sortType [, sortOrder, localeSensitive ]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | Name of an array | +| sortType | string | Yes | | numeric: sorts numbers
text: sorts text alphabetically, taking case into account
(also known as case-sensitive). All letters of one case
precede the first letter of the other case:
- aabzABZ, if sort_order = "asc" (ascending sort)
- ZBAzbaa, if sort_order = "desc" (descending sort)

textnocase: sorts text alphabetically, without regard to
case (also known as case-insensitive). A letter in varying
cases precedes the next letter:
- aAaBbBzzZ, in an ascending sort; preserves original
intra-letter order
- ZzzBbBaAa, in a descending sort; reverses original
intra-letter order | +| sortOrder | string | No | asc | asc: ascending sort order. Default.
- aabzABZ or aAaBbBzzZ, depending on value of sort_type,
for letters
- from smaller to larger, for numbers

desc: descending sort order.
- ZBAzbaa or ZzzBbBaAa, depending on value of sort_type,
for letters
- from larger to smaller, for numbers | +| callback | function | No | | CF10+ A function that uses two elements of an array. `function(element1, element2)`. Returns whether the first is less than (-1), equal to (0) or greater than (1) the second one (like the compare functions). | +| localeSensitive | boolean | No | false | CF10+ Specify if you wish to do a locale sensitive sorting. | + +## Simple example for arraySort function + +Uses the arraySort() function to get the sorted array and which sorted by type numeric + +```javascript +someArray = [10,20,-99,46,50]; +arraySort(someArray, "numeric", "desc"); +writeOutput( serializeJSON(someArray) ); +``` + +### Expected Result: [50,46,20,10,-99] + +## Simple example with member function + +CF11+ Lucee4.5+ + +```javascript +someArray = ["COLDFUSION","coldfusion","adobe","LucEE","RAILO"]; +someArray.sort("text","desc"); +writeOutput( serializeJSON(someArray) ); +``` + +### Expected Result: ["coldfusion","adobe","RAILO","LucEE","COLDFUSION"] + +## Simple example with callback function + +Uses the callback function + +```javascript +someArray = [ + {name="testemployee", age="32"}, + {name="employeetest", age="36"} +]; +arraySort( + someArray, + function (e1, e2){ + return compare(e1.name, e2.name); + } +); +writeOutput( serializeJSON(someArray) ); +``` + +### Expected Result: [{"NAME":"employeetest","AGE":"36"},{"NAME":"testemployee","AGE":"32"}] + +## Script member syntax: sort array of structs by multiple keys + +Takes an array of structs and sorts by multiple different keys, similar to the way a query allows. + +```javascript +arrayOfStructs = [ + { + "userId": 1, + "firstName": "John", + "lastName": "Doe", + "departmentName": "Sales", + "active": 1 + }, + { + "userId": 2, + "firstName": "Jane", + "lastName": "Smith", + "departmentName": "Marketing", + "active": 1 + }, + { + "userId": 3, + "firstName": "Alice", + "lastName": "Johnson", + "departmentName": "Sales", + "active": 0 + }, + { + "userId": 4, + "firstName": "Bob", + "lastName": "Brown", + "departmentName": "Sales", + "active": 1 + }, + { + "userId": 5, + "firstName": "Charlie", + "lastName": "Davis", + "departmentName": "Marketing", + "active": 0 + } +]; +arrayOfStructs.sort((user1,user2) => { + if (user1.active != user2.active) { + return user2.active - user1.active; + } + if (user1.departmentName == user2.departmentName || user1.active == 0) { + if (user1.lastName == user2.lastName) { + return user1.firstName.compare(user2.firstName); + } + return user1.lastName.compare(user2.lastName); + } + return user1.departmentName.compare(user2.departmentName); +}); +writeDump(arrayOfStructs); +``` + +### Expected Result: Sorts by active employees, then by their last name and finally by their first name diff --git a/docs/functions/arraysplice.md b/docs/functions/arraysplice.md new file mode 100644 index 000000000..bb0f81146 --- /dev/null +++ b/docs/functions/arraysplice.md @@ -0,0 +1,81 @@ +# arraySplice + +Modifies an array by removing elements and adding new elements. It starts from the index, removes as many elements as specified by elementCountForRemoval, and puts the replacements starting from index position. + +```javascript +arraySplice(array, index[, elementCountForRemoval, replacements]) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +someArray.splice(index[, elementCountForRemoval, replacements]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array to splice and modify. | +| index | numeric | Yes | | The position at which to start modifying the array. If the position is greater than the length of the array, the replacement elements will be inserted after the last array element. If the position is less than 0, the start is set to the end of the array and the origin is set accordingly. | +| elementCountForRemoval | numeric | No | | The number of elements to be removed starting with the start index. | +| replacements | array | No | | Array of elements to be added to the array starting with index start. | + +## arraySplice inserting replacements at position 2 while removing 0 elements + +```javascript +months = ['Jan', 'March', 'April', 'June']; +item = ["Feb"]; +arraySplice( months, 2, 0, item ); +writedump(months); +``` + +### Expected Result: ["Jan","Feb","March","April","June"] + +## arraySplice inserting replacements at position 3 while removing 2 elements + +```javascript +months = ['Jan', 'March', 'April', 'June']; +item = ["Feb"]; +arraySplice( months, 3, 2, item ); +writedump(months); +``` + +### Expected Result: ["Jan","March","Feb"] + +## arraySplice inserting replacements at position -3 while removing 0 elements + +```javascript +months = ['Jan', 'March', 'April', 'June']; +item = ["Feb"]; +arraySplice( months, -3, 0, item ); +writedump(months); +``` + +### Expected Result: ["Jan","Feb","March","April","June"] + +## arraySplice inserting replacements at position 5 which is greater than the length of the array + +```javascript +months = ['Jan', 'March', 'April', 'June']; +item = ["Feb"]; +arraySplice( months, 5, 0, item ); +writedump(months); +``` + +### Expected Result: ["Jan","March","April","June","Feb"] + +## Splice an array using member function + +```javascript +months = ['Jan', 'March', 'April', 'June']; +item = ["Feb"]; +months.splice( 2, 0, item ); +writedump(months); +``` + +### Expected Result: ["Jan","Feb","March","April","June"] diff --git a/docs/functions/arraysum.md b/docs/functions/arraysum.md new file mode 100644 index 000000000..32a7b871e --- /dev/null +++ b/docs/functions/arraysum.md @@ -0,0 +1,58 @@ +# arraySum + +The sum of values in an array. If the array parameter value is + an empty array, returns zero. + +```javascript +arraySum(array) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someArray.sum() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | An array name or variable name | +| ignoreEmpty | boolean | No | NO | CF2016.0.3+ Whether to ignore empty string or null values | + +## Sum of values in an array + +Uses the arraySum function to get sum of values in an array + +```javascript +numberArray = [10,99,27,72]; +writeOutput( arraySum(numberArray)); +``` + +### Expected Result: 208 + +## Sum of values in an array + +To get sum of values in an empty array + +```javascript +numberArray = []; +writeOutput( arraySum(numberArray)); +``` + +### Expected Result: 0 + +## Sum of values in an array + +CF11+ Lucee4.5+ Uses the sum member function is the same as running arraySum. + +```javascript +numberArray = [10,99,27,72]; +writeOutput( numberArray.sum() ); +``` + +### Expected Result: 208 diff --git a/docs/functions/arrayswap.md b/docs/functions/arrayswap.md new file mode 100644 index 000000000..7c5012189 --- /dev/null +++ b/docs/functions/arrayswap.md @@ -0,0 +1,47 @@ +# arraySwap + +Swaps array values of an array at specified positions. This function is more efficient than multiple cfset tags + +```javascript +arraySwap(array, position1, position2) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someArray.swap(position1, position2) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The array for which positions will be swapped | +| position1 | numeric | Yes | | Position of 1st element to swap. | +| position2 | numeric | Yes | | Position of 2nd element to swap. | + +## Swap the position of two values in an array + +```javascript +superiorArray = ['Spider-Man','Green Goblin','Doctor Octopus','Venom']; +arraySwap(superiorArray,1,3); +writeDump(superiorArray); +``` + +### Expected Result: ['Doctor Octopus', 'Green Goblin', 'Spider-Man', 'Venom'] + +## Swap the position of two values in an array using the member function + +CF11+ or Lucee4.5+ + +```javascript +superiorArray = ['Spider-Man','Green Goblin','Doctor Octopus','Venom']; +superiorArray.swap(1,3); +writeDump(superiorArray); +``` + +### Expected Result: ['Doctor Octopus', 'Green Goblin', 'Spider-Man', 'Venom'] diff --git a/docs/functions/arraytolist.md b/docs/functions/arraytolist.md new file mode 100644 index 000000000..e4e9dbe3a --- /dev/null +++ b/docs/functions/arraytolist.md @@ -0,0 +1,48 @@ +# arrayToList + +Converts a one-dimensional array to a list. + +```javascript +arrayToList(array [, delimiter]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +someArray.toList([delimiter]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | +| delimiter | string | No | , | | + +## Retrieve an array as a list + +Uses the arrayToList function with a pipe delimiter to retrieve an array as a list + +```javascript +someArray = [1,2,3,4]; +someList = arrayToList(someArray,"|"); +writeOutput(someList); +``` + +### Expected Result: "1|2|3|4" + +## Retrieve an array as a list using the Array member function + +CF11+ Lucee4.5+ Uses the Array member function to retrieve an array as a list + +```javascript +seinfeldArray = ["Jerry","Elaine","Kramer","George"]; +seinfeldList = seinfeldArray.toList(); +writeOutput(seinfeldList); +``` + +### Expected Result: "Jerry,Elaine,Kramer,George" diff --git a/docs/functions/arraytostruct.md b/docs/functions/arraytostruct.md new file mode 100644 index 000000000..f94ae415c --- /dev/null +++ b/docs/functions/arraytostruct.md @@ -0,0 +1,31 @@ +# arrayToStruct + +Transform the array to a struct, the index of the array is the key of the struct + +```javascript +arrayToStruct(array) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +array.toStruct() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | | + +## Convert an array to a struct using arrayToStruct() + +```javascript +serializeJSON(arrayToStruct(["a","b"])); +``` + +### Expected Result: {"2":"b","1":"a"} diff --git a/docs/functions/arrayunshift.md b/docs/functions/arrayunshift.md new file mode 100644 index 000000000..918e39be7 --- /dev/null +++ b/docs/functions/arrayunshift.md @@ -0,0 +1,48 @@ +# arrayUnshift + +This function adds one or more elements to the beginning of the original array and returns the length of the modified array. + +```javascript +arrayUnshift(array,object) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +array.unshift(object) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| array | array | Yes | | The original array to be added to. | +| object | any | Yes | | The new object to be added. | + +## Example with simple values + +Add a new element to an array. + +```javascript +arr=[1,2,3]; +newArrLen=arrayUnshift(arr,0); +writeOutput(newArrLen); +``` + +### Expected Result: 4 + +## Using a member function + +This is the same example as above, but using a member function on the array instead of a standalone function. + +```javascript +arr=[1,2,3]; +newArrLen=arr.unshift(0); +writeOutput(newArrLen); +``` + +### Expected Result: 4 diff --git a/docs/functions/asc.md b/docs/functions/asc.md new file mode 100644 index 000000000..c106ba257 --- /dev/null +++ b/docs/functions/asc.md @@ -0,0 +1,26 @@ +# asc + +Determines the ASCII value of a character. + +```javascript +asc(string) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | | + +## character and value of Korean currency symbol ( unicode number 8361 ) + +```javascript +x = chr( 8361 ); + writeoutput( 'character: #x#' ); + x = asc( x ); + writeoutput( '
Unicode value: #x#'); +``` diff --git a/docs/functions/ascii.md b/docs/functions/ascii.md new file mode 100644 index 000000000..02465fe10 --- /dev/null +++ b/docs/functions/ascii.md @@ -0,0 +1,26 @@ +# ascii + +Determines the ASCII value of a character. + +```javascript +ascii(string) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | | + +## character and value of Korean currency symbol ( unicode number 8361 ) + +```javascript +x = chr( 8361 ); + writeoutput( 'character: #x#' ); + x = asc( x ); + writeoutput( '
Unicode value: #x#'); +``` diff --git a/docs/functions/asin.md b/docs/functions/asin.md new file mode 100644 index 000000000..9c2ab79dc --- /dev/null +++ b/docs/functions/asin.md @@ -0,0 +1,25 @@ +# asin + +Determines the arcsine of a number. The arcsine is the angle whose sine is `number`. + +```javascript +asin(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Arcsine of 0.3 + +```javascript +asin(0.3) +``` + +### Expected Result: 0.304692654015 diff --git a/docs/functions/atn.md b/docs/functions/atn.md new file mode 100644 index 000000000..17073aac5 --- /dev/null +++ b/docs/functions/atn.md @@ -0,0 +1,25 @@ +# atn + +Arctangent function. The arctangent is the angle whose tangent is `number`. + +```javascript +atn(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Arctangent of 0.3 + +```javascript +atn(0.3) +``` + +### Expected Result: 0.291456794478 diff --git a/docs/functions/beat.md b/docs/functions/beat.md new file mode 100644 index 000000000..f291efb0e --- /dev/null +++ b/docs/functions/beat.md @@ -0,0 +1,31 @@ +# beat + +Outputs the swatch internet time (or beat time) of the passed local time. + +```javascript +beat([time]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| time | any | No | | The local time to get beat time from | + +## Now in swatch internet time + +```javascript +beat() +``` + +## 14:02 in swatch internet time + +```javascript +beat("14:02") +``` + +### Expected Result: 626.388 diff --git a/docs/functions/binarydecode.md b/docs/functions/binarydecode.md new file mode 100644 index 000000000..cc057951e --- /dev/null +++ b/docs/functions/binarydecode.md @@ -0,0 +1,60 @@ +# binaryDecode + +Converts a string to a binary object. Used to convert + binary data that has been encoded into string format + back into binary data. + +```javascript +binaryDecode(string, encoding) +``` + +```javascript +returns binary +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| string | string | Yes | | A string containing encoded binary data. | | +| encoding | string | Yes | | A string specifying the algorithm used to encode the original
binary data into a string; must be one of the following:
- hex: characters 0-9 and A-F represent the hexadecimal value
of each byte; for example, 3A.
- UU: data is encoded using the UNIX UUencode algorithm.
- base64: data is encoded using the Base64 algorithm.
- base64URL: modification of the main Base64 standard, which uses the encoding result as filename or URL address. | /Users/garethedwards/development/github/cfdocs/docs/functions/binarydecode.md|base64URL | + +## Decode a string using hex back into binary encoding of the string + +use binaryDecode to decode with hex + +```javascript +binaryDecode('F62B','hex'); +``` + +### Expected Result: [BINARY] + +## Decode a string using UNIX UUencode (UU) back into binary encoding of the string + +use binaryDecode to decode with UNIX UUencode (UU) + +```javascript +binaryDecode('& the data; one of the following:
- hex: use characters 0-9 and A-F represent the hexadecimal value
of each byte; for example, 3A.
- UU: use the UNIX UUencode algorithm to convert the data.
- base64: use the Base64 algorithm to convert the data.
- base64URL: modification of the main Base64 standard, which uses the encoding result as filename or URL address. | /Users/garethedwards/development/github/cfdocs/docs/functions/binaryencode.md|base64URL | + +## Encode a binary string back to a string using hex + +use binaryEncode to Encode with hex + +```javascript +s = binaryDecode('737472696E67','hex'); + binaryEncode(s,'hex'); +``` + +### Expected Result: 737472696E67 + +## Encode a binary using UNIX UUencode (UU) back into string + +use binaryEncode to Encode with UNIX UUencode (UU) + +```javascript +s = binaryDecode('&
"" or not set - information to all default caches
object - information to "Default Object" Cache
template - information to "Default Template" Cache
query - information to "Default Query" Cache
resource - information to "Default Resource" Cache
{cache name} - information to a specific cache | /Users/garethedwards/development/github/cfdocs/docs/functions/cachegetproperties.md|query | diff --git a/docs/functions/cachegetsession.md b/docs/functions/cachegetsession.md new file mode 100644 index 000000000..f51371935 --- /dev/null +++ b/docs/functions/cachegetsession.md @@ -0,0 +1,37 @@ +# cacheGetSession + +Lets you retrieve the underlying cache object to access additional cache functionality that is not implemented in the tag cfcache. + +Note: Caution! Using the cacheGetSession function might pose security vulnerabilities. If you wish to disable the usage of this function, add it to Sandbox Security. + +```javascript +cacheGetSession(objectType) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| objectType | string | Yes | | Any of the following values: object, template, or name of the user-defined cache | +| isKey | boolean | No | false | Set to true if objectType is user-defined cache. | + +## The following example shows how to use the function cacheGetSession to operate on default caches: + +```javascript + + + + + + + + + + +``` + +### Expected Result: cache object diff --git a/docs/functions/cacheidexists.md b/docs/functions/cacheidexists.md new file mode 100644 index 000000000..729146377 --- /dev/null +++ b/docs/functions/cacheidexists.md @@ -0,0 +1,53 @@ +# cacheIdExists + +Used to find if a cached object exists in the cache region. The region can be the default cache region (either at server or application level) or the custom region you specify. + +```javascript +cacheIdExists(id [, region]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| id | string | Yes | | The ID of the cached object. | +| region | string | No | | The cache region where you check for the cached object. | + +## Tag Syntax + +Checks if the cache object is present in the user-defined cache region + +```javascript + + + + + + + Starting to write to cache.. + +
+ Done!! + Trying to check if the cached item is present... + #cacheIdExists('obj1','customcache')# +``` + +## Tag Syntax + +Checks if the cache object is present in the default cache region + +```javascript + + + Starting to write to cache.. + +
+ Done!! + Trying to fetch cached item... + + #cacheIdExists('obj2','OBJECT')# +``` diff --git a/docs/functions/cachekeyexists.md b/docs/functions/cachekeyexists.md new file mode 100644 index 000000000..40882d5d8 --- /dev/null +++ b/docs/functions/cachekeyexists.md @@ -0,0 +1,18 @@ +# cacheKeyExists + +Returns true/false whether the cache contains an element with the specified keyname. + +```javascript +cacheKeyExists(key [, cacheName]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| key | string | Yes | | Key to check | +| cacheName | string | No | | Definition of the cache used by name, when not set the "default Object Cache" defined in Lucee Administrator is used instead. | diff --git a/docs/functions/cacheput.md b/docs/functions/cacheput.md new file mode 100644 index 000000000..2a10cc1f8 --- /dev/null +++ b/docs/functions/cacheput.md @@ -0,0 +1,60 @@ +# cachePut + +Stores an object in the cache. + +```javascript +cachePut(id, value [, timespan] [, idleTime] [, region] [, throwOnError]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| id | string | Yes | | Unique identifier for the cached value | +| value | any | Yes | | The value to cache | +| timespan | date | No | | The interval until the object is flushed from the cache, as a decimal number of days. One way to set the value is to use the return value from the CreateTimeSpan function. The default is to not time out the object. | +| idleTime | date | No | | A decimal number of days after which the object is flushed from the cache if it is not accessed during that time. One way to set the value is to use the return value from the CreateTimeSpan function. | +| region | string | No | | Lucee4.5+ CF10+ Specifies the cache region/name where you place the cache object. | +| throwOnError | boolean | No | false | CF10+ If true and region does not exist, throws an error | + +## Tag Syntax + +```javascript + + + + Cache doesn't exist, so create it.
+ + + #cachedData# + +
+``` + +## Script Syntax + +I place data into the default cache. + +```javascript +// generate some data to cache +data = { bar = 'foo', foo = 'bar' }; + +// add the data to a named cache +cachePut( 'cached_object_name_or_id', data, createTimeSpan( 0, 0, 30, 0 ), createTimeSpan( 0, 0, 15, 0 ) ); +``` + +## Script Syntax - Named Cache + +I place data into a named cache. CF10+ Lucee4.5+ + +```javascript +// generate some data to cache +data = { bar = 'foo', foo = 'bar' }; + +// add the data to a named cache +cachePut( 'cached_object_name_or_id', data, createTimeSpan( 0, 0, 30, 0 ), createTimeSpan( 0, 0, 15, 0 ), 'region_cacheName' ); +``` diff --git a/docs/functions/cacheregionexists.md b/docs/functions/cacheregionexists.md new file mode 100644 index 000000000..49e3468d0 --- /dev/null +++ b/docs/functions/cacheregionexists.md @@ -0,0 +1,28 @@ +# cacheRegionExists + +Checks if the cache region exists. + +```javascript +cacheRegionExists(region) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| region | string | Yes | | Name of the cache region. | +| password | string | No | | Lucee5+ The password for the web administrator is required to interact with Cache Connections. | + +## Tag Syntax + +Checking to see if the region is present in the cache + +```javascript + + + +``` diff --git a/docs/functions/cacheregionnew.md b/docs/functions/cacheregionnew.md new file mode 100644 index 000000000..7904d81d0 --- /dev/null +++ b/docs/functions/cacheregionnew.md @@ -0,0 +1,54 @@ +# cacheRegionNew + +Creates a new custom cache region (if no cache region exists). + +```javascript +cacheRegionNew(region [, properties] [, throwOnError]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| region | string | Yes | | Name of the new cache region to be created. | +| properties | struct | No | | Struct that contains the cache region properties. | +| throwOnError | boolean | No | true | A Boolean value specifying if to throw an exception if the cache region name you specify already exists. | +| password | string | No | | Lucee5+ The password for the web administrator is required to interact with Cache Connections. | + +## Tag Syntax + +Defining properties for the struct + +```javascript + + + + + + + + + + + + + + + + + + + + + Starting to write to cache. + + Trying to fetch cached item... + +
+ Done!!
+ #obj.name# +``` diff --git a/docs/functions/cacheregionremove.md b/docs/functions/cacheregionremove.md new file mode 100644 index 000000000..e7dd39898 --- /dev/null +++ b/docs/functions/cacheregionremove.md @@ -0,0 +1,24 @@ +# cacheRegionRemove + +Removes a specified cache region. + +```javascript +cacheRegionRemove(region) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| region | string | Yes | | Name of the cache region that has to be removed. | +| password | string | No | | Lucee5+ The password for the web administrator is required to interact with Cache Connections. | + +## Example Syntax + +```javascript + +``` diff --git a/docs/functions/cacheremove.md b/docs/functions/cacheremove.md new file mode 100644 index 000000000..7934c7fc6 --- /dev/null +++ b/docs/functions/cacheremove.md @@ -0,0 +1,61 @@ +# cacheRemove + +Removes an object from the cache. + +```javascript +cacheRemove(id [, throwOnError [, region[, exact]]]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| id | any | Yes | | Comma delimited list of cache IDs. A list of all available IDs can be retrieved using cacheGetAllIds. CF11+ Can take an array instead of a list. | +| throwOnError | boolean | No | NO | When `true` throws an error when cache ID does not exist. | +| region | string | No | | CF10+ Specify which cache region to search | +| exact | boolean | No | YES | CF10+ When `true`, matches values in `id` exactly | + +## Remove one ID using exact match + +```javascript +cacheRemove( 'myCachedQuery' ); +``` + +## Example using exact=false + +Remove using partially matching IDs + +```javascript +cachePut( 'cache_1', 'test data', 1000, 1000, 'test' ); +cachePut( 'cache_2', 'test data', 1000, 1000, 'test' ); + +// this removes both cached objects: +cacheRemove( 'cache', false, 'test', false ); +``` + +## Example using exact=true + +With exact set to true, no IDs match, so none will be deleted + +```javascript +cachePut( 'cache_1', 'test data', 1000, 1000, 'test' ); +cachePut( 'cache_2', 'test data', 1000, 1000, 'test' ); + +// this removes no object: +cacheRemove( 'cache', false, 'test', true ); +``` + +## Remove all cached data using default settings + +(ColdFusion 10 added cacheRemoveAll.) + +```javascript + + + + +``` diff --git a/docs/functions/cacheremoveall.md b/docs/functions/cacheremoveall.md new file mode 100644 index 000000000..1287d2a10 --- /dev/null +++ b/docs/functions/cacheremoveall.md @@ -0,0 +1,39 @@ +# cacheRemoveAll + +Removes all stored objects in a cache region. If no cache region is specified, objects in the default region are removed. + +```javascript +cacheRemoveAll( region ) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| region | string | No | | Indicates the cache region from which to remove the stored objects. If no value is specified, default cache region is considered by default. | + +## Demonstrates the behavior using test data + +```javascript +// generate some data to cache +for ( i = 1; i <= 10; i++ ) { + cachePut( 'cache_#i#', "Test data #i#" ); +} + +function cacheObjCount() { + return arrayLen(cacheGetAllIds()); +} + +_numCacheObj = "Number of objects in the cache: "; + +writeOutput('Before cacheRemove() :: #_numCacheObj# #cacheObjCount()#
'); + +// clear all objects from the cache +cacheRemoveAll(); + +writeOutput('After cacheRemove() :: #_numCacheObj# #cacheObjCount()#

'); +``` diff --git a/docs/functions/cachesetproperties.md b/docs/functions/cachesetproperties.md new file mode 100644 index 000000000..ce9e57bf7 --- /dev/null +++ b/docs/functions/cachesetproperties.md @@ -0,0 +1,18 @@ +# cacheSetProperties + +Set multiple cache settings + +```javascript +cacheSetProperties(properties) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| properties | struct | Yes | | Structure of properties to be changed | +| region | string | No | | CF10+ Indicates the cache region for which to set the properties. | diff --git a/docs/functions/callstackdump.md b/docs/functions/callstackdump.md new file mode 100644 index 000000000..0d8106d13 --- /dev/null +++ b/docs/functions/callstackdump.md @@ -0,0 +1,52 @@ +# callStackDump + +Similar to the function callStackGet except that it outputs a string representation of the call stack. + +```javascript +callStackDump(output) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| output | string | No | browser | If you chose "file" and do not provide the complete path to the file, the file is written to the temp directory as determined by the function `getTempDirectory()`. | /Users/garethedwards/development/github/cfdocs/docs/functions/callstackdump.md|file | + +## Tag Syntax + +In this example, the factorial of a number is computed. The example is similar to the example for CallStackGet except that the function used here is callStackDump.callfact.cfm + +```javascript + + + + +#cfcatch.message# +
#cfcatch.detail# +
+
+
+
+``` + +## Tag Syntax + +fact.cfm + +```javascript + + + + + + + + + + +Factorial of 5 - #factorial(5)# +``` diff --git a/docs/functions/callstackget.md b/docs/functions/callstackget.md new file mode 100644 index 000000000..0574a2c91 --- /dev/null +++ b/docs/functions/callstackget.md @@ -0,0 +1,59 @@ +# callStackGet + +Returns an array of structs by default. Each struct contains template name, line number, and function name (if applicable). This is a snapshot of all function calls or invocations. + +```javascript +callStackGet() +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | No | array | Lucee4.5+ The type of the returned value | +| offset | numeric | No | 0 | Lucee5.3.8+ The number of frames to skip | +| maxFrames | numeric | No | 0 | Lucee5.3.8+ The maximum number of frames to return | + +## Tag Syntax + +This example the factorial of a number is computed. + +```javascript + + + + + + #cfcatch.message# +
#cfcatch.detail#
+
+
+
+``` + +## Script Syntax + +This example the factorial of a number is computed. + +```javascript + + + numeric function factorial(n) { + if (n == 1) { + writeDump(callStackGet()); + writeOutput('
'); + return 1; + } + else { + writeDump(callStackGet()); + writeOutput('
'); + return n * factorial(n-1); + } + } + factorial(5); +
+``` diff --git a/docs/functions/canonicalize.md b/docs/functions/canonicalize.md new file mode 100644 index 000000000..9369dd248 --- /dev/null +++ b/docs/functions/canonicalize.md @@ -0,0 +1,102 @@ +# canonicalize + +Canonicalize or decode the input string. Canonicalization is simply the operation of reducing a possibly encoded string down to its simplest form. This is important because attackers frequently use encoding to change their input in a way that will bypass validation filters, but still be interpreted properly by the target of the attack. Note that data encoded more than once is not something that a normal user would generate and should be regarded as an attack. + +```javascript +canonicalize(input, restrictMultiple, restrictMixed) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| input | string | Yes | | String to be encoded. | +| restrictMultiple | boolean | Yes | | If set to true, multiple encoding is restricted. This argument can be set to true to restrict the input if multiple or nested encoding is detected. If this argument is set to true, and the given input is multiple or nested encoded using one encoding scheme an error will be thrown. | +| restrictMixed | boolean | Yes | | If set to true, mixed encoding is restricted. This argument can be set to true to restrict the input if mixed encoding is detected. If this argument is set to true, and the given input is encoded using mixed encoding, an error will be thrown. | +| throwOnError | boolean | No | NO | CF11+ If the value of this argument is true, and if restrictMultiple or restrictMixed is true and the given input contains mixed or multiple encoded strings, an exception will be thrown.
If the value of this argument is false, an empty string will be returned instead of an exception. | + +## Canonicalize the simple HTML entity encoded string + +Canonicalize the simple HTML entity encoded string. + +```javascript +#canonicalize("<",false,false)# +``` + +### Expected Result: < + +## Enforce multiple and mixed encoding detection + +(Adobe CF11+ example with `throwOnError` parameter set to true) Enforce multiple and mixed encoding detection. Mixed encoding is detected as the data is encoded using URL and HTML entity encoding. Multiple Encoding is also detected. + +```javascript + + #canonicalize("%26lt; %26lt; %2526lt%253B %2526lt%253B %2526lt%253B",true,true, true)#
+ + + + +
+``` + +### Expected Result: Error Message: Input validation failure. The log message will contain more detailed information on the error. + +## Enforce multiple and mixed encoding detection + +(Adobe CF11+ example with `throwOnError` parameter set to false) Enforce multiple and mixed encoding detection. Mixed encoding is detected as the data is encoded using URL and HTML entity encoding. Multiple Encoding is also detected. + +```javascript + +#canonicalize("%26lt; %26lt; %2526lt%253B %2526lt%253B %2526lt%253B",true,true, false)# +``` + +### Expected Result: [Empty string] + +## Enforce mixed but not multiple encoding detection returns an Empty String + +Enforce mixed but not multiple encoding detection returns an Empty String. + +```javascript +#canonicalize("%25 %2526 %26##X3c;script&##x3e; &##37;3Cscript%25252525253e",false,true)# + + + #canonicalize("%25 %2526 %26##X3c;script&##x3e; &##37;3Cscript%25252525253e",false,true, true)#
+ + + + +
+``` + +### Expected Result: [Empty string] + +## Mixed and multiple encoding detected + +Mixed encoding is detected as the data is encoded using URL and HTML entity encoding. Multiple Encoding is also detected. + +```javascript + +#canonicalize("%26lt; %26lt; %2526lt%253B %2526lt%253B %2526lt%253B",false,false)#
+#canonicalize("&##X25;3c",false,false)#
+#canonicalize("&##x25;3c",false,false)# +``` + +### Expected Result: < < < < < +< +< + +## Simple JavaScript decoding + +http://www.planetpdf.com/codecuts/pdfs/tutorial/jsspec.pdf see section 2.7.5 for JS Encoding + +```javascript +#canonicalize("\\U003C",false,false)#
+#canonicalize("\\X3C",false,false)# +``` + +### Expected Result: < +< diff --git a/docs/functions/ceiling.md b/docs/functions/ceiling.md new file mode 100644 index 000000000..c89e04d5d --- /dev/null +++ b/docs/functions/ceiling.md @@ -0,0 +1,35 @@ +# ceiling + +Determines the closest integer that is greater than a specified floating point number. + +```javascript +ceiling(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | The number for which to get the ceiling | + +## Ceiling of 1.1 + +```javascript +ceiling(1.1) +``` + +### Expected Result: 2 + +## Ceiling of 1 + +When ceiling an integer the result is equal to the value passed + +```javascript +ceiling(1) +``` + +### Expected Result: 1 diff --git a/docs/functions/cfusion_decrypt.md b/docs/functions/cfusion_decrypt.md new file mode 100644 index 000000000..9b908639c --- /dev/null +++ b/docs/functions/cfusion_decrypt.md @@ -0,0 +1,18 @@ +# cfusion_Decrypt + +Decrypts the given string, alias for function call decrypt(string,key,"cfmx_compat","hex"). + +```javascript +cfusion_Decrypt(string, key) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | | +| key | string | Yes | | | diff --git a/docs/functions/cfusion_encrypt.md b/docs/functions/cfusion_encrypt.md new file mode 100644 index 000000000..ecd4e4533 --- /dev/null +++ b/docs/functions/cfusion_encrypt.md @@ -0,0 +1,18 @@ +# cfusion_Encrypt + +Encrypts the given string, alias for function call encrypt(string,key,"cfmx_compat","hex"). + +```javascript +cfusion_Encrypt(string, key) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | | +| key | string | Yes | | | diff --git a/docs/functions/charsetdecode.md b/docs/functions/charsetdecode.md new file mode 100644 index 000000000..0734edc5a --- /dev/null +++ b/docs/functions/charsetdecode.md @@ -0,0 +1,38 @@ +# charsetDecode + +Converts a string to a binary representation. + +```javascript +charsetDecode(string, encoding) +``` + +```javascript +returns binary +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| string | string | Yes | | A string containing data to encode in binary format. | | +| encoding | string | Yes | | A string specifying encoding of the input data. | /Users/garethedwards/development/github/cfdocs/docs/functions/charsetdecode.md|utf-16 | + +## Decode a string using utf-8 back into binary encoding of the string + +Use charsetDecode to decode with utf-8 + +```javascript +charsetDecode('string','utf-8'); +``` + +### Expected Result: [BINARY] + +## Decode a string using us-ascii back into binary encoding of the string + +Use charsetDecode to decode with us-ascii + +```javascript +charsetDecode('string','us-ascii'); +``` + +### Expected Result: [BINARY] diff --git a/docs/functions/charsetencode.md b/docs/functions/charsetencode.md new file mode 100644 index 000000000..a51e67598 --- /dev/null +++ b/docs/functions/charsetencode.md @@ -0,0 +1,40 @@ +# charsetEncode + +Uses the specified encoding to convert binary data to a string. + +```javascript +charsetEncode(binaryData, encoding) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| binaryData | binary | Yes | | A variable containing binary data to decode into text. | | +| encoding | string | Yes | | The character encoding that was used to encode the string into binary format. | /Users/garethedwards/development/github/cfdocs/docs/functions/charsetencode.md|utf-16 | + +## Encode a string using utf-8 back into binary encoding of the string + +Use charsetEncode to Encode with utf-8 + +```javascript +s=charsetDecode('string','utf-8'); + charsetEncode(s,'utf-8'); +``` + +### Expected Result: string + +## Encode a string using us-ascii back into binary encoding of the string + +Use charsetEncode to Encode with us-ascii + +```javascript +s=charsetDecode('string','us-ascii'); + charsetEncode(s,'us-ascii'); +``` + +### Expected Result: string diff --git a/docs/functions/chr.md b/docs/functions/chr.md new file mode 100644 index 000000000..d333035fc --- /dev/null +++ b/docs/functions/chr.md @@ -0,0 +1,26 @@ +# chr + +Converts a numeric value to a UCS-2 character. + +```javascript +chr(number) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | The UCS-2 code value (a number in the range 0 - 65535) | + +## Character and value of Korean currency symbol ( unicode number 8361 ) + +```javascript +x = chr( 8361 ); + writeOutput( 'character: #x#' ); + x = asc( x ); + writeOutput( '
Unicode value: #x#'); +``` diff --git a/docs/functions/cjustify.md b/docs/functions/cjustify.md new file mode 100644 index 000000000..70424212a --- /dev/null +++ b/docs/functions/cjustify.md @@ -0,0 +1,25 @@ +# cJustify + +Centers a string in a given field length by adding spaces to either side. + +```javascript +cJustify(string, length) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The string that is to be centered | +| length | numeric | Yes | | The length of the field in which the string should be centered | + +## Tag Syntax + +```javascript + + +``` diff --git a/docs/functions/cleartimezone.md b/docs/functions/cleartimezone.md new file mode 100644 index 000000000..98cffd56e --- /dev/null +++ b/docs/functions/cleartimezone.md @@ -0,0 +1,24 @@ +# clearTimeZone + +Clears the timezone that was set. + +```javascript +clearTimeZone() +``` + +```javascript +returns void +``` + +## Clear the timezone + +Set the timezone and then clear it. + +```javascript +setTimeZone("CET"); +writeOutput(getTimezoneInfo().timezone & "→ "); +clearTimeZone(); +writeOutput(getTimezoneInfo().timezone); +``` + +### Expected Result: CET→ Etc/UTC diff --git a/docs/functions/collectioneach.md b/docs/functions/collectioneach.md new file mode 100644 index 000000000..7d944a4c5 --- /dev/null +++ b/docs/functions/collectioneach.md @@ -0,0 +1,36 @@ +# collectionEach + +Iterate over each item contained in the collection given + +```javascript +collectionEach(collection, closure) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| collection | any | Yes | | | +| closure | function | Yes | | | + +## Iterate over collection and output a key from each item + +```javascript +coll = [{ + id: 0, + name: 'me' +},{ + id: 1, + name: 'you' +}]; +collectionEach(coll,function(item) { + writeOutput(item.name); + writeOutput(' - '); +}); +``` + +### Expected Result: me - you - diff --git a/docs/functions/collectionevery.md b/docs/functions/collectionevery.md new file mode 100644 index 000000000..019ee1741 --- /dev/null +++ b/docs/functions/collectionevery.md @@ -0,0 +1,63 @@ +# collectionEvery + +Checks if every item passes the truth test of an expression given in the closure + +```javascript +collectionEvery(collection, closure [, parallel] [, maxThreads]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| collection | any | Yes | | | +| closure | function | Yes | | | +| parallel | boolean | No | | | +| maxThreads | numeric | No | 20 | | + +## Check if every item is of type mail + +When only mail items are provided + +```javascript +coll = [{ + id: 0, + type: 'mail' +},{ + id: 1, + type: 'mail' +}]; +onlyMails = collectionEvery(coll,function(item) { + return item.type is 'mail'; +}); +writeOutput(onlyMails); +``` + +### Expected Result: YES + +## Check if every item is of type mail + +When comment items are provided besides mail items as well + +```javascript +coll = [{ + id: 0, + type: 'mail' +},{ + id: 1, + type: 'mail' +},{ + id: 2, + type: 'comment' +}]; +onlyMails = collectionEvery(coll,function(item) { + return item.type is 'mail'; +}); +writeOutput(onlyMails); +``` + +### Expected Result: NO diff --git a/docs/functions/collectionfilter.md b/docs/functions/collectionfilter.md new file mode 100644 index 000000000..74682da8d --- /dev/null +++ b/docs/functions/collectionfilter.md @@ -0,0 +1,43 @@ +# collectionFilter + +Filters items from a collection passing the filter condition + +```javascript +collectionFilter(collection, filter [, parallel] [, maxThreads]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| collection | any | Yes | | | +| filter | function | Yes | | | +| parallel | boolean | No | | | +| maxThreads | numeric | No | 20 | | + +## Return only items of type mail + +```javascript +coll = [{ + id: 0, + type: 'mail' +},{ + id: 1, + type: 'mail' +},{ + id: 2, + type: 'comment' +}]; +onlyMails = collectionFilter(coll,function(item) { + return item.type is 'mail'; +}); +for(mail in onlyMails) { + writeOutput(mail.id&', '); +} +``` + +### Expected Result: 0, 1, diff --git a/docs/functions/collectionmap.md b/docs/functions/collectionmap.md new file mode 100644 index 000000000..e466fa3e5 --- /dev/null +++ b/docs/functions/collectionmap.md @@ -0,0 +1,49 @@ +# collectionMap + +Maps values in a collection + +```javascript +collectionMap(collection, closure [, parallel] [, maxThreads]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| collection | any | Yes | | | +| closure | function | Yes | | | +| parallel | boolean | No | | | +| maxThreads | numeric | No | 20 | | + +## Return users which names are mapped to one value only + +```javascript +coll = [{ + id: 0, + firstname: 'Arthur', + name: 'Dent' +},{ + id: 1, + firstname: 'Harry', + name: 'Potter' +},{ + id: 2, + firstname: 'Peter', + name: 'Jackson' +}]; +users = collectionMap(coll,function(item) { + return { + id: item.id, + fullname: item.firstname&' '&item.name + }; +}); +for(user in users) { + writeOutput(user.fullname&', '); +} +``` + +### Expected Result: Arthur Dent, Harry Potter, Peter Jackson, diff --git a/docs/functions/collectionreduce.md b/docs/functions/collectionreduce.md new file mode 100644 index 000000000..49c31a088 --- /dev/null +++ b/docs/functions/collectionreduce.md @@ -0,0 +1,43 @@ +# collectionReduce + +Sum amount of an item value for every item + +```javascript +collectionReduce(collection, closure [, initialValue]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| collection | any | Yes | | | +| closure | function | Yes | | | +| initialValue | any | No | | | + +## Sum amount of an item value for every item + +```javascript +coll = [{ + id: 0, + type: 'apples', + amount: 25 +},{ + id: 1, + type: 'pinapples', + amount: 2 +},{ + id: 2, + type: 'peaches', + amount: 13 +}]; +fruits = collectionReduce(coll,function(a,b) { + return a + b.amount; +},0); +writeOutput(fruits&' fruits'); +``` + +### Expected Result: 40 fruits diff --git a/docs/functions/collectionsome.md b/docs/functions/collectionsome.md new file mode 100644 index 000000000..18de47dee --- /dev/null +++ b/docs/functions/collectionsome.md @@ -0,0 +1,63 @@ +# collectionSome + +Similar to collectionEvery, except it returns true if at least one item returns true + +```javascript +collectionSome(collection, closure [, parallel] [, maxThreads]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| collection | any | Yes | | | +| closure | function | Yes | | | +| parallel | boolean | No | | | +| maxThreads | numeric | No | 20 | | + +## Check if at least one item is of type mail + +When only mail items are provided + +```javascript +coll = [{ + id: 0, + type: 'mail' +},{ + id: 1, + type: 'mail' +}]; +onlyMails = collectionSome(coll,function(item) { + return item.type is 'comment'; +}); +writeOutput(onlyMails); +``` + +### Expected Result: NO + +## Check if at least one item is of type mail + +When comment items are provided besides mail items as well + +```javascript +coll = [{ + id: 0, + type: 'mail' +},{ + id: 1, + type: 'mail' +},{ + id: 2, + type: 'comment' +}]; +onlyMails = collectionSome(coll,function(item) { + return item.type is 'comment'; +}); +writeOutput(onlyMails); +``` + +### Expected Result: YES diff --git a/docs/functions/compare.md b/docs/functions/compare.md new file mode 100644 index 000000000..3b2671808 --- /dev/null +++ b/docs/functions/compare.md @@ -0,0 +1,30 @@ +# compare + +Performs a case-sensitive comparison of two strings. + -1, if string1 is less than string2 + 0, if string1 is equal to string2 + 1, if string1 is greater than string2 + +```javascript +compare(string1, string2) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string1 | string | Yes | | | +| string2 | string | Yes | | | + +## Tag Syntax + +```javascript + + +``` + +### Expected Result: -1 diff --git a/docs/functions/comparenocase.md b/docs/functions/comparenocase.md new file mode 100644 index 000000000..31c14f04d --- /dev/null +++ b/docs/functions/comparenocase.md @@ -0,0 +1,31 @@ +# compareNoCase + +Performs a case-insensitive comparison of two strings. + An indicator of the difference: + -1, if string1 is less than string2 + 0, if string1 is equal to string2 + 1, if string1 is greater than string2 + +```javascript +compareNoCase(string1, string2) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string1 | string | Yes | | | +| string2 | string | Yes | | | + +## Tag Syntax + +```javascript + + +``` + +### Expected Result: 0 diff --git a/docs/functions/componentcacheclear.md b/docs/functions/componentcacheclear.md new file mode 100644 index 000000000..97366eb79 --- /dev/null +++ b/docs/functions/componentcacheclear.md @@ -0,0 +1,11 @@ +# componentCacheClear + +This function flushes the component path cache + +```javascript +componentCacheClear() +``` + +```javascript +returns void +``` diff --git a/docs/functions/componentcachelist.md b/docs/functions/componentcachelist.md new file mode 100644 index 000000000..9c3f83d65 --- /dev/null +++ b/docs/functions/componentcachelist.md @@ -0,0 +1,33 @@ +# componentCacheList + +This function Lists elements in the component path cache. + +```javascript +componentCacheList() +``` + +```javascript +returns struct +``` + +## Simple Tag Example + +Dumps a struct of components in the cache + +```javascript + + +``` + +### Expected Result: struct + +## Simple Script Example + +Dumps a struct of components in the cache + +```javascript +c = componentCacheList(); +dump(c); +``` + +### Expected Result: struct diff --git a/docs/functions/componentinfo.md b/docs/functions/componentinfo.md new file mode 100644 index 000000000..7850d092d --- /dev/null +++ b/docs/functions/componentinfo.md @@ -0,0 +1,17 @@ +# componentInfo + +Returns meta information from the passed component like "extends", "hint", etc. + +```javascript +componentInfo(component) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| component | component | Yes | | | diff --git a/docs/functions/compress.md b/docs/functions/compress.md new file mode 100644 index 000000000..225cd1bd3 --- /dev/null +++ b/docs/functions/compress.md @@ -0,0 +1,37 @@ +# compress + +Compress a file or a directory with files. + +```javascript +compress(format, source, target [, includeBaseFolder] [, mode]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| format | string | Yes | | The format in which you want to compress the files. | +| source | string | Yes | | Path (relative or absolute) to the file or directory you want to compress. | +| target | string | Yes | | Path (relative or absolute) including the name, where you want to save the compressed output-file. | +| includeBaseFolder | boolean | No | true | Compress the directory or just the content of the directory. | +| mode | string | No | 777 | | + +## Compress a file + +Compress the file "example.txt" to a zip-file. + +```javascript +compress("zip", "example.txt", "output.zip") +``` + +## Compress a directory + +Compress the "example-directory" to a zip-file. + +```javascript +compress("zip", "example-directory", "output.zip") +``` diff --git a/docs/functions/configimport.md b/docs/functions/configimport.md new file mode 100644 index 000000000..2b11e489c --- /dev/null +++ b/docs/functions/configimport.md @@ -0,0 +1,33 @@ +# configImport + +Imports a configuration based on the CFConfig format. + +```javascript +configImport(path path, [, type] [, password], [, params], [, charset]) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | any | Yes | false | Path to the .CFConfig.json file or the data itself as a Struct. | +| type | string | No | server | Config Context to manipulate, server or web context. | +| password | string | No | false | password to access the configuration, depending on the value set for the attribute type. | +| params | struct | No | false | placeholder parameters to use as actual data for the placeholders inside the configuration. | +| charset | string | No | false | charset to use to read the .CFConfig file, if not defined, Lucee will use the default resource charset. | + +## Example for importing a configuration + +Imports a configuration based on the CFConfig format from a file using a password stored in an environment variable. + +```javascript +configImport( + path: expandPath('/config/config.json'), + type: 'server', + password: SERVER.system.environment.PASSWORD +); +``` diff --git a/docs/functions/contractpath.md b/docs/functions/contractpath.md new file mode 100644 index 000000000..c5dc854e2 --- /dev/null +++ b/docs/functions/contractpath.md @@ -0,0 +1,20 @@ +# contractPath + +Opposite of expandpath. + +Tries to match a given absolute path to mappings in the environment and will return a path that is contracted by the shortest matched mapping. If there are no matches, Lucee returns the absolute path it was given. + +```javascript +contractPath(path [, placeholder]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path_absolute | string | Yes | | The absolute path | +| placeholder | boolean | No | false | A boolean indicating whether Lucee placeholder names should be prefixed to the path. | diff --git a/docs/functions/cos.md b/docs/functions/cos.md new file mode 100644 index 000000000..2eb67a24f --- /dev/null +++ b/docs/functions/cos.md @@ -0,0 +1,25 @@ +# cos + +Calculates the cosine of an angle that is entered in radians. + +```javascript +cos(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | The angle, in radians, for which to calculate the cosine | + +## Cosine of 0.3 + +```javascript +cos(0.3) +``` + +### Expected Result: 0.955336489126 diff --git a/docs/functions/createdate.md b/docs/functions/createdate.md new file mode 100644 index 000000000..138de4d3f --- /dev/null +++ b/docs/functions/createdate.md @@ -0,0 +1,30 @@ +# createDate + +Creates a date/time object + +```javascript +createDate(year, month, day) +``` + +```javascript +returns date +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| year | numeric | Yes | | Integer in the range 0-9999. When in the range 0-29, year is converted to 2000-2029. When in the range 30-99, year is converted to 1930-1999. You cannot specify dates before AD 100. | +| month | numeric | Yes | | Numeric month of the year (1-12) | +| day | numeric | Yes | | Day of the month | + +## Output timestamp from date/time object + +```javascript + + yourDate = createDate("2015","12","09"); + writeOutput(yourDate); + +``` + +### Expected Result: {ts '2015-12-09 00:00:00'} diff --git a/docs/functions/createdatetime.md b/docs/functions/createdatetime.md new file mode 100644 index 000000000..ad90e6900 --- /dev/null +++ b/docs/functions/createdatetime.md @@ -0,0 +1,31 @@ +# createDateTime + +Creates a date-time object. + +```javascript +createDateTime(year, month, day, hour, minute, second) +``` + +```javascript +returns date +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| year | numeric | Yes | | Integer in the range 0-9999. When in the range 0-29, year is converted to 2000-2029. When in the range 30-99, year is converted to 1930-1999. You cannot specify dates before AD 100. | +| month | numeric | Yes | 1 | Numeric month of the year (1-12). | +| day | numeric | Yes | 1 | Day of the month. | +| hour | numeric | Yes | 0 | Hour of the day in 24-hour notation (0-23). | +| minute | numeric | Yes | 0 | Minute within the hour. | +| second | numeric | Yes | 0 | Second within the minute. | +| millisecond | numeric | No | 0 | CF2021+ or Lucee4.5+ Only | +| timezone | numeric | No | | Lucee4.5+ | + +## Tag Syntax + +```javascript + + +``` diff --git a/docs/functions/createdynamicproxy.md b/docs/functions/createdynamicproxy.md new file mode 100644 index 000000000..62510c2c5 --- /dev/null +++ b/docs/functions/createdynamicproxy.md @@ -0,0 +1,28 @@ +# createDynamicProxy + +Creates a dynamic proxy of the ColdFusion component that is passed to a Java library. Dynamic proxy lets you pass ColdFusion components to Java objects. Java objects can work with the ColdFusion components seamlessly as if they are native Java objects. + +```javascript +createDynamicProxy(cfc, interfaces) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| cfc | any | Yes | | Fully qualified name of the ColdFusion component or a CFC instance. | +| interfaces | array | Yes | | An array of Java interfaces for which you want to create the dynamic proxy. | + +## Tag Syntax + +```javascript + + + + + #y# +``` diff --git a/docs/functions/createencryptedjwt.md b/docs/functions/createencryptedjwt.md new file mode 100644 index 000000000..ed1a8ff52 --- /dev/null +++ b/docs/functions/createencryptedjwt.md @@ -0,0 +1,19 @@ +# createEncryptedJWT + +Create an encrypted JWT (JSON Web Encryption - JWE) + +```javascript +createEncryptedJWT(payload, encryptOptions, config) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| payload | any | Yes | | The payload as a string or struct. | +| encryptOptions | struct | Yes | | Encrypt using the key information from given struct | +| config | struct | Yes | | A struct with the following values:
- algorithm : algorithm used for signing.
- encryption : algorithm used for encrypting the payload.
- generateIssuedAt : boolean to indicate whether to generate "iat" field
- generateJti : boolean to indicate whether to generate "jti" field | diff --git a/docs/functions/createguid.md b/docs/functions/createguid.md new file mode 100644 index 000000000..99d6de451 --- /dev/null +++ b/docs/functions/createguid.md @@ -0,0 +1,17 @@ +# createGUID + +Creates a globally unique identifier (32 character hexadecimal string) + +```javascript +createGUID() +``` + +```javascript +returns guid +``` + +## Creates a Globally Unique Identifier (GUID). Each GUID will be unique + +```javascript +createGUID() +``` diff --git a/docs/functions/createobject.md b/docs/functions/createobject.md new file mode 100644 index 000000000..34657542c --- /dev/null +++ b/docs/functions/createobject.md @@ -0,0 +1,64 @@ +# createObject + +The createObject function takes different arguments depending on the value of the type argument: + + createObject('component', cfcName) + createObject('java', class) + createObject('java', class, bundleName, bundleVersion) (Lucee only) + createObject('webservice', urltowsdl, [, portname]) + createObject('.NET', class, assembly [, server, port, protocol, secure]) + createObject('com', class, context, serverName) + +```javascript +createObject(type, className) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | | The type of object | +| className | string | Yes | | | +| context | string | Yes | | | +| locale | string | Yes | | | +| servername | string | Yes | | | +| component_name | string | Yes | | | +| urltowsdl | string | Yes | | WSDL file URL; location of web service | +| portname | string | No | | The port name for the web service. This value is case-sensitive
and corresponds to the port element's name attribute under the
service element.
Specify this parameter if the web service contains multiple ports.
If no port name is specified, ColdFusion uses the first port found
in the WSDL. | +| bundleName | string | No | | Bundle where the object has to be located | +| bundleVersion | string | No | | Specific version to | + +## Create a CFC / Component Instance + +createObject Component + +```javascript + + tellTimeCFC=createObject("component","appResources.components.tellTime"); + tellTimeCFC.getLocalTime(); + +``` + +## Create a SOAP WebService Instance + +createObject WebService + +```javascript + + ws = createObject("webservice", "http://www.xmethods.net/sd/2001/TemperatureService.wsdl"); + xlatstring = ws.getTemp(zipcode = "55987"); + writeOutput("The temperature at 55987 is " & xlatstring); + +``` + +## Create a java class with specified bundle and version + +createObject filesystem + +```javascript +POIFSFileSystem=createObject("java","org.apache.poi.poifs.filesystem.POIFSFileSystem","apache.poi","3.11.0"); +``` diff --git a/docs/functions/createodbcdate.md b/docs/functions/createodbcdate.md new file mode 100644 index 000000000..4c35d02c1 --- /dev/null +++ b/docs/functions/createodbcdate.md @@ -0,0 +1,35 @@ +# createODBCDate + +Creates an ODBC date object. + +```javascript +createODBCDate(date) +``` + +```javascript +returns date +``` + +## Member Function Syntax + +```javascript +date.createODBCDate() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | Date or date/time object. | + +## Creates an ODBC date object + +Uses the createODBCDate function to create an ODBC date object + +```javascript + + +#result# +``` + +### Expected Result: {d '2012-12-12'} diff --git a/docs/functions/createodbcdatetime.md b/docs/functions/createodbcdatetime.md new file mode 100644 index 000000000..7c77fc42a --- /dev/null +++ b/docs/functions/createodbcdatetime.md @@ -0,0 +1,35 @@ +# createODBCDateTime + +Creates an ODBC date-time object. + +```javascript +createODBCDateTime(date) +``` + +```javascript +returns date +``` + +## Member Function Syntax + +```javascript +date.createODBCDateTime() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | Date or date/time object or string. | + +## Creates an ODBC date-time object + +Uses the CreateODBCDateTime function to create an ODBC date-time object + +```javascript + + +#result# +``` + +### Expected Result: {ts '2012-12-12 12:12:12'} diff --git a/docs/functions/createodbctime.md b/docs/functions/createodbctime.md new file mode 100644 index 000000000..544aa5ebf --- /dev/null +++ b/docs/functions/createodbctime.md @@ -0,0 +1,35 @@ +# createODBCTime + +Creates an ODBC time object. + +```javascript +createODBCTime(date) +``` + +```javascript +returns date +``` + +## Member Function Syntax + +```javascript +date.createODBCTime() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | Date or date/time object. | + +## Creates an ODBC time object + +Uses the CreateODBCTime function to create an ODBC time object + +```javascript + + +#result# +``` + +### Expected Result: {t '12:12:12'} diff --git a/docs/functions/createsignedjwt.md b/docs/functions/createsignedjwt.md new file mode 100644 index 000000000..10c5a0da6 --- /dev/null +++ b/docs/functions/createsignedjwt.md @@ -0,0 +1,19 @@ +# createSignedJWT + +Create a signed JWT (JSON Web Signature - JWS) + +```javascript +createSignedJWT(payload, signOptions, config) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| payload | any | Yes | | The payload as a string or struct. | +| signOptions | struct | Yes | | Create the signature using the key information from the given struct | +| config | struct | Yes | | A struct with the following values:
- algorithm : algorithm used for signing.
- generateIssuedAt : boolean to indicate whether to generate "iat" field
- generateJti : boolean to indicate whether to generate "jti" field | diff --git a/docs/functions/createtime.md b/docs/functions/createtime.md new file mode 100644 index 000000000..142f61580 --- /dev/null +++ b/docs/functions/createtime.md @@ -0,0 +1,28 @@ +# createTime + + Creates a time variable. + +```javascript +createTime(hour, minute, second) +``` + +```javascript +returns date +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| hour | numeric | Yes | | Hour of the day in 24-hour notation (0-23) | +| minute | numeric | Yes | 0 | Minute within the hour | +| second | numeric | Yes | 0 | Second within the minute | +| millisecond | numeric | No | 0 | | +| timezone | numeric | No | | | + +## Tag Syntax + +```javascript + + +``` diff --git a/docs/functions/createtimespan.md b/docs/functions/createtimespan.md new file mode 100644 index 000000000..bc1130d43 --- /dev/null +++ b/docs/functions/createtimespan.md @@ -0,0 +1,52 @@ +# createTimespan + +Returns a value that defines a time period, represented by a numeric (double) where 1 equals 1 day. You can add or subtract it from other date/time objects and use it with the cachedWithin attribute of cfquery. + +```javascript +createTimespan(days, hours, minutes, seconds) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| days | numeric | Yes | | The number of days ranging from 0 to 32768 | +| hours | numeric | Yes | | The number of hours | +| minutes | numeric | Yes | | The number of minutes | +| seconds | numeric | Yes | | The number of seconds | + +## Use of createTimespan in a cfquery + +The createTimespan function is useful in the cachedwithin attribute of cfquery. + +```javascript + + SELECT PARKNAME, REGION, STATE + FROM Parks + ORDER by ParkName, State + +``` + +## The createTimespan function returns a numeric value + +Passing 6 hours, or a quarter of a day returns a double representing 1/4 + +```javascript +createTimespan(0, 6, 0, 0) +``` + +### Expected Result: 0.25 + +## Adding a date and a timestamp + +Instead of using dateAdd you could add a timestamp to a date object + +```javascript +dateFormat( createDate(2017,1,1) + createTimespan(2,0,0,0) ) +``` + +### Expected Result: 03-Jan-17 diff --git a/docs/functions/createuniqueid.md b/docs/functions/createuniqueid.md new file mode 100644 index 000000000..07d4acec3 --- /dev/null +++ b/docs/functions/createuniqueid.md @@ -0,0 +1,17 @@ +# createUniqueID + +Creates a Unique Identifier for the current instance. If you want it to be Universal Unique use createUUID instead. + +```javascript +createUniqueID() +``` + +```javascript +returns string +``` + +## Creates a Unique Identifier. Each identifier will be unique + +```javascript +createUniqueID() +``` diff --git a/docs/functions/createuuid.md b/docs/functions/createuuid.md new file mode 100644 index 000000000..356702c86 --- /dev/null +++ b/docs/functions/createuuid.md @@ -0,0 +1,19 @@ +# createUUID + +Creates a Universally Unique Identifier (UUID). A UUID is a 35-character string representation of a unique 128-bit integer + xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx : x is a hexadecimal digit (8-4-4-16). + SQL Server UUIDs are similar but have a format of 8-4-4-4-12. + +```javascript +createUUID() +``` + +```javascript +returns uuid +``` + +## Creates a Universally Unique Identifier (UUID). Each UUID will be unique + +```javascript +createUUID() +``` diff --git a/docs/functions/csrfgeneratetoken.md b/docs/functions/csrfgeneratetoken.md new file mode 100644 index 000000000..39fbe6d1d --- /dev/null +++ b/docs/functions/csrfgeneratetoken.md @@ -0,0 +1,62 @@ +# csrfGenerateToken + +Generates a random token and stores it in the session to protect against Cross-Site Request Forgery (CSRF) attacks. You can optionally provide a specific key to store in the session, and optionally force the generation of a new token. + +```javascript +csrfGenerateToken( [key] [,forceNew] ) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| key | string | No | | A random token is generated based on the key provided. This key is stored in the session. | +| forceNew | boolean | No | false | If set to true, a new token is generated every time the method is called. If false, and in the case where a token already exists [for the key], the same key is returned. | + +## CSRF Form Protection + +Use csrfGenerateToken() to generate a unique token for each form submission. + +```javascript +
+ + + + + +
+``` + +## CSRF Form Protection w/ specified key + +Use csrfGenerateToken() to generate a unique token for each form submission. This example specifies a key to store the token into the session with. + +```javascript +
+ + + + + +
+``` + +## CSRF Form Protection w/ automated key generation + +Use csrfGenerateToken() to generate a unique token for each form submission. This example specifies a key automatically to store the token into the session with (for multiple open browser tabs). + +```javascript + +
+ + + + + + +
+``` diff --git a/docs/functions/csrfverifytoken.md b/docs/functions/csrfverifytoken.md new file mode 100644 index 000000000..f8fffe092 --- /dev/null +++ b/docs/functions/csrfverifytoken.md @@ -0,0 +1,76 @@ +# csrfVerifyToken + +Validates the passed in token against the token stored in the session for a specific key. Used to help prevent Cross-Site Request Forgery (CSRF) attacks. + +```javascript +csrfVerifyToken( token [,key] ) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| token | string | Yes | | The passed in token that is to be validated against the token stored in the session. For Adobe Coldfusion, only the first 40 characters of the passed in token are used to verify. | +| key | string | No | | The key against which the token was originally generated. | + +## CSRF Form Validation + +Use csrfVerifyToken() to Verify a unique token for each form submission. + +```javascript + + param name="FORM[ 'f' & hash( 'userId', 'SHA-384', 'UTF-8', 1000 )]" default="0"; + param name="FORM[ 'f' & hash( 'formToken', 'SHA-512', 'UTF-8', 500 )]" default="0"; + param name="FORM.emailAddress" default=""; + param name="FORM.phoneNumber" default=""; + + if( !csrfVerifyToken( FORM[ 'f' & hash( 'formToken', 'SHA-512', 'UTF-8', 500 )] ) + ) { + // formToken is not a valid token + // redirect user to login form (etc.) + } + +``` + +## CSRF Form Validation w/ specified key + +Use csrfVerifyToken() to Verify a unique token for each form submission. + +```javascript + + param name="FORM[ 'f' & hash( 'userId', 'SHA-384', 'UTF-8', 1000 )]" default="0"; + param name="FORM[ 'f' & hash( 'formToken', 'SHA-512', 'UTF-8', 500 )]" default="0"; + param name="FORM.emailAddress" default=""; + param name="FORM.phoneNumber" default=""; + + if( !csrfVerifyToken( FORM[ 'f' & hash( 'formToken', 'SHA-512', 'UTF-8', 500 )], 'profile' ) + ) { + // formToken is not a valid token + // redirect user to login form (etc.) + } + +``` + +## CSRF Form Validation w/ automated key validation + +Use csrfVerifyToken() to Verify a unique token with a unique session variable for each form submission (for multiple open browser tabs). + +```javascript + + param name="FORM[ 'f' & hash( 'userId', 'SHA-384', 'UTF-8', 1000 )]" default="0"; + param name="FORM[ 'f' & hash( 'tokenVar', 'SHA-512', 'UTF-8', 500 )]" default="0"; + param name="FORM[ 'f' & hash( 'formToken', 'SHA-512', 'UTF-8', 500 )]" default="0"; + param name="FORM.emailAddress" default=""; + param name="FORM.phoneNumber" default=""; + + if( !csrfVerifyToken( FORM[ 'f' & hash( 'formToken', 'SHA-512', 'UTF-8', 500 )], FORM[ 'f' & hash( 'tokenVar', 'SHA-512', 'UTF-8', 500 )] ) + ) { + // formToken is not a valid token + // redirect user to login form (etc.) + } + +``` diff --git a/docs/functions/ctcacheclear.md b/docs/functions/ctcacheclear.md new file mode 100644 index 000000000..3a73b41ac --- /dev/null +++ b/docs/functions/ctcacheclear.md @@ -0,0 +1,11 @@ +# ctCacheClear + +Flushes the customtag path cache + +```javascript +ctCacheClear() +``` + +```javascript +returns void +``` diff --git a/docs/functions/ctcachelist.md b/docs/functions/ctcachelist.md new file mode 100644 index 000000000..14fb5aaa1 --- /dev/null +++ b/docs/functions/ctcachelist.md @@ -0,0 +1,11 @@ +# ctCacheList + +Get elements in the customtag path cache + +```javascript +ctCacheList() +``` + +```javascript +returns struct +``` diff --git a/docs/functions/datasourceflushmetacache.md b/docs/functions/datasourceflushmetacache.md new file mode 100644 index 000000000..990b1a489 --- /dev/null +++ b/docs/functions/datasourceflushmetacache.md @@ -0,0 +1,18 @@ +# datasourceFlushMetacache + +Flush the meta data stored for a certain datasource used for stored procedures. + NOTE: This is only supported for Oracle datasources. + +```javascript +datasourceFlushMetacache([datasourceName]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datasourceName | string | No | | Name of the datasource to flush. When not defined all caches are flushed. | diff --git a/docs/functions/dateadd.md b/docs/functions/dateadd.md new file mode 100644 index 000000000..c5c479940 --- /dev/null +++ b/docs/functions/dateadd.md @@ -0,0 +1,65 @@ +# dateAdd + +Adds units of time to a date. + +```javascript +dateAdd(datepart, number, date) +``` + +```javascript +returns date +``` + +## Member Function Syntax + +```javascript +date.add(datepart, number) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datepart | string | Yes | | `yyyy` - Year
`q` - Quarter
`m` - Month
`y` - Day of year
`d` - Day
`w` - Week day
`ww` - Week
`h` - Hour
`n` - Minute
`s` - Second
`l` - Millisecond | +| number | numeric | Yes | | The number of datepart units to add to the provided date.
Number must be an integer.
Negative integers move the date into the past, positive into the future. | +| date | date | Yes | | A datetime object in the range of 100AD-9999AD.
NOTE: When passing a datetime object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a datetime object. | + +## Add Days to a Date + +Add 30 days to August 3rd, 2014. + +```javascript +dateAdd('d', 30, '8/3/2014') +``` + +### Expected Result: {ts '2014-09-02 00:00:00'} + +## Subtract Days from a Date + +Subtract 30 days from August 3rd, 2014. + +```javascript +dateAdd('d', -30, '8/3/2014') +``` + +### Expected Result: {ts '2014-07-04 00:00:00'} + +## Add Weeks to a Date + +Here we're adding 8 weeks to the date August 3rd, 2014. + +```javascript +dateAdd('ww', 8, '8/3/2014') +``` + +### Expected Result: {ts '2014-09-28 00:00:00'} + +## Add Days to a Date (Member Function) + +Here we're adding 1 day to the current date/time. + +```javascript +createDate( 2022, 10, 1 ).add( 'd', 1 ) +``` + +### Expected Result: {ts '2022-10-02 00:00:00'} diff --git a/docs/functions/datecompare.md b/docs/functions/datecompare.md new file mode 100644 index 000000000..ae62bf5fe --- /dev/null +++ b/docs/functions/datecompare.md @@ -0,0 +1,57 @@ +# dateCompare + +Performs a full date/time comparison of two dates. + `-1` if date1 is less than date2 + `0` if date1 is equal to date2 + `1` if date1 is greater than date2 + [DatePart] `yyyy`: Year; `m`: Month; `d`: Day; `h`: Hour; `n`: Minute; `s`: Second + +```javascript +dateCompare(date1, date2 [, datePart]) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date1.compare(date2 [, datePart]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| date1 | date | Yes | | A date to compare | | +| date2 | date | Yes | | Another date to compare | | +| datePart | string | No | s | | /Users/garethedwards/development/github/cfdocs/docs/functions/datecompare.md|s | + +## Compare Two Dates by Year + +```javascript +dateCompare('12/30/2015', '12/02/2015', 'yyyy') +``` + +### Expected Result: 0 + +## Compare Two Dates by Day + +Returns 1 because date1 is greater than date 2 + +```javascript +dateCompare('12/30/2015', '12/02/2015', 'd') +``` + +### Expected Result: 1 + +## Member function example + +```javascript +d1 = createDate("2024","01","01"); +d2 = createDate("2024","02","14"); +d1.compare(d2) +``` + +### Expected Result: -1 diff --git a/docs/functions/dateconvert.md b/docs/functions/dateconvert.md new file mode 100644 index 000000000..956746d48 --- /dev/null +++ b/docs/functions/dateconvert.md @@ -0,0 +1,38 @@ +# dateConvert + +Converts local time to Coordinated Universal Time (UTC), or UTC to local time. The function uses the daylight savings settings in the executing computer to compute daylight savings time, if required. + +```javascript +dateConvert(conversionType, date) +``` + +```javascript +returns date +``` + +## Member Function Syntax + +```javascript +date.convert(conversionType) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| conversionType | string | Yes | | `local2Utc` : Converts local time to UTC time.
`utc2Local` : Converts UTC time to local time. | +| date | date | Yes | | | + +## Converting Local to UTC + +```javascript +utc_datetime = dateConvert('local2Utc', now()); +``` + +## Converting UTC to Local + +This example makes sense only if your server time is UTC. now() uses your server settings when creating a datetime object. + +```javascript +local_datetime = dateConvert('utc2Local', now()); +``` diff --git a/docs/functions/datediff.md b/docs/functions/datediff.md new file mode 100644 index 000000000..dd3d8d3ba --- /dev/null +++ b/docs/functions/datediff.md @@ -0,0 +1,55 @@ +# dateDiff + +Determines the integer number of datepart units by which date1 is less than date2. + +```javascript +dateDiff(datepart, date1, date2) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date2.diff(datepart, date1) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datepart | string | Yes | | yyyy: Year
q: Quarter
m: Month
y: Day of year
d: Day
w: Week (Weekday cf2018+)
ww: Week
h: Hour
n: Minute
s: Second | +| date1 | date | Yes | | The smaller date to diff
Can be either a string or a date object whereas member function only accept the latter | +| date2 | date | Yes | | The bigger date to diff
Can be either a string or a date object whereas member function only accept the latter | + +## dateDiff Example + +Find the difference between two dates. + +```javascript +dateDiff("d", "2013-01-15", "2013-01-25") +``` + +### Expected Result: 10 + +## How old are they? + +Calculates a persons age based on a variable birthDate which contains a date. Uses the now function to get current date. + +```javascript +birthDate = createDate( 1972, 5, 20 ); +age = dateDiff('yyyy', birthDate, now()); +writeoutput( age ); +``` + +## dateDiff member function + +Note the different behavior between ColdFusion and Lucee. + +```javascript +testDate = now(); +diffDate = dateAdd('d', 1, testDate); +writeOutput(testDate.diff('d', diffDate)); // this returns 1 on Lucee, and -1 on ColdFusion +``` diff --git a/docs/functions/dateformat.md b/docs/functions/dateformat.md new file mode 100644 index 000000000..a758b1597 --- /dev/null +++ b/docs/functions/dateformat.md @@ -0,0 +1,56 @@ +# dateFormat + +Formats a date value using U.S. date formats. When formatting both date and time, use dateTimeFormat. For international date support, use lsDateFormat. + +```javascript +dateFormat(date [, mask]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +date.dateFormat([mask]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | The datetime object (100AD-9999AD) | +| mask | string | No | dd-mmm-yy | Each keyword below will be replaced in the string by its respective datepart:
-d: Day of the month as digits; no leading zero for single-digit days.
-dd: Day of the month as digits; leading zero for single-digit days.
-ddd: Day of the week as a three-letter abbreviation.
-dddd: Day of the week as its full name.
-e: Day in a week (CF2016u3+).
-f: Day of a week in a month (CF2016u3+).
-D: Day in year. (pre-CF2016u3)
-m: Month as digits; no leading zero for single-digit months.
-mm: Month as digits; leading zero for single-digit months.
-mmm: Month as a three-letter abbreviation.
-mmmm: Month as its full name.
-M: Month in year. (pre-CF2016u3)
-k: Hour in a day (CF2016u3+).
-W: Week in a month (CF2016u3+).
-w: Week in a year (CF2016u3+).
-yy: Year as last two digits; leading zero for years less than 10.
-yyyy,YYYY: Year represented by four digits.
-gg: Period/era string.
-z: Time zone in unstandardized abbreviated format, for example, `EST` (CF2016u3+).
-Z: Time zone in hours of offset (RFC 822 TimeZone), for example, `+0530` (CF2016u3+).
-X: Time zone in hours of offset in ISO 8601 format. (CF2016u3+).
-X: `+05`
-XX: `+0530`
-XXX: `+5:30`
The following keywords are shorthand for specific full formats and cannot be combined with other masks:
-short: equivalent to `m/d/y`
-medium: equivalent to `mmm d, yyyy`
-long: equivalent to `mmmm d, yyyy`
-full: equivalent to `dddd, mmmm d, yyyy` | + +## Using the short mask + +```javascript +dateFormat("2015-04-11", "short") +``` + +### Expected Result: 4/11/15 + +## Using the long mask + +```javascript +dateFormat("2015-04-11", "long") +``` + +### Expected Result: April 11, 2015 + +## Using the full mask + +```javascript +dateFormat("2015-04-11", "full") +``` + +### Expected Result: Saturday, April 11, 2015 + +## Using the member function + +```javascript +createDate( 2022, 10, 1 ).dateFormat( 'mm/dd/yyyy' ) +``` + +### Expected Result: 10/01/2022 diff --git a/docs/functions/datepart.md b/docs/functions/datepart.md new file mode 100644 index 000000000..e3477c712 --- /dev/null +++ b/docs/functions/datepart.md @@ -0,0 +1,49 @@ +# datePart + +Extracts a part from a datetime value as a numeric. + +```javascript +datePart(datepart, date [,timezone]) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.datePart(datepart) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datepart | string | Yes | | yyyy: Year
q: Quarter
m: Month
y: Day of year
d: Day
w: Weekday
ww: Week
h: Hour
n: Minute
s: Second
l: Millisecond | +| date | date | Yes | | Datetime object (100AD-9999AD). | +| timezone | string | No | Timezone Specified in Lucee Administrator | This is only available in Lucee.
A datetime object is independent of a specific timezone; it is only an offset in milliseconds from `1970-1-1 00.00:00 UTC`.
The timezone only comes into play when you need specific information like hours in a day, minutes in an hour or which day it is, as these calculations depend on the timezone.
A timezone must be specified in order to translate the date object to something else. If you do not provide the timezone in the function call, it will default to the timezone specified in the Lucee Administrator (Settings/Regional), or the timezone specified for the current request using the function `setTimezone()`. | + +## All dateparts + +This example shows information available from datePart + +```javascript + +

datePart Example

+

Today's date is #todayDate#. +

Using datePart, we extract an integer representing the dateparts from that value +

    +
  • year: #datePart("yyyy", todayDate)#
  • +
  • quarter: #datePart("q", todayDate)#
  • +
  • month: #datePart("m", todayDate)#
  • +
  • day of year: #datePart("y", todayDate)#
  • +
  • day: #datePart("d", todayDate)#
  • +
  • weekday: #datePart("w", todayDate)#
  • +
  • week: #datePart("ww", todayDate)#
  • +
  • hour: #datePart("h", todayDate)#
  • +
  • minute: #datePart("n", todayDate)#
  • +
  • second: #datePart("s", todayDate)#
  • +
+ +``` diff --git a/docs/functions/datetimeformat.md b/docs/functions/datetimeformat.md new file mode 100644 index 000000000..03e0127e0 --- /dev/null +++ b/docs/functions/datetimeformat.md @@ -0,0 +1,85 @@ +# dateTimeFormat + +Formats a datetime value using U.S. date and time formats. For international date support, use lsDateTimeFormat. + +```javascript +dateTimeFormat(date [, mask [, timezone]]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +datetime.dateTimeFormat([mask [, timezone]]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | The datetime object (100AD-9999AD).
NOTE: This parameter is named `datetime` in Lucee. | +| mask | string | No | dd-mmm-yyyy HH:nn:ss | The mask used to format the datetime output.
- d : Day of the month as digits; no leading zero for single-digit days.
- dd : Day of the month as digits; leading zero for single-digit days.
- EEE : Day of the week as a three-letter abbreviation.
- EEEE : Day of the week as its full name.
- m : Month as digits; no leading zero for single-digit months.
- mm : Month as digits; leading zero for single-digit months.
- mmm : Month as a three-letter abbreviation. (Dec)
- mmmm : Month as its full name.
- M : Month in year. (pre-CF2016u3)
- D : Day in year. (pre-CF2016u3)
- yy : Year as last two digits; leading zero for years less than 10.
- yyyy : Year represented by four digits.
- YYYY : Week year represented by four digits. (pre-CF2016u3)
- Y : Week year. (pre-CF2016u3)
- YY : Week Year as last two digits; leading zero for years less than 10. (pre-CF2016u3)
- G : Period/era string. (e.g. BC/AD)
- h : hours; no leading zero for single-digit hours. (12-hour clock)
- hh : hours; leading zero for single-digit hours. (12-hour clock)
- H : hours; no leading zero for single-digit hours. (24-hour clock)
- HH : hours; leading zero for single-digit hours. (24-hour clock)
- n : minutes; no leading zero for single-digit minutes.
- nn : minutes; leading zero for single-digit minutes.
- s : seconds; no leading zero for single-digit seconds.
- ss : seconds; leading zero for single-digit seconds.
- l or L : milliseconds, with no leading zeros.
- t : one-character time marker string, such as A or P.
- tt : multiple-character time marker string, such as AM or PM.
- w : Week of the year as digit. (JDK7+)
- ww : Week of the year as digits; leading zero for single-digit week. (JDK7+)
- W : Week of the month as digit. (JDK7+)
- WW : Week of the month as digits; leading zero for single-digit week. (JDK7+)

The following masks tell how to format the full date and time and cannot be combined with other masks:
- `short` : equivalent to `"m/d/y h:nn tt"`
- `medium` : equivalent to `"mmm d, yyyy h:nn:ss tt"`
- `long` : `medium` with full month name rather than abbreviation, followed by three-letter time zone; as in, `"mmmm d, yyyy h:mm:ss tt EST"`
- `full` : equivalent to `"EEEE, mmmm d, yyyy h:mm:ss tt EST"`
- `iso` CF2016+ Lucee5.3.8+ Formats the date time in ISO8601 format
- `iso8601` Lucee4.5+ Formats the date time in ISO8601 format

The function also follows Java date time mask, except for mask "a". For more information, refer to Date and Time Patterns topic in `SimpleDateFormat` Java API page.

JDK7 and JDK8 introduces the masks "w", "ww", "W", and "WW". | +| timezone | string | No | System time-zone | The timezone to use. Can be the 3 letter code ("EST","UTC") or the full name full {"America/New_York") | + +## Mask = Short Example + +On Lucee with Java 11 adds a comma after year bug: LDEV-3744 + +```javascript +dateTimeFormat("2015-04-11 19:02", "short") +``` + +### Expected Result: 4/11/15 7:02 PM + +## Mask = Medium Example + +On Lucee with Java 11 adds a comma after year bug: LDEV-3744 + +```javascript +dateTimeFormat("2015-04-11 19:02", "medium") +``` + +### Expected Result: Apr 11, 2015 7:02:00 PM + +## Mask = Long Example + +On Lucee with Java 11 adds at before the time bug: LDEV-3744 + +```javascript +dateTimeFormat("2015-04-11 19:02", "long") +``` + +### Expected Result: April 11, 2015 7:02:00 PM UTC + +## Mask = Full Example + +On Lucee with Java 11 adds at before the time bug: LDEV-3744 + +```javascript +dateTimeFormat("2015-04-11 19:02", "full") +``` + +### Expected Result: Saturday, April 11, 2015 7:02:00 PM UTC + +## Date Time Format in ISO 8601 + +Uses the CF2016+ `iso` or the Lucee4.5+ `iso8601` format depending on the engine. Note the depending on Java version the timezone format may differ (on Lucee at least, possible due to LDEV-3744) + +```javascript +dateTimeFormat("2015-04-11 19:02", (server.keyExists("lucee")) ? "iso8601" : "iso") +``` + +### Expected Result: 2015-04-11T19:02:00+0000 + +## Date Time Format member function syntax + +Simple date/time formatting using the member function syntax + +```javascript +createDateTime( 2022, 10, 1, 9, 30, 0 ).dateTimeFormat( 'mm/dd/yyyy hh:nn:ss tt' ) +``` + +### Expected Result: 10/01/2022 09:30:00 AM diff --git a/docs/functions/day.md b/docs/functions/day.md new file mode 100644 index 000000000..b7e4a6a09 --- /dev/null +++ b/docs/functions/day.md @@ -0,0 +1,46 @@ +# day + + Determines the day of the month, in a date. + The ordinal for the day of the month, ranging from 1 to 31. + +```javascript +day(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.day() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | Date or datetime object (100AD-9999AD).
When passing a datetime object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a datetime object. | + +## Determines the day of the month + +Uses the day function to determine the day of the month + +```javascript + + +#result# +``` + +### Expected Result: 8 + +## Day using member syntax + +Returns the day from a datetime object + +```javascript +createDate( 2022, 10, 1 ).day(); +``` + +### Expected Result: 1 diff --git a/docs/functions/dayofweek.md b/docs/functions/dayofweek.md new file mode 100644 index 000000000..f42644516 --- /dev/null +++ b/docs/functions/dayofweek.md @@ -0,0 +1,36 @@ +# dayOfWeek + +Determines the day of the week from a date. Returns the ordinal for the day of the week, as an integer in the range 1 (Sunday) to 7 (Saturday). + +```javascript +dayOfWeek(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.dayOfWeek() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| date | date | Yes | | Date or datetime object (100AD-9999AD).
When passing a datetime object as a string, enclose it in quotation marks. Otherwise, it is interpreted as a numeric representation of a datetime object. | | +| calendar | string | No | gregorian | CF2016u8+ Indicates whether the week starts on Sunday (gregorian) or Monday (iso) | /Users/garethedwards/development/github/cfdocs/docs/functions/dayofweek.md|iso | + +## Determines the day of the week + +Uses the dayOfWeek function to determine the day of the week + +```javascript + + +#result# +``` + +### Expected Result: 4 diff --git a/docs/functions/dayofweekasstring.md b/docs/functions/dayofweekasstring.md new file mode 100644 index 000000000..3a42105d5 --- /dev/null +++ b/docs/functions/dayofweekasstring.md @@ -0,0 +1,26 @@ +# dayOfWeekAsString + + Determines the day of the week as a string from 1-7 + +```javascript +dayOfWeekAsString(dayOfWeek [, locale]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| dayOfWeek | numeric | Yes | | Only values from 1 to 7 are valid.
Week starting with 1 for Sunday and ends with 7 for Saturday:
- 1 = Sunday
- 2 = Monday
- 3 = Tuesday
- 4 = Wednesday
- 5 = Thursday
- 6 = Friday
- 7 = Saturday | +| locale | string | No | Default JVM Locale | Locale to use instead of the default JVM locale. | + +## Get Sunday + +```javascript +dayOfWeekAsString(1) +``` + +### Expected Result: Sunday diff --git a/docs/functions/dayofweekshortasstring.md b/docs/functions/dayofweekshortasstring.md new file mode 100644 index 000000000..dc3489143 --- /dev/null +++ b/docs/functions/dayofweekshortasstring.md @@ -0,0 +1,34 @@ +# dayOfWeekShortAsString + +Returns the first three letters of the day of the week passed to the function + +```javascript +dayOfWeekShortAsString(day_of_week [, locale]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| day_of_week | numeric | Yes | | Only values from 1 to 7 are valid.
Week starting with 1 for Sunday and ends with 7 for Saturday. | +| locale | string | No | | | + +## Get Sunday + +```javascript +dayOfWeekShortAsString(1) +``` + +### Expected Result: Sun + +## Get Sunday with french locale + +```javascript +dayOfWeekShortAsString(1,"fr") +``` + +### Expected Result: dim. diff --git a/docs/functions/dayofyear.md b/docs/functions/dayofyear.md new file mode 100644 index 000000000..039d7a5d1 --- /dev/null +++ b/docs/functions/dayofyear.md @@ -0,0 +1,35 @@ +# dayOfYear + + Determines the day of the year, in a date. + +```javascript +dayOfYear(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.dayOfYear() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | Date or datetime object (100AD-9999AD). | + +## Determines the day of the year + +Uses the dayOfYear function to determine the day of the year + +```javascript + + +#result# +``` + +### Expected Result: 365 diff --git a/docs/functions/daysinmonth.md b/docs/functions/daysinmonth.md new file mode 100644 index 000000000..e6eaa6e34 --- /dev/null +++ b/docs/functions/daysinmonth.md @@ -0,0 +1,47 @@ +# daysInMonth + + Determines the number of days in a month. + +```javascript +daysInMonth(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.daysInMonth() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | Date or datetime object (100AD-9999AD).
When passing a datetime object as a string, enclose it in quotation marks, otherwise, it is interpreted as a numeric representation of a datetime object. | + +## Determines the number of days in a month + +Uses the daysInMonth function to determine the number of days in a month + +```javascript + + +#result# +``` + +### Expected Result: 31 + +## Simple example + +To determine the number of days in a month + +```javascript + + +#result# +``` + +### Expected Result: 29 diff --git a/docs/functions/daysinyear.md b/docs/functions/daysinyear.md new file mode 100644 index 000000000..9906bea25 --- /dev/null +++ b/docs/functions/daysinyear.md @@ -0,0 +1,47 @@ +# daysInYear + + Determines the number of days in a year. + +```javascript +daysInYear(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.daysInYear() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | Date or datetime object (100AD-9999AD). | + +## Simple example + +Uses the daysInYear function to determine the number of days in a year + +```javascript + + +#result# +``` + +### Expected Result: 365 + +## Simple example with leap year + +To determine the number of days in a year + +```javascript + + +#result# +``` + +### Expected Result: 366 diff --git a/docs/functions/dbpoolclear.md b/docs/functions/dbpoolclear.md new file mode 100644 index 000000000..3311acf7a --- /dev/null +++ b/docs/functions/dbpoolclear.md @@ -0,0 +1,33 @@ +# dbpoolclear + +clears all existing datasource connection + +```javascript +dbPoolClear([, string]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datasource | string | No | | specific datasource to clear, if not set all datasources get removed. | + +## dbPoolClear Example + +Clear all existing datasource connections + +```javascript +dbPoolClear(); +``` + +## dbPoolClear Example + +Clear a named datasource connection + +```javascript +dbPoolClear(mydatasource); +``` diff --git a/docs/functions/de.md b/docs/functions/de.md new file mode 100644 index 000000000..091b93862 --- /dev/null +++ b/docs/functions/de.md @@ -0,0 +1,25 @@ +# de + +Delay evaluation of a string as an expression, when it is passed as a parameter to the IIf or Evaluate functions. Escapes any double quotation marks in the parameter and wraps the result in double quotation marks. It does not escape `#` so the string could still be evaluated in some cases. + +```javascript +de(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | + +## Simple Example + +```javascript +de("pete") +``` + +### Expected Result: "pete" diff --git a/docs/functions/decimalformat.md b/docs/functions/decimalformat.md new file mode 100644 index 000000000..dfea536da --- /dev/null +++ b/docs/functions/decimalformat.md @@ -0,0 +1,33 @@ +# decimalFormat + +Converts a number to a decimal-formatted string. + +```javascript +decimalFormat(number) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Formatting examples + +```javascript +formattedInt = decimalFormat(123); // 123.00 +writeOutput(formattedInt & "
"); + +formattedWithSeparators = decimalFormat(1000000); // 1,000,000.00 +writeOutput(formattedWithSeparators & "
"); + +formattedDecimal = decimalFormat(987.15); // 987.15 +writeOutput(formattedDecimal & "
"); + +formattedRoundedUp = decimalFormat(456.789); // 456.79 - rounds up +writeOutput(formattedRoundedUp & "
"); +``` diff --git a/docs/functions/decodeforhtml.md b/docs/functions/decodeforhtml.md new file mode 100644 index 000000000..dcc7e177a --- /dev/null +++ b/docs/functions/decodeforhtml.md @@ -0,0 +1,33 @@ +# decodeForHTML + + Decodes an HTML encoded string. + +```javascript +decodeForHTML(string); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The encoded string to decode. | + +## Tag Syntax + +```javascript + + + Output:#decodeForHTML(form.encodedUserName)# + + + + + + + + +``` diff --git a/docs/functions/decodefromurl.md b/docs/functions/decodefromurl.md new file mode 100644 index 000000000..ac1a74415 --- /dev/null +++ b/docs/functions/decodefromurl.md @@ -0,0 +1,30 @@ +# decodeFromURL + + Decodes an encoded HTML URL string. + +```javascript +decodeFromURL(string); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The encoded URL string to decode.. | + +## Tag Syntax + +```javascript + + + + +String: #string#
+URL Encoded: #urlencoded#
+URL Decoded: #urldecoded#
+
+``` diff --git a/docs/functions/decrementvalue.md b/docs/functions/decrementvalue.md new file mode 100644 index 000000000..1b0e8dc2c --- /dev/null +++ b/docs/functions/decrementvalue.md @@ -0,0 +1,33 @@ +# decrementValue + +Decrements the integer part of a number. Same as x=x-1 or x-- + +```javascript +decrementValue(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Decrement 7 + +```javascript +decrementValue(7) +``` + +### Expected Result: 6 + +## Decrement 7.5 + +There is a difference between CFML engines. ACF will return the integer decremented removing the decimal part, returns 6. Lucee will decrement the integer part but return both, returns 6.5. + +```javascript +decrementValue(7.5) +``` diff --git a/docs/functions/decrypt.md b/docs/functions/decrypt.md new file mode 100644 index 000000000..d37b205dd --- /dev/null +++ b/docs/functions/decrypt.md @@ -0,0 +1,36 @@ +# decrypt + + Decrypts a string that is encrypted with the Encrypt function. + +```javascript +decrypt(string, key [, algorithm [, encoding] [, iv | salt [, iterations]]]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | Encrypted string to decrypt. | +| key | string | Yes | | Key or seed used to encrypt the string.
* For the `CFMX_COMPAT` algorithm, any combination of any number of characters; used as a seed used to generate a 32-bit encryption key.
* For all other algorithms, a key in the format used by the algorithm. For these algorithms, use the `GenerateSecretKey` function to generate the key. | +| algorithm | string | No | CFMX_COMPAT | The algorithm to use to decrypt the string. Must be the same as the algorithm used to encrypt the string. See the `encrypt` function for additional algorithms.
ColdFusion Standard Edition installs the following algorithms:
* CFMX_COMPAT: the algorithm used in ColdFusion MX and prior releases. This algorithm is the least secure option (default).
* AES: the Advanced Encryption Standard specified by the National Institute of Standards and Technology (NIST) FIPS-197.
* BLOWFISH: the Blowfish algorithm defined by Bruce Schneier.
* DES: the Data Encryption Standard algorithm defined by NIST FIPS-46-3.
* DESEDE: the "Triple DES" algorithm defined by NIST FIPS-46-3.

NOTE: ColdFusion Enterprise Edition installs RSA BSafe Crypto-J library, which provides FIPS-140 Compliant Strong Cryptography. This also includes:
* DESX: The extended Data Encryption Standard symmetric encryption algorithm.
* RC2: The RC2 block symmetric encryption algorithm defined by RFC 2268.
* RC4: The RC4 symmetric encryption algorithm.
* RC5: The RC5 encryption algorithm.
* PBE: Password-based encryption algorithm defined in PKCS #5.
* AES/GCM/NoPadding: Encryption algorithm.

NOTE: If you install additional cryptography algorithms, you can also specify any of its encryption and decryption algorithms. | +| encoding | string | No | UU | The binary encoding used to represent the data as a string. Must be the same as the algorithm used to encrypt the string.
* Base64: the Base64 algorithm, as specified by IETF RFC 2045.
* Hex: the characters A-F and 0-9 represent the hexadecimal byte values.
* UU: the UNIX standard UUEncode algorithm (default).

NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| iv | binary | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `SALT`.

Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.
* For Block Encryption Algorithms: This is the binary Initialization Vector value to use with the algorithm. The algorithm must contain a Feedback Mode other than ECB. This must be a binary value that is exactly the same size as the algorithm block size.
NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| salt | binary | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `IV`.

Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.
* For Password Based Encryption Algorithms: This is the binary Salt value to transform the password into a key.
NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| iterations | numeric | No | 0 | The number of iterations to transform the password into a binary key. Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.

NOTE: If you specify this parameter, you must also specify the `algorithm` parameter with a Password Based Encryption (PBE) algorithm.
NOTE: This parameter is used with the `salt` parameter. Do not specify this parameter for Block Encryption Algorithms.
NOTE: You must use the same value to encrypt and decrypt the data. | + +## Encrypt and Decrypt a Secret + +Generate an AES 128 bit key and then use it to encrypt and decrypt a secret. + +```javascript +ex={}; +ex.key = generateSecretKey("AES"); +ex.secret = "top secret"; +ex.encrypted=encrypt(ex.secret, ex.key, "AES", "Base64"); +ex.decrypted=decrypt(ex.encrypted, ex.key, "AES", "Base64"); +writeDump(ex); +``` diff --git a/docs/functions/decryptbinary.md b/docs/functions/decryptbinary.md new file mode 100644 index 000000000..3f50abb48 --- /dev/null +++ b/docs/functions/decryptbinary.md @@ -0,0 +1,23 @@ +# decryptBinary + +Decrypts encrypted binary data with the specified key, value, algorithm, salt, and iterations. + +```javascript +decryptBinary(binaryData, key [, algorithm [, encoding] [, iv | salt [, iterations]]]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| binaryData | string | Yes | | Binary data to decrypt. | +| key | string | Yes | | Key or seed used to encrypt the string.
* For the `CFMX_COMPAT` algorithm, any combination of any number of characters; used as a seed used to generate a 32-bit encryption key.
* For all other algorithms, a key in the format used by the algorithm. For these algorithms, use the `GenerateSecretKey` function to generate the key. | +| algorithm | string | No | CFMX_COMPAT | The algorithm to use to decrypt the string. Must be the same as the algorithm used to encrypt the string. See the `encrypt` function for additional algorithms.
ColdFusion Standard Edition installs the following algorithms:
* CFMX_COMPAT: the algorithm used in ColdFusion MX and prior releases. This algorithm is the least secure option and not recommended. (default).
* AES: the Advanced Encryption Standard specified by the National Institute of Standards and Technology (NIST) FIPS-197.
* BLOWFISH: the Blowfish algorithm defined by Bruce Schneier.
* DES: the Data Encryption Standard algorithm defined by NIST FIPS-46-3.
* DESEDE: the "Triple DES" algorithm defined by NIST FIPS-46-3.

NOTE: ColdFusion Enterprise Edition installs RSA BSafe Crypto-J library, which provides FIPS-140 Compliant Strong Cryptography. This also includes:
* DESX: The extended Data Encryption Standard symmetric encryption algorithm.
* RC2: The RC2 block symmetric encryption algorithm defined by RFC 2268.
* RC4: The RC4 symmetric encryption algorithm.
* RC5: The RC5 encryption algorithm.
* PBE: Password-based encryption algorithm defined in PKCS #5.
* AES/GCM/NoPadding: Encryption algorithm.

NOTE: If you install additional cryptography algorithms, you can also specify any of its encryption and decryption algorithms. | +| encoding | string | No | UU | The binary encoding used to represent the data as a string. Must be the same as the algorithm used to encrypt the string.
* Base64: the Base64 algorithm, as specified by IETF RFC 2045.
* Hex: the characters A-F and 0-9 represent the hexadecimal byte values.
* UU: the UNIX standard UUEncode algorithm (default).

NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| iv | binary | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `salt`.

Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.
* For Block Encryption Algorithms: This is the binary Initialization Vector value to use with the algorithm. The algorithm must contain a Feedback Mode other than ECB. This must be a binary value that is exactly the same size as the algorithm block size.
NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| salt | binary | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `iv`.

Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.
* For Password Based Encryption Algorithms: This is the binary Salt value to transform the password into a key.
NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| iterations | numeric | No | 0 | The number of iterations to transform the password into a binary key. Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.

NOTE: If you specify this parameter, you must also specify the `algorithm` parameter with a Password Based Encryption (PBE) algorithm.
NOTE: This parameter is used with the `salt` parameter. Do not specify this parameter for Block Encryption Algorithms.
NOTE: You must use the same value to encrypt and decrypt the data. | diff --git a/docs/functions/deleteclientvariable.md b/docs/functions/deleteclientvariable.md new file mode 100644 index 000000000..a0a480a14 --- /dev/null +++ b/docs/functions/deleteclientvariable.md @@ -0,0 +1,18 @@ +# deleteClientVariable + + Deletes a client variable. Returns `true` if variable was successfully deleted; `false` if it was not deleted. +NOTE: To test for the existence of a variable, use `IsDefined` or `structKeyExists`.) + +```javascript +deleteClientVariable(name) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The name of a client variable to delete, surrounded by double-quotation marks. | diff --git a/docs/functions/deserialize.md b/docs/functions/deserialize.md new file mode 100644 index 000000000..54a86eb58 --- /dev/null +++ b/docs/functions/deserialize.md @@ -0,0 +1,19 @@ +# deserialize + +Deserializes a string. + +```javascript +deserialize(string, type, useCustomSerializer); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | A string that needs to be deserialized. | +| type | string | Yes | | The type of the data to be deserialized. ColdFusion by default supports XML and JSON formats. You can also implement support for other types in the CustomSerializer CFC. | +| useCustomSerializer | boolean | Yes | true | Whether to use the custom serializer or not. The custom serializer will always be used for deserialization.
If false, the XML/JSON deserialization will be done using the default ColdFusion behavior.
If any other type is passed with `useCustomSerializer` as false, then `TypeNotSupportedException` will be thrown. | diff --git a/docs/functions/deserializeavro.md b/docs/functions/deserializeavro.md new file mode 100644 index 000000000..3b1b565e8 --- /dev/null +++ b/docs/functions/deserializeavro.md @@ -0,0 +1,36 @@ +# deserializeAvro + +Converts an Avro data representation into CFML data. + +```javascript +deserializeAvro(data, readerSchema [, strictMapping, useCustomSerialization]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| data | any | Yes | | Avro serialized data | +| readerSchema | string | Yes | | The Avro schema as a string or the absolute path to the schema | +| strictMapping | boolean | No | YES | Specifies whether to convert the Avro strictly. If true, converts the Avro binary to matching ColdFusion data types. | +| useCustomSerialization | boolean | No | YES | Whether to use the customSerializer | + +## Deserialize an Avro serialized query (Script syntax) + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +newsSchema = '{ + "namespace": "my.example", + "type": "record", + "name": "News", + "fields": [ {"name":"id","type":"int"}, {"name":"title","type":"string"} ] +}'; +avro = serializeAvro(news, newsSchema); +writeDump(deserializeAvro(avro, newsSchema)); +``` diff --git a/docs/functions/deserializejson.md b/docs/functions/deserializejson.md new file mode 100644 index 000000000..874f0b207 --- /dev/null +++ b/docs/functions/deserializejson.md @@ -0,0 +1,28 @@ +# deserializeJSON + + Converts a JSON (JavaScript Object Notation) string data representation into CFML data, such as a CFML structure or array. + +```javascript +deserializeJSON(json [, strictMapping, useCustomSerializer]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| json | string | Yes | | A string that contains a valid JSON construct or variable that represents one. | +| strictMapping | boolean | No | true | A Boolean value that specifies whether to convert the JSON strictly. If true, everything becomes structures. | +| useCustomSerializer | boolean | No | true | CF11+ Use custom serializer if defined. See: https://helpx.adobe.com/coldfusion/developing-applications/changes-in-coldfusion/restful-web-services-in-coldfusion.html | + +## Convert JSON into CF Structure + +```javascript +person = deserializeJSON( '{"company":"Foundeo","name":"Pete Freitag"}' ); +writeOutput( person.company ); +``` + +### Expected Result: Foundeo diff --git a/docs/functions/deserializeprotobuf.md b/docs/functions/deserializeprotobuf.md new file mode 100644 index 000000000..3ee5c9100 --- /dev/null +++ b/docs/functions/deserializeprotobuf.md @@ -0,0 +1,34 @@ +# deserializeProtobuf + +Converts a Protobuf data representation into CFML data. + +```javascript +serializeProtobuf(data, schema [, messageType, queryFormat, useCustomSerialization, protoPath]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| data | any | Yes | | Protobuf serialized data | +| schema | string | Yes | | The Protobuf schema as a string or the absolute path to the schema | +| messageType | string | No | | A message type from given schema as string. This is optional if schema contains one and only one message type. | +| strictMapping | boolean | No | YES | Specifies whether to convert the Protobuf strictly. If true, converts the Protobuf binary to matching ColdFusion data types. | +| useCustomSerialization | boolean | No | YES | Whether to use the customSerializer | +| protoPath | string | No | | Specifies a directory in which the compiler looks for imported files defined in the schema. By default, it will be the current schema's parent path. | + +## Deserialize a Protobuf serialized query (Script syntax) + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +newsSchema = 'syntax = "proto3"; +message News { int32 id = 1; string title = 2; }'; +protobuf = serializeProtobuf(news, newsSchema); +writeDump(deserializeProtobuf(protobuf, newsSchema)); +``` diff --git a/docs/functions/deserializexml.md b/docs/functions/deserializexml.md new file mode 100644 index 000000000..38779660b --- /dev/null +++ b/docs/functions/deserializexml.md @@ -0,0 +1,24 @@ +# deserializeXML + +Deserializes a string in XML format to a ColdFusion object. + +```javascript +deserializeXML(string [,useCustomSerializer]); +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | A string that needs to be deserialized. | +| useCustomSerializer | boolean | Yes | YES | This identifies whether or not to use the custom serializer. The default value is true. The custom serializer will be always used for XML deserialization. If false, the XML/JSON deserialization will be done using the default ColdFusion behavior. If any other type is passed with `useCustomSerializer` as false, then `TypeNotSupportedException` will be thrown. | + +## Tag Syntax + +```javascript + +``` diff --git a/docs/functions/directorycopy.md b/docs/functions/directorycopy.md new file mode 100644 index 000000000..85cba4aa1 --- /dev/null +++ b/docs/functions/directorycopy.md @@ -0,0 +1,29 @@ +# directoryCopy + +Copies the contents of a directory to a destination directory + +```javascript +directoryCopy(source, destination [, recurse][, filter]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| source | string | Yes | | Absolute pathname of directory from which you copy content. | +| destination | string | Yes | | Path of the destination directory. If not an absolute path, it is relative to the source directory. | +| recurse | boolean | No | false | If true, copies the subdirectories, otherwise only the files in the source directory. | +| filter | any | No | | File extension filter applied, for example, *.cfm. Filter to be used to filter the data copied: - A string that uses "*" as a wildcard, for example, "*.cfm" - a UDF (User defined Function) using the following pattern "functioname(String path):boolean", the function is run for every single file, if the function returns true, then the file is will be added to the list otherwise it will be omitted. | +| createPath | boolean | No | true | Lucee4.5+ If set to false, expects all parent directories to exist. If set to true, it will generate necessary directories. | + +## Simple DirectoryCopy Example + +Copy directory from one place to another. + +```javascript +directoryCopy(expandPath("./mySourceDirectory"),expandPath("../MyDestinationDirectory")) +``` diff --git a/docs/functions/directorycreate.md b/docs/functions/directorycreate.md new file mode 100644 index 000000000..f7453013c --- /dev/null +++ b/docs/functions/directorycreate.md @@ -0,0 +1,31 @@ +# directoryCreate + +Creates an on-disk or in-memory directory in the specified path + +```javascript +directoryCreate(path) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | Absolute path of the directory to be created. Alternatively, you can specify an IP address, as in the following example: `DirectoryCreate("//12.3.123.123/c_drive/test". NOTE: You have to have the required permissions to run this function.`); | +| createPath | boolean | No | true | Lucee Only. Create parent directory when it doesn't exist. | +| ignoreExists | boolean | No | false | Lucee Only. Pass false (default) to throw an error if the directory already exists, or true to skip the create operation without an error. | + +## Script Syntax + +Checking if a directory called 'icons' exists and then creating the directory if it does not exist. + +```javascript +if (!directoryExists(expandPath('/assets/img/icons'))) { + directoryCreate('assets/img/icons'); +} +``` + +### Expected Result: The directory 'icons' will be created under the img folder. diff --git a/docs/functions/directorydelete.md b/docs/functions/directorydelete.md new file mode 100644 index 000000000..f6e48500a --- /dev/null +++ b/docs/functions/directorydelete.md @@ -0,0 +1,26 @@ +# directoryDelete + +Deletes on-disk or in-memory directory at the given path. NOTE: Ensure that you have the required permissions to run this function. + +```javascript +directoryDelete(path[, recurse]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | Absolute path of the directory to be deleted. Alternatively, you can specify IP address, as in the following example: `DirectoryDelete("//12.3.123.123/c_drive/test");`. | +| recurse | boolean | No | false | If true, the directory and the sub-directories are deleted. If the directory (being deleted) has sub-directories and you set `recurse` to false, an exception occurs. | + +## Tag Syntax + +```javascript + + + +``` diff --git a/docs/functions/directoryexists.md b/docs/functions/directoryexists.md new file mode 100644 index 000000000..e204317bb --- /dev/null +++ b/docs/functions/directoryexists.md @@ -0,0 +1,30 @@ +# directoryExists + +Determines whether an on-disk or in-memory directory exists. + +```javascript +directoryExists(path) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | An absolute on-disk or in-memory path. Alternatively, you can specify IP address as in the following example: `DirectoryExists("//12.3.123.123/c_drive/test");` | +| allowRealPath | boolean | No | | Lucee Only. boolean that defines if relative paths are interpreted or not. | + +## Script Syntax + +Checking if a directory called 'icons' exists and then creating the directory if it does not exist. + +```javascript +if (!directoryExists(expandPath('/assets/img/icons'))) { + directoryCreate('assets/img/icons'); +} +``` + +### Expected Result: The directory 'icons' will be created under the img folder. diff --git a/docs/functions/directorylist.md b/docs/functions/directorylist.md new file mode 100644 index 000000000..1246debbb --- /dev/null +++ b/docs/functions/directorylist.md @@ -0,0 +1,52 @@ +# directoryList + +List the contents of a directory. Returns either an array, or a query. NOTE: Ensure that you have the required permissions to run this function. + +```javascript +directoryList(path [, recurse] [, listInfo] [, filter] [, sort] [, type]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| path | string | Yes | | The absolute path of the directory for which to list the contents. Alternatively, you can specify IP address as in the following example: `DirectoryList("//12.3.123.123/c_drive/test");`. | | +| recurse | boolean | No | false | If `true` directoryList traverses the directory tree. | | +| listInfo | string | No | path | Sets the return type. `name` returns an array with only the file names, `path` returns an array with the full path names and `query` returns a query containing the following fields: `Attributes`, `DateLastModified`, `Directory`, `Link`, `Mode`, `Name`, `Size`, `Type`. | /Users/garethedwards/development/github/cfdocs/docs/functions/directorylist.md|query | +| filter | string | No | | File extension filter applied to the listed files, for example, `*.jpg`. Multiple filters can be applied by using a pipe delimiter. For example: `*.doc|*.xls`. You can also pass a function. The arguments of the passed function must have: `path` :the file path, `type`: The values (file or dir), `extension`: The file extension, if any, otherwise and empty string. This argument can also accept the instances of Java `FileFilter` Objects. In Lucee4.5+ it can be a closure as well. | | +| sort | string | No | | Columns by which to sort. e.g. `Directory, Size DESC, DateLastModified`. To qualify a column, use `asc` (ascending sort a-z) or `desc` (descending sort z-a). | | +| type | string | No | all | CF11+ Lucee5+ Filter the result to only include files, directories, or both. | /Users/garethedwards/development/github/cfdocs/docs/functions/directorylist.md|all | + +## An array of files in this directory + +```javascript +arrayOfLocalFiles = directoryList( expandPath( "./" ), false, "name" ); +``` + +## A query of files in this directory sorted by date last modified + +```javascript +queryOfFiles = directoryList( expandPath( "./" ), false, "query", "", "DateLastModified DESC" ); +``` + +## An array of files in the temp directory + +Including sub-directories and as an array containing full paths + +```javascript +arrayOfTempFiles = directoryList( "./", true ); +``` + +## Filter files with closure + +Lucee4.5+ Pass a closure instead of a string as `filter` param + +```javascript +arrayOfFilteredFiles = directoryList(".", false, "name", function(path) { + return ListFindNoCase("Application.cfc,robots.txt,server.json,favicon.ico,.htaccess,README.md", path); +}); +``` diff --git a/docs/functions/directoryrename.md b/docs/functions/directoryrename.md new file mode 100644 index 000000000..d33125c81 --- /dev/null +++ b/docs/functions/directoryrename.md @@ -0,0 +1,27 @@ +# directoryRename + +Renames given directory. NOTE:Ensure that you have the required permissions to run this function. + +```javascript +directoryRename(oldPath, newPath) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| oldPath | string | Yes | | Absolute path of the directory to be renamed. Alternatively, you can specify IP address, for example, `DirectoryRename("//12.3.123.123/c_drive/test");` | +| newPath | string | Yes | | New name for the directory. | +| createPath | boolean | No | true | Lucee Only. If set to `false`, expects all parent directories to exist. `true` will generate necessary directories. | + +## Tag Syntax + +```javascript + + + +``` diff --git a/docs/functions/dollarformat.md b/docs/functions/dollarformat.md new file mode 100644 index 000000000..1ff1e18e5 --- /dev/null +++ b/docs/functions/dollarformat.md @@ -0,0 +1,37 @@ +# dollarFormat + +Formats a string in U.S. Dollar format. For other currencies, use `LSCurrencyFormat` or `LSEuroCurrencyFormat`. The function will return a number as a string, formatted with two decimal places, thousands separator and dollar sign. If the number is negative, the return value is enclosed in parentheses. If number is an empty string, the function returns zero. + +```javascript +dollarFormat(number) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | The number to format. | + +## Format Positive Numbers + +Dollar Format is about $, commas, and 2 decimal places + +```javascript +dollarFormat(1236598.2) +``` + +### Expected Result: $1,236,598.20 + +## Format Negative Numbers + +Negative numbers appear with parentheses. May cause issues due to LDEV-3743 + +```javascript +dollarFormat(-11.34) +``` + +### Expected Result: ($11.34) diff --git a/docs/functions/dotnettocftype.md b/docs/functions/dotnettocftype.md new file mode 100644 index 000000000..cfa46a92b --- /dev/null +++ b/docs/functions/dotnettocftype.md @@ -0,0 +1,17 @@ +# dotnetToCFType + +Explicitly converts a value returned by a .NET method to the corresponding ColdFusion data type. + +```javascript +dotnetToCFType(variableName) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| variableName | any | Yes | | Name of the .NET variable to convert. | diff --git a/docs/functions/duplicate.md b/docs/functions/duplicate.md new file mode 100644 index 000000000..d6987f104 --- /dev/null +++ b/docs/functions/duplicate.md @@ -0,0 +1,37 @@ +# duplicate + +Returns a clone (or deep copy) of an object or variable, leaving no reference to the original. Use this function to duplicate complex structures, such as nested structures and queries. When you duplicate a CFC instance, the entire CFC contents is copied, including the values of the variables in the `this` scope at the time you call the `Duplicate` function. Thereafter, the two CFC instances are independent, and changes to one copy, for example by calling one of its functions, have no effect on the other copy. Note: With this function, you cannot duplicate a COM, CORBA, or JAVA object returned from the cfobject tag or the CreateObject function. If an array element or structure field is a COM, CORBA, or JAVA object, you cannot duplicate the array or structure. + +```javascript +duplicate(object) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| object | any | Yes | | Name of the object to duplicate. | +| deepcopy | boolean | No | true | Lucee Only. If set to `true` (default) the child elements are also cloned. If `false`, child elements retain a reference to their corresponding element in the original object. Note: deeply cloned elements that are not native Lucee objects (i.e. Java objects) may change data type when they can be converted to a native CFML object. | + +## Changing a struct compared to changing its copy + +`myNewStruct` holds a reference to `myStruct` so if you change `myNewStruct`, `myStruct` is changed accordingly as well, because they are the same struct just assigned to two variables. +In comparison `myOtherNewStruct` is a copy so if you change `myOtherNewStruct`, `myStruct` stays untouched because with the duplicate, a new, unique structure with the same key-value pairs is created thus they do not share the same reference + +```javascript +myStruct = {'foo': 'Lorem ipsum', 'bar': 'baz'}; + +myNewStruct = myStruct; +myOtherNewStruct = duplicate(myStruct); + +myNewStruct.foo = 'ahmet sun'; +myOtherNewStruct.foo = 'dolor sit'; + +writeOutput(myStruct.foo&' → '&myNewStruct.foo&' → '&myOtherNewStruct.foo); +``` + +### Expected Result: ahmet sun → ahmet sun → dolor sit diff --git a/docs/functions/each.md b/docs/functions/each.md new file mode 100644 index 000000000..939627218 --- /dev/null +++ b/docs/functions/each.md @@ -0,0 +1,39 @@ +# each + +Function that will call the given UDF/Closure with every entry (key/value) in the given collection. + +```javascript +each(collection, closure [, parallel] [, maxThreads]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| collection | any | Yes | | Collection to take values from. | +| closure | function | Yes | | UDF/Closure that is called with each entry from the collection. | +| parallel | boolean | No | false | Execute the closures in parallel. | +| maxThreads | numeric | No | 20 | Maximum number of threads executed. Ignored when `parallel` argument is set to `false`. | + +## Iterate over collection and output a key from each item + +```javascript +coll = [{ + id: 0, + name: 'me' +},{ + id: 1, + name: 'you' +}]; +function outputCollection(item) { + writeOutput(item.name); + writeOutput(' - '); +} +each(coll,outputCollection,true); +``` + +### Expected Result: me - you - diff --git a/docs/functions/echo.md b/docs/functions/echo.md new file mode 100644 index 000000000..ca1fa1141 --- /dev/null +++ b/docs/functions/echo.md @@ -0,0 +1,45 @@ +# echo + +While writeOutput writes to the page-output stream, this function writes to the main response buffer + +```javascript +echo(string) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | String to be written to the output buffer | + +## Simple Example + +Prints a simple string. + +```javascript +echo("hello world"); +``` + +### Expected Result: hello world + +## Complex Data Example + +Note that complex objects will not automatically be converted to String, as with System.out.println in Java. + +```javascript +// Create data +data = { + "title" : "A Game of Thrones", + "author" : "George R. R. Martin", + "ISBN" : "0-00-224584-1" +}; + +// Print data +echo(data.toString()); +``` + +### Expected Result: {ISBN={0-00-224584-1}, author={George R. R. Martin}, title={A Game of Thrones}} diff --git a/docs/functions/empty.md b/docs/functions/empty.md new file mode 100644 index 000000000..a334ef89b --- /dev/null +++ b/docs/functions/empty.md @@ -0,0 +1,32 @@ +# empty + +Checks if a variable is empty + +```javascript +empty(variable) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| variable | any | Yes | | | /Users/garethedwards/development/github/cfdocs/docs/functions/empty.md|[] | + +## A Simple Empty Example + +Check whether the variable is empty or not + +```javascript + + + #empty(Language)# + + #empty(MyInput)# + +``` + +### Expected Result: false,true diff --git a/docs/functions/encodefor.md b/docs/functions/encodefor.md new file mode 100644 index 000000000..d8d10a53d --- /dev/null +++ b/docs/functions/encodefor.md @@ -0,0 +1,28 @@ +# encodeFor + +Encodes a given string for safe output in the specified context. The encoding is meant to mitigate Cross Site Scripting (XSS) attacks. + +```javascript +encodeFor(type, value) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | | The context of the encoding to perform. | +| value | string | Yes | | The value to encode. | + +## Simple encodeFor Example + +Pass in a tag and HTML encode the result. + +```javascript +encodeFor("html","
") +``` + +### Expected Result: <br> diff --git a/docs/functions/encodeforcss.md b/docs/functions/encodeforcss.md new file mode 100644 index 000000000..554007526 --- /dev/null +++ b/docs/functions/encodeforcss.md @@ -0,0 +1,46 @@ +# encodeForCSS + +Encodes the input string for safe output in CSS to prevent Cross Site Scripting attacks. + +```javascript +encodeForCSS(string [,canonicalize]); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The string to encode. | +| canonicalize | boolean | No | false | If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded. The default value for canonicalize is false.
When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed.
To use any other combinations you should canonicalize using canonicalize method and then do encoding. | + +## Tag Syntax + +Encoding CSS values. + +```javascript + + + + + +
+ +
+ This div element is styled!!!! +
+
+
+ + Background Color :
+
+``` diff --git a/docs/functions/encodefordn.md b/docs/functions/encodefordn.md new file mode 100644 index 000000000..b476c7faa --- /dev/null +++ b/docs/functions/encodefordn.md @@ -0,0 +1,26 @@ +# encodeForDN + +Encodes the given string for safe output in LDAP Distinguished Names (DN). Intended to prevent LDAP Injection. + +```javascript +encodeForDN( string [,canonicalize]); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | String to encode. | +| canonicalize | boolean | No | false | If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded. The default value for canonicalize is false.
When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed.
To use any other combinations you should canonicalize using canonicalize method and then do encoding. | + +## Simple encodeForDN Example + +```javascript +encodeForDN("x,y") +``` + +### Expected Result: x\,y diff --git a/docs/functions/encodeforhtml.md b/docs/functions/encodeforhtml.md new file mode 100644 index 000000000..94f0c1577 --- /dev/null +++ b/docs/functions/encodeforhtml.md @@ -0,0 +1,28 @@ +# encodeForHTML + +Encodes the input string for safe output in the body of a HTML tag. The encoding in meant to mitigate Cross Site Scripting (XSS) attacks. This function can provide more protection from XSS than the `HTMLEditFormat` or `XMLFormat` functions do. + +```javascript +encodeForHTML(string [, canonicalize]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | A string to encode | +| canonicalize | boolean | No | false | If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded. The default value for canonicalize is false.
When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed.
To use any other combinations you should canonicalize using canonicalize method and then do encoding. | + +## Simple encodeForHTML Example + +Pass in a tag and HTML encode the result. + +```javascript +encodeForHTML("") +``` + +### Expected Result: <test> diff --git a/docs/functions/encodeforhtmlattribute.md b/docs/functions/encodeforhtmlattribute.md new file mode 100644 index 000000000..f368807cd --- /dev/null +++ b/docs/functions/encodeforhtmlattribute.md @@ -0,0 +1,28 @@ +# encodeForHTMLAttribute + +Encodes the input string for safe output in the attribute value of an HTML attribute, such as table width or image height. The encoding is meant to mitigate Cross Site Scripting (XSS) attacks. + +```javascript +encodeForHTMLAttribute(string [, canonicalize]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | A string to encode. | +| canonicalize | boolean | No | false | If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded. The default value for canonicalize is false.
When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed.
To use any other combinations you should canonicalize using canonicalize method and then do encoding. | + +## Simple encodeForHTMLAttribute Example + +Shows how and where encodeForHTMLAttribute would be used. + +```javascript +
")#"> +``` + +### Expected Result:
diff --git a/docs/functions/encodeforjavascript.md b/docs/functions/encodeforjavascript.md new file mode 100644 index 000000000..d50d429c2 --- /dev/null +++ b/docs/functions/encodeforjavascript.md @@ -0,0 +1,27 @@ +# encodeForJavaScript + +Encodes the input string for safe output within JavaScript code. The encoding in meant to mitigate Cross Site Scripting (XSS) attacks. This function can provide more protection from XSS than JSStringFormat does. + +```javascript +encodeForJavaScript(string [, canonicalize]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | A string to encode. | +| canonicalize | boolean | No | | When true runs the canonicalize function against the input before encoding. | +| canonicalize | boolean | No | false | If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded.
When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed.
To use any other combinations you should canonicalize using `canonicalize` method and then do encoding. | + +## Simple encodeForJavaScript Example + +```javascript +encodeForJavaScript("foo()") +``` + +### Expected Result: foo\x28\x29 diff --git a/docs/functions/encodeforldap.md b/docs/functions/encodeforldap.md new file mode 100644 index 000000000..5f768859a --- /dev/null +++ b/docs/functions/encodeforldap.md @@ -0,0 +1,26 @@ +# encodeForLDAP + +Encodes the input string for safe output in LDAP queries to prevent Cross Site Scripting attacks. + +```javascript +encodeForLDAP(string [,canonicalize]); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | String to encode. | +| canonicalize | boolean | No | false | If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded.
When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed.
To use any other combinations you should canonicalize using canonicalize method and then do encoding. | + +## Script Syntax + +```javascript +encodeForLDAP("pete) (| (password = * ) )") +``` + +### Expected Result: pete\29 \28| \28password = \2a \29 \29 diff --git a/docs/functions/encodeforurl.md b/docs/functions/encodeforurl.md new file mode 100644 index 000000000..bfebdc7c7 --- /dev/null +++ b/docs/functions/encodeforurl.md @@ -0,0 +1,43 @@ +# encodeForURL + +Encodes the input string for safe output in URLs to prevent Cross Site Scripting attacks. + +```javascript +encodeForURL(string [,canonicalize]); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The string to encode. | +| canonicalize | boolean | No | false | If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded and canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed. To use any other combinations you should canonicalize using canonicalize method and then do encoding. | + +## URL Encode a value + +```javascript +encodeForURL("") +``` + +### Expected Result: %3Ctag%3E + +## URL Encode a value with escaped HTML entities + +```javascript +encodeForURL("<tag>",true) +``` + +### Expected Result: %3Ctag%3E + +## Example Usage + +```javascript + +http://example.com/math?formula=#encodeForURL(formula)# +``` + +### Expected Result: http://example.com/math?formula=5%2B3%3D8 diff --git a/docs/functions/encodeforxml.md b/docs/functions/encodeforxml.md new file mode 100644 index 000000000..212eb7e00 --- /dev/null +++ b/docs/functions/encodeforxml.md @@ -0,0 +1,28 @@ +# encodeForXML + +Encodes a string for safe use within an XML tag body. Use `encodeForXMLAttribute` for variables output inside an XML attribute value. + +```javascript +encodeForXML(string , [canonicalize]); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The string to encode. | +| canonicalize | boolean | No | false | If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded.
When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed.
To use any other combinations you should canonicalize using canonicalize method and then do encoding. | + +## Simple encodeForXML Example + +Encodes the ampersand into an XML entity. + +```javascript +encodeForXML("Fred & Ted") +``` + +### Expected Result: Fred & Ted diff --git a/docs/functions/encodeforxmlattribute.md b/docs/functions/encodeforxmlattribute.md new file mode 100644 index 000000000..46d2cdb63 --- /dev/null +++ b/docs/functions/encodeforxmlattribute.md @@ -0,0 +1,28 @@ +# encodeForXMLAttribute + +Encodes a string for safe output within an XML attribute to prevent Cross Site Scripting attacks. Use encodeForXML when outputting a variable inside a XML tag body. + +```javascript +encodeForXMLAttribute(string [,canonicalize]); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The string to encode. | +| canonicalize | boolean | No | false | If set to true, canonicalization happens before encoding. If set to false, the given input string will just be encoded.
When this parameter is not specified, canonicalization will not happen. By default, when canonicalization is performed, both mixed and multiple encodings will be allowed.
To use any other combinations you should canonicalize using canonicalize method and then do encoding. | + +## Simple encodeForXMLAttribute Example + +Encodes the single quote into an XML entity. + +```javascript +encodeForXMLAttribute("It's for use in attribute values") +``` + +### Expected Result: It's for use in attribute values diff --git a/docs/functions/encodeforxpath.md b/docs/functions/encodeforxpath.md new file mode 100644 index 000000000..3ecad89df --- /dev/null +++ b/docs/functions/encodeforxpath.md @@ -0,0 +1,26 @@ +# encodeForXPath + +Returns an encoded string for safe use in an XPATH query. + +```javascript +encodeForXPath(string [,canonicalize]); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The string to encode. | +| canonicalize | boolean | No | | If set to true, canonicalization happens before encoding.
If set to false, the given input string will just be encoded.
When this parameter is not specified, canonicalization will not happen.

By default, when canonicalization is performed, both mixed and multiple encodings will be allowed. To use any other combinations you should canonicalize using canonicalize method and then do encoding. | + +## Tag Syntax + +```javascript +encodeForXPath("'or 1=1",false) +``` + +### Expected Result: 'or 1=1 diff --git a/docs/functions/encrypt.md b/docs/functions/encrypt.md new file mode 100644 index 000000000..85deb244a --- /dev/null +++ b/docs/functions/encrypt.md @@ -0,0 +1,56 @@ +# encrypt + + Encrypts a string, using a symmetric key-based algorithm, in which the same key is used to encrypt and decrypt a string. The security of the encrypted string depends on maintaining the secrecy of the key, and the algorithm choice. Algorithm support is determined by the installed default JCE provider in Lucee or ColdFusion Standard. On ColdFusion Enterprise the algorithms are provided by the FIPS certified RSA BSafe Crypto-J JCE provider. + +```javascript +encrypt(string, key [, algorithm [, encoding] [, iv | salt [, iterations]]]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | String to encrypt. | +| key | string | Yes | | Key or seed used to encrypt the string.
* For the `CFMX_COMPAT` algorithm, any combination of any number of characters; used as a seed used to generate a 32-bit encryption key.
* For all other algorithms, a key in the format used by the algorithm. For these algorithms, use the `GenerateSecretKey` function to generate the key. | +| algorithm | string | No | CFMX_COMPAT | The algorithm to use to encrypt the string.
ColdFusion Standard Edition installs the following algorithms:
* CFMX_COMPAT: the algorithm used in ColdFusion MX and prior releases. This algorithm is the least secure option (default).
* AES: the Advanced Encryption Standard specified by the National Institute of Standards and Technology (NIST) FIPS-197.
* BLOWFISH: the Blowfish algorithm defined by Bruce Schneier.
* DES: the Data Encryption Standard algorithm defined by NIST FIPS-46-3.
* DESEDE: the "Triple DES" algorithm defined by NIST FIPS-46-3.

NOTE: ColdFusion Enterprise Edition installs RSA BSafe Crypto-J library, which provides FIPS-140 Compliant Strong Cryptography. This includes:
* AES: the Advanced Encryption Standard specified by the National Institute of Standards and Technology (NIST) FIPS-197.
* DES: the Data Encryption Standard algorithm defined by NIST FIPS-46-3.
* DESEDE: the "Triple DES" algorithm defined by NIST FIPS-46-3.
* DESX: The extended Data Encryption Standard symmetric encryption algorithm.
* RC2: The RC2 block symmetric encryption algorithm defined by RFC 2268.
* RC4: The RC4 symmetric encryption algorithm.
* RC5: The RC5 encryption algorithm.
* PBE: Password-based encryption algorithm defined in PKCS #5.
* AES/GCM/NoPadding: Encryption algorithm.
NOTE: If you install additional cryptography algorithms, you can also specify any of its encryption and decryption algorithms. | +| encoding | string | No | UU | The binary encoding used to represent the data as a string.
* Base64: the Base64 algorithm, as specified by IETF RFC 2045.
* Hex: the characters A-F and 0-9 represent the hexadecimal byte values.
* UU: the UNIX standard UUEncode algorithm (default).

NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| iv | binary | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `SALT`.

Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.
* For Block Encryption Algorithms: This is the binary Initialization Vector value to use with the algorithm. The algorithm must contain a Feedback Mode other than ECB. This must be a binary value that is exactly the same size as the algorithm block size.
NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| salt | binary | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `IV`.

Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.
* For Password Based Encryption Algorithms: This is the binary Salt value to transform the password into a key.
NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| iterations | numeric | No | 0 | The number of iterations to transform the password into a binary key. Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.

NOTE: If you specify this parameter, you must also specify the `algorithm` parameter with a Password Based Encryption (PBE) algorithm.
NOTE: This parameter is used with the `salt` parameter. Do not specify this parameter for Block Encryption Algorithms.
NOTE: You must use the same value to encrypt and decrypt the data. | + +## Encrypt using AES Encryption in ECB Mode + +The key must be generated using the generateSecretKey("AES") function. + +```javascript +encrypt("top secret", "WTq8zYcZfaWVvMncigHqwQ==", "AES", "Base64") +``` + +### Expected Result: keciULin7bxOWvN/BOarWw== + +## Encrypt using AES Cipher Block Chaining (CBC) mode + +By default encrypt() uses the Electronic Code Book (ECB) mode for encryption. + For increased security you should specify the mode and padding to use. In this example we will use CBC mode and PKCS5Padding. The value of the encrypted string will be different every time it runs because the IV is generated at random. + +```javascript +msg = 'data to encrypt'; +key = generateSecretKey('AES'); +encMsg = encrypt( msg, key, 'AES/CBC/PKCS5Padding', 'HEX'); +writeOutput( encMsg ); +``` + +## Encrypt using AES Galois/Counter Mode (GCM) + +Using GCM mode works CF2016+ after update 2. It does not currently work on Lucee (bug: LDEV-904) + +```javascript +msg = 'data to encrypt'; +key = generateSecretKey('AES'); +encMsg = encrypt( msg, key, 'AES/GCM/NoPadding', 'Base64'); +writeOutput( encMsg ); +``` diff --git a/docs/functions/encryptbinary.md b/docs/functions/encryptbinary.md new file mode 100644 index 000000000..b6475d1e9 --- /dev/null +++ b/docs/functions/encryptbinary.md @@ -0,0 +1,22 @@ +# encryptBinary + +Encrypts binary data using a specific algorithm and encoding method. + +```javascript +encryptBinary(binaryData, key [, algorithm [, encoding] [, iv | salt [, iterations]]]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| binaryData | any | Yes | | Binary data to encrypt. | +| key | string | Yes | | Key or seed used to encrypt the string.
* For the `CFMX_COMPAT` algorithm, any combination of any number of characters; used as a seed used to generate a 32-bit encryption key.
* For all other algorithms, a key in the format used by the algorithm. For these algorithms, use the `GenerateSecretKey` function to generate the key. | +| algorithm | string | No | CFMX_COMPAT | The algorithm to use to encrypt the string.
ColdFusion Standard Edition installs the following algorithms:
* CFMX_COMPAT: the algorithm used in ColdFusion MX and prior releases. This algorithm is the least secure option (default).
* AES: the Advanced Encryption Standard specified by the National Institute of Standards and Technology (NIST) FIPS-197.
* BLOWFISH: the Blowfish algorithm defined by Bruce Schneier.
* DES: the Data Encryption Standard algorithm defined by NIST FIPS-46-3.
* DESEDE: the "Triple DES" algorithm defined by NIST FIPS-46-3.

NOTE: ColdFusion Enterprise Edition installs RSA BSafe Crypto-J library, which provides FIPS-140 Compliant Strong Cryptography. This also includes:
* DESX: The extended Data Encryption Standard symmetric encryption algorithm.
* RC2: The RC2 block symmetric encryption algorithm defined by RFC 2268.
* RC4: The RC4 symmetric encryption algorithm.
* RC5: The RC5 encryption algorithm.
* PBE: Password-based encryption algorithm defined in PKCS #5.
* AES/GCM/NoPadding: Encryption algorithm.
NOTE: If you install additional cryptography algorithms, you can also specify any of its encryption and decryption algorithms. | +| iv | binary | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `salt`.

Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.
* For Block Encryption Algorithms: This is the binary Initialization Vector value to use with the algorithm. The algorithm must contain a Feedback Mode other than ECB. This must be a binary value that is exactly the same size as the algorithm block size.
NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| salt | binary | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `iv`.

Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.
* For Password Based Encryption Algorithms: This is the binary Salt value to transform the password into a key.
NOTE: If you specify this parameter, you must also specify the `algorithm` parameter. | +| iterations | numeric | No | 0 | The number of iterations to transform the password into a binary key. Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software.

NOTE: If you specify this parameter, you must also specify the `algorithm` parameter with a Password Based Encryption (PBE) algorithm.
NOTE: This parameter is used with the `salt` parameter. Do not specify this parameter for Block Encryption Algorithms.
NOTE: You must use the same value to encrypt and decrypt the data. | diff --git a/docs/functions/entitydelete.md b/docs/functions/entitydelete.md new file mode 100644 index 000000000..9ade3be7e --- /dev/null +++ b/docs/functions/entitydelete.md @@ -0,0 +1,26 @@ +# entityDelete + +Deletes the record from the database for the specified entity. Depending on the cascade attribute specified in the mapping, it deletes the associated objects also. + +```javascript +entityDelete(entity) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| entity | variableName | Yes | | Name of the entity being deleted. | + +## Delete an existing entity + +Loads an ORM entity from the database, then deletes it + +```javascript +user = entityLoadByPK("User", userID); +entityDelete(user); +``` diff --git a/docs/functions/entityload.md b/docs/functions/entityload.md new file mode 100644 index 000000000..7193f1ace --- /dev/null +++ b/docs/functions/entityload.md @@ -0,0 +1,42 @@ +# entityLoad + +Loads and returns an array of entities of the specified entityname or an entity if unique=true or if a primary key id is passed in to filterCriteria. + +```javascript +entityLoad(entityName [,id | Filter ,unique | Order ,options]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| entityName | string | Yes | | Name of CFC / Entity to be loaded. | | +| id | any | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `Filter`.

The primary key value of the entity to be loaded. Or if the entity has a composite key, then this is specified as a ColdFusion struct (key-value pair). | | +| Filter | any | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `id`.

This is a ColdFusion struct (key-value pair) of property names and values. If there is more than one key-value pair, then use the `AND` keyword. | | +| unique | boolean | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `Order`.

When true a single entity is returned, otherwise an array is returned.
If you are sure only one record exists for the `Filter`, then you can specify `unique=true` to return a single entity instead of an array. If you set `unique=true` and multiple records are returned, then an exception occurs. | | +| Order | string | No | | THIS PARAMETER IS MUTUALLY EXCLUSIVE WITH `unique`.

String used to specify the sort order of the entities that are returned.
If this is specified, the function returns an array of entities that satisfy the `Filter` and is sorted as specified by `Order`.

Usage example: LastName ASC, FirstName ASC | | +| options | struct | No | | A struct with possible keys:
ignorecase : Ignores the case of sort order when set to true. Use only if you've specified the `Order` parameter.
offset : Specifies the position from which to retrieve the objects.
maxResults : Specifies the maximum number of objects to be retrieved.
cacheable : Whether the result has to be cached in secondary cache. Default is `false`.
cachename : Name of the cache in secondary cache.
timeout : Specified the timeout value (in seconds) for the query | /Users/garethedwards/development/github/cfdocs/docs/functions/entityload.md|timeout | + +## Load by PK + +Loads an entity by primary key value + +```javascript +entityLoad("Employee", url.employee_id) +``` + +### Expected Result: An Employee CFC Instance + +## Get multiple entities + +Returns an array of Employee instances with last name Smith + +```javascript +entityLoad("Employee", {LastName="Smith"}) +``` + +### Expected Result: array diff --git a/docs/functions/entityloadbyexample.md b/docs/functions/entityloadbyexample.md new file mode 100644 index 000000000..92f68a71a --- /dev/null +++ b/docs/functions/entityloadbyexample.md @@ -0,0 +1,28 @@ +# entityLoadByExample + +Loads and returns an array of objects that match the `sampleEntity`. + +```javascript +entityLoadByExample(sampleEntity [, unique, matchCriteria]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| sampleEntity | string | Yes | | No Help Available | +| unique | boolean | No | | When true a single entity is returned, otherwise an array is returned.
If you are sure only one record exists for the `Filter`, then you can specify `unique=true` to return a single entity instead of an array. If you set `unique=true` and multiple records are returned, then an exception occurs. | +| matchCriteria | any | No | | No Help Available | + +## Tag Syntax + +```javascript + + + + +``` diff --git a/docs/functions/entityloadbypk.md b/docs/functions/entityloadbypk.md new file mode 100644 index 000000000..5b53fd2df --- /dev/null +++ b/docs/functions/entityloadbypk.md @@ -0,0 +1,25 @@ +# entityLoadByPK + +Loads and returns an array of objects for given primary key. +Use this function to avoid specifying the required boolean parameter in `EntityLoad()`. + +```javascript +entityLoadByPK(entity, id) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| entity | string | Yes | | Name of the entity to be loaded. | +| id | string | Yes | | ID of the entity to be loaded. | + +## Load an existing User object + +```javascript +user = entityLoadByPK("User", userID); +``` diff --git a/docs/functions/entitymerge.md b/docs/functions/entitymerge.md new file mode 100644 index 000000000..15ee7850d --- /dev/null +++ b/docs/functions/entitymerge.md @@ -0,0 +1,17 @@ +# entityMerge + +Attaches given entity to current ORM session + +```javascript +entityMerge(entity) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| entity | variableName | Yes | | The entity that must be attached to the ORM session. | diff --git a/docs/functions/entitynamearray.md b/docs/functions/entitynamearray.md new file mode 100644 index 000000000..d6541d33c --- /dev/null +++ b/docs/functions/entitynamearray.md @@ -0,0 +1,17 @@ +# entityNameArray + +Returns an array of all loaded entities + +```javascript +entityNameArray() +``` + +```javascript +returns array +``` + +## Dump an array of entities currently loaded + +```javascript +dump(entityNameArray()); +``` diff --git a/docs/functions/entitynamelist.md b/docs/functions/entitynamelist.md new file mode 100644 index 000000000..dc8f9b3e1 --- /dev/null +++ b/docs/functions/entitynamelist.md @@ -0,0 +1,23 @@ +# entityNameList + +Returns a list of all loaded entities + +```javascript +entityNameList([delimiter]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| delimiter | string | No | | | + +## Outputs a list of entities currently loaded + +```javascript +entityNameList() +``` diff --git a/docs/functions/entitynew.md b/docs/functions/entitynew.md new file mode 100644 index 000000000..aa877c571 --- /dev/null +++ b/docs/functions/entitynew.md @@ -0,0 +1,27 @@ +# entityNew + +Creates a new instance of the persistent CFC with the entity name that you provide. + +```javascript +entityNew(entityName [,properties [,ignoreExtras]]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| entityName | string | Yes | | Entity name of the persistent CFC. | +| properties | struct | No | | Key-value pair (CF struct) of property names and values. | +| ignoreExtras | boolean | No | false | No Help Available | + +## Create a new ORM entity + +Use entityNew to get a new instance of an Employee entity. + +```javascript +var employee = entityNew("Employee"); +``` diff --git a/docs/functions/entityreload.md b/docs/functions/entityreload.md new file mode 100644 index 000000000..f356aec15 --- /dev/null +++ b/docs/functions/entityreload.md @@ -0,0 +1,17 @@ +# entityReload + +Reloads data for an entity that is already loaded. + +```javascript +entityReload(entity) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| entity | variableName | Yes | | Name of the entity to be reloaded | diff --git a/docs/functions/entitysave.md b/docs/functions/entitysave.md new file mode 100644 index 000000000..00e96bfe8 --- /dev/null +++ b/docs/functions/entitysave.md @@ -0,0 +1,31 @@ +# entitySave + +Saves or updates data of the entity and all related entities to the database. + +```javascript +entitySave(entity [, forceInsert]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| entity | variableName | Yes | | Name of the entity that must be saved in the database. | +| forceInsert | boolean | No | false | If true, then ColdFusion always tries to insert the entity as a new record. | + +## Save a new ORM entity + +Use entitySave to save a newly created entity. + +```javascript +var company = entityNew("Company"); +company.setName(form.companyName); +company.setIndustry(form.industry); +company.setEmployees(form.employeeCount); +company.setWebsite(form.companyWebsite); +entitySave(company); +``` diff --git a/docs/functions/entitytoquery.md b/docs/functions/entitytoquery.md new file mode 100644 index 000000000..488685b38 --- /dev/null +++ b/docs/functions/entitytoquery.md @@ -0,0 +1,21 @@ +# entityToQuery + +Converts the input entity object or the input array of entity objects to a query object. +The following conditions apply for this function: +In the case of array input, all objects in the array must be of the same type. +The result query will not contain any relation data. + +```javascript +entityToQuery(entity [, name]) +``` + +```javascript +returns query +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| entity | variableName | Yes | | Entity object or array of objects that needs to be converted to a query object. | +| name | string | No | | Name of the entity. Use this optional parameter to return the query of the given entity in the case of inheritance mapping. | diff --git a/docs/functions/esapidecode.md b/docs/functions/esapidecode.md new file mode 100644 index 000000000..bfffc6f9c --- /dev/null +++ b/docs/functions/esapidecode.md @@ -0,0 +1,18 @@ +# esapiDecode + +Decodes a string that has been encoded with ESAPIEncode. + +```javascript +esapiDecode(decodeFrom, string) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| decodeFrom | string | Yes | | given value is encoded as:

* Lucee4, Lucee5+ url
* Lucee5+ HTML | +| string | string | Yes | | string to encode | diff --git a/docs/functions/esapiencode.md b/docs/functions/esapiencode.md new file mode 100644 index 000000000..1acb3c53f --- /dev/null +++ b/docs/functions/esapiencode.md @@ -0,0 +1,18 @@ +# esapiEncode + +Calling the various encodeFor functions: encodeForHTML, etc. + +```javascript +esapiEncode(encodeFor,string) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| encodeFor | string | Yes | | Encode for what, valid values are:
- css: for output inside Cascading Style Sheets (CSS)
- dn: for output in LDAP Distinguished Names
- html: for output inside HTML
- html_attr: for output inside HTML Attributes
- javascript: for output inside JavaScript
- ldap: for output in LDAP queries
- url: for output in URL
- vbscript: for output inside vbscript
- xml: for output inside XML
- xml_attr: for output inside XML Attributes
- xpath: for output in XPath. | +| string | string | Yes | | String to encode. | diff --git a/docs/functions/evaluate.md b/docs/functions/evaluate.md new file mode 100644 index 000000000..2ec91a75c --- /dev/null +++ b/docs/functions/evaluate.md @@ -0,0 +1,29 @@ +# evaluate + +Evaluates one or more string expressions, dynamically, from left to right. (The results of an evaluation on the left can have meaning in an expression to the right.) Returns the result of evaluating the rightmost expression. + +```javascript +evaluate(expression) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| expression | string | Yes | | Expression to evaluate. String expressions can be complex. If a string expression contains a single- or double-quotation mark, the mark must be escaped. This function is useful for forming one variable from multiple variables. | + +## Tag Syntax + +```javascript + + + + + #evaluate("first #op# second")# +``` + +### Expected Result: YES diff --git a/docs/functions/exceptionkeyexists.md b/docs/functions/exceptionkeyexists.md new file mode 100644 index 000000000..7a8d40926 --- /dev/null +++ b/docs/functions/exceptionkeyexists.md @@ -0,0 +1,18 @@ +# exceptionKeyExists + +Determines whether a specific key is present in an exception. + +```javascript +exceptionKeyExists(exception, key) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| exception | struct | Yes | | Name of structure to test | +| key | string | Yes | | Key to test | diff --git a/docs/functions/exp.md b/docs/functions/exp.md new file mode 100644 index 000000000..4df771a43 --- /dev/null +++ b/docs/functions/exp.md @@ -0,0 +1,27 @@ +# exp + +Calculates the exponent whose base is e that represents number. The constant e equals 2.71828182845904, the base of the natural logarithm. This function is the inverse of Log, the natural logarithm of number. + +```javascript +exp(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | Exponent to apply to the base e. | + +## exponent of 1.13140211149 + +The result could vary depending on if the server is running windows or linux. On a windows box the result will be round to 3.1 + +```javascript +exp(1.13140211149) +``` + +### Expected Result: 3.099999999997 diff --git a/docs/functions/expandpath.md b/docs/functions/expandpath.md new file mode 100644 index 000000000..1838f74c9 --- /dev/null +++ b/docs/functions/expandpath.md @@ -0,0 +1,35 @@ +# expandPath + +Creates an absolute, platform-appropriate path that is equivalent to the value of 'path', appended to the base path. This function (despite its name) can accept an absolute or relative path in the 'path' attribute. + +```javascript +expandPath(path) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | Relative or absolute directory reference or filename, within the current directory, (.\ and ..\) to convert to an absolute path. Can include forward or backward slashes. | + +## Expand the current path + +```javascript +expandPath("./") +``` + +## Expand the parent folder path + +```javascript +expandPath("../") +``` + +## Expand the path to a subfolder + +```javascript +expandPath("path/to/subfolder") +``` diff --git a/docs/functions/extensionexists.md b/docs/functions/extensionexists.md new file mode 100644 index 000000000..3541e8509 --- /dev/null +++ b/docs/functions/extensionexists.md @@ -0,0 +1,34 @@ +# extensionExists + +This function checks if a specific extension exists. + +```javascript +extensionExists(id, version) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| id | string | Yes | | UUID of the Extension. | +| version | string | No | | Version of the Extension. | + +## Simple ExtensionExists() Example + +This example shows a very basic usage of the function to determine if a function exists. + +```javascript +dump(extensionExists("99A4EF8D-F2FD-40C8-8FB8C2E67A4EEEB6")); +``` + +## Example of ExtensionExists() Using Version Attribute + +This example was created by Michael Born to verify that a specific version of an Extension exists. + +```javascript +dump(extensionExists("99A4EF8D-F2FD-40C8-8FB8C2E67A4EEEB6","7.2.2.jre8")); +``` diff --git a/docs/functions/extensionlist.md b/docs/functions/extensionlist.md new file mode 100644 index 000000000..aafbd9aa8 --- /dev/null +++ b/docs/functions/extensionlist.md @@ -0,0 +1,33 @@ +# extensionList + +This function returns a query object containing a list of installed extensions. It takes no arguments. + +```javascript +extensionList() +``` + +```javascript +returns query +``` + +## Simple ExtensionList() Example + +This example shows a very basic usage of the function to get a list of available extensions. + +```javascript +dump(extensionList()); +``` + +## Complex ExtensionList() Example + +This example was created by Michael Born to check the version of an installed extension. + +```javascript +var extension = extensionList().filter( ( extension ) => extension.name == "Hibernate ORM Engine" ); +if ( !extension.recordCount ){ +throw( "Hibernate extension is not installed; please install it now." ); +} else { +var installedExtensionVersion = extension.version; +writeOutput( "You have the Hibernate extension version " & installedExtensionVersion & " installed." ); +} +``` diff --git a/docs/functions/extract.md b/docs/functions/extract.md new file mode 100644 index 000000000..b007c7bcf --- /dev/null +++ b/docs/functions/extract.md @@ -0,0 +1,35 @@ +# extract + +Extract the data of a compressed file. + +```javascript +extract(format, source, target) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| format | string | Yes | | The format of the compressed file. | +| source | string | Yes | | Path (relative or absolute) to the source-file or a directory with zip-files. | +| target | string | Yes | | Path (relative or absolute) to the directory, where you want to extract the data. | + +## Extract a zip-file + +Extract a zip-file and save the data in the "output-directory". + +```javascript +extract("zip", "test.zip", "output-directory") +``` + +## Extract a multiple zip-files via a directory + +Extract all zip-files, which are stored in the "multiple-directory" and save the data in the "output-directory". + +```javascript +extract("zip", "multiple-directory", "output-directory") +``` diff --git a/docs/functions/fileappend.md b/docs/functions/fileappend.md new file mode 100644 index 000000000..8044dc847 --- /dev/null +++ b/docs/functions/fileappend.md @@ -0,0 +1,32 @@ +# fileAppend + +Appends the data contents to the file. + +```javascript +fileAppend(file, data [, charset] [, addNewLine]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| file | string | Yes | | File path | +| data | string | Yes | | Data to append to the file | +| charset | string | No | | The character encoding in which the file contents is encoded. | +| addNewLine | boolean | No | true | CF2016u11+ Indicates whether a new line is added to the end of the appended data | + +## Simple Example + +Appends a mock entry to a file. + +```javascript +// Create mock log entry +logEntry = dateTimeFormat(now(), "yyyy/mm/dd HH:nn") & " this is a mock log entry!"; + +// Append line to file +fileAppend("/path/to/file.log", logEntry); +``` diff --git a/docs/functions/fileclose.md b/docs/functions/fileclose.md new file mode 100644 index 000000000..4c3c15679 --- /dev/null +++ b/docs/functions/fileclose.md @@ -0,0 +1,45 @@ +# fileClose + +Closes an on-disk or in-memory file that is open. + +```javascript +fileClose(file) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| file | any | Yes | | A file object | + +## Opens a file, reads a line then closes it. + +```javascript +// Open File +var fileObject = fileOpen("/path/to/file.txt"); + +// Perform Actions +try +{ + // Read Line + writeOutput(fileReadLine(fileObject)); +} + +// Error Handling +catch(any ex) +{ + // Report Exception + writeDump(ex); +} + +// Always Close +finally +{ + // Close File + fileClose(fileObject); +} +``` diff --git a/docs/functions/filecopy.md b/docs/functions/filecopy.md new file mode 100644 index 000000000..c006323a0 --- /dev/null +++ b/docs/functions/filecopy.md @@ -0,0 +1,24 @@ +# fileCopy + +Copies the specified on-disk or in-memory source file to the specified destination file. + +```javascript +fileCopy(source, destination) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| source | string | Yes | | Path where the file is located currently | +| destination | string | Yes | | Path where a copy of the file should be placed | + +## Copy file from here to there + +```javascript +fileCopy(sourceFile, destinationFile); +``` diff --git a/docs/functions/filedelete.md b/docs/functions/filedelete.md new file mode 100644 index 000000000..8d5c536ce --- /dev/null +++ b/docs/functions/filedelete.md @@ -0,0 +1,32 @@ +# fileDelete + +Deletes the specified file on the server. fileDelete throws an exception whenever a file doesn't exist. + +```javascript +fileDelete(filePath) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| filePath | string | Yes | | Pathname of the file to delete. If not an absolute path (starting with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory, which is returned by the GetTempDirectory function. | + +## Script Syntax + +Obtaining files within an archive folder and then removing them if they are older than one hour. + +```javascript +var existingFiles = directoryList(expandPath("/archive/"), false, "query"); +for (file in existingFiles) { + if (dateDiff("h", file.datelastmodified, now()) GT 1) { + fileDelete(file.directory & "\" & file.name); + } +} +``` + +### Expected Result: All files within the archive directory older than one hour will be deleted. diff --git a/docs/functions/fileexists.md b/docs/functions/fileexists.md new file mode 100644 index 000000000..d8b75cb21 --- /dev/null +++ b/docs/functions/fileexists.md @@ -0,0 +1,26 @@ +# fileExists + +Determines whether a file exists + +```javascript +fileExists(filePath) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| filePath | string | Yes | | A absolute file system path string. | + +## Checks if file at the given path exists. + +```javascript +var myFile = "/path/to/the/file.jpg"; +if(fileExists(expandPath(myFile))) { + writeOutput(myFile & 'exists!'); +} +``` diff --git a/docs/functions/filegetmimetype.md b/docs/functions/filegetmimetype.md new file mode 100644 index 000000000..ec2d2e49b --- /dev/null +++ b/docs/functions/filegetmimetype.md @@ -0,0 +1,35 @@ +# fileGetMimeType + +Gets the MIME type for the file path/file object you have specified. + +```javascript +fileGetMimeType(file, strict) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| file | any | Yes | | Name of the file object or full path on disk to the file if strict is set to true. If you do not specify the full path, the file is assumed to be present in the temp directory, as returned by the function getTempDirectory. | +| strict | boolean | No | true | If false, determines the file type by extension. The default value is true. | + +## Two PDFs and two text files with and without strict mode + +Assume that you have a file named test.pdf in temp directory and test.txt in the same folder, and you want to check the MIME type. Here test.txt is a copy of test.pdf with extension renamed to txt. + +```javascript + + mimeTypes = ''; + mimeTypes = listAppend(mimeTypes, fileGetMimeType(expandPath('/folder1/test.pdf'))); + mimeTypes = listAppend(mimeTypes, fileGetMimeType(expandPath('/folder1/test.pdf'),false)); + mimeTypes = listAppend(mimeTypes, fileGetMimeType(expandPath('/folder1/test.txt'))); + mimeTypes = listAppend(mimeTypes, fileGetMimeType(expandPath('/folder1/test.txt'),false)); + writeOutput(mimeTypes); + +``` + +### Expected Result: application/pdf,application/pdf,text/plain,text/plain diff --git a/docs/functions/fileiseof.md b/docs/functions/fileiseof.md new file mode 100644 index 000000000..0ff28846c --- /dev/null +++ b/docs/functions/fileiseof.md @@ -0,0 +1,49 @@ +# fileIsEOF + +Determines whether ColdFusion has reached the end of the file while reading it. + +```javascript +fileIsEOF(file) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| file | any | Yes | | The file object. | + +## Simple usage syntax + +Call fileIsEOF on a file object and save the result to a variable. + +```javascript +fileObj = fileOpen(expandPath('./file.txt'); +isEndOfFile = fileIsEOF(fileObj); +``` + +## Using fileIsEOF to loop over all lines of a text file + +Simplified example of using fileIsEOF to determine when all lines have been read from a file. Error handling omitted for clarity. + +```javascript +// Error handling omitted for clarity. + +// open a file for reading +fileObj = fileOpen(expandPath('./file.txt'), "read"); + +// read each line until we read the end of the file. +// fileIsEOF(fileObj) == false until we've read in the last line. +while (!fileIsEOF(fileObj)) { + + lineContent = fileReadLine(fileObj); + + // do something with content of each line +} + +// end of file reached, close the file handle +fileClose(fileObj); +``` diff --git a/docs/functions/filemove.md b/docs/functions/filemove.md new file mode 100644 index 000000000..dca34e8e9 --- /dev/null +++ b/docs/functions/filemove.md @@ -0,0 +1,24 @@ +# fileMove + +Moves file from source to destination + +```javascript +fileMove(source, destination) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| source | string | Yes | | Path where the file is located currently | +| destination | string | Yes | | Path where a copy of the file should be placed | + +## Move file from here to there + +```javascript +fileMove(sourcefile, destinationfile); +``` diff --git a/docs/functions/fileopen.md b/docs/functions/fileopen.md new file mode 100644 index 000000000..a249269a2 --- /dev/null +++ b/docs/functions/fileopen.md @@ -0,0 +1,48 @@ +# fileOpen + +Opens a file + +```javascript +fileOpen(filePath [, mode [, charset] [, seekable]]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| filePath | string | Yes | | An absolute path of an on-disk or in-memory file on the server | +| mode | string | No | read | Type of access you require to the file stream | +| charset | string | No | | Character encoding identified by the file's byte order mark, if any; otherwise, JVM default file character set | +| seekable | boolean | No | false | Whether the file is usable with the `fileSeek` function | + +## Opens a file, reads a line then closes it. + +```javascript +// Open File +var fileObject = fileOpen("/path/to/file.txt"); + +// Perform Actions +try +{ + // Read Line + writeOutput(fileReadLine(fileObject)); +} + +// Error Handling +catch(any ex) +{ + // Report Exception + writeDump(ex); +} + +// Always Close +finally +{ + // Close File + fileClose(fileObject); +} +``` diff --git a/docs/functions/fileread.md b/docs/functions/fileread.md new file mode 100644 index 000000000..8e21b0346 --- /dev/null +++ b/docs/functions/fileread.md @@ -0,0 +1,27 @@ +# fileRead + +Reads an on-disk or in-memory text file or a file object created with the FileOpen function. + +```javascript +fileRead(filePath [, charset | bufferSize]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| filePath | any | Yes | | An absolute file path, or file object. | +| charset | any | No | | Character encoding used to read the file. | +| bufferSize | any | No | | The number of characters to read. | + +## Read a file into a variable + +Uses expandPath to grab a file in current directory. + +```javascript +fileContent = fileRead(expandPath("./file.txt"), "utf-8") +``` diff --git a/docs/functions/filereadbinary.md b/docs/functions/filereadbinary.md new file mode 100644 index 000000000..e33afb7df --- /dev/null +++ b/docs/functions/filereadbinary.md @@ -0,0 +1,25 @@ +# fileReadBinary + +Reads an on-disk or in-memory binary file (such as an executable or image file) on the server, into a binary object + +```javascript +fileReadBinary(filePath) +``` + +```javascript +returns binary +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| filePath | string | Yes | | Absolute path to the file. | + +## Read a file into a binary object + +Uses expandPath to grab a file in current directory. + +```javascript +binaryContent = fileReadBinary(expandPath('./file.pdf')); +``` diff --git a/docs/functions/filereadline.md b/docs/functions/filereadline.md new file mode 100644 index 000000000..3f9d07435 --- /dev/null +++ b/docs/functions/filereadline.md @@ -0,0 +1,45 @@ +# fileReadLine + +Returns the next line from the file + +```javascript +fileReadLine(file) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| file | any | Yes | | file object previously opened with fileOpen() | + +## Opens a file, reads a line then closes it. + +```javascript +// Open File +var fileObject = fileOpen("/path/to/file.txt"); + +// Perform Actions +try +{ + // Read Line + writeOutput(fileReadLine(fileObject)); +} + +// Error Handling +catch(any ex) +{ + // Report Exception + writeDump(ex); +} + +// Always Close +finally +{ + // Close File + fileClose(fileObject); +} +``` diff --git a/docs/functions/fileseek.md b/docs/functions/fileseek.md new file mode 100644 index 000000000..aaca53fff --- /dev/null +++ b/docs/functions/fileseek.md @@ -0,0 +1,27 @@ +# fileSeek + +Shifts the file pointer to the given position. The file must be opened with seekable option + +```javascript +fileSeek(file, position) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| file | any | Yes | | The file object | +| position | numeric | Yes | | The position in the file within a stream where the following read and write operation must occur. | + +## Script Syntax + +```javascript + + NewFile = fileOpen(expandPath(".") & " est.txt","write","",true); + fileSeek(#NewFile#,0); + +``` diff --git a/docs/functions/filesetaccessmode.md b/docs/functions/filesetaccessmode.md new file mode 100644 index 000000000..1930ec584 --- /dev/null +++ b/docs/functions/filesetaccessmode.md @@ -0,0 +1,26 @@ +# fileSetAccessMode + +Sets the attributes of an on-disk file on UNIX or Linux. This function does not work with in-memory files. + +```javascript +fileSetAccessMode(filePath, mode) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| filePath | string | Yes | | Path to file | +| mode | string | Yes | | Access mode (the same attributes you use for the Linux command 'chmod')

Each position specifies who is granted the access:
* 1st position: owner
* 2nd position: group
* 3rd position: other

The number at each position specifies which right is granted:
* 4: read (r)
* 2: write (w)
* 1: execute (x)

Let's assume that matrix as seen on Linux systems: rwxrwxrwx. You can combine the numbers for read, write and execute permissions to achieve combined permissions:
* 3: write & execute
* 5: read & execute
* 6: read & write
* 7: read, write and execute

For example, 400 specifies that only the owner can read the file; 004 specifies that anyone can read the file.
In rwe-notation 400 means r-------- and 004 ------r-- whereas 751 means rwxr-er--. | + +## Grant read access to everyone + +```javascript + + fileSetAccessMode("test1.txt", "004"); + +``` diff --git a/docs/functions/filesetattribute.md b/docs/functions/filesetattribute.md new file mode 100644 index 000000000..2e3b850bc --- /dev/null +++ b/docs/functions/filesetattribute.md @@ -0,0 +1,29 @@ +# fileSetAttribute + +Sets the attributes of an on-disk file in Windows. This function does not work with in-memory files. + +```javascript +fileSetAttribute(filePath, attribute) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| filePath | string | Yes | | Path to on-disk file | | +| attribute | string | Yes | | Attribute to enable/disable

readonly/hidden sets the given attribute to `true` and the other one to `false`
normal sets both to false | /Users/garethedwards/development/github/cfdocs/docs/functions/filesetattribute.md|normal | + +## Create a temporary file and then change read-only mode + +```javascript +myFile = getTempFile(getTempDirectory(),"testFile"); +writeOutput('is writable: '&getFileInfo(myFile).canWrite); +fileSetAttribute(myFile,'readOnly'); +writeOutput(' → '&getFileInfo(myFile).canWrite); +``` + +### Expected Result: is writable: YES → NO diff --git a/docs/functions/filesetlastmodified.md b/docs/functions/filesetlastmodified.md new file mode 100644 index 000000000..16ac2d970 --- /dev/null +++ b/docs/functions/filesetlastmodified.md @@ -0,0 +1,27 @@ +# fileSetLastModified + +Sets the date when an on-disk or in-memory file was most recently modified. + +```javascript +fileSetLastModified(filePath, date) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| filePath | string | Yes | | An absolute path to an on-disk or in-memory file on the server | +| date | date | Yes | | The date to set for when the file was last modified | + +## Script Syntax + +```javascript + + fileSetLastModified("c: emp est1.txt", "#now()#"); + writeOutput(#getFileInfo("c: emp est1.txt").lastmodified#); + +``` diff --git a/docs/functions/fileskipbytes.md b/docs/functions/fileskipbytes.md new file mode 100644 index 000000000..446cc7236 --- /dev/null +++ b/docs/functions/fileskipbytes.md @@ -0,0 +1,27 @@ +# fileSkipBytes + +Shifts the file pointer by the given number of bytes. + +```javascript +fileSkipBytes(file, skipCount) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| file | any | Yes | | The file object | +| skipCount | numeric | Yes | | The number of bytes that must be skipped before the next file operation | + +## Script Syntax + +```javascript + + NewFile = fileOpen(expandPath(".") & " est.txt","write","",true); + fileSeek(#NewFile#,5); + +``` diff --git a/docs/functions/fileupload.md b/docs/functions/fileupload.md new file mode 100644 index 000000000..59aac02bc --- /dev/null +++ b/docs/functions/fileupload.md @@ -0,0 +1,48 @@ +# fileUpload + +Uploads file to a directory on the server. + +```javascript +fileUpload(destination [, fileField] [, mimeType] [, onConflict] [, strict]) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| destination | string | Yes | | Path of directory in which to upload the file. If not an absolute path (starting with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory returned by the function getTempDirectory. If the destination you specify does not exist, ColdFusion creates a file with the specified destination name. | +| fileField | string | No | | Name of form field used to select the file. Do not use number signs (#) to specify the field name. | +| mimeType | string | No | | Specify a comma-delimited list of MIME types and/or file extensions to test the uploaded file against. If the file is not of any of the types in this list, an error of type `coldfusion.tagext.io.FileUtils$InvalidUploadTypeException`is thrown.
If you specify file extensions, use this format: `.txt,.jpg`, not `txt`, `*.txt`, or `*.*`. You can use `*` as a wildcard to accept all files. | +| onConflict | string | No | error | Action to take if file has the same name of a file in the directory. | +| strict | boolean | No | true | CF10+ Defines which method is used to determine the file type to check against the value of the `mimeType` parameter.
`true`: The first few bytes of the uploaded file are used to determine the MIME type.
`false`: The MIME type provided by the browser in the request payload is used. | + +## Upload form with strict check on MIME type + +```javascript +
+ + +
+ + + if( structKeyExists( form, "fileInput" )) { + try { + uploadedFile = fileUpload( getTempDirectory(), "fileInput", "image/jpeg,image/pjpeg", "MakeUnique" ); + // check the file extension of the uploaded file; mime types can be spoofed + if (not listFindNoCase("jpg,jpeg", uploadedFile.serverFileExt)) { + throw("The uploaded file is not of type JPG."); + } + // do stuff with uploadedFile... + } catch ( coldfusion.tagext.io.FileUtils$InvalidUploadTypeException e ) { + writeOutput( "This upload form only accepts JPEG files." ); + } + catch (any e) { + writeOutput( "An error occurred while uploading your file: #e.message#" ); + } + } + +``` diff --git a/docs/functions/fileuploadall.md b/docs/functions/fileuploadall.md new file mode 100644 index 000000000..43635c9c7 --- /dev/null +++ b/docs/functions/fileuploadall.md @@ -0,0 +1,23 @@ +# fileUploadAll + +Uploads all files sent to the page in an HTTP request to a directory on the server. + +```javascript +fileUploadAll(destination [,mimeType] [,onConflict] [,strict] [,continueOnError] [,errorVariable] [,allowedExtensions]) +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| destination | string | Yes | | Path of directory in which to upload the file. If not an absolute path (starting with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory returned by the function getTempDirectory. If the destination you specify does not exist, ColdFusion creates a file with the specified destination name. | +| mimeType | string | No | | Limits the MIME types to accept. Comma-delimited list. For example, the following code permits JPEG and Microsoft Word file uploads:'image/jpg,application/msword' .The browser uses the filename extension to determine file type. | +| onConflict | string | No | error | Action to take if file has the same name of a file in the directory. | +| strict | boolean | No | true | Defines which method is used to determine the file type to check against the value of the `mimeType` parameter.
`true`: The first few bytes of the uploaded file are used to determine the MIME type.
`false`: The MIME type provided by the browser in the request payload is used. | +| continueOnError | boolean | No | false | CF11+ Whether to continue uploading the remaining files when uploading one of the files fails. | +| errorVariable | variableName | No | cffile.uploadAllErrors | CF11+ The name of the variable in which the array of structs of file upload errors will be stored.

The upload failure information error structure contains the following fields:
`REASON` - The reason for the failure
`DETAIL` - File upload failure detail
MESSAGE - A detailed message depicting the failure
CLIENTFILE - Name of the file uploaded from the client's system
`CLIENTFILEEXT` - Extension of the uploaded file on the client system (without a period)
`CLIENTFILENAME` - Name of the uploaded file on the client system (without an extension)
`INVALID_FILE_TYPE` - If the file mime type or extension is not in the specified accept attribute. If the reason is INVALID_FILE_TYPE, two additional keys will be available in the structure.
--`ACCEPT`: list of mime types or file extensions given in the tag
--`MIMETYPE`: mime type of the uploaded file
`EMPTY_FILE` - If the uploaded file is an empty file
`FILE_EXISTS` - If any file with the given name already exists in the destination and the overwritepolicy is error
`DEST` - The destination where file is copied
`FORM_FILE_NOT_FOUND` - If the uploaded file is not found on the server | +| allowedExtensions | string | No | | CF2018+ A comma-separated list of file extensions, which will be allowed for upload.

For example, .png, .jpg, or, .jpeg.

You can use `*` (star) to allow all files, except where you specify the MIME type in the accept attribute.

Values specified in the attribute allowedExtensions override the list of blocked extensions in the server or application settings. | diff --git a/docs/functions/filewrite.md b/docs/functions/filewrite.md new file mode 100644 index 000000000..324caac23 --- /dev/null +++ b/docs/functions/filewrite.md @@ -0,0 +1,25 @@ +# fileWrite + +Writes the data to the file object or file path specified using the charset specified or the java default character set if unspecified. + +```javascript +fileWrite(filePath, data [, charset]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| filePath | any | Yes | | A file object or a file system path string. | +| data | any | Yes | | The variable to write to the file. | +| charset | string | No | | An optional character set that the data is encoded with. Defaults to the Java default character set (which is usually UTF-8). | + +## Write a Temporary File + +```javascript +fileWrite( getTempFile( getTempDirectory(), "tempFile"), "My Data" ); +``` diff --git a/docs/functions/filewriteline.md b/docs/functions/filewriteline.md new file mode 100644 index 000000000..c89f4c241 --- /dev/null +++ b/docs/functions/filewriteline.md @@ -0,0 +1,26 @@ +# fileWriteLine + +Appends content to an existing file + +```javascript +fileWriteLine(file, data) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| file | any | Yes | | The file where you want to add your content | +| data | string | Yes | | Content to add to the file | + +## Script Syntax + +```javascript +myfile = fileOpen("c:\temp\test1.txt", "write"); +fileWriteLine(myfile,"This line is new."); +fileClose(myfile); +``` diff --git a/docs/functions/find.md b/docs/functions/find.md new file mode 100644 index 000000000..e6b747598 --- /dev/null +++ b/docs/functions/find.md @@ -0,0 +1,29 @@ +# find + +Finds the first occurrence of a substring in a string, from a specified start position. If substring is not in string, returns zero. The search is case-sensitive. + +```javascript +find(substring, string [, start]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| substring | string | Yes | | The string you are looking for. | +| string | string | Yes | | The string to search in. | +| start | numeric | No | 1 | The position from which to start searching in the string | + +## Find apple in the string + +Returns the index of apple in the string. + +```javascript +find("apple", "An apple a day keeps the doctor away.") +``` + +### Expected Result: 4 diff --git a/docs/functions/findnocase.md b/docs/functions/findnocase.md new file mode 100644 index 000000000..9b794359a --- /dev/null +++ b/docs/functions/findnocase.md @@ -0,0 +1,27 @@ +# findNoCase + +Finds the first occurrence of a substring in a string, from a specified start position. If substring is not in string, returns zero. The search is case-insensitive. + +```javascript +findNoCase(substring, string [, start]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| substring | string | Yes | | The string for which you are looking | +| string | string | Yes | | The string in which to search | +| start | numeric | No | 1 | The position from which to start searching in the string | + +## Script Syntax + +```javascript +findNoCase("s", "cfdocs.org", 0) +``` + +### Expected Result: 6 diff --git a/docs/functions/findoneof.md b/docs/functions/findoneof.md new file mode 100644 index 000000000..114b747c9 --- /dev/null +++ b/docs/functions/findoneof.md @@ -0,0 +1,55 @@ +# findOneOf + +Finds the first occurrence of any one of a set of characters in a string, from a specified start position. The search is case-sensitive. + + Returns the position of the first member of set found in string; or 0, if no member of set is found in string. + +```javascript +findOneOf(set, string [, start]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| set | string | Yes | | String which contains one or more characters to search for. | +| string | string | Yes | | String in which to search. | +| start | numeric | No | 1 | Start position of search. Can be 1 through the length of the string to search. Choosing a start index greater than the length of the string to search will return a 0. | + +## Find first instance starting from beginning of string. + +We're not passing a start index in this example. + +```javascript +string_to_search = 'The rain in Spain falls mainly in the plains.'; +writeOutput( findOneOf('in', string_to_search) ); +``` + +### Expected Result: 7 + +## Find first instance starting from the twelfth character. + +Let's pass in a starting index of 12. The search will start at the twelfth character, just before the word 'Spain'. + +```javascript +string_to_search = 'The rain in Spain falls mainly in the plains.'; +writeOutput( findOneOf('in', string_to_search, 12) ); +``` + +### Expected Result: 16 + +## Example showing this function will search all characters from the 'set' argument in the 'string' argument. + +This function is case-sensitive so 't' does NOT match the first 'T'. It's the same for 'H' NOT matching the first 'h'. But 'e' matches the 'e' at the third position. +Since this is the first match, this is the index that is returned. + +```javascript +string_to_search = 'The rain in Spain falls mainly in the plains.'; +writeOutput( findOneOf('tHe', string_to_search, 1) ); +``` + +### Expected Result: 3 diff --git a/docs/functions/firstdayofmonth.md b/docs/functions/firstdayofmonth.md new file mode 100644 index 000000000..6f6a14490 --- /dev/null +++ b/docs/functions/firstdayofmonth.md @@ -0,0 +1,35 @@ +# firstDayOfMonth + +Determines the ordinal (day number, in the year) of the first day of the month in which a given date falls. + +```javascript +firstDayOfMonth(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.firstDayOfMonth() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | Date or date/time object. | + +## Simple example + +To determine the ordinal (day number, in the year). + +```javascript + + +#result# +``` + +### Expected Result: 336 diff --git a/docs/functions/fix.md b/docs/functions/fix.md new file mode 100644 index 000000000..da2259670 --- /dev/null +++ b/docs/functions/fix.md @@ -0,0 +1,26 @@ +# fix + +Converts a real number to an integer. +**Tip:** If you want to `fix()` to outcome of a division, simply use the integer division operator (\). + +```javascript +fix(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | The number to convert | + +## Fix 1.8 to an integer + +```javascript +fix(1.8) +``` + +### Expected Result: 1 diff --git a/docs/functions/floor.md b/docs/functions/floor.md new file mode 100644 index 000000000..4ebaf5011 --- /dev/null +++ b/docs/functions/floor.md @@ -0,0 +1,57 @@ +# floor + +Returns the integer less than or equal to the input. This function is equivalent to the int function. + +```javascript +floor(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | A numeric value | + +## Floor Value of 4.0 + +Requires CF2016+ + +```javascript +floor(4.0) +``` + +### Expected Result: 4 + +## Floor Value of 4.3 + +Requires CF2016+ + +```javascript +floor(4.3) +``` + +### Expected Result: 4 + +## Floor Value of 4.7 + +Requires CF2016+ + +```javascript +floor(4.7) +``` + +### Expected Result: 4 + +## Floor Value of -4.3 + +Requires CF2016+ + +```javascript +floor(-4.3) +``` + +### Expected Result: -5 diff --git a/docs/functions/formatbasen.md b/docs/functions/formatbasen.md new file mode 100644 index 000000000..f2623c113 --- /dev/null +++ b/docs/functions/formatbasen.md @@ -0,0 +1,52 @@ +# formatBaseN + +Converts number to a string, in the base specified by radix. + +```javascript +formatBaseN(number, radix) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | The number to convert | +| radix | numeric | Yes | | The base radix to use | + +## Format 10 as dual number + +```javascript +formatBaseN(10,2) +``` + +### Expected Result: 1010 + +## Format 1024 as hexadecimal number + +```javascript +formatBaseN(1024,16) +``` + +### Expected Result: 400 + +## Format 125 as decimal number + +```javascript +formatBaseN(125,10) +``` + +### Expected Result: 125 + +## Format a float + +Floors float to integer then formats with radix given + +```javascript +formatBaseN(10.75,2) +``` + +### Expected Result: 1010 diff --git a/docs/functions/generateargon2hash.md b/docs/functions/generateargon2hash.md new file mode 100644 index 000000000..b8a37cf97 --- /dev/null +++ b/docs/functions/generateargon2hash.md @@ -0,0 +1,30 @@ +# generateArgon2Hash + +Generates and returns an Argon2 hash of the input. + +```javascript +generateArgon2Hash(string [, variant] [, parallelismFactor] [, memoryCost] [, iterations]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| input | string | Yes | | | +| variant | string | No | Argon2i | | +| parallelismFactor | numeric | No | 1 | Degrees of parallelism, a number between 1 and 10. | +| memoryCost | numeric | No | 8 | A number between 8 and 100000. | +| iterations | numeric | No | 1 | A number between 1 and 20. | + +## Generate and verify an Argon2 hash + +```javascript +hashedValue = GenerateArgon2Hash("CFDocs.org"); +dump(hashedValue); +check = Argon2CheckHash( "CFDocs.org", hashedValue); +dump(check); +``` diff --git a/docs/functions/generatebcrypthash.md b/docs/functions/generatebcrypthash.md new file mode 100644 index 000000000..0de08bb48 --- /dev/null +++ b/docs/functions/generatebcrypthash.md @@ -0,0 +1,49 @@ +# generateBCryptHash + +It is a password-hashing cryptographic function that takes an input and hashes it into a fixed size output./nNOTE: BCrypt input is limited to 72 bytes. + +```javascript +generateBCryptHash(plaintext,options); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| plaintext | string | Yes | | The input string to hash. | | +| options | struct | No | {"version":"$2a","rounds":10} | A struct containing the optional values:
--version - Version of BCrypt hash to generate ($2a,$2y or $2b). (Default is "$2a". The most current version is "$2b")
--rounds - Number of rounds to run the hash functions. (Default is 10.) | /Users/garethedwards/development/github/cfdocs/docs/functions/generatebcrypthash.md|rounds | + +## Example of BCrypt Hashing - No Options + +This is an example of using the function with no options. + +```javascript +secretMsg=generateBCryptHash("My voice is my passport. Verify me.");writeDump(secretMsg) +``` + +### Expected Result: $2a$10$.jQX1KnwPzhvVet0vEENnOlO8C70oM8GQhu0MQnCgcIlWhguWb3q. + +## Example of BCrypt Hashing - With Version Option + +This is an example of using the function with optional version specified. + +```javascript +secretMsg=generateBCryptHash("My voice is my passport. Verify me.",{"version":"$2b"}); +writeDump(secretMsg) +``` + +### Expected Result: $2b$10$wkfNE0B2hP/GMqQPWRvTte87F/PlEZwetaDPnVwW5OjBRAPiGKZp. + +## Example of BCrypt Hashing - With Rounds Option + +This is an example of using the function with optional rounds specified. + +```javascript +secretMsg=generateBCryptHash("Setec Astronomy",{"rounds":15});writeDump(secretMsg) +``` + +### Expected Result: $2a$15$yBUewN8dYFd9QawytI5SO.MIq0hO65TXEoVyUAZRlK.oTHZ4Dwa0i diff --git a/docs/functions/generategraphqlmodels.md b/docs/functions/generategraphqlmodels.md new file mode 100644 index 000000000..4940a297f --- /dev/null +++ b/docs/functions/generategraphqlmodels.md @@ -0,0 +1,24 @@ +# generateGraphQLModels + +This generates models for all queries, mutations, and subscriptions. Call this method every time if there is a change in the query or you've added a new query in the GraphQL file. + +```javascript +generateGraphQLModels() +``` + +```javascript +returns void +``` + +## Generate GraphQL models (Script syntax) + +Creates a GraphQL client with specified properties and calls generateGraphQLModels + +```javascript +gqlClient = getGraphQLClient({ + service_url: "https://apollo-fullstack-tutorial.herokuapp.com/graphql", + root_folder: "root", + headers: { keys: "key", values: "value" } +}); +generateGraphQLModels(); +``` diff --git a/docs/functions/generatepbkdfkey.md b/docs/functions/generatepbkdfkey.md new file mode 100644 index 000000000..e7d5eb33b --- /dev/null +++ b/docs/functions/generatepbkdfkey.md @@ -0,0 +1,58 @@ +# generatePBKDFKey + +CFML implementation of Password-Based Key-Derivation Function (PBKDF) + +```javascript +generatePBKDFKey(algorithm, passphrase, salt, iterations, keySize); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| algorithm | string | Yes | | Hashing algorithm used for generating key | +| passphrase | string | Yes | | Passphrase used for the key. KEEP THIS SECRET. | +| salt | string | Yes | | A string which will be added to the passphrase before encryption.
The standard recommends a salt length of at least 64 bits (8 characters). The salt needs to be generated using a pseudo-random number generator (e.g. SHA1PRNG) | +| iterations | numeric | Yes | | The number of PBKDEF iterations to perform. A minimum recommended value is 1000 | +| keySize | numeric | Yes | | The length in bits of the key to generate | + +## Example PBKDF2 With HMAC SHA1 + +The `PBKDF2WithHmacSHA1` algorithm will work on older JVMs, or older versions of CF + +```javascript +generatePBKDFKey("PBKDF2WithHmacSHA1", "secret", "salty", 5000, 128) +``` + +### Expected Result: Y0MCpCe3zb0CNJvyXNUWEQ== + +## More complex encryption example + +```javascript +// some variables +password = "top_secret"; +dataToEncrypt= "the most closely guarded secret"; +encryptionAlgorithm = "AES"; +keysize = 128; +algorithmVersion = 512; +PBKDFalgorithm = 'PBKDF2WithHmacSHA' & algorithmVersion; + +// Generate key as recommended in docs +length = keysize / 8; +multiplicator = 10 ^ length; +salt = Round(Randomize(5,'SHA1PRNG') * multiplicator); + +// The magic happens here +PBKDFKey = GeneratePBKDFKey(PBKDFalgorithm, password, salt, algorithmVersion, keysize); +encryptedData = encrypt(dataToEncrypt, PBKDFKey, encryptionAlgorithm, "BASE64"); +decryptedData = decrypt(encryptedData, PBKDFKey, encryptionAlgorithm, "BASE64"); + +//Output +writeOutput("Generated PBKDFKey (Base 64): " & PBKDFKey); +writeOutput("
Data After Encryption: " & encryptedData); +writeOutput("
Data After Decryption: " & decryptedData); +``` diff --git a/docs/functions/generatescrypthash.md b/docs/functions/generatescrypthash.md new file mode 100644 index 000000000..54cef65db --- /dev/null +++ b/docs/functions/generatescrypthash.md @@ -0,0 +1,41 @@ +# generateSCryptHash + +It is a salted password-hashing cryptographic function that takes an input and hashes it into a fixed size output. +NOTE: This function is less secure than BCrypt. + +```javascript +generateSCryptHash(plaintext,options); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| plaintext | string | Yes | | The input string to hash. | +| options | struct | No | {"memorycost":8,"CpuCost":16348,"Parallel":1,"KeyLength":32,"saltLength":8} | A struct containing the optional values:
- memorycost - Default is 8.
- CpuCost - CPU cost of the algorithm (as defined in scrypt, this is `N`) that must be a power of 2 and greater than 1. Default is currently 16,348 or 2^14.
- Parallel - the parallelization of the algorithm (as defined in scrypt, this is `P`). Default is currently 1.
- Keylength - key length for the algorithm (as defined in scrypt, this is `dkLen`). Default is currently 32.
- saltLength - length of the salt to use. Default is 8. | + +## Example of SCrypt Hashing - No Options + +This is an example of using the function with no options. + +```javascript +secretMsg=generateSCryptHash("My voice is my passport. Verify me."); +writeOutput(secretMsg) +``` + +### Expected Result: $e0801$BEJ9Ob8ZvoY=$LpQ79jMomeePrvBjcWRl3SrVf69962Ztn4WV/Sse4jg= + +## Example of SCrypt Hashing - With Options + +This is an example of using the function with options specified. + +```javascript +secretMsg=generateBCryptHash("My voice is my passport. Verify me.",{"memorycost":4,"CpuCost":4096,"Parallel":1,"KeyLength":28,"saltLength":10}); +writeOutput(secretMsg) +``` + +### Expected Result: $c0401$6TTkF3GRLGrHAw==$NGPASIOKsgNLDOZPyTvn9rrSW3F+IkHLlPWevQ== diff --git a/docs/functions/generatesecretkey.md b/docs/functions/generatesecretkey.md new file mode 100644 index 000000000..48f62f516 --- /dev/null +++ b/docs/functions/generatesecretkey.md @@ -0,0 +1,31 @@ +# generateSecretKey + +Generates a secure random key value for use in the encrypt and decrypt functions. + +```javascript +generateSecretKey([algorithm] [,keysize]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| algorithm | string | No | | The encryption algorithm used to generate the key.
NOTE: You cannot use `generateSecretKey()` to create a key for the `CFMX_COMPAT` default algorithm in `encrypt()` and `decrypt()` functions. | /Users/garethedwards/development/github/cfdocs/docs/functions/generatesecretkey.md|DESEDE | +| keysize | numeric | No | 128 | Number of bits requested in the key for the specified algorithm (when allowed by JDK). | /Users/garethedwards/development/github/cfdocs/docs/functions/generatesecretkey.md|512 | + +## Generate an AES 128 bit Key + +Generate an AES key and use it to encrypt and decrypt a secret. + +```javascript +ex={}; +ex.key = generateSecretKey("AES"); +ex.secret = "top secret"; +ex.encrypted=encrypt(ex.secret, ex.key, "AES", "Base64"); +ex.decrypted=decrypt(ex.encrypted, ex.key, "AES", "Base64"); +writeDump(ex); +``` diff --git a/docs/functions/getapplicationmetadata.md b/docs/functions/getapplicationmetadata.md new file mode 100644 index 000000000..7898c5280 --- /dev/null +++ b/docs/functions/getapplicationmetadata.md @@ -0,0 +1,29 @@ +# getApplicationMetadata + +Returns the application settings that you have specified in the application, either in the Application.cfc or Application.cfm. Contains application settings such as name, sessionManagement, or invokeImplicitAccessor. + +```javascript +getApplicationMetadata() +``` + +```javascript +returns struct +``` + +## Simple Example + +Prints the statements using application meta data. + +```javascript +// Fetch application meta data +data = getApplicationMetadata(); + +// Print application name +writeOutput("Application name is " & (data.name.length() ? data.name : "unspecified") & "
"); + +// Print session timeout +writeOutput("Session timeout is " & data.sessionTimeout & "
"); + +// Print session management +writeOutput("Session management is " & (data.sessionManagement ? "enabled" : "disabled")); +``` diff --git a/docs/functions/getapplicationsettings.md b/docs/functions/getapplicationsettings.md new file mode 100644 index 000000000..1d8c4bc0d --- /dev/null +++ b/docs/functions/getapplicationsettings.md @@ -0,0 +1,17 @@ +# getApplicationSettings + +return all data from this scope, when using a application.cfc or all setting defined in tag cfapplication + +```javascript +getApplicationSettings() +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| suppressFunction | boolean | Yes | false | if true only data members from this scope are returned (no functions), default is false | diff --git a/docs/functions/getauthuser.md b/docs/functions/getauthuser.md new file mode 100644 index 000000000..980b557c3 --- /dev/null +++ b/docs/functions/getauthuser.md @@ -0,0 +1,11 @@ +# getAuthUser + +Gets the name of an authenticated user. + +```javascript +getAuthUser() +``` + +```javascript +returns string +``` diff --git a/docs/functions/getbasetagdata.md b/docs/functions/getbasetagdata.md new file mode 100644 index 000000000..8af606c0b --- /dev/null +++ b/docs/functions/getbasetagdata.md @@ -0,0 +1,40 @@ +# getBaseTagData + +Used within a custom tag. Finds calling (ancestor) tag by name and accesses its data. + +```javascript +getBaseTagData(tagname [, level]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| tagname | string | Yes | | Specify the parent tag name, starting with CF_. | +| level | numeric | No | 1 | Specify the nth-level ancestor to retrieve variables from. | + +## Retrieve parent tag thisTag scope + +Use getBaseTagData() to retrieve the execution mode of the parent CF_MAPPER custom tag. + +```javascript + + + +template + +BODY + +``` + +## Retrieve parent tag attributes + +Use getBaseTagData() to retrieve the attributes of the parent cf_iframe tag + +```javascript +variables.parentAttributes = getBaseTagData('cf_iframe').attributes; +``` diff --git a/docs/functions/getbasetaglist.md b/docs/functions/getbasetaglist.md new file mode 100644 index 000000000..4943392a1 --- /dev/null +++ b/docs/functions/getbasetaglist.md @@ -0,0 +1,17 @@ +# getBaseTagList + +Gets a comma-delimited list of uppercase ancestor tag names, as a string. The first list element is the current tag. If the current tag is nested, the next element is the parent tag. If the function is called for a top-level tag, it returns an empty string. + +```javascript +getBaseTagList() +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| caller | any | No | | Adobe only. Not aliased in Lucee | diff --git a/docs/functions/getbasetemplatepath.md b/docs/functions/getbasetemplatepath.md new file mode 100644 index 000000000..f5ea75a93 --- /dev/null +++ b/docs/functions/getbasetemplatepath.md @@ -0,0 +1,17 @@ +# getBaseTemplatePath + +Gets the absolute server file system path of the requested CFML file. + +```javascript +getBaseTemplatePath() +``` + +```javascript +returns string +``` + +## Basic Example + +```javascript +getBaseTemplatePath() +``` diff --git a/docs/functions/getbuiltinfunction.md b/docs/functions/getbuiltinfunction.md new file mode 100644 index 000000000..19aaabb91 --- /dev/null +++ b/docs/functions/getbuiltinfunction.md @@ -0,0 +1,25 @@ +# getBuiltinFunction + +Returns an object, which contains the description, parameters and return-type of the given function. Throws an exception when the function do not exists. + +```javascript +getBuiltinFunction(name) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name of the function. | + +## Show information about the StructKeyExists-function + +Dump the StructKeyExists-function to show information about this function. + +```javascript +dump(getBuiltinFunction("StructKeyExists")); +``` diff --git a/docs/functions/getcanonicalpath.md b/docs/functions/getcanonicalpath.md new file mode 100644 index 000000000..36a17af29 --- /dev/null +++ b/docs/functions/getcanonicalpath.md @@ -0,0 +1,25 @@ +# getCanonicalPath + +Returns the canonical path of the input path. If a directory a trailing slash is used on Lucee, but not on ACF. + +```javascript +getCanonicalPath(path) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | | + +## getCanonicalPath Example + +Returns the canonical path of the input path. + +```javascript +writeOutput( getCanonicalPath(getBaseTemplatePath()) ); +``` diff --git a/docs/functions/getclasspath.md b/docs/functions/getclasspath.md new file mode 100644 index 000000000..f4dd33361 --- /dev/null +++ b/docs/functions/getclasspath.md @@ -0,0 +1,19 @@ +# getClassPath + +Returns an array containing the Java classPath of the current environment. + +```javascript +getClassPath() +``` + +```javascript +returns array +``` + +## getClassPath Example + +It's containing the Java classPath of the current environment. It supported in Lucee. + +```javascript +writeDump(getClassPath()); +``` diff --git a/docs/functions/getclientvariableslist.md b/docs/functions/getclientvariableslist.md new file mode 100644 index 000000000..d9990721b --- /dev/null +++ b/docs/functions/getclientvariableslist.md @@ -0,0 +1,12 @@ +# getClientVariablesList + + Finds the client variables to which a page has write access. + Comma-delimited list of non-read-only client variables + +```javascript +getClientVariablesList() +``` + +```javascript +returns string +``` diff --git a/docs/functions/getcomponentmetadata.md b/docs/functions/getcomponentmetadata.md new file mode 100644 index 000000000..f840031a9 --- /dev/null +++ b/docs/functions/getcomponentmetadata.md @@ -0,0 +1,17 @@ +# getComponentMetadata + +Gets metadata (such as the functions and implemented interfaces of a component) for a CFC or ColdFusion interface. + +```javascript +getComponentMetadata(path) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | The dot-delimited path of the interface or CFC definition. | diff --git a/docs/functions/getcontextroot.md b/docs/functions/getcontextroot.md new file mode 100644 index 000000000..8d2397277 --- /dev/null +++ b/docs/functions/getcontextroot.md @@ -0,0 +1,11 @@ +# getContextRoot + +Returns path to the J2EE server context root for the current request. + +```javascript +getContextRoot() +``` + +```javascript +returns string +``` diff --git a/docs/functions/getcpuusage.md b/docs/functions/getcpuusage.md new file mode 100644 index 000000000..443f82327 --- /dev/null +++ b/docs/functions/getcpuusage.md @@ -0,0 +1,23 @@ +# getCpuUsage + + Gets the CPU usage with default or custom snapshot interval. + +```javascript +getCpuUsage([interval]); +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| interval | numeric | No | 1000 | Time in milliseconds. This is the time delay between two snapshots. | + +## Output CPU usage from current snapshot + +```javascript +getCpuUsage() +``` diff --git a/docs/functions/getcurrentcontext.md b/docs/functions/getcurrentcontext.md new file mode 100644 index 000000000..91c1d2b49 --- /dev/null +++ b/docs/functions/getcurrentcontext.md @@ -0,0 +1,19 @@ +# getCurrentContext + +Return the context (stacktrace) of the current position. + +```javascript +getCurrentContext() +``` + +```javascript +returns array +``` + +## Script Syntax + +Simple dump of the call stack + +```javascript +writeDump(getCurrentContext()); +``` diff --git a/docs/functions/getcurrenttemplatepath.md b/docs/functions/getcurrenttemplatepath.md new file mode 100644 index 000000000..62e9b840d --- /dev/null +++ b/docs/functions/getcurrenttemplatepath.md @@ -0,0 +1,17 @@ +# getCurrentTemplatePath + +Gets the absolute server file system path of the file that calls this function. + +```javascript +getCurrentTemplatePath() +``` + +```javascript +returns string +``` + +## Basic Example + +```javascript +getCurrentTemplatePath() +``` diff --git a/docs/functions/getdirectoryfrompath.md b/docs/functions/getdirectoryfrompath.md new file mode 100644 index 000000000..95ceb1e72 --- /dev/null +++ b/docs/functions/getdirectoryfrompath.md @@ -0,0 +1,25 @@ +# getDirectoryFromPath + +Extracts a directory from an absolute path. Returns the absolute path with a trailing slash and omits the filename. + +```javascript +getDirectoryFromPath(path) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | | + +## Basic Example + +```javascript +getDirectoryFromPath("C:\temp\file.txt") +``` + +### Expected Result: C:\temp\ diff --git a/docs/functions/getencoding.md b/docs/functions/getencoding.md new file mode 100644 index 000000000..646773ba1 --- /dev/null +++ b/docs/functions/getencoding.md @@ -0,0 +1,17 @@ +# getEncoding + +Returns the encoding (character set) of the Form or URL scope. + +```javascript +getEncoding(scope) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| scope | string | Yes | | | /Users/garethedwards/development/github/cfdocs/docs/functions/getencoding.md|url | diff --git a/docs/functions/getexception.md b/docs/functions/getexception.md new file mode 100644 index 000000000..cd53b2d84 --- /dev/null +++ b/docs/functions/getexception.md @@ -0,0 +1,30 @@ +# getException + + Used with the cftry and cfcatch tags. Retrieves a Java + exception object from a Java object. + +```javascript +getException(javaobject) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| javaobject | any | Yes | | | + +## Simple Example + +Renders map of exception data, when trying to access a non-existent element in an ArrayList. + +```javascript +arrayList = createObject("JAVA", "java.util.ArrayList").init(); +try {writeDump(arrayList.get(2));} +catch(java.lang.IndexOutOfBoundsException _) { + writeDump(getException(arrayList)); +} +``` diff --git a/docs/functions/getfilefrompath.md b/docs/functions/getfilefrompath.md new file mode 100644 index 000000000..53e456750 --- /dev/null +++ b/docs/functions/getfilefrompath.md @@ -0,0 +1,25 @@ +# getFileFromPath + + Extracts a filename from an absolute path. + +```javascript +getFileFromPath(path) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | | + +## Basic Example + +```javascript +getFileFromPath("C:\temp\file.txt") +``` + +### Expected Result: file.txt diff --git a/docs/functions/getfileinfo.md b/docs/functions/getfileinfo.md new file mode 100644 index 000000000..fe97dc2ff --- /dev/null +++ b/docs/functions/getfileinfo.md @@ -0,0 +1,33 @@ +# getFileInfo + +Returns information about on-disk or in-memory file. Return struct contains keys such as: lastModified, size, path, name, type, canWrite, canRead, isHidden and more. + +```javascript +getFileInfo(path) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | Path to the on-disk or in-memory file | + +## Output some information about a temporary file + +```javascript +myFile = getTempFile(getTempDirectory(),"testFile"); +fileInfo = getFileInfo(myFile); +isReadable = (not fileInfo.canRead ? 'un' : '')&'readable'; +isWritable = (not fileInfo.canWrite ? 'un' : '')&'writable'; +isHidden = (not fileInfo.isHidden ? 'not ' : '')&'hidden'; +date = DateTimeFormat(fileInfo.lastModified,'full'); +fileSize = NumberFormat(fileInfo.size / 1000 / 1000,'0.00'); +writeOutput('"'&fileInfo.name&'" is '&isReadable&', '&isWritable&' and '&isHidden&'. '); +writeOutput('It was at last modified at '&date&' and has a size of '&fileSize&' MB'); +``` + +### Expected Result: "testFile9217639658547923751.tmp" is readable, writable and not hidden. It was at last modified at Friday, November 3, 2017 3:58:08 PM UTC and has a size of 0.00 MB diff --git a/docs/functions/getfreespace.md b/docs/functions/getfreespace.md new file mode 100644 index 000000000..43ae6bf04 --- /dev/null +++ b/docs/functions/getfreespace.md @@ -0,0 +1,39 @@ +# getFreeSpace + + Gets information about free hard disk space or free in-memory VFS space. + +```javascript +getFreeSpace(path); +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | The Path to the Hard Disk Drive or to the in-memory file system - ram. | + +## Tag Syntax + +In the following example, in-memory file system memory for the application is set to 20 MB in ColdFusion Administrator. The function returns 20, which means the total space considered is 20 MB. This is because the value specified in the ColdFusion Administrator (Memory Limit per Application for In-Memory Virtual File System) is lesser than the value specified in the Application.cfc (20 MB).Application.cfc + +```javascript + + + + +``` + +## Tag Syntax + +space.cfm + +```javascript + + + Free Application RAM Memory = #decimalFormat(freeRAMSpace / (1024 * 1024))# MB +
Free Hard Disk Space = #decimalFormat(freeDiskSpace / (1024 * 1024 * 1024))# GB +``` diff --git a/docs/functions/getfunctioncalledname.md b/docs/functions/getfunctioncalledname.md new file mode 100644 index 000000000..6330d2b07 --- /dev/null +++ b/docs/functions/getfunctioncalledname.md @@ -0,0 +1,80 @@ +# getFunctionCalledName + + Returns the name of the variable used to call a defined function. This function can be used to return data from CFCs by simulating getters and setters. + +```javascript +getFunctionCalledName() +``` + +```javascript +returns string +``` + +## getFunctionCalledName Basic Example + +Show results of calling a function directly versus by reference + +```javascript +void function actualFunctionName(){ + writeOutput("actualFunctionName() was called as: #getFunctionCalledName()#
"); +} +writeOutput("

Calling actualFunctionName()

"); +actualFunctionName(); +writeOutput("

Calling actualFunctionName() via reference

"); +referenceToFunction = actualFunctionName; +referenceToFunction(); +``` + +## Getters and Setters Example + +Example of using getFunctionCalledName to create dynamic getters and setters + +```javascript +//callednamedemo.cfc +component +{ + variables.x1 = 1; + variables.y1 = 2; + + function init() { + return this; + } + + function get() { + var name = getFunctionCalledName(); + return variables[mid(name,4,len(name)-3)]; + } + + function set(value) { + var name = getFunctionCalledName(); + variables[mid(name,4,len(name)-3)] = value; + } + + this.getX1 = get; + this.getY1 = get; + this.setX1 = set; + this.setY1 = set; +} + + + + +function test() { + return getFunctionCalledName(); +} + +writeOutput(test() & "
"); // test +a = test; + +writeOutput(variables.a() & "
"); // a +o = new callednamedemo(); + +// shows *real* methods get(), SetX1() and getY1(), etc. +writeDump(o); +o.setX1(10); +o.setY1(20); + +writeOutput(o.getX1() & "
"); // 10 +writeOutput(o.getY1() & "
") ; // 20 +
+``` diff --git a/docs/functions/getfunctiondata.md b/docs/functions/getfunctiondata.md new file mode 100644 index 000000000..6af80e9ef --- /dev/null +++ b/docs/functions/getfunctiondata.md @@ -0,0 +1,26 @@ +# getFunctionData + +Return information to a function as struct + +```javascript +getFunctionData(functionName) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| functionName | string | Yes | | The function you want information for | | +| dialect | string | No | current template's dialect | The dialect you want details for | /Users/garethedwards/development/github/cfdocs/docs/functions/getfunctiondata.md|Lucee | + +## Output information about a function + +Returns a structure storing information about writeDump() + +```javascript +getFunctionData('writeDump') +``` diff --git a/docs/functions/getfunctionkeywords.md b/docs/functions/getfunctionkeywords.md new file mode 100644 index 000000000..195e3adad --- /dev/null +++ b/docs/functions/getfunctionkeywords.md @@ -0,0 +1,19 @@ +# getFunctionKeywords + +Returns all keywords defined with all functions. + +```javascript +getFunctionKeywords() +``` + +```javascript +returns array +``` + +## Simple getFunctionKeywords Example + +It returns all function keywords in array format. It is supported only in Lucee. + +```javascript +writeDump(getFunctionKeywords()); +``` diff --git a/docs/functions/getfunctionlist.md b/docs/functions/getfunctionlist.md new file mode 100644 index 000000000..c9b9cdc7e --- /dev/null +++ b/docs/functions/getfunctionlist.md @@ -0,0 +1,21 @@ +# getFunctionList + +Returns a struct with keys of the names of functions that are available in CFML. + +```javascript +getFunctionList() +``` + +```javascript +returns struct +``` + +## Check to see if a function exists + +CF11+ Uses the member function of structKeyExists. + +```javascript +getFunctionList().keyExists("reMatch") +``` + +### Expected Result: YES diff --git a/docs/functions/getgatewayhelper.md b/docs/functions/getgatewayhelper.md new file mode 100644 index 000000000..f2a45f9a0 --- /dev/null +++ b/docs/functions/getgatewayhelper.md @@ -0,0 +1,17 @@ +# getGatewayHelper + +Gets a Java GatewayHelper object that provides methods and properties for use with a ColdFusion event gateway. + +```javascript +getGatewayHelper(gatewayID) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| gatewayID | string | Yes | | Identifier of the gateway that provides the GatewayHelper object. | diff --git a/docs/functions/getgraphqlclient.md b/docs/functions/getgraphqlclient.md new file mode 100644 index 000000000..892ee7fcd --- /dev/null +++ b/docs/functions/getgraphqlclient.md @@ -0,0 +1,34 @@ +# getGraphQLClient + +Use this method to create the GraphQL client that will communicate with the server that contains the schema. Pass the configuration parameters to get the client. + +```javascript +getGraphQLClient(parameterStruct) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| parameterStruct | struct | Yes | | A structure defining the properties of the GraphQL client | + +## Create a GraphQL client (Script syntax) + +Creates a GraphQL client with specified properties + +```javascript +gqlClient = getGraphQLClient({ + service_name: "server-name", + type: "graphqlclient", + raw_http_client: true, + service_url: "endpoint-url", + root_folder: "root_folder", + headers: { values: "auth-value", keys: "auth-key" }, + batching_configuration: { enabled: true, batch_interval_ms: 10, max_batch_size: 15 }, + subscription_configuration: { websocket_url: "wss://websocket-url", subscription_heartbeat_timeout: 5, subscription_heartbeat_timeunit: "nano" } +}); +``` diff --git a/docs/functions/gethttprequestdata.md b/docs/functions/gethttprequestdata.md new file mode 100644 index 000000000..65f19f426 --- /dev/null +++ b/docs/functions/gethttprequestdata.md @@ -0,0 +1,29 @@ +# getHTTPRequestData + +Returns HTTP request headers and request body. The resulting structure contains the following keys: + content (the request body), + headers (a structure of request headers), + method (same as cgi.request_method), + protocol (same as cgi.server_protocol). + +```javascript +getHTTPRequestData() +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| includeBody | boolean | Yes | false | Whether return the body or not.

NOTE: This can only be done once.
If you expect the body to contain content which causes an exception in ColdFusion, set it to false as well and process it yourself. | /Users/garethedwards/development/github/cfdocs/docs/functions/gethttprequestdata.md|false | + +## GetHttpRequestData Example + +Returns HTTP request headers and request body in structure format. + +```javascript +writeDump(GetHttpRequestData()); +``` diff --git a/docs/functions/gethttptimestring.md b/docs/functions/gethttptimestring.md new file mode 100644 index 000000000..3046440a1 --- /dev/null +++ b/docs/functions/gethttptimestring.md @@ -0,0 +1,25 @@ +# getHTTPTimeString + + Gets the current time, in the Universal Time code (UTC). + +```javascript +getHTTPTimeString(DateTime) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| DateTime | date | No | now() | | + +## Output UTC Date of 2017/8/8 14:12:10 + +```javascript +getHTTPTimeString("2017/8/8 14:12:10") +``` + +### Expected Result: Tue, 08 Aug 2017 14:12:10 GMT diff --git a/docs/functions/getk2serverdoccount.md b/docs/functions/getk2serverdoccount.md new file mode 100644 index 000000000..0e7cdb0c8 --- /dev/null +++ b/docs/functions/getk2serverdoccount.md @@ -0,0 +1,11 @@ +# getK2ServerDocCount + +Determines the number of documents that can be searched by the CFML registered K2 Server. This function is used primarily by the CFML Verity and K2Server Administrator pages, and requires significant processing time. Avoid using it in production applications. This function uses Verity K2Server Release K2.2.0. + +```javascript +getK2ServerDocCount() +``` + +```javascript +returns numeric +``` diff --git a/docs/functions/getk2serverdoccountlimit.md b/docs/functions/getk2serverdoccountlimit.md new file mode 100644 index 000000000..caf88d46e --- /dev/null +++ b/docs/functions/getk2serverdoccountlimit.md @@ -0,0 +1,11 @@ +# getK2ServerDocCountLimit + +Gets the maximum number of documents that the CFML registered K2 Server is permitted to return from a search. This function is used primarily by the CFML Verity and K2Server Administrator pages. This function uses Verity K2Server Release K2.2.0. + +```javascript +getK2ServerDocCountLimit() +``` + +```javascript +returns numeric +``` diff --git a/docs/functions/getlocale.md b/docs/functions/getlocale.md new file mode 100644 index 000000000..13add13e2 --- /dev/null +++ b/docs/functions/getlocale.md @@ -0,0 +1,25 @@ +# getLocale + + Gets the current geographic/language locale value. + To set the default display format of date, time, number, and + currency values in a CFML application session, you use + the SetLocale function. + +```javascript +getLocale() +``` + +```javascript +returns string +``` + +## Output current Locale than set it to swiss locale + +```javascript +writeOutput(getlocale()); +writeOutput(' → '); +setLocale('de_ch'); +writeOutput(getlocale()); +``` + +### Expected Result: english (us) → german (swiss) diff --git a/docs/functions/getlocalecountry.md b/docs/functions/getlocalecountry.md new file mode 100644 index 000000000..014e3ef3e --- /dev/null +++ b/docs/functions/getlocalecountry.md @@ -0,0 +1,20 @@ +# getLocaleCountry + +Gets the country where the locale belongs to. + +```javascript +getLocaleCountry() +``` + +```javascript +returns string +``` + +## Output current Locale's display name than set it to swiss locale + +```javascript +writeOutput(getLocaleCountry()); +writeOutput(' → '); +setLocale('de_ch'); +writeOutput(getLocaleCountry()); +``` diff --git a/docs/functions/getlocaledisplayname.md b/docs/functions/getlocaledisplayname.md new file mode 100644 index 000000000..859494a36 --- /dev/null +++ b/docs/functions/getlocaledisplayname.md @@ -0,0 +1,29 @@ +# getLocaleDisplayName + +Gets a locale value and displays the name in a manner that is appropriate to a specific locale. By default, gets the current locale in the current locale's language. + +```javascript +getLocaleDisplayName([locale, inLocale]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| locale | string | No | | The locale whose name you want. The default is the current ColdFusion locale, or if no ColdFusion locale has been set, the JVM locale. | +| inLocale | string | No | | The locale in which to return the name. The default is the current ColdFusion locale, or if no ColdFusion locale has been set, the JVM locale. | + +## Output current Locale's display name than set it to swiss locale + +```javascript +writeOutput(getLocaleDisplayName()); +writeOutput(' → '); +setLocale('de_ch'); +writeOutput(getLocaleDisplayName()); +``` + +### Expected Result: English (United States) → Deutsch (Schweiz) diff --git a/docs/functions/getlocaleinfo.md b/docs/functions/getlocaleinfo.md new file mode 100644 index 000000000..9559148c9 --- /dev/null +++ b/docs/functions/getlocaleinfo.md @@ -0,0 +1,44 @@ +# getLocaleInfo + +Returns a structure containing info to a specific locale. This function combines the locale functions `getLocaleCountry`, `getLocaleDisplayName`, and `getLocaleLanguage` to a single function. + +```javascript +getLocaleInfo() +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| locale | string | No | getLocale() | Geographic/language locale value, where the format is a combination of an ISO 639-1 code and an optional ISO 3166-1 code separated by a dash or an underscore. | /Users/garethedwards/development/github/cfdocs/docs/functions/getlocaleinfo.md|... | +| dspLocale | string | No | getLocaleDisplayName() | Locale's display name/output language | /Users/garethedwards/development/github/cfdocs/docs/functions/getlocaleinfo.md|... | + +## Get information about the page's locale + +```javascript +getLocaleInfo() +``` + +## Output page's locale in a divergent language + +Outputs the language locale of the page in German. + +```javascript +getLocaleInfo(dspLocale='German').display.language +``` + +### Expected Result: Englisch + +## Output German locale in a page's language + +Outputs the German locale in the language defined for the page. + +```javascript +getLocaleInfo(locale='de-DE', dspLocale=getLocaleDisplayName()).display.country +``` + +### Expected Result: Germany diff --git a/docs/functions/getlocalelanguage.md b/docs/functions/getlocalelanguage.md new file mode 100644 index 000000000..e9655d3f1 --- /dev/null +++ b/docs/functions/getlocalelanguage.md @@ -0,0 +1,20 @@ +# getLocaleLanguage + +Gets the language from where the locale belongs to. + +```javascript +getLocaleLanguage() +``` + +```javascript +returns string +``` + +## Output current Locale's display name than set it to swiss locale + +```javascript +writeOutput(getLocaleLanguage()); +writeOutput(' → '); +setLocale('de_ch'); +writeOutput(getLocaleLanguage()); +``` diff --git a/docs/functions/getlocalhostip.md b/docs/functions/getlocalhostip.md new file mode 100644 index 000000000..ab4b02e72 --- /dev/null +++ b/docs/functions/getlocalhostip.md @@ -0,0 +1,19 @@ +# getLocalhostIP + +Returns the localhost IP address, which is 127.0.0.1 for IPv4 and ::1 for IPv6 addresses. + +```javascript +getLocalhostIP() +``` + +```javascript +returns string +``` + +## getLocalhostIP Example + +Here we've example to get localhost ip address using getLocalhostIP() + +```javascript +writeOutput(getLocalhostIP()); +``` diff --git a/docs/functions/getluceeid.md b/docs/functions/getluceeid.md new file mode 100644 index 000000000..7d3b86f3c --- /dev/null +++ b/docs/functions/getluceeid.md @@ -0,0 +1,19 @@ +# getLuceeID + +Get ID, ApiKey and SecurityKey for the Server and the current Web-Context. + +```javascript +getLuceeID() +``` + +```javascript +returns struct +``` + +## Dump getLuceeID + +Display ID, ApiKey and SecurityKey for the Server and Web-Context. + +```javascript +dump( getLuceeID() ) +``` diff --git a/docs/functions/getmemoryusage.md b/docs/functions/getmemoryusage.md new file mode 100644 index 000000000..b159a77e6 --- /dev/null +++ b/docs/functions/getmemoryusage.md @@ -0,0 +1,23 @@ +# getMemoryUsage + +Return detailed information to the memory usage of the container. + +```javascript +getMemoryUsage([type]) +``` + +```javascript +returns query +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| type | string | No | | Specify the type of memory information to return. If not specified, both types are returned. | /Users/garethedwards/development/github/cfdocs/docs/functions/getmemoryusage.md|non_heap | + +## Dump memory usage query + +```javascript +writeDump(getMemoryUsage()); +``` diff --git a/docs/functions/getmetadata.md b/docs/functions/getmetadata.md new file mode 100644 index 000000000..8dc1a1718 --- /dev/null +++ b/docs/functions/getmetadata.md @@ -0,0 +1,25 @@ +# getMetadata + +Gets metadata (the methods, properties, and parameters of a component) associated with an object that is deployed on the CFML server. + +```javascript +getMetadata(value) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | A ColdFusion component, user-defined function, or ColdFusion query. Within a CFC, the parameter can also specify the `this` scope. | + +## Dump Metadata of CFC Instance + +CF9+ + +```javascript +writeDump(getMetadata(new Query())); +``` diff --git a/docs/functions/getmetricdata.md b/docs/functions/getmetricdata.md new file mode 100644 index 000000000..b373b203f --- /dev/null +++ b/docs/functions/getmetricdata.md @@ -0,0 +1,18 @@ +# getMetricData + +Gets server performance metrics + [mode - quickly] + +```javascript +getMetricData(mode) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| mode | string | Yes | | perf_monitor - Returns internal data, in a structure.
simple_load - Returns an integer value that is computed
from the state of the server's internal
queues. Indicates the overall server load.
prev_req_time - Returns the time, in milliseconds, that it
took the server to process the previous
request.
avg_req_time - Returns the average time, in milliseconds,
that it takes the server to process a
request. | /Users/garethedwards/development/github/cfdocs/docs/functions/getmetricdata.md|avg_req_time | diff --git a/docs/functions/getnumericdate.md b/docs/functions/getnumericdate.md new file mode 100644 index 000000000..e9c1c590c --- /dev/null +++ b/docs/functions/getnumericdate.md @@ -0,0 +1,27 @@ +# getNumericDate + +Returns a real number whose integer part represents the number of days since the EPOCH and whose fractional part represents the time value expressed in hours then divided by 24. NOTE: Lucee (and ACF) uses 12/30/1899 00:00:00 as it's epoch time. See links below. + +```javascript +getNumericDate(arg1) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| arg1 | any | Yes | | A datetime object or a date-parsable String. | + +## Convert a date string to a numeric date - Tag Syntax + +This numeric date represents the number of days between December 30, 1899 and January 1, 2008. + +```javascript +getNumericDate('2018-01-01') +``` + +### Expected Result: 43101 diff --git a/docs/functions/getpagecontext.md b/docs/functions/getpagecontext.md new file mode 100644 index 000000000..39b9243f3 --- /dev/null +++ b/docs/functions/getpagecontext.md @@ -0,0 +1,11 @@ +# getPageContext + + Gets the current java PageContext object that provides access to page attributes and configuration, request and response objects. + +```javascript +getPageContext() +``` + +```javascript +returns any +``` diff --git a/docs/functions/getprinterinfo.md b/docs/functions/getprinterinfo.md new file mode 100644 index 000000000..0440dfdf7 --- /dev/null +++ b/docs/functions/getprinterinfo.md @@ -0,0 +1,31 @@ +# getPrinterInfo + +Determines which print attributes are supported by a selected printer. + +```javascript +getPrinterInfo([printer]) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| printer | string | No | | Name of the printer | + +## Output printer info if exists + +```javascript +try { + writeDump(getPrinterInfo()); +} +catch (Application e) { + writeOutput(e.message & "
" & e.detail); +} +catch (any e) { + rethrow; +} +``` diff --git a/docs/functions/getprinterlist.md b/docs/functions/getprinterlist.md new file mode 100644 index 000000000..7b5bb6472 --- /dev/null +++ b/docs/functions/getprinterlist.md @@ -0,0 +1,25 @@ +# getPrinterList + +Returns list of printers accessible by the ColdFusion server + +```javascript +getPrinterList([delimiter]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| delimiter | string | No | | list separator | + +## Return comma separated printer list + +On a server with printers, this will display a result. If there are none, it will be an empty string. + +```javascript +getPrinterList(); +``` diff --git a/docs/functions/getprofilesections.md b/docs/functions/getprofilesections.md new file mode 100644 index 000000000..03efb3326 --- /dev/null +++ b/docs/functions/getprofilesections.md @@ -0,0 +1,21 @@ +# getProfileSections + +Gets all the sections of an initialization file. +Returns a struct whose format is as follows: +- Each initialization file section name is a key in the struct +- Each list of entries in a section of an initialization file is a value in the struct + +```javascript +getProfileSections(path [,encoding]) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| path | string | Yes | | Absolute path of initialization file | | +| encoding | string | No | | CF11+ Encoding of the initialization (ini) file | /Users/garethedwards/development/github/cfdocs/docs/functions/getprofilesections.md|utf-16 | diff --git a/docs/functions/getprofilestring.md b/docs/functions/getprofilestring.md new file mode 100644 index 000000000..3600e7bdd --- /dev/null +++ b/docs/functions/getprofilestring.md @@ -0,0 +1,28 @@ +# getProfileString + +Gets an initialization file entry. An initialization file assigns values to configuration variables, also known as entries, that are set when the system + boots, the operating system comes up, or an application starts. Returns the entry - if no value, returns an empty string. + +```javascript +getProfileString(inipath, section, entry) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| inipath | string | Yes | | | +| section | string | Yes | | | +| entry | string | Yes | | | + +## Tag Syntax + +```javascript + + + +``` diff --git a/docs/functions/getreadableimageformats.md b/docs/functions/getreadableimageformats.md new file mode 100644 index 000000000..c9b5d686a --- /dev/null +++ b/docs/functions/getreadableimageformats.md @@ -0,0 +1,17 @@ +# getReadableImageFormats + +Returns a list of image formats that ColdFusion can read on the operating system where ColdFusion is deployed. + +```javascript +getReadableImageFormats() +``` + +```javascript +returns string +``` + +## Show all available image file extensions + +```javascript +lCase(listChangeDelims(getReadableImageFormats(),", ")) +``` diff --git a/docs/functions/getsafehtml.md b/docs/functions/getsafehtml.md new file mode 100644 index 000000000..e5af68f8f --- /dev/null +++ b/docs/functions/getsafehtml.md @@ -0,0 +1,37 @@ +# getSafeHTML + +Sanitizes HTML using antisamy policy rules. + +```javascript +getSafeHTML(inputString [, PolicyFile, throwOnError]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| inputString | string | Yes | | String to be sanitized | +| PolicyFile | string | No | | File path for custom antisamy policy file. Can be defined in the application scope or if not defined will use ColdFusion server default | +| throwOnError | boolean | No | | If true will throw error else empty string will be returned | + +## application setting demo + +AntiSamy parameter can be set in the application scope + +```javascript + + + +``` + +## Usage + +demonstrates usage + +```javascript + +``` diff --git a/docs/functions/getsoaprequest.md b/docs/functions/getsoaprequest.md new file mode 100644 index 000000000..144db0883 --- /dev/null +++ b/docs/functions/getsoaprequest.md @@ -0,0 +1,29 @@ +# getSOAPRequest + +Returns an XML object that contains the entire SOAP request. Usually called from within a web service CFC. + +```javascript +getSOAPRequest(webservice) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| webservice | any | No | | A webservice object as returned from the cfobject tag or the createObject function | + +## Create a SOAP call and retrieve the request + +Create a SOAP webservice to call, then we can use getSOAPRequest() to view the request + +```javascript +soapURL = "https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl"; +ws = createObject("webservice", soapURL); +zipLatLong = ws.LatLonListZipCode("10001"); +req = getSOAPRequest(ws); +writeDump(req); +``` diff --git a/docs/functions/getsoaprequestheader.md b/docs/functions/getsoaprequestheader.md new file mode 100644 index 000000000..7d62cad0c --- /dev/null +++ b/docs/functions/getsoaprequestheader.md @@ -0,0 +1,19 @@ +# getSOAPRequestHeader + +Obtains a SOAP request header. Call only from within a CFC web service function that is processing a request as a SOAP web service. + +```javascript +getSOAPRequestHeader(namespace, name [, asXML]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| namespace | string | Yes | | A String that is the namespace for the header | +| name | string | Yes | | A String that is the name of the header | +| asXML | boolean | No | NO | If True, the header is returned as a CFML XML object;
if false (default), the header is returned as a Java object. | diff --git a/docs/functions/getsoapresponse.md b/docs/functions/getsoapresponse.md new file mode 100644 index 000000000..3137f51b3 --- /dev/null +++ b/docs/functions/getsoapresponse.md @@ -0,0 +1,29 @@ +# getSOAPResponse + +Returns an XML object that contains the entire SOAP response after invoking a web service. + +```javascript +getSOAPResponse(webservice) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| webservice | any | Yes | | A webservice object as returned from the cfobject tag or the createObject function. | + +## Create a SOAP call and retrieve the response + +Create a SOAP webservice to call, then we can use getSOAPResponse() to view the full response + +```javascript +soapURL = "https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl"; +ws = createObject("webservice", soapURL); +zipLatLong = ws.LatLonListZipCode("10001"); +res = getSOAPResponse(ws); +writeDump(res); +``` diff --git a/docs/functions/getsoapresponseheader.md b/docs/functions/getsoapresponseheader.md new file mode 100644 index 000000000..0bdfd29d8 --- /dev/null +++ b/docs/functions/getsoapresponseheader.md @@ -0,0 +1,20 @@ +# getSOAPResponseHeader + +Returns a SOAP response header. Call this function from within code that is invoking a web service after making a web service request. + +```javascript +getSOAPResponseHeader(webservice, namespace, name [, asXML]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| webservice | any | Yes | | A webservice object as returned from the cfobject tag or the createObject function. | +| namespace | string | Yes | | A String that is the namespace for the header. | +| name | string | Yes | | A String that is the name of the SOAP header. | +| asXML | boolean | No | NO | If True, the header is returned as a CFML XML object;
if false (default), the header is returned as a Java object. | diff --git a/docs/functions/getsystemfreememory.md b/docs/functions/getsystemfreememory.md new file mode 100644 index 000000000..c636cb05a --- /dev/null +++ b/docs/functions/getsystemfreememory.md @@ -0,0 +1,17 @@ +# getSystemFreeMemory + +Gets details of free memory. + +```javascript +getSystemFreeMemory(); +``` + +```javascript +returns numeric +``` + +## Get free memory in MB + +```javascript +#NumberFormat(getSystemFreeMemory() / 1000 / 1000,"0.00")# MB +``` diff --git a/docs/functions/getsystemtotalmemory.md b/docs/functions/getsystemtotalmemory.md new file mode 100644 index 000000000..b083fd8e4 --- /dev/null +++ b/docs/functions/getsystemtotalmemory.md @@ -0,0 +1,23 @@ +# getSystemTotalMemory + + Gets details of the memory that is available for the operating system, in bytes. + +```javascript +getSystemTotalMemory(); +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| region | string | No | | Indicates the cache region from which to remove the stored objects. If no value is specified, default cache region is considered by default. | + +## The in-memory file system memory set in cfadmin + +```javascript +#NumberFormat(getSystemTotalMemory() / 1000 / 1000,"0.00")# MB +``` diff --git a/docs/functions/gettagdata.md b/docs/functions/gettagdata.md new file mode 100644 index 000000000..76bf7da82 --- /dev/null +++ b/docs/functions/gettagdata.md @@ -0,0 +1,27 @@ +# getTagData + +Return information to a Tag as Struct + +```javascript +getTagData(nameSpaceWithSeperator, tagName) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| nameSpaceWithSeperator | string | Yes | | | | +| tagName | string | Yes | | | | +| dialect | string | No | current template's dialect | Define the dialect you want details for | /Users/garethedwards/development/github/cfdocs/docs/functions/gettagdata.md|Lucee | + +## Output information about a tag + +Returns a structure storing information about <cfmail> + +```javascript +getTagData('cf','mail') +``` diff --git a/docs/functions/gettaglist.md b/docs/functions/gettaglist.md new file mode 100644 index 000000000..232e53ec9 --- /dev/null +++ b/docs/functions/gettaglist.md @@ -0,0 +1,20 @@ +# getTagList + +Gets a struct that contains a list CF language tags + +```javascript +getTagList() +``` + +```javascript +returns struct +``` + +## Simple example of getTagList function + +Uses the getTagList function to return a list of CF tags + +```javascript +list = gettagList(); +writeDump(list); +``` diff --git a/docs/functions/gettempdirectory.md b/docs/functions/gettempdirectory.md new file mode 100644 index 000000000..d3348c0e9 --- /dev/null +++ b/docs/functions/gettempdirectory.md @@ -0,0 +1,23 @@ +# getTempDirectory + +Gets the path of the directory that CFML uses for + temporary files. Before using this function in an application, + test to determine the directory it returns under your account. + Returns the absolute pathname of a directory, including a + trailing slash. + +```javascript +getTempDirectory() +``` + +```javascript +returns string +``` + +## Show temp directory path + +File system path where temporary files are stored + +```javascript +getTempDirectory() +``` diff --git a/docs/functions/gettempfile.md b/docs/functions/gettempfile.md new file mode 100644 index 000000000..a5a725e07 --- /dev/null +++ b/docs/functions/gettempfile.md @@ -0,0 +1,27 @@ +# getTempFile + + Creates a temporary file in a directory whose name starts with + (at most) the first three characters of prefix. + +```javascript +getTempFile(dir, prefix) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| dir | string | Yes | | | +| prefix | string | Yes | | | + +## Create temp file in temp dir + +Returns path of file created + +```javascript +getTempFile(getTempDirectory(),"testFile") +``` diff --git a/docs/functions/gettemplatepath.md b/docs/functions/gettemplatepath.md new file mode 100644 index 000000000..7a76493cc --- /dev/null +++ b/docs/functions/gettemplatepath.md @@ -0,0 +1,17 @@ +# getTemplatePath + +Returns the filepath of the base template in this request + +```javascript +getTemplatePath() +``` + +```javascript +returns string +``` + +## Show template path + +```javascript +getTemplatePath() +``` diff --git a/docs/functions/gettickcount.md b/docs/functions/gettickcount.md new file mode 100644 index 000000000..6d5959c31 --- /dev/null +++ b/docs/functions/gettickcount.md @@ -0,0 +1,31 @@ +# getTickCount + + Returns the current value of an internal millisecond timer. + +```javascript +getTickCount() +``` + +```javascript +returns numeric +``` + +## Script Syntax + +Outputs the current value of the internal millisecond timer + +```javascript +writeOutput( getTickCount() ) +``` + +## A simple timer + +Outputs the millisecond difference between a starting point and end point + +```javascript +start = getTickCount(); + sleep( 1000 ); + writeOutput( getTickCount() - start ); +``` + +### Expected Result: 1000 (note: may be off by a few ms depending on the environment) diff --git a/docs/functions/gettimezone.md b/docs/functions/gettimezone.md new file mode 100644 index 000000000..49e2263a0 --- /dev/null +++ b/docs/functions/gettimezone.md @@ -0,0 +1,22 @@ +# getTimeZone + +Returns the time zone for the current request. + +```javascript +getTimeZone() +``` + +```javascript +returns string +``` + +## What is the current time zone that's set? + +Set the time zone, then retrieve it. + +```javascript +setTimeZone("Etc/UTC"); +writeOutput(getTimeZone().timezone); +``` + +### Expected Result: Etc/UTC diff --git a/docs/functions/gettimezoneinfo.md b/docs/functions/gettimezoneinfo.md new file mode 100644 index 000000000..b24fe019e --- /dev/null +++ b/docs/functions/gettimezoneinfo.md @@ -0,0 +1,47 @@ +# getTimezoneInfo + + Gets local time zone information for the computer on which it + is called, relative to Universal Time Coordinated (UTC). UTC is + the mean solar time of the meridian of Greenwich, England. + +```javascript +getTimezoneInfo(text) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| timezone | string | Yes | | Lucee Specify a timezone to return info from | +| locale | string | Yes | | Lucee Locale used to format the output | + +## Output timezone information + +This example shows the use of GetTimeZoneInfo + +```javascript + +The local date and time are #now()#. + + + +

Total offset in seconds is #info.utcTotalOffset#.

+

Offset in hours is #info.utcHourOffset#.

+

Offset in minutes minus the offset in hours is #info.utcMinuteOffset#.

+

Is Daylight Savings Time in effect? #info.isDSTOn#.

+
+``` + +## Get Hawaii timezone information in German + +Shows the use of getTimeZoneInfo for a known / specific timezone with German locale. This syntax is only supported in Lucee. + +```javascript + +var tz = getTimeZoneInfo("US/Hawaii", "de-DE"); + +``` diff --git a/docs/functions/gettoken.md b/docs/functions/gettoken.md new file mode 100644 index 000000000..d28a5136f --- /dev/null +++ b/docs/functions/gettoken.md @@ -0,0 +1,34 @@ +# getToken + + Determines whether a token of the list in the delimiters + parameter is present in a string. + Returns the token found at position index of the string, as a + string. If index is greater than the number of tokens in the + string, returns an empty string. + +```javascript +getToken(string, index [, delimiters]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| index | numeric | Yes | | | +| delimiters | string | No | , | | + +## Tag Syntax + +In the following example, the function call requests element number 2 from the string, using the delimiter '[:;".' + +```javascript + + +getToken(mystring, 3) is : #getToken(mystring, 3)# + +``` diff --git a/docs/functions/gettotalspace.md b/docs/functions/gettotalspace.md new file mode 100644 index 000000000..c1c2653fd --- /dev/null +++ b/docs/functions/gettotalspace.md @@ -0,0 +1,26 @@ +# getTotalSpace + + Returns the total disk space or in-memory space available for an application. + +```javascript +getTotalSpace(path); +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | path to the hard drive or for in memory file system. | + +## Tag Syntax + +the in-memory file system memory set in cfadmin and should return that. + +```javascript + +total app ram memory: #decimalFormat(totalRamSpace)/(1024 * 1024)# mb +``` diff --git a/docs/functions/getuserroles.md b/docs/functions/getuserroles.md new file mode 100644 index 000000000..4296e42d0 --- /dev/null +++ b/docs/functions/getuserroles.md @@ -0,0 +1,11 @@ +# getUserRoles + +Retrieves the list of roles for the current user. + +```javascript +getUserRoles() +``` + +```javascript +returns string +``` diff --git a/docs/functions/getvariable.md b/docs/functions/getvariable.md new file mode 100644 index 000000000..9fbf8bb98 --- /dev/null +++ b/docs/functions/getvariable.md @@ -0,0 +1,26 @@ +# getVariable + +Retrieves value of a variable + +```javascript +getVariable(name) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | | + +## Retrieve value of a variable + +```javascript +a=1; +writeOutput(getVariable('a')); +``` + +### Expected Result: 1 diff --git a/docs/functions/getvfsmetadata.md b/docs/functions/getvfsmetadata.md new file mode 100644 index 000000000..3209abfc8 --- /dev/null +++ b/docs/functions/getvfsmetadata.md @@ -0,0 +1,17 @@ +# getVFSMetadata + +Returns metadata for VFS + +```javascript +getVFSMetadata(fileSystemType) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| fileSystemType | string | Yes | | | diff --git a/docs/functions/getwriteableimageformats.md b/docs/functions/getwriteableimageformats.md new file mode 100644 index 000000000..bd510eff9 --- /dev/null +++ b/docs/functions/getwriteableimageformats.md @@ -0,0 +1,11 @@ +# getWriteableImageFormats + +Returns a list of image formats that ColdFusion can write on the operating system where ColdFusion is deployed. + +```javascript +getWriteableImageFormats() +``` + +```javascript +returns string +``` diff --git a/docs/functions/hash.md b/docs/functions/hash.md new file mode 100644 index 000000000..fd29d7867 --- /dev/null +++ b/docs/functions/hash.md @@ -0,0 +1,42 @@ +# hash + +Converts a string into a fixed length hexadecimal string. + +NOTE: The result is useful for comparison and validation, such as storing and validating a hashed password without exposing the original password. + +```javascript +hash(string [, algorithm [, encoding]] [, additionalIterations]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | | +| algorithm | string | No | MD5 | CF7+ A supported algorithm such as MD5,SHA,SHA-256,SHA-384, or SHA-512. Of those listed SHA-512 is the strongest and generates a 128 character hex result.

NOTE: The Enterprise Edition of ColdFusion installs the RSA BSafe Crypto-J library, which provides FIPS-140 Compliant Strong Cryptography. This includes additional algorithms. You can also install additional cryptography algorithms and use those hashing algorithms. | +| encoding | string | No | UTF-8 | CF7+ A string specifying the encoding to use when converting the string to byte data used by the hash algorithm.
Must be a character encoding name recognized by the Java runtime.

NOTE: The default is specified by the value of `defaultCharset` in the `neo-runtime.xml` file, which is normally `UTF-8`.
NOTE: This is ignored when using the `CFMX_COMPAT` algorithm. | +| additionalIterations | numeric | No | 0 | CF10+ Iterates the number of times the hash is computed to create a more computationally intensive hash. Lucee and Adobe CF implement this differently (off by one), see compatibility notes below.

NOTE: This parameter appears to be ignored if the `CFMX_COMPAT` default algorithm is used. | + +## SHA-256 Hash Example + +Returns 64 character hex result. + +```javascript +hash("something", "SHA-256", "UTF-8") +``` + +### Expected Result: 3FC9B689459D738F8C88A3A48AA9E33542016B7A4052E001AAA536FCA74813CB + +## MD5 Hash Example + +MD5 is not recommended for use requiring security. + +```javascript +hash("something") +``` + +### Expected Result: 437B930DB84B8079C2DD804A71936B5F diff --git a/docs/functions/hash40.md b/docs/functions/hash40.md new file mode 100644 index 000000000..bf7dbccfa --- /dev/null +++ b/docs/functions/hash40.md @@ -0,0 +1,21 @@ +# hash40 + +Converts a variable-length string to a 32-byte, hexadecimal string, using the MD5 algorithm. +Note: It is not possible to convert the hash result back to the source string. + +```javascript +hash40(input [, algorithm] [, encoding] [, numIterations]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| input | any | Yes | | String for hashing | +| algorithm | string | No | | The algorithm to use to hash the string. Supported are the following algorithms:
- CFMX_COMPAT: generating a hash string using classic CFML algorithm.
- MD5: (default) Generates a 32-character, hexadecimal string, using the MD5 algorithm.
- SHA: Generates a 28-character string using the Secure Hash Standard SHA-1 algorithm specified by Nation Institute of Standards and Technology (NIST) FIPS-180-2.
- SHA-256: Generates a 44-character string using the SHA-256 algorithm specified by FIPS-180-2.
- SHA-384: Generates a 64-character string using the SHA-384 algorithm specified by FIPS-180-2.
- SHA-512: Generates an 88-character string using the SHA-1 algorithm specified by FIPS-180-2. | +| encoding | string | No | | Encoding which will be used by the hash algorithm | +| numIterations | numeric | No | 1 | number of iterations | diff --git a/docs/functions/hmac.md b/docs/functions/hmac.md new file mode 100644 index 000000000..1272e9585 --- /dev/null +++ b/docs/functions/hmac.md @@ -0,0 +1,28 @@ +# hmac + +Creates a keyed-hash message authentication code (HMAC), which can be used to verify authenticity and integrity of a message by two parties that share the key. + +```javascript +hmac(message, key [, algorithm] [, encoding] ) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| message | any | Yes | | The message or data to authenticate. This can be a String or a byte array. | | +| key | any | Yes | | The secret key. The key can be a String or byte array. | | +| algorithm | string | No | HMACMD5 | An algorithm supported by the java crypto provider. | /Users/garethedwards/development/github/cfdocs/docs/functions/hmac.md|HMACSHA512 | +| encoding | string | No | utf-8 | The character encoding to use when converting the message to bytes. Must be a character encoding name recognized by the Java runtime. | /Users/garethedwards/development/github/cfdocs/docs/functions/hmac.md|utf-16 | + +## Example HMAC Using HMACSHA256 + +```javascript +hmac("msg", "secret", "HMACSHA256") +``` + +### Expected Result: FE4F9C418F683F034F6AF90D1DD5B86AC0355DD96332C59CC74598D0736107F6 diff --git a/docs/functions/hour.md b/docs/functions/hour.md new file mode 100644 index 000000000..91b48d46c --- /dev/null +++ b/docs/functions/hour.md @@ -0,0 +1,40 @@ +# hour + +Extracts the hour of the day from a date/time object. + Ordinal value of the hour, in the range 0 - 23. + +```javascript +hour(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.hour() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | Date/time object, in the range 100 AD-9999 AD.
NOTE: When passing a date/time value as a string, enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date/time object. | + +## Hour of a datetime object + +```javascript +dt = createdatetime(2016,1,1,5,30,25); +h = hour( dt ); +writeoutput( h ); +``` + +### Expected Result: 5 + +## Current Hour of the day + +```javascript +hour( now() ) +``` diff --git a/docs/functions/htmlcodeformat.md b/docs/functions/htmlcodeformat.md new file mode 100644 index 000000000..70101a533 --- /dev/null +++ b/docs/functions/htmlcodeformat.md @@ -0,0 +1,25 @@ +# htmlCodeFormat + +Replaces special characters in a string with their HTML-escaped equivalents and inserts <pre> and </pre> tags at the beginning and end of the string. +The only difference between this function and `HTMLEditFormat` is that `HTMLEditFormat` doesn't surround the text in HTML `pre` tags. + +```javascript +htmlCodeFormat(string [, version]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| string | string | Yes | | A String or variable that contains one. | | +| version | numeric | No | 2.0 | HTML version to use. Currently ignored.
-1: The latest implementation of HTML
2.0: HTML 2.0 (Default)
3.2: HTML 3.2 | /Users/garethedwards/development/github/cfdocs/docs/functions/htmlcodeformat.md|3.2 | + +## Tag Syntax + +```javascript + #htmlCodeFormat(testString)# +``` diff --git a/docs/functions/htmleditformat.md b/docs/functions/htmleditformat.md new file mode 100644 index 000000000..65258b97a --- /dev/null +++ b/docs/functions/htmleditformat.md @@ -0,0 +1,26 @@ +# htmlEditFormat + +Replaces special characters in a string with their HTML-escaped equivalents. + +```javascript +htmlEditFormat( string [, version] ) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| string | string | Yes | | A string or a variable that contains one. | | +| version | numeric | No | 2.0 | HTML version to use; currently ignored. | /Users/garethedwards/development/github/cfdocs/docs/functions/htmleditformat.md|3.2 | + +## Escapes the HTML characters + +```javascript +htmlEditFormat( "This is a test & this is another Previous line was blank!!!" ) +``` + +### Expected Result: This is a test & this is another <This text is in angle brackets> Previous line was blank!!! diff --git a/docs/functions/htmlparse.md b/docs/functions/htmlparse.md new file mode 100644 index 000000000..4cf0e7519 --- /dev/null +++ b/docs/functions/htmlparse.md @@ -0,0 +1,28 @@ +# htmlParse + +Parse the given HTML/XHTML and converts it to an XML object. Similar to xmlParse, but this function is very forgiving + +```javascript +htmlParse(html [, caseSensitive]) +``` + +```javascript +returns xml +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| html | string | Yes | | | +| caseSensitive | boolean | No | | | + +## htmlParse Example + +Convert the HTML to Xml object.It supported in Lucee + +```javascript +HtmlContent = "Hello

world

"; +writeDump(htmlParse(HtmlContent)); +writeoutput(htmlParse('

This is example text

')); +``` diff --git a/docs/functions/iif.md b/docs/functions/iif.md new file mode 100644 index 000000000..874cadd92 --- /dev/null +++ b/docs/functions/iif.md @@ -0,0 +1,37 @@ +# iIf + +A boolean condition or value is passed into the first argument. If the condition is `true` the second argument is evaluated and returned, if `false` the third argument is evaluated and returned. + +```javascript +iIf(condition, expression1, expression2) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| condition | boolean | Yes | | A boolean value or an expression that evaluates to a boolean. | +| expression1 | string | Yes | | A CFML expression that is evaluated dynamically using Evaluate if the condition is `true`. | +| expression2 | string | Yes | | A CFML expression that is evaluated dynamically using Evaluate if the condition is `false`. | + +## Simple iIf Example + +```javascript +iIf( server.os.name IS "Bacon", de("Running Bacon OS"), de("Not Running Bacon OS") ) +``` + +### Expected Result: Not Running Bacon OS + +## Simple Example using Ternary Operator Instead + +Instead of using iif, you should use the ternary operator CF9+ + +```javascript +( (server.os.name IS "Bacon") ? "Running Bacon OS" : "Not Running Bacon OS") +``` + +### Expected Result: Not Running Bacon OS diff --git a/docs/functions/imageaddborder.md b/docs/functions/imageaddborder.md new file mode 100644 index 000000000..fbf9079a9 --- /dev/null +++ b/docs/functions/imageaddborder.md @@ -0,0 +1,68 @@ +# imageAddBorder + + Adds a rectangular border around the outside edge of a ColdFusion image. + +```javascript +imageAddBorder(name, thickness [, color] [, bordertype]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.addBorder(thickness [, color] [, bordertype]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| thickness | string | Yes | | Thickness of the border in pixels. The default value is 1. The border is added to the outside edge of the image; the image area is increased accordingly. | | +| color | string | No | black | Only valid if the borderType is not specified or if borderType = 'constant'. | | +| bordertype | string | No | constant | The type of border. | /Users/garethedwards/development/github/cfdocs/docs/functions/imageaddborder.md|wrap | + +## Tag Syntax + +Draw a green border around the outside edge of the red border. + +```javascript + +``` + +## Tag Syntax + +Add a 50-pixel-wide border to the outside edge of the image that is a tiled version of the image itself. + +```javascript + +``` + +## Tag Syntax + +Create the border. + +```javascript + +``` + +## Tag Syntax + +Create a ColdFusion image from an existing JPEG file. + +```javascript + +``` + +## Using addBorder member function + +CF11+ Lucee4.5+ Add border with optional color parameter + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.addBorder(5,"005100"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imageblur.md b/docs/functions/imageblur.md new file mode 100644 index 000000000..41d7b217e --- /dev/null +++ b/docs/functions/imageblur.md @@ -0,0 +1,42 @@ +# imageBlur + + Smooths (blurs) the ColdFusion image. + +```javascript +imageBlur(name [, blurradius]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.blur(blurradius) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| blurradius | numeric | No | 3 | The size of the blur radius. Value must be greater than or equal to 3 and less than or equal to 10. | + +## Tag Syntax + +This example shows how to blur an image by a radius of 10. + +```javascript + +``` + +## Using imageBlur member function + +CF11+ Lucee4.5+ Smooth or blur an image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.blur(5); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagecaptcha.md b/docs/functions/imagecaptcha.md new file mode 100644 index 000000000..2e3f07caa --- /dev/null +++ b/docs/functions/imagecaptcha.md @@ -0,0 +1,33 @@ +# imageCaptcha + +Provides information about the time when the current application scope was created. + +```javascript +imageCaptcha() +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| text | string | Yes | | Text in the image captcha. | +| height | numeric | Yes | | Height of the image in pixels. | +| width | numeric | Yes | | Width of the image in pixels. | +| difficulty | string | No | low | Complexity of the image. | +| fonts | any | No | arial | One or more fonts for the CAPTCHA text, as an array or as string list (separated by commas). Lucee supports the system fonts recognized by JDK only. | +| fontsize | numeric | No | 24 | Font size for text of the image. | +| fontcolor | string | No | black | Font color for text of the image. | + +## Script Syntax + +A 300px by 100px image captcha at medium difficulty. + +```javascript +imagewritetobrowser(imagecaptcha( 'abcxyz', 100, 300, 'medium')); +``` + +### Expected Result: An 300px by 100px image captcha with the letters 'abcxyz' diff --git a/docs/functions/imageclearrect.md b/docs/functions/imageclearrect.md new file mode 100644 index 000000000..dcba2fe11 --- /dev/null +++ b/docs/functions/imageclearrect.md @@ -0,0 +1,58 @@ +# imageClearRect + + Clears the specified rectangle by filling it with the background color of the current drawing surface. + +```javascript +imageClearRect(name, x, y, width, height) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.clearRect(x, y, width, height) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed | +| x | numeric | Yes | | The X coordinate of the rectangle to clear. | +| y | numeric | Yes | | The Y coordinate of the rectangle to clear. | +| width | numeric | Yes | | The width of the rectangle to clear. | +| height | numeric | Yes | | The height of the rectangle to clear. | + +## Tag Syntax + +This example shows how to set the background color to green and draws four rectangles in that color on the image. + +```javascript + + + + + + + + + + + + + + +``` + +## Using clearRect member function + +CF11+ Lucee4.5+ Clears the specified rectangle (50x50) from the center of the image (x=50, y-50) + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.clearRect(50,50,50,50); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagecopy.md b/docs/functions/imagecopy.md new file mode 100644 index 000000000..202af3259 --- /dev/null +++ b/docs/functions/imagecopy.md @@ -0,0 +1,41 @@ +# imageCopy + + Copies a rectangular area of an image. + +```javascript +imageCopy(name, x, y, width, height [, dx] [, dy]) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +someImage.copy(x, y, width, height [, dx] [, dy]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The ColdFusion image on which this operation is performed. | +| x | numeric | Yes | | The x coordinate of the source rectangle. | +| y | numeric | Yes | | The y coordinate of the source rectangle. | +| width | numeric | Yes | | The width of the source rectangle. | +| height | numeric | Yes | | The height of the source rectangle. | +| dx | numeric | No | | The x coordinate of the destination rectangle. | +| dy | numeric | No | | The y coordinate of the destination rectangle. | + +## Using copy member function + +CF11+ Lucee4.5+ Copy the center of the image, rotate it 180 degrees about its center and paste it back into the original image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +copiedImgObj = imgObj.copy(50,50,50,50); +copiedImgObj.rotate(25,25,180,"bicubic"); +imgObj.paste(copiedImgObj,50,50); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagecreatecaptcha.md b/docs/functions/imagecreatecaptcha.md new file mode 100644 index 000000000..578c16733 --- /dev/null +++ b/docs/functions/imagecreatecaptcha.md @@ -0,0 +1,34 @@ +# imageCreateCaptcha + + Create a Completely Automated Public Turing test to tell Computers and Humans Apart (CAPTCHA) image, a distorted text image that is human-readable, but not machine-readable, used in a challenge-response test for preventing spam. + +```javascript +imageCreateCaptcha (height, width, text [, difficulty, fonts, fontsize) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| height | numeric | Yes | | Height in pixels of the image. | +| width | numeric | Yes | | Width in pixels of the image. | +| text | string | Yes | | Text string displayed in the CAPTCHA image. Use capital letters for better readability. Do not include spaces because users cannot detect them in the resulting CAPTCHA image.. | +| difficulty | string | No | | Level of complexity of the CAPTCHA text. Specify one of the following levels of text distortion: low, medium, and high | +| font | string | No | | One or more valid fonts to use for the CAPTCHA text. Separate multiple fonts with commas. ColdFusion supports only the system fonts that the JDK can recognize. For example, TTF fonts in the Windows directory are supported on Windows. | +| fontsize | numeric | No | | Font size of the text in the CAPTCHA image. The value must be an integer. | + +## Tag Syntax + +```javascript +

imageCreateCaptcha Method

+ + + + + + +``` diff --git a/docs/functions/imagecrop.md b/docs/functions/imagecrop.md new file mode 100644 index 000000000..a561481f8 --- /dev/null +++ b/docs/functions/imagecrop.md @@ -0,0 +1,53 @@ +# imageCrop + +Crops a ColdFusion image to a specified rectangular area. + +```javascript +imageCrop(name, x, y, width, height) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.crop(x, y, width, height) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| x | numeric | Yes | | The X origin of the crop area. | +| y | numeric | Yes | | The Y origin of the crop area. | +| width | numeric | Yes | | The width of the crop area. | +| height | numeric | Yes | | The height of the crop area. | + +## Tag Syntax + +This example shows how to crop an image. + +```javascript + + + + + + + + + +``` + +## Using crop member function + +CF11+ Lucee4.5+ Crop the image from starting point (x=25, y=25), with width=100 and height=100 + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.crop(25,25,100,100); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawarc.md b/docs/functions/imagedrawarc.md new file mode 100644 index 000000000..a92840475 --- /dev/null +++ b/docs/functions/imagedrawarc.md @@ -0,0 +1,57 @@ +# imageDrawArc + + Draws a circular or elliptical arc. + +```javascript +imageDrawArc(name, x, y, width, height, startAngle, archAngle [, filled]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawArc(x, y, width, height, startAngle, archAngle [, filled]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| x | numeric | Yes | | The x coordinate of the upper-left corner of the arc. | | +| y | numeric | Yes | | The y coordinate of the upper-left corner of the arc. | | +| width | numeric | Yes | | The width of the arc. | | +| height | numeric | Yes | | The height of the arc. | | +| startAngle | numeric | Yes | | The beginning angle in degrees. | | +| archAngle | numeric | Yes | | The angular extent of the arc, relative to the start angle. | | +| filled | boolean | No | false | Specify whether the arc is filled | /Users/garethedwards/development/github/cfdocs/docs/functions/imagedrawarc.md|false | + +## Tag Syntax + +This example shows how to use the imageNew function to create a blank ColdFusion image that is 250 pixels wide and 180 pixels high. + +```javascript + + + + + + + + + +``` + +## Using drawArc member function + +CF11+ Lucee4.5+ Draw a circle in the center of the image and fill with color + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.setDrawingColor("005100"); +imgObj.drawArc(50,50,50,50,90,360,"yes"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawbeveledrect.md b/docs/functions/imagedrawbeveledrect.md new file mode 100644 index 000000000..cc255e9bf --- /dev/null +++ b/docs/functions/imagedrawbeveledrect.md @@ -0,0 +1,56 @@ +# imageDrawBeveledRect + +Draws a rectangle with beveled edges. + +```javascript +imageDrawBeveledRect(name, x, y, width, height, raised [, filled]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawBeveledRect(x, y, width, height, raised [, filled]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| x | numeric | Yes | | The x coordinate of the rectangle. | +| y | numeric | Yes | | The y coordinate of the rectangle. | +| width | numeric | Yes | | The width of the rectangle. | +| height | numeric | Yes | | The height of the rectangle. | +| raised | boolean | Yes | false | Specify whether the rectangle appears raised above the surface or sunk into the surface | +| filled | boolean | No | false | Specify whether the rectangle is filled. | + +## Tag Syntax + +This example shows how to create a bevel-edged rectangle. + +```javascript + + + + + + + + + + +``` + +## Using drawBeveledRect member function + +CF11+ Lucee4.5+ Create a new image and place a raised beveled rectangle at its center + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.drawBeveledRect(50,50,50,50,"yes","yes"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawcubiccurve.md b/docs/functions/imagedrawcubiccurve.md new file mode 100644 index 000000000..818cc201c --- /dev/null +++ b/docs/functions/imagedrawcubiccurve.md @@ -0,0 +1,58 @@ +# imageDrawCubicCurve + + Draws a cubic curve. + +```javascript +imageDrawCubicCurve(name, ctrlx1, ctrly1, ctrlx2, ctrly2, x1, y1, x2, y2) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawCubicCurve(ctrlx1, ctrly1, ctrlx2, ctrly2, x1, y1, x2, y2) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| ctrlx1 | string | Yes | | The x coordinate of the start point of the cubic curve segment. | +| ctrly1 | numeric | Yes | | The y coordinate of the start point of the cubic curve segment. | +| ctrlx2 | numeric | Yes | | The x coordinate of the first control point of the cubic curve segment. | +| ctrly2 | numeric | Yes | | The y coordinate of the first control point of the cubic curve segment. | +| x1 | numeric | Yes | | The x coordinate of the second control point of the cubic curve segment. | +| y1 | numeric | Yes | | The y coordinate of the second control point of the cubic curve segment. | +| x2 | numeric | Yes | | The x coordinate of the end point of the cubic curve segment. | +| y2 | numeric | Yes | | The y coordinate of the end point of the cubic curve segment. | + +## Tag Syntax + +This example shows how to draw a curved line that looks like a stylized 7. + +```javascript + + + + + + + + + + +``` + +## Using drawCubicCurve member function + +CF11+ Lucee4.5+ Create a new image. With the new image draw a cubic curve, starting at top left (0,0) ending at bottom right (152,152) with 2 control points, 1 half way down the left side(0,71) and other at bottom left (0,152) + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.drawCubicCurve(0,0,0,71,0,152,152,152); +cfimage (action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawimage.md b/docs/functions/imagedrawimage.md new file mode 100644 index 000000000..47b3528bd --- /dev/null +++ b/docs/functions/imagedrawimage.md @@ -0,0 +1,20 @@ +# imageDrawImage + +Draws an image on an image with the baseline of the first pixel positioned at (x,y) in the image i.e. with the top left corner positioned at (x,y). + +```javascript +imageDrawImage(name, image, x, y) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | any | Yes | | | +| image | any | Yes | | | +| x | numeric | Yes | | | +| y | numeric | Yes | | | diff --git a/docs/functions/imagedrawline.md b/docs/functions/imagedrawline.md new file mode 100644 index 000000000..7826ea1e9 --- /dev/null +++ b/docs/functions/imagedrawline.md @@ -0,0 +1,52 @@ +# imageDrawLine + +Draws a single line defined by two sets of x and y coordinates on a ColdFusion image. + +```javascript +imageDrawLine(name, x1, y1, x2, y2) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawLine(x1, y1, x2, y2) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| x1 | numeric | Yes | | The x coordinate for the start point of the line. | +| y1 | numeric | Yes | | The y coordinate for the start point of the line. | +| x2 | numeric | Yes | | The x coordinate for the end point of the line. | +| y2 | numeric | Yes | | The y coordinate for the end point of the line. | + +## Tag Syntax + +This example shows how to draw a square bisected by a diagonal line. + +```javascript + + + + + + + + +``` + +## Using drawline member function + +CF11+ Lucee4.5+ Create a new image and with this image draw a diagonal line from the top left (0,0) to the bottom right (152,152) + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.drawLine(0,0,152,152); +cfimage (action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawlines.md b/docs/functions/imagedrawlines.md new file mode 100644 index 000000000..90c4e94f8 --- /dev/null +++ b/docs/functions/imagedrawlines.md @@ -0,0 +1,66 @@ +# imageDrawLines + +Draws a sequence of connected lines defined by arrays of x and y coordinates. + +```javascript +imageDrawLines(name, xcords, ycords [, isPolygon] [, filled]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawLines(xcords, ycords [, isPolygon] [, filled]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| xcords | numeric | Yes | | A array of x coordinates. | +| ycords | numeric | Yes | | A array of y coordinates. | +| isPolygon | boolean | No | false | Specify whether the lines form a polygon | +| filled | boolean | No | false | Specify whether the polygon is filled | + +## Tag Syntax + +This example shows how to draw a zigzag line. + +```javascript + + + + + + + + + + + + + + + + + + + + + + +``` + +## Using drawlines member function + +CF11+ Lucee4.5+ Create a new image and with this image draw a 'W' + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.drawLines([0,38,76,114,152],[0,152,0,152,0],"no","no"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawoval.md b/docs/functions/imagedrawoval.md new file mode 100644 index 000000000..493bb1524 --- /dev/null +++ b/docs/functions/imagedrawoval.md @@ -0,0 +1,55 @@ +# imageDrawOval + + Draws an oval. + +```javascript +imageDrawOval(name, x, y, width, height [, filled]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawOval(x, y, width, height [, filled]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| x | numeric | Yes | | The x coordinate of the upper left corner of the oval to draw. | +| y | numeric | Yes | | The y coordinate of the upper left corner of the oval to draw. | +| width | numeric | Yes | | The width of the oval to draw. | +| height | numeric | Yes | | The height of the oval to draw. | +| filled | boolean | No | false | Specify whether the oval is filled | + +## Tag Syntax + +This example shows how to draw a green filled oval. + +```javascript + + + + + + + + + + +``` + +## Using drawOval member function + +CF11+ Lucee4.5+ Create a new image and with this image draw a white oval (width=50, height=70) start from (50,40) + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.drawOval(50,40,50,70,"yes"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawpoint.md b/docs/functions/imagedrawpoint.md new file mode 100644 index 000000000..8c30c0082 --- /dev/null +++ b/docs/functions/imagedrawpoint.md @@ -0,0 +1,60 @@ +# imageDrawPoint + + Draws a point at the specified (x,y) coordinate. + +```javascript +imageDrawPoint(name, x, y) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawPoint(x, y) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| x | numeric | Yes | | The x coordinate of the point. | +| y | numeric | Yes | | The y coordinate of the point. | + +## Tag Syntax + +This example shows how to draw a large square in the middle of an image. + +```javascript + + + + + + + + + + + + + + +``` + +## Using drawPoints member function + +CF11+ Lucee4.5+ Create a new image and with this image draw 100 random points + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +for (i=1;i LTE 100;i=i+1) { + x = randRange(0,152); + y = randRange(0,152); + imgObj.drawPoint(x,y); +} +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawquadraticcurve.md b/docs/functions/imagedrawquadraticcurve.md new file mode 100644 index 000000000..25881193f --- /dev/null +++ b/docs/functions/imagedrawquadraticcurve.md @@ -0,0 +1,56 @@ +# imageDrawQuadraticCurve + + Draws a curved line. The curve is controlled by a single point. + +```javascript +imageDrawQuadraticCurve(name, ctrlx1, ctrly1, x1, y1, x2, y2) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawQuadraticCurve(ctrlx1, ctrly1, x1, y1, x2, y2) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| x1 | numeric | Yes | | The x coordinate of the start point of the quadratic curve segment. | +| y1 | numeric | Yes | | The y coordinate of the start point of the quadratic curve segment. | +| ctrlx1 | string | Yes | | The x coordinate of the first control point of the quadratic curve segment. | +| ctrly1 | numeric | Yes | | The y coordinate of the first control point of the quadratic curve segment. | +| x2 | numeric | Yes | | The x coordinate of the end point of the quadratic curve segment. | +| y2 | numeric | Yes | | The y coordinate of the end point of the quadratic curve segment. | + +## Tag Syntax + +This example shows how to draw a curved line.OK + +```javascript + + + + + + + + + + +``` + +## Using drawQuadraticCurve member function + +CF11+ Lucee4.5+ Create a new image. With the new image draw a cubic curve, starting at top left (0,0) ending at bottom right (152,152) with 1 control point at the bottom left (0,152) + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.drawQuadraticCurve(0,0,0,152,152,152); +cfimage (action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawrect.md b/docs/functions/imagedrawrect.md new file mode 100644 index 000000000..8a2673a14 --- /dev/null +++ b/docs/functions/imagedrawrect.md @@ -0,0 +1,55 @@ +# imageDrawRect + +Draws a rectangle. + +```javascript +imageDrawRect(name, x, y, width, height [, filled]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawRect(x, y, width, height [, filled]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| x | numeric | Yes | | The x coordinate of the rectangle. | +| y | numeric | Yes | | The y coordinate of the rectangle. | +| width | numeric | Yes | | The width of the rectangle. | +| height | numeric | Yes | | The height of the rectangle. | +| filled | boolean | No | false | Specify whether the rectangle is filled | + +## Tag Syntax + +This example shows how to draw a rectangle. + +```javascript + + + + + + + + + + +``` + +## Using drawRect member function + +CF11+ Lucee4.5+ Create a new image. With the new image draw filled rectangle (width=70, height=50) starting at point (x=40,y=50) + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.drawRect(40,50,70,50,"yes"); +cfimage (action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawroundrect.md b/docs/functions/imagedrawroundrect.md new file mode 100644 index 000000000..2acf3a165 --- /dev/null +++ b/docs/functions/imagedrawroundrect.md @@ -0,0 +1,57 @@ +# imageDrawRoundRect + + Draws a rectangle with rounded corners. + +```javascript +imageDrawRoundRect(name, x, y, width, height, arcwidth, archeight [, filled]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawRoundRect(x, y, width, height, arcwidth, archeight [, filled]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| x | numeric | Yes | | The x coordinate of the rectangle. | +| y | numeric | Yes | | The y coordinate of the rectangle. | +| width | numeric | Yes | | The width of the rectangle. | +| height | numeric | Yes | | The height of the rectangle. | +| arcwidth | numeric | Yes | | The horizontal diameter of the arc at the four corners. | +| archeight | numeric | Yes | | The vertical diameter of the arc at the four corners. | +| filled | boolean | No | false | Specify whether the rectangle is filled | + +## Tag Syntax + +This example shows how to draw a square with rounded corners. + +```javascript + + + + + + + + + + +``` + +## Using drawRoundRect member function + +CF11+ Lucee4.5+ Create a new image. With the new image draw filled rounded rectangle (width=70, height=50) starting at point (x=40,y=50) + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.drawRoundRect(40,50,70,50,35,35,"yes"); +cfimage (action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagedrawtext.md b/docs/functions/imagedrawtext.md new file mode 100644 index 000000000..74b4b0d7c --- /dev/null +++ b/docs/functions/imagedrawtext.md @@ -0,0 +1,53 @@ +# imageDrawText + + Draws a text string on a ColdFusion image with the baseline of the first character positioned at (x,y) in the image. + +```javascript +imageDrawText(name, str, x, y, attributecollection) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.drawText(str, x, y, attributecollection) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| str | string | Yes | | The text to draw. | +| x | numeric | Yes | | The x coordinate for the start point of the string. | +| y | numeric | Yes | | The y coordinate for the start point of the string. | +| attributecollection | struct | No | | A structure used to specify the text characteristics. the following keys are supported:
font: The name of the font used to draw the text string. If you do not specify the font attribute, the text is drawn in the default system font.
size: The font size for the text string. The default value is 10 points.
style: The style to apply to the font ( bold,italic,boldItalic,plain (default) ).
strikethrough: a boolean that specify whether strikethrough is applied to the text image, default is false.
underline: a boolean that specify whether underline is applied to the text image, default is false. | + +## Tag Syntax + +This example shows how to create a text string image. + +```javascript + + + + + + + + +``` + +## Using drawText member function + +CF11+ Lucee4.5+ Create a new image. With the new image write "CFDocs" with the text characteristics specified + +```javascript +TextCharacteristics = { size="20", style="bold", strikethrough="false", underline="false"}; +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.drawText("CFDocs",20,50,TextCharacteristics); +cfimage (action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagefilter.md b/docs/functions/imagefilter.md new file mode 100644 index 000000000..7993df4f3 --- /dev/null +++ b/docs/functions/imagefilter.md @@ -0,0 +1,19 @@ +# imageFilter + +Executes a filter on the given image + +```javascript +imageFilter(name, filtername [, parameters]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | any | Yes | | | +| filtername | string | Yes | | | +| parameters | struct | No | | | diff --git a/docs/functions/imagefiltercolormap.md b/docs/functions/imagefiltercolormap.md new file mode 100644 index 000000000..4319dade1 --- /dev/null +++ b/docs/functions/imagefiltercolormap.md @@ -0,0 +1,19 @@ +# imageFilterColorMap + +Used to provide a colormap as argument of the imageFilter function + +```javascript +imageFilterColorMap(type [, lineColor1] [, lineColor2]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | | | +| lineColor1 | string | No | | | +| lineColor2 | string | No | | | diff --git a/docs/functions/imagefiltercurves.md b/docs/functions/imagefiltercurves.md new file mode 100644 index 000000000..274099653 --- /dev/null +++ b/docs/functions/imagefiltercurves.md @@ -0,0 +1,9 @@ +# imageFilterCurves + +```javascript +imageFilterCurves() +``` + +```javascript +returns any +``` diff --git a/docs/functions/imagefilterkernel.md b/docs/functions/imagefilterkernel.md new file mode 100644 index 000000000..26713826c --- /dev/null +++ b/docs/functions/imagefilterkernel.md @@ -0,0 +1,21 @@ +# imageFilterKernel + +Defines a matrix that describes how a specified pixel and its surrounding pixels affect the value computed for the pixel's position in the output image of a filtering operation. + +The X origin and Y origin indicate the kernel matrix element that corresponds to the pixel position for which an output value is being computed. + +```javascript +imageFilterKernel(width, height, data) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| width | numeric | Yes | | | +| height | numeric | Yes | | | +| data | any | Yes | | | diff --git a/docs/functions/imagefilterwarpgrid.md b/docs/functions/imagefilterwarpgrid.md new file mode 100644 index 000000000..16c0d2df6 --- /dev/null +++ b/docs/functions/imagefilterwarpgrid.md @@ -0,0 +1,18 @@ +# imageFilterWarpGrid + +```javascript +imageFilterWarpGrid(rows, cols, width, height) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| rows | numeric | Yes | | | +| cols | numeric | Yes | | | +| width | numeric | Yes | | | +| height | numeric | Yes | | | diff --git a/docs/functions/imageflip.md b/docs/functions/imageflip.md new file mode 100644 index 000000000..7c9a59496 --- /dev/null +++ b/docs/functions/imageflip.md @@ -0,0 +1,49 @@ +# imageFlip + +Flips an image across an axis. + +```javascript +imageFlip(name, transpose) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.flip(transpose) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| transpose | string | Yes | vertical | Transpose the image.

vertical: Flip an image across an imaginary horizontal line that runs through the center of the image.
horizontal: Flip an image across an imaginary vertical line that runs through the center of the image.
diagonal: Flip an image across its main diagonal that runs from the upper-left to the lower-right corner.
antidiagonal: Flip an image across its main diagonal that runs from the upper-right to the lower-left corner.
Or rotate an image clockwise by 90, 180, or 270 degrees. | /Users/garethedwards/development/github/cfdocs/docs/functions/imageflip.md|270 | + +## Tag Syntax + +This example shows how to rotate an image by 270 degrees. + +```javascript + + + + + + + + +``` + +## Using flip member function + +CF11+ Lucee4.5+ Flip the image vertically + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.flip("vertical"); +cfimage (action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagefonts.md b/docs/functions/imagefonts.md new file mode 100644 index 000000000..e9a86aa4c --- /dev/null +++ b/docs/functions/imagefonts.md @@ -0,0 +1,19 @@ +# imageFonts + +returns all available image fonts + +```javascript +imageFonts() +``` + +```javascript +returns array +``` + +## imageFonts Example + +Returns the all available image fonts. It is supported only in Lucee. + +```javascript +writeDump(imageFonts()) ; +``` diff --git a/docs/functions/imageformats.md b/docs/functions/imageformats.md new file mode 100644 index 000000000..8b0178725 --- /dev/null +++ b/docs/functions/imageformats.md @@ -0,0 +1,19 @@ +# imageFormats + +Returns a structure of all supported image formats that can be read (`decoder`) and written (`encoder`). + +```javascript +imageFormats() +``` + +```javascript +returns struct +``` + +## Simple example + +Calls the function and dumps the structure of image formats it returns + +```javascript +writeDump(imageFormats()); +``` diff --git a/docs/functions/imagegetblob.md b/docs/functions/imagegetblob.md new file mode 100644 index 000000000..b1de3d3c9 --- /dev/null +++ b/docs/functions/imagegetblob.md @@ -0,0 +1,33 @@ +# imageGetBlob + +Retrieves the bytes of the underlying image. The bytes are in the same image format as the source image. + +```javascript +imageGetBlob(source) +``` + +```javascript +returns binary +``` + +## Member Function Syntax + +```javascript +someImage.getBlob() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| source | string | Yes | | The ColdFusion image on which this operation is performed. | + +## Using getBlob() member function + +CF11+ Lucee4.5+ Retrieve the bytes of the underlying image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +blob = imgObj.getBlob(); +writeDump(blob); +``` diff --git a/docs/functions/imagegetbufferedimage.md b/docs/functions/imagegetbufferedimage.md new file mode 100644 index 000000000..44a290aea --- /dev/null +++ b/docs/functions/imagegetbufferedimage.md @@ -0,0 +1,33 @@ +# imageGetBufferedImage + + Returns the java.awt.BufferedImage object underlying the current ColdFusion image. + +```javascript +imageGetBufferedImage(name) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +someImage.getBufferedImage() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | + +## Using getBufferedImage member function + +CF11+ Lucee4.5+ Call getWidth() on the underlying java.awt.BufferedImage object of the image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +x = imgObj.getBufferedImage(); +writeOutput(x.getWidth()); +``` diff --git a/docs/functions/imagegetexifmetadata.md b/docs/functions/imagegetexifmetadata.md new file mode 100644 index 000000000..a5ec15e11 --- /dev/null +++ b/docs/functions/imagegetexifmetadata.md @@ -0,0 +1,33 @@ +# imageGetEXIFMetadata + +Retrieves the Exchangeable Image File Format (EXIF) headers in an image as a CFML structure. + +```javascript +imageGetEXIFMetadata(name) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +someImage.getEXIFMetadata() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | + +## Using getEXIFMetadata member function + +CF11+ Lucee4.5+ Extract the EXIF meta data from exiv sample page (http://www.exiv2.org/sample.html) + +```javascript +imgObj = imageRead("http://www.exiv2.org/include/img_1771.jpg"); +x = imgObj.getEXIFMetadata(); +writeDump(x); +``` diff --git a/docs/functions/imagegetexiftag.md b/docs/functions/imagegetexiftag.md new file mode 100644 index 000000000..a608ba84f --- /dev/null +++ b/docs/functions/imagegetexiftag.md @@ -0,0 +1,49 @@ +# imageGetEXIFTag + + Retrieves the specified EXIF tag in an image. + +```javascript +imageGetEXIFTag(name, tagName) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +someImage.getEXIFTag(tagName) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| tagName | string | Yes | | The EXIF tag name to be returned. | + +## Tag Syntax + +This example shows how to retrieve one element from the EXIF information associated with an image. + +```javascript + + + + + + +``` + +## Using getEXIFTag member function + +CF11+ Lucee4.5+ Extract model of camera used for image on exiv sample page (http://www.exiv2.org/sample.html) + +```javascript +imgObj = imageRead("http://www.exiv2.org/include/img_1771.jpg"); +model = imgObj.getEXIFTag('Model'); +writeOutput(model); +``` + +### Expected Result: Canon PowerShot S40 diff --git a/docs/functions/imagegetheight.md b/docs/functions/imagegetheight.md new file mode 100644 index 000000000..34e8a7b9f --- /dev/null +++ b/docs/functions/imagegetheight.md @@ -0,0 +1,33 @@ +# imageGetHeight + +Retrieves the height of the ColdFusion image in pixels. + +```javascript +imageGetHeight(name) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someImage.getHeight() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | + +## Using getHeight member function + +CF11+ Lucee4.5+ Extract the height of an image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +height = imgObj.getHeight(); +writeOutput(height); +``` diff --git a/docs/functions/imagegetiptcmetadata.md b/docs/functions/imagegetiptcmetadata.md new file mode 100644 index 000000000..dc5f46941 --- /dev/null +++ b/docs/functions/imagegetiptcmetadata.md @@ -0,0 +1,33 @@ +# imageGetIPTCMetadata + + Retrieves the International Press Telecommunications Council (IPTC )headers in a ColdFusion image as a structure. + +```javascript +imageGetIPTCMetadata(name) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +someImage.getIPTCMetadata() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | + +## Using getIPTCMetadata member function + +CF11+ Extract the IPTC meta data from IPTC image (https://code.google.com/p/metadata-extractor/wiki/SampleOutput) + +```javascript +imgObj = imageRead("http://sample-images.metadata-extractor.googlecode.com/git/FujiFilm%20FinePixS1Pro%20(1).jpg"); +x = imgObj.getIPTCMetadata(); +writeDump(x); +``` diff --git a/docs/functions/imagegetiptctag.md b/docs/functions/imagegetiptctag.md new file mode 100644 index 000000000..6e2b6ea2a --- /dev/null +++ b/docs/functions/imagegetiptctag.md @@ -0,0 +1,46 @@ +# imageGetIPTCtag + + Retrieves the value of the IPTC tag for a ColdFusion image. + +```javascript +imageGetIPTCtag(name, tagName) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +someImage.getIPTCtag(tagName) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| tagName | string | Yes | | The IPTC tag name whose value is returned. | + +## Tag Syntax + +This example shows how to retrieve the caption for a JPEG file. + +```javascript + + + + + +``` + +## Using getIPTCtag member function + +CF11+ Lucee4.5+ Extract the copyright notice for image (https://code.google.com/p/metadata-extractor/wiki/SampleOutput) + +```javascript +imgObj = imageRead("http://sample-images.metadata-extractor.googlecode.com/git/FujiFilm%20FinePixS1Pro%20(1).jpg"); +copyright = imgObj.getIPTCtag('Copyright Notice'); +writeOutput(copyright); +``` diff --git a/docs/functions/imagegetmetadata.md b/docs/functions/imagegetmetadata.md new file mode 100644 index 000000000..528eefac7 --- /dev/null +++ b/docs/functions/imagegetmetadata.md @@ -0,0 +1,43 @@ +# imageGetMetadata + +A structure containing information about the image. + +```javascript +imageGetMetadata(image) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +someImage.getMetadata() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | + +## Tag Usage + +CF11+ Extract the meta data from an image + +```javascript + + + +``` + +## Using getMetadata() member function + +CF11+ Extract the meta data from an image + +```javascript +imgObj = imageRead("http://www.exiv2.org/include/img_1771.jpg"); +metaData = imgObj.getMetadata(); +writeDump(metaData); +``` diff --git a/docs/functions/imagegetwidth.md b/docs/functions/imagegetwidth.md new file mode 100644 index 000000000..44c6be927 --- /dev/null +++ b/docs/functions/imagegetwidth.md @@ -0,0 +1,33 @@ +# imageGetWidth + + Retrieves the width of the specified ColdFusion image. + +```javascript +imageGetWidth(name) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someImage.getWidth() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | + +## Using getWidth member function + +CF11+ Lucee4.5+ Extract the width of an image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +width = imgObj.getWidth(); +writeOutput(width); +``` diff --git a/docs/functions/imagegrayscale.md b/docs/functions/imagegrayscale.md new file mode 100644 index 000000000..45612318d --- /dev/null +++ b/docs/functions/imagegrayscale.md @@ -0,0 +1,33 @@ +# imageGrayScale + + Converts a ColdFusion image to grayscale. + +```javascript +imageGrayScale(name) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.grayScale() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | + +## Using grayScale member function + +CF11+ Lucee4.5+ Convert image to grayScale + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.grayScale(); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imageinfo.md b/docs/functions/imageinfo.md new file mode 100644 index 000000000..fc5c9d2ef --- /dev/null +++ b/docs/functions/imageinfo.md @@ -0,0 +1,45 @@ +# imageInfo + + Returns a structure that contains information about the image, such as height, width, color model, size, and filename. + +```javascript +imageInfo(name) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +someImage.info() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | + +## Get Image Info + +Uses the imageRead function to read an image from a url. + +```javascript + + +Image is #imgInfo.height#px high and #imgInfo.width#px wide. +``` + +### Expected Result: Image is 20px high and 10px wide. + +## Using info member function + +CF11+ Lucee4.5+ Extract the image info + +```javascript +imgObj = imageRead("https://cfdocs.org/apple-touch-icon.png"); +info = imgObj.info(); +writeDump(info); +``` diff --git a/docs/functions/imagemakecolortransparent.md b/docs/functions/imagemakecolortransparent.md new file mode 100644 index 000000000..8091cc645 --- /dev/null +++ b/docs/functions/imagemakecolortransparent.md @@ -0,0 +1,37 @@ +# imageMakeColorTransparent + + Creates an image and sets a transparent color. + +```javascript +imageMakeColorTransparent(img, color__); +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| img | string | Yes | | The ColdFusion image on which this operation is performed. | +| color | string | Yes | | The transparent color: Hexadecimal, String value, Default is black. | + +## Tag Syntax + +```javascript + + + + + + + + + PNG image
+ + + + + +``` diff --git a/docs/functions/imagemaketranslucent.md b/docs/functions/imagemaketranslucent.md new file mode 100644 index 000000000..2fbffd5e4 --- /dev/null +++ b/docs/functions/imagemaketranslucent.md @@ -0,0 +1,43 @@ +# imageMakeTranslucent + + Create a new translucent image with given percentage of translucence. + +```javascript +imageMakeTranslucent (img, percent__); +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| img | string | Yes | | The ColdFusion image on which this operation is performed. | +| percentage | numeric | Yes | | The percent of translucence: 0 = opaque, 100=transparent. Decimal values are supported | + +## Tag Syntax + +The following example illustrates three images with the second one translucent than first and the third one translucent than the second. + +```javascript + + + + + + + + + PNG image
+ + + + + + + + + +``` diff --git a/docs/functions/imagenegative.md b/docs/functions/imagenegative.md new file mode 100644 index 000000000..88d41e45d --- /dev/null +++ b/docs/functions/imagenegative.md @@ -0,0 +1,35 @@ +# imageNegative + +Inverts the pixel values of a ColdFusion image. + +```javascript +imageNegative(name) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.negative() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | + +## Using negative member function + +CF11+ Convert image to negative + +```javascript +imgObj = imageRead("https://placekitten.com/408/287"); +imgObjNegative = duplicate(imgObj); +imgObjNegative.negative(); +cfimage(action="writeToBrowser", source=imgObj); +cfimage(action="writeToBrowser", source=imgObjNegative); +``` diff --git a/docs/functions/imagenew.md b/docs/functions/imagenew.md new file mode 100644 index 000000000..65df2b1a0 --- /dev/null +++ b/docs/functions/imagenew.md @@ -0,0 +1,40 @@ +# imageNew + + Creates a ColdFusion image. + +```javascript +imageNew([source] [, width] [, height] [, imagetype] [, canvascolor]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| source | string | No | | The source image path, URL, a variable that is read into the new image, or a Java buffered image. | +| width | numeric | No | | The width of the new image. Valid when the height is specified and the source is not. | +| height | numeric | No | | The height of the new image. Valid when the width is specified and the source is not. | +| imagetype | string | No | | The type of the image to create (Valid only when width and height are specified), | +| canvascolor | string | No | black | Color of the image canvas. Possible values are:

Hexadecimal value of RGB color. For example, specify the color white as ##FFFFFF or FFFFFF.
String value of color (for example, 'black', 'red', 'green').
List of three numbers for (R,G,B) values. Each value must be in the range 0-255. | + +## Tag Syntax + +Use the imageNew function to create a 200x200-pixel image in ARGB format. + +```javascript + + +``` + +## Script Syntax + +This example shows how to create a ColdFusion image from a URL. + +```javascript + + + +``` diff --git a/docs/functions/imageoverlay.md b/docs/functions/imageoverlay.md new file mode 100644 index 000000000..0386a396e --- /dev/null +++ b/docs/functions/imageoverlay.md @@ -0,0 +1,54 @@ +# imageOverlay + + Reads two source ColdFusion images and overlays the second source image on the first source image. + +```javascript +imageOverlay(source1, source2 [, rule, alpha]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.overlay(source2 [, rule, alpha]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| source1 | string | Yes | | The image that is the bottom layer in the image. | +| source2 | string | Yes | | The image that is the top layer (overlaid on the source1 image) in the image. | +| rule | string | No | | CF10+ Compositing Rule | +| alpha | string | No | | CF10+ The percentage value of transparency | + +## Tag Syntax + +This example shows how to overlay a smaller image on a larger image. + +```javascript + + + + + + + + + + +``` + +## Using overlay member function + +CF11+ Lucee4.5+ Overlay one image on the other + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +topImg = imageNew("",50,50,"rgb","ffffff"); +imgObj.overlay(topImg); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagepaste.md b/docs/functions/imagepaste.md new file mode 100644 index 000000000..a738513f9 --- /dev/null +++ b/docs/functions/imagepaste.md @@ -0,0 +1,59 @@ +# imagePaste + + Takes two images and an (x,y) coordinate and draws the second image over the first image with the upper-left corner at coordinate (x,y). + +```javascript +imagePaste(image1, image2, x, y) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.paste(image2, x, y) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| image1 | string | Yes | | The bottom image. | +| image2 | string | Yes | | The image that is pasted on top of image1. | +| x | numeric | Yes | | The x coordinate where the upper-left corner of image2 is pasted. | +| y | numeric | Yes | | The y coordinate where the upper-left corner of image2 is pasted. | + +## Tag Syntax + +This example shows how to copy a small rectangular area of one image and paste it over a larger image. + +```javascript + + + + + + + + + + + + + + +``` + +## Using paste member function + +CF11+ Lucee4.5+ Copy the center of the image, rotate it 180 degrees about its center and paste it back into the original image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +copiedImgObj = imgObj.copy(50,50,50,50); +copiedImgObj.rotate(25,25,180,"bicubic"); +imgObj.paste(copiedImgObj,50,50); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imageread.md b/docs/functions/imageread.md new file mode 100644 index 000000000..28495a5e0 --- /dev/null +++ b/docs/functions/imageread.md @@ -0,0 +1,26 @@ +# imageRead + + Reads the source pathname or URL and creates a ColdFusion image. + +```javascript +imageRead(path) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | On-disk or in-memory pathname or URL of the source image. | + +## Using script syntax + +Read an image from URL and output + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagereadbase64.md b/docs/functions/imagereadbase64.md new file mode 100644 index 000000000..d80b722eb --- /dev/null +++ b/docs/functions/imagereadbase64.md @@ -0,0 +1,26 @@ +# imageReadBase64 + + Creates a ColdFusion image from a Base64 string. + +```javascript +imageReadBase64(string) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | a variable or Base64 string | + +## Using script syntax + +convert base64 representation of a small red dot to an image + +```javascript +imgObj = imageReadBase64('iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imageresize.md b/docs/functions/imageresize.md new file mode 100644 index 000000000..f53ff1acd --- /dev/null +++ b/docs/functions/imageresize.md @@ -0,0 +1,51 @@ +# imageResize + + Resizes a ColdFusion image. + +```javascript +imageResize(name, width, height, interpolation, blurfactor) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.resize(width, height, interpolation, blurfactor) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| width | numeric | Yes | | New width of the image. If this value is blank, the width is calculated proportionately to the height. | | +| height | numeric | Yes | | New height of the image. If this value is blank, the height is calculated proportionately to the width. | | +| interpolation | string | No | | The interpolation method for resampling. You can specify a specific interpolation algorithm by name (for example, hamming), by image quality (for example, mediumQuality), or by performance (for example, highestPerformance). | /Users/garethedwards/development/github/cfdocs/docs/functions/imageresize.md|quadratic | +| blurfactor | boolean | No | | The blur factor used for resampling. The higher the blur factor, the more blurred the image (also, the longer it takes to resize the image). | /Users/garethedwards/development/github/cfdocs/docs/functions/imageresize.md|1-10 | + +## Tag Syntax + +This example shows how to resize an image to 50% of original size and resize it proportionately to the new width. Notice that the height is blank. + +```javascript + + + + + + + +``` + +## Using resize member function + +CF11+ Resize an image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.resize(50,50); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagerotate.md b/docs/functions/imagerotate.md new file mode 100644 index 000000000..1a5e413d9 --- /dev/null +++ b/docs/functions/imagerotate.md @@ -0,0 +1,47 @@ +# imageRotate + +Rotates a ColdFusion image at a specified point by a specified angle. + +```javascript +imageRotate(name [, x] [, y] , angle [, interpolation]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.rotate([, x] [, y] , angle [, interpolation]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| angle | numeric | Yes | | The rotation angle in degrees. | | +| x | numeric | No | 2 | The x coordinate for the point of rotation | | +| y | numeric | No | 2 | The y coordinate for the point of rotation | | +| interpolation | string | No | nearest | Type of interpolation

nearest: Applies the nearest neighbor method of interpolation. Image quality is lower than the other interpolation methods, but processing is fastest.
bilinear: Applies the bilinear method of interpolation. The quality of the image is less pixelated than the default, but processing is slower.
bicubic: Applies the bicubic method of interpolation. Generally, the quality of image is highest with this method and processing is slowest. | /Users/garethedwards/development/github/cfdocs/docs/functions/imagerotate.md|bicubic | + +## Tag Syntax + +This example shows how to rotate an image by 10 degrees. + +```javascript + + + +``` + +## Using rotate member function + +CF11+ Rotate an image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.rotate(90); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagerotatedrawingaxis.md b/docs/functions/imagerotatedrawingaxis.md new file mode 100644 index 000000000..32fba02b5 --- /dev/null +++ b/docs/functions/imagerotatedrawingaxis.md @@ -0,0 +1,57 @@ +# imageRotateDrawingAxis + + Rotates all subsequent drawing on a ColdFusion image at a specified point by a specified angle. + +```javascript +imageRotateDrawingAxis(name, angle [, x] [, y]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.rotateDrawingAxis(angle [, x] [, y]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The ColdFusion image on which this operation is performed. | +| angle | numeric | Yes | | The rotation angle in degrees. | +| x | numeric | No | 0 | The x coordinate for the point of rotation. | +| y | numeric | No | 0 | The y coordinate for the point of rotation. | + +## Tag Syntax + +This example shows how to create an image with three shapes drawn on the same axis. + +```javascript + + + + + + + + + + + + + +``` + +## Using rotateDrawingAxis member function + +CF11+ Create a new image, rotate the drawing axis by 45° about the center (71,71) and draw a 'W' + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.rotateDrawingAxis(45,71,71); +imgObj.drawLines([0,38,76,114,152],[0,152,0,152,0],"no","no"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagescaletofit.md b/docs/functions/imagescaletofit.md new file mode 100644 index 000000000..ac156f82c --- /dev/null +++ b/docs/functions/imagescaletofit.md @@ -0,0 +1,51 @@ +# imageScaleTofit + +Creates a resized image with the aspect ratio maintained. + +```javascript +imageScaleTofit(name, fitWidth, fitHeight [, interpolation] [, blurFactor]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.scaleTofit(fitWidth, fitHeight [, interpolation] [, blurFactor]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The ColdFusion image on which this operation is performed. | | +| fitWidth | numeric | Yes | | The width of the bounding box in pixels. You can specify an integer, or an empty string ('') if the fitHeight is specified. | | +| fitHeight | numeric | Yes | | The height of the bounding box in pixels. You can specify an integer, or an empty string ('') if the fitWidth is specified. | | +| interpolation | string | No | | The interpolation method for resampling. You can specify a specific interpolation algorithm by name (for example, hamming), by image quality (for example, mediumQuality), or by performance (for example, highestPerformance). | /Users/garethedwards/development/github/cfdocs/docs/functions/imagescaletofit.md|quadratic | +| blurfactor | boolean | No | | The blur factor used for resampling. The higher the blur factor, the more blurred the image (also, the longer it takes to resize the image). | /Users/garethedwards/development/github/cfdocs/docs/functions/imagescaletofit.md|1-10 | + +## Tag Syntax + +This example shows how to resize an image to fit a 100x100-pixel square while maintaining the aspect ratio. + +```javascript + + + + + + + +``` + +## Using scaleTofit member function + +CF11+ Scale to fit an image to half its original size (71,71) + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.scaleTofit(71,71); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagesetantialiasing.md b/docs/functions/imagesetantialiasing.md new file mode 100644 index 000000000..6ec1e3585 --- /dev/null +++ b/docs/functions/imagesetantialiasing.md @@ -0,0 +1,47 @@ +# imageSetAntialiasing + +Switches antialiasing on or off in rendered graphics. + +```javascript +imageSetAntialiasing(image [, antialias]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.setAntialiasing(antialias) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| image | string | Yes | | The ColdFusion image on which this operation is performed. | | +| antialias | string | No | on | Antialiasing switch | /Users/garethedwards/development/github/cfdocs/docs/functions/imagesetantialiasing.md|false | + +## Tag Syntax + +This example shows how to turn off antialiasing for a ColdFusion image. + +```javascript + + + + + + +``` + +## Using setAntialiasing member function + +CF11+ Switch the antialiasing off + +```javascript +imgObj = imageRead("https://cfdocs.org/apple-touch-icon.png"); +imgObj.setAntialiasing('off'); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagesetbackgroundcolor.md b/docs/functions/imagesetbackgroundcolor.md new file mode 100644 index 000000000..d15869a5a --- /dev/null +++ b/docs/functions/imagesetbackgroundcolor.md @@ -0,0 +1,52 @@ +# imageSetBackgroundColor + + Sets the background color for the ColdFusion image. The background color is used for clearing a region. Setting the background color only affects the subsequent imageClearRect calls + +```javascript +imageSetBackgroundColor(name, color) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.setBackgroundColor(color) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The ColdFusion image on which this operation is performed. | | +| color | string | Yes | black | Background color | /Users/garethedwards/development/github/cfdocs/docs/functions/imagesetbackgroundcolor.md|List of three numbers for (R,G,B) values. Each value must be in the range 0–255. | + +## Tag Syntax + +This example shows how to set the background color, and then draw a rectangle on an image filled with that color. + +```javascript + + + + + + + + + + +``` + +## Using setBackgroundColor member function + +CF11+ Clears the specified rectangle (50x50) from the center of the image (x=50, y-50) using a new background color (#116185) + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.setBackgroundColor('116185'); +imgObj.clearRect(50,50,50,50); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagesetdrawingalpha.md b/docs/functions/imagesetdrawingalpha.md new file mode 100644 index 000000000..e59448741 --- /dev/null +++ b/docs/functions/imagesetdrawingalpha.md @@ -0,0 +1,18 @@ +# imageSetDrawingAlpha + +Applies drawing alpha to image i.e. makes image transparent/sets opacity. All subsequent graphic operations follow that value. + +```javascript +imageSetDrawingAlpha(name, alpha) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | any | Yes | | | +| alpha | numeric | Yes | | | diff --git a/docs/functions/imagesetdrawingcolor.md b/docs/functions/imagesetdrawingcolor.md new file mode 100644 index 000000000..b68bd532c --- /dev/null +++ b/docs/functions/imagesetdrawingcolor.md @@ -0,0 +1,58 @@ +# imageSetDrawingColor + + Sets the current drawing color for ColdFusion images. All subsequent graphics operations use the specified color. + +```javascript +imageSetDrawingColor(name, color) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.setDrawingColor(color) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The ColdFusion image on which this operation is performed. | | +| color | string | Yes | black | Color | /Users/garethedwards/development/github/cfdocs/docs/functions/imagesetdrawingcolor.md|List of three numbers for (R,G,B) values. Each value must be in the range 0–255. | + +## Tag Syntax + +This example shows how to set the drawing color and draw several objects in that color. + +```javascript + + + + + + + + + + + + + + + + +``` + +## Using setDrawingColor member function + +CF11+ Create a new image and with this image draw a 'W' in blue (#116185) + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.setDrawingColor('116185'); +imgObj.drawLines([0,38,76,114,152],[0,152,0,152,0],"no","no"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagesetdrawingstroke.md b/docs/functions/imagesetdrawingstroke.md new file mode 100644 index 000000000..8a3221862 --- /dev/null +++ b/docs/functions/imagesetdrawingstroke.md @@ -0,0 +1,59 @@ +# imageSetDrawingStroke + + Sets the drawing stroke for points and lines in subsequent ColdFusion images. + +```javascript +imageSetDrawingStroke(name [, attributecollection]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.setDrawingStroke(attributecollection) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The ColdFusion image on which this operation is performed. | +| attributecollection | struct | No | | The structure used to specify the line attributes

width: Pen width, which is measured perpendicularly to the pen trajectory.

endcaps: Decoration applied to the ends of unclosed subpaths and dash segments. Subpaths that start and end on the same point are considered unclosed if they do not have a close segment: (butt,round,square)

lineJoins: Type of line joins: (bevel,miter,join)

miterLimit: The limit to trim a line join that has a mitered join decoration. (Use only when lineJoins = 'miter'.) A line join is trimmed when the ratio of miter length to stroke width is greater than the miterLimit value. The miter length is the diagonal length of the miter, which is the distance between the inside corner and the outside corner of the intersection. The smaller the angle formed by two line segments, the longer the miter length and the sharper the angle of intersection. The default value is 10.0, which trims all angles less than 11 degrees. Trimming miters converts the decoration of the line join to bevel.

dashArray: An array of numbers that indicates the dash pattern. For example. if dashArray is (8,4), the dash pattern is 8 pixels solid, 4 pixels blank, 8 pixels solid, 4 pixels blank, and so on.

dash_phases: An offset into the dash pattern. For example, a dash_phase of 2, and a dashArray of (8,4) produces the dash pattern of 6 pixels solid, 4 pixels blank, 8 pixels solid, 4 pixels blank, and so on. | + +## Tag Syntax + +This example shows how to create an attribute collection for the imageSetDrawingStroke function and draws a line with those attributes. + +```javascript + + + + + + + + + + + + + + + + +``` + +## Using setDrawingStroke member function + +CF11+ Lucee4.5+ Create a new image. With the new image draw a 'W' with a dashed line stroke + +```javascript +lineAttributes = { width="2", endcaps="round", dashArray=[8,4]}; +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.setDrawingStroke(lineAttributes); +imgObj.drawLines([0,38,76,114,152],[0,152,0,152,0],"no","no"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagesetdrawingtransparency.md b/docs/functions/imagesetdrawingtransparency.md new file mode 100644 index 000000000..c5b658db5 --- /dev/null +++ b/docs/functions/imagesetdrawingtransparency.md @@ -0,0 +1,36 @@ +# imageSetDrawingTransparency + + Specifies the degree of transparency of drawing functions. + +```javascript +imageSetDrawingTransparency(name, percent) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.setDrawingTransparency(percent) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| percent | numeric | Yes | | Percent of transparency, a floating point number in range 0-100 | + +## Using setDrawingTransparency member function + +CF11+ Create a new image. With the new image write transparent text + +```javascript +TextCharacteristics = { size="20", style="bold", strikethrough="false", underline="false"}; +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.setDrawingTransparency(50); +imgObj.drawText("CFDocs",20,50,TextCharacteristics); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagesharpen.md b/docs/functions/imagesharpen.md new file mode 100644 index 000000000..da019c83c --- /dev/null +++ b/docs/functions/imagesharpen.md @@ -0,0 +1,34 @@ +# imageSharpen + + Sharpens a ColdFusion image by using the unsharp mask filter. + +```javascript +imageSharpen(name [, gain]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.sharpen(gain) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| gain | numeric | No | 1.0 | Gain values can be integers or real numbers. | /Users/garethedwards/development/github/cfdocs/docs/functions/imagesharpen.md|< 0: the image is blurred. | + +## Using sharpen member function + +CF11+ Lucee4.5+ Sharpen an image + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.sharpen(2); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imageshear.md b/docs/functions/imageshear.md new file mode 100644 index 000000000..3abbe73e0 --- /dev/null +++ b/docs/functions/imageshear.md @@ -0,0 +1,36 @@ +# imageShear + + Shears an image either horizontally or vertically. + +```javascript +imageShear(name, shear [, direction] [, interpolation]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.shear(shear [, direction] [, interpolation]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| shear | numeric | Yes | | Shear value. Coordinates can be integers or real numbers. | | +| direction | string | No | horizontal | Shear direction | /Users/garethedwards/development/github/cfdocs/docs/functions/imageshear.md|vertical | +| interpolation | string | No | nearest | Type of interpolation | /Users/garethedwards/development/github/cfdocs/docs/functions/imageshear.md|bicubic: Applies the bicubic method of interpolation. Generally, the quality of image is highest with this method and processing is slowest. | + +## Using shear member function + +CF11+ Shear the image by a factor of 1 on a horizontal axis + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.shear(1); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagesheardrawingaxis.md b/docs/functions/imagesheardrawingaxis.md new file mode 100644 index 000000000..4bf840aa9 --- /dev/null +++ b/docs/functions/imagesheardrawingaxis.md @@ -0,0 +1,36 @@ +# imageShearDrawingAxis + + Shears the drawing canvas. + +```javascript +imageShearDrawingAxis(name, shrx, shry) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.shearDrawingAxis(shrx, shry) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| shrx | numeric | Yes | | The multiplier by which coordinates are shifted in the positive x axis direction as a function of the y coordinate.e | +| shry | numeric | Yes | | The multiplier by which coordinates are shifted in the positive y axis direction as a function of the x coordinate. | + +## Using shearDrawingAxis member function + +CF11+ Draw a sheared rectangle + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.shearDrawingAxis(0.5,0.5); +imgObj.drawRect(40,50,70,50,"yes"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagetranslate.md b/docs/functions/imagetranslate.md new file mode 100644 index 000000000..8da112d98 --- /dev/null +++ b/docs/functions/imagetranslate.md @@ -0,0 +1,37 @@ +# imageTranslate + + Copies an image to a new location on the plane. + +```javascript +imageTranslate(name, xTrans, yTrans [, interpolation]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.translate(xTrans, yTrans [, interpolation]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| xTrans | numeric | Yes | | Displacement in the x direction. | | +| yTrans | numeric | Yes | | Displacement in the y direction. | | +| interpolation | string | No | nearest | Type of interpolation | /Users/garethedwards/development/github/cfdocs/docs/functions/imagetranslate.md|bicubic: Applies the bicubic method of interpolation. Generally, the quality of image is highest with this method and processing is slowest. | + +## Using translate member function + +CF11+ copy the original image to a new location on the plane + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.translate(35,35); +imgObj.drawRect(40,50,70,50,"yes"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagetranslatedrawingaxis.md b/docs/functions/imagetranslatedrawingaxis.md new file mode 100644 index 000000000..7b9d40f1f --- /dev/null +++ b/docs/functions/imagetranslatedrawingaxis.md @@ -0,0 +1,36 @@ +# imageTranslateDrawingAxis + + Translates the origin of the image context to the point (x,y) in the current coordinate system. Modifies the image context so that its new origin corresponds to the point (x,y) in the image's original coordinate system. + +```javascript +imageTranslateDrawingAxis(name, x, y) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.translateDrawingAxis(x, y) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | +| x | numeric | Yes | | x coordinate | +| y | numeric | Yes | | y coordinate | + +## Using translateDrawingAxis member function + +CF11+ Draw a rectangle after the drawing axis has been moved + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.translateDrawingAxis(50,50); +imgObj.drawRect(40,50,70,50,"yes"); +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/imagewrite.md b/docs/functions/imagewrite.md new file mode 100644 index 000000000..c3d03ccf8 --- /dev/null +++ b/docs/functions/imagewrite.md @@ -0,0 +1,35 @@ +# imageWrite + + Writes a ColdFusion image to the specified filename or destination. + +```javascript +imageWrite(name [, destination] [, quality] [, overwrite]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.write([destination] [, quality] [, overwrite]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| destination | string | No | | The path to write the file.

If you create the image with the ImageNew function or another operation where you do not specify the filename, specify the destination parameter. The file format is derived from the extension of the filename. The default value for this parameter is the filename of the original image source. | | +| quality | string | No | | Defines the JPEG quality used to encode the image. This parameter applies only to destination files with an extension of JPG or JPEG. Valid values are fractions that range from 0 through 1 (the lower the number, the lower the quality). The default value is 0.75. | | +| overwrite | boolean | No | YES | If set to true, overwrites the destination file | /Users/garethedwards/development/github/cfdocs/docs/functions/imagewrite.md|YES | + +## Using write member function + +CF11+ save an image with a new name + +```javascript +imgObj = imageRead("http://cfdocs.org/apple-touch-icon.png"); +imgObj.write('newName.png'); +``` diff --git a/docs/functions/imagewritebase64.md b/docs/functions/imagewritebase64.md new file mode 100644 index 000000000..32d6576c1 --- /dev/null +++ b/docs/functions/imagewritebase64.md @@ -0,0 +1,36 @@ +# imageWriteBase64 + + Writes Base64 images to the specified filename and destination. + +```javascript +imageWriteBase64(name, destination, format [, inHTMLFormat] [, overwrite]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.writeBase64(destination, format [, inHTMLFormat] [, overwrite]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | The image on which this operation is performed. | | +| destination | string | Yes | | The path for the destination file. | | +| format | string | Yes | | the image format | | +| inHTMLFormat | boolean | No | NO | Specify whether Base64 output includes the headers used by the Base64 images in the HTML 'img' tag ('data:image/{format};base64,...') | /Users/garethedwards/development/github/cfdocs/docs/functions/imagewritebase64.md|YES | +| overwrite | boolean | No | YES | If set to true, overwrites the destination file. | /Users/garethedwards/development/github/cfdocs/docs/functions/imagewritebase64.md|YES | + +## Using translateDrawingAxis member function + +CF11+ Write a base64 representation of an image + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.writeBase64('base64.txt','jpg'); +``` diff --git a/docs/functions/imagexordrawingmode.md b/docs/functions/imagexordrawingmode.md new file mode 100644 index 000000000..ff0191418 --- /dev/null +++ b/docs/functions/imagexordrawingmode.md @@ -0,0 +1,41 @@ +# imageXORDrawingMode + +Sets the paint mode of the image to alternate between the image's current color and the new specified color. + +```javascript +imageXORDrawingMode(image, color) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someImage.xorDrawingMode(color) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| image | string | Yes | | The image on which this operation is performed. | +| color | string | Yes | black | XOR alternation color. The values can be:
- Hexadecimal value of the RGB color. For example, specify the color white as `##FFFFFF` or `FFFFFF`.
- String value of color (for example, `black`, `red`, `green`).
- List of three numbers for (R,G,B) values. Each value must be in the range 0-255. | + +## Using xorDrawingMode member function + +CF11+ Create a new image, set the xorDrawingMode to be the background color, draw a white rectangle, set drawing color to white, draw some points on the image. Where point pixels are the same as background color use XOR color + +```javascript +imgObj = imageNew("",152,152,"rgb","149c82"); +imgObj.xorDrawingMode("149c82"); +imgObj.setDrawingColor("white"); +imgObj.drawRect(50,50,50,50,"yes"); +for (i=1;i LTE 100;i=i+1) { + x = randRange(0,152); + y = randRange(0,152); + imgObj.drawPoint(x,y); +} +cfimage(action="writeToBrowser", source=imgObj); +``` diff --git a/docs/functions/incrementvalue.md b/docs/functions/incrementvalue.md new file mode 100644 index 000000000..a0923a1d4 --- /dev/null +++ b/docs/functions/incrementvalue.md @@ -0,0 +1,34 @@ +# incrementValue + +Increment the integer part of a number. +Same as x=x+1 or x++ + +```javascript +incrementValue(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Increment 7 + +```javascript +incrementValue(7) +``` + +### Expected Result: 8 + +## Increment 7.5 + +There is a difference between CFML engines. ACF will return the integer incremented removing the decimal part. Lucee will increment the integer part but return both. + +```javascript +incrementValue(7.5) +``` diff --git a/docs/functions/inputbasen.md b/docs/functions/inputbasen.md new file mode 100644 index 000000000..6a98f97ab --- /dev/null +++ b/docs/functions/inputbasen.md @@ -0,0 +1,50 @@ +# inputBaseN + +Converts string, using the base specified by radix, to an integer. + +```javascript +inputBaseN(String, radix) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| radix | string | Yes | | | + +## Binary string to decimal + +```javascript +inputBaseN("1010",2) +``` + +### Expected Result: 10 + +## Hexadecimal string to decimal + +```javascript +inputBaseN("3FF",16) +``` + +### Expected Result: 1023 + +## Decimal string to decimal + +```javascript +inputBaseN("125",10) +``` + +### Expected Result: 125 + +## Binary number to decimal + +```javascript +inputBaseN(1010,2) +``` + +### Expected Result: 10 diff --git a/docs/functions/insert.md b/docs/functions/insert.md new file mode 100644 index 000000000..4b87b4072 --- /dev/null +++ b/docs/functions/insert.md @@ -0,0 +1,45 @@ +# insert + + Inserts a substring in a string after a specified character + position. If position = 0, prefixes the substring to the + string. + +```javascript +insert(substring, String, position) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| substring | string | Yes | | A string to insert | +| String | string | Yes | | A string, which to insert substring | +| position | numeric | Yes | | Substring add after this position value in given string | + +## Simple insert function example + +To add substring on prefix of the given string + +```javascript +someString = ' chrome browser'; +result = insert('Google', someString, 0); +writeOutput(result); +``` + +### Expected Result: Google chrome browser + +## Simple insert function example with position + +To add substring on suffix of the given string + +```javascript +someString = 'New private mozilla fire'; +length = len(someString); +writeOutput(insert('fox', someString, length)); +``` + +### Expected Result: New private mozilla firefox diff --git a/docs/functions/int.md b/docs/functions/int.md new file mode 100644 index 000000000..dd6ed2631 --- /dev/null +++ b/docs/functions/int.md @@ -0,0 +1,25 @@ +# int + + Calculates the closest integer that is smaller than number. + +```javascript +int(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Closest integer less than 1.8 + +```javascript +int(1.8) +``` + +### Expected Result: 1 diff --git a/docs/functions/invalidateoauthaccesstoken.md b/docs/functions/invalidateoauthaccesstoken.md new file mode 100644 index 000000000..64fc64991 --- /dev/null +++ b/docs/functions/invalidateoauthaccesstoken.md @@ -0,0 +1,24 @@ +# invalidateOauthAccesstoken + +Invalidates the access token generated by the OAUTH servers. + +```javascript +invalidateOauthAccesstoken(token,type); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| token | string | Yes | | The access token to invalidate. | +| type | string | Yes | | The type of the OAUTH server (facebook/google). | + +## Tag Syntax + +```javascript +invalidateOauthAccesstoken("any_token_value","facebook") +``` diff --git a/docs/functions/invoke.md b/docs/functions/invoke.md new file mode 100644 index 000000000..c1ad19bfd --- /dev/null +++ b/docs/functions/invoke.md @@ -0,0 +1,56 @@ +# invoke + +Invokes an object method and returns the result of the invoked method. + +```javascript +invoke(instance, methodName [, arguments]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| instance | string | Yes | | Name or instance of a CFC or an instance of a Java, .NET, COM or CORBA object to instantiate. For a CFC, it can be an empty string when invoking a method within the same ColdFusion page or component. | +| methodname | string | Yes | | The name of the method (or operation for webservice) to invoke. | +| arguments | any | No | | An array of positional arguments or a struct of named arguments to pass into the method. | + +## Invoke a Java Method + +Invokes the size method on a new HashMap object, which should return 0 + +```javascript +invoke(createObject("java", "java.util.HashMap"), "size") +``` + +### Expected Result: 0 + +## Invoke a method on a component + +Invokes the method named 'test' on the component Test.cfc with one parameter + +```javascript +obj = createObject("component", "Test"); +invoke(obj, "test", {parameter="Test Data"}); +``` + +## Invoke a method on a webservice with one argument + +Invokes the method named 'test' on the webservice Test.cfc with one argument + +```javascript +obj = createObject("webservice", "https://example.com/test.cfc?wsdl"); +invoke(obj, "test", {argument1="Test Data"}); +``` + +## Invoke a method on a webservice with multiple arguments + +Invokes the method named 'test' on the webservice Test.cfc with multiple arguments + +```javascript +obj = createObject("webservice", "https://example.com/test.cfc?wsdl"); +invoke(obj, "test", {argument1="Test Data", argument2="More Data", argument3="Still More Data"}); +``` diff --git a/docs/functions/isarray.md b/docs/functions/isarray.md new file mode 100644 index 000000000..c8b1b7667 --- /dev/null +++ b/docs/functions/isarray.md @@ -0,0 +1,65 @@ +# isArray + + Determines whether a value is an array. + True, if value is an array, a query column object, or XML. + also number = Dimension; function tests whether the array has + exactly this dimension + +```javascript +isArray(value [, number]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | The array in which to check. | +| number | numeric | No | | Dimension of the array. | + +## simple isArray example + +For CF9+ CF10+ + +```javascript +colorArray = ['yellow','green','red']; +writeOutput(isArray(colorArray)); +``` + +### Expected Result: yes + +## simple isArray example + +For Lucee4.5+ + +```javascript +colorArray = ['yellow','green','red']; +writeOutput(isArray(colorArray)); +``` + +### Expected Result: true + +## isArray example with number + +For CF9+ CF10+ + +```javascript +numberArray = [1,2,3]; +writeOutput(isArray(numberArray,1)); +``` + +### Expected Result: yes + +## isArray example with number + +For Lucee4.5+ + +```javascript +numberArray = [1,2,3]; +writeOutput(isArray(numberArray,1)); +``` + +### Expected Result: true diff --git a/docs/functions/isbinary.md b/docs/functions/isbinary.md new file mode 100644 index 000000000..0c45347a1 --- /dev/null +++ b/docs/functions/isbinary.md @@ -0,0 +1,37 @@ +# isBinary + + Determines whether a value is stored as binary data. + +```javascript +isBinary(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | | + +## Checks if toBase64() function returns binary data + +toBase64() returns base64 encoded data which is not binary + +```javascript +isBinary( toBase64(1) ) +``` + +### Expected Result: NO + +## Checks if toBinary() function returns binary data + +toBinary() expects base64 encoded data and returns binary data + +```javascript +isBinary( toBinary(toBase64(1)) ) +``` + +### Expected Result: YES diff --git a/docs/functions/isboolean.md b/docs/functions/isboolean.md new file mode 100644 index 000000000..16d59c2bf --- /dev/null +++ b/docs/functions/isboolean.md @@ -0,0 +1,87 @@ +# isBoolean + +Returns true when a value can be converted to Boolean + +```javascript +isBoolean(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | | + +## Yes + +`Yes` is considered a boolean that is `true` + +```javascript +isBoolean("yes") +``` + +### Expected Result: YES + +## No + +`No` is considered a boolean that is `false` + +```javascript +isBoolean("no") +``` + +### Expected Result: YES + +## Maybe + +`Maybe` is not considered a boolean + +```javascript +isBoolean("maybe") +``` + +### Expected Result: NO + +## True + +`true` is a boolean + +```javascript +isBoolean(true) +``` + +### Expected Result: YES + +## False + +`false` is a boolean + +```javascript +isBoolean(false) +``` + +### Expected Result: YES + +## Zero + +`0` is considered a boolean that is `false` + +```javascript +isBoolean(0) +``` + +### Expected Result: YES + +## Non Zero Integer + +`23` is considered a boolean that is `true` + +```javascript +isBoolean(23) +``` + +### Expected Result: YES diff --git a/docs/functions/isclosure.md b/docs/functions/isclosure.md new file mode 100644 index 000000000..bf84ee03f --- /dev/null +++ b/docs/functions/isclosure.md @@ -0,0 +1,43 @@ +# isClosure + +Checks if a given object is a closure. + +```javascript +isClosure(object) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| object | any | Yes | | The object to check if it is a closure. | + +## Returns true if the object is a closure + +```javascript +square = function(x) { + return x * x; +}; + +writeDump(isClosure(square)); +``` + +### Expected Result: TRUE + +## Returns false if the object is not a closure + +```javascript +square = function(x) { + return x * x; +}; + +squared = square(5); + +writeDump(isClosure(squared)); +``` + +### Expected Result: FALSE diff --git a/docs/functions/iscustomfunction.md b/docs/functions/iscustomfunction.md new file mode 100644 index 000000000..a360c696f --- /dev/null +++ b/docs/functions/iscustomfunction.md @@ -0,0 +1,41 @@ +# isCustomFunction + +Determines if a variable is a user defined function + +```javascript +isCustomFunction(Object) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| Object | any | Yes | | The variable to test | + +## isCustomFunction Example + +Here we've example to check the given variable is user defined function or not. + +```javascript +function myfunc() { + return 1; + } + writeDump( isCustomFunction(myfunc) ); +``` + +### Expected Result: YES + +## isCustomFunction Example + +Here we've example to check the given variable is user defined function or not. + +```javascript +myfunc ="2"; + writeDump( isCustomFunction(myfunc) ); +``` + +### Expected Result: NO diff --git a/docs/functions/isdate.md b/docs/functions/isdate.md new file mode 100644 index 000000000..2ff7415fd --- /dev/null +++ b/docs/functions/isdate.md @@ -0,0 +1,41 @@ +# isDate + + Determines whether a string or Java object can be converted + to a date/time value. + +```javascript +isDate(Object) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| Object | any | Yes | | A string or variable name | + +## Simple example + +To determine whether a string can be converted to a date/time value. + +```javascript + + +#result# +``` + +### Expected Result: Yes + +## Simple example + +To determine whether a string can be converted to a date/time value. + +```javascript + +#result# +``` + +### Expected Result: No diff --git a/docs/functions/isdateobject.md b/docs/functions/isdateobject.md new file mode 100644 index 000000000..e1c08be90 --- /dev/null +++ b/docs/functions/isdateobject.md @@ -0,0 +1,28 @@ +# isDateObject + +Checks if the given value is a date / time object. The difference between isDateObject and isDate is that the latter returns true for date / time objects as well as date / time strings. + +```javascript +isDateObject(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | A value to test whether it's a date object | + +## Check if date is a date OBJECT, not just a date string + +```javascript + + date = IsDateObject(now()); + writeOutput("Can string be converted to a date/time value : " & date); + +``` + +### Expected Result: Can string be converted to a date/time value : YES diff --git a/docs/functions/isddx.md b/docs/functions/isddx.md new file mode 100644 index 000000000..813a6dca6 --- /dev/null +++ b/docs/functions/isddx.md @@ -0,0 +1,17 @@ +# isDDX + +Determines whether a DDX file exists and is valid, or if a string contains valid DDX instructions. + +```javascript +isDDX(path) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | Pathname to the DDX file or a string of DDX instructions. | diff --git a/docs/functions/isdebugmode.md b/docs/functions/isdebugmode.md new file mode 100644 index 000000000..cd21a2b35 --- /dev/null +++ b/docs/functions/isdebugmode.md @@ -0,0 +1,11 @@ +# isDebugMode + +Determines whether debugging output is enabled. + +```javascript +isDebugMode() +``` + +```javascript +returns boolean +``` diff --git a/docs/functions/isdefined.md b/docs/functions/isdefined.md new file mode 100644 index 000000000..e0ad5d209 --- /dev/null +++ b/docs/functions/isdefined.md @@ -0,0 +1,45 @@ +# isDefined + +Evaluates a string value to determine whether the variable named in it exists. + +```javascript +isDefined(variable_name) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| variable_name | string | Yes | | A string expression containing the name of a variable to check the existence of. Only simple dotted notation is supported (for example `myVar`, `arguments.myArg`, `myStruct.key`). Square bracket notation to reference array elements or struct keys is not supported. | + +## Using IsDefined + +Checking for the existence of a `form` variable. + +```javascript +... +``` + +## Scope Evaluation Order and Unscoped Variables + +Beware of scope evaluation order when checking for an unscoped variable name. + +```javascript +url.foo = "url.foo" ; form.foo = "form.foo"; writeoutput("Is 'foo' defined? " & isDefined("foo")); writeoutput(isDefined("foo") ? " (" & foo & ")" : ""); +``` + +### Expected Result: Is 'foo' defined? YES (url.foo) + +## Dot-notation Variable Names + +Potentially unexpected behavior when checking for a dot-notation variable containing a scope name. + +```javascript +local["form.submit"] = "local['form.submit']" ; form.submit = "form.submit"; writeoutput("Is 'form.submit' defined?" & isDefined("form.submit")); writeoutput(isDefined("form.submit") ? " (" & form.submit & ")" : ""); writeoutput("
"); writeoutput("Is 'submit' defined? " & isDefined("submit")); writeoutput(isDefined("submit") ? " (" & submit & ")" : ""); +``` + +### Expected Result: Is 'form.submit' defined? YES (local['form.submit']) Is 'submit' defined? YES(form.submit) diff --git a/docs/functions/isempty.md b/docs/functions/isempty.md new file mode 100644 index 000000000..4f8ff12cb --- /dev/null +++ b/docs/functions/isempty.md @@ -0,0 +1,27 @@ +# isEmpty + +Returns whether or not a given value is "empty". + +```javascript +isEmpty(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | | + +## isEmpty Example + +Returns a boolean based on the given value. Strings, Arrays, Structs and queries are accepted data types. + +```javascript +isEmpty( {} ) +``` + +### Expected Result: YES diff --git a/docs/functions/isfileobject.md b/docs/functions/isfileobject.md new file mode 100644 index 000000000..e9b835cdb --- /dev/null +++ b/docs/functions/isfileobject.md @@ -0,0 +1,29 @@ +# isFileObject + +Checks if the given object is a filestream-object. A filestream-object you usually get, when calling fileOpen-function. + +```javascript +isFileObject(object); +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| object | variableName | Yes | | The object you want to check, if it is a filestream-object. | + +## Check for a filestream-object + +Checks if the fileObj is a filestream-object. + +```javascript +filePath = expandPath("./myfile.txt"); +fileObj = fileOpen(filePath); +writeOutput(isFileObject(fileObj)); +``` + +### Expected Result: true diff --git a/docs/functions/isimage.md b/docs/functions/isimage.md new file mode 100644 index 000000000..cecfbbacd --- /dev/null +++ b/docs/functions/isimage.md @@ -0,0 +1,38 @@ +# isImage + +Determines whether a variable returns a ColdFusion image. + +```javascript +isImage(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | The value that is checked. | + +## Check local file image (Tag) + +If the local file is an image, write it to the browser + +```javascript + + + + +``` + +## Check online image (Script) + +Output whether the online file is an image + +```javascript +isImage(imageRead("https://cfdocs.org/apple-touch-icon.png"); +``` + +### Expected Result: YES diff --git a/docs/functions/isimagefile.md b/docs/functions/isimagefile.md new file mode 100644 index 000000000..e9166f1f8 --- /dev/null +++ b/docs/functions/isimagefile.md @@ -0,0 +1,38 @@ +# isImageFile + +Verifies whether an image file is valid. + +```javascript +isImageFile(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | Pathname to an image file. | + +## Check local file path (Tag) + +If the local file path is for an image, write the image to the browser + +```javascript + + + + +``` + +## Check URL (Script) + +Output whether the online file is an image + +```javascript +isImageFile("https://cfdocs.org/apple-touch-icon.png"); +``` + +### Expected Result: YES diff --git a/docs/functions/isinstanceof.md b/docs/functions/isinstanceof.md new file mode 100644 index 000000000..729e19722 --- /dev/null +++ b/docs/functions/isinstanceof.md @@ -0,0 +1,28 @@ +# isInstanceOf + +Determines whether an object is an instance of a ColdFusion interface or component, or of a Java class. + +```javascript +isInstanceOf(value, type) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | The CFC instance or Java object that you are testing | +| type | string | Yes | | The name of the interface, component, or Java class of which the object might be an instance | + +## Check if Date is instance of java.util.Date + +Dates in CFML are instances of the java class: `java.util.Date` + +```javascript +isInstanceOf(now(), "java.util.Date"); +``` + +### Expected Result: YES diff --git a/docs/functions/isinthread.md b/docs/functions/isinthread.md new file mode 100644 index 000000000..6f2080e1e --- /dev/null +++ b/docs/functions/isinthread.md @@ -0,0 +1,27 @@ +# isinthread + +Determines whether the executing code is inside a cfthread or not. + +```javascript +isinthread() +``` + +```javascript +returns boolean +``` + +## isinthread Example + +Check if the code is running inside a cfthread. + +```javascript +request.inthread = false; +writeOutput(isInThread()); +thread action="run" name="inThread" { + request.inthread = isInThread(); +} +sleep(1000); +writeOutput(request.inthread) +``` + +### Expected Result: falsetrue diff --git a/docs/functions/isipinrange.md b/docs/functions/isipinrange.md new file mode 100644 index 000000000..1e7b88cfe --- /dev/null +++ b/docs/functions/isipinrange.md @@ -0,0 +1,18 @@ +# isIPInRange + +Determines whether the given IP address is in a specific range + +```javascript +isIPInRange(ips, ip) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| ips | any | Yes | | comma-delimited list or array as ip range, either a specific ip address, a from to range or with * wildcard | +| ip | string | Yes | | ip to test | diff --git a/docs/functions/isipv6.md b/docs/functions/isipv6.md new file mode 100644 index 000000000..51d13c72d --- /dev/null +++ b/docs/functions/isipv6.md @@ -0,0 +1,25 @@ +# isIPV6 + +Checks if given IP is of IPV6 format + +```javascript +isIPV6(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | IP address to check | + +## isIPV6 Example + +```javascript +isIPV6("127.0.0.1"); +``` + +### Expected Result: YES diff --git a/docs/functions/isjson.md b/docs/functions/isjson.md new file mode 100644 index 000000000..fa371534c --- /dev/null +++ b/docs/functions/isjson.md @@ -0,0 +1,27 @@ +# isJSON + +Evaluates whether a string is in valid JSON (JavaScript Object Notation) data interchange format. + +```javascript +isJSON(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | A string or variable that represents one. | + +## isJSON Example + +Returns true when the argument is a valid JSON value. + +```javascript +isJSON("[1,2,3]") +``` + +### Expected Result: YES diff --git a/docs/functions/isk2serverabroker.md b/docs/functions/isk2serverabroker.md new file mode 100644 index 000000000..6282bcd09 --- /dev/null +++ b/docs/functions/isk2serverabroker.md @@ -0,0 +1,11 @@ +# isK2ServerABroker + +Check if K2Broker is in configured with ColdFusion + +```javascript +isK2ServerABroker() +``` + +```javascript +returns boolean +``` diff --git a/docs/functions/isk2serverdoccountexceeded.md b/docs/functions/isk2serverdoccountexceeded.md new file mode 100644 index 000000000..e0c8de12c --- /dev/null +++ b/docs/functions/isk2serverdoccountexceeded.md @@ -0,0 +1,11 @@ +# isK2ServerDocCountExceeded + +Check if the document count limit is exceeded + +```javascript +isK2ServerDocCountExceeded() +``` + +```javascript +returns boolean +``` diff --git a/docs/functions/isk2serveronline.md b/docs/functions/isk2serveronline.md new file mode 100644 index 000000000..c186e7441 --- /dev/null +++ b/docs/functions/isk2serveronline.md @@ -0,0 +1,11 @@ +# isK2ServerOnline + +Check if the K2Server is available to perform a search + +```javascript +isK2ServerOnline() +``` + +```javascript +returns boolean +``` diff --git a/docs/functions/isleapyear.md b/docs/functions/isleapyear.md new file mode 100644 index 000000000..cb30df581 --- /dev/null +++ b/docs/functions/isleapyear.md @@ -0,0 +1,25 @@ +# isLeapYear + + Determines whether a year is a leap year. + +```javascript +isLeapYear(year) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| year | numeric | Yes | | | + +## Is the current date in a leap year? + +```javascript +date = now(); +isLeapYear = isLeapYear(year(date)); +writeOutput(isLeapYear); +``` diff --git a/docs/functions/islocalhost.md b/docs/functions/islocalhost.md new file mode 100644 index 000000000..9da841fca --- /dev/null +++ b/docs/functions/islocalhost.md @@ -0,0 +1,55 @@ +# isLocalhost + +Determines whether the specified value is the localhost. + +```javascript +isLocalhost(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | The value to check. | + +## Is 127.0.0.1 localhost + +```javascript +isLocalHost("127.0.0.1") +``` + +### Expected Result: YES + +## Is ::1 localhost + +Test the IPv6 Loopback address. IPv6 only has one loopback address. + +```javascript +isLocalHost("::1") +``` + +### Expected Result: YES + +## Is 127.8.8.8 localhost + +IPv4 network standards reserve the entire 127.0.0.0/8 address block for loopback networking purposes however they are not usually mapped to `localhost` by default. + +```javascript +isLocalHost("127.8.8.8") +``` + +### Expected Result: NO + +## Is 8.8.8.8 localhost + +Not a localhost IP. + +```javascript +isLocalHost("8.8.8.8") +``` + +### Expected Result: NO diff --git a/docs/functions/isnotmap.md b/docs/functions/isnotmap.md new file mode 100644 index 000000000..aa9b59143 --- /dev/null +++ b/docs/functions/isnotmap.md @@ -0,0 +1,36 @@ +# isNotMap + +Returns true if the given Object is not of Type java.util.Map. + +```javascript +isNotMap(obj) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| obj | any | Yes | | | + +## Check if Map is of type Map + +```javascript +myMap = createObject('java','java.util.HashMap'); +myMap.put('a','1'); +writeOutput(isNotMap(myMap)); +``` + +### Expected Result: true + +## Check if something else is of type Map + +```javascript +myStruct = {'a': 1}; +writeOutput(isNotMap(myStruct)); +``` + +### Expected Result: false diff --git a/docs/functions/isnull.md b/docs/functions/isnull.md new file mode 100644 index 000000000..00d802141 --- /dev/null +++ b/docs/functions/isnull.md @@ -0,0 +1,27 @@ +# isNull + +Returns true if the specified object is null. + +```javascript +isNull(object) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| object | variableName | Yes | | | + +## isNull Example + +Returns true if the given object is null or the given expressions evaluates to null; Returns false is otherwise. + +```javascript +isNull( javaCast("null", "") ) +``` + +### Expected Result: YES diff --git a/docs/functions/isnumeric.md b/docs/functions/isnumeric.md new file mode 100644 index 000000000..187548ae7 --- /dev/null +++ b/docs/functions/isnumeric.md @@ -0,0 +1,43 @@ +# isNumeric + +Determines whether a string can be converted to a numeric value. Supports numbers in U.S. number format. For other number support use LSIsNumeric. + +```javascript +isNumeric(String) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | + +## Integer isNumeric + +```javascript +isNumeric(23) +``` + +### Expected Result: YES + +## String isNumeric + +```javascript +isNumeric("twenty") +``` + +### Expected Result: NO + +## Scientific Notation + +The number `5e2` is scientific notation for `5 x 10^2` aka `500` + +```javascript +isNumeric(5e2) +``` + +### Expected Result: YES diff --git a/docs/functions/isnumericdate.md b/docs/functions/isnumericdate.md new file mode 100644 index 000000000..140eaccdb --- /dev/null +++ b/docs/functions/isnumericdate.md @@ -0,0 +1,42 @@ +# isNumericDate + +Evaluates whether a real number is a valid representation of a + date (date/time object). + +Same as isValid("date", date) + +```javascript +isNumericDate(number) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Simple example + +To determine whether a string can be converted to a date/time value. + +```javascript + +#Date# +``` + +### Expected Result: Yes + +## Simple example + +To determine whether a string can be converted to a date/time value. + +```javascript + +#result# +``` + +### Expected Result: No diff --git a/docs/functions/isobject.md b/docs/functions/isobject.md new file mode 100644 index 000000000..f9bf1dbe7 --- /dev/null +++ b/docs/functions/isobject.md @@ -0,0 +1,40 @@ +# isObject + +Determines whether a value is an object. +True, if the value represents a CFML object. False if the value is any other type of data, such as an integer, string, date, or struct. + +```javascript +isObject(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | | + +## isObject Example + +Returns true if the parameter is a CFML object. The CFML object here is a Java object. + +```javascript +random = createObject( "java", "java.security.SecureRandom" ).getInstance( "SHA1PRNG" ); +writeOutput( isObject( random ) ); +``` + +### Expected Result: YES + +## isObject Example for Other Data Types + +Returns false if the parameter is any data type other than a CFML object + +```javascript +example = { 'name' = 'I am a struct' }; +writeOutput( isObject( example ) ); +``` + +### Expected Result: NO diff --git a/docs/functions/ispdfarchive.md b/docs/functions/ispdfarchive.md new file mode 100644 index 000000000..316911587 --- /dev/null +++ b/docs/functions/ispdfarchive.md @@ -0,0 +1,18 @@ +# isPDFArchive + +Returns `true` if the pdf file at the specified `path` meets the specified `standard`. + +```javascript +isPDFArchive(path, standard) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| path | string | Yes | | Path to a PDF file. | | +| standard | string | Yes | | PDF Archiving Standard | /Users/garethedwards/development/github/cfdocs/docs/functions/ispdfarchive.md|3b | diff --git a/docs/functions/ispdffile.md b/docs/functions/ispdffile.md new file mode 100644 index 000000000..4103bd0be --- /dev/null +++ b/docs/functions/ispdffile.md @@ -0,0 +1,17 @@ +# isPDFFile + + Verifies whether a PDF file is valid. + +```javascript +isPDFFile(path) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | Pathname to a PDF file. | diff --git a/docs/functions/ispdfobject.md b/docs/functions/ispdfobject.md new file mode 100644 index 000000000..4a27d9036 --- /dev/null +++ b/docs/functions/ispdfobject.md @@ -0,0 +1,17 @@ +# isPDFObject + +Determines whether a value is a PDF object. + +```javascript +isPDFObject(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | A value, typically the PDF object stored as a variable. | diff --git a/docs/functions/isquery.md b/docs/functions/isquery.md new file mode 100644 index 000000000..25eeda8d1 --- /dev/null +++ b/docs/functions/isquery.md @@ -0,0 +1,30 @@ +# isQuery + + Determines whether a value is a query. + +```javascript +isQuery(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | | + +## Create and populate a query and output the 'name' column as a list if it is a valid query + +```javascript +names = queryNew( 'name','varchar' ); +queryAddRow( names ); +querySetCell( names,'name','Seth' ); +queryAddRow( names ); +querySetCell( names,'name','Jen' ); +if( isQuery( names ) ) { + writeOutput( valueList( names.name ) ); +} +``` diff --git a/docs/functions/issafehtml.md b/docs/functions/issafehtml.md new file mode 100644 index 000000000..19ed1f353 --- /dev/null +++ b/docs/functions/issafehtml.md @@ -0,0 +1,44 @@ +# isSafeHTML + +Checks a HTML string against antisamy policy file to determine if it may be vulnerable to XSS / Cross Site Scripting. + +```javascript +isSafeHTML(inputString [, PolicyFile]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| inputString | string | Yes | | String to be validated | +| PolicyFile | string | No | | File path for custom AntiSamy policy file. Can be defined in the application scope or if not defined will use ColdFusion server default | + +## Unsafe HTML Example + +Example with HTML that causes isSafeHTML to return false. + +```javascript + +
+ +#isSafeHTML(html)# +``` + +### Expected Result: no + +## Safe HTML Example + +Example with HTML that is safe on the default policy. + +```javascript + + Foundeo Inc. + +#isSafeHTML(html)# +``` + +### Expected Result: yes diff --git a/docs/functions/issimplevalue.md b/docs/functions/issimplevalue.md new file mode 100644 index 000000000..c3f76efa6 --- /dev/null +++ b/docs/functions/issimplevalue.md @@ -0,0 +1,51 @@ +# isSimpleValue + +Returns true only if the value is a string, boolean, numeric, or date. + +```javascript +isSimpleValue(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | | + +## A number is a simple value + +```javascript +isSimpleValue(42) +``` + +### Expected Result: YES + +## A string is a simple value as well + +```javascript +isSimpleValue("Hello world") +``` + +### Expected Result: YES + +## A structure is a complex value + +So it can't a be simple value + +```javascript +isSimpleValue(structNew()) +``` + +### Expected Result: NO + +## An array is a complex value + +```javascript +isSimpleValue(arrayNew(1)) +``` + +### Expected Result: NO diff --git a/docs/functions/issoaprequest.md b/docs/functions/issoaprequest.md new file mode 100644 index 000000000..eda8eaae1 --- /dev/null +++ b/docs/functions/issoaprequest.md @@ -0,0 +1,11 @@ +# isSOAPRequest + +Determines whether a CFC is being called as a web service. + +```javascript +isSOAPRequest() +``` + +```javascript +returns boolean +``` diff --git a/docs/functions/isspreadsheetfile.md b/docs/functions/isspreadsheetfile.md new file mode 100644 index 000000000..97186e776 --- /dev/null +++ b/docs/functions/isspreadsheetfile.md @@ -0,0 +1,33 @@ +# isSpreadsheetFile + +Checks if the input is a spreadsheet file or not + +```javascript +isSpreadsheetFile(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | A file path | + +## Simple isSpreadsheetFile example + +Here we have simple example to check if the given file is a spreadsheet or not. + +```javascript +
+ + +
+ + + + + +``` diff --git a/docs/functions/isspreadsheetobject.md b/docs/functions/isspreadsheetobject.md new file mode 100644 index 000000000..c95f542ef --- /dev/null +++ b/docs/functions/isspreadsheetobject.md @@ -0,0 +1,17 @@ +# isSpreadsheetObject + +Checks if given object is spreadsheet object or not + +```javascript +isSpreadsheetObject(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | Any Object | diff --git a/docs/functions/isstruct.md b/docs/functions/isstruct.md new file mode 100644 index 000000000..c97a2cd8b --- /dev/null +++ b/docs/functions/isstruct.md @@ -0,0 +1,40 @@ +# isStruct + + Determines whether a variable is a structure. + True, if variable is a CFML structure or is a Java object + that implements the java.lang.Map interface. Returns False if the + object in variable is a user-defined function (UDF). + +```javascript +isStruct(variable) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| variable | any | Yes | | | + +## isStruct Example + +Returns true if variable is a ColdFusion structure or is a Java object that implements the java.lang.Map interface. + +```javascript +isStruct( structNew() ) +``` + +### Expected Result: YES + +## isStruct Example for False + +Returns false is the object in the variable parameter is a user-defined function UDF). In the example below exponent is a function created by the user + +```javascript +isStruct( arrayNew(1) ) +``` + +### Expected Result: NO diff --git a/docs/functions/isuserinanyrole.md b/docs/functions/isuserinanyrole.md new file mode 100644 index 000000000..f4e6d0dc6 --- /dev/null +++ b/docs/functions/isuserinanyrole.md @@ -0,0 +1,17 @@ +# isUserInAnyRole + +Determines whether an authenticated user belongs to any role in a list of roles. + +```javascript +isUserInAnyRole(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | A comma-delimited list of one or more roles to be tested | diff --git a/docs/functions/isuserinrole.md b/docs/functions/isuserinrole.md new file mode 100644 index 000000000..f3aefcd47 --- /dev/null +++ b/docs/functions/isuserinrole.md @@ -0,0 +1,17 @@ +# isUserInRole + +Determines whether an authenticated user belongs to the specified Role. + +```javascript +isUserInRole(value) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | Name of a security role | diff --git a/docs/functions/isuserloggedin.md b/docs/functions/isuserloggedin.md new file mode 100644 index 000000000..9e3a067a1 --- /dev/null +++ b/docs/functions/isuserloggedin.md @@ -0,0 +1,11 @@ +# isUserLoggedIn + +Determines whether a user is logged in. + +```javascript +isUserLoggedIn() +``` + +```javascript +returns boolean +``` diff --git a/docs/functions/isvalid.md b/docs/functions/isvalid.md new file mode 100644 index 000000000..cbeb59c44 --- /dev/null +++ b/docs/functions/isvalid.md @@ -0,0 +1,41 @@ +# isValid + +Tests whether a value meets a validation or data type rule. + +```javascript +isValid(type, value, min, max, pattern) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | | The valid format for the data. | +| value | any | Yes | | The value to test. | +| min | numeric | No | | The minimum valid value; used only for range validation. | +| max | numeric | No | | The maximum valid value; used only for range validation. | +| pattern | string | No | | A regular expression that the parameter must match;
used only for regex or regular_expression validation. | + +## Check to see if a 235 is an integer + +Use the isValid function with integer as the type. + +```javascript +isValid("integer", 235) +``` + +### Expected Result: true + +## Validate an Email Address + +Use the isValid function with email as the type. + +```javascript +isValid("email", "user@example.com") +``` + +### Expected Result: true diff --git a/docs/functions/isvalidoauthaccesstoken.md b/docs/functions/isvalidoauthaccesstoken.md new file mode 100644 index 000000000..435ab3720 --- /dev/null +++ b/docs/functions/isvalidoauthaccesstoken.md @@ -0,0 +1,24 @@ +# isValidOauthAccesstoken + +Checks if the OAuth access token is still valid. + +```javascript +isValidOauthAccesstoken(token,type); +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| token | string | Yes | | The access token to check. | +| type | string | Yes | | The type of the OAuth server (facebook/google). | + +## Tag Syntax + +```javascript +isValidOauthAccesstoken("any_token_value","facebook") +``` diff --git a/docs/functions/isvideofile.md b/docs/functions/isvideofile.md new file mode 100644 index 000000000..47bd59359 --- /dev/null +++ b/docs/functions/isvideofile.md @@ -0,0 +1,17 @@ +# isVideoFile + +Checks if given string is a video file + +```javascript +isVideoFile(path) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | Pathname to a video file. | diff --git a/docs/functions/iswddx.md b/docs/functions/iswddx.md new file mode 100644 index 000000000..1755b847a --- /dev/null +++ b/docs/functions/iswddx.md @@ -0,0 +1,17 @@ +# isWDDX + + Determines whether a value is a well-formed WDDX packet. + +```javascript +isWDDX(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | | diff --git a/docs/functions/isxml.md b/docs/functions/isxml.md new file mode 100644 index 000000000..e3e46fa7e --- /dev/null +++ b/docs/functions/isxml.md @@ -0,0 +1,58 @@ +# isXML + +Determines whether a string is well-formed XML text. + +```javascript +isXML(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | A string containing the XML document text. | +| parserOptions | struct | No | | XML parsing options. No documentation available on usage. | + +## isXML Example + +Returns true if the string is well-formed XML. + +```javascript +example = ' + + Adobe ColdFusion + + + Lucee + + + Railo + + + Open BlueDragon + +'; +writeOutput( isXml( example ) ); +``` + +### Expected Result: YES + +## isXML Example for Invalid XML + +Returns false if the string is not well-formed XML. + +```javascript +example1 = ' + + Adobe ColdFusion + + + Lucee'; +writeOutput( isXml( example1 ) ); +``` + +### Expected Result: NO diff --git a/docs/functions/isxmlattribute.md b/docs/functions/isxmlattribute.md new file mode 100644 index 000000000..38ff18651 --- /dev/null +++ b/docs/functions/isxmlattribute.md @@ -0,0 +1,17 @@ +# isXMLAttribute + +Determines whether the function parameter is an XML Document Object Model (DOM) attribute node. + +```javascript +isXMLAttribute(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | Name of an XML attribute. | diff --git a/docs/functions/isxmldoc.md b/docs/functions/isxmldoc.md new file mode 100644 index 000000000..619f7c907 --- /dev/null +++ b/docs/functions/isxmldoc.md @@ -0,0 +1,43 @@ +# isXMLDoc + +Determines whether a function parameter is an Extended Markup language (XML) document object. + +```javascript +isXMLDoc(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | XML document | + +## Checks if a given XML is valid + +```javascript + + + + Adobe ColdFusion + + + Lucee + + + Railo + + + Open BlueDragon + + + + + writeOutput(isXMLDoc(example)); + +``` + +### Expected Result: YES diff --git a/docs/functions/isxmlelem.md b/docs/functions/isxmlelem.md new file mode 100644 index 000000000..d9fdac919 --- /dev/null +++ b/docs/functions/isxmlelem.md @@ -0,0 +1,44 @@ +# isXMLElem + +Determines whether a function parameter is an Extended Markup + language (XML) document object element. + +```javascript +isXMLElem(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | XML Element | + +## Check if given path is an XML element + +```javascript + + + + Adobe ColdFusion + + + Lucee + + + Railo + + + Open BlueDragon + + + + + writeOutput(isXMLElem(example.coldfusionengines)); + +``` + +### Expected Result: YES diff --git a/docs/functions/isxmlnode.md b/docs/functions/isxmlnode.md new file mode 100644 index 000000000..ee1c5f06f --- /dev/null +++ b/docs/functions/isxmlnode.md @@ -0,0 +1,43 @@ +# isXMLNode + +Determines whether the function parameter is an XML document object node. + +```javascript +isXMLNode(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | XML document object node. | + +## Checks if given path is an XML node + +```javascript + + + + Adobe ColdFusion + + + Lucee + + + Railo + + + Open BlueDragon + + + + + writeOutput(isXMLNode(example.coldfusionengines)); + +``` + +### Expected Result: YES diff --git a/docs/functions/isxmlroot.md b/docs/functions/isxmlroot.md new file mode 100644 index 000000000..7a1a55088 --- /dev/null +++ b/docs/functions/isxmlroot.md @@ -0,0 +1,69 @@ +# isXMLRoot + +Determines whether a function parameter is the root element of an Extended Markup language (XML) document object. + +```javascript +isXMLRoot(value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | XML Element | + +## "coldfusionengines" is root element + +```javascript + + + + Adobe ColdFusion + + + Lucee + + + Railo + + + Open BlueDragon + + + + + writeOutput(isXMLRoot(example.coldfusionengines)); + +``` + +### Expected Result: YES + +## "engine" is child of "coldfusionengines" + +```javascript + + + + Adobe ColdFusion + + + Lucee + + + Railo + + + Open BlueDragon + + + + + writeOutput(isXMLRoot(example.coldfusionengines.engine)); + +``` + +### Expected Result: NO diff --git a/docs/functions/iszipfile.md b/docs/functions/iszipfile.md new file mode 100644 index 000000000..e45dc0e36 --- /dev/null +++ b/docs/functions/iszipfile.md @@ -0,0 +1,17 @@ +# isZipFile + +Determines whether the given file is a zip archive or not + +```javascript +isZipFile(path) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | | diff --git a/docs/functions/javacast.md b/docs/functions/javacast.md new file mode 100644 index 000000000..fba6fe4e2 --- /dev/null +++ b/docs/functions/javacast.md @@ -0,0 +1,28 @@ +# javaCast + +Converts the data type of a CFML variable to pass as an argument to an overloaded method of a Java object. + +```javascript +javaCast(type, variable) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | | The name of a Java primitive or a Java class name. | +| variable | string | Yes | | A variable, Java object or array. | + +## Convert a ColdFusion Number to a Java double primitive + +Converts the number 180.0 degrees to radians using Java method: Math.toRadians(double degrees) + +```javascript +createObject("java", "java.lang.Math").toRadians( javaCast("double", 180.0) ) +``` + +### Expected Result: 3.14159265359 diff --git a/docs/functions/jsstringformat.md b/docs/functions/jsstringformat.md new file mode 100644 index 000000000..90af788f4 --- /dev/null +++ b/docs/functions/jsstringformat.md @@ -0,0 +1,27 @@ +# jsStringFormat + + Escapes special JavaScript characters, such as single quotation + mark, double quotation mark, and newline + +```javascript +jsStringFormat(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | + +## jsStringFormat Example + +This example illustrates use of the JSStringFormat function. + +```javascript +string = "An example string value with ""quoted"" 'text'"; + writeOutput(JSStringFormat(string)) ; +``` diff --git a/docs/functions/lcase.md b/docs/functions/lcase.md new file mode 100644 index 000000000..d816bc563 --- /dev/null +++ b/docs/functions/lcase.md @@ -0,0 +1,25 @@ +# lCase + + Converts the alphabetic characters in a string to lowercase. + +```javascript +lCase(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | + +## lowercase CFDocs Rock + +```javascript +lCase('CFDocs Rock') +``` + +### Expected Result: cfdocs rock diff --git a/docs/functions/left.md b/docs/functions/left.md new file mode 100644 index 000000000..e341e937d --- /dev/null +++ b/docs/functions/left.md @@ -0,0 +1,74 @@ +# left + + Returns the leftmost count characters in a string. + +```javascript +left(String, count) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.left(count) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| count | numeric | Yes | | An integer or a variable that contains one.
Number of characters to return. | + +## Using left() on a string + +In this example we'll use left() to return part of a string. + +```javascript +writeOutput( left( 'The quick brown fox jumped over the lazy dog', 19 ) ); +``` + +### Expected Result: The quick brown fox + +## Using left() with a negative count on a string + +CF2018+ In this example we'll use a negative count to return part of a string. CF2018+ + +```javascript +writeOutput( left( 'The quick brown fox jumped over the lazy dog', -25 ) ); +``` + +### Expected Result: The quick brown fox + +## Using left() in a function + +In this example we'll use left() in a function to help us to capitalize the first letter in a string. + +```javascript +public string function capitalize( required string text ) { + return uCase( left( arguments.text, 1 ) ) & right( arguments.text, len( arguments.text ) - 1 ); +} +``` + +## Using left() to test values + +In this example we'll use left() to test the first five characters of a request context variable. + +```javascript +if( listFindNoCase( 'super,great,coder,rulez', left( rc.answer, 5 ) ) ) { + writeOutput( 'You are an awesome developer!' ); +} +``` + +## Using left() as a member function + +CF11+ Lucee4.5+ In this example we'll use left() as a member function inside a function to help us to capitalize the first letter in a string. + +```javascript +public string function capitalize( required string text ) { + return arguments.text.left( 1 ).ucase() & arguments.text.right( arguments.text.len() - 1 ); +} +``` diff --git a/docs/functions/len.md b/docs/functions/len.md new file mode 100644 index 000000000..7d1dbbe9e --- /dev/null +++ b/docs/functions/len.md @@ -0,0 +1,39 @@ +# len + + Determines the length of a string or binary object + +```javascript +len(Object) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| Object | any | Yes | | A string or variable name | + +## Simple example for Len function + +To get the total length of the string or binary object + +```javascript +someString = 'ColdFusion'; +writeOutput(len(someString)); +``` + +### Expected Result: 10 + +## Simple example for Len function as member function + +For CF11+ Lucee4.5+ + +```javascript +colorArray = ['Green','red','blue']; +writeOutput(colorArray.len()); +``` + +### Expected Result: 3 diff --git a/docs/functions/listappend.md b/docs/functions/listappend.md new file mode 100644 index 000000000..9dd4deb6d --- /dev/null +++ b/docs/functions/listappend.md @@ -0,0 +1,74 @@ +# listAppend + +Concatenates a list or element to a list and returns the concatenated list. + +```javascript +listAppend(list, value [, delimiters, includeEmptyFields]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +str.listAppend(value [, delimiters, includeEmptyFields]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| list | string | Yes | | A list or variable with the list. | | +| value | string | Yes | | An element or a list of elements. | | +| delimiters | string | No | , | A string or variable with a character that separates list elements. | | +| includeEmptyFields | boolean | No | false | CF2018+ Set to true to append blank values to the list. | /Users/garethedwards/development/github/cfdocs/docs/functions/listappend.md|false | + +## Simple listAppend Example + +Add 'foo' to the end of this list + +```javascript +oldList = "bar,bar2"; +newList = listAppend(oldList, "foo"); +writeOutput(oldList & "-->" & newList); +``` + +### Expected Result: bar,bar2,foo + +## Simple listAppend Example with Delimiter + +Add 'foo' to the end of this list using a custom delimiter + +```javascript +oldList = "bar,bar2"; +newList = listAppend(oldList, "foo", "|"); +writeOutput(oldList & "-->" & newList); +``` + +### Expected Result: bar,bar2|foo + +## Simple listAppend Example with Empty Fields On + +CF2018+ Add 'foo,,' to the end of this list using includeEmptyFields as true + +```javascript +oldList = "bar,bar2"; +newList = listAppend(oldList, "foo,,", ",", true); +writeOutput(oldList & "-->" & newList); +``` + +### Expected Result: bar,bar2,foo,, + +## Simple listAppend Example with Empty Fields Off + +CF2018+ Add 'foo' to the end of this list using includeEmptyFields as false + +```javascript +oldList = "bar,bar2"; +newList = listAppend(oldList, "foo,,", ",", false); +writeOutput(oldList & "-->" & newList); +``` + +### Expected Result: bar,bar2,foo diff --git a/docs/functions/listavg.md b/docs/functions/listavg.md new file mode 100644 index 000000000..139306450 --- /dev/null +++ b/docs/functions/listavg.md @@ -0,0 +1,47 @@ +# listAvg + +Calculates average from all numeric values given in the list + +```javascript +listAvg(list [, delimiters] [, multiCharacterDelimiter]) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +list.listAvg([delimiters] [, multiCharacterDelimiter]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| delimiters | string | No | , | | +| multiCharacterDelimiter | boolean | No | false | | + +## Calculate average from query columns + +```javascript +athletes = queryNew('id,name,bestTime', 'integer,varchar,decimal'); +queryAddRow(athletes,[{ + id: 0, + name: 'Anne', + bestTime: 15.4 +},{ + id: 1, + name: 'John', + bestTime: 12.8 +},{ + id: 2, + name: 'Sue', + bestTime: 9.1 +}]); +writeOutput('Athlete''s average best time is #NumberFormat(listAvg(ValueList(athletes.bestTime)),'0.00')# seconds.'); +``` + +### Expected Result: Athlete's average best time is 12.43 seconds. diff --git a/docs/functions/listchangedelims.md b/docs/functions/listchangedelims.md new file mode 100644 index 000000000..fadb9142a --- /dev/null +++ b/docs/functions/listchangedelims.md @@ -0,0 +1,48 @@ +# listChangeDelims + + Changes a list delimiter. + Returns a copy of the list, with each delimiter character + replaced by new_delimiter. + +```javascript +listChangeDelims(list, new_delimiter [, delimiters, [includeEmptyValues]]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +list.listChangeDelims(new_delimiter [, delimiters, [includeEmptyValues]]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | A list or a variable that contains one. | +| new_delimiter | string | Yes | | Delimiter string or a variable that contains one. Can be an empty string. ColdFusion processes the string as one delimiter. | +| delimiters | string | No | , | A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter. | +| includeEmptyValues | string | No | NO | CF10+ Set to yes to include empty values. | + +## Simple Example + +Changes the delimiters in the list + +```javascript +listChangeDelims("foo,bar,lorem,ipsum", "|") +``` + +### Expected Result: foo|bar|lorem|ipsum + +## Example with Custom Delimiter + +Changes the delimiters in the list using a custom delimiter + +```javascript +listChangeDelims("foo,bar|lorem,ipsum|me|something", "~", "|") +``` + +### Expected Result: foo,bar~lorem,ipsum~me~something diff --git a/docs/functions/listcompact.md b/docs/functions/listcompact.md new file mode 100644 index 000000000..e05ed0832 --- /dev/null +++ b/docs/functions/listcompact.md @@ -0,0 +1,33 @@ +# listCompact + +Remove empty elements from start and end of the list + +```javascript +listCompact(list [, delimiters] [, multiCharacterDelimiter]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +list.listCompact([delimiters] [, multiCharacterDelimiter]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| delimiters | string | No | , | | +| multiCharacterDelimiter | boolean | No | false | | + +## Trims first and last comma from list string + +```javascript +listCompact(",eggs,milk,bread,flour,") +``` + +### Expected Result: eggs,milk,bread,flour diff --git a/docs/functions/listcontains.md b/docs/functions/listcontains.md new file mode 100644 index 000000000..72aed3121 --- /dev/null +++ b/docs/functions/listcontains.md @@ -0,0 +1,32 @@ +# listContains + +Determines the index of the first list element that contains a + specified substring. + Returns the index of the first list element that contains + substring. If not found, returns zero. The search for the substring is case-sensitive. + +```javascript +listContains(list, substring [, delimiters]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| substring | string | Yes | | | +| delimiters | string | No | , | | + +## Simple Example + +Return the first instance of an item containing 'oo' + +```javascript +listContains("sheep,goat,foo,bar,goo", "oo") +``` + +### Expected Result: 3 diff --git a/docs/functions/listcontainsnocase.md b/docs/functions/listcontainsnocase.md new file mode 100644 index 000000000..0937e9c26 --- /dev/null +++ b/docs/functions/listcontainsnocase.md @@ -0,0 +1,30 @@ +# listContainsNoCase + + Determines the index of the first list element that contains a + specified substring. + +```javascript +listContainsNoCase(list, substring [, delimiters]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| substring | string | Yes | | | +| delimiters | string | No | , | | + +## Simple Example + +Return the first instance position of 'foo', irrespective of case + +```javascript +listContainsNoCase("sheep,goat,Foo,bar,foo", "foo") +``` + +### Expected Result: 3 diff --git a/docs/functions/listdeleteat.md b/docs/functions/listdeleteat.md new file mode 100644 index 000000000..2d3f2c92e --- /dev/null +++ b/docs/functions/listdeleteat.md @@ -0,0 +1,40 @@ +# listDeleteAt + +Deletes an element from a list. + Returns a copy of the list, without the specified element. + +```javascript +listDeleteAt(list, position [, delimiters]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| position | numeric | Yes | | | +| delimiters | string | No | , | | + +## Simple Example + +Deletes 2nd item from the list + +```javascript +listDeleteAt("foo,bar,lorem,ipsum", 2) +``` + +### Expected Result: foo,lorem,ipsum + +## Example with Custom Delimiter + +Deletes 2nd item from the list using a custom delimiter + +```javascript +listDeleteAt("foo,bar|lorem,ipsum|me|something", 2, "|") +``` + +### Expected Result: foo,bar|me|something diff --git a/docs/functions/listeach.md b/docs/functions/listeach.md new file mode 100644 index 000000000..8ba35864b --- /dev/null +++ b/docs/functions/listeach.md @@ -0,0 +1,76 @@ +# listEach + +Iterates over every element of a List object and can call a UDF function, passed as the second argument. + +```javascript +listEach(String str, UDFMethod function [, String delim, boolean includeEmptyFields]); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| str | string | Yes | | An input list object. | +| function | function | Yes | | UDF or closure object. | +| delim | string | Yes | | A list delimiter to be used. The default value is comma (,). | +| includeEmptyFields | boolean | No | false | Boolean. Whether to allow empty fields. Default is false. | + +## List Loop using listEach + +Using a semicolon delimiter. + +```javascript +list = "a;b;c"; +listEach(list, function(element,index,list) { + writeOutput("#index#:#element#;"); +}, ";"); +``` + +### Expected Result: 1:a;2:b;3:c; + +## Member Function Example + +List Loop list.listEach() + +```javascript +list = "a;b;c"; +list.listEach(function(element,index,list) { + writeOutput("#index#:#element#;"); +}, ";"); +``` + +### Expected Result: 1:a;2:b;3:c; + +## Example using a Closure + +Example 1 + +```javascript +empArray = ["john", "pete", "bob"]; + listS = "'john', 'pete', 'bob'"; + arrayEach(empArray, xclosure); + listEach(listS, xclosure); + function xclosure(empname, index) { + writeOutput(empName & " at index: " & index); + } +``` + +### Expected Result: john at index: 1pete at index: 2bob at index: 3'john' at index: 1 'pete' at index: 2 'bob' at index: 3 + +## Another Closure Example + +Example 2 + +```javascript +cityList = "Pittsburgh, Raleigh, Miami, Las Vegas"; + function printCity(String city) { + writeOutput("Current city: " & city); + } + listEach(cityList ,printCity); +``` + +### Expected Result: Current city: PittsburghCurrent city: RaleighCurrent city: MiamiCurrent city: Las Vegas diff --git a/docs/functions/listevery.md b/docs/functions/listevery.md new file mode 100644 index 000000000..9367a079f --- /dev/null +++ b/docs/functions/listevery.md @@ -0,0 +1,51 @@ +# listEvery + +This function calls a given callback function for every element in a given string list and returns true, if all of the calls returns true. + +```javascript +listEvery(list, closure [, delimiter] [, includeEmptyFields] [, multiCharacterDelimiter] [, parallel] [, maxThreads]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +list.listEvery(closure [, delimiter] [, includeEmptyFields] [, multiCharacterDelimiter] [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | List to iterate. | +| closure | function | Yes | | Callback function that is called for every item of the list and returns a boolean value. The arguments passed to the callback are

value: Current list item
index: Index of the list item within the list
list: List as defined in the 'list' parameter
delimiter: Delimiter as defined in the 'delimiter' parameter | +| delimiter | string | No | , | Delimiter used to separate the string list. | +| includeEmptyFields | boolean | No | false | Specifies whether to include empty fields or not. | +| multiCharacterDelimiter | boolean | No | true | Specifies whether the 'delimiter' parameter specifies a multi-character delimiter. If it is set to `true`, all characters are considered as one delimiter; otherwise each character is a delimiter on its own. | +| parallel | boolean | No | false | Specifies whether to execute closures in parallel. | +| maxThreads | numeric | No | 20 | Maximum number of threads executed, ignored when argument 'parallel' is set to false. | + +## Example for positive result + +Checks whether all items in a list are greater than 2 and outputs true because all of them fulfill the requirement. + +```javascript +list = '4,5,6,7'; +writeOutput(listEvery(list, function(value) { return value gt 2; })); +``` + +### Expected Result: YES + +## Example for negative result + +Checks whether all items in a list are greater than 2 and outputs false because some of them do not fulfill the requirement. + +```javascript +list = '1,2,3,4'; +writeOutput(listEvery(list, function(value) { return value gt 2; })); +``` + +### Expected Result: NO diff --git a/docs/functions/listfilter.md b/docs/functions/listfilter.md new file mode 100644 index 000000000..d166e40c7 --- /dev/null +++ b/docs/functions/listfilter.md @@ -0,0 +1,54 @@ +# listFilter + +Used to filter an list to items for which the closure function returns true. + +```javascript +listFilter(list, function(listElement, [list]) ) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +someList.listFilter(function(listElement, [list]) ) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| function | function | Yes | | Inline closure function executed for each element in the list. Returns true if the list element should be included in the filtered list. Support for passing the original list to the closure function added in CF11 Update 5. | + +## Example using a simple numeric comparison + +Take list and use List Filter to return items that are 3 and higher. + +```javascript +numberList = '1,2,3,4,5,6'; + +threeOrMore = listFilter(numberList, function(item){ + return item >= 3; +}); +writedump(threeOrMore); +``` + +### Expected Result: A List with the values '3,4,5,6' + +## Example using a member function + +This is the same example as above, but using a member function on the list instead of a standalone function. + +```javascript +numberList = '1,2,3,4,5,6'; + +threeOrMore = numberList.listFilter(function(item){ + return item >= 3; +}); +writedump(threeOrMore); +``` + +### Expected Result: A List with the values '3,4,5,6' diff --git a/docs/functions/listfind.md b/docs/functions/listfind.md new file mode 100644 index 000000000..2e20fd7c9 --- /dev/null +++ b/docs/functions/listfind.md @@ -0,0 +1,57 @@ +# listFind + +Determines the index of the first list element in which a specified value occurs. Returns 0 if not found. Case-sensitive + +```javascript +listFind(list, value [, delimiters, includeEmptyValues]) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +list.listFind(value [, delimiters, includeEmptyValues]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| list | string | Yes | | | | +| value | string | Yes | | | | +| delimiters | string | No | , | | | +| includeEmptyValues | string | No | false | | /Users/garethedwards/development/github/cfdocs/docs/functions/listfind.md|false | + +## Basic Example + +Find item in a list and return the index. + +```javascript +listFind("apple,orange,banana", "orange") +``` + +### Expected Result: 2 + +## Different Delimiters + +Find item in a pipe delimited list and return the index. + +```javascript +listFind("apple|orange|banana", "orange", "|") +``` + +### Expected Result: 2 + +## Member Syntax + +listFind as a member function + +```javascript +fruits = "apple|orange|banana"; +writeOutput(fruits.listFind("orange", "|")); +``` + +### Expected Result: 2 diff --git a/docs/functions/listfindnocase.md b/docs/functions/listfindnocase.md new file mode 100644 index 000000000..d17f5d777 --- /dev/null +++ b/docs/functions/listfindnocase.md @@ -0,0 +1,57 @@ +# listFindNoCase + +Determines the index of the first list element in which a specified value occurs. Returns 0 if not found. Case-insensitive. + +```javascript +listFindNoCase(list, value [, delimiters, includeEmptyValues]) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +list.listFindNoCase(value [, delimiters, includeEmptyValues]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| list | string | Yes | | | | +| value | string | Yes | | | | +| delimiters | string | No | , | | | +| includeEmptyValues | string | No | false | | /Users/garethedwards/development/github/cfdocs/docs/functions/listfindnocase.md|false | + +## Basic Example + +Find item in a list and return the index. + +```javascript +listFindNoCase("apple,orange,banana", "orange") +``` + +### Expected Result: 2 + +## Different Delimiters + +Find item in a pipe delimited list and return the index. + +```javascript +listFindNoCase("apple|orange|banana", "orange", "|") +``` + +### Expected Result: 2 + +## Member Syntax + +listFindNoCase as a member function + +```javascript +fruits = "apple|orange|banana"; +writeOutput(fruits.listFindNoCase("ORANGE", "|")); +``` + +### Expected Result: 2 diff --git a/docs/functions/listfirst.md b/docs/functions/listfirst.md new file mode 100644 index 000000000..f6f316f5b --- /dev/null +++ b/docs/functions/listfirst.md @@ -0,0 +1,38 @@ +# listFirst + + Gets the first element of a list. + +```javascript +listFirst(list [, delimiters]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| delimiters | string | No | , | | + +## Simple listFirst Example + +A very basic listFirst example + +```javascript +listFirst("one,two,three,four"); +``` + +### Expected Result: one + +## Traversing a List with listFirst and listRest + +Nesting list functions lets you move through the list in pieces. + +```javascript +listFirst(listRest(listRest("one,two,three,four"))); +``` + +### Expected Result: three diff --git a/docs/functions/listgetat.md b/docs/functions/listgetat.md new file mode 100644 index 000000000..5189fa156 --- /dev/null +++ b/docs/functions/listgetat.md @@ -0,0 +1,50 @@ +# listGetAt + +Gets a list element at a specified position. + +```javascript +listGetAt(list, position [, delimiters [, includeEmptyValues]]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| position | numeric | Yes | | | +| delimiter | string | No | , | | +| includeEmptyValues | boolean | No | false | | + +## Simple Example + +Returns the 2nd element in the list + +```javascript +listGetAt("foo,bar,lorem,ipsum", 2) +``` + +### Expected Result: bar + +## Example with Delimiter + +Returns the 3rd element in the list using a custom delimiter + +```javascript +listGetAt("foo,bar|lorem,ipsum|me|something", 3, "|") +``` + +### Expected Result: me + +## Example with IncludeEmptyValues + +Returns the 4th element in the list, treating the empty element as a value + +```javascript +listGetAt("foo,bar,,lorem,ipsum", 4, ",", true) +``` + +### Expected Result: lorem diff --git a/docs/functions/listindexexists.md b/docs/functions/listindexexists.md new file mode 100644 index 000000000..a5395dc66 --- /dev/null +++ b/docs/functions/listindexexists.md @@ -0,0 +1,40 @@ +# listIndexExists + +Determines whether that index exists in the given list or not + +```javascript +listIndexExists(list, index [, delimiter] [, includeEmptyFields]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +list.listIndexExists(index [, delimiter] [, includeEmptyFields]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| index | numeric | Yes | | | +| delimiter | string | No | , | | +| includeEmptyFields | boolean | No | | | + +## Simple listIndexExists + +Check whether the index is exists or not in list + +```javascript + + + + +#list# +``` + +### Expected Result: Apple,Goa,Banana,Graphs diff --git a/docs/functions/listinsertat.md b/docs/functions/listinsertat.md new file mode 100644 index 000000000..1f1d523ab --- /dev/null +++ b/docs/functions/listinsertat.md @@ -0,0 +1,40 @@ +# listInsertAt + +Inserts an element in a list. + +```javascript +listInsertAt(list, position, value [, delimiters]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| position | numeric | Yes | | | +| value | string | Yes | | | +| delimiters | string | No | , | | + +## Simple Example + +Inserts 'foo' into the list at position 2 + +```javascript +listInsertAt("bar,lorem,ipsum", 2, "foo") +``` + +### Expected Result: bar,foo,lorem,ipsum + +## Example with Custom Delimiter + +Inserts 'foo' into the list with a custom delimiter + +```javascript +listInsertAt("bar|lorem,ipsum|me|something", 2, "foo", "|") +``` + +### Expected Result: bar|foo|lorem,ipsum|me|something diff --git a/docs/functions/listitemtrim.md b/docs/functions/listitemtrim.md new file mode 100644 index 000000000..e5e719a39 --- /dev/null +++ b/docs/functions/listitemtrim.md @@ -0,0 +1,59 @@ +# listItemTrim + +Trims every item in the list and returns a new list. + +```javascript +listItemTrim(list [, delimiters] [, includeEmptyFields]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +list.listItemTrim([delimiters] [, includeEmptyFields]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | The list with the items, you want to trim. | +| delimiters | string | No | , | The delimiters which the list is using. | +| includeEmptyFields | boolean | No | false | By default empty items will be removed from the list. If it is true, empty items will be stay in the list. | + +## Simple Example + +Trims each item in the list. + +```javascript +exampleList = "hello, world ,this, is a, ,example"; +writeOutput(listItemTrim(examplelist)); +``` + +### Expected Result: hello,world,this,is a,,example + +## Using as member function + +Trims each item in the list. + +```javascript +exampleList = "hello, world ,this, is a, ,example"; +exampleList = exampleList.listItemTrim(); +writeOutput(examplelist); +``` + +### Expected Result: hello,world,this,is a,,example + +## Keep empty items in the list + +Trims each item in the list and keep empty items. + +```javascript +exampleList = "hello, world ,this, is a, ,,example"; +writeOutput(listItemTrim(examplelist, ",", true)); +``` + +### Expected Result: hello,world,this,is a,,,example diff --git a/docs/functions/listlast.md b/docs/functions/listlast.md new file mode 100644 index 000000000..934f67c9f --- /dev/null +++ b/docs/functions/listlast.md @@ -0,0 +1,39 @@ +# listLast + +Gets the last element of a list. + +```javascript +listLast(list [, delimiters, includeEmptyValues ]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| list | string | Yes | | A list or a variable that contains a list. | | +| delimiters | string | No | , | A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter; you cannot specify a multicharacter delimiter. | | +| includeEmptyValues | boolean | No | | Set to true to include empty values. | /Users/garethedwards/development/github/cfdocs/docs/functions/listlast.md|false | + +## Simple listLast Example + +A very basic listLast example + +```javascript +listLast("one,two,three,four"); +``` + +### Expected Result: four + +## listLast Example with multiple delimiters + +A more advanced listLast example + +```javascript +listLast("one/two\three/four", "\/"); +``` + +### Expected Result: four diff --git a/docs/functions/listlen.md b/docs/functions/listlen.md new file mode 100644 index 000000000..6f1c290a8 --- /dev/null +++ b/docs/functions/listlen.md @@ -0,0 +1,49 @@ +# listLen + + Determines the number of elements in a list. + +```javascript +listLen(list [, delimiters, [includeEmptyValues]]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | A list or a variable that contains one | +| delimiters | string | No | , | A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter. | +| includeEmptyValues | string | No | NO | CF10+ If includeEmptyValues is set to true, all empty values in the list will be considered when computing length. If set to false, the empty list elements are ignored. | + +## Simple listLen Example + +Get the number of elements in this list + +```javascript +listLen("foo,bar,bar2,foo2") +``` + +### Expected Result: 4 + +## listLen Example with Delimiter + +Get the number of elements in this list using a custom delimiter + +```javascript +listLen("foo,bar|bar2|foo2", "|") +``` + +### Expected Result: 3 + +## listLen Example with IncludeEmptyValues + +Get the number of elements in this list, including empty values + +```javascript +listLen("foo,bar,,foo2", ",", "YES") +``` + +### Expected Result: 4 diff --git a/docs/functions/listmap.md b/docs/functions/listmap.md new file mode 100644 index 000000000..520ea5b8f --- /dev/null +++ b/docs/functions/listmap.md @@ -0,0 +1,41 @@ +# listMap + +Iterates over every entry of the List and calls the closure function to work on the item of the list. The returned value will be set at the same index in a new list and the new list will be returned. + +```javascript + listMap(list, function(item [,index, list]) [,delimiter, includeEmptyFields) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | The input list. | +| function | any | Yes | | Closure or a function reference that will be called for each of the iteration. The arguments passed to the callback are

item: value
index : current index for the iteration
list : reference of the original list | +| intialValue | any | No | | Initial value which will be used for the reduce operation. | +| delimiter | string | No | , | The list delimiter. | +| includeEmptyFields | boolean | No | false | Include empty values | + +### function ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| item | string | No | value +| index | numeric | No | current index for the iteration +| list | string | No | reference of the original list + +## Script Syntax + +```javascript +Rainbow = "Whero, Karaka, Kowhai, Kakariki, Kikorangi, Tawatawa, Mawhero"; +externalList = ""; +reverseRainbow = listMap( rainbow, function(v,i,l) { + var newValue = "#i#:#v.reverse()#"; + externalList = externalList.listAppend(newValue); + return newValue; +}); +writeDump([{rainbow=rainbow},{reverseRainbow=reverseRainbow},{externalList=externalList}]); +``` diff --git a/docs/functions/listprepend.md b/docs/functions/listprepend.md new file mode 100644 index 000000000..fc2476be1 --- /dev/null +++ b/docs/functions/listprepend.md @@ -0,0 +1,72 @@ +# listPrepend + + Inserts an element at the beginning of a list. + +```javascript +listPrepend(someList, value [, delimiters, includeEmptyFields]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +someList.listPrepend( value [, delimiters, includeEmptyFields]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| list | string | Yes | | A string list. | | +| value | string | Yes | | An element or list of elements. | | +| delimiters | string | No | , | Characters that separate list elements. | | +| includeEmptyFields | boolean | No | false | CF2018+ Set to true to insert blank values to the beginning of the list. | /Users/garethedwards/development/github/cfdocs/docs/functions/listprepend.md|false | + +## Prepend to a List using the List member function + +CF11+ Lucee4.5+ + +```javascript +seinfeldList = "Close Talker,Soup Nazi"; +seinfeldList = seinfeldList.listPrepend("Puffy Shirt"); +writeOutput(seinfeldList); +``` + +### Expected Result: "Puffy Shirt,Close Talker,Soup Nazi" + +## Prepend to a List using a dash delimiter + +```javascript +someList = "1-2-3-4"; +someList = listPrepend(someList,"0","-"); +writeOutput(someList); +``` + +### Expected Result: "0-1-2-3-4" + +## Prepend to a List with Empty Fields On + +CF2018+ + +```javascript +someList = "Feb,Mar,Apr"; +someList = listPrepend(someList, ",,Jan", ",", true); +writeOutput(someList); +``` + +### Expected Result: ",,Jan,Feb,Mar,Apr" + +## Prepend to a List with Empty Fields Off + +CF2018+ + +```javascript +someList = "Feb,Mar,Apr"; +someList = listPrepend(someList, ",,Jan,,", ",", false); +writeOutput(someList); +``` + +### Expected Result: "Jan,Feb,Mar,Apr" diff --git a/docs/functions/listqualify.md b/docs/functions/listqualify.md new file mode 100644 index 000000000..9c051ab76 --- /dev/null +++ b/docs/functions/listqualify.md @@ -0,0 +1,54 @@ +# listQualify + +Inserts a string at the beginning and end of list elements. + +```javascript +listQualify(list, qualifier [, delimiters] [, elements] [, includeEmptyValues]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | A list or variable name | +| qualifier | string | Yes | | A string or character in which to insert before and after the list elements | +| delimiters | string | No | , | Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion uses the first character as the delimiter and ignores the remaining characters. | +| elements | string | No | all | all -all elements; char -elements that are composed of alphabetic characters | +| includeEmptyFields | boolean | No | | If includeEmptyFields is true, empty value add in list elements | + +## Simple example for listQualify function with delimiter + +To insert a string or character before and after the list elements. + +```javascript +list = "coldfusion:railo:144:lucee:46"; +writeOutput(listQualify(list, "|", ":")); +``` + +### Expected Result: |coldfusion|:|railo|:|144|:|lucee|:|46| + +## Example for listQualify function with elements + +To insert a string or character before and after the alphabet list elements only. + +```javascript +list = "coldfusion:railo:144:lucee:46"; +writeOutput(listQualify(list, "|", ":","CHAR")); +``` + +### Expected Result: |coldfusion|:|railo|:144:|lucee|:46 + +## Example for listQualify function with includeEmptyFields + +If includeEmptyFields is true, empty value add in list elements. + +```javascript +list = "coldfusion:railo:144::lucee::46"; +writeOutput(listQualify(list, "|", ":","CHAR",true)); +``` + +### Expected Result: |coldfusion|:|railo|:144:||:|lucee|:||:46 diff --git a/docs/functions/listreduce.md b/docs/functions/listreduce.md new file mode 100644 index 000000000..dc9091aee --- /dev/null +++ b/docs/functions/listreduce.md @@ -0,0 +1,32 @@ +# listReduce + +Iterates over each item of the list and calls the closure to work on the item. This function will reduce the list to a single value and will return the value. + +```javascript + listReduce(list, function(result, item [,index, list]) [,initialValue, delimiter, includeEmptyFields]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | Input list | +| function | any | Yes | | Closure or a function reference that will be called for each of the iteration. The arguments passed to the callback are

item: value
index : current index for the iteration
list : reference of the original list | +| intialValue | any | No | | Initial value which will be used for the reduce operation. The type is any. | +| delimiter | string | No | comma | The list delimiter. | +| includeEmptyFields | boolean | No | false | Include empty values. | + +## Script Syntax + +```javascript +numbers = "1,2,3,4,5,6,7,8,9,10"; + sum = listReduce(numbers, function(previousValue, value) + { + return previousValue + value; + }, 0); + writeOutput("The sum of the digits #numbers# is #sum#
"); +``` diff --git a/docs/functions/listreduceright.md b/docs/functions/listreduceright.md new file mode 100644 index 000000000..62a29bd4e --- /dev/null +++ b/docs/functions/listreduceright.md @@ -0,0 +1,73 @@ +# listReduceRight + +This function iterates over every element of the list and calls the closure to work on that element. This function will reduce the list to a single value, from the right to the left, and will return the value. +NOTE: Use caution if using the member function. `list.reduceRight` and `list.listReduceRight` may behave differently. +NOTE:This function is not available in Lucee 5.x or lower. Potentially use `reverse()` instead. + +```javascript +listReduceRight(list, callback, initialValue[, delimiter][, includeEmptyFields]) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +list.listReduceRight(callback, initialValue[, delimiter][, includeEmptyFields]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | The input list. | +| callback | any | Yes | | Closure or a function reference that will be called for each iteration. | +| initialValue | any | Yes | | Initial value which will be used for the reduce operation. | +| delimiter | string | No | , | The list delimiter | +| includeEmptyFields | boolean | No | false | Include empty values? | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| result | any | No | The result of the reduce operation after the previous iteration. +| item | any | No | The value for the current iteration's item. +| index | numeric | No | The current index for the iteration. +| list | string | No | A reference of the original list. + +## Simple listReduceRight Example + +Demonstrate how the function works from right to left. + +```javascript +myList="a,b,c,d"; +newList=listReduceRight(myList,function(prev,next,idx,arr){ return prev & next & idx },""); +writedump(newList); +``` + +### Expected Result: d4c3b2a1 + +## listReduceRight as a Member Function + +Demonstrate the member function. + +```javascript +myList="a,b,c,d"; +newList=myList.listReduceRight(function(prev,next,idx,arr){ return prev & next & idx },""); +writedump(newList); +``` + +### Expected Result: d4c3b2a1 + +## Empty Elements + +Demonstrate the behavior when there is an empty element. + +```javascript +myList="a,,,,,b,,,c,,,d"; +newList=myList.listReduceRight(function(prev,next,idx){ return prev & next & idx },""); +writedump(newList); +``` + +### Expected Result: d4c3b2a1 diff --git a/docs/functions/listremoveduplicates.md b/docs/functions/listremoveduplicates.md new file mode 100644 index 000000000..eda5dc8c7 --- /dev/null +++ b/docs/functions/listremoveduplicates.md @@ -0,0 +1,39 @@ +# listRemoveDuplicates + +Removes duplicate values (if they exist) in a list. + +```javascript +listRemoveDuplicates(list[, delimiter] [, ignoreCase]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | Required. List of objects. | +| delimiter | string | No | , | Optional. Character(s) that separate list elements. The default value is comma. | +| ignoreCase | boolean | No | NO | Optional. If true, ignores the case of strings in the list. By default the value is set to false. | + +## Basic usage (case-sensitive) + +Basic usage. Optional arguments left as defaults. + +```javascript +listRemoveDuplicates("one,two,three,four,five,one,five,three") +``` + +### Expected Result: one,two,three,four,five + +## Optional arguments usage (ignore case = true) + +Optional arguments being set. Ignore case set to true + +```javascript +listRemoveDuplicates("one,two,three,four,five,ONE,TWO,THREE", ",", true) +``` + +### Expected Result: one,two,three,four,five diff --git a/docs/functions/listrest.md b/docs/functions/listrest.md new file mode 100644 index 000000000..475e255cb --- /dev/null +++ b/docs/functions/listrest.md @@ -0,0 +1,48 @@ +# listRest + +Gets a list, without its first element. + +```javascript +listRest(list [, delimiters]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| delimiters | string | No | , | | + +## Simple listRest Example + +A very basic listRest example + +```javascript +listRest("one,two,three,four"); +``` + +### Expected Result: two,three,four + +## Combining listRest to Shorten the List + +Nesting listRest shortens the list by one each time with the first element removed. + +```javascript +listRest(listRest("one,two,three,four")); +``` + +### Expected Result: three,four + +## Traversing a List with listRest and listFirst + +Nesting list functions lets you move through the list in pieces. + +```javascript +listFirst(listRest(listRest("one,two,three,four"))); +``` + +### Expected Result: three diff --git a/docs/functions/listsetat.md b/docs/functions/listsetat.md new file mode 100644 index 000000000..e650b6b43 --- /dev/null +++ b/docs/functions/listsetat.md @@ -0,0 +1,40 @@ +# listSetAt + + Replaces the contents of a list element. + +```javascript +listSetAt(list, position, value [, delimiters]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| position | numeric | Yes | | | +| value | string | Yes | | | +| delimiters | string | No | , | | + +## Simple Example + +Replaces the 2nd list element with 'foo' + +```javascript +listSetAt("bar,lorem,ipsum", 2, "foo") +``` + +### Expected Result: bar,foo,ipsum + +## Example with Custom Delimiter + +Inserts 'foo' into the list with a custom delimiter + +```javascript +listSetAt("bar|lorem,ipsum|me|something", 2, "foo", "|") +``` + +### Expected Result: bar|foo|me|something diff --git a/docs/functions/listsome.md b/docs/functions/listsome.md new file mode 100644 index 000000000..ecc5ae8d4 --- /dev/null +++ b/docs/functions/listsome.md @@ -0,0 +1,50 @@ +# listSome + +This function calls a given closure/function with every element in a given string list and returns true, if one of the closure calls returns true. + +```javascript +listSome(list, closure [, delimiter] [, includeEmptyFields] [, multiCharacterDelimiter] [, parallel] [, maxThreads]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +list.listSome(closure [, delimiter] [, includeEmptyFields] [, multiCharacterDelimiter] [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | string list to iterate

Alias: string | +| closure | function | Yes | | function/closure that implements the following constructor [function(any value, numeric index,string list, string delimiter):boolean].

Alias: function, callback, udf | +| delimiter | string | No | , | delimiter used to separate the string list | +| includeEmptyFields | boolean | No | false | include empty fields or not | +| multiCharacterDelimiter | boolean | No | true | specifying whether the delimiters parameter specifies a multi-character delimiter. If this parameter is true, the delimiters parameter must specify a single delimiter consisting of multiple characters. This parameter enables the ListToArray function to convert a list to an array of color names | +| parallel | boolean | No | false | execute closures parallel | +| maxThreads | numeric | No | 20 | maximum number of threads executed, ignored when argument "parallel" is set to false | + +### closure ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| value | any | No | current value from the list +| index | numeric | No | position in the list +| list | string | No | string list to iterate +| delimiter | string | No | delimiter used to separate the string list + +## List contains some. + +Take a string list and see if some elements match a given predicate. + +```javascript +var fruitList = arrayToList(["apple", "mango", "orange", "pear"], ","); +writeOutput(listSome(fruitList, function(fruit) { + return findNoCase("n", fruit); +}, ",")); +``` + +### Expected Result: true diff --git a/docs/functions/listsort.md b/docs/functions/listsort.md new file mode 100644 index 000000000..7ba021de2 --- /dev/null +++ b/docs/functions/listsort.md @@ -0,0 +1,75 @@ +# listSort + +Sorts list elements according to a sort type and sort order. Returns a sorted copy of the list. + [sortType - description] + numeric: sorts numbers + text: sorts text alphabetically, taking case into account + - aabzABZ, if sort_order = "asc" + - ZBAzbaa, if sort_order = "desc" + textnocase: sorts text alphabetically, without regard to case + - aAaBbBzzZ, in an asc sort; + - ZzzBbBaAa, in a desc sort; + +```javascript +listSort(list, sortType [, sortOrder] [, delimiters] [, includeEmptyFields] [, localeSensitive]) +or +listSort(list, callback) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +list.listSort(sortType [, sortOrder]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | A list or variable name | +| sortType | string | Yes | | numeric: sorts numbers
text: sorts text alphabetically, taking case into account
(also known as case-sensitive).
- aabzABZ for ascending sort(sort_order = "asc")
- ZBAzbaa for descending sort(sort_order = "desc")

textnocase: sorts text alphabetically, without regard to
case (also known as case-insensitive).
- aAaBbBzzZ for ascending sort(sort_order = "asc")
- ZzzBbBaAa for descending sort(sort_order = "desc") | +| sortOrder | string | No | asc | - asc: ascending sort order
- desc: descending sort order | +| delimiters | string | No | , | Characters that separate the list elements. The default value is comma. If this parameter contains more than one character, ColdFusion uses the first character in the string as the delimiter in the output list. | +| includeEmptyFields | boolean | No | false | Set to true to include empty fields. | +| callback | function | No | | CF2016+ A function that uses two elements of a list. `function(element1, element2)`. Returns whether the first is less than (-1), equal to (0) or greater than (1) the second one (like the compare functions). | +| localeSensitive | boolean | No | false | CF10+ Specify if you wish to do a locale sensitive sorting. | + +## Simple example for listSort function + +Uses the listSort() function to get the list which sorted by type text(case-sensitive) + +```javascript +list = "COLDFUSION,coldfusion,adobe,LucEE,RAILO"; +sortList = listSort(list, "Text", "desc"); +writeOutput(sortList); +``` + +### Expected Result: coldfusion,adobe,RAILO,LucEE,COLDFUSION + +## Example for listSort function with delimiters + +Uses the listSort() function with delimiters to get the list which sorted by type numeric + +```javascript +list = "10;20;-99;46;50"; +sortList = listSort(list, "Numeric", "asc", ";"); +writeOutput(sortList); +``` + +### Expected Result: -99;10;20;46;50 + +## Simple Example for listSort function using sortType(textnocase) + +Uses the listSort() function with delimiters to get the list which sorted by type textnocase(case-insensitive) + +```javascript +list = "10|RED|yeLLow|-246|green|ORange"; +sortList = listSort(list, "TextNoCase", "asc", "|"); +writeOutput(sortList); +``` + +### Expected Result: -246|10|green|ORange|RED|yeLLow diff --git a/docs/functions/listtoarray.md b/docs/functions/listtoarray.md new file mode 100644 index 000000000..e7e2400b3 --- /dev/null +++ b/docs/functions/listtoarray.md @@ -0,0 +1,78 @@ +# listToArray + + Copies the elements of a list to an array. + +```javascript +listToArray(list [, delimiters] [, includeEmptyFields] [, multiCharacterDelimiter]) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +str.listToArray([delimiters] [, includeEmptyFields] [, multiCharacterDelimiter]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | A list or variable name | +| delimiters | string | No | , | | +| includeEmptyFields | boolean | No | false | A Boolean value specifying whether to create empty array entries if there are two delimiters in a row. | +| multiCharacterDelimiter | boolean | No | false | A Boolean value specifying whether the delimiters parameter specifies a multi-character delimiter. | + +## Simple example for listToArray function + +Uses the listToArray() function to retrieve a list as an array + +```javascript +list = "red,green,orange"; +getArray = listToArray(list); +someJSON = serializeJSON(getArray); +writeOutput(someJSON); +``` + +### Expected Result: ["red", "green", "orange"] + +## Example for listToArray function with delimiter + +Uses the listToArray() function with a semicolon delimiter to retrieve a list as an array + +```javascript +list = "coldfusion;php;java;sql"; +getArray = listToArray(list,";"); +someJSON = serializeJSON(getArray); +writeOutput(someJSON); +``` + +### Expected Result: ["coldfusion", "php", "java", "sql"] + +## Example for listToArray function with includeEmptyFields + +If includeEmptyFields is true, empty value add in array elements + +```javascript +list = "coldfusion;php;;java;sql"; +getArray = listToArray(list,";",true); +someJSON = serializeJSON(getArray); +writeOutput(someJSON); +``` + +### Expected Result: ["coldfusion", "php", " " , "java", "sql"] + +## Example for listToArray function with multiCharacterDelimiter + +Uses the listToArray() function to retrieve a list as an array with multiCharacterDelimiter + +```javascript +list = "coldfusion,php,|test,java,|sql"; +getArray = listToArray(list,",|",false,true); +someJSON = serializeJSON(getArray); +writeOutput(someJSON); +``` + +### Expected Result: ["coldfusion,php", "test,java", "sql"] diff --git a/docs/functions/listtrim.md b/docs/functions/listtrim.md new file mode 100644 index 000000000..66d91e21d --- /dev/null +++ b/docs/functions/listtrim.md @@ -0,0 +1,18 @@ +# listTrim + +trims leading and trailing spaces from each list element + +```javascript +listTrim(list [, delimiters]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | a string list | +| delimiters | string | No | , | characters that separate list elements | diff --git a/docs/functions/listvaluecount.md b/docs/functions/listvaluecount.md new file mode 100644 index 000000000..34f329b52 --- /dev/null +++ b/docs/functions/listvaluecount.md @@ -0,0 +1,40 @@ +# listValueCount + +Counts instances of a specified value in a list. +The search is case-sensitive. For case-insensitive search use listValueCountNoCase. + +```javascript +listValueCount(list, value [, delimiters]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| value | string | Yes | | | +| delimiters | string | No | , | | + +## Simple Example + +Counts instances of 'foo' in the list + +```javascript +listValueCount("foo,bar,lorem,foo,ipsum", "foo") +``` + +### Expected Result: 2 + +## Example with Custom Delimiter + +Counts instances of 'foo' in the list with a custom delimiter + +```javascript +listValueCount("bar|foo|lorem,ipsum|me|foo,something|foo|FOO", "foo", "|") +``` + +### Expected Result: 2 diff --git a/docs/functions/listvaluecountnocase.md b/docs/functions/listvaluecountnocase.md new file mode 100644 index 000000000..7a2899cff --- /dev/null +++ b/docs/functions/listvaluecountnocase.md @@ -0,0 +1,40 @@ +# listValueCountNoCase + +Counts instances of a specified value in a list. +The search is case-insensitive. For case-sensitive search use listValueCount. + +```javascript +listValueCountNoCase(list, value [, delimiters]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| list | string | Yes | | | +| value | string | Yes | | | +| delimiters | string | No | , | | + +## Simple Example + +Counts instances of 'foo' in the list, ignoring case + +```javascript +listValueCountNoCase("foo,bar,lorem,Foo,ipsum", "foo") +``` + +### Expected Result: 2 + +## Example with Custom Delimiter + +Counts instances of 'foo' in the list with a custom delimiter, ignoring case + +```javascript +listValueCountNoCase("bar|Foo|lorem,ipsum|me|foo,something|foo|FOO", "foo", "|") +``` + +### Expected Result: 3 diff --git a/docs/functions/ljustify.md b/docs/functions/ljustify.md new file mode 100644 index 000000000..440485e68 --- /dev/null +++ b/docs/functions/ljustify.md @@ -0,0 +1,28 @@ +# lJustify + + Left justifies characters in a string of a specified length. + +```javascript +lJustify(String, length) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| length | numeric | Yes | | | + +## Tag Example + +```javascript + + + +
~#result#~
+
+``` diff --git a/docs/functions/location.md b/docs/functions/location.md new file mode 100644 index 000000000..16a2b213e --- /dev/null +++ b/docs/functions/location.md @@ -0,0 +1,29 @@ +# location + +Stops execution of the current page and redirects to the given URL. + +```javascript +location(url [, addtoken] [, statuscode]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| url | string | Yes | | URL of web page to open. | | +| addtoken | boolean | No | YES | clientManagement must be enabled (see cfapplication). | | +| statuscode | numeric | No | 302 | The HTTP status code | /Users/garethedwards/development/github/cfdocs/docs/functions/location.md|307 | + +## Simple Example + +Relocates to a different page if user is not logged in. + +```javascript +if (!structKeyExists(session, "userID") { + location("login.cfm"); +} +``` diff --git a/docs/functions/log.md b/docs/functions/log.md new file mode 100644 index 000000000..282475553 --- /dev/null +++ b/docs/functions/log.md @@ -0,0 +1,28 @@ +# log + + Calculates the natural logarithm of a number. Natural + logarithms are based on the constant e (2.71828182845904). + +```javascript +log(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## logarithm of 3.1 + +There will be a precision difference between running the some code on Linux or Windows + +```javascript +log(3.1) +``` + +### Expected Result: 1.131402111491 diff --git a/docs/functions/log10.md b/docs/functions/log10.md new file mode 100644 index 000000000..0c27e85e3 --- /dev/null +++ b/docs/functions/log10.md @@ -0,0 +1,25 @@ +# log10 + + Calculates the logarithm of number, to base 10. + +```javascript +log10(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## logarithm 3.1 to base 10 + +```javascript +log10(3.1) +``` + +### Expected Result: 0.491361693834 diff --git a/docs/functions/lscurrencyformat.md b/docs/functions/lscurrencyformat.md new file mode 100644 index 000000000..22ed3513b --- /dev/null +++ b/docs/functions/lscurrencyformat.md @@ -0,0 +1,51 @@ +# lsCurrencyFormat + +Formats a number in a locale-specific currency format. For countries that use the euro, the result depends on the JVM. + [type - quicky] + local: the currency format and currency symbol used locally. + - With JDK 1.3, the default for Euro Zone: local currency. + - With JDK 1.4, the default for Euro Zone: euro. + international: the international standard currency format + none: the local currency format; no currency symbol + +```javascript +lsCurrencyFormat(number [, type, locale]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| number | numeric | Yes | | | | +| type | string | No | local | | /Users/garethedwards/development/github/cfdocs/docs/functions/lscurrencyformat.md|none | +| locale | string | No | | Geographic/language locale value, where the format is a combination of an ISO 639-1 code and an optional ISO 3166-1 code separated by a dash or an underscore. | /Users/garethedwards/development/github/cfdocs/docs/functions/lscurrencyformat.md|... | + +## Tag Example + +lsCurrencyFormat returns a currency value using the locale convention. Default value is local. + +```javascript + + + +

#locale# +Local: #lsCurrencyFormat(100000, "local")# +International: #lsCurrencyFormat(100000, "international")# +None: #lsCurrencyFormat(100000, "none")# +


+
+
+``` + +## Script Example using specific locale + +lsCurrencyFormat returns a currency value using the specified locale. + +```javascript +writeDump(lsCurrencyFormat(5, 'local', 'en_US')); +``` diff --git a/docs/functions/lsdateformat.md b/docs/functions/lsdateformat.md new file mode 100644 index 000000000..906d908a2 --- /dev/null +++ b/docs/functions/lsdateformat.md @@ -0,0 +1,53 @@ +# lsDateFormat + +Formats the date part of a date/time value in a locale-specific format. + [mask - quicky] + d,dd,ddd,dddd: Day of month / week + m,mm,mmm,mmmm: Month + y,yy,yyyy: Year + gg: Period/era string + short / medium / long / full + +```javascript +lsDateFormat(date [, mask, locale]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +date.lsDateFormat([mask, locale]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | The datetime object | +| mask | string | No | medium | A keyword or custom combination of components | +| locale | string | No | | CF8+ Locale to use instead of the locale of the page when processing the function | + +## Tag Example + +lsDateFormat formats the date part of a date/time value using the locale convention. + +```javascript + + + +

#locale# + #lsDateFormat(now(), "mmm-dd-yyyy")# + #lsDateFormat(now(), "mmmm d, yyyy")# + #lsDateFormat(now(), "mm/dd/yyyy")# + #lsDateFormat(now(), "d-mmm-yyyy")# + #lsDateFormat(now(), "ddd, mmmm dd, yyyy")# + #lsDateFormat(now(), "d/m/yy")# + #lsDateFormat(now())# +


+
+
+``` diff --git a/docs/functions/lsdatetimeformat.md b/docs/functions/lsdatetimeformat.md new file mode 100644 index 000000000..09a114868 --- /dev/null +++ b/docs/functions/lsdatetimeformat.md @@ -0,0 +1,26 @@ +# lsDateTimeFormat + + Formats date and time values using locale-specific date and time formatting conventions. + +```javascript +lsDateTimeFormat(date [, mask, locale, [timeZone]]); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | A date/time object, in the range 100 AD-9999 AD. | +| mask | string | No | | Mask that has to be used for formatting. | +| locale | string | No | | Locale to use instead of the locale of the page when processing the function. | +| timeZone | string | No | | The time-zone information. You can specify in either of the following formats. Abbreviation and Full Name. | + +## Mask = Short Example + +```javascript +lsDateTimeFormat("2015-04-11 19:02", "short") +``` diff --git a/docs/functions/lsdayofweek.md b/docs/functions/lsdayofweek.md new file mode 100644 index 000000000..4d8565707 --- /dev/null +++ b/docs/functions/lsdayofweek.md @@ -0,0 +1,25 @@ +# lsDayOfWeek + +Returns the day of the week using locale-specific date and time formatting conventions. + +```javascript +lsDayOfWeek(date [, locale] [, timezone]) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.lsDayOfWeek([locale] [, timezone]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | date object; for example, now() | +| locale | string | No | | Locale to use instead of the locale of the page when processing the function | +| timezone | string | No | | A datetime object is independent of a specific timezone; it is only an offset in milliseconds from 1970-1-1 00.00:00 UTC (Coordinated Universal Time).

The timezone only comes into play when you need specific information like hours in a day, minutes in a hour or which day it is as these calculations depend on the timezone.

A timezone must be specified in order to translate the date object to something else. If you do not provide the timezone in the function call, it will default to the timezone specified in the Lucee Administrator (Settings/Regional), or the timezone specified for the current request using the function setTimezone().

You can find a list of all available timezones in the Lucee administrator (Settings/Regional). Some examples of valid timezones include:

* AGT (for time in Argentina)
* Europe/Zurich (for time in Zurich/Switzerland)
* HST (Hawaiian Standard Time in the USA) | diff --git a/docs/functions/lseurocurrencyformat.md b/docs/functions/lseurocurrencyformat.md new file mode 100644 index 000000000..d93680c29 --- /dev/null +++ b/docs/functions/lseurocurrencyformat.md @@ -0,0 +1,49 @@ +# lsEuroCurrencyFormat + +Formats a number in a locale-specific currency format. + [type - quicky] + local: the currency format used in the locale. (Default.) + international: the international standard currency format + none: the currency format used; no currency symbol + +```javascript +lsEuroCurrencyFormat(currency [, type, locale]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| currency | string | Yes | | | | +| type | string | No | local | | /Users/garethedwards/development/github/cfdocs/docs/functions/lseurocurrencyformat.md|none | +| locale | string | No | | Geographic/language locale value, where the format is a combination of an ISO 639-1 code and an optional ISO 3166-1 code separated by a dash or an underscore. | /Users/garethedwards/development/github/cfdocs/docs/functions/lseurocurrencyformat.md|... | + +## Tag Example + +returns a currency value using the locale convention. Default value is local. + +```javascript + + + +

#locale# +Local: #lsEuroCurrencyFormat(100000, "local")# +International: #lsEuroCurrencyFormat(100000, "international")# +None: #lsEuroCurrencyFormat(100000, "none")# +


+
+
+``` + +## Script Example using specific locale + +lsEuroCurrencyFormat returns a currency value using the specified locale. + +```javascript +writeDump(lsEuroCurrencyFormat(5, 'local', 'de_DE')); +``` diff --git a/docs/functions/lsiscurrency.md b/docs/functions/lsiscurrency.md new file mode 100644 index 000000000..68daa0aef --- /dev/null +++ b/docs/functions/lsiscurrency.md @@ -0,0 +1,17 @@ +# lsIsCurrency + +Determines whether a string is a valid representation of a currency amount in the current locale. + +```javascript +lsIsCurrency(String) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | diff --git a/docs/functions/lsisdate.md b/docs/functions/lsisdate.md new file mode 100644 index 000000000..3ecfdd67a --- /dev/null +++ b/docs/functions/lsisdate.md @@ -0,0 +1,17 @@ +# lsIsDate + +Determines whether a string is a valid representation of a date/time value in the current locale. + +```javascript +lsIsDate(String) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | diff --git a/docs/functions/lsisnumeric.md b/docs/functions/lsisnumeric.md new file mode 100644 index 000000000..7121f4b2d --- /dev/null +++ b/docs/functions/lsisnumeric.md @@ -0,0 +1,38 @@ +# lsIsNumeric + + Determines whether a string is a valid representation of a + number in the current locale. + +```javascript +lsIsNumeric(String) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | + +## Simple Lsisnumeric Example + +Check whether the string is number or not in locale + +```javascript +lsIsNumeric('Ten') +``` + +### Expected Result: NO + +## Simple Lsisnumeric Example + +Check whether the string is number or not in locale + +```javascript +lsIsNumeric('4678') +``` + +### Expected Result: YES diff --git a/docs/functions/lsnumberformat.md b/docs/functions/lsnumberformat.md new file mode 100644 index 000000000..7fbfcf9f3 --- /dev/null +++ b/docs/functions/lsnumberformat.md @@ -0,0 +1,58 @@ +# lsNumberFormat + +Formats a number in a locale-specific format. +[mask - quicky] + _,9 Digit placeholder; . decimal point; 0 Pads with zeros; + ( ) less than zero, puts parentheses around the mask ++ plus sign before positive number minus before negative +- a space before positive minus sign before negative +, Separates every third decimal place with a comma. +L,C Left-justifies or center-justifies number +$ dollar sign before formatted number. +^ Separates left and right formatting. + +```javascript +lsNumberFormat(number [, mask, locale]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| number | numeric | Yes | | | | +| mask | string | No | _ | | | +| locale | string | No | | Geographic/language locale value, where the format is a combination of an ISO 639-1 code and an optional ISO 3166-1 code separated by a dash or an underscore. | /Users/garethedwards/development/github/cfdocs/docs/functions/lsnumberformat.md|... | + +## Tag Example + +lsNumberFormat returns a number value using the locale convention. + +```javascript + + + +

#locale#
+#lsNumberFormat(-1234.5678, "_________")#
+#lsNumberFormat(-1234.5678, "_________.___")#
+#lsNumberFormat(1234.5678, "_________")#
+#lsNumberFormat(1234.5678, "_________.___")#
+#lsNumberFormat(1234.5678, "$_(_________.___)")#
+#lsNumberFormat(-1234.5678, "$_(_________.___)")#
+#lsNumberFormat(1234.5678, "+_________.___")#
+#lsNumberFormat(1234.5678, "-_________.___")#
+ + +``` + +## Script Example using specific locale + +lsNumberFormat returns a number value using the specified locale. + +```javascript +writeDump(lsNumberFormat(5, '.99', 'en_US')); +``` diff --git a/docs/functions/lsparsecurrency.md b/docs/functions/lsparsecurrency.md new file mode 100644 index 000000000..cd2f2e4dd --- /dev/null +++ b/docs/functions/lsparsecurrency.md @@ -0,0 +1,27 @@ +# lsParseCurrency + +Converts a locale-specific currency string into a formatted number. Attempts conversion by comparing the string with each the three supported currency formats (none, local, international) and using the first that matches. + +```javascript +lsParseCurrency(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | + +## lsParseCurrency Example + +LSParseCurrency converts a locale-specific currency string to a number. + +```javascript +lsParseCurrency("$120.50") +``` + +### Expected Result: 120.5 diff --git a/docs/functions/lsparsedatetime.md b/docs/functions/lsparsedatetime.md new file mode 100644 index 000000000..4e5089b37 --- /dev/null +++ b/docs/functions/lsparsedatetime.md @@ -0,0 +1,27 @@ +# lsParseDateTime + +Converts a string that is a valid date/time representation in the current locale into a date/time object. + +```javascript +lsParseDateTime(dt_string) +``` + +```javascript +returns date +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| dt_string | string | Yes | | | + +## lsParseDateTime Example + +This example illustrates use of the lsParseDateTime function. + +```javascript +lsParseDateTime("01/08/2011") +``` + +### Expected Result: {ts '2011-01-08 00:00:00'} diff --git a/docs/functions/lsparseeurocurrency.md b/docs/functions/lsparseeurocurrency.md new file mode 100644 index 000000000..bc3c00e39 --- /dev/null +++ b/docs/functions/lsparseeurocurrency.md @@ -0,0 +1,17 @@ +# lsParseEuroCurrency + +Formats a locale-specific currency string as a number. Attempts conversion through each of the default currency formats (none, local, international). Ensures correct handling of euro currency for Euro zone countries. + +```javascript +lsParseEuroCurrency(currency_string) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| currency_string | string | Yes | | | diff --git a/docs/functions/lsparsenumber.md b/docs/functions/lsparsenumber.md new file mode 100644 index 000000000..73b8042af --- /dev/null +++ b/docs/functions/lsparsenumber.md @@ -0,0 +1,30 @@ +# lsParseNumber + +Converts a string that is a valid numeric representation in the current locale into a formatted number. + +```javascript +lsParseNumber(String [, locale]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| locale | string | No | | Locale to use instead of the locale of the page when processing the function | + +## Simple example usage + +Converts number to string and back" + +```javascript +str = numberFormat(42,'000.00'); +num = lsParseNumber(str); +writeOutput(str&' → '&num); +``` + +### Expected Result: 042.00 → 42 diff --git a/docs/functions/lstimeformat.md b/docs/functions/lstimeformat.md new file mode 100644 index 000000000..67138d7bb --- /dev/null +++ b/docs/functions/lstimeformat.md @@ -0,0 +1,57 @@ +# lsTimeFormat + +Formats the time part of a date/time string into a string in a locale-specific format. + [mask - quicky] + h,hh,H,HH: Hours; m,mm: Minutes; s,ss: Seconds; + l: Milliseconds; t: A or P; tt: AM or PM + "short" = h:mm tt; "medium" = h:mm:ss tt + +```javascript +lsTimeFormat(time [, mask, locale]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +time.lsTimeFormat([mask]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| time | date | Yes | | | | +| mask | string | No | short | | /Users/garethedwards/development/github/cfdocs/docs/functions/lstimeformat.md|long | +| locale | string | No | | Geographic/language locale value, where the format is a combination of an ISO 639-1 code and an optional ISO 3166-1 code separated by a dash or an underscore. | /Users/garethedwards/development/github/cfdocs/docs/functions/lstimeformat.md|... | + +## Tag Example + +lsTimeFormat returns a time value using the locale convention. + +```javascript + + + +

#locale# + #lsTimeFormat(now())# + #lsTimeFormat(now(), 'hh:mm:ss')# + #lsTimeFormat(now(), 'hh:mm:sst')# + #lsTimeFormat(now(), 'hh:mm:sstt')# + #lsTimeFormat(now(), 'HH:mm:ss')# +


+
+
+``` + +## Script Example using specific locale + +lsTimeFormat returns a time value using the specified locale. + +```javascript +writeDump(lsTimeFormat(now(), 'short', 'en_US')); +``` diff --git a/docs/functions/lsweek.md b/docs/functions/lsweek.md new file mode 100644 index 000000000..c797ee994 --- /dev/null +++ b/docs/functions/lsweek.md @@ -0,0 +1,28 @@ +# lsWeek + +Returns the week number in the year of the date referenced, based on the local influence. +Not everywhere does the week begin on Monday by definition. + +```javascript +lsWeek(date [, locale] [, timezone]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | date object; for example, now() | +| locale | string | No | getLocale() | Geographic/language locale value, where the format is a combination of an ISO 639-1 code and an optional ISO 3166-1 code separated by a dash or an underscore. | +| timezone | string | No | | A datetime object is independent of a specific timezone; it is only an offset in milliseconds from 1970-1-1 00.00:00 UTC (Coordinated Universal Time).

The timezone can come into play for all dateparts. For example: 8:00 a.m. in Germany (= CET) is 11 p.m. the previous day in PST (pacific time zone). So it's important to keep in mind, that the same date can be on different dates in different timezones, not only hours may change.

A timezone must be specified in order to translate the date object to something else. If you do not provide the timezone in the function call, it will default to the timezone specified in the Lucee Administrator (Settings/Regional), or the timezone specified for the current request using the function setTimezone().

You can find a list of all available timezones in the Lucee administrator (Settings/Regional). Some examples of valid timezones include:

* AGT (for time in Argentina)
* Europe/Zurich (for time in Zurich/Switzerland)
* HST (Hawaiian Standard Time in the USA) | + +## Get localized week number for USA central standard time. + +```javascript +WriteOutput( lsWeek( createDateTime( '2019', '10', '04', '01', '50', '00' ), 'en_US', 'CDT' ) ); +``` + +### Expected Result: 40 diff --git a/docs/functions/ltrim.md b/docs/functions/ltrim.md new file mode 100644 index 000000000..2e1e97a43 --- /dev/null +++ b/docs/functions/ltrim.md @@ -0,0 +1,25 @@ +# lTrim + + Removes leading spaces from a string. + +```javascript +lTrim(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | + +## Left Trim + +```javascript +'>' & lTrim(' CFDocs ') & '<' +``` + +### Expected Result: >CFDocs < diff --git a/docs/functions/manifestread.md b/docs/functions/manifestread.md new file mode 100644 index 000000000..a247df400 --- /dev/null +++ b/docs/functions/manifestread.md @@ -0,0 +1,29 @@ +# manifestRead + +reads a manifest file and returns the content as struct + +```javascript +manifestRead(path) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript + +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | Path to
— a jar file containing a "MANIFEST.MF" file in the directory "/META-INF/"
— a Manifest file

or the content of a Manifest File | + +## Dump manifest of a bundle + +```javascript +dump(manifestRead(path)); +``` diff --git a/docs/functions/max.md b/docs/functions/max.md new file mode 100644 index 000000000..6c671168d --- /dev/null +++ b/docs/functions/max.md @@ -0,0 +1,28 @@ +# max + + Determines the greater of two numbers. + +```javascript +max(number1, number2) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number1 | numeric | Yes | | | +| number2 | numeric | Yes | | | + +## Tag Example + +```javascript + + +The maximum of #myNum1# and #myNum2# numbers is #max(myNum1, myNum2)#. +``` + +### Expected Result: The maximum of 4 and 9 is 9. diff --git a/docs/functions/metaphone.md b/docs/functions/metaphone.md new file mode 100644 index 000000000..c25b3478c --- /dev/null +++ b/docs/functions/metaphone.md @@ -0,0 +1,45 @@ +# metaphone + +Metaphone is a phonetic algorithm, an algorithm published in 1990 for indexing words by their English pronunciation. The algorithm produces variable length keys as its output, as opposed to Soundex's fixed-length keys. Similar sounding words share the same keys. + +```javascript +metaphone(str) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| str | string | Yes | | | + +## Metaphone long words + +This compound word is the longest word published with 79 letters according to the 1996 Guinness Book of World Records + +```javascript +Metaphone("Donaudampfschiffahrtsgesellschaftskapitän") +``` + +### Expected Result: TNTM + +## Different words with the same metaphone + +```javascript +Metaphone("Truck")&"/"&Metaphone("Trek") +``` + +### Expected Result: TRK/TRK + +## Metaphone of a word and then same word with prefix + +Adding a word changes the whole metaphone + +```javascript +Metaphone("Trek")&"/"&Metaphone("Star Trek") +``` + +### Expected Result: TRK/STRT diff --git a/docs/functions/mid.md b/docs/functions/mid.md new file mode 100644 index 000000000..5fe976899 --- /dev/null +++ b/docs/functions/mid.md @@ -0,0 +1,29 @@ +# mid + + Extracts a substring from a string. + +```javascript +mid(String, start, count) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | The string from which the substring will be extracted. | +| start | numeric | Yes | | The position of the first character to retrieve. | +| count | numeric | Yes | | The number of characters to retrieve. | + +## Extract month from date + +Grabs the month out of a raw date yyyymmdd value. + +```javascript +mid("20001122", "5", "2") +``` + +### Expected Result: 11 diff --git a/docs/functions/millisecond.md b/docs/functions/millisecond.md new file mode 100644 index 000000000..5cf687914 --- /dev/null +++ b/docs/functions/millisecond.md @@ -0,0 +1,24 @@ +# millisecond + +Returns the milliseconds of the referenced date. + +```javascript +millisecond(date [, timezone]) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.millisecond([timezone]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | date object | +| timezone | string | No | | A datetime object is independent of a specific timezone; it is only an offset in milliseconds from 1970-1-1 00.00:00 UTC (Coordinated Universal Time).

The timezone only comes into play when you need specific information like hours in a day, minutes in a hour or which day it is as these calculations depend on the timezone.

A timezone must be specified in order to translate the date object to something else. If you do not provide the timezone in the function call, it will default to the timezone specified in the Lucee Administrator (Settings/Regional), or the timezone specified for the current request using the function setTimezone().

You can find a list of all available timezones in the Lucee administrator (Settings/Regional). Some examples of valid timezones include:

  • AGT (for time in Argentina)
  • Europe/Zurich (for time in Zurich/Switzerland)
  • HST (Hawaiian Standard Time in the USA)
| diff --git a/docs/functions/min.md b/docs/functions/min.md new file mode 100644 index 000000000..66875b812 --- /dev/null +++ b/docs/functions/min.md @@ -0,0 +1,28 @@ +# min + + Determines the lesser of two numbers. + +```javascript +min(number1, number2) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number1 | numeric | Yes | | | +| number2 | numeric | Yes | | | + +## Minimum of 4 and 9 + +```javascript + + +The minimum of #myNum1# and #myNum2# numbers is #min(myNum1, myNum2)#. +``` + +### Expected Result: The minimum of 4 and 9 is 4. diff --git a/docs/functions/minute.md b/docs/functions/minute.md new file mode 100644 index 000000000..e0a1a7d98 --- /dev/null +++ b/docs/functions/minute.md @@ -0,0 +1,33 @@ +# minute + + Extracts the minute value from a date/time object. + +```javascript +minute(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.minute() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | | + +## Minutes of a datetime object + +```javascript +dt = createdatetime(2016,1,1,5,30,25); +m = minute( dt ); +writeoutput( m ); +``` + +### Expected Result: 30 diff --git a/docs/functions/month.md b/docs/functions/month.md new file mode 100644 index 000000000..570d27ecf --- /dev/null +++ b/docs/functions/month.md @@ -0,0 +1,43 @@ +# month + + Extracts the month value from a date/time object. + +```javascript +month(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.month() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | | + +## Month of a datetime object + +```javascript +dt = createdatetime(2016,1,1,5,30,25); +m = month( dt ); +writeoutput( m ); +``` + +### Expected Result: 1 + +## Month using member syntax + +Returns the month from a datetime object + +```javascript +createDate( 2022, 10, 1 ).month(); +``` + +### Expected Result: 10 diff --git a/docs/functions/monthasstring.md b/docs/functions/monthasstring.md new file mode 100644 index 000000000..b6ccee21e --- /dev/null +++ b/docs/functions/monthasstring.md @@ -0,0 +1,36 @@ +# monthAsString + +```javascript +monthAsString(month_number [, locale]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| month_number | numeric | Yes | | | +| locale | string | No | | | + +## Script Syntax + +```javascript +getVal = monthAsString(11); + writeDump(getVal); +``` + +### Expected Result: result is: November + +## Script Syntax + +With locale + +```javascript +getVal = monthAsString(6,"DE"); + writeDump(getVal); +``` + +### Expected Result: result is: Juni diff --git a/docs/functions/monthshortasstring.md b/docs/functions/monthshortasstring.md new file mode 100644 index 000000000..199b31f30 --- /dev/null +++ b/docs/functions/monthshortasstring.md @@ -0,0 +1,28 @@ +# monthShortAsString + +Returns the first three letters of the given month + +```javascript +monthShortAsString(monthnumber) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| monthnumber | numeric | Yes | | | + +## Script Syntax + +Returns the string for the given month in short format. It supported in Lucee + +```javascript +getVal = monthShortAsString(3); + writeOutput(getVal); +``` + +### Expected Result: Mar diff --git a/docs/functions/newline.md b/docs/functions/newline.md new file mode 100644 index 000000000..2f437a9d6 --- /dev/null +++ b/docs/functions/newline.md @@ -0,0 +1,11 @@ +# newLine + +returns a new line + +```javascript +newLine() +``` + +```javascript +returns string +``` diff --git a/docs/functions/now.md b/docs/functions/now.md new file mode 100644 index 000000000..f4d41d30b --- /dev/null +++ b/docs/functions/now.md @@ -0,0 +1,32 @@ +# now + + Gets the current date and time of the computer running + the CFML server. + +```javascript +now() +``` + +```javascript +returns date +``` + +## Using now() in Script + +Let's display the current server datetime using script. + +```javascript +writeOutput( 'The current date and time is: ' & now() ); +``` + +### Expected Result: The current date and time is: {ts '2014-03-19 15:27:42'} + +## Using now() in Tagged CFML + +Let's display the current server datetime using tagged CFML. + +```javascript +

The current date and time is: #now()#

+``` + +### Expected Result: The current date and time is: {ts '2014-03-19 15:27:42'} diff --git a/docs/functions/nowserver.md b/docs/functions/nowserver.md new file mode 100644 index 000000000..13d4a009b --- /dev/null +++ b/docs/functions/nowserver.md @@ -0,0 +1,17 @@ +# nowServer + +Returns the current time on the server independent of Lucee timezone definition. + +```javascript +nowServer() +``` + +```javascript +returns date +``` + +## Get current server time + +```javascript +nowServer() +``` diff --git a/docs/functions/nullvalue.md b/docs/functions/nullvalue.md new file mode 100644 index 000000000..879e548ab --- /dev/null +++ b/docs/functions/nullvalue.md @@ -0,0 +1,21 @@ +# nullValue + +returns null + +```javascript +nullValue() +``` + +```javascript +returns any +``` + +## ColdFusion polyfill + +Using java data type null instead + +```javascript +writeOutput(isNull(nullValue())); +``` + +### Expected Result: YES diff --git a/docs/functions/numberformat.md b/docs/functions/numberformat.md new file mode 100644 index 000000000..7c9570d1b --- /dev/null +++ b/docs/functions/numberformat.md @@ -0,0 +1,130 @@ +# numberFormat + +Creates a custom-formatted number value. For international +number formatting use LSNumberFormat. +The mask is made up of: +_,9 Digit placeholder; . decimal point; 0 Pads with zeros; +( ) less than zero, puts parentheses around the mask ++ plus sign before positive number minus before negative +- a space before positive minus sign before negative +, Separates every third decimal place with a comma. +L,C Left-justifies or center-justifies number +$ dollar sign before formatted number. +^ Separates left and right formatting. + +```javascript +numberFormat(number [, mask]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | +| mask | string | No | | _ : (underscore): Optional. Digit placeholder.
9 : Optional. Digit placeholder. (Shows decimal places more clearly than _.). Note that when ‘9’ or ‘_’ is used after the decimal place, 0 will be padded, if required.
. : Location of a mandatory decimal point.
0 : Located to the left or right of a mandatory decimal point. Pads with zeros.
( ) : If number is less than zero, puts parentheses around the mask.
+ : Puts plus sign before positive number; minus sign before negative number.
- : Puts a space before positive number; minus sign before negative number.
, : Separates every third decimal place with a comma.
L,C : Left-justifies or center-justifies number within width of mask column. First character of mask must be L or C. The default value is right-justified.
$ : Puts a dollar sign before formatted number. First character of mask must be the dollar sign ($).
^ : Separates left and right formatting. | + +## Format to 2 decimal places + +```javascript +1.234 ('__.00') -> #numberFormat(1.234,'__.00')#
+1234 ('__.00') -> #numberFormat(1234,'__.00')#
+``` + +## 0 and 9 mask + +```javascript + +123 ('00000') -> #numberFormat(123,'00000')#
+123 ('99999') -> #numberFormat(123,'99999')#
+123 ('99.99999') -> #numberFormat(123.12,'99.99999')#
+
+``` + +## _ mask + +```javascript + +123 ('_____') -> #numberFormat(123,'_____')#
+123 ('_.___') -> #numberFormat(123,'_.___')#
+11.10 ('__.000') -> #numberFormat(11.10,'__.000')#
+
+``` + +## + & - mask + +```javascript + +123 ('+') -> #numberFormat(123,'+')#
+-123 ('-') -> #numberFormat(-123,'-')#
+
+``` + +## , comma + +```javascript + +123 (',') -> #numberFormat(123,',')#
+123456 (',') -> #numberFormat(123456,',')#
+
+``` + +## L,C mask + +```javascript + +1 ("L999") -> #NumberFormat( 1, "L999" )#
+1 ("C000") -> #NumberFormat( 1, "C000" )#
+
+``` + +## Two decimal places, decimal input + +```javascript +numberFormat(1.23,'__.00') +``` + +### Expected Result: 1.23 + +## Two decimal places, integer input + +```javascript +numberFormat(123,'__.00') +``` + +### Expected Result: 123.00 + +## Zero will pad zeros; nine doesn’t + +```javascript +num1 = NumberFormat(123,'00000'); +num2 = NumberFormat(123,'99999'); + +writeOutput(num1&'/'&num2); +``` + +### Expected Result: 00123/ 123 + +## show positive/negative sign + +```javascript +num1 = NumberFormat( 5, "+" ); +num2 = NumberFormat( -5, "+" ); + +writeOutput(num1&'/'&num2); +``` + +### Expected Result: +5/-5 + +## Formats to a dollar format (US) + +You could use dollarFormat() or lsCurrencyFormat() instead + +```javascript +numberFormat(123456789,'_$,9.99') +``` + +### Expected Result: $123,456,789.00 diff --git a/docs/functions/objectequals.md b/docs/functions/objectequals.md new file mode 100644 index 000000000..964d1f3b4 --- /dev/null +++ b/docs/functions/objectequals.md @@ -0,0 +1,25 @@ +# objectEquals + +Identifies any conflict between CFC instances on the client and the server. + +```javascript +objectEquals(clientobject, originalobject) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| clientobject | any | Yes | | New instance of the CFC on the client. | +| originalobject | any | Yes | | Original instance of the CFC. | + +## Tag Example + +```javascript + + +``` diff --git a/docs/functions/objectload.md b/docs/functions/objectload.md new file mode 100644 index 000000000..e9d56235a --- /dev/null +++ b/docs/functions/objectload.md @@ -0,0 +1,29 @@ +# objectLoad + +Load object from binary object + +```javascript +objectLoad(binaryObject) +objectLoad(filepath) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| binaryObject | binary | Yes | | A binary object returned by objectSave function. | +| filepath | string | Yes | | A file path to a serialized object | + +## Saving and loading a complex object + +```javascript +people = queryNew('id,name','integer,varchar', {'id':1,'name':'Pedro'}); +binary_people = objectSave(people); +writeDump(binary_people); +restored_people = objectLoad(binary_people); +writeDump(restored_people); +``` diff --git a/docs/functions/objectsave.md b/docs/functions/objectsave.md new file mode 100644 index 000000000..04f4f8487 --- /dev/null +++ b/docs/functions/objectsave.md @@ -0,0 +1,28 @@ +# objectSave + +Serialize object to file or convert it to binary format + +```javascript +objectSave(object [, file]) +``` + +```javascript +returns binary +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| object | variableName | Yes | | Object to be serialized | +| file | string | No | | File in which serialized object will be stored | + +## Saving and loading a complex object + +```javascript +people = queryNew('id,name','integer,varchar', {'id':1,'name':'Pedro'}); +binary_people = objectSave(people); +writeDump(binary_people); +restored_people = objectLoad(binary_people); +writeDump(restored_people); +``` diff --git a/docs/functions/onapplicationend.md b/docs/functions/onapplicationend.md new file mode 100644 index 000000000..8ee67e208 --- /dev/null +++ b/docs/functions/onapplicationend.md @@ -0,0 +1,29 @@ +# onApplicationEnd + +Defined in Application.cfc, invoked when the application times out or when the server is shutting down. + +```javascript +function onApplicationEnd(applicationScope) { } +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| ApplicationScope | struct | Yes | | The application scope of the application that is ending. | + +## Write to log when onApplicationEnd is triggered + +Write to the log that application has ended. In the example below, text 'myApp ended on {current date/time}' gets added to D:\CF\logs\myApp.log file. Note: Application has already ended, but we can use ApplicationScope argument to access any Application scope variables. + +```javascript +public void function onApplicationEnd(struct ApplicationScope){ + + writeLog(text = "#arguments.ApplicationScope.name# ended on: #now()#"); + return true; + } +``` diff --git a/docs/functions/onapplicationstart.md b/docs/functions/onapplicationstart.md new file mode 100644 index 000000000..f47167574 --- /dev/null +++ b/docs/functions/onapplicationstart.md @@ -0,0 +1,11 @@ +# onApplicationStart + +Defined in Application.cfc, invoked once when the application is initialized. + +```javascript +function onApplicationStart() { return true; } +``` + +```javascript +returns boolean +``` diff --git a/docs/functions/onerror.md b/docs/functions/onerror.md new file mode 100644 index 000000000..7221159d7 --- /dev/null +++ b/docs/functions/onerror.md @@ -0,0 +1,18 @@ +# onError + +Defined in Application.cfc, invoked when an exception occurs that was not caught by a cftry or cfcatch statement. + +```javascript +function onError(exception, eventName) {} +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| exception | struct | Yes | | A structure containing the exception similar to what the cfcatch tag has. | | +| eventName | string | Yes | | The name of the application event at which the exception occurred. If no onRequest method is defined then an empty string may be passed. | /Users/garethedwards/development/github/cfdocs/docs/functions/onerror.md|[empty string] | diff --git a/docs/functions/onmissingmethod.md b/docs/functions/onmissingmethod.md new file mode 100644 index 000000000..963671f64 --- /dev/null +++ b/docs/functions/onmissingmethod.md @@ -0,0 +1,33 @@ +# onMissingMethod + +This method is invoked in a CFC when a method call exists that is not defined by cffunction or with a function statement. + +```javascript +function onMissingMethod(string missingMethodName, struct missingMethodArguments) { } +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| missingMethodName | string | Yes | | The name of the missing method. | +| missingMethodArguments | struct | Yes | | The arguments that were passed on the function call to the missing method. | + +## onMissingMethod Example + +Creates helper function getPropertyNameForHTML() which calls getPropertyName() and wraps it with the encodeForHTML function. + +```javascript +public function onMissingMethod(missingMethodName, missingMethodArguments) { + if (reFindNoCase("^get[a-zA-Z0-9]+ForHTML$", arguments.missingMethodName) { + local.getter = this[replaceNoCase(arguments.missingMethodName, "ForHTML", "")]; + return encodeForHTML(local.getter()); + } else { + throw (message="Method #encodeForHTML(arguments.missingMethodName)# was not found in the component #encodeForHTML(getMetadata(this).name)#"); + } +} +``` diff --git a/docs/functions/onmissingtemplate.md b/docs/functions/onmissingtemplate.md new file mode 100644 index 000000000..65ef4819f --- /dev/null +++ b/docs/functions/onmissingtemplate.md @@ -0,0 +1,17 @@ +# onMissingTemplate + +Defined in Application.cfc, invoked when a request is made for a CFML template that does not exist. + +```javascript +function onMissingTemplate(string targetPage) { return true; } +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| targetPage | string | Yes | | Requested template path relative to the webroot | diff --git a/docs/functions/onrequest.md b/docs/functions/onrequest.md new file mode 100644 index 000000000..b25fe5678 --- /dev/null +++ b/docs/functions/onrequest.md @@ -0,0 +1,17 @@ +# onRequest + +Defined in Application.cfc, invoked when the request starts after onRequestStart. + +```javascript +onRequest(string targetPage) { include arguments.targetPage; } +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| targetPage | string | Yes | | Requested template path relative to the webroot | diff --git a/docs/functions/onrequestend.md b/docs/functions/onrequestend.md new file mode 100644 index 000000000..f8f2b634e --- /dev/null +++ b/docs/functions/onrequestend.md @@ -0,0 +1,17 @@ +# onRequestEnd + +Defined in Application.cfc, invoked at the end of the request before the request is terminated. It can generate output. + +```javascript +function onRequestEnd(string targetPage) { } +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| targetPage | string | Yes | | Requested template path relative to the webroot | diff --git a/docs/functions/onrequeststart.md b/docs/functions/onrequeststart.md new file mode 100644 index 000000000..866155b76 --- /dev/null +++ b/docs/functions/onrequeststart.md @@ -0,0 +1,17 @@ +# onRequestStart + +Defined in Application.cfc, invoked when the request starts before onRequest. + +```javascript +function onRequestStart(string targetPage) { return true; } +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| targetPage | string | Yes | | Requested template path relative to the webroot | diff --git a/docs/functions/onserverstart.md b/docs/functions/onserverstart.md new file mode 100644 index 000000000..b05d20460 --- /dev/null +++ b/docs/functions/onserverstart.md @@ -0,0 +1,19 @@ +# onServerStart + +Called upon startup of the server. Typically defined in server.cfc and placed at the webroot. In the ColdFusion Administrator > Setting check 'Component with onServerStart() method' and specify the file. The function is useful for application-independent tasks, and specifying the server specific environment variables and other general tasks. + +```javascript +function onServerStart() { } +``` + +```javascript +returns void +``` + +## Specify environment variables + +Setting server specific variables + +```javascript + +``` diff --git a/docs/functions/onsessionend.md b/docs/functions/onsessionend.md new file mode 100644 index 000000000..06b487111 --- /dev/null +++ b/docs/functions/onsessionend.md @@ -0,0 +1,18 @@ +# onSessionEnd + +Defined in Application.cfc, invoked when a session expires or times out. + +```javascript +function onSessionEnd(sessionScope, applicationScope) {} +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| sessionScope | struct | Yes | | The session scope of the session that is ending. | +| applicationScope | struct | Yes | | The application scope of the session that is ending. | diff --git a/docs/functions/onsessionstart.md b/docs/functions/onsessionstart.md new file mode 100644 index 000000000..32e33dbda --- /dev/null +++ b/docs/functions/onsessionstart.md @@ -0,0 +1,11 @@ +# onSessionStart + +Defined in Application.cfc, invoked upon initialization of a session. + +```javascript +function onSessionStart() {} +``` + +```javascript +returns void +``` diff --git a/docs/functions/ormclearsession.md b/docs/functions/ormclearsession.md new file mode 100644 index 000000000..6ecdd4412 --- /dev/null +++ b/docs/functions/ormclearsession.md @@ -0,0 +1,23 @@ +# ormClearSession + +ORMClearSession removes all the entities that are loaded or created in the session. This clears the first level cache and removes the objects that are not yet saved to the database. + +```javascript +ormClearSession([datasource]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datasource | string | No | | Name of the data source used for the session. If not defined, the default datasource defined in Application.cfc/cfapplication is used. | + +## Clears the Hibernate session associated with the datasource from the application. + +```javascript +ormClearSession(); +``` diff --git a/docs/functions/ormcloseallsessions.md b/docs/functions/ormcloseallsessions.md new file mode 100644 index 000000000..b4305d1dd --- /dev/null +++ b/docs/functions/ormcloseallsessions.md @@ -0,0 +1,19 @@ +# ormCloseAllSessions + + Closes all Hibernate sessions in the request. + +```javascript +ormCloseAllSessions(); +``` + +```javascript +returns void +``` + +## Tag Syntax + +Example 2 + +```javascript +ormCloseAllSessions() +``` diff --git a/docs/functions/ormclosesession.md b/docs/functions/ormclosesession.md new file mode 100644 index 000000000..d568f2029 --- /dev/null +++ b/docs/functions/ormclosesession.md @@ -0,0 +1,23 @@ +# ormCloseSession + +Closes the current ORM session for the given datasource. When the datasource argument is not passed then it uses the default datasource defined in Application.cfc. + +```javascript +ormCloseSession([datasource]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datasource | string | No | | Name of the datasource for the ORM session | + +## Closes the Hibernate session associated with the datasource from the application. + +```javascript +ormCloseSession(); +``` diff --git a/docs/functions/ormevictcollection.md b/docs/functions/ormevictcollection.md new file mode 100644 index 000000000..92522f43c --- /dev/null +++ b/docs/functions/ormevictcollection.md @@ -0,0 +1,27 @@ +# ormEvictCollection + +This will remove all the entries with the specified relation/collection name in the specified component. + +```javascript +ormEvictCollection(entityName, collectionName [, primaryKey]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| entityName | string | Yes | | Entity name of the persistent CFC | +| collectionName | string | Yes | | Name of the collection in the component | +| primaryKey | string | No | | Primary key of the collection or association data of the entity | + +## Tag Example + +To evict all the association or collection data of collection `arts` belonging to the component `CArtists` + +```javascript + +``` diff --git a/docs/functions/ormevictentity.md b/docs/functions/ormevictentity.md new file mode 100644 index 000000000..20cdf9628 --- /dev/null +++ b/docs/functions/ormevictentity.md @@ -0,0 +1,34 @@ +# ormEvictEntity + +This will remove all the entries for the specified component name from the entity cache. + +```javascript +ormEvictEntity(entityName [, primaryKey]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| entityName | string | Yes | | Entity name of the persistent CFC | +| primaryKey | string | No | | Primary key value of the component | + +## Tag Example + +To evict all the cache data of CArtist entity + +```javascript + +``` + +## Tag Example + +To evict the cache data of CArtists entity whose primary key is 1 + +```javascript + +``` diff --git a/docs/functions/ormevictqueries.md b/docs/functions/ormevictqueries.md new file mode 100644 index 000000000..13254bdd6 --- /dev/null +++ b/docs/functions/ormevictqueries.md @@ -0,0 +1,26 @@ +# ormEvictQueries + +This will remove all the queries from the named query cache. If name is not specified, all queries from default cache will be removed. + +```javascript +ormEvictQueries([cacheName, datasource]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| cacheName | string | No | | Name of the cache region that you want to evict. If you do not specify the cache, the default query cache is evicted. | +| datasource | string | No | | Name of the data source whose cache you want to evict. | + +## Evicts all the Hibernate cached queries for the default cache. + +This will remove any cached queries from the default cache and cause the query to run again + +```javascript +ormEvictQueries(); +``` diff --git a/docs/functions/ormexecutequery.md b/docs/functions/ormexecutequery.md new file mode 100644 index 000000000..7253547f9 --- /dev/null +++ b/docs/functions/ormexecutequery.md @@ -0,0 +1,22 @@ +# ormExecuteQuery + +Runs the HQL on the default data source specified for the application. + +```javascript +ormExecuteQuery(hql, params [,unique]); +ormExecuteQuery(hql, [,unique] [, queryoptions]); +ormExecuteQuery(hql, params [,unique] [,queryOptions]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| hql | string | Yes | | A HQL query statement | +| params | any | No | | A struct or array of query params. | +| unique | boolean | No | | If true returns a single entity instead of an array. | +| queryoptions | string | No | | A struct with possible keys: ignorecase, maxResults, offset, cacheable, timeout, datasource | diff --git a/docs/functions/ormflush.md b/docs/functions/ormflush.md new file mode 100644 index 000000000..49a012546 --- /dev/null +++ b/docs/functions/ormflush.md @@ -0,0 +1,23 @@ +# ormFlush + +Flushes the current ORM session of all the pending CRUD operations in that request. Any changes made in the objects, in the current ORM session, are saved to the database. + +```javascript +ormFlush([datasource]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datasource | string | No | | Name of the data source used for the session. If not defined, the default datasource defined in Application.cfc/cfapplication is used. | + +## Flush all pending CRUD operations for datasource defined in the Application.cfc + +```javascript +ormFlush(); +``` diff --git a/docs/functions/ormflushall.md b/docs/functions/ormflushall.md new file mode 100644 index 000000000..9c1b950b4 --- /dev/null +++ b/docs/functions/ormflushall.md @@ -0,0 +1,19 @@ +# ormFlushAll + +Flushes all the current Hibernate sessions in the request. + +```javascript +ormFlushAll(); +``` + +```javascript +returns void +``` + +## Flush all pending CRUD operations for ALL Hibernate sessions for the default datasource. + +Please note this will flush all operations for all users, use with care. + +```javascript +ormFlushAll(); +``` diff --git a/docs/functions/ormgetsession.md b/docs/functions/ormgetsession.md new file mode 100644 index 000000000..53beae1a1 --- /dev/null +++ b/docs/functions/ormgetsession.md @@ -0,0 +1,25 @@ +# ormGetSession + +Get the current ORM session object + +```javascript +ormGetSession([datasource]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datasource | string | No | | Name of the data source used for the session. If not defined, the default datasource defined in Application.cfc/cfapplication is used. | + +## Gets the Hibernate session object associated with the datasource from the application. + +Returns the object representing the current Hibernate session so you can perform functions on it. + +```javascript +ormGetSession(); +``` diff --git a/docs/functions/ormgetsessionfactory.md b/docs/functions/ormgetsessionfactory.md new file mode 100644 index 000000000..1fde0850b --- /dev/null +++ b/docs/functions/ormgetsessionfactory.md @@ -0,0 +1,25 @@ +# ormGetSessionFactory + +Returns ORM session factory instance + +```javascript +ormGetSessionFactory([datasource]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datasource | string | No | | Name of the data source used for the session. If not defined, the default datasource defined in Application.cfc/cfapplication is used. | + +## Gets the Hibernate session factory object associated with the datasource from the application. + +Returns the Factory object for the Hibernate session so you can perform operations on it. + +```javascript +ormGetSessionFactory(); +``` diff --git a/docs/functions/ormindex.md b/docs/functions/ormindex.md new file mode 100644 index 000000000..ba038f35e --- /dev/null +++ b/docs/functions/ormindex.md @@ -0,0 +1,20 @@ +# ormIndex + + Performs offline indexing - using this function without specifying parameters, all persistent entities of a given application are indexed. + +```javascript +ormIndex(); ormIndex('entity_name'); ormIndex('entity_list'); ormIndex('entityObject'); +``` + +```javascript +returns void +``` + +## Script Syntax + +```javascript +EmpOBJs = entityLoad('employee', {lastname='Bond'}); + for(EmpObj in EmpObjs) + { + ormIndex(empObj); ]r]n } +``` diff --git a/docs/functions/ormindexpurge.md b/docs/functions/ormindexpurge.md new file mode 100644 index 000000000..05976db0c --- /dev/null +++ b/docs/functions/ormindexpurge.md @@ -0,0 +1,31 @@ +# ormIndexPurge + +Clears all indexed data for all entities or specified entities in the current application scope. + +```javascript +ormIndexPurge(); ormIndexPurge("entityName"); ormIndexPurge("entityName_list"); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| region | string | Yes | | Name of the cache region. | + +## Tag Syntax + +If you use this function without specifying entityName, all persistent entities of the application are purged. + +```javascript +ormIndexPurge(); +``` + +## Tag Syntax + +```javascript +ormIndexPurge('Employee'); +``` diff --git a/docs/functions/ormreload.md b/docs/functions/ormreload.md new file mode 100644 index 000000000..56df8b2eb --- /dev/null +++ b/docs/functions/ormreload.md @@ -0,0 +1,33 @@ +# ormReload + +Reinitializes ORM for the application. If you make any change to the persistent metadata of the CFCs, then you might want to reload the ORM. Returns ORM session factory instance + +```javascript +ormReload() +``` + +```javascript +returns void +``` + +## Reload ORM by calling ormReload onRequestStart + +Reloads the ORM of an application when `?ormreload` is in the URL. This is recommended ONLY for development and should be removed from production. + +```javascript +component { + this.name = hash(getCurrentTemplatePath()); + this.datasource = "somedatasourceORM"; + // turn on ORM for this application + this.ormenabled = true; + public boolean function onRequestStart(required string targetPage) { + // if ormreload is in the URL, then reload ORM + if (structKeyExists(url,"ormreload")) { + ormReload(); + } + return true; + } +} +``` + +### Expected Result: string diff --git a/docs/functions/ormsearch.md b/docs/functions/ormsearch.md new file mode 100644 index 000000000..d4833e5cd --- /dev/null +++ b/docs/functions/ormsearch.md @@ -0,0 +1,56 @@ +# ormSearch + +Searches for given text in specific properties or entities. + +```javascript +ormSearch('query_text', 'entityName') +ormSearch('query_text', 'entityName', fields) +ormSearch('query_text', 'entityName', fields, optionMap); +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query_text | string | Yes | | The text to be searched for or a complete Lucene query.In the case of ORMSearch('query_text', 'entityName'), only Lucene query is supported. For details of Lucene query, see http://lucene.apache.org/core/old_versioned_docs/versions/3_0_0/queryparsersyntax.html | +| entityName | string | Yes | | Name of the entity to be searched. | +| fields | array | Yes | | Fields in which search has to be performed. This can be an array of strings. If you are performing a Lucene query, you need not specify this field. In other words, if you do not specify this value, a Lucene query is performed. Field name is case-sensitive. | +| optionMap | struct | Yes | | Extra options that can be passed while executing Lucene query. The options are: Sort, Offset, maxResults | + +## Tag Syntax + +ORM search based on Lucene query. + +```javascript +ormSearch('FirstName:ch*','Employee'); + ormSearch('ch*','Employee',['FirstName']); + objs = ormSearch('FirstName:ch*','Employee',[],{sort='salary',maxresults=5,offset=2}); +``` + +## Tag Syntax + +ORM search on multiple entities. + +```javascript +ormSearch('john*','DeveloperEntity,UserEntity',['firstname']); +``` + +## Tag Syntax + +ORM search on all subentities based on Lucene query + +```javascript +ormSearch('john*','EmployeeEntity',['FirstName']); +``` + +## Tag Syntax + +ORM search in relationships + +```javascript +ormSearch('CategoryID.CategoryName:In*','cproducts',[]); +``` diff --git a/docs/functions/ormsearchoffline.md b/docs/functions/ormsearchoffline.md new file mode 100644 index 000000000..a8fa48772 --- /dev/null +++ b/docs/functions/ormsearchoffline.md @@ -0,0 +1,46 @@ +# ormSearchOffline + + Performs search on the indexed properties but returns only the stored fields. For this function to work, specify indexStore=true on the properties on which you want to perform the search. + +```javascript +ormSearchOffline(query_text, entityName, fields_to_be_selected) +ormSearchOffline(query_text, entityName, fields_to_be_selected, fields) +ormSearchOffline(query_text, entityName, fields_to_be_selected, fields, optionMap); +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query_text | string | Yes | | The text to be searched for or a complete Lucene query. For details of Lucene query, see http://lucene.apache.org/core/old_versioned_docs/versions/. | +| entityName | string | Yes | | Name of the entity to be searched. | +| fields_to_be_selected | array | Yes | | Fields to be returned as keys in the resultant struct. | +| fields | array | Yes | | Fields in which search has to be performed. | +| optionMap | struct | No | | | +| extra options | struct | No | | can be passed while executing Lucene query. The options can be: sort, offset, maxResults | + +## Tag Syntax + +```javascript +ormSearchOffline('FirstName:'ch*','Employee',['id','firstname']); +``` + +## Tag Syntax + +In the following example, offline search is performed on the property FirstName and first name and last name are returned as keys in the resultant struct. + +```javascript +ormSearchOffline('ch*','Employee',['FirstName','LastName'],['FirstName'],{sort='salary',maxresults=5,offset=2}); +``` + +## Tag Syntax + +In this example, the resultObj in the query is an array of structs. The individual structs contain all the selected fields (passed as third parameter). + +```javascript + +``` diff --git a/docs/functions/pagepoolclear.md b/docs/functions/pagepoolclear.md new file mode 100644 index 000000000..f1884255a --- /dev/null +++ b/docs/functions/pagepoolclear.md @@ -0,0 +1,19 @@ +# pagePoolClear + +clear pages in pools + +```javascript +pagePoolClear() +``` + +```javascript +returns boolean +``` + +## pagePoolClear Example + +Clear out all the CFML code (cfm, cfcs) in the cache of compiled code. It is supported in Lucee. + +```javascript +writeDump(pagePoolClear()); +``` diff --git a/docs/functions/pagepoollist.md b/docs/functions/pagepoollist.md new file mode 100644 index 000000000..26aba0a5a --- /dev/null +++ b/docs/functions/pagepoollist.md @@ -0,0 +1,19 @@ +# pagePoolList + +list all pages in pools + +```javascript +pagePoolList() +``` + +```javascript +returns array +``` + +## pagePoolList Example + +Lists all the CFML code (cfm, cfcs) in the cache of compiled code. It is supported in Lucee. + +```javascript +writeDump(pagePoolList()); +``` diff --git a/docs/functions/paragraphformat.md b/docs/functions/paragraphformat.md new file mode 100644 index 000000000..bce22937e --- /dev/null +++ b/docs/functions/paragraphformat.md @@ -0,0 +1,19 @@ +# paragraphFormat + + Replaces characters in a string: + * Single newline characters (CR/LF sequences) with spaces + * Double newline characters with HTML paragraph tags (`<p>`) + +```javascript +paragraphFormat(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | diff --git a/docs/functions/parameterexists.md b/docs/functions/parameterexists.md new file mode 100644 index 000000000..a59f8f4c2 --- /dev/null +++ b/docs/functions/parameterexists.md @@ -0,0 +1,25 @@ +# parameterExists + +Determines whether a parameter exists. ColdFusion does not evaluate the argument. + +```javascript +parameterExists(name) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| parameter | string | Yes | | A syntactically valid parameter name. | + +## Tag Syntax + +```javascript + +

Using parameterExists, we have shown that the FORM field 'myString' now exists. + +``` diff --git a/docs/functions/parsedatetime.md b/docs/functions/parsedatetime.md new file mode 100644 index 000000000..5b60d8bcc --- /dev/null +++ b/docs/functions/parsedatetime.md @@ -0,0 +1,29 @@ +# parseDateTime + + Parses a date/time string according to the English (U.S.) + locale conventions. (To format a date/time string for other + locales, use the LSParseDateTime function.) + +```javascript +parseDateTime(dt_string [, pop_conversion]) +``` + +```javascript +returns date +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| dt_string | string | Yes | | | | +| pop_conversion | string | No | standard | - standard: function does no conversion.
- pop: specifies that the date/time string is in POP format, which includes the local time of the sender and a time-zone offset from UTC. ColdFusion applies the offset and returns
a value with the UTC time.
- Apart from these two values, this parameter allows you to directly specify the format in which to parse the given string. | /Users/garethedwards/development/github/cfdocs/docs/functions/parsedatetime.md|pop | + +## Tag Example + +```javascript + + + #parseDateTime(dateTimeVar)# + +``` diff --git a/docs/functions/parsenumber.md b/docs/functions/parsenumber.md new file mode 100644 index 000000000..f5d7fa614 --- /dev/null +++ b/docs/functions/parsenumber.md @@ -0,0 +1,34 @@ +# parseNumber + +Converts string to number in numeral system + +```javascript +parseNumber(number [, radix]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| number | string | Yes | | | | +| radix | string | No | | | /Users/garethedwards/development/github/cfdocs/docs/functions/parsenumber.md|hex | + +## Convert decimal number to binary + +```javascript +parseNumber(1010,"bin") +``` + +### Expected Result: 10 + +## Convert decimal number to hex + +```javascript +parseNumber(1010,"hex") +``` + +### Expected Result: 4112 diff --git a/docs/functions/pi.md b/docs/functions/pi.md new file mode 100644 index 000000000..e33b9aa54 --- /dev/null +++ b/docs/functions/pi.md @@ -0,0 +1,38 @@ +# pi + +Gets the mathematical constant p, accurate to 15 digits +, but only shows 11 when simply outputted. + +```javascript +pi() +``` + +```javascript +returns numeric +``` + +## pi to 11 digits + +```javascript +pi() +``` + +### Expected Result: 3.14159265359 + +## Display all 15 digits with numberFormat + +```javascript +numberFormat(pi(),"0.000000000000000") +``` + +### Expected Result: 3.141592653589793 + +## ColdFusion only shows up to 15 digits of pi + +After 15th digit CF outputs 0's + +```javascript +numberFormat(pi(),"0.0000000000000000000") +``` + +### Expected Result: 3.1415926535897930000 diff --git a/docs/functions/precisionevaluate.md b/docs/functions/precisionevaluate.md new file mode 100644 index 000000000..665bffa1f --- /dev/null +++ b/docs/functions/precisionevaluate.md @@ -0,0 +1,37 @@ +# precisionEvaluate + + Evaluates one or more string expressions using BigDecimal precision arithmetic. If the results ends in an infinitely repeating decimal value only the first 20 digits of the decimal portion will be used. BigDecimal precision results only work with addition, subtraction, multiplication and division. The use of ^, MOD, % or \ arithmetic operators will result in normal integer precision. + +```javascript +precisionEvaluate(expressions) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| expressions | string | Yes | | Expressions to evaluate | + +## precisionEvaluate of 1/3 plus 5 + +1/3 is calculated then 5 is added to the total. Display is limited to 20 threes. + +```javascript +precisionEvaluate( 1/3 + 5 ) +``` + +### Expected Result: 5.333333333333 + +## precisionEvaluate of 1/(7*12) + +Calculate 1 divided by the product of 7 x 12 + +```javascript +precisionEvaluate( 1/(7*12) ) +``` + +### Expected Result: 0.011904761905 diff --git a/docs/functions/preservesinglequotes.md b/docs/functions/preservesinglequotes.md new file mode 100644 index 000000000..968a097c4 --- /dev/null +++ b/docs/functions/preservesinglequotes.md @@ -0,0 +1,17 @@ +# preserveSingleQuotes + +Prevents CFML from automatically escaping single quotation mark characters that are contained in a variable. CFML does not evaluate the argument. + +```javascript +preserveSingleQuotes(variable) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| variable | string | Yes | | Variable that contains a string in which to preserve single quotation marks. | diff --git a/docs/functions/quarter.md b/docs/functions/quarter.md new file mode 100644 index 000000000..b8139f92b --- /dev/null +++ b/docs/functions/quarter.md @@ -0,0 +1,33 @@ +# quarter + + Calculates the quarter of the year in which a date falls. + +```javascript +quarter(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.quarter() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | | + +## Quarter of a datetime object + +```javascript +dt = createdatetime(2016,1,1,5,30,25); +q = quarter( dt ); +writeoutput( q ); +``` + +### Expected Result: 1 diff --git a/docs/functions/query.md b/docs/functions/query.md new file mode 100644 index 000000000..341549c9e --- /dev/null +++ b/docs/functions/query.md @@ -0,0 +1,27 @@ +# query + +Create and populate a query object. You can initialize with data by passing arrays of data as arguments, where the argument name is the desired column name and each item in the array is the value for a row. + +```javascript +query() +``` + +```javascript +returns query +``` + +## Empty query + +Create an empty query object + +```javascript +myQuery = query(); +``` + +## Query with some data + +Create query object with some initial data + +```javascript +myQuery = query(foo: [1,2,3], bar: ['a','b','c']); +``` diff --git a/docs/functions/queryaddcolumn.md b/docs/functions/queryaddcolumn.md new file mode 100644 index 000000000..33e1163ff --- /dev/null +++ b/docs/functions/queryaddcolumn.md @@ -0,0 +1,55 @@ +# queryAddColumn + + Adds a column to a query and populates its rows with the + contents of a one-dimensional array. Pads query columns, + if necessary, to ensure that all columns have the same number + of rows. + +```javascript +queryAddColumn(query, column_name [, datatype], array_name) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someQuery.addColumn(column_name [, datatype], array_name) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| column_name | string | Yes | | | +| datatype | string | No | | Column data type. | +| array_name | array | Yes | | | + +## Tag Example + +```javascript + + + + + + + + + + + +``` + +## member syntax example + +add a column to a query using member syntax + +```javascript +books = queryNew("id,title", "integer,varchar"); +books.addColumn("author", "varchar", []); +writeDump(books); +``` diff --git a/docs/functions/queryaddrow.md b/docs/functions/queryaddrow.md new file mode 100644 index 000000000..960379200 --- /dev/null +++ b/docs/functions/queryaddrow.md @@ -0,0 +1,83 @@ +# queryAddRow + + Adds a specified number of empty rows to a query. + +```javascript +queryAddRow(query [, number/row(s)]) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +someQuery.addRow([number/row(s)]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| number/row(s) | numeric | No | | As of CF10+ you can pass a Structure whose keys map to the query column names to insert a row of data; or an Array of those Structures to insert multiple rows at once. | + +## Builds a simple query using queryNew and queryAddRow + +CF10+ Pass in row data directly to queryAddRow argument. + +```javascript +news = queryNew("id,title", "integer,varchar"); +queryAddRow(news, {"id"=1,"title"="Dewey defeats Truman"}); +writeDump(news); +``` + +## Builds a simple query using queryNew and queryAddRow member syntax + +CF10+ Pass in row data directly to queryAddRow argument. + +```javascript +news = queryNew("id,title", "integer,varchar"); +news.addRow({"id"=1,"title"="Dewey defeats Truman"}); +writeDump(news); +``` + +## Builds a simple query using queryNew queryAddRow and querySetCell + +Using Script with the queryAddRow querySetCell functions to populate the query. + +```javascript +news = queryNew("id,title", "integer,varchar"); +queryAddRow(news); +querySetCell(news, "id", "1"); +querySetCell(news, "title", "Dewey defeats Truman"); +queryAddRow(news); +querySetCell(news, "id", "2"); +querySetCell(news, "title", "Men walk on Moon"); +writeDump(news); +``` + +## Builds a simple query using queryNew queryAddRow and querySetCell with rows number + +The example above could be simplified this way: + +```javascript +news = queryNew("id,title", "integer,varchar"); +queryAddRow(news,2); +querySetCell(news, "id", "1",1); +querySetCell(news, "title", "Dewey defeats Truman",1); +querySetCell(news, "id", "2",2); +querySetCell(news, "title", "Men walk on Moon",2); +writeDump(news); +``` + +## Builds a simple query using queryNew queryAddRow with multiple rows as an array + +CF10+ The example above could be simplified even more this way: + +```javascript +news = queryNew("id,title", "integer,varchar"); +queryAddRow(news, [{"id"=1,"title"="Dewey defeats Truman"},{"id"=2,"title"= "Men walk on Moon"}]); +writeDump(news); +``` diff --git a/docs/functions/queryappend.md b/docs/functions/queryappend.md new file mode 100644 index 000000000..5f587686f --- /dev/null +++ b/docs/functions/queryappend.md @@ -0,0 +1,35 @@ +# queryAppend + + Adds a query to the end of the current query. + +```javascript +queryAppend(query1, query2) +``` + +```javascript +returns query +``` + +## Member Function Syntax + +```javascript +qry.append(query2) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query1 | query | Yes | | The initial query object. | +| query2 | query | Yes | | The query being added. | + +## Builds a simple query using queryNew and queryAppend + +Add new query to the end of the current query using queryAppend. + +```javascript +names = queryNew("empl_id,name", "integer,varchar", [["empl_id"=1239,"name"="John"]]); +newnames = queryNew("empl_id,name", "integer,varchar", [["empl_id"=1501,"name"="Jane"]]); +queryAppend(names, newnames); +writeDump(names); +``` diff --git a/docs/functions/queryclear.md b/docs/functions/queryclear.md new file mode 100644 index 000000000..9c3b77321 --- /dev/null +++ b/docs/functions/queryclear.md @@ -0,0 +1,45 @@ +# queryClear + +This function takes a query, removes all the rows, then returns a query object with no records + +```javascript +queryClear(query) +``` + +```javascript +returns query +``` + +## Member Function Syntax + +```javascript +query.clear() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | + +## queryClear member function + +Description of the code example + +```javascript +heroes = queryNew("id,Name", + "integer,varchar", + [ + {"id":1,"Name":"Bruce Banner"}, + {"id":2,"Name":"Tony Stark"}, + {"id":3,"Name":"Bobby Drake"}, + {"id":4,"Name":"Jean Grey"} + ] + ); +writeOutput("Query with records
"); +writeDump(heroes); +writeOutput("The same query, but cleared
"); +writeDump(heroes.clear()); +``` + +### Expected Result: A query with 4 heroes, then a query with none diff --git a/docs/functions/querycolumnarray.md b/docs/functions/querycolumnarray.md new file mode 100644 index 000000000..4cc6ed3ce --- /dev/null +++ b/docs/functions/querycolumnarray.md @@ -0,0 +1,38 @@ +# queryColumnArray + +return the column names as array, in the orders of the column in the database + +```javascript +queryColumnArray(query) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +query.columnArray() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | + +## Dump array of query columns + +```javascript +news = queryNew("id,title", + "integer,varchar", [{ + "id": 1, + "title": "Dewey defeats Truman" + }, { + "id": 2, + "title": "Man walks on Moon" + }] +); +dump(queryColumnArray(news)); +``` diff --git a/docs/functions/querycolumncount.md b/docs/functions/querycolumncount.md new file mode 100644 index 000000000..7f9cbc57c --- /dev/null +++ b/docs/functions/querycolumncount.md @@ -0,0 +1,32 @@ +# queryColumnCount + +Returns the amount of all columns in the given query object + +```javascript +queryColumnCount(query) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +query.columnCount() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | + +## Output number of query columns + +```javascript +myQuery = queryNew("ID,name,age"); +writeOutput( queryColumnCount( myQuery ) ); +``` + +### Expected Result: 3 diff --git a/docs/functions/querycolumndata.md b/docs/functions/querycolumndata.md new file mode 100644 index 000000000..1760cb495 --- /dev/null +++ b/docs/functions/querycolumndata.md @@ -0,0 +1,45 @@ +# queryColumnData + +Returns the data in a query column. See also valueArray for use in ACF. + +```javascript +queryColumnData(query, columnName [, closure]) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +query.columnData(columnName [, closure]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| columnName | string | Yes | | | +| closure | function | No | | | + +## Create and populate a query and output the 'name' column data as an array + +```javascript +myQuery = QueryNew( '' ); +names = [ 'Indra','Elizabeth','Harry','Seth' ]; +queryAddColumn( myQuery,'name','varchar',names ); +result = queryColumnData( myQuery,'name' ); +Dump( var='#result#' ); +``` + +## Using a member function + +```javascript +myQuery = QueryNew( '' ); +names = [ 'Indra','Elizabeth','Harry','Seth' ]; +queryAddColumn( myQuery,'name','varchar',names ); +result = myQuery.columnData( 'name' ); +Dump( var='#result#' ); +``` diff --git a/docs/functions/querycolumnexists.md b/docs/functions/querycolumnexists.md new file mode 100644 index 000000000..8e4045eb2 --- /dev/null +++ b/docs/functions/querycolumnexists.md @@ -0,0 +1,42 @@ +# queryColumnExists + +Checks whether a column exists in the given query object + +```javascript +queryColumnExists(query, column) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +query.columnExists(column) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| column | string | Yes | | | + +## ID column is in given query + +```javascript +myQuery = queryNew("ID,name,age"); +writeOutput(queryColumnExists(myQuery,"ID")); +``` + +### Expected Result: YES + +## Whereas "gender" is not + +```javascript +myQuery = queryNew("ID,name,age"); +writeOutput(queryColumnExists(myQuery,"gender")); +``` + +### Expected Result: NO diff --git a/docs/functions/querycolumnlist.md b/docs/functions/querycolumnlist.md new file mode 100644 index 000000000..d76632bbd --- /dev/null +++ b/docs/functions/querycolumnlist.md @@ -0,0 +1,42 @@ +# queryColumnList + +Returns the column names of a query as a list. + +```javascript +queryColumnList(query [, delimiter]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +query.columnList([delimiter]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| delimiter | string | No | , | | + +## Create a query and output the column list + +```javascript +myQuery = queryNew( 'ID,name,age' ); +writeOutput( queryColumnList( myQuery ) ); +``` + +### Expected Result: ID,name,age + +## Using a member function + +```javascript +myQuery = queryNew( 'ID,name,age' ); +writeOutput( myQuery.columnList() ); +``` + +### Expected Result: ID,name,age diff --git a/docs/functions/queryconvertforgrid.md b/docs/functions/queryconvertforgrid.md new file mode 100644 index 000000000..69e949a35 --- /dev/null +++ b/docs/functions/queryconvertforgrid.md @@ -0,0 +1,49 @@ +# queryConvertForGrid + + Converts query data to a structure that contains a paged subset of the query. + +```javascript +queryConvertForGrid(query, page, pageSize) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | string | Yes | | No Help Available | +| page | numeric | Yes | | No Help Available | +| pageSize | numeric | Yes | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + + + + + + + #query# + + + +``` diff --git a/docs/functions/querycurrentrow.md b/docs/functions/querycurrentrow.md new file mode 100644 index 000000000..f61559485 --- /dev/null +++ b/docs/functions/querycurrentrow.md @@ -0,0 +1,55 @@ +# queryCurrentRow + +Returns the current row number + +```javascript +queryCurrentRow(query) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +query.currentRow() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | + +## Simple QueryCurrentRow Example + +Here we've example to get the currentRow number. + +```javascript + + + + #queryCurrentRow(myQuery)# + + +``` + +### Expected Result: 2 + +## Simple currentRow Example + +Here we've example to get the currentRow number from query using script syntax. + +```javascript + +var myQuery = queryNew("id,title","integer,varchar",[[1,"Charlottes Web"],[3,"The Outsiders"],[4,"Mieko and the Fifth Treasure"]]); +cfloop(query = "myQuery"){ + if (title Eq "Mieko and the Fifth Treasure"){ + writeOutput(myQuery.currentRow()); + } +} + +``` + +### Expected Result: 3 diff --git a/docs/functions/querydeletecolumn.md b/docs/functions/querydeletecolumn.md new file mode 100644 index 000000000..9741f42f6 --- /dev/null +++ b/docs/functions/querydeletecolumn.md @@ -0,0 +1,36 @@ +# queryDeleteColumn + +Deletes a column within a query object. + +```javascript +queryDeleteColumn(query, column) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +query.deleteColumn(column) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | Query to modify | +| column | string | Yes | | Name of the column to delete | + +## Deletes a column from the query + +Builds a simple query and removes the 'id' column. + +```javascript +news = queryNew("id,title", "integer,varchar", [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +queryDeleteColumn(news, 'id'); +writeOutput(serializeJSON(news)); +``` + +### Expected Result: {"COLUMNS":["TITLE"],"DATA":[["Dewey defeats Truman"],["Man walks on Moon"]]} diff --git a/docs/functions/querydeleterow.md b/docs/functions/querydeleterow.md new file mode 100644 index 000000000..e9789f3c9 --- /dev/null +++ b/docs/functions/querydeleterow.md @@ -0,0 +1,48 @@ +# queryDeleteRow + +Deletes a row within a query object. + +```javascript +queryDeleteRow(query [, row]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +query.deleteRow([row]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | Query to modify | +| row | numeric | No | -9999 | Index of the row to delete, starts at 1. If a row is not specified, the last row is removed. | + +## Implicit deletion of the last row + +Builds a simple query and removes the last row by not specifying a row index. + +```javascript +news = queryNew("id,title", "integer,varchar", [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +queryDeleteRow(news); +writeOutput(news['title'][1]); +``` + +### Expected Result: Dewey defeats Truman + +## Deletes a specific row from the query + +Builds a simple query and removes one of the rows. + +```javascript +news = queryNew("id,title", "integer,varchar", [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +queryDeleteRow(news, 1); +writeOutput(news['title'][1]); +``` + +### Expected Result: Man walks on Moon diff --git a/docs/functions/queryeach.md b/docs/functions/queryeach.md new file mode 100644 index 000000000..4444ac4ab --- /dev/null +++ b/docs/functions/queryeach.md @@ -0,0 +1,95 @@ +# queryEach + +Iterates over query rows and passes each row per iteration to a callback function + +```javascript +queryEach(query, function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +query.each(function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | query to loop over | +| callback | any | Yes | | Closure or a function reference that will be called for each of the iteration. | +| parallel | boolean | No | | Lucee4.5+ Executes closures parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ Maximum number of threads executed
If `parallel` argument is set to false it will be ignored | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| row | struct | No | A struct with all of the columns for the current iteration +| currentRow | numeric | No | The value for the current iteration +| query | query | No | A reference of the original struct + +## Iterate over query rows instead of cfloop() + +ACF2016+ and Lucee5+ + +```javascript + + news = queryNew("id,title", + "integer,varchar", [{ + "id": 1, + "title": "Dewey defeats Truman" + }, { + "id": 2, + "title": "Man walks on Moon" + }] + ); + function newsRow(row) { + writeOutput(""); + writeOutput("#row.id#"); + writeOutput("#row.title#"); + writeOutput(""); + } + + + + queryEach(news,newsRow); + +
+``` + +### Expected Result: 1 Dewey defeats Truman +2 Man walks on Moon + +## Iterate over query rows instead of cfloop() + +Lucee5+ + +```javascript + + news = queryNew("id,title", + "integer,varchar", [{ + "id": 1, + "title": "Dewey defeats Truman" + }, { + "id": 2, + "title": "Man walks on Moon" + }] + ); + function newsRow(row) { + writeOutput(""); + writeOutput("#row.id#"); + writeOutput("#row.title#"); + writeOutput(""); + } + + + #queryEach(news,newsRow)# +
+``` + +### Expected Result: 1 Dewey defeats Truman +2 Man walks on Moon diff --git a/docs/functions/queryevery.md b/docs/functions/queryevery.md new file mode 100644 index 000000000..abf90c729 --- /dev/null +++ b/docs/functions/queryevery.md @@ -0,0 +1,39 @@ +# queryEvery + +Executes a callback/closure against every row in a query and returns true if the callback/closure returned true for every row. + +```javascript +queryEvery(query, closure [, parallel] [, maxThreads]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +query.every(closure [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| closure | function | Yes | | | +| parallel | boolean | No | | | +| maxThreads | numeric | No | 20 | | + +## All values greater than 50 + +Find out if every value in the query is greater than 50 + +```javascript + +data = query(foo: [51,52,535]); +allGT50 = queryEvery(function(row){ return row.foo > 50; }); + +``` + +### Expected Result: true diff --git a/docs/functions/queryexecute.md b/docs/functions/queryexecute.md new file mode 100644 index 000000000..5bd677056 --- /dev/null +++ b/docs/functions/queryexecute.md @@ -0,0 +1,137 @@ +# queryExecute + +Executes a SQL query, returns the result. + +```javascript +queryExecute(sql [, params, options]) +``` + +```javascript +returns query +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| sql | string | Yes | | SQL string to execute. | +| params | any | No | | Array or Struct of parameter values. When passing an array use ? as place holders. When passing a struct use :keyName where keyName is the name of the key in the structure corresponding to the parameter. The struct or array can be a struct with keys such as the following. | +| options | struct | No | | Struct containing query options, all cfquery tag attributes are supported except the name attribute. | + +## Simple Example + +SQL Only Example. Assumes that a default datasource has been specified (by setting the variable this.datasource in Application.cfc) + +```javascript +qryResult = queryExecute("SELECT * FROM Employees"); +``` + +## Passing Query Parameters using Struct + +Use :structKeyName in your sql then pass a struct with corresponding key names. + +```javascript +qryResult = queryExecute("SELECT * FROM Employees WHERE empid = :empid AND country = :country", {country="USA", empid=1}); +``` + +## Passing Query Parameters using Array + +When passing with an array use the ? as a placeholder in your sql + +```javascript +qryResult = queryExecute("SELECT * FROM Employees WHERE empid = ? AND country = ?", [1,"USA"]); +``` + +## Passing Query Parameters using Struct of Structs + +If you need to pass the cfsqltype or other cfqueryparam attributes you can pass a struct for each param. + +```javascript +qryResult = queryExecute("SELECT * FROM Employees WHERE empid = :empid AND country = :country", {country={value="USA", cfsqltype="cf_sql_varchar"}, empid={value=1, cfsqltype="cf_sql_integer"}}); +``` + +## Specifying the Datasource + +If you have not defined the datasource using this.datasource in Application.cfc or want to explicitly specify the datasource use the third argument. + +```javascript +qryResult = queryExecute("SELECT * FROM Employees", {}, {datasource="myDataSourceName"}); +``` + +## Combined Example + +Complete example showing use of an sql statement, query parameters using Struct of Structs, while specifying the datasource . + +```javascript +sql = "SELECT * FROM Employees WHERE empid = :empid AND country = :country"; +qparams = structNew(); +qparams.empid = { value=1, cfsqltype="cf_sql_integer" }; +qparams.country = { value="Canada", cfsqltype="cf_sql_varchar" }; +options = { datasource="myDataSourceName" }; +qryResult = queryExecute(sql, qparams, options); +``` + +## Get Primary Key of INSERTed record + +To return the Generated Key of an INSERT query, you need to specify a result variable in the 3rd argument, options. +* Note your SQL must contain ONLY a single INSERT and no other SQL code or generatedKey will not be available. + +```javascript +queryExecute( "INSERT INTO employee ( firstname ) VALUES ( :firstname )", { firstname = { value="Han", cfsqltype="varchar" } }, { result="employee" } ); +writeDump( employee.generatedKey ); +``` + +## IN Query using lists + +Query the database using a list of values + +```javascript +keys = '1,2,3,4,5,6,7'; +data = queryExecute("select * from sometable where somecolumn in (:keys)",{keys={value=keys,list=true}}); +``` + +## Query of Queries + +Query a local database variable without going through your database + +```javascript +users = queryNew( "firstname", "varchar", [{"firstname":"Han"}] ); +subUsers = queryExecute( "select * from users", {}, { dbtype="query" } ); +writedump( subUsers ); +``` + +## Return Query as an Array of Structs - Lucee5+ + +Lucee5+ Return a query object converted into an array of structs. + +```javascript +users = queryNew( "firstname", "varchar", [{"firstname":"Han"}] ); +subUsers = queryExecute( "select * from users", {}, { dbtype="query", returntype="array" } ); +writedump( subUsers ); +``` + +### Expected Result: [ { firstname: "Han" } ] + +## Return Query as an Array of Structs - Lucee 4.5 + +Lucee4.5+ Return a query object converted into an array of structs. + +```javascript +users = queryNew( "firstname", "varchar", [{"firstname":"Han"}] ); +subUsers = queryExecute( "select * from users", {}, { dbtype="query", returntype="array-of-entities" } ); +writedump( subUsers ); +``` + +### Expected Result: [ { firstname: "Han" } ] + +## Return Query as a Struct of Structs + +Lucee5+ Return a query object converted into a struct of structs. (Struct key is based on the "columnkey" parameter) + +```javascript +users = queryNew( "id, firstname", "integer, varchar", [{"id":1, "firstname":"Han"}] ); +subUsers = queryExecute( "select * from users", {}, { dbtype="query", returntype="struct", columnkey="id" } ); +writedump( subUsers ); +``` + +### Expected Result: { 1: { id: 1, firstname: "Han" } } diff --git a/docs/functions/queryfilter.md b/docs/functions/queryfilter.md new file mode 100644 index 000000000..aacc7f9ac --- /dev/null +++ b/docs/functions/queryfilter.md @@ -0,0 +1,83 @@ +# queryFilter + +Filters query rows specified in filter criteria + +```javascript +queryFilter(query, function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads]) +``` + +```javascript +returns query +``` + +## Member Function Syntax + +```javascript +query.filter(function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | The query to filter | +| callback | boolean | Yes | | Closure or a function reference that will be called for each of the iteration. Returns true if the row should be included in the filtered query. | +| parallel | boolean | No | false | Lucee4.5+ CF2021+ true if the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ CF2021+ the maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| row | struct | No | A struct with all of the columns for the current iteration +| currentRow | numeric | No | The row number for the current iteration +| query | query | No | A reference of the original query + +## Filter a query + +```javascript +news = queryNew("id,type,title", "integer,varchar,varchar"); + queryAddRow(news,[{ + id: 1, + type: "book", + title: "Cloud Atlas" + },{ + id: 2, + type: "book", + title: "Lord of The Rings" + },{ + id: 3, + type: "film", + title: "Men in Black" + }]); + books = queryFilter(news,function(_news) { + return _news.type is 'book'; + }); + writeDump(valueList(books.title,', ')); +``` + +### Expected Result: Cloud Atlas, Lord of The Rings + +## Filter a query as member function + +```javascript +news = queryNew("id,type,title", "integer,varchar,varchar"); + queryAddRow(news,[{ + id: 1, + type: "book", + title: "Cloud Atlas" + },{ + id: 2, + type: "book", + title: "Lord of The Rings" + },{ + id: 3, + type: "film", + title: "Men in Black" + }]); + books = news.filter(function(_news) { + return _news.type is 'book'; + }); + writeDump(valueList(books.title,', ')); +``` + +### Expected Result: Cloud Atlas, Lord of The Rings diff --git a/docs/functions/querygetcell.md b/docs/functions/querygetcell.md new file mode 100644 index 000000000..1bb5ed498 --- /dev/null +++ b/docs/functions/querygetcell.md @@ -0,0 +1,49 @@ +# queryGetCell + +Returns data contained in that specific cell + +```javascript +queryGetCell(query, column_name [, row_number]) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +query.getCell(column_name [, row_number]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| column_name | string | Yes | | | +| row_number | numeric | No | -9999 | | + +## The simple querygetcell example + +Here we've example about querygetcell. We created query using queryNew() then we got the last title column value using querygetCell. If we give row number displays the particular row title value otherwise it displays last row value. + +```javascript + +#querygetcell(myQuery,'name')# +``` + +### Expected Result: Anil + +## The simple querygetcell (getCell) script based example + +Here we've the example to get particular column(title) value in script syntax + +```javascript + +var myQuery = queryNew("id,title","integer,varchar",[[1,"Charlottes Web"],[3,"The Outsiders"],[4,"Mieko and the Fifth Treasure"]]); +writeOutput(myQuery.getCell('title',2)); + +``` + +### Expected Result: The Outsiders diff --git a/docs/functions/querygetresult.md b/docs/functions/querygetresult.md new file mode 100644 index 000000000..1838003de --- /dev/null +++ b/docs/functions/querygetresult.md @@ -0,0 +1,35 @@ +# queryGetResult + + Returns the metadata of a query. + +```javascript +queryGetResult(query) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | The query whose metadata is to be returned. | + +## Retrieves query metadata using queryGetResult + +```javascript +fruit = queryNew("id,name", "integer,varchar", [ {"id":1,"name":"apple"}, {"id":2,"name":"banana"}, {"id":3,"name":"orange"}, {"id":4,"name":"peach"} ]); +myQuery = queryExecute( "select * from fruit where id < 4",{},{dbtype="query"}); +myResult = queryGetResult(myQuery); +writeDump(myResult); +``` + +## Retrieves query metadata using getResult member function + +```javascript +fruit = queryNew("id,name", "integer,varchar", [ {"id":1,"name":"apple"}, {"id":2,"name":"banana"}, {"id":3,"name":"orange"}, {"id":4,"name":"peach"} ]); +myQuery = queryExecute( "select * from fruit where id < 4",{},{dbtype="query"}); +myResult = myQuery.getResult(); +writeDump(myResult); +``` diff --git a/docs/functions/querygetrow.md b/docs/functions/querygetrow.md new file mode 100644 index 000000000..fe80dcb48 --- /dev/null +++ b/docs/functions/querygetrow.md @@ -0,0 +1,46 @@ +# queryGetRow + +Returns a struct having all the columns as keys and their corresponding values. + +```javascript +queryGetRow( query, rowNumber ); +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +someQuery.getRow(rowNumber) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | query object do get data from. | +| rowNumber | numeric | Yes | | position of the row to be returned. | + +## Use queryGetRow to return a struct + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +writeOutput( serializeJSON( queryGetRow(news, 1) ) ); +``` + +### Expected Result: {"title":"Dewey defeats Truman","id":1} + +## Use queryGetRow member syntax to return a struct + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +writeOutput( serializeJSON( news.getRow(1) ) ); +``` + +### Expected Result: {"title":"Dewey defeats Truman","id":1} diff --git a/docs/functions/queryinsertat.md b/docs/functions/queryinsertat.md new file mode 100644 index 000000000..6af0f353f --- /dev/null +++ b/docs/functions/queryinsertat.md @@ -0,0 +1,48 @@ +# queryInsertAt + +Inserts an element into a query at the indicate position. Elements with equal or greater positions are incremented by one. +Returns the updated query with the element inserted. + +```javascript +queryInsertAt(query,value,position) +``` + +```javascript +returns query +``` + +## Member Function Syntax + +```javascript +query.InsertAt(value,position) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | The original query object. | +| value | query | Yes | | The query object to insert. | +| position | numeric | Yes | | Index position at which to insert the query object. | + +## Example1 + +This is Example1 + +```javascript +qry=queryNew("rowid,name", "integer,varchar",[ [1, "Jay"],[2, "Bob"],[3, "Theodore"],[4, "William"] ]); +rufus=QueryNew("rowid,name","integer,varchar",[[42,"Rufus"]]); +queryInsertAt(qry,rufus,3); +WriteDump(qry); +``` + +## Member function version. + +Using the member function. + +```javascript +qry=queryNew("rowid,name", "integer,varchar",[ [1, "Jay"],[2, "Bob"],[3, "Theodore"],[4, "William"] ]); +rufus=QueryNew("rowid,name","integer,varchar",[[42,"Rufus"]]); +qry.InsertAt(rufus,3); +WriteDump(qry); +``` diff --git a/docs/functions/querykeyexists.md b/docs/functions/querykeyexists.md new file mode 100644 index 000000000..c5cf8d224 --- /dev/null +++ b/docs/functions/querykeyexists.md @@ -0,0 +1,37 @@ +# queryKeyExists + +Determines whether the specified column (key) is present in a query. + +```javascript +queryKeyExists(query, key) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +query.keyExists(key) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | Query Object to test. | +| key | string | Yes | | Key to test | + +## Check to see if column exists in Query + +Uses the member function syntax + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +writeOutput(news.keyExists("title")); +``` + +### Expected Result: YES diff --git a/docs/functions/querylazy.md b/docs/functions/querylazy.md new file mode 100644 index 000000000..8a5c00a74 --- /dev/null +++ b/docs/functions/querylazy.md @@ -0,0 +1,41 @@ +# querylazy + +Executes a SQL query without loading the data entirely to memory. Instead it calls the given Function with every single row + +```javascript +querylazy() +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| sql | string | Yes | | SQL to execute | +| listener | function | Yes | | listener function that will be called with the data of every single row. if returns false, execution is stopped. | +| params | any | No | | Array or Struct of parameter values.
When passing an array use ? as place holders.
When passing a struct use :keyName where keyName is the name of the key in the structure corresponding to
the parameter.
The struct or array can be a struct with keys such as the following: cfsqltype, list | +| options | struct | No | | Struct containing query options, all cfquery tag attributes are supported except the name attribute. | + +## QueryLazy Example + +This example demonstrates how to use the querylazy function to execute a query without loading the data entirely to memory. + +```javascript +records = 0 + queryLazy( + sql="SELECT * FROM users;", + listener=function(row){ + // Do something with a query row + records++; + }, + options={ + datasource:"MyDatasource" + } + ); + echo("Records: #records#"); +``` + +### Expected Result: Records: 10 diff --git a/docs/functions/querymap.md b/docs/functions/querymap.md new file mode 100644 index 000000000..b0f5e0383 --- /dev/null +++ b/docs/functions/querymap.md @@ -0,0 +1,60 @@ +# queryMap + +Maps each query row using a function to manipulate the rows fields + +```javascript +queryMap(query, function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads]) +``` + +```javascript +returns query +``` + +## Member Function Syntax + +```javascript +query.map(function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | query to process entries from | +| callback | boolean | Yes | | Closure or a function reference that will be called for each of the iteration. | +| parallel | boolean | No | false | Lucee4.5+ true if the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ the maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| row | struct | No | A struct with all of the columns for the current iteration +| currentRow | numeric | No | The value for the current iteration +| query | query | No | A reference of the original struct + +## Maps query results + +Manipulates query column + +```javascript +news = queryNew("id,title", + "integer,varchar", [{ + "id": 1, + "title": "Dewey defeats Truman" + }, { + "id": 2, + "title": "Man walks on Moon" + }] +); + +writeDump(news); + +function mapQuery(any Obj) { + if (Obj.id == 1) + Obj.title = "NEW: " & Obj.title; + return Obj; +} + +newQuery = QueryMap(news, mapQuery); +writeDump(newQuery); +``` diff --git a/docs/functions/querynew.md b/docs/functions/querynew.md new file mode 100644 index 000000000..fe788eab8 --- /dev/null +++ b/docs/functions/querynew.md @@ -0,0 +1,83 @@ +# queryNew + +Creates a new query object. The query can be populated with data using functions queryAddRow, querySetCell, or by passing it in to the rowData argument. + +```javascript +queryNew(columnList [, columnTypeList [, rowData]]) +``` + +```javascript +returns query +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| columnList | string | Yes | | A string or a variable that contains one. Delimited list
of column names, or an empty string. | +| columnTypeList | string | No | | CF7+ Comma-delimited list specifying column data types. | +| rowData | any | No | | CF10+ Data to populate the query. Can be a struct (with keys matching column names), an array of structs, or an array of arrays (in same order as columnList) | + +## Builds a simple query using queryNew + +Using Script with the queryAddRow querySetCell functions to populate the query. + +```javascript +news = queryNew("id,title", "integer,varchar"); +queryAddRow(news); +querySetCell(news, "id", "1"); +querySetCell(news, "title", "Dewey defeats Truman"); +queryAddRow(news); +querySetCell(news, "id", "2"); +querySetCell(news, "title", "Men walk on Moon"); +writeDump(news); +``` + +## Builds a simple query using queryNew + +Using CFML Tags with the queryAddRow querySetCell functions to populate the query. + +```javascript + + + + + + + + +``` + +## Creating and Populating a query using an array rowData in queryNew + +CF10+ Passes an array of structs to create a new query. + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +writeDump(news); +``` + +## Creating and Populating a single row query using rowData in queryNew + +CF10+ If you only need one row you can pass a single struct instead of an array into the rowData argument. + +```javascript +news = queryNew("id,title", + "integer,varchar", + {"id":1,"title":"Dewey defeats Truman"}); +writeDump(news); +``` + +## Creating and populating a query with an array of structs + +CF2018u5+ Directly assigns columns and values with an array of structs. + +```javascript +news = queryNew([ + {"id":1,"title":"Dewey defeats Truman"}, + {"id":2,"title":"Man walks on Moon"} +]); +writeDump(news); +``` diff --git a/docs/functions/queryprepend.md b/docs/functions/queryprepend.md new file mode 100644 index 000000000..1188c6b47 --- /dev/null +++ b/docs/functions/queryprepend.md @@ -0,0 +1,35 @@ +# queryPrepend + + Adds a query to the beginning of the current query. + +```javascript +queryPrepend(query1, query2) +``` + +```javascript +returns query +``` + +## Member Function Syntax + +```javascript +qry.prepend(query2) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query1 | query | Yes | | The initial query object. | +| query2 | query | Yes | | The query being added. | + +## Builds a simple query using queryNew and queryPrepend + +Add new query to the end of the current query using queryPrepend. + +```javascript +names = queryNew("empl_id,name", "integer,varchar", [["empl_id"=1239,"name"="John"]]); +newnames = queryNew("empl_id,name", "integer,varchar", [["empl_id"=1501,"name"="Jane"]]); +queryPrepend(names, newnames); +writeDump(names); +``` diff --git a/docs/functions/queryrecordcount.md b/docs/functions/queryrecordcount.md new file mode 100644 index 000000000..dbc3264fe --- /dev/null +++ b/docs/functions/queryrecordcount.md @@ -0,0 +1,40 @@ +# queryRecordCount + +Returns the number of rows given in the query object result set + +```javascript +queryRecordCount(query) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +query.recordCount() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | + +## Returns the record count of the query + +```javascript +heroes = queryNew("id,Name", + "integer,varchar", + [ + {"id":1,"Name":"Bruce Banner"}, + {"id":2,"Name":"Tony Stark"}, + {"id":3,"Name":"Bobby Drake"}, + {"id":4,"Name":"Jean Grey"} + ] + ) + writeDump(heroes.recordCount()); +``` + +### Expected Result: 4 diff --git a/docs/functions/queryreduce.md b/docs/functions/queryreduce.md new file mode 100644 index 000000000..a4430a2c1 --- /dev/null +++ b/docs/functions/queryreduce.md @@ -0,0 +1,53 @@ +# queryReduce + +Reduces query columns just like in array or collection + +```javascript +queryReduce(query, function(result, row [, currentRow] [, query]){} [, initialVal]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | query to process entries from | +| callback | any | Yes | | Closure or a function reference that will be called for each of the iteration. | +| initialValue | any | No | | initial value passed as part of the first closure call | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| result | any | No | The result of the reduce operation after the previous iteration +| row | struct | No | A struct with all of the columns for the current iteration +| currentRow | numeric | No | The value for the current iteration +| query | query | No | A reference of the original query + +## Reduce column to total + +Sum one query column + +```javascript +fruits = queryNew("fruit,amount", + "varchar,integer", [{ + "fruit": "apples", + "amount": 15 + }, { + "fruit": "pineapples", + "amount": 3 + }, { + "fruit": "strawberries", + "amount": 32 + }] + ); + total_fruits = queryReduce(fruits,function(a,b) { + return a + b.amount; + },0); + + writeOutput(total_fruits); +``` + +### Expected Result: 50 diff --git a/docs/functions/queryreverse.md b/docs/functions/queryreverse.md new file mode 100644 index 000000000..9c51530ef --- /dev/null +++ b/docs/functions/queryreverse.md @@ -0,0 +1,42 @@ +# queryReverse + +Returns a reversed version of the query + +```javascript +queryReverse(query) +``` + +```javascript +returns query +``` + +## Member Function Syntax + +```javascript +query.reverse() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | + +## Reverses a queries results + +```javascript +heroes = queryNew( + "id,Name", + "integer,varchar", + [ + {"id":1,"Name":"Bruce Banner"}, + {"id":2,"Name":"Tony Stark"}, + {"id":3,"Name":"Bobby Drake"}, + {"id":4,"Name":"Jean Grey"} + ] + ) +writeOutput("The query:
"); +writeDump(heroes); +writeOutput("The reversed query:
"); +writeDump(heroes.reverse()); +``` diff --git a/docs/functions/queryrowdata.md b/docs/functions/queryrowdata.md new file mode 100644 index 000000000..ec45c9926 --- /dev/null +++ b/docs/functions/queryrowdata.md @@ -0,0 +1,44 @@ +# queryRowData + +Returns the cells of a query row as a structure + +```javascript +queryRowData(query, rowNumber) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +query.rowData(rowNumber) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| rowNumber | numeric | Yes | | | + +## The simple queryRowData example + +Here we've a example to get the particular row value from myquery. + +```javascript + + +``` + +## The simple rowData example + +We've example to get the particular row value from myquery using script syntax. + +```javascript + +var myQuery = queryNew("id,title,author","integer,varchar,varchar",[[1,"Charlottes Web","E.B. White"],[3,"The Outsiders","S.E. Hinton"],[4,"Mieko and the Fifth Treasure","Eleanor Coerr"]]); +writeDump(myQuery.rowData(3)); + +``` diff --git a/docs/functions/queryrowswap.md b/docs/functions/queryrowswap.md new file mode 100644 index 000000000..376422c0e --- /dev/null +++ b/docs/functions/queryrowswap.md @@ -0,0 +1,45 @@ +# queryRowSwap + +In a query object, swap the record in the sourceRow with the record from the destinationRow. + +```javascript +queryRowSwap(query, sourceRow, destinationRow ) +``` + +```javascript +returns query +``` + +## Member Function Syntax + +```javascript +query.rowSwap(sourceRow, destinationRow) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | The original query object. | +| sourceRow | numeric | Yes | | The row to swap. | +| destinationRow | numeric | Yes | | The row to be swapped with. | + +## Example1 + +This is Example1 + +```javascript +qry=queryNew("rowid,name", "integer,varchar",[ [1, "Bob"],[2, "Theodore"],[3, "Jay"],[4, "William"] ]); +swap1=queryRowSwap(qry,1,4); +writeDump(swap1); +``` + +## Member function version. + +Using the member function. + +```javascript +qry=queryNew("rowid,name", "integer,varchar",[ [1, "Bob"],[2, "Theodore"],[3, "Jay"],[4, "William"] ]); +swap2=qry.rowSwap(1,4); +writeDump(swap2); +``` diff --git a/docs/functions/querysetcell.md b/docs/functions/querysetcell.md new file mode 100644 index 000000000..9dd53c826 --- /dev/null +++ b/docs/functions/querysetcell.md @@ -0,0 +1,51 @@ +# querySetCell + + Sets a cell to a value. If no row number is specified, + the cell on the last row is set. + +```javascript +querySetCell(query, column, value [, row]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +query.setCell(column, value [, row]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| column | string | Yes | | | +| value | any | Yes | | | +| row | numeric | No | | | + +## Tag Example + +```javascript + + + SELECT Course_ID, Descript + FROM Courses + + + +``` + +## Script member function example + +```javascript + + q = queryNew( "id,name"); + q.addRow(); + q.setCell("id", 1, 1); + q.setCell("name", "one", 1); + writeDump(q); + +``` diff --git a/docs/functions/querysetrow.md b/docs/functions/querysetrow.md new file mode 100644 index 000000000..b096db0f5 --- /dev/null +++ b/docs/functions/querysetrow.md @@ -0,0 +1,45 @@ +# querySetRow + +Adds a row to a query, either by struct or array + +```javascript +querySetRow(query, [rowNumber,] rowData) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someQuery.setRow([rowNumber,] rowData) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | The query object on which to set the row | +| rowNumber | numeric | No | 0 | Position of the row to be updated. If not provided or set to 0, a new row is added. | +| rowData | any | Yes | | A struct or array containing the row data | + +## Builds a simple query using queryNew and querySetRow + +Sets third row of query overwriting news entry + +```javascript +news = queryNew("id,title", "integer,varchar", [{"id"=1,"title"="Dewey defeats Truman"},{"id"=2,"title"="Men walk on Moon"},{"id"=3,"title"="Nixon Resigns"},{"id"=4,"title"="The Berlin Wall falls"}]); +querySetRow(news, 3, {"id"=5,"title"="The internet is born"}); +writeDump(news); +``` + +## Builds a simple query using queryNew and someQuery.setRow member syntax + +Sets third row of query overwriting news entry + +```javascript +news = queryNew("id,title", "integer,varchar", [{"id"=1,"title"="Dewey defeats Truman"},{"id"=2,"title"="Men walk on Moon"},{"id"=3,"title"="Nixon Resigns"},{"id"=4,"title"="The Berlin Wall falls"}]); +news.setRow(3, {"id"=5,"title"="The internet is born"}); +writeDump(news); +``` diff --git a/docs/functions/queryslice.md b/docs/functions/queryslice.md new file mode 100644 index 000000000..df07e9910 --- /dev/null +++ b/docs/functions/queryslice.md @@ -0,0 +1,53 @@ +# querySlice + +Returns a query containing a subset of another query + +```javascript +querySlice(query, offset [, length]) +``` + +```javascript +returns query +``` + +## Member Function Syntax + +```javascript +query.slice(offset [, length]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | | +| offset | numeric | Yes | | The first row to include in the new query | +| length | numeric | No | | The number of rows to include in the new query, defaults to all remaining rows | + +## Create a query with 4 rows and return a new query containing the 2nd and 3rd rows of the first + +```javascript +data = [ + [ 1,'James' ], + [ 2,'Alfred' ], + [ 3,'Amisha' ], + [ 4,'Terri' ] +]; +myQuery = QueryNew( 'ID,name','integer,varchar',data ); +result = QuerySlice( myQuery,2,2 ); +writeDump( var='#result#' ); +``` + +## Using a member function + +```javascript +data = [ + [ 1,'James' ], + [ 2,'Alfred' ], + [ 3,'Amisha' ], + [ 4,'Terri' ] +]; +myQuery = QueryNew( 'ID,name','integer,varchar',data ); +result = myQuery.slice( 2,2 ); +writeDump( var='#result#' ); +``` diff --git a/docs/functions/querysome.md b/docs/functions/querysome.md new file mode 100644 index 000000000..14bdb5e07 --- /dev/null +++ b/docs/functions/querysome.md @@ -0,0 +1,65 @@ +# querySome + +This function calls a given closure/function with every element in a given query and returns true, if one of the closure calls returns true + +```javascript +querySome(query, function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +query.some(function(row [, currentRow] [, query] ){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | query to filter entries from | +| callback | boolean | Yes | | Closure or a function reference that will be called for each of the iteration. | +| parallel | boolean | No | false | Lucee4.5+ true if the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ the maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| row | struct | No | A struct with all of the columns for the current iteration +| currentRow | numeric | No | The value for the current iteration +| query | query | No | A reference of the original struct + +## The simple Querysome example + +Here,we've example to check whether the 75 is exists or not in myquery mark column value. + +```javascript + +myQuery = queryNew("id,name,mark","integer,varchar,integer",[[1,"Rahu",75],[2,"Ravi",80]]); + result = querySome(myQuery , function(details){ + return details.mark IS 75; + }); + writeOutput((result ? "Some" : "No") & " matches Record found!"); + +``` + +### Expected Result: Some matches Record found! + +## The Query Member Function example + +Here,we've example to check whether the 85 is exists or not in myquery mark column value using query member function. + +```javascript + +myQuery = queryNew("id,name,mark","integer,varchar,integer",[[1,"Rahu",75],[2,"Ravi",80]]); + result = myQuery.Some(function(details){ + return details.mark IS 85; + }); + writeOutput((result ? "Some" : "No") & " matches Record found!"); + +``` + +### Expected Result: No matches Record found! diff --git a/docs/functions/querysort.md b/docs/functions/querysort.md new file mode 100644 index 000000000..a9fbc3848 --- /dev/null +++ b/docs/functions/querysort.md @@ -0,0 +1,140 @@ +# querySort + +Sorts a query. + +```javascript +querySort(query, sortFunction) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +query.sort(sortFunction) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | The query to sort | +| sortFunction | function | Yes | | CF2016+ or Lucee5.1.0.13+ a function with two arguments each corresponding to a query row. The function returns -1 if first row is less than second, 0 if equal, or 1 if first row is greater than second. Lucee4.5+ accepts a column name to sort by instead of a function. | +| direction | string | No | | Lucee4.5+ Only supported on Lucee when second argument is a column name instead of a callback function. | + +## Sort a query using the querySort function on a column with date values in ascending order + +```javascript +//build a query +exampleQuery = queryNew( + "id,createdDate", + "integer,timestamp", + [ + {id=1, createdDate=dateAdd("d", randRange(-100, 100), now())}, + {id=2, createdDate=dateAdd("d", randRange(-100, 100), now())}, + {id=3, createdDate=dateAdd("d", randRange(-100, 100), now())}, + {id=4, createdDate=dateAdd("d", randRange(-100, 100), now())}, + {id=5, createdDate=dateAdd("d", randRange(-100, 100), now())} + ] +); +//sort it +querySort(exampleQuery, function(rowA, rowB) { + return dateCompare(rowA.createdDate, rowB.createdDate); +}); +//dump it +writeDump(exampleQuery); +``` + +## Sort a query using a sort member function on a column with date values in descending order + +```javascript +//build a query +exampleQuery = queryNew( + "id,createdDate", + "integer,timestamp", + [ + {id=1, createdDate=dateAdd("d", randRange(-100, 100), now())}, + {id=2, createdDate=dateAdd("d", randRange(-100, 100), now())}, + {id=3, createdDate=dateAdd("d", randRange(-100, 100), now())}, + {id=4, createdDate=dateAdd("d", randRange(-100, 100), now())}, + {id=5, createdDate=dateAdd("d", randRange(-100, 100), now())} + ] +); +//sort it +exampleQuery.sort(function(rowA, rowB) { + return -(dateCompare(rowA.createdDate, rowB.createdDate)); +}); +//dump it +writeDump(exampleQuery); +``` + +## Sort a query using a sort member function on a column with string values in ascending order + +```javascript +//build a query +exampleQuery = queryNew( + "id,description", + "integer,varchar", + [ + {id=1, description="dog"}, + {id=2, description="cat"}, + {id=3, description="bird"}, + {id=4, description="zebra"}, + {id=5, description="snake"} + ] +); +//sort it +exampleQuery.sort(function(rowA, rowB) { + return compare(rowA.description, rowB.description); +}); +//dump it +writeDump(exampleQuery); +``` + +## Sort a query using the querySort function on a column with string values in descending order + +```javascript +//build a query +exampleQuery = queryNew( + "id,description", + "integer,varchar", + [ + {id=1, description="dog"}, + {id=2, description="cat"}, + {id=3, description="bird"}, + {id=4, description="zebra"}, + {id=5, description="snake"} + ] +); +//sort it +querySort(exampleQuery, function(rowA, rowB) { + return -(compare(rowA.description, rowB.description)); +}); +//dump it +writeDump(exampleQuery); +``` + +## Sort a query using the querySort function on a column with numeric values in ascending order + +```javascript +//build a query +exampleQuery = queryNew( + "id,description", + "integer,varchar", + [ + {id=3, description="dog"}, + {id=5, description="cat"}, + {id=4, description="bird"}, + {id=1, description="zebra"}, + {id=2, description="snake"} + ] +); +//sort it +querySort(exampleQuery, function(rowA, rowB) { + return val(rowA.id) < val(rowB.id) ? -1 : val(rowA.id) == val(rowB.id) ? 0 : 1; +}); +//dump it +writeDump(exampleQuery); +``` diff --git a/docs/functions/quotedvaluelist.md b/docs/functions/quotedvaluelist.md new file mode 100644 index 000000000..3ded780ee --- /dev/null +++ b/docs/functions/quotedvaluelist.md @@ -0,0 +1,32 @@ +# quotedValueList + + Gets the values of each record returned from an executed query. + CFML does not evaluate the arguments + +```javascript +quotedValueList(column [, delimiter]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| column | query | Yes | | Name of an executed query and column. Separate query name
and column name with a period. | +| delimiter | string | No | , | | + +## Tag Example + +```javascript + + SELECT * + FROM CourseList + WHERE Dept_ID IN ('#GetDepartments.Dept_ID#') + + + #quotedValueList(GetCourseList.CorNumber,";")# + +``` diff --git a/docs/functions/rand.md b/docs/functions/rand.md new file mode 100644 index 000000000..2563da784 --- /dev/null +++ b/docs/functions/rand.md @@ -0,0 +1,33 @@ +# rand + + Generates a pseudo-random number in the range 0 - 1. + +```javascript +rand([algorithm]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| algorithm | string | No | CFMX_COMPAT | The algorithm to use to generated the random number. | /Users/garethedwards/development/github/cfdocs/docs/functions/rand.md|IBMSecureRandom | + +## simple example Using rand() + +To generate a random number between 0 to 1 + +```javascript +writeOutput( rand() ); +``` + +## simple example Using rand() with algorithm + +To generate a random number between 0 to 1 by using CFMX_COMPAT algorithm + +```javascript +writeOutput( rand('CFMX_COMPAT') ); +``` diff --git a/docs/functions/randomize.md b/docs/functions/randomize.md new file mode 100644 index 000000000..653afa5dc --- /dev/null +++ b/docs/functions/randomize.md @@ -0,0 +1,30 @@ +# randomize + + Seeds the pseudo-random number generator with an + integer number, ensuring repeatable number patterns. + +```javascript +randomize(number [, algorithm]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| number | numeric | Yes | | | | +| algorithm | string | No | CFMX_COMPAT | The algorithm to use to generated the random number. | /Users/garethedwards/development/github/cfdocs/docs/functions/randomize.md|IBMSecureRandom | + +## Tag Example + +The following example calls the Randomize function to seed the random number generator and generates 10 random numbers. + +```javascript + + + #rand()# + +``` diff --git a/docs/functions/randrange.md b/docs/functions/randrange.md new file mode 100644 index 000000000..5f9faad97 --- /dev/null +++ b/docs/functions/randrange.md @@ -0,0 +1,50 @@ +# randRange + +Generates a random integer between two specified numbers. + Requests for random integers that are greater than 100,000,000 + result in non-random numbers, to prevent overflow during + internal computations. + +```javascript +randRange(number1, number2 [, algorithm]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| number1 | numeric | Yes | | | | +| number2 | numeric | Yes | | | | +| algorithm | string | No | CFMX_COMPAT | CF7+ The algorithm to use to generated the random number. | /Users/garethedwards/development/github/cfdocs/docs/functions/randrange.md|NativePRNGNonBlocking | + +## Tag Example + +The following example calls the Randomize function to seed the random number generator and generates 10 random numbers. + +```javascript + + + + +

+ RandRange returned: #randRange(local.myInt, local.myInt2, "SHA1PRNG")# +

+``` + +## Script Example + +```javascript + + bytes = []; + bytecount = 32; + arrayResize( bytes, byteCount ); + for ( i = 1 ; i <= byteCount ; i++ ) { + bytes[ i ] = randRange( -128, 127, "SHA1PRNG" ); + } + + +``` diff --git a/docs/functions/reescape.md b/docs/functions/reescape.md new file mode 100644 index 000000000..a43fd854d --- /dev/null +++ b/docs/functions/reescape.md @@ -0,0 +1,25 @@ +# reEscape + +Escapes regular expression control characters within a string. + +```javascript +reEscape(string); +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The string you that to escape. | + +## Example of reEscape + +```javascript +reEscape('*.{}[]exam?ple') +``` + +### Expected Result: \*\.\{\}\[\]exam\?ple diff --git a/docs/functions/refind.md b/docs/functions/refind.md new file mode 100644 index 000000000..4612a32a3 --- /dev/null +++ b/docs/functions/refind.md @@ -0,0 +1,33 @@ +# reFind + +Uses a regular expression (RE) to search a string for a pattern, starting from a specified position. The search is case-sensitive. + +It will return `numeric` if `returnsubexpressions` is `false` and a `struct` of arrays named "len", "match" and "pos" when `returnsubexpressions` is `true`. + +```javascript +reFind(reg_expression, string [, start] [, returnsubexpressions]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| reg_expression | string | Yes | | | | +| string | string | Yes | | A string or a variable that contains one. String in which
to search. | | +| start | numeric | No | 1 | | | +| returnsubexpressions | boolean | No | NO | True: if the regular expression is found, the first array
element contains the length and position, respectively,
of the first match.
If the regular expression contains parentheses that
group subexpressions, each subsequent array element
contains the length and position, respectively, of
the first occurrence of each group.
If the regular expression is not found, the arrays each
contain one element with the value 0.
False: the function returns the position in the string
where the match begins. Default. | | +| scope | string | No | one | CF2016+ * one: returns the first value that matches the regex.
* all: returns all values that match the regex. | /Users/garethedwards/development/github/cfdocs/docs/functions/refind.md|all | + +## Find an integer in a string + +This example uses reFind to locate an integer in a string, and returns the position of the integer in the string. + +```javascript +reFind("[0-9]+", "test 123!") +``` + +### Expected Result: 6 diff --git a/docs/functions/refindnocase.md b/docs/functions/refindnocase.md new file mode 100644 index 000000000..e5af43493 --- /dev/null +++ b/docs/functions/refindnocase.md @@ -0,0 +1,39 @@ +# reFindNoCase + +Uses a regular expression (RE) to search a string for a pattern, starting from a specified position. The search is case-insensitive. + +```javascript +reFindNoCase(reg_expression, String [, start] [, returnsubexpressions]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| reg_expression | string | Yes | | | | +| string | string | Yes | | A string or a variable that contains one. String in which
to search. | | +| start | numeric | No | 1 | | | +| returnsubexpressions | boolean | No | NO | True: if the regular expression is found, the first array
element contains the length and position, respectively,
of the first match.
If the regular expression contains parentheses that
group subexpressions, each subsequent array element
contains the length and position, respectively, of
the first occurrence of each group.
If the regular expression is not found, the arrays each
contain one element with the value 0.
False: the function returns the position in the string
where the match begins. Default. | | +| scope | string | No | one | CF2016+ * one: returns the first value that matches the regex.
* all: returns all values that match the regex. | /Users/garethedwards/development/github/cfdocs/docs/functions/refindnocase.md|all | + +## Script Syntax + +```javascript +reFindNoCase("E", "test 123!") +``` + +### Expected Result: 2 + +## Script Syntax + +CF2016+ example with all optional arguments + +```javascript +serializeJSON(reFindNoCase("E", "test 123!", 1, true, "ALL")) +``` + +### Expected Result: [{ "len":[1], "match":["e"], "pos":[2]}] diff --git a/docs/functions/releasecomobject.md b/docs/functions/releasecomobject.md new file mode 100644 index 000000000..d4d851746 --- /dev/null +++ b/docs/functions/releasecomobject.md @@ -0,0 +1,17 @@ +# releaseCOMObject + + Releases a COM Object and frees up resources that it used. + +```javascript +releaseCOMObject(objectName) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| objectName | any | Yes | | | diff --git a/docs/functions/rematch.md b/docs/functions/rematch.md new file mode 100644 index 000000000..8d582a69c --- /dev/null +++ b/docs/functions/rematch.md @@ -0,0 +1,28 @@ +# reMatch + +Uses a regular expression (RE) to search a string for a pattern, starting from a specified position. + +```javascript +reMatch(reg_expression, string) +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| reg_expression | string | Yes | | Regular expression for which to search. Case-sensitive. | +| string | string | Yes | | A string or a variable that contains one. String in which to search. | + +## Simple reMatch Example + +Extracts numbers from a string and returns them as an array + +```javascript +serializeJSON( reMatch("[0-9]+", "1 way to extract any number like 45, 38") ) +``` + +### Expected Result: ["1","45","38"] diff --git a/docs/functions/rematchnocase.md b/docs/functions/rematchnocase.md new file mode 100644 index 000000000..216a361f7 --- /dev/null +++ b/docs/functions/rematchnocase.md @@ -0,0 +1,27 @@ +# reMatchNoCase + +Uses a regular expression (RE) to search a string for a pattern, starting from a specified position. + +```javascript +reMatchNoCase(reg_expression, string) +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| reg_expression | string | Yes | | Regular expression for which to search. Case insensitive. | +| string | string | Yes | | A string or a variable that contains one. String in which to search. | + +## reMatchNoCase Example + +Uses a regular expression (RE) to search a string for a pattern. + +```javascript +string = "1234AbcacAcdd"; + writeDump(reMatchNoCase("[A-Z]+",string)) ; +``` diff --git a/docs/functions/removecachedquery.md b/docs/functions/removecachedquery.md new file mode 100644 index 000000000..3d2b5c4f5 --- /dev/null +++ b/docs/functions/removecachedquery.md @@ -0,0 +1,34 @@ +# removeCachedQuery + + Removes the query with the details you provide from query cache. + +```javascript +removeCachedQuery(SQL_, datasource, params, region___); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| SQL | string | Yes | | The Query SQL. | +| datasource | string | Yes | | The datasource you ran the query on. | +| params | array | No | | Array of parameter values passed to SQL. | +| region | string | No | | Specifies the cache region where you can place the cache object. | + +## Tag Syntax + +the in-memory file system memory set in cfadmin and should return that. + +```javascript + + + SELECT * from art where artid = + + + + +``` diff --git a/docs/functions/removechars.md b/docs/functions/removechars.md new file mode 100644 index 000000000..9f94f9b3e --- /dev/null +++ b/docs/functions/removechars.md @@ -0,0 +1,27 @@ +# removeChars + + Removes characters from a string. + +```javascript +removeChars(String, start, count) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | The string or variable containing a string to process. | +| start | numeric | Yes | | The starting position in the string to process. | +| count | numeric | Yes | | Number of characters to remove. | + +## Remove a string + +```javascript +removeChars('Hello CFML World',6,5) +``` + +### Expected Result: Hello World diff --git a/docs/functions/render.md b/docs/functions/render.md new file mode 100644 index 000000000..26392dff4 --- /dev/null +++ b/docs/functions/render.md @@ -0,0 +1,39 @@ +# render + +Executes CFML/Lucee code that you provide as a string. + +```javascript +render(CFML[, dialect ]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript + +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| CFML | string | Yes | | String to evaluate including some CFML/Lucee code | /Users/garethedwards/development/github/cfdocs/docs/functions/render.md| | +| dialect | string | No | current template's dialect | The dialect you want details for | /Users/garethedwards/development/github/cfdocs/docs/functions/render.md|Lucee | + +## Execute replace using render + +Description of the code example + +```javascript +str = 'hello world'; +savecontent variable="changed"{ +render("#replace(str,'world','universe')#!"); +} +writeOutput(str); +writeOutput(changed); +``` + +### Expected Result: hello worldhello universe! diff --git a/docs/functions/repeatstring.md b/docs/functions/repeatstring.md new file mode 100644 index 000000000..edad2153e --- /dev/null +++ b/docs/functions/repeatstring.md @@ -0,0 +1,28 @@ +# repeatString + + Creates a string that contains a specified number of + repetitions of the specified string. + +```javascript +repeatString(String, count) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| count | numeric | Yes | | | + +## Script Syntax + +```javascript +getVal = repeatString("ColdFusion ", 3); + writeDump(getVal); +``` + +### Expected Result: Expected Result: ColdFusion ColdFusion ColdFusion diff --git a/docs/functions/replace.md b/docs/functions/replace.md new file mode 100644 index 000000000..28fe2a564 --- /dev/null +++ b/docs/functions/replace.md @@ -0,0 +1,74 @@ +# replace + +Replaces occurrences of substring1 in a string with obj, in a specified scope. The search is case-sensitive. Function returns original string with replacements made. + +```javascript +replace(string, substring1, obj [, scope]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.replace(substring1, obj[, scope]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | String to search | +| substring1 | string | Yes | | Substring to find within string | +| obj | any | Yes | | String to replace substring1 with. As of CF2016+ you can also pass a callback function in this argument `function(transform, position, original)`. | +| scope | string | No | one | * one: replace the first occurrence
* all: replace all occurrences | +| start | numeric | No | 1 | CF2021+ Position to start searching in the string. | + +## Replace uppercase 'U' with lowercase 'u' + +Replace in Script Syntax + +```javascript +getVal = replace("ColdFUsion", "U", "u"); +writeDump(getVal); +``` + +### Expected Result: ColdFusion + +## Replace uppercase 'O' with lowercase 'o', but only once + +Something similar in Tag Syntax + +```javascript + + +``` + +### Expected Result: ColdFusiOn + +## Example using Callback Function + +In CF2016+ you can pass in a callback function to the third argument of the `replace` function + +```javascript +public function upCase(pattern, position, orig) { + return uCase(pattern); +} +result = replace("A man a plan a canal.","an", upCase , "ALL"); +writeOutput(result); +``` + +### Expected Result: A mAN a plAN a cANal. + +## Example with start argument (Replace lowercase 'o' with uppercase 'O' from the third position) + +In CF2021+ you can pass position to start searching in the string + +```javascript +getRes = replace("Love ColdFusion", "o", "O","ALL","3"); +writeOutput(getRes); +``` + +### Expected Result: Love COldFusiOn diff --git a/docs/functions/replacelist.md b/docs/functions/replacelist.md new file mode 100644 index 000000000..b3b1a91e7 --- /dev/null +++ b/docs/functions/replacelist.md @@ -0,0 +1,35 @@ +# replaceList + +Replaces occurrences of the elements from a delimited list + in a string with corresponding elements from another delimited + list. The search is case-sensitive. + +```javascript +replaceList(String, list1, list2 [, includeEmptyFields]) +replaceList(String, list1, list2, delimiter [, includeEmptyFields]) +replaceList(String, list1, list2, delimiterList1, delimiterList2 [, includeEmptyFields]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | A string, or a variable that contains one, within which to replace substring | +| list1 | string | Yes | | List of substrings for which to search | +| list2 | string | Yes | | List of replacement substrings | +| delimiter | string | No | , | Common delimiter for both search and replacement. | +| delimiterList1 | string | No | , | Delimiter for search. | +| delimiterList2 | string | No | , | Delimiter for replacement. | +| includeEmptyFields | boolean | No | false | When true, zero-length list elements are preserved. | + +## Tag Example + +```javascript +#replaceList("My Test String", "Test, String", "Replaced, Sentence")# +``` + +### Expected Result: My Replaced Sentence diff --git a/docs/functions/replacelistnocase.md b/docs/functions/replacelistnocase.md new file mode 100644 index 000000000..f0e658868 --- /dev/null +++ b/docs/functions/replacelistnocase.md @@ -0,0 +1,36 @@ +# replaceListNoCase + +Replaces occurrences of the elements from a delimited list in a string with corresponding elements from another delimited list. The search is case-insensitive. + +```javascript +replaceListNoCase(string, list1, list2, includeEmptyFields) +replaceListNoCase(string, list1, list2, delimiter, includeEmptyFields) +replaceListNoCase(string, list1, list2, delimiterList1, delimiterList2, includeEmptyFields) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | A string, or a variable that contains one, within which to replace substring | +| list1 | string | Yes | | List of substrings for which to search | +| list2 | string | Yes | | List of replacement substrings | +| delimiter | string | No | , | Common delimiter for both search and replacement. | +| delimiterList1 | string | No | , | Delimiter for search. | +| delimiterList2 | string | No | , | Delimiter for replacement. | +| includeEmptyFields | boolean | No | false | When true, zero-length list elements are preserved. | + +## Tag Example + +```javascript + + + +#replaceListNoCase(myString, mySubstring1, mySubString2)# +``` + +### Expected Result: My Replaced Sentence diff --git a/docs/functions/replacenocase.md b/docs/functions/replacenocase.md new file mode 100644 index 000000000..13461e22a --- /dev/null +++ b/docs/functions/replacenocase.md @@ -0,0 +1,45 @@ +# replaceNoCase + +Replaces occurrences of substring1 with callback, in the specified scope. The search is case-insensitive. + +```javascript +replaceNoCase(string, substring1, callback [, scope]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.replaceNoCase(substring1, callback[, scope]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | A string (or variable that contains one) within which to replace substring | +| substring1 | string | Yes | | A string (or variable that contains one) to replace, if found. | +| callback | any | Yes | | String to replace substring1 with. As of CF2018+ you can also pass a callback function in this argument `function(transform, position, original)`. | +| scope | string | No | | * one: Replace the first occurrence (default)
* all: Replace all occurrences | +| start | numeric | No | 1 | CF2021+ Position to start searching in the string. | + +## Script Syntax + +```javascript +getVal = replaceNoCase("ColdFUsion", "u", "a"); +writeDump(getVal); +``` + +### Expected Result: Expected Result: ColdFasion + +## Tag Syntax + +```javascript + + +``` + +### Expected Result: Expected Result: CaldFusian diff --git a/docs/functions/rereplace.md b/docs/functions/rereplace.md new file mode 100644 index 000000000..9dd2a8e0b --- /dev/null +++ b/docs/functions/rereplace.md @@ -0,0 +1,46 @@ +# reReplace + +Uses a regular expression (regex) to search a string for a string pattern and replace it with another. The search is case-sensitive. + +```javascript +reReplace(string, regex, substring [, scope]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.reReplace(regex, substring[, scope]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| string | string | Yes | | A string or a variable that contains one | | +| regex | string | Yes | | Regular expression to replace. | | +| substring | string | Yes | | A string or a variable that contains one. Replaces substring with the regex match | | +| scope | string | No | one | * one: Replace the first occurrence of the regular
expression. Default.
* all: Replace all occurrences of the regular expression. | /Users/garethedwards/development/github/cfdocs/docs/functions/rereplace.md|all | + +## Strip Characters Using reReplace + +This example strips out all characters except a-z and 0-9. + +```javascript +reReplace("test 123!", "[^a-z0-9]", "", "ALL") +``` + +### Expected Result: test123 + +## Extract Characters Using Back Reference + +Uses a back reference: \1 to extract the pattern contained within the parenthesis. + +```javascript +reReplace("123abc456", "[0-9]+([a-z]+)[0-9]+", "\1") +``` + +### Expected Result: abc diff --git a/docs/functions/rereplacenocase.md b/docs/functions/rereplacenocase.md new file mode 100644 index 000000000..a417ce207 --- /dev/null +++ b/docs/functions/rereplacenocase.md @@ -0,0 +1,48 @@ +# reReplaceNoCase + +Uses a regular expression to search a string for a string + pattern and replace it with another. The search is + case-insensitive. + +```javascript +reReplaceNoCase(String, reg_expression, substring[, scope]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.reReplaceNoCase(reg_expression, substring[, scope]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| String | string | Yes | | A string or a variable that contains one | | +| reg_expression | string | Yes | | Regular expression to replace. | | +| substring | string | Yes | | A string or a variable that contains one. Replaces
reg_expression | | +| scope | string | No | | * one: Replace the first occurrence of the regular
expression. Default.
* all: Replace all occurrences of the regular expression. | /Users/garethedwards/development/github/cfdocs/docs/functions/rereplacenocase.md|all | + +## Strip Characters Using ReReplace + +This example strips out all characters except a-z and 0-9. + +```javascript +reReplaceNoCase("test 123!", "[^a-z0-9]", "", "ALL") +``` + +### Expected Result: test123 + +## Extract Characters Using Back Reference + +Uses a back reference: \1 to extract the pattern contained within the parenthesis. + +```javascript +reReplaceNoCase("123abc456", "[0-9]+([a-z]+)[0-9]+", "\1") +``` + +### Expected Result: abc diff --git a/docs/functions/restdeleteapplication.md b/docs/functions/restdeleteapplication.md new file mode 100644 index 000000000..0c777f125 --- /dev/null +++ b/docs/functions/restdeleteapplication.md @@ -0,0 +1,23 @@ +# restDeleteApplication + + Unregisters the directory path if it is already registered. + +```javascript +restDeleteApplication('dirPath'); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| dirPath | string | Yes | | Path to the directory to be unregistered. If the path is not valid, it results in an error. | + +## Tag Syntax + +```javascript + +``` diff --git a/docs/functions/restinitapplication.md b/docs/functions/restinitapplication.md new file mode 100644 index 000000000..dcc104ff4 --- /dev/null +++ b/docs/functions/restinitapplication.md @@ -0,0 +1,26 @@ +# restInitApplication + +Scans all the CFCs in dirPath, and places those that are REST enabled at the serviceMapping URL. Requires the web admin password under Lucee. + +```javascript +restInitApplication(dirPath,serviceMapping,default,password) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| dirPath | string | Yes | | The path to a folder of CFCs to scan. Should be a full file system path | +| serviceMapping | string | Yes | | The root of the exposed API, minus the server-wide prefix. E.g. to expose at '/rest/api/' you should set this to 'api'. | +| default | string | No | | If the mapping is a default mapping set this to true (Lucee only) | +| password | string | Yes | | The password for the web admin (Lucee only) | + +## Recreate the CFCs available at /rest/api (Lucee) + +```javascript +restInitApplication( dirPath=expandPath('./cfcs/api/'),serviceMapping='api',password='password' ) +``` diff --git a/docs/functions/restsetresponse.md b/docs/functions/restsetresponse.md new file mode 100644 index 000000000..bbbcf2d2d --- /dev/null +++ b/docs/functions/restsetresponse.md @@ -0,0 +1,37 @@ +# restSetResponse + + Sets the custom responses. + +```javascript +restSetResponse(response); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| response | struct | Yes | | A struct that contains the response details. | + +## Tag Syntax + +restSetResponse() can only be used on function with a return type of void. It will cause errors if it is used on functions that have any other return type. + +```javascript + + + + '&name&' + '>, + headers={ + location='http://localhost:8500/rest/CustomerService/customers/123', + } + }> + + +``` diff --git a/docs/functions/reverse.md b/docs/functions/reverse.md new file mode 100644 index 000000000..39b997819 --- /dev/null +++ b/docs/functions/reverse.md @@ -0,0 +1,34 @@ +# reverse + + Reverses the order of items, such as the characters in a + string and the digits in a number + +```javascript +reverse(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | A string or a variable that contains one | + +## Reverse a string + +```javascript +reverse('Hello World') +``` + +### Expected Result: dlroW olleH + +## Reverse a number + +```javascript +reverse(123456789) +``` + +### Expected Result: 987654321 diff --git a/docs/functions/right.md b/docs/functions/right.md new file mode 100644 index 000000000..9b7f26c08 --- /dev/null +++ b/docs/functions/right.md @@ -0,0 +1,69 @@ +# right + + Gets a specified number of characters from a string, + beginning at the right. + +```javascript +right(String, count) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| count | numeric | Yes | | An integer or a variable that contains one.
Number of characters to return. | + +## Using right() on a string + +In this example we'll use right() to return part of a string. + +```javascript +writeOutput( right( 'The quick brown fox jumped over the lazy dog', 8 ) ); +``` + +### Expected Result: lazy dog + +## Using right() with a negative count on a string + +In this example we'll use a negative count right() to return part of a string. CF2018+ + +```javascript +writeOutput( right( 'The quick brown fox jumped over the lazy dog', -32 ) ); +``` + +### Expected Result: the lazy dog + +## Using right() in a function + +In this example we'll use right() in a function to help us to capitalize the last letter in a string. + +```javascript +public string function capitalizeLast( required string text ) { + return left( arguments.text, len( arguments.text ) - 1 ) & uCase( right( arguments.text, 1 ) ); +} +``` + +## Using right() to test values + +In this example we'll use right() to test the last five characters of a request context variable. + +```javascript +if( listFindNoCase( 'super,great,coder,rulez', right( rc.answer, 5 ) ) ) { + writeOutput( 'You are an awesome developer!' ); +} +``` + +## Using right() as a member function + +CF11+ Lucee4.5+ In this example we'll use right() as a member function inside a function to help us to capitalize the last letter in a string. + +```javascript +public string function capitalizeLast( required string text ) { + return arguments.text.left( arguments.text.len() - 1 ) & arguments.text.right( 1 ).ucase(); +} +``` diff --git a/docs/functions/rjustify.md b/docs/functions/rjustify.md new file mode 100644 index 000000000..5e5879ed9 --- /dev/null +++ b/docs/functions/rjustify.md @@ -0,0 +1,28 @@ +# rJustify + + Right justifies characters of a string. + +```javascript +rJustify(String, length) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| length | numeric | Yes | | | + +## Tag Example + +```javascript + + + +
~#result#~
+
+``` diff --git a/docs/functions/round.md b/docs/functions/round.md new file mode 100644 index 000000000..18af3cd7a --- /dev/null +++ b/docs/functions/round.md @@ -0,0 +1,41 @@ +# round + + Rounds a number to the closest integer. + +```javascript +round(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Round 1.56 + +```javascript +round(1.56) +``` + +### Expected Result: 2 + +## Round 1.49 + +```javascript +round(1.49) +``` + +### Expected Result: 1 + +## Round -0.9 + +```javascript +round(-0.9) +``` + +### Expected Result: -1 diff --git a/docs/functions/rtrim.md b/docs/functions/rtrim.md new file mode 100644 index 000000000..e70c70279 --- /dev/null +++ b/docs/functions/rtrim.md @@ -0,0 +1,25 @@ +# rTrim + + Removes spaces from the end of a string. + +```javascript +rTrim(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | A string or a variable that contains one | + +## Right Trim + +```javascript +'>' & rTrim(' CFDocs ') & '<' +``` + +### Expected Result: > CFDocs< diff --git a/docs/functions/runasync.md b/docs/functions/runasync.md new file mode 100644 index 000000000..991b85161 --- /dev/null +++ b/docs/functions/runasync.md @@ -0,0 +1,58 @@ +# runAsync + +A function that returns a Future object, which is an eventual result of an asynchronous operation + +```javascript +runAsync(function() {}) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| callback | function | No | | Closure function that returns a result to be resolved. | +| timeout | numeric | No | 1000 | Timeout for the asynchronous process in milliseconds | + +## Run a function asynchronously and get the result + +```javascript +future = runAsync(function(){ + return "Hello World!"; +}); +writeOutput(future.get()); +``` + +### Expected Result: Hello World! + +## Run a function after the asynchronous function and use a five milliseconds timeout when calling get() + +```javascript +future = runAsync(function(){ + return 5; +}).then(function(input){ + return input + 2; +}); +result = future.get(3); // 3 is timeout(in ms) +writeOutput(result); +``` + +### Expected Result: 5 + +## Run a function asynchronously with then() and error() + +```javascript +future = runAsync(function(){ + return 5; +}).then(function(input){ + return input + 2; +}).error(function(){ + return "Error occurred."; +}); +writeOutput(future.get()); +``` + +### Expected Result: 7 diff --git a/docs/functions/sanitizehtml.md b/docs/functions/sanitizehtml.md new file mode 100644 index 000000000..a85ec9f5a --- /dev/null +++ b/docs/functions/sanitizehtml.md @@ -0,0 +1,54 @@ +# sanitizeHtml + +Sanitizes unsafe HTML to protect against XSS attacks + +```javascript +sanitizeHtml(string [, policy ]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.sanitizeHTML( policy ) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| string | string | Yes | | The string to sanitize | | +| policy | string | No | | Either a org.owasp.html.PolicyFactory or a list of built in policies which allow and sanitize the named element types (see list below). If omitted then all of the built-in policies are applied. | /Users/garethedwards/development/github/cfdocs/docs/functions/sanitizehtml.md|TABLES | + +## Using default built-in policies + +Sanitize a string using built-in policies + +```javascript +unsafe = '

a link test

'; +result = sanitizeHtml( unsafe ); +dump(result); +``` + +## Specifying a list of built-in policies to exclude certain elements + +Only allow sanitized link and block elements + +```javascript +unsafe = '

a link test

'; +result = sanitizeHtml( unsafe,"LINKS,BLOCKS" ); +dump(result); +``` + +## Member function version + +Only allow sanitized link and block elements + +```javascript +unsafe = '

a link test

'; +result = unsafe.sanitizeHtml( "LINKS,BLOCKS" ); +dump(result); +``` diff --git a/docs/functions/second.md b/docs/functions/second.md new file mode 100644 index 000000000..0b162424e --- /dev/null +++ b/docs/functions/second.md @@ -0,0 +1,33 @@ +# second + + Extracts the ordinal for the second from a date/time object. + +```javascript +second(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.second() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | A date/time object | + +## Seconds of a datetime object + +```javascript +dt = createdatetime(2016,1,1,5,30,25); +s = second( dt ); +writeoutput( s ); +``` + +### Expected Result: 25 diff --git a/docs/functions/sendgatewaymessage.md b/docs/functions/sendgatewaymessage.md new file mode 100644 index 000000000..0d322f62f --- /dev/null +++ b/docs/functions/sendgatewaymessage.md @@ -0,0 +1,18 @@ +# sendGatewayMessage + + Sends an outgoing message through a ColdFusion MX event gateway. + +```javascript +sendGatewayMessage(gatewayID, data) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| gatewayID | string | Yes | | Identifier of the gateway to send the message. | +| data | struct | Yes | | A ColdFusion structure. | diff --git a/docs/functions/serialize.md b/docs/functions/serialize.md new file mode 100644 index 000000000..fba70a5a9 --- /dev/null +++ b/docs/functions/serialize.md @@ -0,0 +1,39 @@ +# serialize + +Serializes the object to a specified type + +```javascript +serialize( object, type, useCustomSerializer ) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| object | any | Yes | | An object to be serialized. | +| type | string | Yes | | A type to which the object will be serialized. ColdFusion, by default supports XML and JSON formats. You can also implement support for other types in the CustomSerializer CFC. | +| useCustomSerializer | boolean | No | YES | Whether to use the custom serializer or not. The custom serializer will be always used for XML deserialization.
If false, the XML/JSON deserialization will be done using the default ColdFusion behavior.
If any other type is passed with useCustomSerializer as false, then TypeNotSupportedException will be thrown. | + +## Serialize with Lucee's default serializer (Script syntax) + +Lucee5+ This will serialize the object using the default serialization mechanism. + +```javascript +serialize({ "firstName": "John", "lastName": "Doe" }); +``` + +### Expected Result: {"lastName":"Doe","firstName":"John"} + +## Serialize to JSON (Script syntax) + +This will serialize the object to JSON using ColdFusion's default serialization mechanism. + +```javascript +serialize({ "firstName": "John", "lastName": "Doe" }, 'json'); +``` + +### Expected Result: {"lastName":"Doe","firstName":"John"} diff --git a/docs/functions/serializeavro.md b/docs/functions/serializeavro.md new file mode 100644 index 000000000..cf78bbc55 --- /dev/null +++ b/docs/functions/serializeavro.md @@ -0,0 +1,37 @@ +# serializeAvro + +Serializes data into an Avro binary format + +```javascript +serializeAvro(data, writerSchema [, queryFormat, useCustomSerialization]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| data | any | Yes | | The data to serialize | +| writerSchema | string | Yes | | The Avro schema as a string or the absolute path to the schema | +| queryFormat | string | No | | Indicates in which format a query will be serialized | +| useCustomSerialization | boolean | No | YES | Whether to use the customSerializer | + +## Serialize a query into Avro (Script syntax) + +Serializes a ColdFusion query into an array of Avro binary data + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +newsSchema = '{ + "namespace": "my.example", + "type": "record", + "name": "News", + "fields": [ {"name":"id","type":"int"}, {"name":"title","type":"string"} ] +}'; +writeDump(serializeAvro(data, newsSchema)); +``` diff --git a/docs/functions/serializejson.md b/docs/functions/serializejson.md new file mode 100644 index 000000000..3d68c8687 --- /dev/null +++ b/docs/functions/serializejson.md @@ -0,0 +1,95 @@ +# serializeJSON + +Converts a ColdFusion value into a JSON (JavaScript Object Notation) string. + +```javascript +serializeJSON(data[, queryFormat[, useSecureJSONPrefix[, useCustomSerializer]]]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +someVar.toJSON([queryFormat[, useSecureJSONPrefix[, useCustomSerializer]]]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| data | any | Yes | | A serializable ColdFusion data value | +| queryFormat | any | No | row | This specifies how to serialize ColdFusion queries. Prior to CF11+, this would only accept Boolean values. If it is a Boolean, the false value is equivalent to 'row' and true is 'column'. | +| useSecureJSONPrefix | boolean | No | false | CF11+ When Prefix Serialized JSON is enabled in the ColdFusion Administrator, then by default this function inserts the secure JSON prefix at the beginning of the JSON. | +| useCustomSerializer | boolean | No | true | CF11+ Use custom serializer if defined. See: https://helpx.adobe.com/coldfusion/developing-applications/changes-in-coldfusion/restful-web-services-in-coldfusion.html | + +## Serialize a Struct + +Serialize a CF Struct into a JSON representation + +```javascript +person = {name="Pete Freitag", company="Foundeo"}; +writeOutput( serializeJSON(person) ); +``` + +### Expected Result: {"COMPANY":"Foundeo","NAME":"Pete Freitag"} + +## Serialize a Struct with Member Syntax + +Serialize a CF Struct into a JSON representation using toJSON + +```javascript +person = {name="Pete Freitag", company="Foundeo"}; +writeOutput( person.toJSON() ); +``` + +### Expected Result: {"COMPANY":"Foundeo","NAME":"Pete Freitag"} + +## Lower Case Keys + +Same as above but they variable names are case-sensitive by quoting them. + +```javascript +person = {"name"="Pete Freitag", "company"="Foundeo"}; +writeOutput( serializeJSON(person) ); +``` + +### Expected Result: {"company":"Foundeo","name":"Pete Freitag"} + +## ACF Possible Issues + +Adobe ColdFusion may incorrectly serializes some strings if they can be automatically converted into other types, like numbers or booleans. One workaround is to use a CFC with cfproperty to specify types. Another workaround is to prepend chr(2) to the value and it will be forced to a string, however that is an unofficial / undocumented workaround. + +```javascript +person = { "phone"="123456789", "firstname"="no","lastname"="yes" }; +writeOutput( serializeJson(person) ); +``` + +### Expected Result: {"phone":123456789,"firstname":false,"lastname":true} + +## Using setMetadata to force types + +As of CF2016.0.2+ you can call `setMetadata()` as a member function on a struct to force a type + +```javascript +myStruct = {"zip"="00123"}; +myStruct.setMetadata( { "zip": "string" } ); +writeOutput(serializeJSON(myStruct)); +``` + +### Expected Result: {"zip":"00123"} + +## Serialize a Query as an array of structs + +Serialize a CF Query into a JSON representation of an array of structs + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +writeOutput(serializeJSON(news, "struct")); +``` + +### Expected Result: [{"ID":1,"TITLE":"Dewey defeats Truman"},{"ID":2,"TITLE":"Man walks on Moon"}] diff --git a/docs/functions/serializeprotobuf.md b/docs/functions/serializeprotobuf.md new file mode 100644 index 000000000..e2a33fded --- /dev/null +++ b/docs/functions/serializeprotobuf.md @@ -0,0 +1,35 @@ +# serializeProtobuf + +Serializes data into the Protobuf format + +```javascript +serializeProtobuf(data, schema [, messageType, queryFormat, useCustomSerialization, protoPath]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| data | any | Yes | | The data to serialize | +| schema | string | Yes | | The Protobuf schema as a string or the absolute path to the schema | +| messageType | string | No | | A message type from given schema as string. This is optional if schema contains one and only one message type. | +| queryFormat | string | No | struct | Indicates in which format a query will be serialized | +| useCustomSerialization | boolean | No | YES | Whether to use the customSerializer | +| protoPath | string | No | | Specifies a directory in which the compiler looks for imported files defined in the schema. By default, it will be the current schema's parent path. | + +## Serialize a query into Protobuf (Script syntax) + +Serializes a ColdFusion query into an array of Protobuf binary data + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +newsSchema = 'syntax = "proto3"; +message News { int32 id = 1; string title = 2; }'; +writeDump(serializeProtobuf(news, newsSchema)); +``` diff --git a/docs/functions/serializexml.md b/docs/functions/serializexml.md new file mode 100644 index 000000000..b4a678712 --- /dev/null +++ b/docs/functions/serializexml.md @@ -0,0 +1,28 @@ +# serializeXML + +Serializes the given object to XML. + +```javascript +serializeXML( objToBeSerialized, useCustomSerializer ) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| objToBeSerialized | any | Yes | | An object to be serialized. | +| useCustomSerializer | boolean | No | YES | Whether to use the custom serializer. The default value is true. The custom serializer will be always used for XML deserialization. If false, the XML/JSON deserialization will be done using the default ColdFusion behavior. If any other type is passed with useCustomSerializer as false, then TypeNotSupportedException will be thrown. | + +## Serialize a struct to XML (Script syntax) + +This will serialize the object to XML using ColdFusion's default serialization mechanism. + +```javascript +serializeXML({ "firstName": "John", "lastName": "Doe" }) +``` + +### Expected Result: DoeJohn diff --git a/docs/functions/sessiongetmetadata.md b/docs/functions/sessiongetmetadata.md new file mode 100644 index 000000000..1e19fd75a --- /dev/null +++ b/docs/functions/sessiongetmetadata.md @@ -0,0 +1,23 @@ +# sessionGetMetadata + + Returns meta data related to the current session. + +```javascript +sessionGetMetadata(); +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| region | string | Yes | | Name of the cache region. | + +## Tag Syntax + +```javascript + +``` diff --git a/docs/functions/sessioninvalidate.md b/docs/functions/sessioninvalidate.md new file mode 100644 index 000000000..a861e68b8 --- /dev/null +++ b/docs/functions/sessioninvalidate.md @@ -0,0 +1,11 @@ +# sessionInvalidate + +Clears session scope and makes the current session identifiers no longer valid. This function does not invalidate J2EE sessions, only CF sessions (CFID/CFToken) + +```javascript +sessionInvalidate() +``` + +```javascript +returns void +``` diff --git a/docs/functions/sessionrotate.md b/docs/functions/sessionrotate.md new file mode 100644 index 000000000..ab1013722 --- /dev/null +++ b/docs/functions/sessionrotate.md @@ -0,0 +1,11 @@ +# sessionRotate + +Creates a new session (using new session ids) and copies session scope into this new session, then invalidates the old session. Used after a valid login to prevent session fixation. + +```javascript +sessionRotate() +``` + +```javascript +returns void +``` diff --git a/docs/functions/sessionstarttime.md b/docs/functions/sessionstarttime.md new file mode 100644 index 000000000..1aeef237d --- /dev/null +++ b/docs/functions/sessionstarttime.md @@ -0,0 +1,11 @@ +# sessionstartTime + +Provides information about the time when the current users session scope was created + +```javascript +sessionstartTime() +``` + +```javascript +returns date +``` diff --git a/docs/functions/setencoding.md b/docs/functions/setencoding.md new file mode 100644 index 000000000..f0b81e614 --- /dev/null +++ b/docs/functions/setencoding.md @@ -0,0 +1,43 @@ +# setEncoding + + Sets the character encoding (character set) of Form and URL + scope variable values; used when the character encoding of + the input to a form, or the character encoding of a URL, is + not in UTF-8 encoding. + +```javascript +setEncoding(scope_name, charset) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| scope_name | string | Yes | | | | +| charset | string | Yes | | The character encoding in which text in the scope
variables is encoded. | /Users/garethedwards/development/github/cfdocs/docs/functions/setencoding.md|utf-16 | + +## Script Example + +```javascript + + +
+ + + +
+ + + setEncoding("url", "big5"); + writeOutput("URL.XXX is " & URL.xxx & "
"); + writeOutput("URL.YYY is " & URL.yyy & "
"); + theEncoding = getEncoding("URL"); + writeOutput("The URL variables were decoded using '" & theEncoding & "' encoding."); + writeOutput("The encoding is " & theEncoding); +
+
+``` diff --git a/docs/functions/setlocale.md b/docs/functions/setlocale.md new file mode 100644 index 000000000..587c37fd2 --- /dev/null +++ b/docs/functions/setlocale.md @@ -0,0 +1,41 @@ +# setLocale + + Sets the country/language locale for CFML processing + and the page returned to the client. The locale value + determines the default format of date, time, number, and + currency values, according to language and regional + conventions. + +```javascript +setLocale(new_locale) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| new_locale | string | Yes | | The name of a locale; for example, "English (US)" | /Users/garethedwards/development/github/cfdocs/docs/functions/setlocale.md|Swedish | + +## Set Locale Script Example + +Outputs the current locale, Sets the locale to French (Belgian) and outputs it, then puts it back to the original and outputs it + +```javascript + + currentLocale = getLocale(); + writeOutput("Current: "); + writeDump(currentLocale); + writeOutput("
"); + setLocale("French (Belgian)"); + writeOutput("New: "); + writeDump(getLocale()); + writeOutput("
"); + setLocale(currentLocale); + writeOutput("Original: "); + writeDump(getLocale()); +
+``` diff --git a/docs/functions/setprofilestring.md b/docs/functions/setprofilestring.md new file mode 100644 index 000000000..c6598b21c --- /dev/null +++ b/docs/functions/setprofilestring.md @@ -0,0 +1,20 @@ +# setProfileString + +Sets the value of a profile entry in an initialization file. + +```javascript +setProfileString(inipath, section, entry, value) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| inipath | string | Yes | | Absolute path of initialization file | +| section | string | Yes | | Section of the initialization file in which the entry is
to be set | +| entry | string | Yes | | Name of the entry to set | +| value | string | Yes | | Value to which to set the entry | diff --git a/docs/functions/settimezone.md b/docs/functions/settimezone.md new file mode 100644 index 000000000..e7ebba023 --- /dev/null +++ b/docs/functions/settimezone.md @@ -0,0 +1,26 @@ +# setTimeZone + +Change the timezone definition for the current request + +```javascript +setTimezone(timezone) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| timezone | string | Yes | | The timezone to set to. | + +## Set the current Timezone to CET + +```javascript +setTimezone("CET"); +writeoutput(getTimezoneInfo().timezone); +``` + +### Expected Result: CET diff --git a/docs/functions/setvariable.md b/docs/functions/setvariable.md new file mode 100644 index 000000000..a67bad200 --- /dev/null +++ b/docs/functions/setvariable.md @@ -0,0 +1,28 @@ +# setVariable + +Sets a variable in the name parameter to the value of the value parameter. + +```javascript +setVariable(name, value) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Variable name | +| value | string | Yes | | A string, the name of a string, or a number | + +## Set the value of a from 1 to 2 + +```javascript +a=1; +setVariable('a',2); +writeOutput(a); +``` + +### Expected Result: 2 diff --git a/docs/functions/sgn.md b/docs/functions/sgn.md new file mode 100644 index 000000000..1665025cb --- /dev/null +++ b/docs/functions/sgn.md @@ -0,0 +1,41 @@ +# sgn + + Determines the sign of a number. + +```javascript +sgn(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Sign of any number greater than 0 + +```javascript +sgn(0.3) +``` + +### Expected Result: 1 + +## Sign of 0 + +```javascript +sgn(0) +``` + +### Expected Result: 0 + +## Sign of any number less than 0 + +```javascript +sgn(-0.3) +``` + +### Expected Result: -1 diff --git a/docs/functions/sin.md b/docs/functions/sin.md new file mode 100644 index 000000000..2f39f4c7b --- /dev/null +++ b/docs/functions/sin.md @@ -0,0 +1,25 @@ +# sin + + Calculates the sine of an angle that is entered in radians. + +```javascript +sin(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | | + +## Sine of 0.3 + +```javascript +sin(0.3) +``` + +### Expected Result: 0.295520206661 diff --git a/docs/functions/sizeof.md b/docs/functions/sizeof.md new file mode 100644 index 000000000..f951c698c --- /dev/null +++ b/docs/functions/sizeof.md @@ -0,0 +1,18 @@ +# sizeOf + +Returns the size in bytes of a given object + +```javascript +sizeOf(obj [, complex]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| obj | any | Yes | | | +| complex | boolean | No | | | diff --git a/docs/functions/sleep.md b/docs/functions/sleep.md new file mode 100644 index 000000000..4d07dbe02 --- /dev/null +++ b/docs/functions/sleep.md @@ -0,0 +1,30 @@ +# sleep + +Causes the current thread to stop processing for a specified period of time. + +```javascript +sleep(duration) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| duration | numeric | Yes | | Time, in milliseconds, to stop processing the current thread | + +## Sleep for 5 seconds + +Outputs the current date/time, sleeps for 5 seconds, then outputs the current date/time again. + +```javascript + + writeOutput(now()); + writeOutput("
"); + sleep(5000); + writeOutput(now()); +
+``` diff --git a/docs/functions/soundex.md b/docs/functions/soundex.md new file mode 100644 index 000000000..63373f9b1 --- /dev/null +++ b/docs/functions/soundex.md @@ -0,0 +1,31 @@ +# soundEx + +Soundex is a phonetic algorithm for indexing names by sound, as pronounced in English. +The goal is for homophones to be encoded to the same representation so that they can be matched despite minor differences in spelling. +The algorithm mainly encodes consonants; a vowel will not be encoded unless it is the first letter. + +Soundex is the most widely known of all phonetic algorithms, as it is a standard feature of MS SQL and Oracle, and is often used (incorrectly) as a synonym for 'phonetic algorithm' + +```javascript +soundEx(str) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| str | string | Yes | | | + +## Get Soundexes of "Robert", "Rupert" and "Rubin" + +Both "Robert" and "Rupert" return the same string "R163" while "Rubin" yields "R150" + +```javascript +soundEx("Robert")&"/"&soundEx("Rupert")&"/"&soundEx("Rubin") +``` + +### Expected Result: R163/R163/R150 diff --git a/docs/functions/spanexcluding.md b/docs/functions/spanexcluding.md new file mode 100644 index 000000000..0c02152ba --- /dev/null +++ b/docs/functions/spanexcluding.md @@ -0,0 +1,28 @@ +# spanExcluding + + Gets characters from a string, from the beginning to a + character that is in a specified set of characters. The + search is case-sensitive. + +```javascript +spanExcluding(String, set) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| set | string | Yes | | A string or a variable that contains a set of characters.
Must contain one or more characters | + +## Tag Example + +```javascript + + #spanExcluding('This is Great', 'r')# + +``` diff --git a/docs/functions/spanincluding.md b/docs/functions/spanincluding.md new file mode 100644 index 000000000..6e7815cbd --- /dev/null +++ b/docs/functions/spanincluding.md @@ -0,0 +1,28 @@ +# spanIncluding + + Gets characters from a string, from the beginning to a + character that is not in a specified set of characters. The + search is case-sensitive. + +```javascript +spanIncluding(String, set) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | | +| set | string | Yes | | A string or a variable that contains a set of characters.
Must contain one or more characters | + +## Tag Example + +```javascript + + #SpanIncluding('This is Great', 'p')# + +``` diff --git a/docs/functions/spreadsheetaddautofilter.md b/docs/functions/spreadsheetaddautofilter.md new file mode 100644 index 000000000..4c10cc7e4 --- /dev/null +++ b/docs/functions/spreadsheetaddautofilter.md @@ -0,0 +1,18 @@ +# spreadsheetAddAutoFilter + +A function to add auto filters to the spreadsheet. + +```javascript +spreadsheetAddAutoFilter(SpreadsheetObj, autofilter) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | any | Yes | | Excel spreadsheet object | +| autofilter | string | Yes | | The Excel filter that needs to be applied to the sheet. Note that the vale should not contain spaces or invalid characters. | diff --git a/docs/functions/spreadsheetaddcolumn.md b/docs/functions/spreadsheetaddcolumn.md new file mode 100644 index 000000000..cce634bd3 --- /dev/null +++ b/docs/functions/spreadsheetaddcolumn.md @@ -0,0 +1,35 @@ +# spreadsheetAddColumn + + Adds a column or column data to an Excel spreadsheet object. + +```javascript +spreadsheetAddColumn(spreadsheetObj, data, startrow, startcolumn, insert [, insert]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| data | string | Yes | | No Help Available | +| startrow | numeric | Yes | | No Help Available | +| startcolumn | numeric | Yes | | No Help Available | +| insert | boolean | Yes | | No Help Available | +| insert | boolean | No | | No Help Available | + +## Tag Example + +```javascript + +mySheet = SpreadsheetNew( "Test" ); +writeDump( mySheet ); +SpreadsheetAddColumn( mySheet, "MySingleColumn" ); // Add a row of data: a single value for the single column +mySingleColumnValue = "As you can see, this sentence contains commas, which force the value to be split over 3 columns instead of one."; +SpreadsheetAddRow( mySheet, mySingleColumnValue ); +writeDump( mySheet ); + +``` diff --git a/docs/functions/spreadsheetaddfreezepane.md b/docs/functions/spreadsheetaddfreezepane.md new file mode 100644 index 000000000..5a763b3a9 --- /dev/null +++ b/docs/functions/spreadsheetaddfreezepane.md @@ -0,0 +1,21 @@ +# spreadsheetAddFreezePane + +Adds freeze pane (non-scrollable columns/rows) to spreadsheet + +```javascript +spreadsheetAddFreezePane(spreadsheetObj, column, row [, endColumn] [, endRow]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | Spreadsheet variable name | +| freezeColumn | numeric | Yes | | Amount of columns from left which should be freeze | +| freezeRow | numeric | Yes | | Amount of rows from top which should be freeze | +| hideColumn | numeric | No | | Amount of columns which should be hidden under/behind freeze columns (Scrolls left to first unhidden column). | +| hideRow | numeric | No | | Amount of rows which should be hidden under/behind freeze rows (Scrolls down to first unhidden row). | diff --git a/docs/functions/spreadsheetaddimage.md b/docs/functions/spreadsheetaddimage.md new file mode 100644 index 000000000..0ca477fb0 --- /dev/null +++ b/docs/functions/spreadsheetaddimage.md @@ -0,0 +1,38 @@ +# spreadsheetAddimage + + Adds an image to an Excel spreadsheet object. + +```javascript +spreadsheetAddimage(spreadsheetObj, imagefilepath, anchor) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| imagefilepath | string | Yes | | No Help Available | +| anchor | string | Yes | | No Help Available | + +## Tag Example + +The following example creates a PNG format chart, puts it in a new spreadsheet as rows 5-12 and column 5-10, and saves the sheet to disk. + +```javascript + + + + + + + + + + + + +``` diff --git a/docs/functions/spreadsheetaddinfo.md b/docs/functions/spreadsheetaddinfo.md new file mode 100644 index 000000000..93977a459 --- /dev/null +++ b/docs/functions/spreadsheetaddinfo.md @@ -0,0 +1,31 @@ +# spreadsheetAddInfo + + Adds information to an Excel spreadsheet object. + +```javascript +spreadsheetAddInfo(spreadsheetObj, info) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| info | struct | Yes | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + +``` diff --git a/docs/functions/spreadsheetaddpagebreaks.md b/docs/functions/spreadsheetaddpagebreaks.md new file mode 100644 index 000000000..1af6d9d08 --- /dev/null +++ b/docs/functions/spreadsheetaddpagebreaks.md @@ -0,0 +1,33 @@ +# spreadsheetAddPagebreaks + +A function to add page breaks for rows and columns to a Spreadsheet Object. + +```javascript +spreadsheetAddPagebreaks(SpreadsheetObj, rowbreaks, colbreaks) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| SpreadsheetObj | any | Yes | | Excel spreadsheet object to apply page break to. | +| rowbreaks | string | Yes | | Comma-delimited row numbers where the page breaks will be applied. | +| colbreaks | string | Yes | | Comma-delimited column numbers where the page breaks will be applied. | + +## Simple spreadsheetAddPagebreaks Example + +CF11+ Here,we've example to break the excel using spreadsheetaddpagebreaks. It is supported only in adobe coldfusion. + +```javascript + + + + + + + +``` diff --git a/docs/functions/spreadsheetaddrow.md b/docs/functions/spreadsheetaddrow.md new file mode 100644 index 000000000..0a1fc883e --- /dev/null +++ b/docs/functions/spreadsheetaddrow.md @@ -0,0 +1,32 @@ +# spreadsheetAddRow + +Adds a row to an Excel spreadsheet object. + +```javascript +spreadsheetAddRow(spreadsheetObj, data [, row] [, column] [, insert] [, datatype]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | The spreadsheet | +| data | string | Yes | | A comma separated list of cell values. | +| row | numeric | No | | Row number at which to insert, if omitted appended. | +| column | numeric | No | 1 | Column number at which to insert data. | +| insert | boolean | No | true | When true appends data to spreadsheetObj, when false attempts to update rows. | +| datatype | array | No | | CF11+ List of datatype expressions with values such as `STRING` `NUMERIC` or `DATE`. For example use `DATE:1;NUMERIC:2-2;STRING | + +## Add a row to SpreadSheet + +```javascript + + + + + +``` diff --git a/docs/functions/spreadsheetaddrows.md b/docs/functions/spreadsheetaddrows.md new file mode 100644 index 000000000..809bf631e --- /dev/null +++ b/docs/functions/spreadsheetaddrows.md @@ -0,0 +1,55 @@ +# spreadsheetAddRows + +Adds multiple rows from a query or array to an Excel spreadsheet object. + +```javascript +spreadsheetAddRows(spreadsheetObj, data,[ row, column , insert, datatype, includeColumnNames]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | The spreadsheet object variable | +| data | any | Yes | | A query or array | +| row | numeric | No | | The row number in the spreadsheet at which to insert the data. If omitted rows are appended. | +| column | numeric | No | | The column number to start, all columns to the left will be empty. | +| insert | boolean | No | true | When true appends the row `data` to the `spreadsheetObj`. When `false` attempts to update the spreadsheet object rows. | +| datatype | array | No | | CF11+ An array of datatype expressions with values `STRING` `NUMERIC` or `DATE`. For example use `DATE:1;NUMERIC:2-2;STRING | +| includeColumnNames | boolean | No | false | CF2016+ When `true` writes column names as headers in the spreadsheet. | + +## Adding rows to a spreadsheet from a Query + +```javascript + + + + + + + + + +``` + +## CF2016: Adding rows to a spreadsheet from a Query using column names as headers + +You need to state the row, column, insert and datatype arguments before you can change includeColumnNames to true as ACF internal functions don't allow named arguments. + +```javascript + + + + + + + +``` diff --git a/docs/functions/spreadsheetaddsplitpane.md b/docs/functions/spreadsheetaddsplitpane.md new file mode 100644 index 000000000..136c4b319 --- /dev/null +++ b/docs/functions/spreadsheetaddsplitpane.md @@ -0,0 +1,36 @@ +# spreadsheetAddSplitPane + + Adds split pane to spreadsheet. + +```javascript +spreadsheetAddSplitPane(spreadsheetObj, x, y, splitColumn, splitRow [, position]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | Spreadsheet variable | | +| x | numeric | Yes | | X position for split | | +| y | numeric | Yes | | Y position for split | | +| splitColumn | numeric | Yes | | Split Column | | +| splitRow | numeric | Yes | | Split Row | | +| position | string | No | | Specify which pane has the focus | /Users/garethedwards/development/github/cfdocs/docs/functions/spreadsheetaddsplitpane.md|UPPER_RIGHT | + +## Simple SpreadsheetAddSplitPane Example + +Here,we've example to splitpane in excel using spreadsheetaddsplitpane. + +```javascript + + + + + + + +``` diff --git a/docs/functions/spreadsheetcreatesheet.md b/docs/functions/spreadsheetcreatesheet.md new file mode 100644 index 000000000..184bbbe58 --- /dev/null +++ b/docs/functions/spreadsheetcreatesheet.md @@ -0,0 +1,45 @@ +# spreadsheetCreateSheet + + Create spreadsheet from given spreadsheet object + +```javascript +spreadsheetCreateSheet(spreadsheetObj, name) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| name | string | Yes | | No Help Available | + +## Tag Example + +The following example creates two sheets: CourseData and EvaluationSheet. + +```javascript + +// Make a spreadsheet object +spreadsheet = spreadsheetNew("Sheet A"); + +// add a new sheet +spreadsheetCreateSheet(spreadsheet, "Sheet B"); + +// set the new sheet to be the active one +SpreadsheetSetActiveSheet(spreadsheet, "Sheet B"); + +// populate Sheet B +i = 1; +while (i < 10) { + SpreadsheetSetCellValue(spreadsheet, "col #i#", 1, i); + i++; +} + + + + +``` diff --git a/docs/functions/spreadsheetdeletecolumn.md b/docs/functions/spreadsheetdeletecolumn.md new file mode 100644 index 000000000..0b5b4248c --- /dev/null +++ b/docs/functions/spreadsheetdeletecolumn.md @@ -0,0 +1,39 @@ +# spreadsheetDeleteColumn + + Deletes the data from a column of an Excel spreadsheet object. It does not delete the column. + +```javascript +spreadsheetDeleteColumn(spreadsheetObj, column) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| column | numeric | Yes | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + + +``` diff --git a/docs/functions/spreadsheetdeletecolumns.md b/docs/functions/spreadsheetdeletecolumns.md new file mode 100644 index 000000000..275542f9b --- /dev/null +++ b/docs/functions/spreadsheetdeletecolumns.md @@ -0,0 +1,39 @@ +# spreadsheetDeleteColumns + + Deletes the data from multiple columns of an Excel spreadsheet object. This function does not remove the columns. + +```javascript +spreadsheetDeleteColumns(spreadsheetObj, range) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| range | numeric | Yes | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + + +``` diff --git a/docs/functions/spreadsheetdeleterow.md b/docs/functions/spreadsheetdeleterow.md new file mode 100644 index 000000000..5cbb6949a --- /dev/null +++ b/docs/functions/spreadsheetdeleterow.md @@ -0,0 +1,39 @@ +# spreadsheetDeleteRow + + Deletes all data from a row of an Excel spreadsheet object. It does not delete the row. + +```javascript +spreadsheetDeleteRow(spreadsheetObj, row) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| row | numeric | Yes | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + + +``` diff --git a/docs/functions/spreadsheetdeleterows.md b/docs/functions/spreadsheetdeleterows.md new file mode 100644 index 000000000..1ba0e3fe0 --- /dev/null +++ b/docs/functions/spreadsheetdeleterows.md @@ -0,0 +1,39 @@ +# spreadsheetDeleteRows + + Deletes all data from multiple rows of an Excel spreadsheet object. It does not delete the row. + +```javascript +spreadsheetDeleteRows(spreadsheetObj, range) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| range | numeric | Yes | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + + +``` diff --git a/docs/functions/spreadsheetformatcell.md b/docs/functions/spreadsheetformatcell.md new file mode 100644 index 000000000..4d7f36251 --- /dev/null +++ b/docs/functions/spreadsheetformatcell.md @@ -0,0 +1,41 @@ +# spreadsheetFormatCell + +Formats the contents of a single cell of an Excel spreadsheet object. + +```javascript +spreadsheetFormatCell(spreadsheetObj, format, row, column) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | any | Yes | | The spreadsheet object for which formatting will be applied | +| format | struct | Yes | | A structure containing the formatting information | +| row | numeric | Yes | | The row the cell to format is in | +| column | numeric | Yes | | The column the cell to format is in | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + + +``` diff --git a/docs/functions/spreadsheetformatcellrange.md b/docs/functions/spreadsheetformatcellrange.md new file mode 100644 index 000000000..89c2de53b --- /dev/null +++ b/docs/functions/spreadsheetformatcellrange.md @@ -0,0 +1,54 @@ +# spreadsheetFormatCellRange + +Formats the cells within the given range. + +```javascript +spreadsheetFormatCellRange (spreadsheetObj, format, startRow, startColumn, endRow, endColumn) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | any | Yes | | The Excel spreadsheet object for which you want to format the cells. | +| format | struct | Yes | | A structure that contains format information. | +| startRow | numeric | Yes | | The number of the first row to format. | +| startColumn | numeric | Yes | | The number of the first column to format. | +| endRow | numeric | Yes | | The number of the last row to format. | +| endColumn | numeric | Yes | | The number of the last column to format. | + +## Tag Syntax + +Checking to see if the region is present in the cache + +```javascript + + + SELECT CORNUMBER,DEPT_ID,CORLEVEL,COURSE_ID,CORNAME,CORDESC,LASTUPDATE + FROM COURSELIST + + + ///We need an absolute path, so get the current directory path. + theFile=getDirectoryFromPath(getCurrentTemplatePath()) & 'courses.xls'; + //Create a new Excel spreadsheet object and add the query data. + theSheet = spreadsheetNew('CourseData'); + spreadsheetAddRows(theSheet,courses); + // Define a format for the column. + format1=structNew() + format1.font='Courier'; + format1.fontsize='10'; + format1.color='dark_blue;'; + format1.italic='true'; + format1.bold='true'; + format1.alignment='left'; + spreadsheetFormatCellRange(theSheet,format1, 3,4,30,10); + + + +``` diff --git a/docs/functions/spreadsheetformatcolumn.md b/docs/functions/spreadsheetformatcolumn.md new file mode 100644 index 000000000..947b77dc4 --- /dev/null +++ b/docs/functions/spreadsheetformatcolumn.md @@ -0,0 +1,44 @@ +# spreadsheetFormatColumn + +Formats the contents of a single column of an Excel spreadsheet object. + +```javascript +spreadsheetFormatColumn(spreadsheetObj, format, column) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | any | Yes | | The spreadsheet object for which formatting will be applied | +| format | struct | Yes | | A structure containing the formatting information | +| column | numeric | Yes | | The column number for which to apply formatting | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + format1.font="Courier"; + format1.fontsize="10"; + format1.color="dark_blue;"; + SpreadsheetFormatColumn(s,format1,5); + + +``` diff --git a/docs/functions/spreadsheetformatcolumns.md b/docs/functions/spreadsheetformatcolumns.md new file mode 100644 index 000000000..047f8a922 --- /dev/null +++ b/docs/functions/spreadsheetformatcolumns.md @@ -0,0 +1,44 @@ +# spreadsheetFormatColumns + +Formats the contents of a multiple columns of an Excel spreadsheet object. + +```javascript +spreadsheetFormatColumns(spreadsheetObj, format, columns) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | The spreadsheet object for which formatting will be applied | +| format | string | Yes | | A structure containing the formatting information | +| columns | string | Yes | | A string containing comma-separated column numbers or column ranges | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + format1.font="Courier"; + format1.fontsize="10"; + format1.color="dark_blue;"; + spreadsheetFormatColumns(s,format1,"1-3"); + + +``` diff --git a/docs/functions/spreadsheetformatrow.md b/docs/functions/spreadsheetformatrow.md new file mode 100644 index 000000000..1087a3001 --- /dev/null +++ b/docs/functions/spreadsheetformatrow.md @@ -0,0 +1,44 @@ +# spreadsheetFormatRow + +Formats the contents of a single row of an Excel spreadsheet object. + +```javascript +spreadsheetFormatRow(spreadsheetObj, format, row) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | any | Yes | | The spreadsheet object for which formatting will be applied | +| format | struct | Yes | | A structure containing the formatting information | +| row | numeric | Yes | | The row number for which to apply formatting | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + format1.font="Courier"; + format1.fontsize="10"; + format1.color="dark_blue;"; + spreadsheetFormatRow(s,format1,1); + + +``` diff --git a/docs/functions/spreadsheetformatrows.md b/docs/functions/spreadsheetformatrows.md new file mode 100644 index 000000000..350941309 --- /dev/null +++ b/docs/functions/spreadsheetformatrows.md @@ -0,0 +1,44 @@ +# spreadsheetFormatRows + +Formats the contents of a multiple rows of an Excel spreadsheet object. + +```javascript +spreadsheetFormatRows(spreadsheetObj, format, rows) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | any | Yes | | The spreadsheet object for which formatting will be applied | +| format | struct | Yes | | A structure containing the formatting information | +| rows | string | Yes | | A string containing comma-separated row numbers or row ranges | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + format1.font="Courier"; + format1.fontsize="10"; + format1.color="dark_blue;"; + spreadsheetFormatRows(s,format1,"1-2"); + + +``` diff --git a/docs/functions/spreadsheetgetcellcomment.md b/docs/functions/spreadsheetgetcellcomment.md new file mode 100644 index 000000000..bca3ef2d9 --- /dev/null +++ b/docs/functions/spreadsheetgetcellcomment.md @@ -0,0 +1,54 @@ +# spreadsheetGetCellComment + + Gets the comment for an Excel spreadsheet object cell as a structure with formatting information, or all comments for the object. + +```javascript +spreadsheetGetCellComment(author [, column] [, comment] [, row]) +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| author | string | Yes | | No Help Available | +| column | numeric | No | | No Help Available | +| comment | string | No | | No Help Available | +| row | string | No | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + comment1=structNew() ; + comment1.anchor="0,0,5,8"; + comment1.author="John Smithg"; + comment1.comment="This is a test comment"; + comment1.size="10"; + //Set the comment. + SpreadsheetSetCellComment(s,comment1,3,5); + //Get the comment from the Excel spreadsheet object. + theComment=SpreadsheetGetCellComment(s,3,5); + + + Row,Column: #theComment.row#,#theComment.column#
+ Author: #theComment.author#
+ Comment: #theComment.comment# +
+``` diff --git a/docs/functions/spreadsheetgetcellformula.md b/docs/functions/spreadsheetgetcellformula.md new file mode 100644 index 000000000..8a76bde2f --- /dev/null +++ b/docs/functions/spreadsheetgetcellformula.md @@ -0,0 +1,109 @@ +# spreadsheetGetCellFormula + + Gets the formula for a for an Excel spreadsheet object cell, or all formulas for the object. + +```javascript +spreadsheetGetCellFormula(spreadsheetObj, row, column) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| row | numeric | Yes | | No Help Available | +| column | numeric | Yes | | No Help Available | + +## Script Example + +```javascript + + + + + + + + + + + + + + + theFormula=SpreadsheetGetCellFormula(s,1,1); + + + Row,Column: #theFormula# + +``` + +## Example for getting cell formula + +Example of getting Excel spreadsheet cell value and formula + +```javascript + +columnsList = "Name,Employed,Sales,Earnings,Some Value"; +employees = [ + { "Name": "Robert","Employed":"Y","Sales":1,"Earnings":500 }, + { "Name": "Wilma","Employed":"Y","Sales":15,"Earnings":5500 }, + { "Name": "Eric","Employed":"Y","Sales":3,"Earnings":1200 }, + { "Name": "Fred","Employed":"Y","Sales":1,"Earnings":500 }, + { "Name": "Dillan","Employed":"Y","Sales":15,"Earnings":5500 }, + { "Name": "Dana","Employed":"Y","Sales":3,"Earnings":1200 }, + { "Name": "Sandy","Employed":"Y","Sales":1,"Earnings":500 }, + { "Name": "Ellen","Employed":"Y","Sales":15,"Earnings":5500 }, + { "Name": "Richard","Employed":"Y","Sales":3,"Earnings":1200 } +]; + +// create a spreadsheet +s = SpreadsheetNew("Example"); +// add the header row +spreadsheetAddRow(s, columnsList); +// Add some employee data +employees.each(function(record,row){ + spreadsheetAddRow(s, "", row + 1); + // Add the row data by column name + ListToArray(columnsList).each(function(columnName,col){ + if(structKeyExists(record,columnName)){ + SpreadsheetSetCellValue(s, record[columnName], row + 1, col); + } + }); +}); +// Capture the number of rows plus the header row +numRows = ArrayLen(employees) + 1; + +// Create some random data in the 5th column +for (i=2; i<= numRows; i=i+1) + SpreadsheetSetCellValue(s,i,i,5); +// add a totals row +spreadsheetAddRow(s, "", numRows + 1); + +// Set the formula for the cell in the last row, column 3 to be the sum of +// 'Sales' +SpreadsheetSetCellFormula(s,"SUM(#Chr(64+3)#2:#Chr(64+3)#10)",numRows+1,3); +// Set the formula for the cell in the last row, column 4 to be the sum of +// 'Earnings' +SpreadsheetSetCellFormula(s,"SUM(#Chr(64+4)#2:#Chr(64+4)#10)",numRows+1,4); +// Set the formula for the cell in the last row, column 5 to be the sum of +// 'Some Value' +SpreadsheetSetCellFormula(s,"SUM(#Chr(64+5)#2:#Chr(64+5)#10)",numRows+1,5); + +for (i=3; i<= 5; i=i+1){ + //Get the formula from last row column i ex: ($E11) + formulaValue=SpreadsheetGetCellFormula(s,numRows+1,i); + //Get the value from last row column i ex: ($E11) + cellValue=SpreadsheetGetCellValue(s,numRows+1,i); + writeOutput("Total: " & cellValue & "
"); + writeOutput("formula: " & formulaValue & "
" ); +} +writedump(var=s,label="Example"); +
+``` + +### Expected Result: Total: 57 formula: SUM(C2:C10) Total: 21600 formula: SUM(D2:D10) Total: 54 formula: SUM(E2:E10) diff --git a/docs/functions/spreadsheetgetcellvalue.md b/docs/functions/spreadsheetgetcellvalue.md new file mode 100644 index 000000000..f9bf1fa1e --- /dev/null +++ b/docs/functions/spreadsheetgetcellvalue.md @@ -0,0 +1,43 @@ +# spreadsheetGetCellValue + + Gets the Value for a for an Excel spreadsheet object cell. + +```javascript +spreadsheetGetCellValue(spreadsheetObj, row, column) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| row | string | Yes | | No Help Available | +| column | string | Yes | | No Help Available | + +## Script Example + +```javascript + + + + + + + + + + + + + + + theFormula=SpreadsheetGetCellFormula(s,1,1); + + + Row,Column: #theFormula# + +``` diff --git a/docs/functions/spreadsheetgetcolumncount.md b/docs/functions/spreadsheetgetcolumncount.md new file mode 100644 index 000000000..2d645d121 --- /dev/null +++ b/docs/functions/spreadsheetgetcolumncount.md @@ -0,0 +1,28 @@ +# spreadsheetGetColumnCount + +Returns the number of columns in a given spreadsheet. + +```javascript +spreadsheetAddRow(spreadsheetObj, [sheet]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | any | Yes | | The spreadsheet object | +| sheet | string | No | | The sheet name or sheet number | + +## Get Column Count + +```javascript +s = spreadsheetNew(); +spreadsheetAddRow(s,"Name,Beers,Vegetables,Fruits,Meats"); +writeOutput( spreadsheetGetColumnCount( s ) ); +``` + +### Expected Result: 5 diff --git a/docs/functions/spreadsheetinfo.md b/docs/functions/spreadsheetinfo.md new file mode 100644 index 000000000..084fd76ae --- /dev/null +++ b/docs/functions/spreadsheetinfo.md @@ -0,0 +1,27 @@ +# spreadsheetInfo + + Returns spreadsheet property + +```javascript +spreadsheetInfo(spreadsheetObj) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | + +## Simple spreadsheetInfo example + +Here we have simple example about spreadsheetinfo function. It displays the detail of read sreadsheet like sheet name,last edited,creation date etc.. + +```javascript + + + +``` diff --git a/docs/functions/spreadsheetmergecells.md b/docs/functions/spreadsheetmergecells.md new file mode 100644 index 000000000..119956e39 --- /dev/null +++ b/docs/functions/spreadsheetmergecells.md @@ -0,0 +1,47 @@ +# spreadsheetMergeCells + + Merges a rectangular block of two or more Excel spreadsheet object cells. + +```javascript +spreadsheetMergeCells(spreadsheetObj, startrow, endrow, startcolumn, endcolumn) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| startrow | numeric | Yes | | No Help Available | +| endrow | numeric | Yes | | No Help Available | +| startcolumn | numeric | Yes | | No Help Available | +| endcolumn | numeric | Yes | | No Help Available | + +## Script Example + +```javascript + + + + + + + + + + + + + + + Spreadsheetmergecells(s,1,1,1,2); + + + + + + +``` diff --git a/docs/functions/spreadsheetnew.md b/docs/functions/spreadsheetnew.md new file mode 100644 index 000000000..08da9622a --- /dev/null +++ b/docs/functions/spreadsheetnew.md @@ -0,0 +1,40 @@ +# spreadsheetNew + + Creates a ColdFusion spreadsheet object, which represents a single sheet of an Excel document. + +```javascript +spreadsheetNew([sheetname] [, xmlFormat]) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| sheetname | string | No | | String value to be used as the sheet name. | +| xmlFormat | boolean | No | false | Boolean value to indicate the use of Excels xlsx format. | + +## Create xlsx sheet + +xlsx files with and with out sheet name + +```javascript +xlsxSheet1 = spreadsheetNew("xlsx sheet",true); +xlsxSheet2 = spreadsheetNew(true); +writeDump(xlsxSheet1); +writeDump(xlsxSheet2); +``` + +## Create xls sheet + +xls files with and with out sheet name + +```javascript +xlsSheet1 = spreadsheetNew("xls sheet"); +xlsSheet2 = spreadsheetNew(); +writeDump(xlsSheet1); +writeDump(xlsSheet2); +``` diff --git a/docs/functions/spreadsheetread.md b/docs/functions/spreadsheetread.md new file mode 100644 index 000000000..b1f2ba23d --- /dev/null +++ b/docs/functions/spreadsheetread.md @@ -0,0 +1,26 @@ +# spreadsheetRead + +Create a new spreadsheet variable from specified file + +```javascript +spreadsheetRead(fileName, spreadsheetObj) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| fileName | string | Yes | | Path to spreadsheet file | +| spreadsheetObj | variableName | Yes | | Spreadsheet name or number | + +## Script Example + +```javascript + + a = SpreadSheetRead('C:\Files\Report.xls',"Annual Report") + +``` diff --git a/docs/functions/spreadsheetreadbinary.md b/docs/functions/spreadsheetreadbinary.md new file mode 100644 index 000000000..bd2a208ff --- /dev/null +++ b/docs/functions/spreadsheetreadbinary.md @@ -0,0 +1,35 @@ +# spreadsheetReadBinary + + Reads spreadsheet file into a binary object + +```javascript +spreadsheetReadBinary(spreadsheetObj) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | Spreadsheet file | + +## Tag Example + +```javascript + + + + +``` + +## Script Example + +```javascript +testSpreadsheet = spreadhsheetnew("New Sheet"); +spreadsheetAddRow(testSpreadsheet ,"column a,column b,column c"); +cfheader(name="Content-Disposition" value="inline; filename=test.xls")' +cfcontent(type="application/vnd-ms.excel" variable="#spreadsheetReadBinary(testSpreadsheet)#"); +``` diff --git a/docs/functions/spreadsheetremovesheet.md b/docs/functions/spreadsheetremovesheet.md new file mode 100644 index 000000000..579c5d669 --- /dev/null +++ b/docs/functions/spreadsheetremovesheet.md @@ -0,0 +1,30 @@ +# spreadsheetRemoveSheet + +Deletes a spreadsheet. + +```javascript +spreadsheetRemoveSheet (spreadsheetObj, sheetname); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | The Excel spreadsheet object from which you delete the sheet. | +| sheetname | string | Yes | | Name of the sheet that must be removed. | + +## Tag Syntax + +```javascript + + + + + + + +``` diff --git a/docs/functions/spreadsheetsetactivesheet.md b/docs/functions/spreadsheetsetactivesheet.md new file mode 100644 index 000000000..18e785d59 --- /dev/null +++ b/docs/functions/spreadsheetsetactivesheet.md @@ -0,0 +1,45 @@ +# spreadsheetSetActiveSheet + + Sets active sheet in given spreadsheet + +```javascript +spreadsheetSetActiveSheet(spreadsheetObj [, name]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| name | string | No | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + SpreadsheetCreateSheet (s, "TestSheet"); + SpreadsheetSetActiveSheet(s, "TestSheet"); + + + + + + +``` diff --git a/docs/functions/spreadsheetsetactivesheetnumber.md b/docs/functions/spreadsheetsetactivesheetnumber.md new file mode 100644 index 000000000..8316e28b6 --- /dev/null +++ b/docs/functions/spreadsheetsetactivesheetnumber.md @@ -0,0 +1,45 @@ +# spreadsheetSetActiveSheetNumber + + Sets number of active sheet in given spreadsheet + +```javascript +spreadsheetSetActiveSheetNumber(spreadsheetObj [, number]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| number | numeric | No | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + SpreadsheetCreateSheet (s, "TestSheet"); + SpreadsheetSetActiveSheetNumber(s, 2); + + + + + + +``` diff --git a/docs/functions/spreadsheetsetcellcomment.md b/docs/functions/spreadsheetsetcellcomment.md new file mode 100644 index 000000000..18a0e974e --- /dev/null +++ b/docs/functions/spreadsheetsetcellcomment.md @@ -0,0 +1,54 @@ +# spreadsheetSetCellComment + + Specifies the comment for an Excel spreadsheet object cell. + +```javascript +spreadsheetSetCellComment(spreadsheetObj, comment, row, column) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| comment | string | Yes | | No Help Available | +| row | numeric | Yes | | No Help Available | +| column | numeric | Yes | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + comment1=structNew() ; + comment1.anchor="0,0,5,8"; + comment1.author="John Jones"; + comment1.comment="This is a test comment"; + comment1.size="10"; + //Set the comment. + SpreadsheetSetCellComment(s,comment1,3,5); + //Get the comment from the Excel spreadsheet object. + theComment=SpreadsheetGetCellComment(s,3,5); + + + Row,Column: #theComment.row#,#theComment.column#
+ Author: #theComment.author#
+ Comment: #theComment.comment# +
+``` diff --git a/docs/functions/spreadsheetsetcellformula.md b/docs/functions/spreadsheetsetcellformula.md new file mode 100644 index 000000000..75f9505af --- /dev/null +++ b/docs/functions/spreadsheetsetcellformula.md @@ -0,0 +1,45 @@ +# spreadsheetSetCellFormula + + Specifies the formula for an Excel spreadsheet object cell. + +```javascript +spreadsheetSetCellFormula(spreadsheetObj, formula, row, column) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| formula | string | Yes | | No Help Available | +| row | numeric | Yes | | No Help Available | +| column | numeric | Yes | | No Help Available | + +## Script Example + +```javascript + + + + + + + + + + + + + + + SpreadsheetSetCellValue(theSheet,'SetIT',2,3); + theFormula=SpreadsheetGetCellFormula(s,2,3); + + + Row,Column: #theFormula# + +``` diff --git a/docs/functions/spreadsheetsetcellvalue.md b/docs/functions/spreadsheetsetcellvalue.md new file mode 100644 index 000000000..677887328 --- /dev/null +++ b/docs/functions/spreadsheetsetcellvalue.md @@ -0,0 +1,45 @@ +# spreadsheetSetCellValue + + Specifies the value of an Excel spreadsheet object cell. + +```javascript +spreadsheetSetCellValue(spreadsheetObj, value, row, column) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| value | string | Yes | | No Help Available | +| row | numeric | Yes | | No Help Available | +| column | numeric | Yes | | No Help Available | + +## Script Example + +```javascript + + + + + + + + + + + + + + + spreadsheetSetCellValue(s, 111, 2,1); + theFormula=SpreadsheetGetCellValue(s,2,1); + + + Row,Column: #theFormula# + +``` diff --git a/docs/functions/spreadsheetsetcolumnwidth.md b/docs/functions/spreadsheetsetcolumnwidth.md new file mode 100644 index 000000000..e196f6548 --- /dev/null +++ b/docs/functions/spreadsheetsetcolumnwidth.md @@ -0,0 +1,31 @@ +# spreadsheetSetColumnWidth + + Sets the width of a column in a worksheet. + +```javascript +spreadsheetSetColumnWidth(spreadsheetObj, columnNumber, width) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | The Excel spreadsheet object to which to set the column width. | +| columnNumber | numeric | Yes | | Specifies the column to set the width. | +| width | numeric | Yes | | Specifies the width in points. | + +## Simple spreadsheetSetColumnWidth Example + +Here,we've example to set the width for particular column in excel. + +```javascript + + + + + +``` diff --git a/docs/functions/spreadsheetsetfooter.md b/docs/functions/spreadsheetsetfooter.md new file mode 100644 index 000000000..02b668852 --- /dev/null +++ b/docs/functions/spreadsheetsetfooter.md @@ -0,0 +1,20 @@ +# spreadsheetSetFooter + + Adds a footer to the specified worksheet. + +```javascript +spreadsheetSetFooter(spreadsheetObj, leftFooter, centerFooter, rightFooter) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | The Excel spreadsheet object to which to add the footer. | +| leftFooter | string | Yes | | Adds the footer in the left side of the worksheet. | +| centerFooter | string | Yes | | Adds the footer in the center of the worksheet. | +| rightFooter | string | Yes | | Adds the footer in the right side of the worksheet. | diff --git a/docs/functions/spreadsheetsetheader.md b/docs/functions/spreadsheetsetheader.md new file mode 100644 index 000000000..291fac947 --- /dev/null +++ b/docs/functions/spreadsheetsetheader.md @@ -0,0 +1,32 @@ +# spreadsheetSetHeader + + Adds a header to the specified worksheet. + +```javascript +spreadsheetSetHeader(spreadsheetObj, leftHeader, centerHeader, rightHeader) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | The Excel spreadsheet object to which to add the header. | +| leftHeader | string | Yes | | Adds the header in the left side of the worksheet. | +| centerHeader | string | Yes | | Adds the header in the center of the worksheet. | +| rightHeader | string | Yes | | Adds the header in the right side of the worksheet. | + +## Simple spreadsheetSetHeader Example + +Here,we've example to set the header for excel file. + +```javascript + + + + + +``` diff --git a/docs/functions/spreadsheetsetrowheight.md b/docs/functions/spreadsheetsetrowheight.md new file mode 100644 index 000000000..d27e9904d --- /dev/null +++ b/docs/functions/spreadsheetsetrowheight.md @@ -0,0 +1,31 @@ +# spreadsheetSetRowHeight + + Sets the height of a row in a worksheet. + +```javascript +spreadsheetSetRowHeight(spreadsheetObj, rowNumber, height) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | The Excel spreadsheet object to which to set the column width. | +| rowNumber | numeric | Yes | | Specifies the row to set the height. | +| height | numeric | Yes | | Specifies the height in points. | + +## Simple spreadsheetSetRowHeight Example + +Here,we've example to set the height for particular row in excel. It is supported only in adobe coldfusion. + +```javascript + + + + + +``` diff --git a/docs/functions/spreadsheetshiftcolumns.md b/docs/functions/spreadsheetshiftcolumns.md new file mode 100644 index 000000000..f43948057 --- /dev/null +++ b/docs/functions/spreadsheetshiftcolumns.md @@ -0,0 +1,46 @@ +# spreadsheetShiftColumns + + shifts one or more columns in Excel spreadsheet object left or right. + +```javascript +spreadsheetShiftColumns(spreadsheetObj, start [, end] [, start]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| start | numeric | Yes | | No Help Available | +| end | numeric | No | | No Help Available | +| start | numeric | No | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + spreadsheetAddRow(s, "Name1,Beers1,Vegetables1,Fruits1,Meats1")> + + + SpreadsheetShiftColumns(s,1,6,1); + + + + + +``` diff --git a/docs/functions/spreadsheetshiftrows.md b/docs/functions/spreadsheetshiftrows.md new file mode 100644 index 000000000..456a504bc --- /dev/null +++ b/docs/functions/spreadsheetshiftrows.md @@ -0,0 +1,46 @@ +# spreadsheetShiftRows + + shifts one or more rows in Excel spreadsheet object up or down. . The contents of the shifted row, including empty cells, overwrites data in the column to which it is shifted. + +```javascript +spreadsheetShiftRows(spreadsheetObj, start, end [, rows]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| start | numeric | Yes | | No Help Available | +| end | numeric | Yes | | No Help Available | +| rows | numeric | No | | No Help Available | + +## Tag Example + +```javascript + + + + + + + + + + + + + + + + SpreadsheetShiftRows(s,2,2,2); + + + + + +``` diff --git a/docs/functions/spreadsheetwrite.md b/docs/functions/spreadsheetwrite.md new file mode 100644 index 000000000..ee86aa7a9 --- /dev/null +++ b/docs/functions/spreadsheetwrite.md @@ -0,0 +1,57 @@ +# spreadsheetwrite + + Writes Spreadsheet object into file + +```javascript +spreadsheetwrite(spreadsheetObj, fileName [, password] [, overwrite]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| spreadsheetObj | variableName | Yes | | No Help Available | +| fileName | string | Yes | | No Help Available | +| password | string | No | | No Help Available | +| overwrite | boolean | No | | No Help Available | + +## Script Example + +```javascript + + spObj = spreadsheetread("#dirname#SingleSheet.xls","Sheet2"); + spreadsheetCreateSheet(spObj,"A"); + spreadsheetaddrow(spObj,"x,x,x,x,x",3,1); + spreadsheetsetActiveSheet(spObj,"A"); + spreadsheetaddrow(spObj,"z,z,z,z,z",3,1); + spreadsheetsetActiveSheetNumber(spObj,1); + spreadsheetaddrow(spObj,"a,b,c,d,e",3,1); + SpreadsheetWrite(spObj,"#dirname#SingleSheet1.xls","yes"); + +``` + +## Script Example + +This will work if there was a place to store the xls file. + +```javascript + + + + + + + + + + + + + + + +``` diff --git a/docs/functions/sqr.md b/docs/functions/sqr.md new file mode 100644 index 000000000..8c1cf5547 --- /dev/null +++ b/docs/functions/sqr.md @@ -0,0 +1,25 @@ +# sqr + + Calculates the square root of a number. + +```javascript +sqr(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | A positive integer or a variable that contains one.
Number whose square root to get. | + +## Square Root of 144 + +```javascript +sqr(144) +``` + +### Expected Result: 12 diff --git a/docs/functions/sslcertificateinstall.md b/docs/functions/sslcertificateinstall.md new file mode 100644 index 000000000..cd5559e25 --- /dev/null +++ b/docs/functions/sslcertificateinstall.md @@ -0,0 +1,18 @@ +# sslCertificateInstall + +Installs certificates of a specific host into the JVM certificate store + +```javascript +sslCertificateInstall(host [, port]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| host | string | Yes | | | +| port | numeric | No | 443 | | diff --git a/docs/functions/sslcertificatelist.md b/docs/functions/sslcertificatelist.md new file mode 100644 index 000000000..88cf1eab2 --- /dev/null +++ b/docs/functions/sslcertificatelist.md @@ -0,0 +1,18 @@ +# sslCertificateList + +List all Certificates available on a specific host + +```javascript +sslCertificateList(host [, port]) +``` + +```javascript +returns query +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| host | string | Yes | | | +| port | numeric | No | 443 | | diff --git a/docs/functions/storeaddacl.md b/docs/functions/storeaddacl.md new file mode 100644 index 000000000..b75acb73b --- /dev/null +++ b/docs/functions/storeaddacl.md @@ -0,0 +1,46 @@ +# storeAddACL + +Adds ACL to existing ACL for object or bucket. + +```javascript +storeAddACL(url, ACLObject); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| url | string | Yes | | Amazon S3 URLs (content or object). | +| ACLObject | array | Yes | | An array of struct where each struct represents a permission or grant as discussed in ACLObject. | + +## Tag Syntax + +Use this function to add permissions to the existing ones. + +```javascript + + + + + + + + + + + + + + + + + + + + + +``` diff --git a/docs/functions/storegetacl.md b/docs/functions/storegetacl.md new file mode 100644 index 000000000..a206457e1 --- /dev/null +++ b/docs/functions/storegetacl.md @@ -0,0 +1,29 @@ +# storeGetACL + + Gets the ACL object or bucket. + +```javascript +storeGetACL(url, ACLObject); +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| ulr | string | Yes | | Amazon S3 URLs (content or object) | +| ACLObject | array | Yes | | An array of struct where each struct represents a permission or grant as discussed in ACLObject. | + +## Tag Syntax + +```javascript + + + + + + +``` diff --git a/docs/functions/storegetmetadata.md b/docs/functions/storegetmetadata.md new file mode 100644 index 000000000..6925797b6 --- /dev/null +++ b/docs/functions/storegetmetadata.md @@ -0,0 +1,23 @@ +# storeGetMetadata + + Returns the metadata related to the object or bucket. + +```javascript +storeGetMetadata(url); +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| url | string | Yes | | Amazon S3 URLs (bucket or object). | + +## Tag Syntax + +```javascript +> +``` diff --git a/docs/functions/storesetacl.md b/docs/functions/storesetacl.md new file mode 100644 index 000000000..2aa21ddfd --- /dev/null +++ b/docs/functions/storesetacl.md @@ -0,0 +1,46 @@ +# storeSetACL + + Sets the ACL for object or bucket. + +```javascript +storeSetACL(url, ACLObject); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| url | string | Yes | | Amazon S3 URLs (content or object). | +| ACLObject | array | Yes | | An array of struct where each struct represents a permission or grant as discussed in ACLObject. | + +## Tag Syntax + +Use this function to set full permission. The function overwrites all existing permissions. Only the ones you set in the current context exist. + +```javascript + + + + + + + + + + + + + + + + + + + + + +``` diff --git a/docs/functions/storesetmetadata.md b/docs/functions/storesetmetadata.md new file mode 100644 index 000000000..97a2b1f98 --- /dev/null +++ b/docs/functions/storesetmetadata.md @@ -0,0 +1,33 @@ +# storeSetMetadata + +Sets the metadata on bucket or object. + +```javascript +storeSetMetadata(url,Struct); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| url | string | Yes | | Amazon S3 URLs (bucket or object). | +| region | struct | Yes | | Represents the metadata. See Standard keys for a list of standard keys in metadata. You can also have custom metadata apart from the standard ones. | + +## Tag Syntax + +```javascript + + mydate = #now()#; + hello = structNew(); + hello.color = 'grey'; + + + + + + +``` diff --git a/docs/functions/stringeach.md b/docs/functions/stringeach.md new file mode 100644 index 000000000..f99472dbd --- /dev/null +++ b/docs/functions/stringeach.md @@ -0,0 +1,43 @@ +# stringEach + +Iterates over a string and runs the closure function for each element in the string. + +```javascript +stringEach(string,callback) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +string.each(callback) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The input string. | +| callback | any | Yes | | The closure function that is executed for each element in the string. The syntax is `callback(element,index,string)`. | + +## Full function + +```javascript +letters="ahqwz"; +callback=function(inp){ writeoutput(inp == "q");} +StringEach(letters,callback); +``` + +### Expected Result: NONOYESNONO + +## Member function + +```javascript +letters="ahqwz"; +letters.each(function(inp){writeoutput(inp == "q");}); +``` + +### Expected Result: NONOYESNONO diff --git a/docs/functions/stringevery.md b/docs/functions/stringevery.md new file mode 100644 index 000000000..f512b0630 --- /dev/null +++ b/docs/functions/stringevery.md @@ -0,0 +1,50 @@ +# stringEvery + +Determines if all elements of a string satisfy a given condition. Will return `TRUE` is all elements meet the condition, else `FALSE`. + +```javascript +stringEvery(string,callback) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +string.every(callback) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | Original input string to search. | +| callback | any | Yes | | The closure function that is executed for each element in the string. The syntax is `callback(element,index,string)`. | + +## Full function + +Do all letters in the string meet the callback condition? + +```javascript +letters="ZZazz"; +callback=function(inp){return inp=="z";} +allZs = StringEvery(letters,callback); +writeOutput(allZs) +``` + +### Expected Result: NO + +## Member function + +Do all letters in the string meet the callback condition? + +```javascript +letters="zzZZz"; +callback=function(inp){return inp=="z";} +allZs = letters.every(callback); +writeOutput(allZs) +``` + +### Expected Result: YES diff --git a/docs/functions/stringfilter.md b/docs/functions/stringfilter.md new file mode 100644 index 000000000..2bc01c1a8 --- /dev/null +++ b/docs/functions/stringfilter.md @@ -0,0 +1,50 @@ +# stringFilter + +This function uses the callback to filter the elements in a string. + +```javascript +stringFilter(string,callback) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.filter(callback) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | Original input string to search. | +| callback | any | Yes | | The closure function that is executed for each element in the string. | + +## Full function + +Return only the letters in the string that meet the callback condition. + +```javascript +letters="zzQQZ"; +callback=function(inp){return inp=="z";} +onlyZs = StringFilter(letters,callback); +writeOutput(onlyZs); +``` + +### Expected Result: zzZ + +## Member function + +Return only the letters in the string that meet the callback condition. + +```javascript +letters="zzQQZ"; +callback=function(inp){return inp=="z";} +onlyZs = letters.filter(callback); +writeOutput(onlyZs); +``` + +### Expected Result: zzZ diff --git a/docs/functions/stringlen.md b/docs/functions/stringlen.md new file mode 100644 index 000000000..178d338ec --- /dev/null +++ b/docs/functions/stringlen.md @@ -0,0 +1,43 @@ +# stringLen + +Get the length of a string. + +```javascript +stringLen(string) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +string.len() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | | + +## StringLen() example + +Output the length of the string "Hello World". + +```javascript +StringLen("Hello World") +``` + +### Expected Result: 11 + +## StringLen() using as a member function + +Output the length of the string "Hello World". + +```javascript +"Hello World".len() +``` + +### Expected Result: 11 diff --git a/docs/functions/stringmap.md b/docs/functions/stringmap.md new file mode 100644 index 000000000..55b41aefc --- /dev/null +++ b/docs/functions/stringmap.md @@ -0,0 +1,48 @@ +# stringMap + +This functions executes the callback function for each element in the string. + +```javascript +stringMap(string,callback) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.map(callback) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | Original input string. | +| callback | any | No | | The closure function that is executed for each element in the string. | + +## Full function + +Map each element of the string to a new value. + +```javascript +letters="abcdefg"; +closure=function(inp){return chr(asc(inp)+7);} +writeOutput(StringMap(letters,closure)); +``` + +### Expected Result: hijklmn + +## Member function + +Map each element of the string to a new value. + +```javascript +letters="abcdefg"; +closure=function(inp){return chr(asc(inp)+7);} +writeOutput(letters.map(closure)); +``` + +### Expected Result: hijklmn diff --git a/docs/functions/stringreduce.md b/docs/functions/stringreduce.md new file mode 100644 index 000000000..f89fd6936 --- /dev/null +++ b/docs/functions/stringreduce.md @@ -0,0 +1,49 @@ +# stringReduce + +This function iterates over every character in the string and executes the callback function to reduce the string to a single value. + +```javascript +stringReduce(string,callback,initialValue) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.reduce(callback, initialValue) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | Original input string. | +| callback | any | Yes | | Closure or a function reference. | +| initialVal | any | No | | Initial value for the reduce operation. | + +## Full function + +Reduce the string to a single value. + +```javascript +letters="abcdef"; +closure=function(inp1,inp2){return inp1 & inp2;} +writeOutput( StringReduce(letters,closure,"z") ); +``` + +### Expected Result: zabcdef + +## Member function + +Reduce the string to a single value. + +```javascript +letters="abcdef"; +closure=function(inp1,inp2){return inp1 & inp2;} +writeOutput( letters.reduce(closure,"z") ); +``` + +### Expected Result: zabcdef diff --git a/docs/functions/stringreduceright.md b/docs/functions/stringreduceright.md new file mode 100644 index 000000000..bb7ce5e5a --- /dev/null +++ b/docs/functions/stringreduceright.md @@ -0,0 +1,58 @@ +# stringReduceRight + +This function iterates over every element of the string and calls the closure to work on that element. This function will reduce the string to a single value, from the right to the left, and will return the value. +NOTE: This function is not available in Lucee 5.x or lower. Potentially use `reverse()` instead. + +```javascript +stringReduceRight(string, callback, initialValue) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +string.reduceRight(callback, initialValue) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | The input string. | +| callback | any | Yes | | Closure or a function reference that will be called for each iteration. | +| initialValue | any | Yes | | Initial value which will be used for the reduce operation. | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| result | any | No | The result of the reduce operation after the previous iteration. +| item | any | No | The value for the current iteration's item. +| index | numeric | No | The current index for the iteration +| array | array | No | A reference of the original array + +## Simple stringReduceRight Example + +Demonstrate how the function works from right to left. + +```javascript +myString="abcd"; +newString=stringReduceRight(myString,function(prev,next,idx,arr){ return prev & next & idx },"") +writedump(newString); +``` + +### Expected Result: d4c3b2a1 + +## How Do You Do This In Lucee? + +This function will be added to Lucee in Version 6. But if you need to reverse a string now, use the `reverse()` function. + +```javascript +myString="abcd"; +newString=myString.reverse(); +writedump(newString); +``` + +### Expected Result: dcba diff --git a/docs/functions/stringsome.md b/docs/functions/stringsome.md new file mode 100644 index 000000000..07ede9b61 --- /dev/null +++ b/docs/functions/stringsome.md @@ -0,0 +1,48 @@ +# stringSome + +This function calls a given closure/function with every element in a given string and returns true as soon as the callback condition is met. + +```javascript +stringSome(inputString,callback) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +inputString.some(callback) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| inputString | string | Yes | | Original input string to search. | +| callback | function | No | | The closure function that is executed for each element in the string. | + +## Full function + +Are any of the characters in the string greater than our condition? + +```javascript +instring="abcdefg"; +callback=function(inp){return inp > "f"} +writeoutput(StringSome(instring,callback)); +``` + +### Expected Result: YES + +## Member function + +Are any of the characters in the string greater than our condition? + +```javascript +instring="abcdefg"; +callback=function(inp){return inp > "f"} +writeoutput(instring.some(callback)); +``` + +### Expected Result: YES diff --git a/docs/functions/stringsort.md b/docs/functions/stringsort.md new file mode 100644 index 000000000..1f6725b89 --- /dev/null +++ b/docs/functions/stringsort.md @@ -0,0 +1,45 @@ +# stringSort + +Sorts an input string. + +```javascript +stringSort(inputString) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +inputString.sort() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| inputString | string | Yes | | The string to sort. | + +## Full function + +Sort the string. + +```javascript +letters="ZzgiSA"; +writeOutput(stringSort(letters)) +``` + +### Expected Result: ASZgiz + +## Member function + +Sort the string. + +```javascript +letters="ZzgiSA"; +writeOutput(letters.sort()) +``` + +### Expected Result: ASZgiz diff --git a/docs/functions/stripcr.md b/docs/functions/stripcr.md new file mode 100644 index 000000000..d01883b3a --- /dev/null +++ b/docs/functions/stripcr.md @@ -0,0 +1,26 @@ +# stripCR + + Deletes return characters from a string. + +```javascript +stripCR(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | A string or a variable that contains one | + +## Removing carriage returns (cr) from a string + +```javascript +x = 'A' & chr(13) & 'B' & chr(13); + y = stripcr( x ); + writeoutput( 'Original: ' & x & ' Length: #len(x)#
' ); + writeoutput( 'Stripped: ' & y & ' Length: #len(y)#' ); +``` diff --git a/docs/functions/structappend.md b/docs/functions/structappend.md new file mode 100644 index 000000000..5d4cd469c --- /dev/null +++ b/docs/functions/structappend.md @@ -0,0 +1,86 @@ +# structAppend + +Appends one structure to another. + +```javascript +structAppend(destStruct, sourceStruct [, overwriteFlag]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +destStruct.append(sourceStruct [, overwriteFlag]) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| destStruct | struct | Yes | | Structure to append. | +| sourceStruct | struct | Yes | | Structure that contains the data to append to destStruct | +| overwriteFlag | boolean | No | YES | Whether values in sourceStruct should overwrite corresponding values in
destStruct or not. | + +## Append options to config struct (without overwrite flag) + +```javascript +config = {a:0, b:0}; +options= {b:1, c:1}; +structAppend(config, options, false); +writeOutput( serializeJSON( config ) ); +``` + +### Expected Result: {"A":0,"B":0,"C":1} + +## Append options to config struct (same, but using member function) + +```javascript +config = {a:0, b:0}; +options= {b:1, c:1}; +config.append(options, false); +writeOutput( serializeJSON( config ) ); +``` + +### Expected Result: {"A":0,"B":0,"C":1} + +## Append options to config struct (with overwrite flag) + +```javascript +config = {a:0, b:0}; +options= {b:1, c:1}; +structAppend(config, options); +writeOutput( serializeJSON( config ) ); +``` + +### Expected Result: {"A":0,"B":1,"C":1} + +## Creating a request context from form and url scopes + +Demonstrates how to construct a Request Context (rc) that combines the values of the form and url scopes + +```javascript +rc = {}; +structAppend( rc, form ); +structAppend( rc, url ); +writeOutput( serializeJSON( rc ) ); +``` + +## Polyfill for earlier versions + +In older ColdFusion version where this function is not supported yet, you can fall back to a native java method to achieve the same behavior except that it does not have the `overwriteFlag`. + +```javascript +config = {a:0, b:0}; +options= {b:1, c:1}; +config.putAll(options); +writeOutput( serializeJSON( config ) ); +``` + +### Expected Result: {"A":0,"B":0,"C":1} diff --git a/docs/functions/structclear.md b/docs/functions/structclear.md new file mode 100644 index 000000000..10b890659 --- /dev/null +++ b/docs/functions/structclear.md @@ -0,0 +1,37 @@ +# structClear + + Removes all data from a structure. + +```javascript +structClear(structure) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure to clear | + +## Script Syntax + +```javascript +profile = {name:'John', instrument:'guitar', occupation:'singer'}; +structClear(profile); +writeOutput(serializeJSON(profile)); +``` + +### Expected Result: An empty struct + +## Tag Syntax + +```javascript + + + +``` + +### Expected Result: An empty struct diff --git a/docs/functions/structcopy.md b/docs/functions/structcopy.md new file mode 100644 index 000000000..289868a20 --- /dev/null +++ b/docs/functions/structcopy.md @@ -0,0 +1,36 @@ +# structCopy + + Copies a structure. Copies top-level keys, values, and arrays + in the structure by value; copies nested structures by + reference. + +```javascript +structCopy(structure) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure to copy | + +## Copy a structure and change it. Original structure stays unchanged + +```javascript +myStruct = { + 'a': 1, + 'b': 2, + 'c': 3 +}; +myNewStruct = structCopy(myStruct); +myNewStruct.b = 5; +myNewStruct['d'] = 4; +structDelete(myNewStruct,'c'); +writeOutput(structKeyList(myStruct)&' → '&structKeyList(myNewStruct)); +``` + +### Expected Result: b,a,c → b,a,d diff --git a/docs/functions/structcount.md b/docs/functions/structcount.md new file mode 100644 index 000000000..bdc6af9ed --- /dev/null +++ b/docs/functions/structcount.md @@ -0,0 +1,51 @@ +# structCount + + Counts the keys in a structure. + +```javascript +structCount(structure) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure to access | + +## Using structCount as a function + +Pass a structure as an argument to the function. + +```javascript +user = { + id = 1, + firstname = "Han", + lastname = "Solo", + movie = "Star Wars" +}; + +writeDump( structCount( user ) ); +``` + +### Expected Result: 4 + +## Using structCount as a Member Function + +CF11+ Lucee4.5+ Having a reference of a structure as a variable, use the dot notation to get a key count on it using a member function. + +```javascript +user = { + id = 1, + firstname = "Han", + lastname = "Solo", + movie = "Star Wars" +}; + +writeDump( user.count() ); +``` + +### Expected Result: 4 diff --git a/docs/functions/structdelete.md b/docs/functions/structdelete.md new file mode 100644 index 000000000..66741a90b --- /dev/null +++ b/docs/functions/structdelete.md @@ -0,0 +1,51 @@ +# structDelete + +Removes an element from a structure. + +```javascript +structDelete(structure, key [, indicateNotExisting]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someStruct.delete(key) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | string | Yes | | Structure or a variable that contains one. Contains element
to remove | +| key | string | Yes | | Element to remove | +| indicateNotExisting | boolean | No | NO | When true this function will return true only if the key that was deleted existed. When false (default) this function will return true if the key is successfully removed. | + +## Remove a key from a struct + +Creates a struct then removes a key + +```javascript +someStruct = {a=1,b=2}; +structDelete(someStruct, "a"); + +writeDump(someStruct); +``` + +### Expected Result: Struct with one key-value pair: B 2 + +## Remove a key from a struct using the member function + +CF11+ Lucee4.5+ Invoking the delete function on a struct is the same as running structDelete. + +```javascript +someStruct = {a=1, b=2}; +someStruct.delete('a'); + +writeDump(someStruct); +``` + +### Expected Result: Struct with one key-value pair: B 2 diff --git a/docs/functions/structeach.md b/docs/functions/structeach.md new file mode 100644 index 000000000..0fae46ca9 --- /dev/null +++ b/docs/functions/structeach.md @@ -0,0 +1,106 @@ +# structEach + +Used to loop over elements in a structure by accessing key-value pairs. + +```javascript +structEach(struct,function(key, value [, struct]){} [, parallel] [, maxThreads]) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +someStruct.each(function(key, value [, struct]){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct | string | Yes | | Structure or a variable that contains one. | +| callback | any | Yes | | Closure or a function reference that will be called for each of the iteration. | +| parallel | boolean | No | false | Lucee4.5+ true if the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ the maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| key | string | No | The key for the current iteration +| value | any | No | The value for the current iteration +| struct | struct | No | A reference of the original struct + +## structEach() with an inline function (closure) + +Use a function to write out the keys in a structure to the screen + +```javascript +someStruct = {a=1,b=2,c=3}; + +structEach(someStruct,function(key,value) { + writeOutput('Key ' & key & ' is ' & value & '; '); +}); +``` + +### Expected Result: Key a is 1; Key b is 2; Key c is 3; + +## Using a function reference + +```javascript +favs = {color: 'blue', food: 'pizza', sport: 'basketball'}; + // named function + // notice that the function takes two arguments, the key and value pair of the current iteration of the structure's key-value pairs + function getFavorites(key, value) { + writeOutput('My favorite ' & key & ' is ' & value); + } + // run structEach() with a named function + structEach(favs,getFavorites); + // run structEach() with an inline function + structEach(favs, function(key,value) { + writeOutput('My favorite ' & key & ' is ' & value); + }); +``` + +## Using the member function + +CF11+ Lucee4.5+ + +```javascript +statusCodes = { + OK = 200, + CREATED = 201, + NOT_MODIFIED = 304, + BAD_REQUEST = 400, + NOT_FOUND = 404 +}; + +statusCodes.each(function(key, value) { + writeOutput("#key# => #value#
"); +}); +``` + +### Expected Result: NOT_FOUND => 404 +BAD_REQUEST => 400 +CREATED => 201 +OK => 200 +NOT_MODIFIED => 304 + +## Accessing a reference to the looping struct in the callback + +Lucee4.5+ + +```javascript +statusCodes = { + OK = 200, + CREATED = 201, + NOT_MODIFIED = 304, + BAD_REQUEST = 400, + NOT_FOUND = 404 +}; + +statusCodes.each(function(key, value, struct) { + writeDump(struct); +}); +``` diff --git a/docs/functions/structequals.md b/docs/functions/structequals.md new file mode 100644 index 000000000..983c410c0 --- /dev/null +++ b/docs/functions/structequals.md @@ -0,0 +1,28 @@ +# structEquals + +Performs a deep comparison of two structures to see if they represent the same values + +```javascript +structEquals(struct1, struct2) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct1 | struct | Yes | | A structure to compare | +| struct2 | struct | Yes | | A structure to compare | + +## Append options to config struct (without overwrite flag) + +```javascript +config1 = {a:0, b:0}; +config2 = {a:0, b:1}; +writeOutput( structEquals(config1, config2) ); +``` + +### Expected Result: NO diff --git a/docs/functions/structevery.md b/docs/functions/structevery.md new file mode 100644 index 000000000..31933863d --- /dev/null +++ b/docs/functions/structevery.md @@ -0,0 +1,54 @@ +# structEvery + +This function calls a given closure/function with every element in a given struct and returns true, if all of the closure calls returns true + +```javascript +structEvery(struct, closure [, parallel] [, maxThreads]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +struct.every(closure [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct | struct | Yes | | | +| closure | function | Yes | | | +| parallel | boolean | No | | | +| maxThreads | numeric | No | 20 | | + +## Simple structEvery example + +Here we have simple example about structevery function. It is supported only in Lucee. + +```javascript +var struct = {"Name":"Dhar","Age":"20","Country":"US"}; +structevery(struct,function(key,value){ + writeOutput(key & ":" & value & " "); + return true; +}); +``` + +### Expected Result: Country:US Name:Dhar Age:20 + +## Simple structEvery member function example + +Here we have simple example about structevery member function. It is supported only in Lucee. + +```javascript +var struct = {"Name":"Dhar","Age":"20","Country":"US"}; +struct.every(function(key,value){ + writeOutput(key & ":" & value & " "); + return false; +}); +``` + +### Expected Result: Country:US diff --git a/docs/functions/structfilter.md b/docs/functions/structfilter.md new file mode 100644 index 000000000..546f31f95 --- /dev/null +++ b/docs/functions/structfilter.md @@ -0,0 +1,63 @@ +# structFilter + +Used to filter the key-value pairs in a structure. + +```javascript +structFilter(struct,function(key, value [,struct]){} [, parallel] [, maxThreads]) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +someStruct.filter(function(key, value [,struct]){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct | struct | Yes | | Name of the structure to filter | +| callback | boolean | Yes | | Closure or a function reference that will be called for each of the iteration. Returns true if the key-value pair in the structure should be included in the filtered struct. Support for passing the original struct to the closure function added in CF11 Update 5. | +| parallel | boolean | No | false | Lucee4.5+ true if the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ the maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| key | string | No | The key for the current iteration +| value | any | No | The value for the current iteration +| struct | struct | No | A reference of the original struct + +## Example using a simple numeric comparison + +Take a struct of items with their rating and use structFilter to return ones of a rating 3 and higher. + +```javascript +fruitRatings = {apple=4,banana=1,orange=5,mango=2,kiwi=3}; + +favoriteFruits = structFilter(fruitRatings, function(key, value){ + return value >= 3; +}); +writedump(favoriteFruits); +``` + +### Expected Result: {apple=4,orange=5,kiwi=3} + +## Example using a member function + +This is the same example, but using a member function on the struct instead of a standalone function. + +```javascript +fruitRatings = {apple=4,banana=1,orange=5,mango=2,kiwi=3}; + +favoriteFruits = fruitRatings.filter(function(key, value){ + return value >= 3; +}); +writedump(favoriteFruits); +``` + +### Expected Result: {apple=4,orange=5,kiwi=3} diff --git a/docs/functions/structfind.md b/docs/functions/structfind.md new file mode 100644 index 000000000..a970a815a --- /dev/null +++ b/docs/functions/structfind.md @@ -0,0 +1,40 @@ +# structFind + +Determines the value associated with a key in a structure. + +```javascript +structFind(structure, key [, defaultValue ]) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +struct.find(key [, defaultValue ]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure that contains the value to return | +| key | string | Yes | | Key whose value to return | +| defaultValue | any | No | | Lucee4.5+ Default value which will be returned if the key does not exist or if null was found. Currently only supported by Lucee. See https://docs.lucee.org/reference/functions/structfind.html#argument-defaultValue | + +## Simple example + +Searches through a structure by a given key and outputs the related value + +```javascript +countries = { + "USA"="Washington D.C.", + "Germany"="Berlin", + "Japan"="Tokio" +}; +writeOutput(structFind(countries, "Germany")); +``` + +### Expected Result: Berlin diff --git a/docs/functions/structfindkey.md b/docs/functions/structfindkey.md new file mode 100644 index 000000000..a4a766996 --- /dev/null +++ b/docs/functions/structfindkey.md @@ -0,0 +1,76 @@ +# structFindKey + + Searches recursively through a substructure of nested arrays, + structures, and other elements, for structures whose keys + match the search key in the value parameter. + +```javascript +structFindKey(top, value, scope) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +struct.findKey( value, scope ) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| top | any | Yes | | CFML object (structure or array) from which to start
search. This attribute requires an object, not a name of
an object. | | +| value | string | Yes | | String or a variable that contains one for which to search. | | +| scope | string | Yes | | * one: returns one matching key. Default.
* all: returns all matching keys | /Users/garethedwards/development/github/cfdocs/docs/functions/structfindkey.md|all | + +## Find first match for a nested struct key + +```javascript +Beatles = { + person1: { id: 1, firstName: 'John', lastName: 'Lennon' }, + person2: { id: 2, firstName: 'Paul', lastName: 'McCartney' }, + person3: { id: 3, firstName: 'George', lastName: 'Harrison' }, + person5: { id: 5, firstName: 'Abbey', lastName: 'Road' }, + person4: { id: 4, firstName: 'Ringo', lastName: 'Starr' } +}; +myKey = structFindKey( Beatles, 'lastName', 'one' ); +writeOutput( serializeJSON( myKey ) ); +``` + +### Expected Result: [{"path":".PERSON3.LASTNAME","owner":{"LASTNAME":"Harrison","FIRSTNAME":"George","ID":3},"value":"Harrison"}] + +## Find all matches of a nested struct key + +```javascript +Beatles = { + person1: { id: 1, firstName: 'John', lastName: 'Lennon' }, + person2: { id: 2, firstName: 'Paul', lastName: 'McCartney' }, + person3: { id: 3, firstName: 'George', lastName: 'Harrison' }, + person4: { id: 4, firstName: 'Ringo', lastName: 'Starr' } +}; +myKey = structFindKey( Beatles, 'lastName', 'all' ); +writeOutput( serializeJSON( myKey ) ); +``` + +### Expected Result: [{"path":".PERSON3.LASTNAME","owner":{"LASTNAME":"Harrison","FIRSTNAME":"George","ID":3},"value":"Harrison"},{"path":".PERSON1.LASTNAME","owner":{"LASTNAME":"Lennon","FIRSTNAME":"John","ID":1},"value":"Lennon"},{"path":".PERSON2.LASTNAME","owner":{"LASTNAME":"McCartney","FIRSTNAME":"Paul","ID":2},"value":"McCartney"},{"path":".PERSON4.LASTNAME","owner":{"LASTNAME":"Starr","FIRSTNAME":"Ringo","ID":4},"value":"Starr"}] + +## Find first match for a nested struct key using member function + +CF11+ calling the findKey member function on a struct. + +```javascript +Beatles = { + person1: { id: 1, firstName: 'John', lastName: 'Lennon' }, + person2: { id: 2, firstName: 'Paul', lastName: 'McCartney' }, + person3: { id: 3, firstName: 'George', lastName: 'Harrison' }, + person5: { id: 5, firstName: 'Abbey', lastName: 'Road' }, + person4: { id: 4, firstName: 'Ringo', lastName: 'Starr' } +}; +myKey = Beatles.findKey( 'lastName', 'one' ); +writeOutput( serializeJSON( myKey ) ); +``` + +### Expected Result: [{"path":".PERSON3.LASTNAME","owner":{"LASTNAME":"Harrison","FIRSTNAME":"George","ID":3},"value":"Harrison"}] diff --git a/docs/functions/structfindvalue.md b/docs/functions/structfindvalue.md new file mode 100644 index 000000000..9b32e82c5 --- /dev/null +++ b/docs/functions/structfindvalue.md @@ -0,0 +1,65 @@ +# structFindValue + + Searches recursively through a substructure of nested arrays, + structures, and other elements for structures with values that + match the search key in the value parameter. + +```javascript +structFindValue(top, value [, scope]) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +struct.findValue( value, scope ) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| top | any | Yes | | CFML object (a structure or an array) from which to
start search. This attribute requires an object, not a
name of an object. | | +| value | string | Yes | | String or a variable that contains one for which to search.
The type must be a simple object. Arrays and structures
are not supported. | | +| scope | string | No | | one: function returns one matching key (default)
all: function returns all matching keys | /Users/garethedwards/development/github/cfdocs/docs/functions/structfindvalue.md|all | + +## Find first match for a nested struct value + +```javascript +myStruct = { a=2, b=4, c=8, d=10, e=12, f=12 }; +myStruct.mySecondStruct = { a1=50, a2=12 }; +myStruct.mySecondStruct.myThirdStruct = { b1=12, b2=65 }; +myValue=StructFindValue( myStruct, "12", "one" ); +WriteOutput( serializeJSON( myValue ) ); +``` + +### Expected Result: [{"path":".E","owner":{"A":2,"B":4,"C":8,"D":10,"E":12,"F":12,"MYSECONDSTRUCT":{"A1":50,"A2":12,"MYTHIRDSTRUCT":{"B2":65,"B1":12}}},"key":"E"}] + +## Find all matches for a nested struct value + +```javascript +myStruct = { a=2, b=4, c=8, d=10, e=12, f=12 }; +myStruct.mySecondStruct = { a1=50, a2=12 }; +myStruct.mySecondStruct.myThirdStruct = { b1=12, b2=65 }; +myValue=StructFindValue( myStruct, "12", "all" ); +WriteOutput( serializeJSON( myValue ) ); +``` + +### Expected Result: [{"path":".E","owner":{"A":2,"B":4,"C":8,"D":10,"E":12,"F":12,"MYSECONDSTRUCT":{"A1":50,"A2":12,"MYTHIRDSTRUCT":{"B2":65,"B1":12}}},"key":"E"},{"path":".F","owner":{"A":2,"B":4,"C":8,"D":10,"E":12,"F":12,"MYSECONDSTRUCT":{"A1":50,"A2":12,"MYTHIRDSTRUCT":{"B2":65,"B1":12}}},"key":"F"},{"path":".MYSECONDSTRUCT.A2","owner":{"A1":50,"A2":12,"MYTHIRDSTRUCT":{"B2":65,"B1":12}},"key":"A2"},{"path":".MYSECONDSTRUCT.MYTHIRDSTRUCT.B1","owner":{"B2":65,"B1":12},"key":"B1"}] + +## Find first match for a nested struct value using member function + +CF11+ calling the findValue member function on a struct. + +```javascript +myStruct = { a=2, b=4, c=8, d=10, e=12, f=12 }; +myStruct.mySecondStruct = { a1=50, a2=12 }; +myStruct.mySecondStruct.myThirdStruct = { b1=12, b2=65 }; +myValue=myStruct.findValue( "12", "one" ); +WriteOutput( serializeJSON( myValue ) ); +``` + +### Expected Result: [{"path":".E","owner":{"A":2,"B":4,"C":8,"D":10,"E":12,"F":12,"MYSECONDSTRUCT":{"A1":50,"A2":12,"MYTHIRDSTRUCT":{"B2":65,"B1":12}}},"key":"E"}] diff --git a/docs/functions/structget.md b/docs/functions/structget.md new file mode 100644 index 000000000..12df623ee --- /dev/null +++ b/docs/functions/structget.md @@ -0,0 +1,46 @@ +# structGet + +Returns a value in a structure or a structure in the specified path. + +```javascript +structGet(path) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| path | string | Yes | | Pathname of variable that contains structure or array from which CFML retrieves the value. If there is no structure or array present in the path, this function creates structures or arrays to make it a valid variable path. | + +## Get a value in a structure using structGet + +```javascript +x = { y = { z=8 } }; +writeDump( structGet("x.y.z") ); +``` + +### Expected Result: 8 + +## Accidentally Modifying a Structure + +The structGet function will modify the variable x by adding a new structure x.a and also adds a key x.a.b to satisfy the path. + +```javascript +x = { y = { z=8 } }; +writeDump( structGet("x.a.b") ); +writeDump(x); +``` + +## Accidentally Overwriting a variable using structGet + +The value of x.y.z[2] will be set to an empty struct. + +```javascript +x = { y = { z=[1,2,3] } }; +writeDump( structGet("x.y.z[2]") ); +writeDump(x); +``` diff --git a/docs/functions/structgetmetadata.md b/docs/functions/structgetmetadata.md new file mode 100644 index 000000000..405f19959 --- /dev/null +++ b/docs/functions/structgetmetadata.md @@ -0,0 +1,23 @@ +# structGetMetadata + +Gets metadata for keys in a struct and indicates if it is an ordered struct. + +```javascript +structGetMetadata(struct) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +someStruct.getMetadata() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct | struct | Yes | | The struct in which you want to add the metadata. | diff --git a/docs/functions/structinsert.md b/docs/functions/structinsert.md new file mode 100644 index 000000000..f4355b538 --- /dev/null +++ b/docs/functions/structinsert.md @@ -0,0 +1,50 @@ +# structInsert + + Inserts a key-value pair into a structure. + +```javascript +structInsert(structure, key, value [, allowoverwrite]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure to contain the new key-value pair. | +| key | string | Yes | | Key that contains the inserted value. | +| value | any | Yes | | Value to add. | +| allowoverwrite | boolean | No | NO | Whether to allow overwriting a key. Default: False. | + +## Simple Example + +Inserts a new key/value into the structure + +```javascript +map = { + "hair" : "brown", + "eyes" : "green" +}; +structInsert(map, "lips", "red"); +writeOutput(structKeyList(map)); +``` + +### Expected Result: eyes,lips,hair + +## Overwrite Example + +Throws exception when you try to add a duplicate key, when allowoverwrite parameter is false. + +```javascript +map = { + "hair" : "brown", + "eyes" : "green" +}; +try {structInsert(map, "hair", "red", false);} +catch(any ex) {writeOutput("error!");} +``` + +### Expected Result: error! diff --git a/docs/functions/structiscasesensitive.md b/docs/functions/structiscasesensitive.md new file mode 100644 index 000000000..99ef644dc --- /dev/null +++ b/docs/functions/structiscasesensitive.md @@ -0,0 +1,62 @@ +# structIsCaseSensitive + +Determines whether a struct is case-sensitive. + +```javascript +structIsCaseSensitive(inputStruct) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +inputStruct.isCaseSensitive +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| inputStruct | struct | Yes | | The struct that needs to be checked for case sensitivity. | + +## Full Function with Explicit CaseSensitive + +Show when the struct is explicitly set to casesensitive. + +```javascript +myStruct1=StructNew("casesensitive"); +myStruct1.elem1="elEmOne"; +myStruct1.elEm2="eLemtwO"; +myStruct1.elem3="elemthree"; +writeOutPut(StructIsCaseSensitive(myStruct1)); +``` + +### Expected Result: YES + +## Member Function with Explicit CaseSensitive + +Show when the struct is explicitly set to casesensitive. + +```javascript +myStruct1=StructNew("casesensitive"); +myStruct1.elem1="elEmOne"; +myStruct1.elEm2="eLemtwO"; +myStruct1.elem3="elemthree"; +writeOutPut(myStruct1.isCaseSensitive()); +``` + +### Expected Result: YES + +## Full Function with Implicit Struct Creation and Default Case Sensitivity + +Show when the struct is implicitly created. + +```javascript +myStruct4 = {"elem1":"elEmOne","elEm2":"eLemtwO","elem3":"elemthree"} +writeOutPut(StructIsCaseSensitive(myStruct4)); +``` + +### Expected Result: NO diff --git a/docs/functions/structisempty.md b/docs/functions/structisempty.md new file mode 100644 index 000000000..edf954d03 --- /dev/null +++ b/docs/functions/structisempty.md @@ -0,0 +1,52 @@ +# structIsEmpty + + Determines whether a structure contains data. + +```javascript +structIsEmpty(structure) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +someStruct.isEmpty() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure to test | + +## Test to see if a struct is empty + +```javascript +myStruct={}; +writeOutput( structIsEmpty(myStruct) ); +``` + +### Expected Result: true + +## Test to see if a struct contains something + +```javascript +myStructWithThings={ "one": "foo", "two": "bar"}; +writeOutput( structIsEmpty(myStructWithThings) ); +``` + +### Expected Result: false + +## Using Member Function + +CF11+ Lucee4.5+ + +```javascript +myStruct={}; +writeOutput( myStruct.IsEmpty() ); +``` + +### Expected Result: true diff --git a/docs/functions/structisordered.md b/docs/functions/structisordered.md new file mode 100644 index 000000000..aaa1e6cfe --- /dev/null +++ b/docs/functions/structisordered.md @@ -0,0 +1,31 @@ +# structIsOrdered + +Check if a struct is ordered + +```javascript +structIsOrdered() +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +struct.isOrdered() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct | struct | Yes | false | Struct that should be tested whether it is ordered | + +## Check if a struct is ordered + +```javascript +structNew("ordered").isOrdered() +``` + +### Expected Result: YES diff --git a/docs/functions/structkeyarray.md b/docs/functions/structkeyarray.md new file mode 100644 index 000000000..06ea90c31 --- /dev/null +++ b/docs/functions/structkeyarray.md @@ -0,0 +1,57 @@ +# structKeyArray + +Returns the keys in a CFML structure as an array. If structure does not exist throws an exception. + +```javascript +structKeyArray(structure) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +someStruct.keyArray() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | | + +## Traditional function + +```javascript +statusCodes = { + OK = 200, + CREATED = 201, + NOT_MODIFIED = 304, + BAD_REQUEST = 400, + NOT_FOUND = 404 +}; + +writeDump(structKeyArray(statusCodes)); +``` + +### Expected Result: [NOT_FOUND, BAD_REQUEST, CREATED, OK, NOT_MODIFIED] + +## Using Member Function + +CF11+ Lucee4.5+ Retrieve a comma separated list of keys using the member function + +```javascript +statusCodes = { + OK = 200, + CREATED = 201, + NOT_MODIFIED = 304, + BAD_REQUEST = 400, + NOT_FOUND = 404 +}; + +writeDump(statusCodes.keyArray()); +``` + +### Expected Result: [NOT_FOUND, BAD_REQUEST, CREATED, OK, NOT_MODIFIED] diff --git a/docs/functions/structkeyexists.md b/docs/functions/structkeyexists.md new file mode 100644 index 000000000..4c99498ce --- /dev/null +++ b/docs/functions/structkeyexists.md @@ -0,0 +1,42 @@ +# structKeyExists + +Determines whether a specific key is present in a structure. + +```javascript +structKeyExists(structure, key) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +struct.keyExists(key) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Name of structure to test | +| key | string | Yes | | Key to test | + +## Check if server struct has OS key + +```javascript +structKeyExists(server, "os") +``` + +### Expected Result: YES + +## Check if server struct has OS key using member function + +CF11+ calling the keyExists member function on a struct. + +```javascript +server.keyExists("os") +``` + +### Expected Result: YES diff --git a/docs/functions/structkeylist.md b/docs/functions/structkeylist.md new file mode 100644 index 000000000..aef81466a --- /dev/null +++ b/docs/functions/structkeylist.md @@ -0,0 +1,60 @@ +# structKeyList + + Extracts keys from a CFML structure. + +```javascript +structKeyList(structure [, delimiter]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +someStruct.keyList([delimiter]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure from which to extract a list of keys | +| delimiter | string | No | , | Character that separates keys in list. Default: comma. | + +## Using Custom Delimiter + +Retrieve a pipe separated list of keys + +```javascript +statusCodes = { + OK = 200, + CREATED = 201, + NOT_MODIFIED = 304, + BAD_REQUEST = 400, + NOT_FOUND = 404 +}; + +writeDump(structKeyList(statusCodes, " | ")); +``` + +### Expected Result: "OK | CREATED | NOT_MODIFIED | BAD_REQUEST | NOT_FOUND" + +## Using Member Function + +CF11+ Lucee4.5+ Retrieve a comma separated list of keys using the member function + +```javascript +statusCodes = { + OK = 200, + CREATED = 201, + NOT_MODIFIED = 304, + BAD_REQUEST = 400, + NOT_FOUND = 404 +}; + +writeDump(statusCodes.keyList()); +``` + +### Expected Result: "OK,CREATED,NOT_MODIFIED,BAD_REQUEST,NOT_FOUND" diff --git a/docs/functions/structkeytranslate.md b/docs/functions/structkeytranslate.md new file mode 100644 index 000000000..001b3632b --- /dev/null +++ b/docs/functions/structkeytranslate.md @@ -0,0 +1,25 @@ +# structKeyTranslate + +Converts structure key/value pairs where the key contains a period (.) into nested structures key / value pairs + +```javascript +structKeyTranslate(structure [, deepTranslation] [, leaveOriginalKey]) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +structure.keyTranslate([deepTranslation] [, leaveOriginalKey]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | | +| deepTranslation | boolean | No | | | +| leaveOriginalKey | boolean | No | | | diff --git a/docs/functions/structlistnew.md b/docs/functions/structlistnew.md new file mode 100644 index 000000000..2b13ae862 --- /dev/null +++ b/docs/functions/structlistnew.md @@ -0,0 +1,29 @@ +# structListNew + +Creates a new structure, that has a maximum number of items. It will maintain the insertion order of the structure. + +```javascript +structListNew(maxsize) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| maxsize | numeric | Yes | | The maximum number of items that this struct will hold. | + +## New struct using function + +Creates an ordered struct with a maximum of 3 items. + +```javascript +sampleStruct = structListNew(3); +sampleStruct.a = 1; +sampleStruct.b = 2; +sampleStruct.c = 3; +writeDump( sampleStruct ); +``` diff --git a/docs/functions/structmap.md b/docs/functions/structmap.md new file mode 100644 index 000000000..083267ce1 --- /dev/null +++ b/docs/functions/structmap.md @@ -0,0 +1,82 @@ +# structMap + +Iterates over every entry of the Struct and calls the closure function to work on the key value pair of the struct. The returned value will be set for the same key in a new struct and the new struct will be returned. + +```javascript +structMap(struct, function(key, value [,struct]){} [, parallel] [, maxThreads]) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +someStruct.map(function(key, value [,struct]){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct | struct | Yes | | The input struct. | +| callback | any | Yes | | Closure or a function reference that will be called for each of the iteration. | +| parallel | boolean | No | false | Lucee4.5+ true if the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ the maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| key | string | No | The key for the current iteration +| value | any | No | The value for the current iteration +| struct | struct | No | A reference of the original struct + +## Script Syntax + +```javascript +original = { + "one": { + 1: "tahi" + }, + "two": { + 2: "rua" + }, + "three": { + 3: "toru" + }, + "four": { + 4: "wha" + } +}; +function mapOriginal(k,v) { + return v[ListFirst(v.keyList())]; +} +fixed = structMap(original,mapOriginal); +writeDump([original, fixed]); +``` + +## Using Member Function + +CF11+ Lucee4.5+ + +```javascript +original = { + "one": { + 1: "tahi" + }, + "two": { + 2: "rua" + }, + "three": { + 3: "toru" + }, + "four": { + 4: "wha" + } +}; +fixed = original.map(function(k,v) { + return v[ListFirst(v.keyList())]; +}); +writeDump([original, fixed]); +``` diff --git a/docs/functions/structnew.md b/docs/functions/structnew.md new file mode 100644 index 000000000..1bdcdd758 --- /dev/null +++ b/docs/functions/structnew.md @@ -0,0 +1,118 @@ +# structNew + +Creates a new, empty structure. The shorthand syntax for an empty unordered struct is `{}`. You can also use the syntax `{"key":"value"}` to initialize it with values. The shorthand syntax for an ordered struct is `[:]` or `[=]`. The shorthand for a case-sensitive struct is `${}`.The shorthand for a ordered and casesensitive struct is `$[=]`. +NOTE: To preserve the case of the struct key, place quotes around it, otherwise it will be converted to uppercase. + +```javascript +structNew([type[[,sortType][,sortOrder][,localeSensitive]|[,callback]]]) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | No | | CF2016+ Lucee4.5+ If set to `ordered` the order in which elements are added to the structure will be maintained. In Lucee `linked` can be used in place of `ordered`.
CF2021+ If set to `casesensitive` the keys will remain case-sensitive. Additionally, `ordered-casesensitive` can be used to create an ordered case-sensitive struct. | +| sortType | string | No | | CF2016u3+ Sort types are text or numeric. | +| sortOrder | string | No | asc | CF2016u3+ The order of the sort (ascending or descending). | +| localeSensitive | boolean | No | false | CF2016u3+ Specify if you wish to do a locale sensitive sorting. | +| callback | function | No | | CF2016u3+ A comparator function used to sort new data entered into the structure. Returns 1, 0 or -1. | + +## New struct using literal notation + +Creates an unordered struct. + +```javascript +unordered = { a=1, c=3, b=2 }; +writeDump( unordered ); +``` + +## New struct using function + +Creates an unordered struct. + +```javascript +unordered = structNew(); +unordered.a = 1; +unordered.b = 2; +unordered.c = 3; +writeDump( unordered ); +``` + +## New ordered struct using literal notation + +CF2016+ Creates an ordered struct. Note the square brackets. + +```javascript +ordered = [ a=1, b=2, c=3 ]; +writeDump( ordered ); +``` + +## New ordered struct using function + +CF2016+ Lucee4.5+ Creates an ordered struct. + +```javascript +ordered = structNew( "ordered" ); +ordered.a = 1; +ordered.b = 2; +ordered.c = 3; +writeDump( ordered ); +``` + +## New ordered struct using literal notation + +CF2016+ Lucee5+ Creates an ordered struct. + +```javascript +ordered = [:]; +ordered.a = 1; +ordered.b = 2; +ordered.c = 3; +writeDump( ordered ); +``` + +## New case-sensitive struct using function + +CF2021+ Creates a case-sensitive struct. + +```javascript +casesensitive = structNew( "casesensitive" ); +casesensitive.a = 1; +casesensitive.B = 2; +casesensitive.c = 3; +writeDump( casesensitive ); +``` + +## New case-sensitive struct using literal notation + +CF2021+ Creates a case-sensitive struct. + +```javascript +casesensitive = ${a=1, B=2, c=3}; +writeDump( casesensitive ); +``` + +## New ordered and case-sensitive struct using function + +CF2021+ Creates a case-sensitive struct. + +```javascript +someStruct = structNew( "ordered-casesensitive" ); +someStruct.c = 3; +someStruct.B = 2; +someStruct.a = 1; +writeDump( someStruct ); +``` + +## New ordered and case-sensitive struct using literal notation + +CF2021+ Creates an ordered and case-sensitive struct. + +```javascript +someStruct = $[c=3, B=2, a=1]; +writeDump( someStruct ); +``` diff --git a/docs/functions/structreduce.md b/docs/functions/structreduce.md new file mode 100644 index 000000000..383dfc553 --- /dev/null +++ b/docs/functions/structreduce.md @@ -0,0 +1,63 @@ +# structReduce + +Iterates over every entry of the struct and calls the closure to work on the key value pair of the struct. This function will reduce the struct to a single value and will return the value. + +```javascript +structReduce(struct, function(result, key, value [,struct]){} [, initialVal]) +``` + +```javascript +returns any +``` + +## Member Function Syntax + +```javascript +someStruct.reduce(function(result, key, value [,struct]){} [, initialVal]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct | struct | Yes | | The input struct. | +| callback | any | Yes | | Closure or a function reference that will be called for each of the iteration. | +| initialVal | any | No | | Initial value which will be used for the reduce operation. | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| result | any | No | The result of the reduce operation after the previous iteration +| key | string | No | The key for the current iteration +| value | any | No | The value for the current iteration +| struct | struct | No | A reference of the original struct + +## Script Syntax + +```javascript +rainbow = { "Red"="Whero", "Orange"="Karaka", "Yellow"="Kowhai", "Green"="Kakariki" }; + ui = structReduce( rainbow, function(previousValue, key, value) + { + return previousValue & "
#key#
#value#
"; + }, + "
" + ) & "
"; + writeDump(rainbow); + writeOutput(ui); +``` + +## Using Member Function + +CF11+ Lucee4.5+ + +```javascript +rainbow = { "Red"="Whero", "Orange"="Karaka", "Yellow"="Kowhai", "Green"="Kakariki" }; + ui = rainbow.reduce( function(previousValue, key, value) + { + return previousValue & "
#key#
#value#
"; + }, + "
" + ) & "
"; + writeDump(rainbow); + writeOutput(ui); +``` diff --git a/docs/functions/structsetmetadata.md b/docs/functions/structsetmetadata.md new file mode 100644 index 000000000..393751f44 --- /dev/null +++ b/docs/functions/structsetmetadata.md @@ -0,0 +1,62 @@ +# structSetMetadata + +Sets metadata for a key in a struct. When you want to SerializeJSON, the key and the value will be display as you defined in the metadata. + +```javascript +structSetMetadata(inputStruct, metaStruct) +``` + +```javascript +returns void +``` + +## Member Function Syntax + +```javascript +inputStruct.setMetadata(metaStruct) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| inputStruct | struct | Yes | | The struct in which you want to add the metadata. | +| metaStruct | struct | Yes | | The metadata struct you want to add. | + +## Add metadata to a struct + +Add metadata to a struct and serialize to a json. +It is changing the keyname and convert a string ("20") to a number. + +```javascript +testStruct = structNew("ordered"); +testStruct.testdata = "example"; +testStruct.testdata2 = "20"; +metadata = { + testdata: {type: "string", name: "td1" }, + testdata2: {type: "numeric", name: "td2" } +}; +StructSetMetadata(testStruct,metadata); +writeoutput(SerializeJSON(testStruct)); +``` + +### Expected Result: {"td1":"example", "td2":20.0} + +## Add metadata to a struct as a member function + +Add metadata to a struct and serialize to a json. +It is changing the keyname and convert a string ("20") to a number. + +```javascript +testStruct = structNew("ordered"); +testStruct.testdata = "example"; +testStruct.testdata2 = "20"; +metadata = { + testdata: {type: "string", name: "td1" }, + testdata2: {type: "numeric", name: "td2" } +}; +testStruct.setMetadata(metadata); +writeoutput(SerializeJSON(testStruct)); +``` + +### Expected Result: {"td1":"example", "td2":20.0} diff --git a/docs/functions/structsome.md b/docs/functions/structsome.md new file mode 100644 index 000000000..3f4bc8c34 --- /dev/null +++ b/docs/functions/structsome.md @@ -0,0 +1,65 @@ +# structSome + +This function calls a given closure/function with every element in a given struct and returns true, if one of the closure calls returns true + +```javascript +structSome(struct, function(key, value [,struct]){} [, parallel] [, maxThreads]) +``` + +```javascript +returns boolean +``` + +## Member Function Syntax + +```javascript +struct.some(function(key, value [,struct]){} [, parallel] [, maxThreads]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct | struct | Yes | | | +| callback | boolean | Yes | | Closure or a function reference that will be called for each of the iteration. | +| parallel | boolean | No | false | Lucee4.5+ true if the items can be executed in parallel | +| maxThreads | numeric | No | 20 | Lucee4.5+ the maximum number of threads to use when parallel = true | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| key | string | No | The key for the current iteration +| value | any | No | The value for the current iteration +| struct | struct | No | A reference of the original struct + +## The simple StructSome example + +Here we have simple example about structsome function. + +```javascript + +struct={"Name":"Raja","age":20,"mark":80}; +result = structSome(struct,function(key,value){ + return key IS "Name" +}); +writeOutput((result ? '' : 'No')& " Key Exists.") + +``` + +### Expected Result: Key Exists. + +## The structSome member function example + +Here we have simple example about structsome as member function. + +```javascript + +struct={"Name":"Raja","age":20,"mark":80}; +result = struct.some(function(key,value){ + return key IS "average" +}); +writeOutput((result ? '' : 'No')&" Key Exists.") + +``` + +### Expected Result: No Key Exists. diff --git a/docs/functions/structsort.md b/docs/functions/structsort.md new file mode 100644 index 000000000..1a4ab1456 --- /dev/null +++ b/docs/functions/structsort.md @@ -0,0 +1,74 @@ +# structSort + +Returns a sorted array of the top level keys in a structure. Sorts using alphabetic or numeric sorting, and can sort based on the values of any structure element. + +```javascript +structSort(struct [, sortType, sortOrder, path, localeSensitive]) +structSort(struct, callback) +``` + +```javascript +returns array +``` + +## Member Function Syntax + +```javascript +struct.sort([sortType, sortOrder, path, localeSensitive]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| struct | struct | Yes | | A ColdFusion structure | +| sortType | string | No | text | * numeric
* text: case-sensitive
* textnocase | +| sortOrder | string | No | asc | * asc: ascending (a to z) sort order.
* desc: descending (z to a) sort order | +| path | string | No | | Top-level key path; String or a variable that contains one | +| localeSensitive | boolean | No | NO | CF10+ Respect locale-specific characters (including support for umlaut characters) while sorting
(Applies to type"text" and "textnocase". | +| callback | function | No | | CF2016+ A closure for sorting which takes two keys of the struct and returns whether the first value is greater than, equal to, or less than the second value. Inside compare function can be used (compare, compareNoCase, dateCompare or custom). `function(key1, key2)` | + +## Numeric sorting + +```javascript +someStruct = {red=93,yellow=90,green=94}; +result = structSort(someStruct, "numeric", "desc"); +writeOutput( lcase(serializeJSON(result)) ); +``` + +### Expected Result: ["green", "red", "yellow"] + +## Sort by subelement + +```javascript +someStruct = {}; +someStruct.scott = {age=26, department="General"}; +someStruct.glan = {age=29, department="computer"}; +someStruct.george = {age=31, department="Physical"}; +result = structSort(someStruct, "textnocase", "asc", "department"); +writeOutput( lcase(serializeJSON(result)) ); +``` + +### Expected Result: ["glan","scott","george"] + +## Date sorting using callback + +Compare values via dateCompare + +```javascript +birthdays = { + 'Jim': '1982/12/5', + 'Anne': '1968/9/13', + 'Thomas': '1975/3/28' +}; + +sorted = structSort(birthdays,function(e1,e2) { + return dateCompare(e1,e2); +}); + +for(birthday in sorted) { + writeOutput(birthday&' ('&dateDiff('yyyy',birthdays[birthday],now())&'), '); +} +``` + +### Expected Result: Anne (49), Thomas (42), Jim (35), diff --git a/docs/functions/structtoquerystring.md b/docs/functions/structtoquerystring.md new file mode 100644 index 000000000..b67ff9c8d --- /dev/null +++ b/docs/functions/structtoquerystring.md @@ -0,0 +1,38 @@ +# structToQueryString + +Converts a struct to a query string using the specified delimiter. + +```javascript +structToQueryString(structure, delimiter) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +structure.structToQueryString(delimiter) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure or a variable that contains one. | +| delimiter | string | No | & | Delimiter to use in between key/value pairs. Default is &. | + +## structToQueryString with the default delimiter + +Converting a struct to a query string using the default delimiter (&) + +```javascript +someStruct = { + "firstName": "John", + "lastName": "Doe" +}; +writeDump( structToQueryString( someStruct ) ); +``` + +### Expected Result: firstName=John&lastName=Doe diff --git a/docs/functions/structtosorted.md b/docs/functions/structtosorted.md new file mode 100644 index 000000000..cef5bf6bb --- /dev/null +++ b/docs/functions/structtosorted.md @@ -0,0 +1,142 @@ +# structToSorted + +Converts a struct to an ordered one + +```javascript +structToSorted(structure, callback) +structToSorted(structure, sorttype, sortorder, localeSensitive) +``` + +```javascript +returns struct +``` + +## Member Function Syntax + +```javascript +structure.toSorted(callback) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure or a variable that contains one. | +| callback | function | No | | Closure or function reference that will be called for each iteration. Should return -1, 0 or 1. | +| sorttype | string | No | text | | +| sortorder | string | No | asc | * asc: ascending (a to z) sort order.
* desc: descending (z to a) sort order | +| localeSensitive | boolean | No | NO | Respect locale-specific characters (including support for umlaut characters) while sorting (applies to type"text"). | + +### callback ( callback arguments ) +| Name | Type | Required | Description | +| --- | --- | --- | --- | +| value1 | any | No | The value of the first key/value pair +| value2 | any | No | The value of the second key/value pair +| key1 | string | No | The key name of the first key/value pair +| key2 | string | No | The key name of the second key/value pair + +## structToSorted with an inline function sorting by key value + +Use a function to sort the keys by numeric value descending + +```javascript +someStruct = { + "NINE": 9, + "SIX": 6, + "THREE": 3, + "TWELVE": 12, + "tres": 3, + "seis": 6, + "nueve": 9, + "doce": 12 +}; + +function sortByNumericValuesDescending(value1, value2, key1, key2) { + if (value1 > value2) { + return -1; + } + return 1; +}; + +sortedStruct=StructToSorted(someStruct, sortByNumericValuesDescending); +writedump(sortedStruct); +``` + +### Expected Result: A new struct with the keys ordered by value descending + +## structToSorted member function with an inline function sorting by key value + +Use a function to sort the keys by numeric value descending + +```javascript +someStruct = { + "NINE": 9, + "SIX": 6, + "THREE": 3, + "TWELVE": 12, + "tres": 3, + "seis": 6, + "nueve": 9, + "doce": 12 +}; + +function sortByNumericValuesDescending(value1, value2, key1, key2) { + if (value1 > value2) { + return -1; + } + return 1; +}; + +sortedStruct=someStruct.ToSorted(sortByNumericValuesDescending); +writedump(sortedStruct); +``` + +### Expected Result: A new struct with the keys ordered by value descending + +## structToSorted member function with an inline function sorting by key name + +Use a function to sort the keys by name + +```javascript +someStruct = { + "NINE": 9, + "SIX": 6, + "THREE": 3, + "TWELVE": 12, + "tres": 3, + "seis": 6, + "nueve": 9, + "doce": 12 +}; + +function sortByKeyName(value1, value2, key1, key2) { + return compareNoCase(key1, key2); +} + +sortedStruct=someStruct.ToSorted(sortByKeyName); +writedump(sortedStruct); +``` + +### Expected Result: A new struct with the keys ordered by key name + +## structToSorted member function with sorttype argument + +Use a function to sort the keys by name + +```javascript +someStruct = { + "NINE": 9, + "SIX": 6, + "THREE": 3, + "TWELVE": 12, + "tres": 3, + "seis": 6, + "nueve": 9, + "doce": 12 +}; + +sortedStruct=someStruct.ToSorted("text","asc",false); +writedump(sortedStruct); +``` + +### Expected Result: A new struct with the keys ordered by key name diff --git a/docs/functions/structupdate.md b/docs/functions/structupdate.md new file mode 100644 index 000000000..4ce1a04ab --- /dev/null +++ b/docs/functions/structupdate.md @@ -0,0 +1,31 @@ +# structUpdate + + Updates a key with a value. + +```javascript +structUpdate(structure, key, value) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | Structure to update | +| key | string | Yes | | Key, the value of which to update | +| value | any | Yes | | New value | + +## Updates a structure value at specific key + +Change value of structure item + +```javascript +myStruct = {a: 1, b: 2, c: 3, d: 4}; +structUpdate(myStruct,'c',15); +writeDump(serializeJSON(myStruct)); +``` + +### Expected Result: {"A":1,"B":2,"C":15,"D":4} diff --git a/docs/functions/structvaluearray.md b/docs/functions/structvaluearray.md new file mode 100644 index 000000000..61e04cdb8 --- /dev/null +++ b/docs/functions/structvaluearray.md @@ -0,0 +1,33 @@ +# structValueArray + +Returns all the values as an array + +```javascript +structValueArray(structure) +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| structure | struct | Yes | | | + +## Traditional function + +```javascript +statusCodes = { + OK = 200, + CREATED = 201, + NOT_MODIFIED = 304, + BAD_REQUEST = 400, + NOT_FOUND = 404 +}; + +writeDump(structValueArray(statusCodes)); +``` + +### Expected Result: [200, 201, 304, 400, 404] diff --git a/docs/functions/systemcacheclear.md b/docs/functions/systemcacheclear.md new file mode 100644 index 000000000..f35db979e --- /dev/null +++ b/docs/functions/systemcacheclear.md @@ -0,0 +1,33 @@ +# systemCacheClear + +Clears all caches or the specified cache + +```javascript +systemCacheClear([cacheName]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| cacheName | string | No | | Name of the cache you want to clear. If not specified it will clear all caches.
Some cachenames are aliases:
page = template
cfc, class = component
ct = customtag
object = query | /Users/garethedwards/development/github/cfdocs/docs/functions/systemcacheclear.md|function | + +## Clear all caches + +Clear all caches. + +```javascript +systemCacheClear(); +``` + +## Clear the template cache + +Clear the template cache. + +```javascript +systemCacheClear("template"); +``` diff --git a/docs/functions/systemoutput.md b/docs/functions/systemoutput.md new file mode 100644 index 000000000..d6552f768 --- /dev/null +++ b/docs/functions/systemoutput.md @@ -0,0 +1,37 @@ +# systemOutput + +Writes the given object to the output stream + +```javascript +systemOutput(obj [, addNewLine] [, doErrorStream]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| obj | any | Yes | | | +| addNewLine | boolean | No | | | +| doErrorStream | boolean | No | | | + +## Write a string to the output stream "Hello World" + +```javascript +systemOutput("Hello World"); +``` + +## Write an array to the output stream + +```javascript +systemOutput([ "foo", "bar" ]); +``` + +## Write a struct to the output stream + +```javascript +systemOutput({ "myKey", "myValue" }); +``` diff --git a/docs/functions/tan.md b/docs/functions/tan.md new file mode 100644 index 000000000..9f3c7a523 --- /dev/null +++ b/docs/functions/tan.md @@ -0,0 +1,25 @@ +# tan + + Calculates the tangent of an angle that is entered in radians. + +```javascript +tan(number) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| number | numeric | Yes | | Angle, in radians, for which to calculate the tangent | + +## Tangent of 0.3 + +```javascript +tan(0.3) +``` + +### Expected Result: 0.30933624961 diff --git a/docs/functions/threadjoin.md b/docs/functions/threadjoin.md new file mode 100644 index 000000000..17a7c320d --- /dev/null +++ b/docs/functions/threadjoin.md @@ -0,0 +1,18 @@ +# threadJoin + +Waits for the given thread object to finish running + +```javascript +threadJoin() +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| threadName | string | No | | Thread to join

If no `threadName` is specified, all running threads will be affected.
You can pass a threadname as string or multiple threads as comma-separated list | +| timeout | numeric | No | 0 | The number of milliseconds for which to suspend thread processing | diff --git a/docs/functions/threadnew.md b/docs/functions/threadnew.md new file mode 100644 index 000000000..79a012020 --- /dev/null +++ b/docs/functions/threadnew.md @@ -0,0 +1,20 @@ +# threadNew + +Creates a new thread of execution based on the passed closure/lambda. + +```javascript +threadNew() +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| runnable | function | Yes | | The closure/lambda to execute in the new thread. | | +| attributes | struct | No | {} | A struct of data to bind into the thread's scope. | | +| name | string | No | | The name for the thread. | | +| priority | string | No | normal | The priority of the thread. | /Users/garethedwards/development/github/cfdocs/docs/functions/threadnew.md|low | diff --git a/docs/functions/threadterminate.md b/docs/functions/threadterminate.md new file mode 100644 index 000000000..ef3d1b7a3 --- /dev/null +++ b/docs/functions/threadterminate.md @@ -0,0 +1,17 @@ +# threadTerminate + +Terminates the thread specified by the threadName parameter. + +```javascript +threadTerminate(threadname) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| threadname | string | Yes | | Thread to be terminated | diff --git a/docs/functions/throw.md b/docs/functions/throw.md new file mode 100644 index 000000000..ef33045c9 --- /dev/null +++ b/docs/functions/throw.md @@ -0,0 +1,43 @@ +# throw + +Throws a developer-specified exception, which can be caught + with a catch block. + +```javascript +throw([message] [, type] [, detail] [, errorcode] [, extendedinfo] [, object]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| message | string | No | | Message that describes exception event. | +| type | string | No | Custom | * A custom type
* Application
Do not enter another predefined type; types are not
generated by CFML applications. If you specify
Application, you need not specify a type for cfcatch. | +| detail | string | No | | Description of the event. CFML appends error position
to description; server uses this parameter if an error is
not caught by your code. | +| errorcode | string | No | | A custom error code that you supply. | +| extendedinfo | string | No | | Additional custom error data that you supply. | +| object | any | No | | Requires the value of the cfobject tag name attribute.

Throws a Java exception from a CFML tag.

This attribute is mutually exclusive with all other
attributes of this tag. | + +## Throw a custom exception + +Use the throw function to throw a custom application exception. + +```javascript + +throw(type="MyCustomError", message="A custom error has been thrown!"); + +``` + +## Throw a custom http response exception + +Use the throw function to throw a custom exception when the http response is invalid. + +```javascript +if (!isJSON(httpResponse.fileContent)) { + throw(type="InvalidHTTPResponse",message="The http response was not valid JSON"); +} +``` diff --git a/docs/functions/timeformat.md b/docs/functions/timeformat.md new file mode 100644 index 000000000..23daad22b --- /dev/null +++ b/docs/functions/timeformat.md @@ -0,0 +1,52 @@ +# timeFormat + +Formats a time value using US English time formatting conventions. If no mask is specified, returns a time value using the hh:mm tt format. For international time formatting, see LSTimeFormat. + +```javascript +timeFormat(time [, mask]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +time.timeFormat([mask]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| time | date | Yes | | A date/time value or string to convert | | +| mask | string | No | hh:mm tt | Masking characters that determine the format.
`h`,`hh`: Hours in 12 hour format
,`H`,`HH`: Hours in 24 hour format
`m`,`mm`: Minutes
`s`,`ss`: Seconds
`l`: Milliseconds
`t`: A or P
`tt`: AM or PM
`z`: Time zone in literal format, for example GMT
`Z`: Time zone in hours offset (RFC822), for example +0400
`X`,`XX`,`XXX`: Time zone in hours of offset in ISO 8601 format
`"short"`: `h:mm tt`
`"medium"`: `h:mm:ss tt` | /Users/garethedwards/development/github/cfdocs/docs/functions/timeformat.md|full | + +## Format a 12 hour time with am/pm + +```javascript +timeFormat( createDateTime(2017, 8, 31, 15, 25, 11), "h:mm tt") +``` + +### Expected Result: 3:25 PM + +## Member Function Example + +Requires CF11+ or Lucee5+ + +```javascript +createDateTime(2017, 8, 31, 15, 25, 11).timeFormat("h:mm tt") +``` + +### Expected Result: 3:25 PM + +## Omitting the Mask + +Should default mask to `hh:mm tt` + +```javascript +timeFormat( createDateTime(2017, 8, 31, 15, 25, 11) ) +``` + +### Expected Result: 03:25 PM diff --git a/docs/functions/tobase64.md b/docs/functions/tobase64.md new file mode 100644 index 000000000..72ba002f6 --- /dev/null +++ b/docs/functions/tobase64.md @@ -0,0 +1,39 @@ +# toBase64 + + Calculates the Base64 representation of a string or binary + object. The Base64 format uses printable characters, allowing + binary data to be sent in forms and e-mail, and stored in a + database or file. + +```javascript +toBase64(string_or_object [, encoding]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| string_or_object | any | Yes | | A string, the name of a string, or a binary object. | | +| encoding | string | No | | For a string, defines how characters are represented in a
byte array. | /Users/garethedwards/development/github/cfdocs/docs/functions/tobase64.md|utf-16 | + +## String Example + +Converts a String to a Base64-String. + +```javascript +ToBase64("Test String") +``` + +### Expected Result: VGVzdCBTdHJpbmc= + +## Binary Object Example + +Converts an Image Binary to a Base64-String. + +```javascript +ToBase64(ToBinary(ImageRead("example.jpg"))) +``` diff --git a/docs/functions/tobinary.md b/docs/functions/tobinary.md new file mode 100644 index 000000000..8e72ca1db --- /dev/null +++ b/docs/functions/tobinary.md @@ -0,0 +1,17 @@ +# toBinary + + Calculates the binary representation of Base64-encoded data. + +```javascript +toBinary(base64_or_object) +``` + +```javascript +returns binary +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| base64_or_object | any | Yes | | A string or a variable that contains one:
* In Base64 format to convert to binary
* In binary format to test whether it is valid | diff --git a/docs/functions/tonumeric.md b/docs/functions/tonumeric.md new file mode 100644 index 000000000..f6e58bbac --- /dev/null +++ b/docs/functions/tonumeric.md @@ -0,0 +1,42 @@ +# toNumeric + +Cast a value to a number. + +```javascript +toNumeric(value [, radix]) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| value | any | Yes | | | | +| radix | any | No | 10 | The base of the value. | /Users/garethedwards/development/github/cfdocs/docs/functions/tonumeric.md|hex | + +## Cast a string to a number. + +```javascript +toNumeric("29.5") +``` + +### Expected Result: 29.5 + +## Cast a hex-value to a number. + +```javascript +toNumeric("FF0011", "hex") +``` + +### Expected Result: 16711697 + +## Cast a binary-value to a number. + +```javascript +toNumeric("1010", "bin") +``` + +### Expected Result: 10 diff --git a/docs/functions/toscript.md b/docs/functions/toscript.md new file mode 100644 index 000000000..1c0cf175e --- /dev/null +++ b/docs/functions/toscript.md @@ -0,0 +1,117 @@ +# toScript + + Creates a JavaScript or ActionScript expression that + assigns the value of a ColdFusion variable to a JavaScript + or ActionScript variable. This function can convert + ColdFusion strings, numbers, arrays, structures, and + queries to JavaScript or ActionScript syntax that defines + equivalent variables and values. + +```javascript +toScript(cfvar, javascriptvar [, outputformat] [, asformat]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| cfvar | any | Yes | | A ColdFusion variable. This can contain one of the following:
String, Number, Array, Structure or Query. | +| javascriptvar | string | Yes | | A string that specifies the name of the JavaScript variable
that the toScript function creates. | +| outputformat | boolean | No | YES | A Boolean value that determines whether to create
WDDX (JavaScript) or ActionScript style output for
structures and queries.
Default: true | +| asformat | boolean | No | NO | A Boolean value that specifies whether to use
ActionScript shortcuts in the script.
Default: false | + +## Multiple to Script Examples + +Converts coldfusion objects to JavaScript syntax for use + +```javascript +

ToScript

+ +

Converting a string variable

+ + +The thisString variable in ColdFusion
+#thisString#
+
+The output of ToScript(thisString, "jsVar")
+#ToScript(thisString, "jsVar")#
+
+In a JavaScript script, convert thisString Variable to JavaScript +and output the resulting variable:
+ +
+ +

Converting an array

+ + + + + + + +The ColdFusion myArray Array
+ + +myArry[#i#]: #myArray[i]#
+
+
+The output of ToScript(myArray, "jsArray")
+#toScript(myArray, "jsArray")#
+
+In JavaScript, convert myArray to a JavaScript variable and write it's contents
+ +
+

Converting a query

+This section converts the following query object to both WDDX format +and ActionScript type JavaScript objects.
+ + + + + + + + + + + + + + SELECT id, title FROM news + ORDER BY title DESC + +
+The Query in ColdFusion + + + + + +JavaScript generated by ToScript(sortedNews, "WDDXQuery"):
+#toScript(sortedNews, "WDDXQuery")#;
+
+JavaScript generated by ToScript(sortedNews, "ActionScriptQuery", +False):
+#toScript(sortedNews, "ActionScriptQuery", False)#
+
+ + + +
+``` diff --git a/docs/functions/tostring.md b/docs/functions/tostring.md new file mode 100644 index 000000000..78d961a77 --- /dev/null +++ b/docs/functions/tostring.md @@ -0,0 +1,61 @@ +# toString + + Converts a value to a string. +Lucee parses numbers with one decimal place. +complex object types can only be used in combination with the member syntax. + +```javascript +toString(any_value [, encoding]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +any_value.toString() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| any_value | any | Yes | | Value to convert to a string | | +| encoding | string | No | | The character encoding (character set) of the string.

The default value is the encoding of the page on which the function is called. | /Users/garethedwards/development/github/cfdocs/docs/functions/tostring.md|utf-16 | + +## Base64 value to binary to string + +```javascript +base64Value = toBase64( "stringValue" ); +binaryValue = toBinary( base64Value ); +stringValue = toString( binaryValue ); +writeOutput(stringValue); +``` + +### Expected Result: Expected Result: stringValue + +## Structure to String + +```javascript +s = { + "a": "1", + "b":"2" +}; +writeOutput(toString(s)); +``` + +### Expected Result: {a={1},b={2}} + +## Member syntax + +CF number toString as a method +CAUTION: While CF returns an integer (42), Lucee returns a double (42.0), that's because while CF stores the value as `java.lang.Integer` (CF2018+) resp. `java.lang.String` (CF2016+), Lucee calls this method on `java.lang.Double`. + +```javascript +num = 42; +writeOutput(num.toString()); +``` + +### Expected Result: 42 diff --git a/docs/functions/trace.md b/docs/functions/trace.md new file mode 100644 index 000000000..839eb1eec --- /dev/null +++ b/docs/functions/trace.md @@ -0,0 +1,33 @@ +# trace + + Displays and logs debugging data about the state of an + application at the time the cftrace tag executes. Tracks + runtime logic flow, variable values, and execution time. + Displays output at the end of the request or in the debugging + section at the end of the request; + + CFML logs cftrace output to the file logs\cftrace.log, in + the CFML installation directory. + + Note: To permit this tag to execute, you must enable debugging + in the CFML Administrator. Optionally, to report trace + summaries, enable the trace section. + +```javascript +trace([var] [, text] [, type] [, category] [, inline] [, abort]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| var | string | No | | The name of a simple or complex variable to display.

Useful for displaying a temporary value, or a value that
does not display on any CFM page. | +| text | string | No | | User-defined string, which can include simple variable,
but not complex variables such as arrays. Outputs to cflog
text attribute | +| type | string | No | information | Corresponds to the cflog type attribute; displays an
appropriate icon.

* Information
* Warning
* Error
* Fatal Information | +| category | string | No | | User-defined string for identifying trace groups | +| inline | boolean | No | NO | Displays trace code in line on the page in the
location of the cftrace tag, addition to the debugging
information output. | +| abort | boolean | No | NO | Calls cfabort tag when the tag is executed | diff --git a/docs/functions/transactioncommit.md b/docs/functions/transactioncommit.md new file mode 100644 index 000000000..f037d1072 --- /dev/null +++ b/docs/functions/transactioncommit.md @@ -0,0 +1,27 @@ +# transactionCommit + +Commit a pending transaction + +```javascript +transactionCommit() +``` + +```javascript +returns void +``` + +## Script Syntax + +In this code, transactionCommit() will commit the pending transaction, which is any database queries run in the transaction block. + +```javascript +transaction { + try { + // code to run + transaction action="commit"; + } + catch(any e) { + transaction action="rollback"; + } + } +``` diff --git a/docs/functions/transactionrollback.md b/docs/functions/transactionrollback.md new file mode 100644 index 000000000..fbb5e0566 --- /dev/null +++ b/docs/functions/transactionrollback.md @@ -0,0 +1,33 @@ +# transactionRollback + +Rollback current transaction + +```javascript +transactionRollback([savepoint]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| savepoint | string | No | | Name of the savepoint to roll back to | + +## Script Syntax + +In this code, any error triggered will cause transactionRollback() to run and roll back the pending transaction + +```javascript +transaction { + try { + // code to run + transactionCommit(); + } + catch(any e) { + transactionRollback(); + } + } +``` diff --git a/docs/functions/transactionsetsavepoint.md b/docs/functions/transactionsetsavepoint.md new file mode 100644 index 000000000..fd55a4670 --- /dev/null +++ b/docs/functions/transactionsetsavepoint.md @@ -0,0 +1,34 @@ +# transactionSetSavepoint + +Set savepoint for transaction + +```javascript +transactionSetSavepoint(savepoint) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| savepoint | string | Yes | | Savepoint name to which can be rolled back | + +## Roll back to a specified savepoint + +This example runs multiple queries with a savepoint for each, and rolls back to the 'useradded' savepoint if the last query fails. + +```javascript +transaction { + // insert user + transactionSetSavepoint('useradded'); + try { + // another query + } + catch(any e) { + transactionRollback(); + } +} +``` diff --git a/docs/functions/trim.md b/docs/functions/trim.md new file mode 100644 index 000000000..e33ebb137 --- /dev/null +++ b/docs/functions/trim.md @@ -0,0 +1,25 @@ +# trim + +Removes leading and trailing spaces from a string. + +```javascript +trim(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | A string or a variable that contains one | + +## Trim + +```javascript +'>' & trim(' CFDocs ') & '<' +``` + +### Expected Result: >CFDocs< diff --git a/docs/functions/truefalseformat.md b/docs/functions/truefalseformat.md new file mode 100644 index 000000000..bfa1c1fa3 --- /dev/null +++ b/docs/functions/truefalseformat.md @@ -0,0 +1,73 @@ +# trueFalseFormat + +Returns the string true or false when a boolean value is passed in. Throws an exception if the value passed in cannot be converted to a boolean. + +```javascript +trueFalseFormat(value) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | boolean | Yes | | | + +## Numeric 1 is interpreted as true + +```javascript +trueFalseFormat(1) +``` + +### Expected Result: true + +## Numeric 0 is interpreted as false + +```javascript +trueFalseFormat(0) +``` + +### Expected Result: false + +## String representation of 1 is interpreted as true + +```javascript +trueFalseFormat('1') +``` + +### Expected Result: true + +## String representation of 0 is interpreted as false + +```javascript +trueFalseFormat('0') +``` + +### Expected Result: false + +## YES is recognized as synonym for true as well + +```javascript +trueFalseFormat('YES') +``` + +### Expected Result: true + +## And NO as synonym for false + +```javascript +trueFalseFormat('NO') +``` + +### Expected Result: false + +## An empty string results in false again + +```javascript +trueFalseFormat('') +``` + +### Expected Result: false diff --git a/docs/functions/ucase.md b/docs/functions/ucase.md new file mode 100644 index 000000000..1e01c427e --- /dev/null +++ b/docs/functions/ucase.md @@ -0,0 +1,25 @@ +# uCase + + Converts the alphabetic characters in a string to uppercase. + +```javascript +uCase(String) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | A string or a variable that contains one | + +## uppercase CFDocs Rock + +```javascript +uCase('CFDocs Rock') +``` + +### Expected Result: CFDOCS ROCK diff --git a/docs/functions/ucfirst.md b/docs/functions/ucfirst.md new file mode 100644 index 000000000..fd7c83e90 --- /dev/null +++ b/docs/functions/ucfirst.md @@ -0,0 +1,55 @@ +# ucFirst + +Transforms the first letter of a string to uppercase or the first letter of each word, and optionally lowercase uppercase characters. + +```javascript +ucFirst(string [, doAll] [, doLowerIfAllUppercase]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.ucFirst([doAll] [, doLowerIfAllUppercase]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | | +| doAll | boolean | No | | | +| doLowerIfAllUppercase | boolean | No | | | + +## Basic usage + +Lucee4.5+ Capitalizes the first character of the first word only. + +```javascript +ucFirst("hello world!") +``` + +### Expected Result: Hello world! + +## Capitalize all the words in string + +Lucee4.5+ Using the optional doAll parameter capitalizes the first character of all words. Word separators are: whitespace, period, parenthesis, or dash. + +```javascript +ucFirst("cfdocs.org is your (everyone's) resource for cf-related documentation!", true) +``` + +### Expected Result: Cfdocs.Org Is Your (Everyone's) Resource For Cf-Related Documentation! + +## Handling of strings in all uppercase + +Lucee4.5+ Using the optional doLowerIfAllUppercase parameter allows for intelligent capitalization of words in all caps. + +```javascript +ucFirst("CFDOCS.ORG YOUR (EVERYONE'S) RESOURCE FOR CF-RELATED DOCUMENTATION!", true, true) +``` + +### Expected Result: Cfdocs.Org Your (Everyone's) Resource For Cf-Related Documentation! diff --git a/docs/functions/unserializejava.md b/docs/functions/unserializejava.md new file mode 100644 index 000000000..4f6e123e4 --- /dev/null +++ b/docs/functions/unserializejava.md @@ -0,0 +1,17 @@ +# unserializeJava + +literal definition of a serialized Java Object by function serialize + +```javascript +unserializeJava(string) +``` + +```javascript +returns any +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | | diff --git a/docs/functions/urldecode.md b/docs/functions/urldecode.md new file mode 100644 index 000000000..022392e1c --- /dev/null +++ b/docs/functions/urldecode.md @@ -0,0 +1,65 @@ +# urlDecode + +Decodes a URL-encoded string. + +```javascript +urlDecode(urlencodedstring [, charset]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| urlencodedstring | string | Yes | | | | +| charset | string | No | | The character encoding in which the string is encoded. | /Users/garethedwards/development/github/cfdocs/docs/functions/urldecode.md|utf-16 | + +## Simple urlDecode() example + +Shows how it takes an input of: %21 and returns: ! + +```javascript +urlDecode("%21") +``` + +### Expected Result: ! + +## Basic urlDecode() usage + +In this example we demonstrate taking a URL encoded message passed on the request context and displaying it decoded. + +```javascript +if( len( rc.msg ) ) { + writeOutput( encodeForHTML( urlDecode( rc.msg ) ) ); +} +``` + +## urlDecode() in obfuscation + +In this example we demonstrate url encoding a password before it is encrypted, and then decoding it after it is decrypted. + +```javascript +pwd = urlEncodedFormat( '$18$f^$XlTe41' ); +writeOutput( pwd & ' : ' ); +pwd = encrypt( pwd, '7Z8of/gKWpqsx/v6O5yHRKanrXsp93B4xIHV97zf88Q=', 'BLOWFISH/CBC/PKCS5Padding', 'HEX' ); +writeOutput( pwd & ' : ' ); +decpwd = decrypt( pwd, '7Z8of/gKWpqsx/v6O5yHRKanrXsp93B4xIHV97zf88Q=', 'BLOWFISH/CBC/PKCS5Padding', 'HEX' ); +writeOutput( decpwd & ' : ' ); +decpwd = urlDecode( decpwd ); +writeOutput( decpwd ); +``` + +### Expected Result: %2418%24f%5E%24XlTe41 : : %2418%24f%5E%24XlTe41 : $18$f^$XlTe41 + +## urlDecode() usage as a member function + +In this example we demonstrate taking a URL encoded message passed on the request context and displaying it decoded using the urlDecode() member function. + +```javascript +if( len( rc.msg ) ) { + writeOutput( encodeForHTML( rc.msg.urlDecode() ) ); +} +``` diff --git a/docs/functions/urlencode.md b/docs/functions/urlencode.md new file mode 100644 index 000000000..06c172184 --- /dev/null +++ b/docs/functions/urlencode.md @@ -0,0 +1,61 @@ +# urlEncode + +Returns an url-encoded string with respect to charset. + +```javascript +urlEncode(string [, charset] [, force]) +``` + +```javascript +returns string +``` + +## Member Function Syntax + +```javascript +string.urlEncode([charset] [, force]) +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| string | string | Yes | | | +| charset | string | No | utf-8 | The character encoding in which the string will be encoded. | +| force | boolean | No | true | | + +## String encoding + +Encode string with special chars for use in url + +```javascript +urlEncode('Apples → Äpfel','utf-8') +``` + +### Expected Result: Apples+%E2%86%92+%C3%84pfel + +## String charset + +Same string, different charset + +```javascript +urlEncode('Apples → Äpfel','ASCII') +``` + +### Expected Result: Apples+%3F+%3Fpfel + +## Convert collection to be able to be passed as url param value + +```javascript +vocab = [{ + apples: { + en: 'apples', + de: 'Äpfel', + da: 'æble', + el: 'μήλο' + } + }]; + writeOutput(urlEncode(vocab.toString(),'utf-8')); +``` + +### Expected Result: %5B%7BAPPLES%3D%7B%7BEL%3D%7B%CE%BC%CE%AE%CE%BB%CE%BF%7D%2C+EN%3D%7Bapples%7D%2C+DA%3D%7B%C3%A6ble%7D%2C+DE%3D%7B%C3%84pfel%7D%7D%7D%7D%5D diff --git a/docs/functions/urlencodedformat.md b/docs/functions/urlencodedformat.md new file mode 100644 index 000000000..1fe6fce98 --- /dev/null +++ b/docs/functions/urlencodedformat.md @@ -0,0 +1,31 @@ +# urlEncodedFormat + +Generates a URL-encoded string. For example, it replaces spaces + with %20, and non-alphanumeric characters with equivalent + hexadecimal escape sequences. Passes arbitrary strings within a + URL. + +```javascript +urlEncodedFormat(String [, charset]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| String | string | Yes | | A string or a variable that contains one | | +| charset | string | No | | The character encoding in which the string is encoded. | /Users/garethedwards/development/github/cfdocs/docs/functions/urlencodedformat.md|utf-16 | + +## Simple urlEncodedFormat Example + +It returns url encoded string. + +```javascript +writeOutput(URLEncodedFormat('This is a string with special character.')); +``` + +### Expected Result: This%20is%20string%20with%20special%20character%2E diff --git a/docs/functions/urlsessionformat.md b/docs/functions/urlsessionformat.md new file mode 100644 index 000000000..6cd171891 --- /dev/null +++ b/docs/functions/urlsessionformat.md @@ -0,0 +1,17 @@ +# urlSessionFormat + +If the client does not accept cookies appends session identifiers `CFID`, `CFTOKEN` and / or `JSESSIONID` to the URL. + +```javascript +urlSessionFormat(requesturl) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| requesturl | string | Yes | | URL of a CFML page | /Users/garethedwards/development/github/cfdocs/docs/functions/urlsessionformat.md|cgi.script_name | diff --git a/docs/functions/val.md b/docs/functions/val.md new file mode 100644 index 000000000..80fa9a79a --- /dev/null +++ b/docs/functions/val.md @@ -0,0 +1,34 @@ +# val + + Converts numeric characters that occur at the beginning of a + string to a number. If conversion fails, returns zero. + +```javascript +val(String) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | A string or a variable that contains one | + +## Numeric characters at beginning and middle of a string + +```javascript +val("120test12sstring"); +``` + +### Expected Result: 120 + +## Numeric characters only at the end of a string + +```javascript +val("string98"); +``` + +### Expected Result: 0 diff --git a/docs/functions/valuearray.md b/docs/functions/valuearray.md new file mode 100644 index 000000000..49fa13dc3 --- /dev/null +++ b/docs/functions/valuearray.md @@ -0,0 +1,29 @@ +# valueArray + +Returns an array of values for the given query and column. + +```javascript +valueArray(query, column) +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | A query object | +| column | string | Yes | | The column name whose values you want | + +## Simple valueArray Example + +Converts the id column values into an array + +```javascript +news = queryNew("id", "integer", [ {id:1}, {id:2} ]); +writeOutput( serializeJSON( valueArray(news, "id") ) ); +``` + +### Expected Result: [1,2] diff --git a/docs/functions/valuelist.md b/docs/functions/valuelist.md new file mode 100644 index 000000000..13a3bc0eb --- /dev/null +++ b/docs/functions/valuelist.md @@ -0,0 +1,33 @@ +# valueList + +Returns each value from a column of an executed query. + CFML does not evaluate the arguments. + A delimited list of the values of each record returned from an executed query column + +```javascript +valueList(column [, delimiter]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| column | query | Yes | | Name of an executed query and column. Separate query name and column name with a period. | +| delimiter | string | No | , | A delimiter character to separate column data items.
Default: comma (,). | + +## Simple Example + +Retrieve column results + +```javascript +news = queryNew("id,title", + "integer,varchar", + [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]); +writeOutput( valueList(news.id) ); +``` + +### Expected Result: 1,2 diff --git a/docs/functions/verifybcrypthash.md b/docs/functions/verifybcrypthash.md new file mode 100644 index 000000000..522bf72ae --- /dev/null +++ b/docs/functions/verifybcrypthash.md @@ -0,0 +1,44 @@ +# verifyBCryptHash + +This function compares a plaintext entry to the hashed string. +NOTE 1:Hashing is one-way, so you can't "decrypt" a hashed value. You have to hash the value you want to check and then compare that to the saved hash. +NOTE 2: The version and rounds don't need to be specified because they are included at the beginning of the hashed string. + +```javascript +verifyBCryptHash(plaintext,hashedstring); +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| plaintext | string | Yes | | The unhashed string to compare. | +| hashedstring | string | Yes | | The hashed string to compare. | + +## Example of Verifying the BCrypt Hash + +This is an example of using the function to check against a hashed value. + +```javascript +secretMsg="$2a$10$.jQX1KnwPzhvVet0vEENnOlO8C70oM8GQhu0MQnCgcIlWhguWb3q."; +checkMe="My voice is my passport. Verify me." +writeOutput(verifyBCryptHash(checkMe,secretMsg); +``` + +### Expected Result: YES + +## Example of Verifying the BCrypt Hash With Options Set On Hash + +This is an example of using the function to check against a hashed value when the options were previously set. + +```javascript +secretMsg="$2b$05$Cf4c5OFks8s8QKrByuEA7OHQDKSKPs5217L0H1DowfFLY3RLbFi4a"; +checkMe="Setec Astronomy" +writeOutput(verifyBCryptHash(checkMe,secretMsg)); +``` + +### Expected Result: YES diff --git a/docs/functions/verifyclient.md b/docs/functions/verifyclient.md new file mode 100644 index 000000000..94beb7761 --- /dev/null +++ b/docs/functions/verifyclient.md @@ -0,0 +1,11 @@ +# verifyClient + + Verifies whether request is from valid client or not + +```javascript +verifyClient() +``` + +```javascript +returns void +``` diff --git a/docs/functions/verifyencryptedjwt.md b/docs/functions/verifyencryptedjwt.md new file mode 100644 index 000000000..8e439c031 --- /dev/null +++ b/docs/functions/verifyencryptedjwt.md @@ -0,0 +1,19 @@ +# verifyEncryptedJWT + +Verify an encrypted JWT (JSON Web Encryption - JWE) + +```javascript +verifyEncryptedJWT(token, encryptOptions, config) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| token | string | Yes | | An encrypted JWT | +| encryptOptions | struct | Yes | | The encryption uses the key information from the given struct | +| config | struct | Yes | | A struct with the following values:
- clockSkew : time in seconds to account for difference between the systems generating and processing the JWT
- returntype : plaintext/struct | diff --git a/docs/functions/verifyscrypthash.md b/docs/functions/verifyscrypthash.md new file mode 100644 index 000000000..a6fee7231 --- /dev/null +++ b/docs/functions/verifyscrypthash.md @@ -0,0 +1,44 @@ +# verifySCryptHash + +This function compares a plaintext entry to the hashed string. +NOTE 1:Hashing is one-way, so you can't "decrypt" a hashed value. You have to hash the value you want to check and then compare that to the saved hash. + +```javascript +verifySCryptHash(plaintext,hashedstring); +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| plaintext | string | Yes | | The unhashed string to compare. | +| hashedString | string | Yes | | The hashed string to compare. | +| options | struct | No | {"memorycost":8,"CpuCost":16348,"Parallel":1,"KeyLength":32,"saltLength":8} | A struct containing the optional values:
--memorycost - Default is 8.
--CpuCost - CPU cost of the algorithm (as defined in scrypt, this is `N`) that must be a power of 2 and greater than 1. Default is currently 16,348 or 2^14.
--Parallel - the parallelization of the algorithm (as defined in scrypt, this is `P`). Default is currently 1.
--Keylength - key length for the algorithm (as defined in scrypt, this is `dkLen`). Default is currently 32.
--saltLength - length of the salt to use. Default is 8. | + +## Example of Verifying the SCrypt Hash + +This is an example of using the function to check against a hashed value. + +```javascript +secretMsg="$e0801$21aGCy86deU=$Yp2UaxwONLNgp0kUaBwuXAqsnFaAjOAUislNejW6Bjs="; +checkMe="My voice is my passport. Verify me." +writeOutput(verifySCryptHash(checkMe,secretMsg); +``` + +### Expected Result: YES + +## Example of Verifying the SCrypt Hash With Options Set On Hash + +This is an example of using the function to check against a hashed value when the options were previously set. + +```javascript +secretMsg="$c0401$Eg7sS/HsxhHTWA==$sejraZ7kZZ82adEz8uHHUz51Hk36YkkJ4KZk3w=="; +checkMe="Setec Astronomy" +writeOutput(verifySCryptHash(checkMe,secretMsg); +``` + +### Expected Result: YES diff --git a/docs/functions/verifysignedjwt.md b/docs/functions/verifysignedjwt.md new file mode 100644 index 000000000..dfb1d017a --- /dev/null +++ b/docs/functions/verifysignedjwt.md @@ -0,0 +1,19 @@ +# verifySignedJWT + +Verify a signed JWT (JSON Web Signature - JWS) + +```javascript +verifySignedJWT(token, signOptions, config) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| token | string | Yes | | A signed JWT | +| signOptions | struct | Yes | | The signature uses the key information from the given struct | +| config | struct | Yes | | A struct with the following values:
- clockSkew : time in seconds to account for difference between the systems generating and processing the JWT
- returntype : plaintext/struct | diff --git a/docs/functions/webservicenew.md b/docs/functions/webservicenew.md new file mode 100644 index 000000000..36d35a2b4 --- /dev/null +++ b/docs/functions/webservicenew.md @@ -0,0 +1,36 @@ +# webserviceNew + +Creates a web service proxy object, a reference to a remote webservice. This function is a replacement for `createObject("webservice",...)`. + +```javascript +webserviceNew(url) +``` + +```javascript +returns function +``` + +## Member Function Syntax + +```javascript + +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| url | string | Yes | | URL of the Webservice | +| arguments | struct | No | | Additional arguments
(URL params are not allowed in url itself and must be set here) | + +## Get country data from a webspace + +Get country by country code and output country name + +```javascript +ws = webserviceNew('http://www.webservicex.net/country.asmx?wsdl'); +country = ws.GetCountryByCountryCode('us'); +writeOutput(XMLParse(country).NewDataSet.Table.name.XmlText); +``` + +### Expected Result: United States diff --git a/docs/functions/week.md b/docs/functions/week.md new file mode 100644 index 000000000..54c175fd7 --- /dev/null +++ b/docs/functions/week.md @@ -0,0 +1,36 @@ +# week + + From a date/time object, determines the week number within + the year. An integer in the range 1-53; the ordinal of the + week, within the year. + +```javascript +week(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.week() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| date | date | Yes | | A date/time object in the range 100 AD-9999 AD. | | +| calendar | string | No | gregorian | CF2016u8+ Indicates whether the week starts on Sunday (gregorian) or Monday (iso) | /Users/garethedwards/development/github/cfdocs/docs/functions/week.md|iso | + +## Week of a datetime object + +```javascript +dt = createdatetime(2016,1,1,5,30,25); +w = week( dt ); +writeoutput( w ); +``` + +### Expected Result: 1 diff --git a/docs/functions/wrap.md b/docs/functions/wrap.md new file mode 100644 index 000000000..8bc20455b --- /dev/null +++ b/docs/functions/wrap.md @@ -0,0 +1,40 @@ +# wrap + + Wraps text so that each line has a specified maximum number + of characters. + +```javascript +wrap(String, limit [, strip]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | String or variable that contains one. The text to wrap. | +| limit | numeric | Yes | | Positive integer maximum number of characters to allow on
a line. | +| strip | boolean | No | NO | Whether to remove all existing newline and carriage return
characters in the input string with spaces before wrapping
the text. Default: False. | + +## Script Syntax + +```javascript +sentence = "This is a standard sentence."; +wrappedSentence = wrap(sentence, 7); +writeOutput(wrappedSentence); +``` + +### Expected Result: This is a standar d senten ce. + +## Tag Syntax + +```javascript + + +#wrappedSentence# +``` + +### Expected Result: This is a standar d senten ce. diff --git a/docs/functions/writebody.md b/docs/functions/writebody.md new file mode 100644 index 000000000..1c419258b --- /dev/null +++ b/docs/functions/writebody.md @@ -0,0 +1,17 @@ +# writeBody + + Writes an output to a page. WriteBody should be used within a tag with a body only. + +```javascript +writeBody(value); +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | A string or any variable that can evaluate to a string. | diff --git a/docs/functions/writedump.md b/docs/functions/writedump.md new file mode 100644 index 000000000..0566ce796 --- /dev/null +++ b/docs/functions/writedump.md @@ -0,0 +1,34 @@ +# writeDump + +Outputs the elements, variables and values of most kinds of CFML objects. Useful for debugging. You can display the contents of simple and complex variables, objects, components, user-defined functions, and other elements. Equivalent to the cfdump tag, useful in cfscript. + +```javascript +writeDump(var [, output] [, format] [, abort] [, label] [, metainfo] [, top] [, show] [, hide] [, keys] [, expand] [, showUDFs]) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| var | variableName | Yes | | Variable to display. Enclose a variable name in pound
signs. | +| output | string | No | browser | Where to send the results of cfdump. | +| format | string | No | text | specify whether to save the results of a cfdump to a file in text or HTML format | +| abort | boolean | No | NO | Boolean value to immediately abort after displaying the dump. | +| label | string | No | | A string; header for the dump output. | +| metainfo | boolean | No | YES | Includes information about the query in the cfdump results. | +| top | numeric | No | | The number of rows to display. | +| show | string | No | | show column or keys. | +| hide | string | No | | hide column or keys. | +| keys | numeric | No | | For a structure, number of keys to display. | +| expand | boolean | No | YES | Yes: In Internet Explorer and Mozilla, expands views | +| showUDfs | boolean | No | YES | show UDFs in cfdump output. | + +## Dump Server Scope + +```javascript +writeDump(server); +``` diff --git a/docs/functions/writelog.md b/docs/functions/writelog.md new file mode 100644 index 000000000..d254f854f --- /dev/null +++ b/docs/functions/writelog.md @@ -0,0 +1,29 @@ +# writeLog + +Writes a message to a log file. + +```javascript +writeLog(text [, type] [, application] [, file] [, log] ) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| text | string | Yes | | Message to log. The date / time will be logged automatically for you. | | +| type | string | No | | Type or severity of the log message | /Users/garethedwards/development/github/cfdocs/docs/functions/writelog.md|fatal | +| application | boolean | No | true | Logs the application name, if it is specified in Application.cfc or a cfapplication tag. | | +| file | string | No | | The file name to log to. You cannot specify a directory path or file extension (extension will be `.log`). If the file does not exist, it is created automatically. The log file will be located in your CF server logs directory. | | +| log | string | No | | If you omit the file attribute, writes messages to standard
log file. Ignored, if you specify file attribute.

Application: writes to Application.log, normally used for
application-specific messages.
Scheduler: writes to Scheduler.log, normally used to log
the execution of scheduled tasks. | /Users/garethedwards/development/github/cfdocs/docs/functions/writelog.md|Scheduler | + +## Simple writeLog Code Example + +Logs an order processed successfully message to `orders.log` which will be located in the CF logs directory, eg: `{cf.root}/cfusion/logs/` + +```javascript +writeLog(text="Order #order.getOrderID()# Processed Successfully", type="information", file="orders"); +``` diff --git a/docs/functions/writeoutput.md b/docs/functions/writeoutput.md new file mode 100644 index 000000000..e07240c20 --- /dev/null +++ b/docs/functions/writeoutput.md @@ -0,0 +1,44 @@ +# writeOutput + + Appends text to the page-output stream. + This function writes to the page-output stream regardless of + conditions established by the cfsetting tag. + +```javascript +writeOutput(string) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| string | string | Yes | | A string, or a variable that contains one | | +| encodeFor | string | No | | CF2016+ Lucee5.1.0.8+ Wraps the result with an encodeFor function. | /Users/garethedwards/development/github/cfdocs/docs/functions/writeoutput.md|dn | + +## Output the literal string "Hello World" + +```javascript +writeOutput("Hello World"); +``` + +## Output the equivalent string as a variable + +```javascript +greeting = "Hello World"; +writeOutput(greeting); +``` + +## Using the encodeFor argument + +CF2016+ Passing in `html` to the `encodeFor` argument wraps the result with a call to encodeForHTML. + +```javascript +name = "Pete"; +writeOutput("Hello " & name, "html"); +``` + +### Expected Result: Hello Pete diff --git a/docs/functions/wsgetallchannels.md b/docs/functions/wsgetallchannels.md new file mode 100644 index 000000000..2d64b7e77 --- /dev/null +++ b/docs/functions/wsgetallchannels.md @@ -0,0 +1,17 @@ +# wsGetAllChannels + +Provides all the channels defined in the Application.cfc as an array. + +```javascript +wsGetAllChannels (); wsGetAllChannels('channelName'); +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| channelName | string | No | | If specified, returns all sub-channels listed under the entered channel name. If left unspecified, the function returns all channels registered under the current application. | diff --git a/docs/functions/wsgetsubscribers.md b/docs/functions/wsgetsubscribers.md new file mode 100644 index 000000000..7366b70f4 --- /dev/null +++ b/docs/functions/wsgetsubscribers.md @@ -0,0 +1,17 @@ +# wsGetSubscribers + +Returns an array of struct with clientID and subscriberInfo as the keys. + +```javascript +wsGetSubscribers(channel); +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| channel | string | Yes | | Channel whose list of subscribers you wish to retrieve. | diff --git a/docs/functions/wspublish.md b/docs/functions/wspublish.md new file mode 100644 index 000000000..48dcd4522 --- /dev/null +++ b/docs/functions/wspublish.md @@ -0,0 +1,46 @@ +# wsPublish + + Sends messages to a specific channel based on the filter criteria (which is a struct). + +```javascript +wsPublish(String channel, Object message); wsPublish(channel,message [,filterCriteria]); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| channel | string | Yes | | Specific channel to which the server publishes its response. | +| message | any | Yes | | Response sent by the server to all clients subscribed to a specific channel. | +| filterCriteria | struct | No | | Conditions to filter eligible clients that need to be notified for a given channel. | + +## Tag Syntax + +Checking to see if the region is present in the cache + +```javascript + + if(isDefined('form.publish')) + wsPublish(#form.channel#, #form.message#); + + + + + + + + Message: + + + +``` diff --git a/docs/functions/wssendmessage.md b/docs/functions/wssendmessage.md new file mode 100644 index 000000000..41a061a6f --- /dev/null +++ b/docs/functions/wssendmessage.md @@ -0,0 +1,17 @@ +# wsSendMessage + + Sends messages to a specific client that invokes the method. This can be included as a part of the function that is called by the invoke WebSocket JavaScript method. + +```javascript +wsSendMessage(message); +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| message | any | Yes | | The message object. This can be of type Any. | diff --git a/docs/functions/xmlchildpos.md b/docs/functions/xmlchildpos.md new file mode 100644 index 000000000..0e22886aa --- /dev/null +++ b/docs/functions/xmlchildpos.md @@ -0,0 +1,22 @@ +# xmlChildPos + +Gets the position of a child element within an XML document + object. + The position, in an XmlChildren array, of the Nth child that + has the specified name. + +```javascript +xmlChildPos(elem, childname, n) +``` + +```javascript +returns numeric +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| elem | xml | Yes | | XML element within which to search | +| childname | string | Yes | | XML child element for which to search | +| n | numeric | Yes | | Index of XML child element for which to search | diff --git a/docs/functions/xmlclear.md b/docs/functions/xmlclear.md new file mode 100644 index 000000000..b5496ea34 --- /dev/null +++ b/docs/functions/xmlclear.md @@ -0,0 +1,30 @@ +# xmlClear + +Clears a given XML node from an XML document + +```javascript +xmlClear(node) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| node | xml | Yes | | The XML node to clear | + +## Clear an XML node (Script syntax) + +Clears a single node in a simple XML document + +```javascript +xmlData = xmlParse('Item 1Item 2Item 3'); +xmlClear(xmlData.root.item[2]); +writeOutput(xmlData.toString()); +``` + +### Expected Result: +Item 1Item 3 diff --git a/docs/functions/xmldeleteat.md b/docs/functions/xmldeleteat.md new file mode 100644 index 000000000..ac4dead1e --- /dev/null +++ b/docs/functions/xmldeleteat.md @@ -0,0 +1,31 @@ +# xmlDeleteAt + +Removes a node from an XML document by specifying the position + +```javascript +xmlDeleteAt(xmlObject, position) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| xmlObject | xml | Yes | | The XML object | +| position | numeric | Yes | | The position of the child node to be deleted | + +## Delete a specified XML node (Script syntax) + +Deletes a single node in a simple XML document + +```javascript +xmlData = xmlParse('Item 1Item 2Item 3'); +xmlDeleteAt(xmlData.root.item, 1); +writeOutput(xmlData.toString()); +``` + +### Expected Result: +Item 2Item 3 diff --git a/docs/functions/xmlelemnew.md b/docs/functions/xmlelemnew.md new file mode 100644 index 000000000..417905ad9 --- /dev/null +++ b/docs/functions/xmlelemnew.md @@ -0,0 +1,34 @@ +# xmlElemNew + +Creates an XML document object element + +```javascript +xmlElemNew(xmlobj [, namespace], childname) +``` + +```javascript +returns xml +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| xmlobj | xml | Yes | | The name of an XML object. An XML document or an element. | +| namespace | string | No | | URI of the namespace to which this element belongs. | +| childname | string | Yes | | The name of the element to create. This element becomes a
child element of xmlObj in the tree. | + +## Simple xmlelemnew Example + +Here, we've created myXml with root and child nodes using xmlelemnew(). + +```javascript + + + + + + + + +``` diff --git a/docs/functions/xmlformat.md b/docs/functions/xmlformat.md new file mode 100644 index 000000000..d3f058c92 --- /dev/null +++ b/docs/functions/xmlformat.md @@ -0,0 +1,28 @@ +# xmlFormat + +Escapes XML special characters in a string, so that the string is safe to use with XML. + +```javascript +xmlFormat(String [, escapeChars]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| String | string | Yes | | The string to escape | +| escapeChars | boolean | No | | When true escapes restricted characters according to the W3C XML standard. | + +## Basic xmlFormat() usage + +In this example we demonstrate passing the invalid characters < and & into the xmlFormat() function to make them XML safe. + +```javascript +writeOutput( xmlFormat( 'Good & Juicy') ); +``` + +### Expected Result: <node>Good &amp; Juicy</node> diff --git a/docs/functions/xmlgetnodetype.md b/docs/functions/xmlgetnodetype.md new file mode 100644 index 000000000..d74ff368c --- /dev/null +++ b/docs/functions/xmlgetnodetype.md @@ -0,0 +1,42 @@ +# xmlGetNodeType + +Determines the type of an XML document object node. + +```javascript +xmlGetNodeType(xmlNode) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| xmlNode | xml | Yes | | An XML DOM object node. | + +## xmlGetNodeType Example + +A string identifying the XML node type. + +```javascript + + + + Alice + Bob + Reminder + Here is the message you requested. + + + John + Doe + + + + + xmlobject:#XMLGetNodeType(xmlobject1)# + xmlRoot:#XMLGetNodeType(xmlobject1.xmlRoot)# + +``` diff --git a/docs/functions/xmlhaschild.md b/docs/functions/xmlhaschild.md new file mode 100644 index 000000000..199606e1f --- /dev/null +++ b/docs/functions/xmlhaschild.md @@ -0,0 +1,30 @@ +# xmlHasChild + +Checks if the XML document object has a child node + +```javascript +xmlHasChild(xmlObject [, childName]) +``` + +```javascript +returns boolean +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| xmlObject | xml | Yes | | The XML document object to be checked for child nodes | +| childName | string | No | | The name of the child node to check if it exists. If not provided, the root is checked. | + +## Check for children (Script syntax) + +Checks the existence of children for two separate nodes in a simple XML document + +```javascript +xmlData = xmlParse('Item 1Item 2Item 3'); +writeOutput(xmlHasChild(xmlData, "root")); +writeOutput(" " & xmlHasChild(xmlData, "item")); +``` + +### Expected Result: YES NO diff --git a/docs/functions/xmlnew.md b/docs/functions/xmlnew.md new file mode 100644 index 000000000..e443496b5 --- /dev/null +++ b/docs/functions/xmlnew.md @@ -0,0 +1,28 @@ +# xmlNew + +Creates an XML document object. + +```javascript +xmlNew([casesensitive]) +``` + +```javascript +returns xml +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| casesensitive | boolean | No | NO | Maintains the case of document elements and attributes.
Default: false | + +## The simple xmlnew example + +Here, We created myXml by using xmlNew function. Then created root node(sampleXml) for myXml and set the rootnode text + +```javascript + + + + +``` diff --git a/docs/functions/xmlparse.md b/docs/functions/xmlparse.md new file mode 100644 index 000000000..873e2451d --- /dev/null +++ b/docs/functions/xmlparse.md @@ -0,0 +1,29 @@ +# xmlParse + +Converts an XML document that is represented as a string + variable into an XML document object. + +```javascript +xmlParse(xmlString [, caseSensitive] [, validator]) +``` + +```javascript +returns xml +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| xmlString | string | Yes | | Any of the following:
- A string containing XML text.
- The name of an XML file.
- The URL of an XML file; valid protocol identifiers
include http, https, ftp, and file. | +| caseSensitive | boolean | No | NO | Maintains the case of document elements and attributes.
Default: false | +| validator | string | No | | Any of the following:
- The name of a Document Type Definition (DTD) or
XML Schema file.
- The URL of a DTD or Schema file; valid protocol
identifiers include http, https, ftp, and file.
- A string representation of a DTD or Schema.
- An empty string; in this case, the XML file must
contain an embedded DTD or Schema identifier, which
is used to validate the document. | + +## Parse XML read from a file + +Read XML from a file and use the xmlParse method to parse it into an XML data structure. + +```javascript + + +``` diff --git a/docs/functions/xmlsearch.md b/docs/functions/xmlsearch.md new file mode 100644 index 000000000..13df53fcb --- /dev/null +++ b/docs/functions/xmlsearch.md @@ -0,0 +1,51 @@ +# xmlSearch + +Get XML values according to given xPath query + +```javascript +xmlSearch(xmlNode, xpath [, params]) +``` + +```javascript +returns array +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| xmlNode | xml | Yes | | An XML document object | +| xpath | string | Yes | | xPath expression | +| params | struct | No | | CF10+ A struct with key value pairs to be used a variables within the xPath Expression | + +## Read specific properties from XML collection + +XPath extracts 'name' property from every user given in the XML collection + +```javascript + + + + + Me + + + You +
+ Long Road +
+
+
+
+ + xml = XMLParse(xmlstring); + result = xmlSearch(xml,'users//name'); + userlist = ''; + for(i = 1; i <= ArrayLen(result); i++) { + userlist = ListAppend(userlist,result[i].XmlText); + } + writeOutput(userlist); + +``` + +### Expected Result: Me,You diff --git a/docs/functions/xmltransform.md b/docs/functions/xmltransform.md new file mode 100644 index 000000000..84d008a8b --- /dev/null +++ b/docs/functions/xmltransform.md @@ -0,0 +1,23 @@ +# xmlTransform + +Applies an Extensible Stylesheet Language Transformation (XSLT) + to an XML document object that is represented as a string + variable. An XSLT converts an XML document to another format + or representation by applying an Extensible Stylesheet + Language (XSL) stylesheet to it. + +```javascript +xmlTransform(xml, xsl [, parameters]) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| xml | xml | Yes | | An XML document in string format, or an XML document object. | +| xsl | string | Yes | | XSLT transformation to apply; can be any of the following:
- A string containing XSL text.
- The name of an XSTLT file. Relative paths start at
the directory containing the current CFML page.
- The URL of an XSLT file; valid protocol identifiers
include http, https, ftp, and file. Relative paths start
at the directory containing the current CFML page. | +| parameters | struct | No | | A structure containing XSL template parameter name-value
pairs to use in transforming the document. The XSL transform
defined in the xslString parameter uses these parameter values
in processing the xml. | diff --git a/docs/functions/xmlupdate.md b/docs/functions/xmlupdate.md new file mode 100644 index 000000000..46531af94 --- /dev/null +++ b/docs/functions/xmlupdate.md @@ -0,0 +1,32 @@ +# xmlUpdate + +Updates a part of an XML document (elements, attributes, or nodes) with a new value. + +```javascript +xmlUpdate(node, xpath, value) +``` + +```javascript +returns void +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| node | xml | Yes | | The XML node in which to update a value | +| xpath | string | Yes | | XPath expression to locate the XML fragment to update | +| value | string | Yes | | The new value | + +## Update a specified node (Script syntax) + +Updates the text node of root in a simple XML document + +```javascript +xmlData = xmlParse('Item 1Item 2Item 3'); +xmlUpdate(xmlData.root, "xmlText", "hello world!"); +writeOutput(xmlData.toString()); +``` + +### Expected Result: +Item 1Item 2Item 3hello world! diff --git a/docs/functions/xmlvalidate.md b/docs/functions/xmlvalidate.md new file mode 100644 index 000000000..4ef191f06 --- /dev/null +++ b/docs/functions/xmlvalidate.md @@ -0,0 +1,28 @@ +# xmlValidate + +Uses a Document Type Definition (DTD) or XML Schema to validate an XML text document or an XML document object. Returns keys `status` (boolean), `errors` (array), `fatalerrors` (array) and `warnings` (array) + +```javascript +xmlValidate(xmlDoc [, validator]) +``` + +```javascript +returns struct +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| xmlDoc | any | Yes | | Any of the following:
- A string containing an XML document.
- The name of an XML file.
- The URL of an XML file; valid protocol identifiers
include http, https, ftp, and file.
- An XML document object, such as one generated by
the XmlParse function. | +| validator | string | No | | Any of the following:
- A string containing a DTD or Schema.
- The name of a DTD or Schema file.
- The URL of a DTD or Schema file; valid protocol
identifiers include http, https, ftp, and file. If this argument is omitted the XML document must have a `!DOCTYPE` `xsi:schemaLocation` or `xsi:noNamespaceSchemaLocation` tag pointing to the DTD or schema location. | + +## Validate against an XML Schema + +Validates that note.xml is valid according to the schema note.xsd. Not currently working on Lucee, see: LDEV-2909 + +```javascript +xmlValidate("https://www.w3schools.com/xml/note.xml", "https://www.w3schools.com/xml/note.xsd").status +``` + +### Expected Result: true diff --git a/docs/functions/year.md b/docs/functions/year.md new file mode 100644 index 000000000..998bfc5a2 --- /dev/null +++ b/docs/functions/year.md @@ -0,0 +1,33 @@ +# year + + From a date/time object, gets the year value. + +```javascript +year(date) +``` + +```javascript +returns numeric +``` + +## Member Function Syntax + +```javascript +date.year() +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| date | date | Yes | | | + +## Year of a datetime object + +```javascript +dt = createdatetime(2016,1,1,5,30,25); +y = year( dt ); +writeoutput( y ); +``` + +### Expected Result: 2016 diff --git a/docs/functions/yesnoformat.md b/docs/functions/yesnoformat.md new file mode 100644 index 000000000..8bd9d1517 --- /dev/null +++ b/docs/functions/yesnoformat.md @@ -0,0 +1,47 @@ +# yesNoFormat + + Yes, for a true value; No for a false value, empty string or null. Throws an exception for other values. + +```javascript +yesNoFormat(value) +``` + +```javascript +returns string +``` + +## Argument Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | any | Yes | | A Boolean value or empty string | + +## Example of Yes + +Pass in a true value outputs Yes + +```javascript +yesNoFormat(true) +``` + +### Expected Result: Yes + +## Example of No + +Pass in a false value outputs No + +```javascript +yesNoFormat(false) +``` + +### Expected Result: No + +## Example of empty string + +Pass in an empty string outputs No + +```javascript +yesNoFormat("") +``` + +### Expected Result: No diff --git a/docs/guides/acf-only.md b/docs/guides/acf-only.md new file mode 100644 index 000000000..f916b5e65 --- /dev/null +++ b/docs/guides/acf-only.md @@ -0,0 +1,269 @@ +# Adobe ColdFusion only + +## The following tags/functions are Adobe ColdFusion only + +`arrayGetMetadata` - Minimum Version: 2016.0.2 + +`arrayReduceRight` - Minimum Version: 2021 + +`arraySetMetadata` - Minimum Version: 2016.0.2 + +`arraySplice` - Minimum Version: 2018.0.5 + +`cacheGetEngineProperties` - Minimum Version: 2018 + +`cacheGetSession` - Minimum Version: 9.0.1 + +`cf_socialplugin` - Minimum Version: 11 + +`cfcalendar` - Minimum Version: 7 + +`cfclient` - Minimum Version: 11 + +`cfclientsettings` - Minimum Version: 11 + +`cfexchangecalendar` - Minimum Version: 8 + +`cfexchangeconnection` - Minimum Version: 8 + +`cfexchangecontact` - Minimum Version: 8 + +`cfexchangeconversation` - Minimum Version: 10 + +`cfexchangefilter` - Minimum Version: 8 + +`cfexchangefolder` - Minimum Version: 10 + +`cfexchangemail` - Minimum Version: 8 + +`cfexchangetask` - Minimum Version: 8 + +`cffileupload` - Minimum Version: 9 + +`cfformgroup` - Minimum Version: 7 + +`cfformitem` - Minimum Version: 7 + +`cfgrid` - Minimum Version: 3 + +`cfgridcolumn` - Minimum Version: 3 + +`cfgridrow` - Minimum Version: 3 + +`cfgridupdate` - Minimum Version: 3 + +`cfhtmltopdf` - Minimum Version: 11 + +`cfhtmltopdfitem` - Minimum Version: 11 + +`cfimapfilter` - Minimum Version: 11 + +`cfjava` - Minimum Version: 2021 + +`cflayout` - Minimum Version: 8 + +`cflayoutarea` - Minimum Version: 8 + +`cfmap` - Minimum Version: 9 + +`cfmapitem` - Minimum Version: 9 + +`cfmediaplayer` - Minimum Version: 9 + +`cfmenu` - Minimum Version: 8 + +`cfmenuitem` - Minimum Version: 8 + +`cfmessagebox` - Minimum Version: 9 + +`cfntauthenticate` - Minimum Version: 7 + +`cfoauth` - Minimum Version: 11 + +`cfpdfform` - Minimum Version: 8 + +`cfpdfformparam` - Minimum Version: 8 + +`cfpdfsubform` - Minimum Version: 8 + +`cfpod` - Minimum Version: 8 + +`cfpresentation` - Minimum Version: 8 + +`cfpresentationslide` - Minimum Version: 8 + +`cfpresenter` - Minimum Version: 8 + +`cfprint` - Minimum Version: 8 + +`cfprogressbar` - Minimum Version: 9 + +`cfreport` - Minimum Version: 2 + +`cfreportparam` - Minimum Version: 7 + +`cfservlet` - Minimum Version: 4.5 + +`cfservletparam` - Minimum Version: 4.5 + +`cfsharepoint` - Minimum Version: 9 + +`cfsprydataset` - Minimum Version: 8 + +`cftooltip` - Minimum Version: 8 + +`cfwebsocket` - Minimum Version: 10 + +`cfwindow` - Minimum Version: 8 + +`createEncryptedJWT` - Minimum Version: 2023 + +`createSignedJWT` - Minimum Version: 2023 + +`deserialize` - Minimum Version: 11 + +`deserializeAvro` - Minimum Version: 2023 + +`deserializeProtobuf` - Minimum Version: 2023 + +`deserializeXML` - Minimum Version: 11 + +`dotnetToCFType` - Minimum Version: 8 + +`encodeFor` - Minimum Version: 2016 + +`generateBCryptHash` - Minimum Version: 2021 + +`generateGraphQLModels` - Minimum Version: 2023 + +`generateSCryptHash` - Minimum Version: 2021 + +`getException` + +`getGatewayHelper` - Minimum Version: 7 + +`getGraphQLClient` - Minimum Version: 2023 + +`getPrinterInfo` - Minimum Version: 8 + +`getSafeHTML` - Minimum Version: 11 + +`imageCreateCaptcha` - Minimum Version: 10 + +`imageGetIPTCMetadata` - Minimum Version: 8 + +`imageGetMetadata` - Minimum Version: 11 + +`imageMakeColorTransparent` - Minimum Version: 10 + +`imageMakeTranslucent` - Minimum Version: 10 + +`invalidateOauthAccesstoken` - Minimum Version: 11 + +`isDateObject` - Minimum Version: 2016.0.3 + +`isDDX` - Minimum Version: 8 + +`isFileObject` - Minimum Version: 11 + +`isPDFArchive` - Minimum Version: 2016 + +`isPDFFile` - Minimum Version: 8 + +`isSafeHTML` - Minimum Version: 11 + +`isSpreadsheetFile` - Minimum Version: 9 + +`isValidOauthAccesstoken` - Minimum Version: 11 + +`listReduce` - Minimum Version: 11 + +`listReduceRight` - Minimum Version: 2021 + +`onServerStart` - Minimum Version: 9 + +`ormFlushAll` - Minimum Version: 9.0.1 + +`ormIndex` - Minimum Version: 10 + +`ormIndexPurge` - Minimum Version: 10 + +`ormSearch` - Minimum Version: 10 + +`ormSearchOffline` - Minimum Version: 10 + +`parameterExists` + +`queryAppend` - Minimum Version: 2018.0.5 + +`queryClear` - Minimum Version: 2018.0.5 + +`queryGetResult` - Minimum Version: 2016.3 + +`queryInsertAt` - Minimum Version: 2018 + +`queryPrepend` - Minimum Version: 2018.0.5 + +`queryReverse` - Minimum Version: 2018.0.5 + +`queryRowSwap` - Minimum Version: 2018.0.5 + +`removeCachedQuery` - Minimum Version: 10 + +`serializeAvro` - Minimum Version: 2023 + +`serializeProtobuf` - Minimum Version: 2023 + +`serializeXML` - Minimum Version: 11 + +`sessionGetMetadata` - Minimum Version: 10 + +`spreadsheetAddAutoFilter` - Minimum Version: 11 + +`spreadsheetAddPagebreaks` - Minimum Version: 11 + +`spreadsheetFormatCellRange` - Minimum Version: 9.0.1 + +`spreadsheetGetColumnCount` - Minimum Version: 2016 + +`spreadsheetRemoveSheet` - Minimum Version: 9.0.1 + +`spreadsheetSetRowHeight` + +`stringReduceRight` - Minimum Version: 2021 + +`structGetMetadata` - Minimum Version: 2016.0.2 + +`structIsCaseSensitive` - Minimum Version: 2021 + +`structIsOrdered` - Minimum Version: 2018 + +`structSetMetadata` - Minimum Version: 2016.0.2 + +`structToSorted` - Minimum Version: 2016.0.3 + +`verifyBCryptHash` - Minimum Version: 2021 + +`verifyEncryptedJWT` - Minimum Version: 2023 + +`verifySCryptHash` - Minimum Version: 2021 + +`verifySignedJWT` - Minimum Version: 2023 + +`writeBody` + +`wsGetAllChannels` - Minimum Version: 10 + +`wsGetSubscribers` - Minimum Version: 10 + +`wsPublish` - Minimum Version: 10 + +`wsSendMessage` - Minimum Version: 10 + +`xmlClear` - Minimum Version: 2023 + +`xmlDeleteAt` - Minimum Version: 2023 + +`xmlHasChild` - Minimum Version: 2023 + +`xmlUpdate` - Minimum Version: 2023 \ No newline at end of file diff --git a/docs/guides/application.md b/docs/guides/application.md new file mode 100644 index 000000000..8580b2c27 --- /dev/null +++ b/docs/guides/application.md @@ -0,0 +1,124 @@ +# Application.cfc + +## Example: Full Application/Request Lifecycle Methods + +This shows all of the built-in Application.cfc methods. +[Application variables](https://helpx.adobe.com/coldfusion/cfml-reference/application-cfc-reference/application-variables.html) are explained in Adobe's Application.cfc documentation. + +```cfml +component { + this.name = "YourAppName" & hash(getCurrentTemplatePath()); + this.applicationTimeout = createTimeSpan(1,0,0,0); + this.sessionTimeout = createTimeSpan(1,0,0,0); + this.sessionManagement = true; + this.setClientCookies = false; + + public boolean function onApplicationStart() { + return true; + } + + public void function onApplicationEnd(struct applicationScope={}) { + return; + } + + public void function onSessionStart() { + return; + } + + public void function onSessionEnd(required struct sessionScope, struct applicationScope={}) { + return; + } + + public boolean function onRequestStart(required string targetPage) { + return true; + } + + public void function onRequest(required string targetPage) { + include arguments.targetPage; + return; + } + + public void function onCFCRequest(string cfcname, string method, struct args) { + return; + } + + public void function onRequestEnd() { + return; + } + + public void function onAbort(required string targetPage) { + return; + } + + public void function onError(required any exception, required string eventName) { + return; + } + + public boolean function onMissingTemplate(required string targetPage) { + return true; + } +} +``` + +## Lifecycle Methods explained + +| Method | Description | +|--------------------|----------------------------------------------------------------------| +| onApplicationStart | First function run when ColdFusion receives the first request for a page in the application. | +| onApplicationEnd | Last function run when Application times out or server is shut down. | +| onSessionStart | Run when first setting up a session. | +| onSessionEnd | Run when a session ends. | +| onRequestStart | First page-processing function run when a page request starts. Return False to prevent ColdFusion from processing the request. | +| onRequest | Runs when a request starts, after the onRequestStart event handler. This method is optional. If you implement this method, it must explicitly call the requested page to process it. | +| onCFCRequest | Intercepts any HTTP or AMF calls to an application based on CFC request. Whereas onRequest handles only requests made to ColdFusion templates, this function controls Ajax, Web Service, and Flash Remoting requests. | +| onRequestEnd | Runs at the end of a request, after all other CFML code. | +| onAbort | Runs when you execute the CFML tag cfabort or cfscript "abort". If showError attribute is specified in cfabort, onError method is executed instead of onAbort. When using cfabort, cflocation, or cfcontent tags, the onAbort method is invoked instead on onRequestEnd. | +| onError | Runs when an uncaught exception occurs in the application. This method overrides any error handlers that you set in the ColdFusion Administrator or in cferror tags. It does not override try/catch blocks. | +| onMissingTemplate | Runs when a request specifies a non-existent CFML page. True, or no return value, specifies that the event has been processed. If the function returns false, ColdFusion invokes the standard error handler. | + +## APPLICATION Scope + +The `APPLICATION` scope is used for setting the information at application level, i.e. + +* Application variables are usually set when the application starts, for example with the onApplicationStart event. +* Information stored in an application variable is available from anywhere within the application (any URI requested under the given Application.cfc or Application.cfm) +* The values of variables declared in `application` scope typically do not changes throughout the lifecycle of the application. +* The default timeout of an application scope is 2 days, but can be changed in the Administrator or by setting `this.applicationTimeout` in the Application.cfc file. + +### Example using onApplicationStart + +```cfml +component { + this.name = "myApplication"; + + function onApplicationStart() { + application.something = "otherthing"; + } +} +``` + +### Locking Concerns + +Since variables within the application scope can be accessed by multiple threads at once (simultaneous requests), you should consider if locking is necessary. + +In very early versions of ColdFusion (pre-CF6), locking was required when reading or writing to a shared scope, such as the application scope. In modern versions of ColdFusion or Lucee, in most cases, locking is taken care of automatically and you do not need to use `cflock`. + +One case that does not require locking is if you set your `application` variables in `onApplicationStart` and do not modify them (i.e., they are only read, except in `onRequestStart`). + +You should take care not to lock unnecessarily, as it may create a performance bottleneck. + +One case where you _should_ use locking is when you are using the `application` scope on both sides of the assignment. For example: + +```cfml +application.counter += 1; +``` + +The above example requires locking to ensure that a concurrent thread does not corrupt the value of the counter. + +```cfml +lock scope="application" timeout="1" type="exclusive" { + application.counter += 1; +} +``` + +Keep in mind that, if the application scoped variable is written to at any time other than `onApplicationStart`, there is a possibility that the value of the application variable could change mid-request. If this is a problem, consider using `cflock` to ensure a consistent value. diff --git a/docs/guides/cfsqltype-cheatsheet.md b/docs/guides/cfsqltype-cheatsheet.md new file mode 100644 index 000000000..3b02c0e4f --- /dev/null +++ b/docs/guides/cfsqltype-cheatsheet.md @@ -0,0 +1,50 @@ +# CFSqlType Cheatsheet + +Table sourced from [the Adobe Documentation][docs] + +[docs]: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-p-q/cfqueryparam.html + +| `CF_SQL_*` | JDBC | DB2 | Oracle | SQL Server | +| ---------------------- | ------------- | ------------------------- | ------------------- | ------------------- | +| `CF_SQL_ARRAY` | ARRAY | N/A | N/A | N/A | +| `CF_SQL_BIGINT` | BIGINT | BigInt | N/A | bigint | +| `CF_SQL_BINARY` | BINARY | Char for Bit Data | N/A | binary, timestamp | +| `CF_SQL_BIT` | BIT | N/A | N/A | bit | +| `CF_SQL_BLOB` | BLOB | Blob | blob, bfile | longvarbinary | +| `CF_SQL_CHAR` | CHAR | Char | char, nchar | char, nchar, uniqueidentifier | +| `CF_SQL_CLOB` | CLOB | Clob | clob, nclob | N/A | +| `CF_SQL_DATE` | DATE | Date | N/A/ | date | +| `CF_SQL_DECIMAL`* | DECIMAL | Decimal | number | decimal, money, smallmoney | +| `CF_SQL_DISTINCT` | DISTINCT | N/A | N/A | N/A | +| `CF_SQL_DOUBLE` | DOUBLE | Double | N/A | float | +| `CF_SQL_FLOAT` | FLOAT | Float | number | real | +| `CF_SQL_IDSTAMP` | CHAR | Char | char, nchar | char, nchar, uniqueidentifier | +| `CF_SQL_INTEGER` | INTEGER | Integer | N/A | int | +| `CF_SQL_LONGVARBINARY` | LONGVARBINARY | Long Varchar for Bit Data | long raw | image | +| `CF_SQL_LONGNVARCHAR` | LONGNVARCHAR | LONGVARGRAPHIC | NVARCHAR2 | ntext, xml | +| `CF_SQL_LONGVARCHAR` | LONGVARCHAR | Long Varchar | long | text, ntext, xml | +| `CF_SQL_MONEY` | DOUBLE | Double | N/A | float, money | +| `CF_SQL_MONEY4` | DOUBLE | Double | N/A | float, money | +| `CF_SQL_NCHAR` | NCHAR | NCHAR | NCHAR | nchar | +| `CF_SQL_NCLOB` | CLOB | NCLOB | NCLOB | nvarchar | +| `CF_SQL_NULL` | NULL | N/A | N/A | N/A | +| `CF_SQL_NUMERIC`* | NUMERIC | Numeric | N/A | numeric | +| `CF_SQL_NVARCHAR` | NVARCHAR | NVARCHAR | NVARCHAR2 | nvarchar | +| `CF_SQL_OTHER` | OTHER | N/A | N/A | N/A | +| `CF_SQL_REAL` | REAL | Real | N/A | real | +| `CF_SQL_REFCURSOR` | REF | N/A | N/A | N/A | +| `CF_SQL_SMALLINT` | SMALLINT | Smallint | N/A | smallint | +| `CF_SQL_STRUCT` | STRUCT | N/A | N/A | N/A | +| `CF_SQL_SQLXML` | N/A | N/A | N/A | xml | +| `CF_SQL_TIME` | TIME | Time | N/A | time | +| `CF_SQL_TIMESTAMP` | TIMESTAMP | Timestamp | date | datetime, datetime2, smalldatetime | +| `CF_SQL_TINYINT` | TINYINT | N/A | N/A | tinyint | +| `CF_SQL_VARBINARY` | VARBINARY | Rowid | raw | varbinary, geometry, geography, udt | +| `CF_SQL_VARCHAR` | VARCHAR | Varchar | varchar2, nvarchar2 | varchar, nvarchar | + +* Scale param option applies to decimal and numeric types. See docs for [cfqueryparam](https://cfdocs.org/cfqueryparam). + +## See also + +- [CF_SQL_ is optional in cfqueryparam cfsqltype](https://www.petefreitag.com/blog/cfsql-optional-cfqueryparam/) +- [SQL Server JDBC data type mappings](https://docs.microsoft.com/en-us/sql/connect/jdbc/using-basic-data-types) diff --git a/docs/guides/cgi-scope.md b/docs/guides/cgi-scope.md new file mode 100644 index 000000000..764f22703 --- /dev/null +++ b/docs/guides/cgi-scope.md @@ -0,0 +1,78 @@ +# CGI Scope + +## CGI Server Variables + +The `CGI` server variables or `CGI` scope contains variables that are passed from the web server to the CFML server. + +### `cgi.server_software` + +The name of the web server / connector used to communicate with the CFML server. Example: `Apache/2.4.16 (Unix) mod_jk/1.2.40` + +### `cgi.server_name` + +The hostname or IP address of the web server. Typically this is the value of the `Host` header sent by the client in the HTTP request. + +### `cgi.server_protocol` + +The name and revision of the protocol used for the server request. Example: `HTTP/1.1` + +### `cgi.server_port` + +The TCP port number that the request was received on. + +### `cgi.request_method` + +This the method that was used to make the request. Examples: `GET`, `POST`, `PUT`, `DELETE` + +### `cgi.path_info` + +This is the extra path information that follows the virtual path of the requested script. For the request `/index.cfm/order/123`, `cgi.path_info` would contain `/order/123`. + +### `cgi.path_translated` + +This is the physical path to the requested script. + +### `cgi.script_name` + +The virtual path to the requested script. + +### `cgi.query_string` + +The string that follows `?` in the request URL. Example: `id=1&action=update` + +### `cgi.remote_host` + +The hostname of the client that made the request to the web server. If the server does not have that information then it may be the IP address. + +### `cgi.remote_addr` + +The IP address of the client that made the connection to the web server. In basic server configurations this will be the IP address of the user or their proxy server. If your CF server is behind a reverse proxy or load balancer, then it may be the IP address of the load balancer or proxy server. In that case you may need to look at a HTTP header such as `X-Forwarded-For` to get the end users _real_ ip address. + +### `cgi.auth_type` + +The authentication method used, if the server supports user authentication and the user is authenticated. Example: `BASIC` + +### `cgi.auth_user` + +The username of the authenticated user. Also available as `cgi.remote_user` + +### `cgi.content_type` + +This would be the [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of data being sent with the server request as the request message-body. This will be for HTTP requests that support sending additional data such as `POST` or `PUT`. Example: `application/x-www-form-urlencoded` or `application/json` + +### `cgi.content_length` + +This would be the size of the data being sent with the server request as in the request message-body. This will not be set for requests that do not contain data in the message-body. + +Adobe CGI Server Variables Documentation: https://helpx.adobe.com/coldfusion/cfml-reference/reserved-words-and-variables/cgi-environment-cgi-scope-variables/cgi-server-variables.html + + +## CGI Client Variables + +The `CGI` client variables or `CGI` scope also contains variables that are passed from the browser to the CFML server in the request header. + +### `cgi.http_user_agent` + +Browser information of the internet browser used by the client. For e.g. `Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0` + +Adobe CGI Client Variables Documentation: https://helpx.adobe.com/coldfusion/cfml-reference/reserved-words-and-variables/cgi-environment-cgi-scope-variables/cgi-client-variables.html diff --git a/docs/guides/closures.md b/docs/guides/closures.md new file mode 100644 index 000000000..aa4f5401b --- /dev/null +++ b/docs/guides/closures.md @@ -0,0 +1,339 @@ +# ColdFusion Closures + +CF10+ A closure is an inner function. The inner function can access the variables in the outer function. You can access the inner function by accessing the outer function. See the example below. + + function helloTranslator(String helloWord) { + return function(String name) { + return "#helloWord#, #name#"; + }; + } + + helloInHindi = helloTranslator("Namaste"); + helloInFrench = helloTranslator("Bonjour"); + writeOutput(helloInHindi("Anna")); + + //closure is formed. + //Prints Namaste, Anna. + writeOutput("
"); + writeOutput(helloInFrench("John")); + //Prints Bonjour, John. + +In the above example, the outer function returns a closure. Using the helloHindi variable, the outer function is accessed. It sets the helloWord argument. + +Using this function pointer, the closure is called. For example, helloInHindi("Anna"). Observe that even after the execution of outer function, the closure can access the variable sets by the outer function. + +In this case, using closure, two new functions are created. One adds Namaste to the name. And the second one adds Bonjour to the name. +helloInHindi and helloInFrench are closures. They have the same function body; however, store different environments. + +The inner function is available for execution after the outer function is returned. A closure is formed when the inner function is available for execution. + +As seen in the example, even after the outer function is returned, the inner function can access the variables in the outer function. Closure retains the reference to the environment at the time it is created. For example, the value of a local variable in the outer function. It makes closure an easy to use and handy feature. + +To see more details on closure, see http://jibbering.com/faq/notes/closures/. + +### Closure in ColdFusion + +A closure can be of the following categories: + +* Defined inline without giving a name. They can be used in the following ways: +* They can be assigned to a variable, array item, struct, and variable scope. It can be returned directly from a function. + +#### ColdFusion Example + + function operation(string operator) { + return function(numeric x, numeric y) { + if (operator == "add") { + return x + y; + } + else if (operator == "subtract") { + return x - y; + } + }; + } + + myval_addition = operation("add"); + myval_subtraction = operation("subtract"); + writeOutput(myval_addition(10,20)); + writeOutput("
"); + writeOutput(myval_subtraction(10,20)); + +In the above example, the outer function sets the operator. myval_addition and myval_subtraction are two closures. They process the data based on the condition sets by the outer function. + +#### Defined inline as a function and tag argument + + function operation(numeric x, numeric y, function logic) + { + var result = logic(x,y); + return result; + } + add = operation(10,20, function(numeric N1, numeric N2) + { + return N1+N2; + }); + subtract = operation(10,20, function(numeric N1, numeric N2) + { + return N1-N2; + }); + writeDump(add); + writeDump(subtract); + +In the above example, the function operation has an argument logic, which is a closure. While calling operation, an inline closure is passed as an argument. This anonymous closure contains the logic to process the numbers - addition or subtraction. In this case, the logic is dynamic and passed as a closure to the function. + +#### You can assign a closure to a variable + + var c2 = function () {..} + +Note: When assigning Closures to a variable, only script style of syntax is supported. + +A closure can be used as a return type + +Note: As a best practice, if the return type is a closure, provide the Function keyword with initial capitalization. + +Example + + function function exampleClosure(arg1) { + function exampleReturned(innerArg) { + return innerArg + arg1; + } + /* return a reference to the inner function defined. */ + return exampleReturned; + } + +#### Calling closure with key-value pair + + var c2 = function(arg1, arg1) {..} + c2(arg1=1, arg2=3); + +#### Closure can be assigned to a variable outside function + + hello = function (arg1) { + writeOutput("Hello " & arg1); + }; + hello("Mark"); + +#### Calling closure with argument collection + + var c2 = function(arg1, arg1) {..} + argsColl = structNew(); + argsColl.arg1 = 1; + argsColl.arg2 = 3; + c2(argumentCollection = argsColl); + +### Closures and functions + +A closure retains a copy of variables visible at the time of its creation. The global variables (like ColdFusion specific scopes) and the local variables (including declaring or outer function's local and arguments scope) are retained at the time of a closure creation. Functions are static. + +The following details the scope of closure based on the way they are defined: + +#### Scenario where closure is defined + +##### In a CFC function + +Closure argument scope, enclosing function local scope and argument scope, this scope, variable scope, and super + +##### In a CFM function + +Closure argument scope, enclosing function local scope and argument scope, this scope, variable scope, and super + +##### As function argument + +Closure argument scope, variable scope, and this scope and super scope (if defined in CFC component). + +Scope Chain: + +* Closure's local scope +* Closure's arguments scope +* Outer function's local scope if available +* Owner function's local scope if available +* ColdFusion built-in scope + +Note: A closure cannot call any user-defined function, because the function's context is not retained, though the closure's context is retained. It gives erroneous results. For example, when a closure is cached, it can be properly called for later use, while a function cannot. + +### The isClosure Function + +CF10+ added the `isClosure` function which returns true if a variable is a closure, false otherwise. + +#### Modifications to the function isCustomFunction + +Though closure is a function object, it is not considered as a custom function. +The function now returns: + +True: If name can be called as a custom function. +False: If name can be called as a closure. +Usage scenarios +The following scenario explains how you can effectively use ColdFusion closures. + +## Example - filtering of arrays using closures + +The following example filters employees based on location, age, and designation. A single function is used for filtering. The filtering logic is provided to the function as closures. That's filtering logic changes dynamically. + +Create the `employee.cfc` file that defines the variables. + + /** + * @name employee + * @displayname ColdFusion Closure Example + * @output false + * @accessors true + */ + component + { + property string Name; + property numeric Age; + property string designation; + property string location; + property string status; + } + +Create the employee array. This CFC also contains the `filterArray()` function. A closure, `filter`, is an argument of the function. While accessing this function, the filtering logic is passed as a closure. + + // filter.cfc + component { + //Filter the array based on the logic provided by the closure. + function filterArray(array a, function filter) { + resultArray = arrayNew(1); + for (i=1; i <= arrayLen(a); i++) { + if (filter(a[i])) + arrayAppend(resultArray,a[i]); + } + return resultArray; + } + + function getEmployee() { + //Create the employee array. + empArray = arrayNew(1); + arrayAppend(empArray,new employee(Name="Ryan", Age=24, designation="Manager", location="US")); + arrayAppend(empArray,new employee(Name="Ben", Age=34, designation="Sr Manager", location="US")); + arrayAppend(empArray,new employee(Name="Den", Age=24, designation="Software Engineer", location="US")); + arrayAppend(empArray,new employee(Name="Ran", Age=28, designation="Manager", location="IND")); + arrayAppend(empArray,new employee(Name="Ramesh", Age=31, designation="Software Engineer", location="IND")); + return empArray; + } + } + +Create the CFM page that accesses the {{filterArray()}}function with a closure which provides the filtering logic. The {{filterArray()}}function is used to filter the employee data in three ways: location, age, and designation. Each time the function is accessed, the filtering logic is changed in the closure. + + + + + + obj = createObject("component", "filter"); + // Filters employees from India + filteredArray = obj.filterArray(obj.getEmployee(), function(a) + { + if (a.getLocation() == "IND") { + return 1; + } + else { + return 0; + } + }); + writeDump(filteredArray); + //Filters employees from India whose age is above thirty + filteredArray = obj.filterArray(obj.getEmployee(), closure(a) + { + if ((a.getLocation() == "IND") && (a.getAge() > 30)) { + return 1; + } + else { + return 0; + } + }); + writeDump(filteredArray); + // Filters employees who are managers + filteredArray = obj.filterArray( obj.getEmployee(), function(a) + { + if ((a.getdesignation() contains "Manager")) { + return 1; + } + else { + return 0; + } + }); + writeDump(filteredArray); + + +### Other Closure Examples + +JavaScript example: + + function outerFunction() { + var a = 3; + return function innerFunction(b) { + var c = a + b; + return c; + } + } + +(1) `var foo = outerFunction()` +(2) `var result = foo(2);` +(3) `console.log(result); //5` + +We have an outer function with a nested function which accepts a parameter `b` + +(1) When you invoke the outer you get the inner returned later. +(2) Notice the outer function was called but the a still has its value and is used in the return function (innerFunction). +(3) That is why the result Is 5! + +https://web.archive.org/web/20170508020042/taha-sh.com/blog/understanding-closures-in-javascript + +## ColdFusion built in Functions that use Closures + +### CF10 Closure Functions + +* [arrayEach](/arrayeach) +* [structEach](/structeach) +* [arrayFilter](/arrayfilter) +* [structFilter](/structfilter) +* [listFilter](/listfilter) +* [arrayFind](/arrayfind) +* [arrayFindAll](/arrayfindall) +* [arrayFindAllNoCase](/arrayfindallnocase) +* [arrayFindNoCase](/arrayfindnocase) +* [arraySort](/arraysort) + +### CF11 Closure Functions + +* [isClosure](/isclosure) +* [listEach](/listeach) +* [arrayReduce](/arrayreduce) +* [structReduce](/structreduce) +* [listReduce](/listreduce) +* [arrayMap](/arraymap) +* [structMap](/structmap) +* [listMap](/listmap) + +### CF2016 Closure Functions + +* [queryEach](/queryeach) +* [queryFilter](/queryfilter) +* [queryMap](/querymap) +* [structNew](/structnew) (Update 3) +* [queryReduce](/queryreduce) +* [replace](/replace) +* [listSort](/listsort) +* [querySort](/querysort) +* [structSort](/structsort) +* [structToSorted](/structtosorted) (Update 3) + +### CF2018 Closure Functions + +* [arrayEvery](/arrayevery) +* [queryEvery](/queryevery) +* [structEvery](/structevery) +* [replaceNoCase](/replacenocase) +* [arraySome](/arraysome) +* [querySome](/querysome) +* [structSome](/structsome) +* [runAsync](/runasync) + +### CF2021 Closure Functions + +* [stringEach](/stringeach) +* [stringEvery](/stringevery) +* [stringFilter](/stringfilter) +* [stringMap](/stringmap) +* [stringReduce](/stringreduce) +* [arrayReduceRight](/arrayreduceright) +* [listReduceRight](/listreduceright) +* [stringReduceRight](/stringreduceright) +* [stringSome](/stringsome) diff --git a/docs/guides/coldfusion-versions.md b/docs/guides/coldfusion-versions.md new file mode 100644 index 000000000..dc1d93ebe --- /dev/null +++ b/docs/guides/coldfusion-versions.md @@ -0,0 +1,186 @@ +# ColdFusion Versions + +Historical information about ColdFusion Versions and releases. + +## Allaire Cold Fusion 1.0 - July 1995 + +* Database Connectivity +* Tag-based programming templates (DBML) + +## Allaire Cold Fusion 1.5 - February 1996 + +* Email DBMAIL +* CFX Tags C/C++ + +## Allaire Cold Fusion 2 - November 1996 + +* CFML (tags were switched from `dbif` to `cfif`) +* Significantly expanded language capabilities +* Advanced function library +* File Upload and Management +* Application Framework (Application.cfm) +* Client Management + +## Allaire Cold Fusion 3 - June 1997 + +* Full text searching and indexing (Verity) +* COM integration +* Template Encryption +* Multidimensional Arrays +* Custom Tags +* Java Form Controls +* Server Scope Added +* Operator short cuts: `GTE` `LTE` `LT` `GT` +* Version 3.1 released November 1997 added RDS and Solaris Support + +## Allaire ColdFusion 4.0 - November 1998 + +* Added cfscript +* [ColdFusion 4 New Tags and Functions](/cf4) + +## Allaire ColdFusion 4.5 - November 1999 + +* `url`, `cgi`, `form`, and `cookie` scopes are now structures +* Added lots of Java Integration features (CFX, `createObject`, `cfservlet`) +* [ColdFusion 4.5 New Tags and Functions](/cf45) + +## Macromedia ColdFusion 5 - June 2001 + +* [ColdFusion 5 Release Notes](https://web.archive.org/web/20151001110848/www.adobe.com/support/coldfusion/releasenotes/5/server/releasenotes_5.htm) +* [ColdFusion 5 Language Reference](https://download.macromedia.com/pub/documentation/en/coldfusion/5/cf5_cfml_ref.pdf) +* UDF's / cfscript `function` +* [ColdFusion 5 New Tags and Functions](/cf5) + +## Macromedia ColdFusion 6 - June 2002 (_aka ColdFusion MX or Neo_) + +* Rewritten in Java +* Added Components / CFCs +* SOAP Web Services +* [ColdFusion 6 New Tags and Functions](/cf6) + +## Macromedia ColdFusion 7 - February 2005 (_Merrimack_) + +* Enhanced Crypto +* [ColdFusion 7 New Tags and Functions](/cf7) + +## Adobe ColdFusion 8 - July 2007 (_Scorpio_) + +* Implicit array and structs, e.g. `x = [1,2,3]` +* [ColdFusion 8 New Tags and Functions](/cf8) +* EOL: Core Support Ended 7/31/2012, Extended Support Ended 7/31/2014 + +## Adobe ColdFusion 9 - October 2009 (_Centaur_) + +* Added Script Components +* Added `local` scope and `var` no longer needs to be at top of function +* Added ORM via Hibernate +* [ColdFusion 9 New Tags and Functions](/cf9) +* EOL: Core Support Ended 12/31/2014, Extended Support Ended 12/31/2016 + + +## Adobe ColdFusion 10 - May 2012 (_Zeus_) + +* Ditched JRun, Moved to Tomcat +* [ColdFusion 10 Updates & Hotfixes](https://helpx.adobe.com/coldfusion/kb/coldfusion-10-updates.html) +* [ColdFusion 10 New Tags and Functions](/cf10) +* EOL: Core Support Ended 5/16/2017, Extended Support Ended 5/16/2019 + + +## Adobe ColdFusion 11 - April 2014 (_Splendor_) + +* Member functions e.g. `structName.keyExists("k")` instead of `structKeyExists(structName, "k")` +* Full script support for all tags e.g. `cftagName(attribute=value)` +* [ColdFusion 11 Updates & Hotfixes](https://helpx.adobe.com/coldfusion/kb/coldfusion-11-updates.html) +* [ColdFusion 11 New Tags and Functions](/cf11) +* EOL: Core Support Ended 4/30/2019, Extended Support Ended 4/30/2021 + + +## Adobe ColdFusion 2016 - February 2016 (_Raijin_) + +* Security Analyzer +* API Manager +* [ColdFusion 2016 Updates & Hotfixes](https://helpx.adobe.com/coldfusion/kb/coldfusion-2016-updates.html) +* [ColdFusion 2016 New Tags and Functions](/cf2016) +* EOL: Core Support Ended 2/17/2021, Extended Support Ended 2/17/2022 + +## Adobe ColdFusion 2018 - July 2018 (_Aether_) + +* Semicolons optional +* Asynchronous Programming [runAsync()](/runasync) +* Typed Arrays `[type][element1,element2,etc]` +* Array Negative Indices `lastItem = a[-1]` +* Array Slices +* Member Functions on String Literals `"string".len()` +* Component Enhancements: Abstract, Final, Default Functions, Covariance +* Performance Monitoring Toolset +* Lockdown Installer +* [ColdFusion 2018 Updates & Hotfixes](https://helpx.adobe.com/coldfusion/kb/coldfusion-2018-updates.html) +* [ColdFusion 2018 New Tags and Functions](/cf2018) +* EOL: Core Support Ended 7/13/2023, Extended Support Ends 7/13/2024 + +## Adobe ColdFusion 2021 - November 2020 (_Stratus_) + +* Added Package Manager (cfpm) +* Cloud Abstraction Functions for Azure and AWS +* NoSQL Support - DynamoDB and MongoDB +* [ColdFusion 2021 Updates & Hotfixes](https://helpx.adobe.com/coldfusion/kb/coldfusion-2021-updates.html) +* [ColdFusion 2021 What's New](https://community.adobe.com/t5/coldfusion/introducing-adobe-coldfusion-2021-release/m-p/11585468) +* [ColdFusion 2021 New Tags and Functions](/cf2021) + +## Adobe ColdFusion 2023 - May 2023 (_Fortuna_) + +* Google Cloud Platform (GCP) - Storage, Pub/Sub, FireStore +* Central Configuration Server (CCS) +* SSO CF Admin Integration (SAML/LDAP) including CF Admin API updates +* JSON Web Tokens +* Avro & Protocal Buffer Serialization +* New PDF Engine +* Library Updates (Java, Solr, Hibernate) +* Native GraphQL Query support +* [ColdFusion 2023 Updates & Hotfixes](https://helpx.adobe.com/coldfusion/kb/coldfusion-2023-updates.html) +* [ColdFusion 2023 What's New](https://community.adobe.com/t5/coldfusion-discussions/live-introducing-the-2023-release-of-adobe-coldfusion/td-p/13797706) +* [ColdFusion 2023 New Tags and Functions](/cf2023) + + +## Adobe ColdFusion 2025 - February 2025 (_Project CFNext_) + +* New licensing and activation changes (requires annual subscription) +* New spreadsheet and CSV functions +* [Language enhancements](https://helpx.adobe.com/coldfusion/using/whats-new.html#other-language) +* [Charting enhancements](https://helpx.adobe.com/coldfusion/using/whats-new.html#other-language) +* [Deprecations and removals](https://helpx.adobe.com/coldfusion/deprecated-features.html) +* [Release Notes](https://helpx.adobe.com/coldfusion/release-note/coldfusion-2025-release-notes.html) +* Destructuring changes +* Support for final static methods +* Bitwise Operator Support in Query of Queries +* Modulus operator in Query of Queries +* Case-sensitive deserialization +* Changes in Hash function +* Support for compound assignment operators in expressions +* Support for multi-dimensional arrays in JavaCast function +* ArrayInsertAt enhancements +* Password protection in cfspreadsheet +* Changes to scriptProtect property +* Changes to JEE configuration deployment +* Thread management enhancements +* cfthread tag "action" changes +* New attribute cacheMaxIdleTime in cfquery +* FileUpload changes (continueOnError) +* Spreadsheet visibility +* Support for Content-Security-Policy (CSP) in ColdFusion tags +* DirectoryList function enhancements +* getTimeZoneInfo enhancements +* Null coalescing operator +* Multiple exception handling in catch statements +* Trailing comma on last element in arrays +* Deepcopy parameter in the duplicate function +* ListSort function changes +* Additional information on cfdump output of a Java class +* Deserialize JSON to query +* Changes to createObject function and cfobject tag +* Default value of cfproperty can be valid CFML expressions +* cfoauth changes +* cfexchangeconnection changes +* Microsoft Graph: User Store in ColdFusion + +Lots of additional historical and version information can be found on the [ColdFusion Wikipedia Page](https://en.wikipedia.org/wiki/Adobe_ColdFusion) diff --git a/docs/guides/datetime.md b/docs/guides/datetime.md new file mode 100644 index 000000000..0a7190900 --- /dev/null +++ b/docs/guides/datetime.md @@ -0,0 +1,53 @@ +# Date Time Cheatsheet + +## Formatting + +| Format | Notes | +|--------|---------------------------------------------------------------------------| +| d | Day of the month as digits; no leading zero for single-digit days. | +| dd | Day of the month as digits; leading zero for single-digit days. | +| EEE | Day of the week as a three-letter abbreviation. | +| EEEE | Day of the week as its full name. | +| m | Month as digits; no leading zero for single-digit months. **CAUTION:** In `timeFormat()` "m" means "minutes" | +| mm | Month as digits; leading zero for single-digit months. | +| mmm | Month as a three-letter abbreviation. | +| mmmm | Month as its full name. | +| M | Month in year. | +| D | Day in year. (Depends on `-Dcoldfusion.datemask.useDasdayofmonth` after CF2021U1) | +| yy | Year as last two digits; leading zero for years less than 10. | +| yyyy | Year represented by four digits. | +| Y | Week year | +| YY | Week year as last two digits; leading zero for years less than 10. | +| YYYY | Week year represented by four digits. | +| G | Period/era string. (e.g. BC, AD) | +| h | hours; no leading zero for single-digit hours (12-hour clock) | +| hh | hours; leading zero for single-digit hours (12-hour clock) | +| H | hours; no leading zero for single-digit hours (24-hour clock) | +| HH | hours; leading zero for single-digit hours (24-hour clock) | +| n | minutes; no leading zero for single-digit minutes | +| nn | minutes; a leading zero for single-digit minutes | +| s | seconds; no leading zero for single-digit seconds | +| ss | seconds; leading zero for single-digit seconds | +| l or L | milliseconds, with no leading zeros | +| t | one-character time marker string, such as A or P | +| tt | multiple-character time marker string, such as AM or PM | +| w | Week of the year as digit. (JDK7+) | +| ww | Week of the year as digits. Leading zero for single-digit week. (JDK7+) | +| W | Week of the month as digit. (JDK7+) | +| WW | Week of the month as digits. Leading zero for single-digit week. (JDK7+) | + +### Shortcuts + +| Shortcut | Format | +|----------|-------------------------------------| +| short | m/d/yy h:nn tt | +| medium | mmm d, yyyy h:nn:ss tt | +| long | mmmm dd, yyyy h:nn:ss tt UTC | +| full | EEEE, mmmm dd, yyyy h:nn:ss tt UTC | +| iso | yyyy-mm-dd'T'HH:nn:ssX | + +## Date functions + +* dateTimeFormat +* lsDateTimeFormat +* [date-and-time-functions](/date-and-time-functions) diff --git a/docs/guides/deprecated.md b/docs/guides/deprecated.md new file mode 100644 index 000000000..0a1b5e780 --- /dev/null +++ b/docs/guides/deprecated.md @@ -0,0 +1,91 @@ +# Deprecated + +## The following tags/functions are deprecated + +`cacheKeyExists` - Deprecated as of Lucee 4.5 + +`cacheRegionExists` - Deprecated as of Lucee 5 + +`cacheRegionNew` - Deprecated as of Lucee 5 + +`cacheRegionRemove` - Deprecated as of Lucee 5 + +`cacheSetProperties` - Deprecated as of Lucee 4.5 + +`cfapplet` - Deprecated as of Adobe ColdFusion 11 + +`cfcalendar` - Deprecated as of Adobe ColdFusion 2016 + +`cffileupload` - Deprecated as of Adobe ColdFusion 2016 + +`cfmediaplayer` - Deprecated as of Adobe ColdFusion 2016 + +`cfmenu` - Deprecated as of Adobe ColdFusion 2016 + +`cfmenuitem` - Deprecated as of Adobe ColdFusion 2016 + +`cfservlet` - Deprecated as of Adobe ColdFusion 6 + +`cfservletparam` - Deprecated as of Adobe ColdFusion 6 + +`cfslider` - Deprecated as of Adobe ColdFusion 11 + +`cfsprydataset` - Deprecated as of Adobe ColdFusion 11 + +`cftable` - Deprecated as of Adobe ColdFusion 2016 + +`cftextinput` - Deprecated as of Adobe ColdFusion 7 + +`cftree` - Deprecated as of Adobe ColdFusion 11 + +`cftreeitem` - Deprecated as of Adobe ColdFusion 11 + +`componentInfo` - Deprecated as of Lucee 4.5 + +`createObject` - Deprecated as of Lucee 5 + +`empty` - Deprecated as of Lucee 4.5 + +`esapiDecode` - Deprecated as of Lucee 5 + +`esapiEncode` - Deprecated as of Lucee 5 + +`getCurrentContext` - Deprecated as of Lucee 5 + +`getK2ServerDocCount` - Deprecated as of Adobe ColdFusion 6.1 + +`getK2ServerDocCountLimit` - Deprecated as of Adobe ColdFusion 6.1 + +`getLocale` - Deprecated as of Lucee 5 + +`getLocaleCountry` - Deprecated as of Lucee 5.0 + +`getLocaleDisplayName` - Deprecated as of Lucee 5 + +`getLocaleLanguage` - Deprecated as of Lucee 5.0 + +`getMetricData` - Deprecated as of Lucee 4 + +`getMetricData` - Deprecated as of Railo 0 + +`getTemplatePath` - Deprecated as of Adobe ColdFusion 6 + +`getTemplatePath` - Deprecated as of Lucee 4.5 + +`hash40` - Deprecated as of Lucee 4.5 + +`htmlEditFormat` - Deprecated as of Adobe ColdFusion 11 + +`imageDrawImage` - Deprecated as of Lucee 5 + +`isK2ServerABroker` - Deprecated as of Adobe ColdFusion 6.1 + +`isK2ServerDocCountExceeded` - Deprecated as of Adobe ColdFusion 6.1 + +`isK2ServerOnline` - Deprecated as of Adobe ColdFusion 6.1 + +`listTrim` - Deprecated as of Lucee 4 + +`nowServer` - Deprecated as of Lucee 4.5 + +`parameterExists` - Deprecated as of Adobe ColdFusion 6 \ No newline at end of file diff --git a/docs/guides/discouraged.md b/docs/guides/discouraged.md new file mode 100644 index 000000000..a6719cf20 --- /dev/null +++ b/docs/guides/discouraged.md @@ -0,0 +1,136 @@ +# Discouraged + +## The following tags/functions are discouraged to use + +`array` + +Lucee recommends to use the inline array notation. + +`cfapplication` + +Use Application.cfc instead of Application.cfm files. The Application component provides better organization and additional features. Note that if you are using Application.cfm it should contain a cfapplication tag. + +`cfcol` + +The use of tags that generate client side UI code is generally discouraged by the CFML community. See: http://static.raymondcamden.com/cfuitherightway/cftable/index.html + +`cfdiv` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfdiv/index.html + +`cfgrid` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfgrid/index.html + +`cfgridcolumn` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfgrid/index.html + +`cfgridrow` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfgrid/index.html + +`cfgridupdate` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfgrid/index.html + +`cflayout` + +The use of tags generating UI is generally discouraged by the CFML community. See: http://static.raymondcamden.com/cfuitherightway/cfpod/index.html + +`cflayoutarea` + +The use of tags generating UI is generally discouraged by the CFML community. See: http://static.raymondcamden.com/cfuitherightway/cfpod/index.html + +`cfmap` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfmap/index.html + +`cfmapitem` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfmap/index.html + +`cfmenu` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfmenu/index.html + +`cfmenuitem` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfmenu/index.html + +`cfpod` + +The use of tags generating UI is generally discouraged by the CFML community. See: http://static.raymondcamden.com/cfuitherightway/cfpod/index.html + +`cfprogressbar` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfprogressbar/index.html + +`cfselect` + +The use of tags generating UI is generally discouraged by the CFML community. See: http://static.raymondcamden.com/cfuitherightway/cfpod/index.html + +`cftable` + +The use of tags that generate client side UI code is generally discouraged by the CFML community. See: http://static.raymondcamden.com/cfuitherightway/cftable/index.html + +`cftooltip` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cftooltip/index.html + +`cftree` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cftree/index.html + +`cftreeitem` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cftree/index.html + +`cfusion_Decrypt` + +The use of this function is discouraged. It is an internal function, call decrypt(string,key,"cfmx_compat","hex") instead. + +`cfusion_Encrypt` + +The use of this function is discouraged. It is an internal function, call encrypt(string,key,"cfmx_compat","hex") instead. + +`cfwindow` + +The use of tags generating UI is generally discouraged by the CFML community. See: https://static.raymondcamden.com/cfuitherightway/cfwindow/index.html + +`evaluate` + +In almost all cases evaluate is unnecessary (use bracket notation instead). Use of evaluate can lead to performance and security issues. + +`iIf` + +Use the ternary operator CF9+ instead because it does not evaluate. +Example ternary operator: `( (condition) ? valueIfTrue : valueIfFalse )` + +`lsParseEuroCurrency` + +Use LSParseCurrency instead + +`preserveSingleQuotes` + +The use of preserveSingleQuotes often (but not always) results in code that will be vulnerable to SQL Injection. Use the cfqueryparam tag instead, and you will not need to worry about single quotes. + +`setVariable` + +This function is no longer required in well-formed CFML pages + +`sizeOf` + +This function is in an early state. Do not use in production! + +`urlEncodedFormat` + +The continued use of this function is discouraged. It is recommended that you use EncodeForURL for all new applications. + +`urlSessionFormat` + +Putting session identifiers in the URL may lead to session hijacking. + +`xmlFormat` + +Adobe recommends using encodeForXML instead of xmlFormat. \ No newline at end of file diff --git a/docs/guides/elvis.md b/docs/guides/elvis.md new file mode 100644 index 000000000..babd2f99f --- /dev/null +++ b/docs/guides/elvis.md @@ -0,0 +1,71 @@ +# Elvis Operator + +CF11+ The Elvis Operator added in ColdFusion 11 + +## Ternary Operator + +It works like a Ternary Operator; it's a decision making operator that requires three operands: condition, true statement, and false statement that are combined using a question mark (?) and a colon (:): + + ((condition) ? trueStatement : falseStatement) + +The way it works is that the condition is evaluated. If it is true, then the true statement executed; if it is false, then the false statement executes. + +## Elvis Operator + +Before Elvis we had `isDefined()`, `structKeyExists()`, and `if` statements to do these kind of evaluations. + +The Elvis operator is primarily used to assign the ‘right default’ for a variable or an expression +Or it is a short-hand way to do parameterization. It will allow us to set a value if the variable is Null + +For instance, + + myDisplayName = userName ?: "Anonymous"; + +In the above example, if userName is defined, it will be assigned to the myDisplayName variable. If the userName is not defined, the value "Anonymous" will be assigned to the myDisplayName variable. + +See the following example: + + employeeName = getEmployeeName(ID) ?: "Joe"; + +In the above example, if getEmployeeName(ID) does not return any value, the value "Joe" will be assigned to the employeeName variable. + +Similarly, you can use this operator for Struct: + + securityNumber = securityStruct['Joe'] ?: ""; + +NB: In CF if the value tested === false, then the expression on the right will be evaluated. [See Adobe bug](https://tracker.adobe.com/#/view/CF-4198933). Lucee behaves as expected. + +## Examples + +Examples which are all the same: + + if (!isNull(local.testVar)) { + value = local.newTest; + } else { + value = "test Item"; + } + + value = (local.testVar ?: "test Item"); + + value = (!isNull(local.testVar) ? local.newTest : "test Item"); + +Three types of usage for the Elvis Operator: + + result = firstOperand ?: secondOperand; // binary + result = (local.myVar ?: "default value"); + +OR + + result = firstOperand ?: secondOperand; // binary + result = isNumeric(17) ? "it's numeric" : "no it isn't"; // "it's numeric" + +OR + + result = firstOperand ? secondOperand : thirdOperand; // ternary + result = isNumeric("nineteen") ? "it's numeric" : "no it isn't"; // "no it isn't" + +Nesting examples for `if`/`elseif`/`else`. Note: It's not advisable to nest it because of poor readability, but useful in some rare situations. + + result = stage1.firstOperand ? stage1.secondOperand : stage2.firstOperand ? stage2.secondOperand : stage1.thirdOperand; + value = "nineteen"; + result = isNumeric(value) ? "it's numeric" : (reFind("[A-Za-z]",value) > 0) ? "it's alphabetic" : "it's neither"; // "it's alphabetic" diff --git a/docs/guides/error-handling.md b/docs/guides/error-handling.md new file mode 100644 index 000000000..1fda2b291 --- /dev/null +++ b/docs/guides/error-handling.md @@ -0,0 +1,184 @@ +# Error handling + +## onError function + +Your application's onError function can be defined to handle errors gracefully and to log/alert important ones. The method is called when an error is thrown. + +```cfml +// log to a folder defined e.g. in onApplicationStart +void function onError(e) { + local.id = CreateUUID(); + local.logfile = this.errorFolder & "/" & local.id & ".html"; + writeDump(var=arguments.e,output=local.logfile,format="html"); + writeOutput("

Sorry an Error has occurred

"); +} +``` + +## Status codes + +Using an onError handler will stop the application setting a 500 status code that is normally sent with a system error. Sometimes you will still want to set these status codes, in which case you will need to use + +```cfml +cfheader(statuscode = 500); +``` + +You can also set other status codes such as 404 not found or 400 bad request. + +## Custom error pages + +There is a function cferror that allows you to set custom templates for different types of errors. If you are using onError, it's usually better not to use this and include a template according to the error type. + +A missing page error has an error type of `missinginclude`. + +```cfml +switch(e.type) { + case "missingInclude": + cfheader(statuscode = 404); + include(template="/_errors/404.cfm"); + break; + default: + cfheader(statuscode = 500); + include(template="/_errors/500.cfm"); + break; +} +``` + +You might want to do a redirect here instead, in which case you would use `location`, usually with a 301 status to indicate the page has permanently moved. + +```cfml +location("mypage.cfm", "false", "301"); +``` + +## Throwing errors + +With an `onError` function in place you can deliberately throw your own errors to ensure they are handled correctly. + +```cfml +if (!isValid("integer",url.id)) { + throw(message="Invalid page ID",type="badrequest"); +} +``` + +This allows you to specify your own error type. In the example a custom value of `badrequest` is used. In the on error handler you might choose to ignore this type of error so as not to flood your alerting with errors. + +If you want to include extra information in the throw statement, you can use the `errorcode`,`detail`, and `extendedinfo` arguments to `throw`. + +### Using extendedinfo for debugging + +`extendedinfo` is a text string, but it's common practice to use it as a JSON serialized store of debug information. + +```cfml +local.extendedinfo = {"myobj"=local.myobj}; +throw( + extendedinfo = SerializeJSON(local.extendedinfo), + message = "Error", + detail = "Further info", + errorcode = "xxx" +); +``` + +You can then use your application.onError to deserialize this field and handle the result. + +## Try / Catch / Finally + +Where a function is likely to be error prone, such as an http connection, you should wrap it in a try-catch-block. + +The catch method will run if an error is thrown. Note that cfhttp requires a setting to throw an error if it fails, otherwise the status code can be inspected and errors thrown manually. + +```cfml +try { + cfhttp(url=webaddr,throwonerror=1,result=myres); +} +catch (any e) { + // handle likely connection issue. +} +``` + +### Rethrowing an error + +Often after checking the details of an error you will want to pass it back to the error handling system. This is known as "rethrowing" an error. In cfscript, you use the `object` argument to do this: + +```cfml +try { + // something +} +catch (any e) { + if (some_condition) { + // carry on regardless + } + else { + throw(object=e); + } +} +``` + +### Using finally + +A finally clause in a try/catch block will run whether an error is thrown or not. This is useful for cleaning things up, especially when using file handles. + +```cfml + +var fileObject = fileOpen("/path/to/file.txt"); + +try +{ + while (!fileIsEOF(fileObj)) { + line = fileReadLine(fileObj); + // logic for each line + } +} + +catch(any e) +{ + // raise some sort of flag but don't throw! +} + +finally +{ + fileClose(fileObject); +} +``` + +## HTTP request response + +In the age of REST-API usage error responses need to be returned in JSON format. A typical response would include an http status and details of the error. + +```cfml +errors = []; +if (!isValid("integer", Form.age)) { + arrayAppend(errors,'Your value for "age" must be numeric!'); +} +if (len(Form.name) < 8) { + arrayAppend(errors,'Your value for "name" is too short. Type 8 letters at least!'); +} + +if (arrayLen(errors)) { + statuscode = 400; + message = errors; +} +else { + statuscode = 300; + message = 'OK'; +} + +cfheader(statuscode = statuscode); +writeOutput(serializeJSON({'status': statusCode, 'msg': message})); +``` + +A logic clause in your application.onError can be used to determine whether a request is a JSON request and return the error in a suitable format. + +When using this approach, you can use the status code to indicate a range of client errors such as 401 to indicate a login is required or 400 to indicate a validation failure as in the last example. + +```cfml +if (request.prc.isAjaxRequest) { + local.statuscode = e.type eq "validation" ? 400 : 500; + cfheader(statuscode = local.statuscode); + writeOutput(serializeJSON({'status': local.statuscode, 'msg': e.message})); +} +else { + // normal output +} +``` + + + diff --git a/docs/guides/first_class.md b/docs/guides/first_class.md new file mode 100644 index 000000000..2e02c7649 --- /dev/null +++ b/docs/guides/first_class.md @@ -0,0 +1,45 @@ +# Built in ColdFusion Functions as First Class Citizens + +The ColdFusion built-in functions will be treated as ‘first-class’ functions so that any built-in function can be passed as an argument. + +For instance, this is valid: + + function convertCaseForArray(array array, function convertor) + { + for (var i=1; i <= arrayLen(array); i++) { + array[i] = convertor(array[i]); + } + return array; + } + + // lCase built-in function is being passed as callback. + resultantArray = convertCaseForArray(['One', 'Two','Three'], lCase); + + writeDump(resultantArray); + +Now, you can treat the built-in CFML functions like uCase() as objects, being able to assign them to variables, and pass them as arguments. + +Another example, this is where `lCase` and `uCase` are being returned from a function" (NOTE: This example only works with CF11-CF2021.) + + function convertArray(array array, string caseTo) { + caseConverterFunction = getConvertFunction(caseTo); + for (var i=1; i <= arrayLen(array); i++) { + array[i] = caseConverterFunction(array[i]); + } + return array; + } + + function getConvertFunction(string caseType) { + if (caseType == 'lower') return lCase; + return uCase; + } + + results = { + "lower" = convertArray(['One', 'Two', 'Three'], 'lower'), + "upper" = convertArray(['One', 'Two', 'Three'], 'upper') + }; + + writeDump(results); + +_lower array: one, two, three +_upper array: ONE, TWO, THREE diff --git a/docs/guides/for.md b/docs/guides/for.md new file mode 100644 index 000000000..871c39c3f --- /dev/null +++ b/docs/guides/for.md @@ -0,0 +1,112 @@ +# For Loops in CFML / CFScript + +There are several different types of for loops. For more info please see the docs for cfloop. + +## Types of loops + +### Basic for loop + +The following for loop has been supported since the initial version of cfscript. + + array = [3,2,1]; + for (i=1; i <= arrayLen(array); i++) { + writeOutput(array[i]); + } + +The above would output `321` + +### For In Loop (over a structure) + + struct = {a=1,b=2}; + for (key in struct) { + writeOutput(key); + } + +The above outputs `AB` + +### For In Loop (over an array) CF9.0.1+ + + cars = ["Ford","Dodge"]; + for (car in cars) { + writeOutput(car); + } + +The above example would output `FordDodge` + +For in support for native Java arrays was added in CF10+ + +### For In Loop (over a list) CF10+ + + fruits = "apple,orange,banana"; + for (fruit in fruits) { + writeOutput(fruit); + } + +The above example would output `appleorangebanana` + +### For In Loop (over a query) CF10+ + + query = queryNew("name", "varchar", [ + ["apple"], + ["banana"], + ["orange"] + ]); + + for (row in query) { + writeOutput("#query.currentRow# - #row.name#
"); + } + +### Query Loop (with grouping) CF10+ + + q = queryNew("pk,fk,data", "integer,integer,varchar", [ + [1, 10, "aa"], + [2, 20, "bb"], + [3, 20, "cc"], + [4, 30, "dd"], + [5, 30, "ee"], + [6, 30, "ff"] + ]); + cfloop(query=q, group="fk") { + writeOutput("#fk#
"); + cfloop() { + writeOutput(" #pk#:#data#
"); + } + writeOutput("
"); + } + +### File Loop + + filePath = getCurrentTemplatePath(); + cfloop(file=filePath, index="chars", characters=16, charset="UTF-8") { + writeOutput(chars); // outputs the contents of this file + } + +### Date Time Loop + + from = now(); + to = dateAdd("d", 7, from); + for (date=from; dateCompare(date, to, "d") <= 0; date = dateAdd("d", 1, date)) { + writeOutput(dateTimeFormat(date, "yyyy-mm-dd HH:nn:sstt") & "
"); + } + +## Additional statements + +### `continue` + + cars = ["Ford","Dodge"]; + for (car in cars) { + if (car == "Ford") { + continue; + } + writeOutput(car); + } + +### `break` + + cars = ["Ford","Dodge"]; + for (car in cars) { + if (car == "Ford") { + break; + } + writeOutput(car); + } diff --git a/docs/guides/java.md b/docs/guides/java.md new file mode 100644 index 000000000..367bce353 --- /dev/null +++ b/docs/guides/java.md @@ -0,0 +1,89 @@ +# Java Integration Guide + +Since ColdFusion 6, Java has been core to the CFML language. Your CFML code get converted into Java bytecode and is executed by the Java Virtual Machine. This close relationship makes integration with Java libraries in your CFML code very easy and fast. + +## Using Java in CFML + +The Java Platform has several built-in classes that you can make use of in CFML (similar to how CFML has several built-in Functions and Tags that you can leverage). You can find detailed documentation of the Java Platform API [here](https://docs.oracle.com/javase/8/docs/api/index.html), there is quite a bit of useful API at your disposal. + +#### Using a Constructor + +Here's an example of using the [`java.io.File`](https://docs.oracle.com/javase/8/docs/api/java/io/File.html) class to output the last modified date by calling the `lastModified()` method. + + currentFile = createObject("java", "java.io.File").init( getCurrentTemplatePath() ); + writeOutput( currentFile.lastModified() ); + +In the above example we created a new instance of the `java.io.File` class. The use of `init()` is CFML's way of calling a constructor on a Java object. Java classes may have multiple constructors, in this case we use the `File(String pathname)` constructor to pass in a [String](https://javadocs.org/string) returned by the CFML function getCurrentTemplatePath. + +In order to call a non static method, you first need to have an instance of the Java object. You will need to use a constructor or a static method to get an instance of a Java object so you can start calling methods. + +#### Invoking a static method + +A static method is a function that does not require an object instance to execute. In CFML you still have to use `createObject` to get a reference to the class to invoke the static method on. + +For example if we want to invoke the static `currentTimeMillis()` function in the [`java.lang.System`](https://docs.oracle.com/javase/8/docs/api/java/lang/System.html) class +we can do so like this: + + javaSystem = createObject("java", "java.lang.System"); + currentTime = javaSystem.currentTimeMillis(); + writeOutput(currentTime); + +Often when you have an API to interact with you can look through the Java API documentation for static methods which are sometimes the entry point into an API (they return an instance of the Object you want to use). For example to interact with the Java Runtime, you can call the static method `getRuntime()` on the [`java.lang.Runtime`](https://javadocs.org/runtime) class. + + runtime = createObject("java", "java.lang.Runtime").getRuntime(); + writeOutput( runtime.availableProcessors() ); + +#### Converting Java Code Examples to CFML + +Ok, let's suppose you have a Java library that you want to use in CFML. You have a code example showing how to use the library in Java that looks like this: + + Car myCar = CarFactory.create(); + myCar.setDriver( new Driver("Pete") ); + Driver myDriver = myCar.getDriver(); + myDriver.eject(); + +Often times code examples leave off the package names and only use class names, you will need the full package name of the class. Here's a hint: look for an `import` statement in a full code example, you might see `import com.example.cars.CarFactory;` or perhaps `import com.example.cars.*;` in the code example. If all else fails rename the jar file as a zip and extract it and use the folder names pointing to the class you want to use. + +Now to write the example in CFML. On the first line, we can assume that the `create()` method in the `CarFactory` class is a `static` method. The difference between a `static` method and a regular instance method is very important to understand. A `static` method can be called without an _instance_ of the class. All `static` methods are marked as such. + +#### All I have are Java Docs, how do I get started? + +A good way to start is to look for `static` methods that you can invoke. If there are too many classes start by looking for a class with _Factory_ in the name, the _Abstract Class Factory Pattern_ is popular entry point to Java APIs. + +#### Type Casting + +Because CFML is a typeless language and Java is not, when you want to pass a Java primitive `int` into a method you can use the `javaCast` function. + + integerObject = createObject("java", "java.lang.Integer"); + maxInt = integerObject.max(javaCast("int", 5), javaCast("int", 6)); + +## Using third party Java Libraries (jar files) in CFML + +To use a third party Java library, you will need to let the Java Runtime Environment know where to find the executable code. Java libraries are distributed as _jar_ files. Java uses _class loaders_ to load jar files and point to class implementations. + +Once the jar file is loaded and accessible to the CFML server / JVM you can use `createObject` just like above to work with the third party Java API. + +#### Using this.javaSettings to load jar files in CF10+ + +If you are running CF10+ or Lucee4.5+ you can use your Application.cfc file to specify jar file locations. Here is an example: + + component { + this.name = "example"; + this.javaSettings = { + loadPaths = ["/path/to/jarFile.jar"] + }; + } + +The variable `this.javaSettings.loadPaths` is an array of jar files or java class file paths. You may need to restart ColdFusion or rename/restart your Application when you make changes to this setting. + +#### Adding Jar files to the classpath + +If you want a Java library to be accessible to the entire server you can add it to the Java classpath. There are a few ways you can do this. On most ColdFusion servers the classpath is specified in the jvm.config file, you can also use the ColdFusion administrator to add jar file paths (it simply updates the jvm.config file for you) under the _Java and JVM Settings_ page. + +Most JEE/CFML servers also are configured to pick up any jar files placed in `WEB-INF/lib` automatically on server startup. + +## More Info + +* [Enhanced Java Integration in ColdFusion 10](https://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d318518-106e125d1353e804331-8000.html) +* [JavaLoader - dynamic classloader for CFML](https://github.com/markmandel/JavaLoader) +* [Java integration in ColdFusion](https://helpx.adobe.com/coldfusion/using/java-integration-coldfusion.html) diff --git a/docs/guides/lucee-only.md b/docs/guides/lucee-only.md new file mode 100644 index 000000000..1c037e1ec --- /dev/null +++ b/docs/guides/lucee-only.md @@ -0,0 +1,259 @@ +# Lucee only + +## The following tags/functions are Lucee only + +`applicationStartTime` + +`argon2CheckHash` - Minimum Version: 5.3.8 + +`array` + +`arrayIndexExists` + +`arrayMedian` + +`arrayMerge` + +`arrayMid` + +`arrayReverse` + +`arrayToStruct` + +`beat` + +`bundleInfo` - Minimum Version: 5 + +`cacheClear` + +`cacheCount` + +`cacheDelete` + +`cacheGetAll` + +`cacheGetDefaultCacheName` + +`cacheKeyExists` + +`cfadmin` + +`cfpageencoding` + +`cfretry` + +`cfsleep` + +`cfstopwatch` + +`cfusion_Decrypt` + +`cfusion_Encrypt` + +`cfwhile` + +`collectionEach` + +`collectionEvery` + +`collectionFilter` + +`collectionMap` + +`collectionReduce` + +`collectionSome` + +`componentCacheClear` + +`componentCacheList` + +`componentInfo` + +`compress` + +`contractPath` + +`createGUID` + +`createUniqueID` + +`ctCacheClear` + +`ctCacheList` + +`dayOfWeekShortAsString` + +`each` + +`echo` + +`empty` + +`entityNameArray` + +`entityNameList` + +`esapiDecode` + +`esapiEncode` - Minimum Version: 4.5 + +`extensionExists` - Minimum Version: 5.3 + +`extensionList` - Minimum Version: 5.3 + +`extract` + +`generateArgon2Hash` - Minimum Version: 5.3.8 + +`getApplicationSettings` + +`getBuiltinFunction` + +`getClassPath` + +`getCurrentContext` + +`getFunctionData` + +`getFunctionKeywords` + +`getLocaleCountry` + +`getLocaleInfo` - Minimum Version: 5 + +`getLocaleLanguage` + +`getLuceeID` + +`getMemoryUsage` + +`getTagData` + +`getTagList` + +`getVariable` + +`hash40` + +`htmlParse` + +`imageCaptcha` - Minimum Version: 5 + +`imageDrawImage` - Minimum Version: 4.5 + +`imageFilter` + +`imageFilterColorMap` + +`imageFilterCurves` + +`imageFilterKernel` + +`imageFilterWarpGrid` + +`imageFonts` + +`imageFormats` + +`imageSetDrawingAlpha` + +`isEmpty` + +`isIPInRange` + +`isNotMap` + +`isVideoFile` + +`isZipFile` + +`listAvg` + +`listCompact` + +`listEvery` + +`listIndexExists` + +`listItemTrim` + +`listSome` + +`listTrim` + +`lsDayOfWeek` + +`lsWeek` + +`manifestRead` - Minimum Version: 5 + +`metaphone` + +`millisecond` + +`monthShortAsString` + +`newLine` + +`nowServer` + +`nullValue` + +`pagePoolClear` + +`pagePoolList` + +`parseNumber` + +`query` + +`queryColumnArray` + +`queryColumnCount` + +`queryColumnData` + +`queryColumnExists` + +`queryColumnList` + +`queryCurrentRow` + +`queryGetCell` + +`queryRowData` + +`render` - Minimum Version: 5 + +`sanitizeHtml` + +`sessionstartTime` + +`sizeOf` + +`soundEx` + +`sslCertificateInstall` + +`sslCertificateList` + +`stringLen` + +`structKeyTranslate` + +`systemCacheClear` + +`systemOutput` + +`toNumeric` + +`trueFalseFormat` + +`ucFirst` + +`unserializeJava` + +`urlEncode` + +`webserviceNew` - Minimum Version: 5 diff --git a/docs/guides/member.md b/docs/guides/member.md new file mode 100644 index 000000000..630d3c0f6 --- /dev/null +++ b/docs/guides/member.md @@ -0,0 +1,503 @@ +# ColdFusion Member Functions + +CF11+ Member Functions allow variables of certain CFML data types to be treated as objects with functions. Invoking a member function on the object (the variable) allows you to skip passing the variable into the function because it already has a reference to the value. +The use of member functions often lead to more concise and readable code. + +For instance, consider the following headless function: + + arrayAppend(empArr, emp) + +Using a member function it can be written as: + + empArr.append(emp) + +Where `empArr` is a reference to an instance of a CFArray class (possibly a variable created with arrayNew). + +The following example depicts the new usage of member functions: + + // The standard way + var myArray = arrayNew(1); + arrayAppend(myArray, "objec_new"); + arraySort(myArray, "ASC"); + + // The member way + myArray.append("objec_new"); + myArray.sort("ASC"); + + // The member way + var myProductObject = createObject("java", "myJavaClass"); + myJavaList = myProductObject.getProductList(); + myJavaList.add("newProduct"); // Java API + + myJavaList.append("newProduct"); // CF API + myJavaList.sort("ASC"); + +Member Functions can also be chained (on Lucee or CF2018+), for example: + + s = "the"; + s = s.listAppend("quick brown fox", " ") + .listAppend("jumps over the lazy dog", " ") + .uCase() + .reverse(); + +result: `GOD YZAL EHT REVO SPMUJ XOF NWORB KCIUQ EHT` + +Member functions for the following data types are supported: + +- [Array](#array-member-functions) +- [String](#string-member-functions) +- [List](#list-member-functions) +- [Struct](#struct-member-functions) +- [Date](#date-member-functions) +- [Image](#image-member-functions) +- [Spreadsheet](#spreadsheet-member-functions) +- [XML](#xml-member-functions) +- [Query](#query-member-functions) +- [Numeric](#numeric-member-functions) + +CF 2016 changed the return type for append member functions: + +- `someArray.append()` now returns the appended array +- `someStruct.append()` now returns the appended structure + +## Array member functions + +- arrayAppend : `someVar.append()` +- arrayAvg : `someVar.avg()` +- arrayClear : `someVar.clear()` +- arrayContains : `someVar.contains()` +- arrayContainsNoCase : `someVar.containsNoCase()` +- arrayDelete : `someVar.delete()` +- arrayDeleteAt : `someVar.deleteAt()` +- arrayDeleteNoCase : `someVar.deleteNoCase()` +- arrayEach : `someVar.each()` +- arrayEvery : `someVar.every()` +- arrayFilter : `someVar.filter()` +- arrayFind : `someVar.find()` +- arrayFindAll : `someVar.findAll()` +- arrayFindAllNoCase : `someVar.findAllNoCase()` +- arrayFindNoCase : `someVar.findNoCase()` +- arrayFirst : `someVar.first()` +- arrayGetMetaData : `someVar.getMetaData()` +- arrayInsertAt : `someVar.insertAt()` +- arrayIsDefined : `someVar.isDefined()` +- arrayIsEmpty : `someVar.isEmpty()` +- arrayLast : `someVar.last()` +- arrayLen : `someVar.len()` +- arrayMap : `someVar.map()` +- arrayMax : `someVar.max()` +- arrayMin : `someVar.min()` +- arrayPrepend : `someVar.prepend()` +- arrayReduce : `someVar.reduce()` +- arrayReduceRight : `someVar.reduceRight()` +- arrayResize : `someVar.resize()` +- arraySet : `someVar.set()` +- arraySlice : `someVar.slice()` +- arraySome : `someVar.some()` +- arraySort : `someVar.sort()` +- arraySplice : `someVar.splice()` +- arraySum : `someVar.sum()` +- arraySwap : `someVar.swap()` +- arrayToList : `someVar.toList()` +- serializeJSON : `someVar.toJSON()` + +## String member functions + +- binaryDecode : `someVar.binaryDecode()` +- binaryEncode : `someVar.binaryEncode()` +- canonicalize : `someVar.canonicalize()` +- charsetDecode : `someVar.charsetDecode()` +- charsetEncode : `someVar.charsetEncode()` +- cJustify : `someVar.cJustify()` +- compare : `someVar.compare()` +- compareNoCase : `someVar.compareNoCase()` +- decodeForHTML : `someVar.decodeForHTML()` +- decodeFromURL : `someVar.decodeFromURL()` +- decrypt : `someVar.decrypt()` +- encodeForCSS : `someVar.encodeForCSS()` +- encodeForHTML : `someVar.encodeForHTML()` +- encodeForHTMLAttribute : `someVar.encodeForHTMLAttribute()` +- encodeForJavaScript : `someVar.encodeForJavaScript()` +- encodeForURL : `someVar.encodeForURL()` +- encodeForXML : `someVar.encodeForXML()` +- encodeForXMLAttribute : `someVar.encodeForXMLAttribute()` +- encodeForXPath : `someVar.encodeForXPath()` +- encrypt : `someVar.encrypt()` +- find : `someVar.find()` +- findNoCase : `someVar.findNoCase()` +- findOneOf : `someVar.findOneOf()` +- formatBaseN : `someVar.formatBaseN()` +- generateSecretKey : `someVar.generateSecretKey()` +- getSafeHTML : `someVar.getSafeHTML()` +- getToken : `someVar.getToken()` +- hash : `someVar.hash()` +- htmlCodeFormat : `someVar.htmlCodeFormat()` +- htmlEditFormat : `someVar.htmlEditFormat()` +- insert : `someVar.insert()` +- isSafeHTML : `someVar.isSafeHTML()` +- jsStringFormat : `someVar.jsStringFormat()` +- lCase : `someVar.lCase()` +- left : `someVar.left()` +- len : `someVar.len()` +- lJustify : `someVar.lJustify()` +- lsIsCurrency : `someVar.lsIsCurrency()` +- lsIsDate : `someVar.lsIsDate()` +- lsIsNumeric : `someVar.lsIsNumeric()` +- lsParseCurrency : `someVar.lsParseCurrency()` +- lsParseDateTime : `someVar.lsParseDateTime()` +- lsParseEuroCurrency : `someVar.lsParseEuroCurrency()` +- lsParseNumber : `someVar.lsParseNumber()` +- mid : `someVar.mid()` +- paragraphFormat : `someVar.paragraphFormat()` +- parseDateTime : `someVar.parseDateTime()` +- reFind : `someVar.reFind()` +- reFindNoCase : `someVar.reFindNoCase()` +- reMatch : `someVar.reMatch()` +- reMatchNoCase : `someVar.reMatchNoCase()` +- removeChars : `someVar.removeChars()` +- repeatString : `someVar.repeatString()` +- replace : `someVar.replace()` +- replaceList : `someVar.replaceList()` +- replaceListNoCase : `someVar.replaceListNoCase()` +- replaceNoCase : `someVar.replaceNoCase()` +- reReplace : `someVar.reReplace()` +- reReplaceNoCase : `someVar.reReplaceNoCase()` +- reverse : `someVar.reverse()` +- right : `someVar.right()` +- rJustify : `someVar.rJustify()` +- rTrim : `someVar.trim()` +- serializeJSON : `someVar.toJSON()` +- spanExcluding : `someVar.spanExcluding()` +- spanIncluding : `someVar.spanIncluding()` +- stringEach : `someVar.each()` +- stringEvery : `someVar.every()` +- stringFilter : `someVar.filter()` +- stringMap : `someVar.map()` +- stringReduce : `someVar.reduce()` +- stringReduceRight : `someVar.reduceRight()` +- stringSome : `someVar.some()` +- stringSort : `someVar.sort()` +- stripCR : `someVar.stripCR()` +- toBase64 : `someVar.toBase64()` +- toBinary : `someVar.toBinary()` +- toString : `someVar.toString()` +- trim : `someVar.trim()` +- uCase : `someVar.uCase()` +- urlDecode : `someVar.urlDecode()` +- urlEncodedFormat : `someVar.urlEncodedFormat()` +- val : `someVar.val()` +- wrap : `someVar.wrap()` +- xmlFormat : `someVar.xmlFormat()` + +## List member functions + +- listAppend : `someVar.listAppend()` +- listChangeDelims : `someVar.listChangeDelims()` +- listContains : `someVar.listContains()` +- listContainsNoCase : `someVar.listContainsNoCase()` +- listDeleteAt : `someVar.listDeleteAt()` +- listEach : `someVar.listEach()` +- listFind : `someVar.listFind()` +- listFindNoCase : `someVar.listFindNoCase()` +- listFirst : `someVar.listFirst()` +- listGetAt : `someVar.listGetAt()` +- listInsertAt : `someVar.listInsertAt()` +- listLast : `someVar.listLast()` +- listLen : `someVar.listLen()` +- listMap : `someVar.listMap()` +- listPrepend : `someVar.listPrepend()` +- listQualify : `someVar.listQualify()` +- listReduce : `someVar.listReduce()` +- listReduceRight : `someVar.listReduceRight()` +- listRemoveDuplicates : `someVar.listRemoveDuplicates()` +- listRest : `someVar.listRest()` +- listSetAt : `someVar.listSetAt()` +- listSort : `someVar.listSort()` +- listToArray : `someVar.listToArray()` +- listValueCount : `someVar.listValueCount()` +- listValueCountNoCase : `someVar.listValueCountNoCase()` +- serializeJSON : `someVar.toJSON()` + +## Struct member functions + +- serializeJSON : `someVar.toJSON()` +- structAppend : `someVar.append()` +- structClear : `someVar.clear()` +- structCopy : `someVar.copy()` +- structCount : `someVar.count()` +- structDelete : `someVar.delete()` +- structEach : `someVar.each()` +- structEvery : `someVar.every()` +- structFilter : `someVar.filter()` +- structFind : `someVar.find()` +- structFindKey : `someVar.findKey()` +- structFindValue : `someVar.findValue()` +- structGet : `someVar.get()` +- structGetMetadata : `someVar.getMetadata()` +- structInsert : `someVar.insert()` +- structIsCaseSensitive : `someVar.isCaseSensitive()` +- structIsEmpty : `someVar.isEmpty()` +- structIsOrdered : `someVar.isOrdered()` +- structKeyArray : `someVar.keyArray()` +- structKeyExists : `someVar.keyExists()` +- structKeyList : `someVar.keyList()` +- structMap : `someVar.map()` +- structReduce : `someVar.reduce()` +- structSetMetadata : `someVar.setMetadata()` +- structSome : `someVar.some()` +- structSort : `someVar.sort()` +- structToSorted : `someVar.toSorted()` +- structUpdate : `someVar.update()` + +## Date member functions + +- createODBCDate : `someVar.createODBCDate()` +- createODBCDateTime : `someVar.createODBCDateTime()` +- createODBCTime : `someVar.createODBCTime()` +- dateAdd : `someVar.add()` +- dateConvert : `someVar.convert()` +- dateDiff : `someVar.diff()` +- dateFormat : `someVar.dateFormat()` +- datePart : `someVar.datePart()` +- dateTimeFormat : `someVar.dateTimeFormat()` +- day : `someVar.day()` +- dayOfWeek : `someVar.dayOfWeek()` +- dayOfYear : `someVar.dayOfYear()` +- daysInMonth : `someVar.daysInMonth()` +- daysInYear : `someVar.daysIn` +- firstDayOfMonth : `someVar.firstDayOfMonth()` +- format : `someVar.format()` +- hour : `someVar.hour()` +- lsDateFormat : `someVar.lsDateFormat()` +- lsTimeFormat : `someVar.lsTimeFormat()` +- millisecond : `someVar.millisecond()` +- minute : `someVar.minute()` +- month : `someVar.month()` +- quarter : `someVar.quarter()` +- second : `someVar.second()` +- setDay : `.setDay(day)` +- setHour : `.setHour(hour)` +- setMinute : `.setMinute(minute)` +- setMonth : `.setMonth(month)` +- setSecond : `.setSecond(second)` +- setYear : `.setYear(year)` +- timeFormat : `someVar.timeFormat()` +- week : `someVar.week()` +- year : `someVar.year()` + +## Image member functions + +- imageAddBorder : `someVar.addBorder()` +- imageBlur : `someVar.blur()` +- imageClearRect : `someVar.clearRect()` +- imageCopy : `someVar.copy()` +- imageCrop : `someVar.crop()` +- imageDrawArc : `someVar.drawArc()` +- imageDrawBeveledRect : `someVar.drawBeveledRect()` +- imageDrawCubicCurve : `someVar.drawCubicCurve()` +- imageDrawLine : `someVar.drawLine()` +- imageDrawLines : `someVar.drawLines()` +- imageDrawOval : `someVar.drawOval()` +- imageDrawPoint : `someVar.drawPoint()` +- imageDrawQuadraticCurve : `someVar.drawQuadraticCurve()` +- imageDrawRect : `someVar.drawRect()` +- imageDrawRoundRect : `someVar.drawRoundRect()` +- imageDrawText : `someVar.drawText()` +- imageFlip : `someVar.flip()` +- imageGetBlob : `someVar.getBlob()` +- imageGetBufferedImage : `someVar.getBufferedImage()` +- imageGetExifMetadata : `someVar.getExifMetadata()` +- imageGetEXIFTag : `someVar.getEXIFTag()` +- imageGetHeight : `someVar.getHeight()` +- imageGetIptcMetadata : `someVar.getIptcMetadata()` +- imageGetIPTCTag : `someVar.getIPTCTag()` +- imageGetWidth : `someVar.getWidth()` +- imageGrayscale : `someVar.grayscale()` +- imageInfo : `someVar.info()` +- imageNegative : `someVar.negative()` +- imageOverlay : `someVar.overlay()` +- imagePaste : `someVar.paste()` +- imageResize : `someVar.resize()` +- imageRotate : `someVar.rotate()` +- imageRotateDrawingAxis : `someVar.rotateDrawingAxis()` +- imageScaleToFit : `someVar.scaleToFit()` +- imageSetAntialiasing : `someVar.setAntialiasing()` +- imageSetBackgroundColor : `someVar.setBackgroundColor()` +- imageSetDrawingColor : `someVar.setDrawingColor()` +- imageSetDrawingStroke : `someVar.setDrawingStroke()` +- imageSetDrawingTransparency : `someVar.setDrawingTransparency()` +- imageSharpen : `someVar.sharpen()` +- imageShear : `someVar.shear()` +- imageShearDrawingAxis : `someVar.shearDrawingAxis()` +- imageTranslate : `someVar.translate()` +- imageTranslateDrawingAxis : `someVar.translateDrawingAxis()` +- imageWrite : `someVar.write()` +- imageWriteBase64 : `someVar.writeBase64()` +- imageXORDrawingMode : `someVar.xorDrawingMode()` + +## Spreadsheet member functions + +- spreadsheetAddAutoFilter : `someVar.addAutoFilter()` +- spreadsheetAddColumn : `someVar.addColumn()` +- spreadsheetAddFreezePane : `someVar.addFreezePane()` +- spreadsheetAddImage : `someVar.addImage()` +- spreadsheetAddInfo : `someVar.addInfo()` +- spreadsheetAddPageBreaks : `someVar.addPageBreaks()` +- spreadsheetAddRow : `someVar.addRow()` +- spreadsheetAddRows : `someVar.addRows()` +- spreadsheetAddSplitPane : `someVar.addSplitPane()` +- spreadsheetCreateSheet : `someVar.createSheet()` +- spreadsheetDeleteColumn : `someVar.deleteColumn()` +- spreadsheetDeleteColumns : `someVar.deleteColumns()` +- spreadsheetDeleteRow : `someVar.deleteRow()` +- spreadsheetDeleteRows : `someVar.deleteRows()` +- spreadsheetFormatCell : `someVar.formatCell()` +- spreadsheetFormatCellRange : `someVar.formatCellRange()` +- spreadsheetFormatColumn : `someVar.formatColumn()` +- spreadsheetFormatColumns : `someVar.formatColumns()` +- spreadsheetFormatRow : `someVar.formatRow()` +- spreadsheetFormatRows : `someVar.formatRows()` +- spreadsheetGetCellComment : `someVar.getCellComment()` +- spreadsheetGetCellFormula : `someVar.getCellFormula()` +- spreadsheetGetCellValue : `someVar.getCellValue()` +- spreadsheetGetColumnCount : `someVar.getColumnCount()` +- spreadsheetInfo : `someVar.info()` +- spreadsheetMergeCells : `someVar.mergeCells()` +- spreadsheetReadBinary : `someVar.readBinary()` +- spreadsheetRemoveSheet : `someVar.removeSheet()` +- spreadsheetSetActiveSheet : `someVar.setActiveSheet()` +- spreadsheetSetActiveSheetNumber : `someVar.setActiveSheetNumber()` +- spreadsheetSetCellComment : `someVar.setCellComment()` +- spreadsheetSetCellFormula : `someVar.setCellFormula()` +- spreadsheetSetCellValue : `someVar.setCellValue()` +- spreadsheetSetColumnWidth : `someVar.setColumnWidth()` +- spreadsheetSetFooter : `someVar.setFooter()` +- spreadsheetSetHeader : `someVar.setHeader()` +- spreadsheetSetRowHeight : `someVar.setRowHeight()` +- spreadsheetShiftColumns : `someVar.shiftColumns()` +- spreadsheetShiftRows : `someVar.shiftRows()` +- spreadsheetWrite : `someVar.write()` + +## XML member functions + +- duplicate : `someVar.duplicate()` +- toString : `someVar.toString()` +- xmlAppend : `someVar.append()` +- xmlChildPos : `someVar.childPos()` +- xmlCount : `someVar.count()` +- xmlElemNew : `someVar.elemNew()` +- xmlGetNodeType : `someVar.getNodeType()` +- xmlHasChild : `someVar.hasChild()` +- xmlKeyArray : `someVar.keyArray()` +- xmlKeyList : `someVar.keyList()` +- xmlLen : `someVar.len()` +- xmlSearch : `someVar.search()` +- xmlTransform : `someVar.transform()` +- xmlUpdate : `someVar.update()` + +## Query member functions + +- len : `someVar.len()` +- queryAddColumn : `someVar.addColumn()` +- queryAddRow : `someVar.addRow()` +- queryAppend : `someVar.append()` +- queryClear : `someVar.clear()` +- queryConvertForGrid : `someVar.convertForGrid()` +- queryDeleteAt : `someVar.deleteAt()` +- queryDeleteColumn : `someVar.deleteColumn()` +- queryDeleteRow : `someVar.deleteRow()` +- queryEach : `someVar.each()` +- queryEvery : `someVar.every()` +- queryFilter : `someVar.filter()` +- queryGetResult : `someVar.getResult()` +- queryGetRow : `someVar.getRow()` +- queryInsertAt : `someVar.insertAt()` +- queryKeyExists : `someVar.keyExists()` +- queryMap : `someVar.map()` +- queryPrepend : `someVar.prepend()` +- queryRecordCount : `someVar.recordCount()` +- queryReduce : `someVar.reduce()` +- queryRowSwap : `someVar.rowSwap()` +- querySetCell : `someVar.setCell()` +- querySlice : `someVar.slice()` +- querySome : `someVar.some()` +- querySort : `someVar.sort()` +- serializeJSON : `someVar.toJSON()` +- valueArray : `someVar.valueArray()` + +When using Query.cfc, you get your results from the execution by using: + +- `someVar.getResult()` + +## Numeric member functions + +- abs : `someVar.abs()` +- acos : `someVar.aCos()` +- asin : `someVar.aSin()` +- atn : `someVar.atn()` +- bitAnd : `someVar.bitAnd()` +- bitMaskClear : `someVar.bitMaskClear()` +- bitMaskRead : `someVar.bitMaskRead()` +- bitMaskSet : `someVar.bitMaskSet()` +- bitNOT : `someVar.bitNot()` +- bitOR : `someVar.bitOr()` +- bitSHLN : `someVar.bitSHLN()` +- bitSHRN : `someVar.bitSHRN()` +- bitXOR : `someVar.bitXor()` +- ceiling : `someVar.ceiling()` +- cos : `someVar.cos()` +- decrementValue : `someVar.decrementValue()` +- exp : `someVar.exp()` +- fix : `someVar.fix()` +- floor : `someVar.floor()` +- formatBaseN : `someVar.formatBaseN()` +- incrementValue : `someVar.incrementValue()` +- inputBaseN : `someVar.inputBaseN()` +- log : `someVar.log()` +- log10 : `someVar.log10()` +- max : `someVar.max()` +- min : `someVar.min()` +- precisionEvaluate : `someVar.precisionEvaluate()` +- randomize : `someVar.randomize()` +- randRange : `someVar.randRange()` +- round : `someVar.round()` +- sgn : `someVar.sgn()` +- sin : `someVar.sin()` +- sqr : `someVar.sqr()` +- tan : `someVar.tan()` + +## Display and Formatting member functions + +- booleanFormat : `someVal.booleanFormat()` +- yesNoFormat : `someVal.yesNoFormat()` + +## Future member functions + +These are exclusively member functions and have no headless equivalent. You use them on the Future returned by `runAsync`. + +### Standard Future member functions + +- cancel : `FutureObject.cancel()` +- error : `FutureObject.error(UDFMethod method)` +- error : `FutureObject.then((UDFMethod method, long timeout)` +- get : `FutureObject.get()` +- get : `FutureObject.get(long timeout)` +- get : `FutureObject.get(long timeout, String timeUnit)` +- isCancelled : `FutureObject.isCancelled()` +- isDone : `FutureObject.isDone()` +- then : `FutureObject.then(UDFMethod method)` +- then : `FutureObject.then((UDFMethod method, long timeout)` + +### Empty Future member functions + +- cancel : `EmptyFutureObject.cancel()` +- complete : `EmptyFutureObject.complete(Object val)` +- get : `EmptyFutureObject.get()` +- isCancelled : `EmptyFutureObject.isCancelled()` +- isDone : `EmptyFutureObject.isDone()` + +## Important Note on a potential Member Function Gotcha + +Some member functions [might fall into underlying Java methods][note] if the strict ColdFusion syntax is not followed. + +[note]: https://tracker.adobe.com/#/view/CF-3753710 diff --git a/docs/guides/new.md b/docs/guides/new.md new file mode 100644 index 000000000..e7a0a77dd --- /dev/null +++ b/docs/guides/new.md @@ -0,0 +1,63 @@ +# New operator + +CF9+ New operator added in ColdFusion 9 + +The new operator is an alternate way to instantiate a component. The other methods being: cfobject, createObject, cfinvoke and entityNew. The CFML engine will automatically call the component constructor which by default is the init method. The init method can be overridden by the initmethod attribute. If neither the init method or initmethod attribute are present an instance is created but no methods are ran. The constructor will determine the value returned and can be anything allowed by cffunction. A return value of void will cause an instance of the component to be returned. The constructor can accept arguments by position or named just like a normal function call. + +file: Person.cfc + + component { + public Person function init() { + return this; + } + } + +example creating an instance of the Person component and the equivalent using createObject. + + + + + +example using the initmethod attribute + +file: Dog.cfc + + component initmethod="birth" { + public Dog function birth( required string name, string breed="mixed" ) { + variables.name = name; + return this; + } + } + +example using cfscript + + pet = new Dog( "fido" ); + +example using named arguments + + +or + + pet = new Dog( breed="pitbull", name="hank" ); + +example where the component is in a folder structure. + + pet = new node.animals.Dog( breed="pitbull", name="hank" ); + +The path and component can also be a variable. Notice the use of quotes around the variable name. You must also use quotes if the component name contains a hyphen. Components imported with cfimport do not need to use a dotted path. + + path2component = "node.animals.Dog"; + pet = new "#path2component#"( breed="pitbull", name="hank" ); + +Any of the script functions implemented as a cfc can be instantiate using the new operator. + +CF2018 New Operator Additions + +CF2018+ Added support for creating Java objects using the `new` keyword, as well as components by path. + + pet = new component("node.animals.Dog"); + +To create a new instance of a Java object in CF2018+ you can use: + + map = new java("java.util.HashMap"); + diff --git a/docs/guides/operators.md b/docs/guides/operators.md new file mode 100644 index 000000000..9fce5fc65 --- /dev/null +++ b/docs/guides/operators.md @@ -0,0 +1,83 @@ +# Operators in CFML + +This is an incomplete / work in progress guide to operators in CFML. + +### Equality + +`EQ` _Script_ ✓ _Tags_ ✓ + +`IS` _Script_ ✓ _Tags_ ✓ + +`==` _Script_ ✓ _Tags_ ✖ CF8+ + + if (animal == "cow") { + return "mooo!"; + } + +The `EQ`, `IS`, and `==` operators are case insensitive, so `"PETE" IS "pete"` evaluates to `true`. + +### Inequality + +`NEQ` _Script_ ✓ _Tags_ ✓ + +`IS NOT` _Script_ ✓ _Tags_ ✓ + +`!=` _Script_ ✓ _Tags_ ✖ CF8+ + + if (true != false) { + return "sanity"; + } + +### Negation + +`NOT` _Script_ ✓ _Tags_ ✓ + +`!` _Script_ ✓ _Tags_ ✓ CF8+ + + if ( !isLocalHost(cgi.remote_addr) ) { + throw("sorry localhost only"); + } + +### Comparison + +`GREATER THAN` _Script_ ✓ _Tags_ ✓ +`GT` _Script_ ✓ _Tags_ ✓ +`>` _Script_ ✓ _Tags_ ✖ + +`GREATER THAN OR EQUAL TO` _Script_ ✓ _Tags_ ✓ +`GTE` _Script_ ✓ _Tags_ ✓ +`GE` _Script_ ✓ _Tags_ ✓ +`>=` _Script_ ✓ _Tags_ ✖ + +`LESS THAN` _Script_ ✓ _Tags_ ✓ +`LT` _Script_ ✓ _Tags_ ✓ +`<` _Script_ ✓ _Tags_ ✖ + +`LESS THAN OR EQUAL TO` _Script_ ✓ _Tags_ ✓ +`LTE` _Script_ ✓ _Tags_ ✓ +`LE` _Script_ ✓ _Tags_ ✓ +`<=` _Script_ ✓ _Tags_ ✖ + +`CONTAINS` _Script_ ✓ _Tags_ ✓ +`DOES NOT CONTAIN` _Script_ ✓ _Tags_ ✓ + +Lucee supports the following shorthand for the `CONTAINS` and `DOES NOT CONTAIN` operators. + +`CT` _Script_ ✓ _Tags_ ✓ +`NCT` _Script_ ✓ _Tags_ ✓ + +### Concatenation + +`&` _Script_ ✓ _Tags_ ✓ + + name = name & " Jr."; + +`&=` _Script_ ✓ _Tags_ ✓ CF8+ + + name &= " Jr."; + +Both code examples are equivalent. + +## Compatibility Notes + +The operators `==`, `!=`, `<`, `<=`, `>`, and `>=` do not work in tags such as cfif or cfset in Adobe ColdFusion (as of Version 2016). However the `==`, `!=`, `<`, and `<=` operators work from tags on Lucee, but `>` and `>=` do not. diff --git a/docs/guides/ormsettings.md b/docs/guides/ormsettings.md new file mode 100644 index 000000000..b7de4c2d7 --- /dev/null +++ b/docs/guides/ormsettings.md @@ -0,0 +1,154 @@ +# ORM Settings Struct + +The following settings can be set using the `this.ORMSettings` struct in the pseudo constructor of Application.cfc. +ColdFusion uses these settings to configure ORM. All settings are optional. + +## Example + + this.ORMSettings = { + datasource = "foo", + dbcreate = "dropcreate" + }; + +## Options + +### `boolean autoGenMap` + +Default: `true` + +Specifies whether ColdFusion should automatically generate mapping for the persistent CFCs. If `false` the mappings should be provided in the form of `.hbmxml` files (see the Hibernate documentation at https://hibernate.org/orm/). + +### `boolean autoManageSession` + +Default: `true` + +CF901+ Lets you specify how the ORM session is managed. If `true`, ColdFusion manages everything for you, if `false` you have to flush, open, clear and close the ORM session yourself. + +ColdFusion closes the ORM session at the end of request irrespective of this setting. + +### `string cacheConfig` + +_This setting is used only when `secondarycacheenabled=true`._ + +Specifies the location of the configuration file that should be used by the secondary cache provider. + +### `string cacheProvider` + +_This setting is used only when `secondarycacheenabled=true`._ + +Specifies the cache provider that should be used by ORM as secondary cache. Fully qualified name of the class for any other cache provider. Possible values: + +* Ehcache +* Hashtable +* JBossCache +* OSCache +* SwarmCache + +### `string catalog` + +Specifies the default catalog that should be used by ORM. + +### `string|array CFCLocation` + +Specifies the directory (or array of directories) that should be used by ColdFusion to search for persistent CFCs to generate the mapping. If CFCLocation is set, ColdFusion looks at only the paths specified in it. If it is not set, ColdFusion looks at the application directory, its sub-directories, and its mapped directories to search for persistent CFCs. + +The specified paths can be: relative paths from the application root, mappings or absolute paths. + +### `string datasource` + +Specifies the data source that should be used by ORM. If it is not specified here, then the data source specified for the application is picked up. + +### `string DBCreate` + +Default: `none` + +ColdFusion ORM can automatically create the tables for your application in the database when ORM is initialized for the application. This can be enabled by using this setting. It takes the following values: + +* `dropcreate` Drops and recreates every table specified in the ORM. Does not drop other existing tables. +* `none` Does not touch the database. +* `update` Creates tables if they do not exist and updates tables if they do. Does not remove columns or tables. + +### `string dialect` + +Specifies the dialect. You can specify one of the following dialects, or provide your own using the fully qualified class name. + +* DB2 +* DB2AS400 +* DB2OS390 +* Derby +* Informix +* MicrosoftSQLServer +* MySQL +* MySQLwithInnoDB +* MySQLwithMyISAM +* Oracle10g +* Oracle8i +* Oracle9i +* PostgreSQL +* Sybase +* SybaseAnywhere + +### `boolean eventHandling` + +Default: `false` + +ORM provides callbacks to the event listeners for all the persistence events like `load`, `insert`, `update`, `delete` + +### `boolean flushAtRequestEnd` + +Default: `true` + +`true` (default) causes `ormFlush()` to be called automatically at request end. + +### `boolean logSQL` + +Default: `false` + +Specifies whether the SQL queries that are executed by ORM will be logged. When `true` the SQL queries are logged to the console. + +### `string namingStrategy` + +Defines database standard and naming convention. + +* default: This strategy uses the logical table or column name as it is. +* smart: This strategy changes the logical table or column name to uppercase. Also, if the logical table or column name is in camel case, this strategy breaks the camel cased name and separates the broken words using underscore. For example, for a CFC named "OrderProduct", this strategy changes the table name as "ORDER_PRODUCT". +* your own cfc : You can get complete control of the naming strategy by providing your own implementation. You need to specify the fully qualified name of the CFC as the value for naming strategy. This CFC must implement `cfide.orm.INamingStrategy` interface. + +### `string ORMConfig` + +A Hibernate configuration file, see https://www.tutorialspoint.com/hibernate/hibernate_configuration.htm + +### `boolean saveMapping` + +Default: `false` + +_Can be overridden in the individual CFCs._ +Specifies whether the generated Hibernate mapping files (.hbmxml) are saved to disc. If `true`, an .hbmxml file will be generated and saved in the same directory as the persistent CFC. + +### `string schema` + +Specifies the default database schema to be used by ORM. + +### `boolean skipCFCWithError` + +Default: `false` + +CF901+ Lets you specify if ColdFusion must skip the CFCs that have errors. If `true`, ColdFusion ignores the CFCs that have errors. + +### `string SQLScript` + +_This setting is used only when `dbcreate="dropcreate"`_ + +Absolute file path to the SQL script file that gets executed after ORM is initialized. Useful for populating the database with test data before the application is accessed. + +### `boolean useDBForMapping` + +Default: `true` + +Specifies whether the database has to be inspected to identify the missing information required to generate the Hibernate mapping. The database is inspected to get the column data type, primary key and foreign key information." + +### `boolean secondaryCacheEnabled` + +Default: `false` + +Specifies whether secondary caching should be enabled. diff --git a/docs/guides/scopes.md b/docs/guides/scopes.md new file mode 100644 index 000000000..adf00c08c --- /dev/null +++ b/docs/guides/scopes.md @@ -0,0 +1,44 @@ +# Scopes + +Scopes are regions of a program or application in which a variable exists. Variables with the same name in different scopes are different variables. + +## Variables Scope + +see [Variables Scope](/variables-scope) + +## CGI Scope + +see [CGI Scope](/cgi-scope) + +## Application Scope + +see Application Scope + +## Form Scope + +If you submitted a HTML form to the server, all named form fields will available in form scope. Let's say we have + + + +then you can access it via + + + +## URL Scope + +Every URL param can be accessed via the URL Scope like this: + + /?view=userlist&page=2&start=u&group=admin&mode=full + +According to this URL given output could be the following: + + + You're looking at #URL.view#'s page #URL.page# in #URL.mode# mode + + Start with letter: #URL.start# + + + +## Server Scope + +See [Server Scope](/server-scope) diff --git a/docs/guides/script.md b/docs/guides/script.md new file mode 100644 index 000000000..d6a560962 --- /dev/null +++ b/docs/guides/script.md @@ -0,0 +1,118 @@ +# CFScript Syntax Guide + +The CFScript syntax provides a way of writing CFML code without using tags. CFScript can either be in a script based component (CFC) or inside the cfscript tag. + +## Exception handling with the cfscript tag + +To handle exceptions use try and catch statements, which are equivalent to the cftry and cfcatch tags. For each try statement, you must have a catch statement. + +## Script support for tags + +CF11+ ColdFusion 11 allows you to invoke nearly all the built-in tags in a generic manner. + + cfexampletag (attrib=1, attr2=2); // The parent tag + { + // First child tag having attributes in the parenthesis (Optional) + cfexamplechild (child_attr1='cv1', child_attr2='cv2'); + { + // Nested child tag + cfexamplegrandchild (name="bob"); + } + // Second child of parent tag + cfexampleotherchild (child2_attr1='cv1', child2_attr2='cv2'); + } + +Note that the attributes of a tag must be enclosed within a parenthesis and also the attributes must be comma-separated. + +### The script support is not available for the following tags + + (infinite loop :) + (use writeOutput() instead) + (use writeDump() instead) + (use invoke() instead) + + (use createObject instead) + +### Using custom tags in scripts + +Custom tags can also be used in cfscript blocks just like built-in ColdFusion tags. This practice is not recommended, use a component instead of a custom tag. But if you really must, you can invoke a custom tag like this: + + cf_myCustomTag(myArg="x", otherArg="y"); + +### There are some tags that have multiple implementations + +These implementations are due to old syntax or dual syntax (CF9 cfc's) + + //CF9 syntax + thread action="run" name="testName" { + thread.test = "CFML"; + } + //CF11 syntax + cfthread( action="run", name="testName") { + thread.test = "CFML"; + } + +## Examples of CFScript + +### For Loop + + for (i=1; i <= 5; i++) { + // all statements in the block are looped over + result = i * 2; + writeOutput(result); + } + +### While Loop + + while (condition) { + // statements + } + +### If / else if / else + + count = 10; + if (count > 20) { + writeOutput(count); + } else if (count == 8) { + writeOutput(count); + } else { + writeOutput(count); + } + +### Query Loop + + q = queryNew("id,data", "integer,varchar", [ [11, "aa"], [22, "bb"], [33, "cc"] ] ); + for (row in q) { + writeOutput("#q.currentRow#:#row.id#:#row.data#;"); + //result: 1:11:aa;2:22:bb;3:33:cc; + } + +OR for CF11+ + + cfloop(query=q, group="fk") { + writeOutput("#fk#"); + } + +### Break / Continue + + for (row in q) { + if (row.skip) { + continue; + } + //do stuff... + } + + for (row in q) { + if (q.currentRow > 5) { + break; + } + //process rows 1-5 + } + +## Resources + +* [Tony Junkes GitHub](https://github.com/tonyjunkes/cfml-tags-to-cfscript/blob/master/README.md#general) +* [Adam Cameron GitHub](https://github.com/adamcameron/cfscript/blob/master/cfscript.md#database) +* [Pete Freitag Cheat sheet](https://www.petefreitag.com/cheatsheets/coldfusion/cfscript/) +* [Steve Walker CF Tag and Script Equivalents](https://web.archive.org/web/20151202091752/www.cfuser.com/cf-tag-and-script-equivalents/) +* [CFScript.me - tool to convert CFML tags to cfscript](https://cfscript.me/) diff --git a/docs/guides/security-authentication.md b/docs/guides/security-authentication.md new file mode 100644 index 000000000..5d45a599a --- /dev/null +++ b/docs/guides/security-authentication.md @@ -0,0 +1,219 @@ +# Authentication Guide + +If you missed our [Obfuscation](/security-obfuscation) or [Encryption](/security-encryption) guides, we strongly recommend that you read those guides first as this guide builds on some of the principles outlined in those guides to build a robust authentication system. + +Authentication is the process by which you validate that a particular user is allowed to login to your application. This should not be confused with *access control*, which determines what parts of your application a user has access to. Authentication is merely the process of ensuring a user can login. + +Authentication has been around as long as computers have been around. The first widely used version of authentication for web applications was known as HTTP Basic Authentication and was widely used by everyone in the early days of web application development. Unfortunately, HTTP Basic Authentication has some caveats to it that make it a very insecure way of handling authentication in the modern world, not the least of which is the username and password being sent in clear-text on every single request made. This opened the door for MITM (Man In The Middle) attacks in the early 1990's and quickly fell out of favor with most web developers. + +Since then several 'flavors' of web application authentication have come along that aimed to address the various attack vectors exposed by preceding authentication mechanisms. We will use many of these authentication mechanisms, layered upon one another, to build a highly secure authentication system that will provide a concise way for you to allow registered users to authenticate with your application. + +### Federated Authentication + +Federated authentication was born to address the need to ensure that a user was logging in from your server and not from someone else's server. Federation helps prevent someone from generating a form on their site that then logs into your site, exposing your authentication to abuse by servers not under your control. + +The first step to federation is to ensure that the value of the referrer HTTP header value matches that of your domain. While this is still a good practice, modern languages can easily fake the referrer in the HTTP header itself, so another method of federation needs to be layered upon this one - federated cookies. + +Federated cookies, when layered with the referrer check, provide a more secure login form by requiring that your domain specific cookie is provided to your server on the authentication request. While it is still feasible to provide this cookie from another server, it makes your authentication more robust and can help ward off those scripts that cannot, or does not, provide for these kinds of added protections. This is not a failsafe, it merely adds upon the layers your authentication requires, thus making it more difficult and time consuming to hack. + +### Disclosure Prevention + +One of the drawbacks of authenticating with web applications is that the username and password still need to be sent to the server for authentication. In most cases, this information is still sent in clear-text on the initial request. While this alleviates one of the problems with HTTP Basic Authentication - the need to send the username and password in clear-text on **every** request, it still presents an opportunity for a MITM attack to see the username and password being passed in. + +For most web applications being built these days, the 'username' is typically the users email address. Some systems still support, or require, a unique username that is not your email address, but the vast majority of username login's these days are based on your email. Disclosure of a person's email address is commonly considered 'ok' in that a users email address is publicly available information in most cases. + +Passwords on the other hand, are always (or should always) be unique to each system a user wishes to authenticate with. Far too often, however, people are lazy or have far too many login's to keep track of manually (and lack any understanding of the availability of applications that manage these passwords for them) and will use the same password... everywhere. + +For this reason, steps should be taken to ensure that the plain-text passwords of your users are not sent to the server so that such a password disclosure doesn't lead to a user having all of their accounts exposed and attacked. We will look at one effective way of doing this using hashing in this guide. + +### Session Cookies + +CFML can provide the *cftoken* session cookie management features out of the box and, by default, these are usually turned on in older CFML engines, with CF10+ allowing for greater control over how those session cookies are managed. You can, and should, however utilize your own session cookie to manage sessions to achieve greater control over the session as well as eliminate a common attack vector against CFML - anyone who has used CFML understands that the *cftoken* cookie is used for session management, and thus understands this is the attack vector to exploit. If you instead utilize your own session cookie, it can help avoid script kiddie utilities designed to attack the specific *cftoken* cookie provided by CFML. We'll start by defining the name of our session cookie within the *application* scope of your *Application.cfc*, as follows: + + // set the name of the cookie to use for session management (*DO NOT USE* cfid, cftoken or jsessionid) + application.cookieName = '__some_obfuscated_name'; + +To prevent potential hackers from recognizing your cookie as an authentication cookie, it is best to obfuscate the name of the cookie in some way. For example: + + __ga_tracking_beacon_ + +Which might confuse the hacker into believing that this is a Google Analytics cookie, and not one specific to authentication. Be creative in naming your cookie and it can, and often will, be readily dismissed by a potential hacker as unrelated to your authentication. You could also simply use the [hash()](/hash) algorithm, but this is less likely to confuse a potential hacker than making the cookie appear to be unrelated to your site: + + __#hash( 'some_cookie_name', 'SHA-256', 'UTF-8', 25 )# + +### The Login View (Page) + +We'll start exploring how to build a secure authentication mechanism by examining the login page you should use for your web application. This login page should take advantage of both federation and prevent against password disclosure. Our examples will, again, be using fw/1 to demonstrate ways of handling these tasks, but the same concepts are applicable across all web applications (even non-CFML ones!). + +Let's start by looking at our login() controller. One of the first things we do is to set a zero-value session cookie when requesting the login form. This will be checked during authentication to ensure that our form is being posted from our own server: + + // set a zero-value session cookie when hitting the login page (federate the login) + getPageContext().getResponse().addHeader("Set-Cookie", "#application.cookieName#=0;path=/;domain=#listFirst( CGI.HTTP_HOST, ':' )#;HTTPOnly"); + +In the above code, we are simply setting a cookie on the request, utilizing our application scoped cookie name, with a zero value. + +The next thing you'll typically want to do is to clear any existing session object (bean) from the system for this session to ensure that there are is no lingering session data, which we'll use during [session management](/security-session-management): + + // lock and clear the sessionObj + lock scope='session' timeout='10' { + session.sessionObj = createObject( 'component', 'model.beans.Session').init(); + } + +Once this is completed, you would add any other processes you need before displaying your login form and then display the form. + +Within the login view (page) itself you want to include two hidden fields, as follows: + + + + +The first field, which we call 'heartbeat' will contain a random alphanumeric value which we will use later to obfuscate the users password **before** it is sent to the server. We'll cover this more in a moment, but it is important to note that this field has been given a DOM id value which we'll need to later process this field. + +It is also important to note that we did not assign this to an rc. value within the controller itself because if an attacker knows this value is passed from the controller to the view, it is feasible for them to pass the rc. value in with the request itself and override that value in the controller. It is unlikely, but feasible, and as such we make the call to our random alphanumeric code generator directly within the form itself. + +The second field, which is a hashed 'token' utilizes CFML's [csrfGenerateToken()](/csrfgeneratetoken) function, forcing a new key, which we will use along with the built-in [csrfVerifyToken()](/csrfverifytoken) function to help protect the login form from Cross-Site Request Forgery (CSRF) attacks. + +We then proceed to provide the username and password fields as we normally would, giving an id to our password field, something along the lines of: + + + +We can now use these two form fields, along with a bit of JavaScript, to protect the user's password from disclosure - by not sending the password from the browser to the server in plain-text, we ensure that the users password is protected from that disclosure. By using the randomly generated heartbeat value in connection with our hashing algorithm, which we'll explore below, we ensure that the password cannot be matched to a rainbow table with relative ease. + +We'll be using jQuery in our example, along with an SHA-384 JavaScript algorithm from the [CryptoJS](https://bit.ly/1tqrgeu) library: + + + +In the code above, we add an onClick() listener to the login form's submit button, check to ensure that the password has length, prevent the default action (submitting the form) and then take the following steps: + +We hash the user's password field value with SHA-384. +We then append that hashed value with the value of the heartbeat field, and hash them both together. +We then replace the value of the user's password field with the hashed password + heartbeat value. +Then we submit the form. + +In doing so, we have obfuscated the users password and prevented disclosure from the browser to the server in plain-text. This has a drawback with some older browsers which will save the hashed password when choosing to 'save my password for this site', but then users really ought not be letting the browser save their passwords anyway. Modern browsers understand what is going on with this code, however, and will rightly save the actual password typed in by the user. + +In just a few simple lines of code (which are spelled out here to show the process more thoroughly and could be truncated to further obscure what the JavaScript is intended to do), we have a) federated our login form with a cookie, b) eliminated any lingering session values for that session, c) ensured that the users password is protected from disclosure when being sent to the server from the browser and d) helped protect against CSRF attacks by generating a token. + +### Authentication + +Once the user has entered their username and password, and clicked your 'login' button, their data is sent to your server to be processed. The first thing we want to do is ensure that the page is being submitted to your server from your server, which we do both by checking the referrer, as follows: + + // check if the host and referrer match (federate the login) + if ( !findNoCase( CGI.HTTP_HOST, CGI.HTTP_REFERER ) ) { + // they don't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = 'msg=503' ); + } + +And next by checking the cookie is provided, as follows: + + // check if the session cookie exists (federate the login) + if ( !structKeyExists( cookie, application.cookieName ) ) { + // it doesn't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = 'msg=504' ); + } + +In both cases, if either of these checks fails then the user is redirected back to the login view, thus preventing anyone from submitting a form to your server from another location. + +We then do a little server-side validation (because we cannot always trust that this request is being sent from a form that contained client-side validation, e.g. a script someone wrote to attempt to hack your authentication), so we make sure both the username and password are provided: + + // ensure a username and password were sent + if ( !len( rc.username ) OR !len( rc.password ) ) { + // they weren't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = 'msg=500' ); + } + +We then want to ensure that the CSRF token has been provided and matches the token we have stored for this users session: + + // ensure the CSRF token is provided and valid + if ( !structKeyExists( rc, 'f' & application.securityService.uberHash( 'token', 'SHA-512', 150 ) ) OR !csrfVerifyToken( rc[ 'f' & application.securityService.uberHash( 'token', 'SHA-512', 150 ) ] ) ) { + // it doesn't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = 'msg=505' ); + } + +If we've passed all of these checks, our next step is to get the user's information from storage (typically the database) by passing the provided username (email address in many cases), as follows: + + // get the user from the database by encrypted username + qGetUser = userService.filter( username = application.securityService.dataEnc( rc.username, 'repeatable' ) ); + +If you followed along with all our guides, you may recognize us discussing the need to use repeatable encryption when using the CBC\PKCS5Padding option for encryption. + +Next, we check if the provided username even exists in the database: + + // check if there is a record for the passed username + if ( !qGetUser.recordCount ) { + // there isn't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = 'msg=404' ); + } + +Next we'll typically want to ensure that the user has an active account in the system. We do this with an 'isActive' bit flag in our database which we then check for 'false': + + // check to be sure this user has an active account + if ( !qGetUser.isActive ) { + // they don't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = 'msg=555' ); + } + +If we've gotten this far in the process, then it's time to decrypt the stored users (hashed) password and compare it against the passed in heartbeat and password form field values, like so: + + // hash the users stored password with the passed heartbeat for comparison + hashedPwd = hash( lCase( application.securityService.dataDec( qGetUser.password, 'db' ) ) & rc.heartbeat, 'SHA-384' ); + + // compare the hashed stored password with the passed password + if ( !findNoCase( hashedPwd, rc.password ) ) { + // they don't match, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = 'msg=403' ); + } + +And now, assuming the user has provided the proper password upon login, we generate a session object: + + // lock the session scope and create a sessionObj for this user + lock scope='session' timeout='10' { + session.sessionObj = application.securityService.createUserSession( + userId = qGetUser.userId, + role = qGetUser.role, + firstName = application.securityService.dataDec( qGetUser.firstName, 'db' ), + lastName = application.securityService.dataDec( qGetUser.lastName, 'db' ) + ); + } + +The above is one example of storing useful information in the session object, but is by no means complete and by no means required. You are free to come up with your own session object bean and populate it as needed for your particular application. + +We then set a cookie for the user with an encrypted value, which we will then use during [session management](/security-session-management) to manage the users session after they have successfully authenticated: + + // set the session cookie with the new encrypted session id + getPageContext().getResponse().addHeader("Set-Cookie", "#application.cookieName#=#application.securityService.setSessionIdForCookie( session.sessionObj.getSessionId() )#;path=/;domain=#listFirst( CGI.HTTP_HOST, ':' )#;HTTPOnly"); + +And then we redirect the user to whichever page within our system we consider the 'landing' page for authenticated users: + + // and go to the dashboard view + variables.fw.redirect( 'main.dashboard' ); + +And presto! A secure authentication has been made and we are now ready to serve content to this authenticated user. + +This combination of layered security best practices ensures that any hacker wanting to break into our authentication mechanisms would need to spend a fair amount of time reverse-engineering the process and mimicking both the browser and potential server responses. If a hacker really wants to try and break your authentication, they can still do it but it will take considerable effort on their part. Less capable and less interested hackers will simply move on to easier targets, of which there are many. + +All of these concepts can be found in convenient functions in my [SecurityService.cfc](https://bit.ly/1IkY5zK) service, [main.cfc](https://bit.ly/1S1syAp) controller and [default.cfm](https://bit.ly/1XhyJrX) view, which are part of a larger example of using these and other security techniques to create a [secure](https://bit.ly/1Msdwkt), or [two-factor](https://bit.ly/1Yx4hGt), [framework one (FW/1)](https://bit.ly/22lB2eu) application. diff --git a/docs/guides/security-encryption.md b/docs/guides/security-encryption.md new file mode 100644 index 000000000..bdcf1504b --- /dev/null +++ b/docs/guides/security-encryption.md @@ -0,0 +1,116 @@ +# Encryption Guide + +If you missed our [Obfuscation Guide](/security-obfuscation), we suggest you read it before reading this one, as this guide builds on the principles established in the [Obfuscation Guide](/security-obfuscation). + +Encrypting data is different than [obfuscating](/security-obfuscation) data in one key sense – obfuscation, or [hash()](/hash)ing in our case, is a one-way encryption technique. There is no practical way, other than building and using a [rainbow table](https://bit.ly/1TQzXG7), to decrypt the value produced by the hashing algorithm. This is perfect for parameter names because we know ahead of time what that parameter name is going to be. This isn't usually the case for the values assigned to those parameters, however, which is usually dynamic. + +Encryption, on the other hand, **is** reversible and allows you to safely encode the values of your URL and FORM (and COOKIE, RC, and other scope) values for passage on the URL or in hidden FORM fields. + +Before we dive much further into actual encryption, we need to visit another function that helps us to generate the encryption keys we'll use… [generateSecretKey()](/generatesecretkey): + + // generate a 128 bit AES encryption key + writeOutput( generateSecretKey( 'AES' ) ); + + // generate a 256 bit AES encryption key CF10+ Lucee4.5+ + writeOutput( generateSecretKey( 'AES', 256 ) ); + +Note that by default [generateSecretKey()](/generatesecretkey) generates 128-bit encryption keys. You can pass the optional parameter for key size to this function, however, and generate 256 bit (and indeed, 512 bit, 1024 bit, etc.) keys. As of this writing, 256 bit keys are supported for the AES and BLOWFISH encryption algorithms. If you're using CF10+ or Lucee4.5+ then you can generate and use 256 bit keys instead of 128 bit keys. + +I have used 256 bit keys in my examples here, and I tend to use 256 bit keys only in those applications that demand a high level of security, however there is a (very) good argument to be made against using 256 bit keys as they are, at present, no more secure than 128 bit encryption and require up to 40% more processing cycles than 128 bit keys. In short, 128 bit keys are sufficient to safely encrypt your data as of today. One day, when quantum computers are all the rage, 128 bit is unlikely to be enough as the quantum bit halves the effective key size (quantum computers can decrypt 2n/2 vs. current processors which can only decrypt 2n). Mass market quantum computing may yet be 20 or more years out, however, so honestly my use of 256 bit keys could be considered overkill presently. + +Also before we get into the nuts and bolts of the [encrypt()](/encrypt) and [decrypt()](/decrypt) functions we'll use, it is helpful to note that there are a couple of caveats with the default functionality of these functions. + +The first of these is that, by default, [encrypt()](/encrypt) and [decrypt()](/decrypt) utilize the ECB, or Electronic Code Book, mode of encryption. ECB is a weak cipher mode which encrypts blocks of data in parallel. This cipher mode allows forced decryption to occur in parallel, further enhancing the chances of breaking the encryption and finding the key. Once one block has been decrypted, the key is known and all remaining blocks can be decrypted. + +You can instead specify that you want to use CBC, or Cipher-Block Chaining, mode which uses an XOR of the previously encrypted block as its initialization vector for the next block to be encrypted. Decryption therefore requires each previous block to decrypt, though decryption can still occur in parallel, but only if the key is already known – it is much harder to decipher the key from any given block of data when using CBC mode and thus, you're better protected from a forced decryption attempt if your data is ever disclosed (a nice way of saying 'stolen'). + +Our examples will utilize CBC mode with PKCS5Padding to demonstrate how to best use encryption in CFML. One caveat to using CBC mode with PKCS5Padding, which is a bonus in most circumstances, is that it will generate a unique encrypted output value every time you run the same input value through [encrypt()](/encrypt). So, if you [encrypt()](/encrypt) 'dog' twice, it will encrypt to a different final value on each pass: + + myString = 'dog'; + myKey = 'ITRkCTb/XMtGT0g99WUkKak/hhNvPml3k+UbsVDqSBE='; + myAlgorithm = 'AES/CBC/PKCS5Padding'; + myEncoding = 'HEX'; + encString = encrypt( myString, myKey, myAlgorithm, myEncoding ); + writeOutput( encString ); + +This is desirable behavior 99.99% of the time, but there is one use case where this behavior is less than favorable – user authentication. Typically, you'll [encrypt()](/encrypt) your user's username and [hash()](/hash) and [encrypt()](/encrypt) your user's password. If you use CBC mode to encrypt the username, and then later wish to query this username upon user login, you will be unable to find the user due to the unique output values generated by using the CBC/PKCS5Padding option. In these cases, you will want to use ECB instead of CBC cipher mode, and encrypt in multiple passes: + + myUsername = 'bob@bob.com'; + myKey1 = 'RQr9IRygGQtguVEHvKh4WLgs5wz3V+BZIq82GKM5FrI='; + myAlgorithm1 = 'AES'; + myEncoding1 = 'HEX'; + myKey2 = '7SlPIgphVuR8sTGjBdKHBUqw2wss1XKwz5vYZXn7TY0='; + myAlgorithm2 = 'BLOWFISH'; + myEncoding2 = 'BASE64'; + myKey3 = 'zZYZVmsNFMqZcz0SzKMGPtCixdP9CWfmV3/xu9cwCRA='; + myAlgorithm3 = 'AES'; + myEncoding3 = 'HEX'; + encUsername = encrypt( myUsername, myKey1, myAlgorithm1, myEncoding1 ); + encUsername = encrypt( encUsername, myKey2, myAlgorithm2, myEncoding2 ); + encUsername = encrypt( encUsername, myKey3, myAlgorithm3, myEncoding3 ); + writeOutput( encUsername ); + +This will allow you to easily replicate the encrypted value and query the user by their encrypted username, while still protecting the username reasonably well from disclosure if your database is ever hacked. You should still [encrypt()](/encrypt) the password with CBC/PKCS5Padding, of course, to help further protect against information disclosure. + +As we discovered previously in our [Obfuscation Guide](/security-obfuscation), obfuscating URL and form parameter names makes parameter tampering a 'shot in the dark' prospect, but because the values of those parameters are still being sent in clear text, enough fiddling around and one can guesstimate what the values are for, and, of course, one can still directly tamper with the parameter values with ease. Encryption helps us to solve the plain text value problem: + + myKey = 'Ng12PCeRET7ESEfUqwJCA2TgWh3wadBk/SDx10U/8lI='; + myAlgorithm = 'AES/CBC/PKCS5Padding'; + myEncoding = 'HEX'; + Edit Profile + +This leads to a URL that looks more like the following (parameter names and values are contrived for brevity): + + Profile.cfm?vc5c71dd0fbb58b1de4df=B5AF357FCCDD45&vfe6f54c33f9064833ee8=195A550ED9D9C08&va929c5b94ad8ed832a38=D5C0C93E4 + +Now that the values of the parameters are encrypted, it is nearly impossible to guess which parameter does what, and it is pretty much impossible to tamper with these values without knowing the encryption key. This has the additional benefit of allowing you to check for failed decryption in your application and flag this as a parameter tampering event, perhaps leading to other actions such as IP banning whoever is attempting to tamper with the parameters, after some value of N unsuccessful attempts, for example. + +To access these newly encrypted values we simply [decrypt()](/decrypt) them in a try/catch block within our page processing, after validating all parameters have been passed and are valid, to handle parameter tampering causing decryption errors: + + // set-up encryption details + myKey = 'HIjv4jTHeknV7mY4CFBqdgOv1vWX4i/G9zPrctJjl0c='; + myAlgorithm = 'AES/CBC/PKCS5Padding'; + myEncoding = 'HEX'; + + // parameterize + param name="URL['v' & hash( 'userId', 'SHA-384', 'UTF-8', 500 )]" default="0"; + param name="URL['v' & hash( 'name', 'SHA-384', 'UTF-8', 1000 )]" default=""; + param name="URL['v' & hash( 'departmentId', 'SHA-384', 'UTF-8', 750 )]" default="0"; + + // check for validity of parameter values + if ( URL['v' & hash( 'userId', 'SHA-384', 'UTF-8', 500 )] == 0 ) { + // invalid or no user id submitted + } else if ( !len( URL['v' & hash( 'name', 'SHA-384', 'UTF-8', 1000 )] ) ) { + // invalid or no name submitted + } else if ( URL['v' & hash( 'departmentId', 'SHA-384', 'UTF-8', 750 )] == 0 ) { + // invalid or no departmentId submitted + } + + // try to decrypt passed values + try { + userId = decrypt( URL['v' & hash( 'userId', 'SHA-384', 'UTF-8', 500 )] , myKey, myAlgorithm, myEncoding ); + name = decrypt( URL['v' & hash( 'name', 'SHA-384', 'UTF-8', 1000 )], myKey, myAlgorithm, myEncoding ); + departmentId = decrypt( URL['v' & hash( 'departmentId', 'SHA-384', 'UTF-8', 750 )], myKey, myAlgorithm, myEncoding ); + } catch( any e ) { + // deal with decryption errors + } + +Now if the hacker attempts to modify the values of the parameters, they will quickly find themselves throwing decryption errors and you'll be able to quickly identify when hacking attempts are being made and take a suitable action (like IP banning the offender). + +This layered approach works equally well for hidden form fields – you obfuscate the form field name and encrypt the form field value, then decrypt on form submission and process as you normally would: + + myKey = 'tf0wcU7556DTt0ftUSkWOZlk82FkL7acSCnsCuWPHZ8='; + myAlgorithm = 'BLOWFISH/CBC/PKCS5Padding'; + myEncoding = 'HEX'; + + writeOutput( "" ); + +If you're a keen observer you'll notice that, in addition to using a different [hash()](/hash) algorithm for form scoped parameter names vs. the URL scoped parameter names, I use a different key and algorithm when encrypting form parameter values vs. URL parameter values. This further obfuscates these values and makes them impossible to match up between a GET and POST request. It is recommended to use a different algorithm and key for each scope where you will be storing encrypted information, such as URL, form and cookie scopes. + +The last, and arguably the most important, use of encryption is to secure the data stored in your database, typically anything that is considered Personally Identifiable Information (PII, for short). While there are dozens of differing opinions online as to what constitutes personally identifiable information, the [NIST Guide to Protecting the Confidentiality of Personally Identifiable Information](https://1.usa.gov/1DgxrRy), covers what should be protected at a minimum. Names, addresses, email addresses, phone numbers, social security numbers, credit card numbers (which you ought not store at all if you can avoid it) and date of birth are some examples of what should be encrypted in your database. + +In addition, use of CBC/PKCS5Padding and multi-pass encryption is highly recommended when storing PII – though the NIST standards are less restrictive, more encryption is almost always better than less encryption and a couple extra encryption passes can have a big impact on security for the small cost of a couple of extra compute cycles. That being said, however, use your best judgment based on the expected server load and available hardware as to how many passes you should give PII before storing it in your database so you don't accidentally create an artificial bottleneck. As mentioned previously, 128 bit keys are suitable for encrypting data today with AES or BLOWFISH algorithms, but use of 256-bit keys are supported. + +All of these concepts – different keys and algorithms depending on scope, repeatable but secure encryption, and multi-pass encryption for database storage – can all be found in convenient `dataEnc( string, scope )` and `dataDec( string, scope )` functions in my [SecurityService.cfc available on GitHub](https://bit.ly/1IkY5zK), which are part of a larger example of using the other security techniques outlined in this document to create a [secure](https://bit.ly/1Msdwkt), or [two-factor](https://bit.ly/1Yx4hGt), [framework one (FW/1)](https://bit.ly/22lB2eu) application. diff --git a/docs/guides/security-obfuscation.md b/docs/guides/security-obfuscation.md new file mode 100644 index 000000000..d44876665 --- /dev/null +++ b/docs/guides/security-obfuscation.md @@ -0,0 +1,41 @@ +# Obfuscation Guide + +It's a funny sounding word, but it means to 'render obscure, unclear, or unintelligible', or what us older folk used to call 'security through obscurity', essentially. When it comes to code, there are lots of things that should be obscured to enhance security, such as form and URL parameters. How often do you see parameters in URL's like the following? + + Profile.cfm?userId=911&name=Bob&departmentId=5 + +You know immediately that '911' is the id of the user being passed in to this code, that their name is 'Bob' and they belong to department id '5'. From here it's easy enough to start changing any of the values of these parameters to see what the code does. Hmm… what if we change the userId to 912… what would we get returned from this code then? Probably user 912's information. This is called parameter tampering, and is by far the easiest of all exploits. You ought to be checking for parameter tampering – to make sure that when use 911 is logged in they can't get to any other users information for example… but we'll cover that in more depth a bit later. + +What if, instead of giving hackers the information they need right on the URL, we generated URL's that obfuscate the names of our parameters? + + Profile.cfm?vc5c71dd0fbb58b1de4df=911&vfe6f54c33f9064833ee8=Bob&va929c5b94ad8ed832a38=5 + +These are contrived values, mind you, but now that these parameter names are obfuscated, you really don't know what the values are for. You could still monkey with the values and see what happens, and we'll explain how to rectify that problem in our [Encryption](/security-encryption) guide, but you won't instinctively understand what any one of those parameters do just by looking at the URL anymore. + +I can hear some of you already asking… 'Wait. Do you mean I have to come up with obscure parameter names and then try and remember where I used them?' The answer is no, you do not. Thankfully there is an easy way to obscure the parameter names you already use… we [hash()](/hash) them: + + Edit Profile + +The next question I hear you asking is 'Ok, great. But how do I handle that in Profile.cfm?'. I'm glad you asked, and it is just as simple: + + param name="URL['v' & hash( 'userId', 'SHA-384', 'UTF-8', 500 )]" default="0"; + param name="URL['v' & hash( 'name', 'SHA-384', 'UTF-8', 1000 )]" default=""; + param name="URL['v' & hash( 'departmentId', 'SHA-384', 'UTF-8', 750 )]" default="0"; + +Note the inclusion of the letter 'v' in both the construction of the URL and in the parameters expected in Profile.cfm. The reason for this additional character is to remain compliant with HTML parameter name definitions, which state that all parameter names should start with a letter. As [hash()](/hash) frequently produces values that start with a number, this additional character ensures you remain HTML compliant. You can use any letter (or combination of letters) that you choose, for URL 'variables' I chose the letter 'v'. + +You can just as easily apply this technique to form fields, though there is less value in using them for standard form fields given the HTML form typically includes labels which clearly indicate what each field's purpose is. It is still a handy technique to apply to hidden form fields, however, which helps further obfuscate common values. Using our Profile.cfm example: + + + +And conversely, getting this value in the action page, let's assume Profile.cfm posts back on itself, is just as simple as the URL variant: + + param name="FORM['ff' & hash( 'userId', 'SHA-512', 'UTF-8', 825 )]" default="0"; + +Note that I've switched from 'v' as my starting variable name to 'ff' for 'formfield' when generating and parameterizing the hashed userId name. Also note that I've switched the encoding from SHA-384 to SHA-512, and changed the number of iterations. These tweaks produce a different parameter name in the form than was produced in the URL, thus further obfuscating which parameter is which when investigating the form for data passed into it. + +'Wait.' You say… 'The value of the URL and form fields are still "911", so this is still not very secure'. Right you are, my friend. And thus, we need to introduce our next concept on the road to true security enlightenment… encryption. + +[Click Here](/security-encryption) to learn how encrypting your data will help protect you from parameter tampering or information disclosure. diff --git a/docs/guides/security-session-management.md b/docs/guides/security-session-management.md new file mode 100644 index 000000000..569227680 --- /dev/null +++ b/docs/guides/security-session-management.md @@ -0,0 +1,218 @@ +# Session Management Guide + +If you missed our [Obfuscation](/security-obfuscation), [Encryption](/security-encryption) or [Authentication](/security-authentication) guides, we strongly recommend that you read those guides first as this guide builds on some of the principles outlined in those guides to build a more secure session management system. + +This guide **does not** cover using much of the built-in session management functions available with CFML. Instead, we approach this topic using a ground-up approach that offers complete control over the session management process. This roll-your-own approach has been found to be more secure and more concise than the built-in functions of CFML, and for many the concepts are easier to grasp as they require you to walk through the entire session management lifecycle. + +Once your user has [authenticated](/security-authentication) with your system securely, you will need to ensure that the session management lifecycle is secure and concise. We begin to do that by understanding some of the basic concepts of session management. Note that some of this information is repetitive if you've been following along with all our security guides, but is presented here again for a more complete picture of session management if you've **not** already read our other guides. + +### Session Cookies + +CFML can provide the *cftoken* session cookie management features out of the box and, by default, these are usually turned on in older CFML engines, with CF10+ allowing for greater control over how those session cookies are managed. You can, and should, however utilize your own session cookie to manage sessions to achieve greater control over the session as well as eliminate a common attack vector against CFML - anyone who has used CFML understands that the *cftoken* cookie is used for session management, and thus understands this is the attack vector to exploit. If you instead utilize your own session cookie, it can help avoid script kiddie utilities designed to attack the specific *cftoken* cookie provided by CFML. We'll start by defining the name of our session cookie within the *application* scope of your *Application.cfc*, as follows: + + // set the name of the cookie to use for session management (*DO NOT USE* cfid, cftoken or jsessionid) + application.cookieName = '__some_obfuscated_name'; + +To prevent potential hackers from recognizing your cookie as an authentication cookie, it is best to obfuscate the name of the cookie in some way. For example: + + __ga_tracking_beacon_ + +Which might confuse the hacker into believing that this is a Google Analytics cookie, and not one specific to authentication. Be creative in naming your cookie and it can, and often will, be readily dismissed by a potential hacker as unrelated to your authentication. You could also simply use the [hash()](/hash) algorithm, but this is less likely to confuse a potential hacker than making the cookie appear to be unrelated to your site: + + __#hash( 'some_cookie_name', 'SHA-256', 'UTF-8', 25 )# + +### Session timeout + +If a user is idle for a period of time, then we want to invalidate that user's session and force them to login again to help ensure our session management remains secure. This is a best practice you should not avoid... else you open yourself up to another vector of attack where a MITM attacker could hijack a user's session and begin attacking your application as an authenticated user. For this reason, we will set a timeout value in the *application* scope of your *Application.cfc*, as follows: + + // set number of minutes before a session is timed out + application.timeoutMinutes = 30; // 30 minutes + +Depending on the application, you will want to adjust the timeout value to a number of minutes equivalent to the longest process within your application. For example, if you have long forms in your application that could take the user 20 minutes to fill out completely before posting the form, then you will want to allow for that time between requests to avoid the user submitting the form and being immediately timed out for inactivity. + +### Session storage + +In our examples here we will be using the cache functions of CFML to store a session object (bean) for each logged in user to our system. This is arbitrary and you could just as easily use a database, in-memory database, virtual file system (e.g. RAM://), or flat file storage with XML or JSON - or some combination thereof, for example. + +We have found, through trial and error, that using the cache functions is fast and allows us to use distributed caching in large enterprise applications without sticky sessions to maintain the session across clusters, and is our preferred way of storing session data. + +### Session management in onRequestStart() + +We'll put our session management code in the *onRequestStart()* method of our Application.cfc so that we can capture and manage the session for each request made of our application. If you're using an MVC framework, like fw/1 or ColdBox, for example, you can use the equivalent onRequestStart() method to inject a controller or interceptor to handle session management for you, otherwise you can build your session management directly into the onRequestStart() method. For our example here we will be using a *security.cfc* controller in fw/1 to manage the sessions, coupled with a *SecurityService.cfc* service. + +The first thing we'll need to do is to ensure that we're **not** triggering session management for the login or authentication parts of our application. We do this so that we do not end up in an endless loop where the user can never actually authenticate because the session management code triggers a redirect to the login page if certain conditions are not met. I typically do this using an array of 'views' to **exclude** from session management, as follows: + + var actionArr = [ 'main.login', 'main.authenticate' ]; + + // check if we're already logging in + if ( !arrayFind( actionArr, rc.action )) { + +In this example we're using fw/1's *rc.action* variable to determine if we're in the login or authentication views. If we are not in either of those views, then we proceed to check if our session cookie is present, as follows: + + // we're not, check if the session cookie is defined + if ( !structKeyExists( cookie, application.cookieName ) ) { + // it isn't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = "msg=501" ); + } + +In the above code, we check if our *application.cookieName* variable is defined in the COOKIE scope by using the [structKeyExists()](/structkeyexists) function. If the cookie is **not** defined, then we redirect the user to the login page, passing some parameter we can use to provide a message to the user about why they have to authenticate (session expired, etc.). Again, we're using fw/1 in this example, but you could also simply check for the existence of the cookie and then use [cflocation](/cflocation) to redirect the user to the login page. + +When we [authenticated](/security-authentication) our user, we set an [encrypted](/encrypt) cookie value to store the users session id. Once we have checked for the existence of the cookie, we will then attempt to [decrypt()](/decrypt) the cookie's value using a [try](/cftry)/[catch](/cfcatch) block, as follows: + + // try + try { + // decrypt the cookie + rc.sessionId = application.securityService.getSessionIdFromCookie( cookie[ application.cookieName ] ); + // catch any decryption errors + } catch ( any e ) { + // decryption failed (invalid cookie value), redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = "msg=501" ); + } + +In the above code we're using a function from another CFC called SecurityService to decrypt the session id from the cookie. If that function fails to decrypt the value of the passed in cookie, then the value is invalid and we once again redirect the user to our login page. The *getSessionIdFromCookie()* function has the following code: + + public string function getSessionIdFromCookie( required string cookieId ) { + var sessionId = dataDec( arguments.cookieId, 'cookie' ); + return sessionId; + } + +As you can see, we're simply using the dataDec() function from the same SecurityService CFC to decrypt the value of the cookie using the encryption key and algorithm assigned to the cookie scope. Again, if you've not read our previous guides then this function may seem obscure to you, so we recommend reading those guides for a complete understanding of what we're doing here and why. + +Once we have successfully decrypted the users cookie, we then check to see if the users session is valid. In our example we are once again using a function from the SecurityService CFC to ensure that the users session is in our session management storage (in this case, the cache - but could just as easily be using database, XML, JSON, etc. storage mechanisms), and that the session has not (or should not be) timed out for inactivity, as follows: + + // lock the session and get the sessionObj from the cache + lock scope='session' timeout='10' { + session.sessionObj = application.securityService.checkUserSession( rc.sessionId ); + } + +Our *checkUserSession()* function has the following code: + + public any function checkUserSession( required string sessionId ) { + // get the session object from the cache + var sessionObj = cacheGet( uberHash( arguments.sessionId, 'MD5', 3000 ) ); + // ensure it is still in the cache + if ( isNull( sessionObj ) ) { + // it isn't, return an empty session object + return createObject( 'component', 'model.beans.Session').init(); + // otherwise, ensure the session shouldn't have already expired (30 mins) + } else if ( dateDiff('n', sessionObj.getLastActionAt(), now() ) >= application.timeoutMinutes ) { + // it should have expired, return an empty session object + return createObject( 'component', 'model.beans.Session').init(); + // otherwise + } else { + // session is valid, return the session object + return sessionObj; + } + } + +Here we are first checking if the session object exists in our cache. If it does **not** exist, then we return an empty bean which we will check after returning from this function. We then compare the last action of the user as stored in the session object with the timeout we specified in our application scope. If the users last action timespan is longer than the session timeout specified, then we again return an empty bean. Otherwise, the user has a valid session object and we return the populated bean we have stored in our cache. Again, this storage mechanism is arbitrary and could be any other storage mechanism - for speed and for distributed caching capabilities, however, we feel that using the cache functions is the most appropriate method of handling user sessions and recommend using it. + +Now that we have a session object (bean) to check, we have to see if the user id returned is valid (any non-zero value) or invalid (a zero value), as follows: + + // check if the sessionObj returned is valid + if ( session.sessionObj.getUserId() == 0 ) { + // it isn't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = "msg=502" ); + } + +In the above code we check if the user id is zero, which is specified as the default value in our bean's init() method upon creation. If it *is* zero, then the user does not have a valid session and is redirected back to the login page. If the user is a non-zero value, then we know we now have a valid session and can proceed to operate on that session object to a) rotate the users session and b) update the users session with the last action datetime, as follows: + + // lock the session and rotate the session id (for every request) + lock scope='session' timeout='10' { + session.sessionObj = application.securityService.rotateUserSession( session.sessionObj ); + } + + // update session's last action datetime and save session + lock scope='session' timeout='10' { + session.sessionObj = application.securityService.updateUserSession( session.sessionObj ); + } + +We've split this process into two parts - one to rotate the users session id, with our *rotateUserSession()* function of the SecurityService CFC, which has the following code: + + public any function rotateUserSession( required any sessionObj ) { + arguments.sessionObj.setSessionId( getSessionId() ); + return arguments.sessionObj; + } + +This function sets a new session id into our session object (bean) using the *getSessionId()* function of the SecurityService CFC, which has the following code: + + public string function getSessionId() { + var sessionId = uberHash( createUUID() & now(), 'SHA-384', 2000 ); + return sessionId; + } + +We then update the session's last action and save the session back into the cache with the *updateUserSession()* function of the SecurityService CFC, which has the following code: + + public any function updateUserSession( required any sessionObj ) { + clearUserSession( arguments.sessionObj ); + arguments.sessionObj.setLastActionAt( now() ); + setUserSession( arguments.sessionObj ); + return arguments.sessionObj; + } + +This code first clears any existing session object from the cache, then updates the session object's (bean's) last action datetime, saves the user's session object (bean) back to the cache and returns the updated session object. + +We split this into two parts because session rotation can be tricky in some applications. For example, using the browsers 'back' function can (and will) cause the cookie being sent from the browser to be the formerly assigned cookie value which is no longer valid. For this reason and for some applications we simply comment out, or leave out completely, the session rotation. + +Finally, we re-set the users cookie value with the new (rotated) and encrypted session id, as follows: + + // send a new cookie with the new encrypted session id + getPageContext().getResponse().addHeader("Set-Cookie", "#application.cookieName#=#application.securityService.setSessionIdForCookie( session.sessionObj.getSessionId() )#;path=/;domain=#listFirst( CGI.HTTP_HOST, ':' )#;HTTPOnly"); + +The above code uses the *setSessionIdForCookie()* function of the SecurityService CFC, which has the following code: + + public string function setSessionIdForCookie( required string sessionId ) { + var cookieId = dataEnc( arguments.sessionId, 'cookie' ); + return cookieId; + } + +In the above code we encrypt the cookie's value (the session id) using the key and algorithm for the cookie scope. If we put this all together we now have the following session management code: + + var actionArr = [ 'main.login', 'main.authenticate' ]; + + // check if we're already logging in + if ( !arrayFind( actionArr, rc.action )) { + + // we're not, check if the session cookie is defined + if ( !structKeyExists( cookie, application.cookieName ) ) { + // it isn't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = "msg=501" ); + } + + // try + try { + // decrypt the cookie + rc.sessionId = application.securityService.getSessionIdFromCookie( cookie[ application.cookieName ] ); + // catch any decryption errors + } catch ( any e ) { + // decryption failed (invalid cookie value), redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = "msg=501" ); + } + + // lock the session and get the sessionObj from the cache + lock scope='session' timeout='10' { + session.sessionObj = application.securityService.checkUserSession( rc.sessionId ); + } + + // check if the sessionObj returned is valid + if ( session.sessionObj.getUserId() == 0 ) { + // it isn't, redirect to the login page + variables.fw.redirect( action = 'main.login', queryString = "msg=502" ); + } + + // lock the session and rotate the session id (for every request) + lock scope='session' timeout='10' { + session.sessionObj = application.securityService.rotateUserSession( session.sessionObj ); + } + + // update session's last action datetime and save session + lock scope='session' timeout='10' { + session.sessionObj = application.securityService.updateUserSession( session.sessionObj ); + } + + // send a new cookie with the new encrypted session id + getPageContext().getResponse().addHeader("Set-Cookie", "#application.cookieName#=#application.securityService.setSessionIdForCookie( session.sessionObj.getSessionId() )#;path=/;domain=#listFirst( CGI.HTTP_HOST, ':' )#;HTTPOnly"); + + } + +All of these concepts can be found in convenient functions in my [SecurityService.cfc](https://bit.ly/1IkY5zK) service and [security.cfc](https://bit.ly/1XhnGPG) controller, which are part of a larger example of using these and other security techniques to create a [secure](https://bit.ly/1Msdwkt), or [two-factor](https://bit.ly/1Yx4hGt), [framework one (FW/1)](https://bit.ly/22lB2eu) application. diff --git a/docs/guides/security.md b/docs/guides/security.md new file mode 100644 index 000000000..04842d0d9 --- /dev/null +++ b/docs/guides/security.md @@ -0,0 +1,85 @@ +# ColdFusion Security Guide + +Safeguarding your applications and data from attack requires addressing several important factors including server security, network security and code security. + +This document will outline some of the basics of each, and link to further information. + +## Server Security + +Entire books have been written about server security and will generally include topics covering everything from the physical security of your server (e.g. can someone walk right up and take it) to common sense protections you should take to harden your server and the application software using it. For our purposes, we're going to focus on hardening your Adobe ColdFusion server(s) using the handy lock-down guides: + +[ColdFusion 9 Lockdown Guide (PDF)](https://www.adobe.com/content/dam/cc/us/en/products/coldfusion/pdfs/white-papers/91025512-cf9-lockdownguide-wp-ue.pdf) + +[ColdFusion 10 Lockdown Guide (PDF)](https://web.archive.org/web/20220228041500/www.adobe.com/content/dam/acom/en/products/coldfusion/pdfs/cf10/cf10-lockdown-guide.pdf) + +[ColdFusion 11 Lockdown Guide (PDF)](https://web.archive.org/web/20220227161443/www.adobe.com/content/dam/acom/en/products/coldfusion/pdfs/cf11/cf11-lockdown-guide.pdf) + +[ColdFusion 2016 Lockdown Guide (PDF)](https://web.archive.org/web/20220227161327/wwwimages.adobe.com/content/dam/acom/en/products/coldfusion/pdfs/coldfusion-2016-lockdown-guide.pdf) + +[ColdFusion 2018 Lockdown Guide (PDF)](https://www.adobe.com/content/dam/cc/us/en/products/coldfusion/pdfs/cf-starter-kits/coldfusion-2018-lockdown-guide.pdf) + +[ColdFusion 2021 Lockdown Guide (PDF)](https://www.adobe.com/content/dam/cc/us/en/products/coldfusion/pdfs/cf-starter-kits/coldfusion-2021-lockdown-guide-1.1.pdf) + +[ColdFusion 2023 Lockdown Guide (PDF)](https://www.adobe.com/content/dam/cc/us/en/products/coldfusion/pdfs/cf-starter-kits/coldfusion-2023-lockdown-guide-1.1.pdf) + +There has been some attempt made at putting together a Lucee lockdown guide, but it is incomplete. A Google search for 'Lucee lockdown guide' provides useful links to blog posts and the following start to a guide: + +[Lucee Lockdown Guide (HTML)](https://bit.ly/2imMVTF) + +These lockdown guides will give you an excellent head start on protecting your servers, your application servers and your network, and those tasks while not (yet) explicitly called out in Lucee documentation, certainly all apply to Lucee equally. I suggest using the most recent Adobe lockdown guide as your basis for what to also apply to your Lucee servers, Adobe specific nuances aside, of course. + +## ColdFusion Version Security + +It is important to note that end of life versions of Adobe ColdFusion, and all Railo server versions, have inherent security flaws that are not and will not be addressed. These weaknesses can be, and very often are, primary attack vectors for exploitation of those insecure systems. + +If you are running Adobe ColdFusion versions prior to 2021 (e.g. CF2018, 2016, 11, 10, etc.), or any version of Railo, then you are currently **at high risk** of being attacked and should consider upgrading your version of Adobe to the latest version, or if you are using Railo to migrate to Lucee. + +It is also important to note that Adobe, and Lucee, regularly release security patches for those application servers and you should regularly ensure that your server is on the latest security point release to avoid being the target of potential hackers. Likewise, much of the underlying infrastructure of these application servers, including Java, Tomcat, Apache, nginx, etc. also have security releases and it is important to keep these underlying services up to date with the latest security point release. + +You can use tools such as [HackMyCF's ColdFusion server security scanner](https://foundeo.com/hack-my-cf/) to continuously monitor the version of ColdFusion, Lucee, Tomcat and Java that you are running to make sure it is up to date with the latest security patches. + +## Network Security + +Again, entire books exist that go in depth with securing your network. For most CFML DevOps, this usually means ensuring you have hardened your server (using much of the same steps already outlined in the lockdown guides) to include your web server, application server (JRun, Tomcat, Jetty, etc.) and your database. Ensuring these application servers are consistently patched and configured to be the least granting of access is essential. + +Layered security approaches work the best for network security, so having both a hardware firewall and intrusion detection system, and using the software based firewall that comes with your operating system is recommended. Limit access from the external network to your server only on the ports that need to be open. This is typically port 80 for http and port 443 for https. All other external ports should be blocked. If you need access to ssh, ftp or rdp ports, then you should use other methods such as IP allow listing, VPNs, etc. + +Layering anti-virus, anti-malware and/or intrusion detection software should also be considered and implemented to ensure your systems are not infected or hijacked by rogue viruses and other malware. + +## Code Security + +Code security is an often overlooked and frequently misunderstood concept for many ColdFusion developers. It has either never come up for many, or they simply ignore possible security threats believing a breach will never happen to them. However, code security really is your first line of defense online – without it your web site or application could be hacked, data could be disclosed or outright destroyed. An attack from a random script kiddie trying to pwn as many systems as he could would be your best case scenario, an actual focused attacker trying to steal your data or use your application to hack further into your operating system, to get at your finance departments data, or your research departments data, etc. as a worst case scenario. + +You can use third party tools such as [Fixinator's ColdFusion code security scanner](https://fixinator.app/) to find vulnerabilities in your code or hire a [ColdFusion security consultant](https://foundeo.com/consulting/coldfusion/) to conduct a review of your code. + +### Web Application Firewalls + +Also known as WAF's a _Web Application Firewall_ can provide a basic level of protection from several vulnerabilities without requiring any code changes. A WAF can be especially useful in legacy applications that take a long time to find and fix security issues in. + +Here are some popular WAFs for use with CFML: + +- [FuseGuard by Foundeo](https://foundeo.com/security/) - commercial product, written in CFML, runs from your `Application.cfc` +- dotDefender by Applicure - commercial product, runs at the web server (IIS) level. +- CloudFlare + +### OWASP + +The [Online Web Application Security Project](https://owasp.org/) is the go-to resource for all things related to web application security - from threat assessments to tools, tips and techniques on how to avoid security pitfalls, this is the place to be and should be on your reference list. [OWASP Top 10 Security Threats](https://owasp.org/www-project-top-ten/) is an excellent place to start exploring. OWASP also publishes cheat sheets on a wide variety of web application security topics. + +### Encryption + +Encryption is the technology that allows us to take plain text messages and make them unreadable by both humans and other machines that do not have access to the encryption key used to [encrypt()](/encrypt) the data. + +[Click Here](/security-encryption) to learn how encrypting your data will help protect you from both parameter tampering and information disclosure. + +### Authentication + +Authentication is the process by which you validate that a particular user is allowed to login to your application. This should not be confused with *access control*, which determines what parts of your application a user has access to. Authentication is merely the process of ensuring a user can login. + +[Click Here](/security-authentication) to learn how authentication can be used to provide logins for your users to your application. + +### Session Management + +Session management is the process by which you ensure that a logged in user maintains a valid session throughout the session lifecycle and is used to ensure that your user has not timed out or has not had their session hijacked by a potential hacker. + +[Click Here](/security-session-management) to learn how to build your own session management routines to maintain sessions for your logged in users. diff --git a/docs/guides/server-scope.md b/docs/guides/server-scope.md new file mode 100644 index 000000000..ab204a976 --- /dev/null +++ b/docs/guides/server-scope.md @@ -0,0 +1,42 @@ +# Server Scope + +The `server` [scope](/scopes) can hold variables that exist, and are accessible to all applications on the server. + +## Built-in Server Scope Variables + +### `server.coldfusion` + +A struct containing several keys such as `productversion` `productname` `rootdir` `updatelevel` + +This is populated on both ACF and Lucee, `productname` is `Lucee` or `ColdFusion`. + +### `server.os` + +A struct containing info about the operating system: + +* `server.os.name` - The OS Name, e.g. `UNIX` `Mac OS X` `Windows` +* `server.os.version` - The OS Version +* `server.os.arch` - The CPU architecture, e.g. `amd64` +* `server.os.additionalinformation` - Additional OS info, e.g. `'Linux` + +### `server.system.environment` + +Lucee5+ CF2018+ A struct containing environment variables. + +### `server.system.properties` + +Lucee5+ CF2018+ A struct containing Java system properties. + +### `server.lucee` + +Lucee4.5+ Info specific to Lucee, e.g. `server.lucee.version` - useful for checking if you are running on Lucee: + +```cfml +if ( server.keyExists("lucee") ) { + //you are on Lucee +} +``` + +### `server.separator` + +Lucee4.5+ a struct with keys `file` `line` and `path` for OS specific/preferred separators. diff --git a/docs/guides/strings.md b/docs/guides/strings.md new file mode 100644 index 000000000..b62c28776 --- /dev/null +++ b/docs/guides/strings.md @@ -0,0 +1,27 @@ +# Strings + +## Slicing / Sub-strings via array notation + +CF2018 added support to slice `arrays`, allowing you to extract element from the array depending on a start and stop position, with an optional step value. + +CF2018 Update 5 extended this functionality to `strings`. + +You can now reference a sub-string via array notation with positional ranges (beginning at 1). + + string[start:stop:step] + +You can use this like + + myString = "This is my string. I love CFDocs!"; + writeOutput(myString[1]); // Returns T // First character from start of string. + writeOutput(myString[-1]); // Returns ! // First character from end of string. + writeOutput(myString[20:28]); // Returns I love CF + writeOutput(myString[20:50]); // Returns Error : Cannot access array element at position 50. -- This will not wrap. + writeOutput(myString[-20,-10]); // Returns ring. I lov + writeOutput(myString[1,-10]); // Returns This is my string. I lov + writeOutput(myString[1:]); // Returns This is my string. I love CFDocs! // Full string from position 1 to end. + writeOutput(myString[:10]); // Returns This is my // String from position 1 to position 10. + writeOutput(myString[5:25:5]); // Returns yiI // Every 5th character from position 5 to 25. + writeOutput(myString[::2]); // Returns Ti sm tig oeCDc! // Every other character in the string. + +_**Note:** The `start` value must occur **before** the `stop` value within the string._ diff --git a/docs/guides/system-properties.md b/docs/guides/system-properties.md new file mode 100644 index 000000000..16867dc3b --- /dev/null +++ b/docs/guides/system-properties.md @@ -0,0 +1,76 @@ +# ColdFusion Java System Properties + +There are several ColdFusion Java System properties that have been created for various reasons. Usually they exist to work around bugs that were fixed but then cause a backwards compatibility change. + +## `-Dcoldfusion.udf.reuseTagInstances` + +This setting was added in CF2016+ to address issues: + +* Premature termination of the loop when invoking a UDF recursively while using `cfloop` to loop over a query that is defined as a var function local variable +* Incorrect struct modification issue when the `cfhttp` tag is using a struct that has been passed to it via the `cfthread` tag + +The ColdFusion 2016 [release notes](https://helpx.adobe.com/coldfusion/release-note/coldfusion-2016-release-notes.html) instruct you to set `-Dcoldfusion.udf.reuseTagInstances=false` if you see those issues. + +## `-Dhttps.protocols` + +Set this to restrict the SSL and or TLS protocols that will be used by tags such as `cfhttp`. The possible values are: SSLv3, TLSv1, TLSv1.1, TLSv1.2 and can be combined as a comma separated list. + +For CF10 update 18 and CF11+ [Read more](https://web.archive.org/web/20200927173340/www.trunkful.com/index.cfm/2014/12/8/Preventing-SSLv3-Fallback-in-ColdFusion) + +## `-Dcoldfusion.disablejsafe` + +Set this to `true` if you want to disable the RSA BSafe CryptoJ JCE (enterprise edition only), and use the default Oracle JCE (or another provider). + +## `-Dcoldfusion.jsafe.defaultalgo` + +The setting controls the default algorithm for random number generation in CF8+ Enterprise. It is set to `FIPS186Random` + +## `-Dcoldfusion.enablefipscrypto` + +Set this to `true` to disable algorithms that are not FIPS approved, such as DESX, RC5, and MD5PRNG. + +## `-Dcoldfusion.sessioncookie.httponly` + +Applies to CF9.0.1 only. When this setting is set to true your `CFID` and `CFTOKEN` cookies will have the `httponly` flag set. Does not apply to `JSESSIONID` cookies. + +For CF10+ Use `this.sessioncookie.httponly` setting in Application.cfc or ColdFusion Administrator. + +## `-Dcoldfusion.session.protectfixation` + +ColdFusion security hotfix APSB11-04 added protection from session fixation. When you set this setting to `false` it disables the session fixation protection. Please [read about session fixation](https://www.petefreitag.com/item/815.cfm) before changing this setting. + +## `-Dcoldfusion.fckupload` + +ColdFusion 8 security hotfix hf801-77218 added this setting to block any request to `/fckeditor/editor/filemanager/` unless this setting is set to `true`. [Read more](https://www.petefreitag.com/item/718.cfm). + +## `-Dcoldfusion.ignoredbvarname` + +Introduced with ColdFusion 11 Update 4. Used to disable the `dbvarname` attribute in the `cfprocparam` tag. This attribute was deprecated with ColdFusion MX and subsequently reintroduced with ColdFusion 11 Update 3. See [bug 3919479](https://tracker.adobe.com/#/view/CF-3919479) for further details. + +## `-Dcoldfusion.application.recur_resolve.include` + +Introduced with ColdFusion 2018. When set to `true`, `cfinclude` inside Application.cfc will correctly resolve paths relative from the included file. By default, Application.cfc is unable to resolve nested `cfinclude`s from outside the directory where the file resides. + +## `-Dcoldfusion.query.filter.mutateinputquery` + +Introduced with ColdFusion 2021. It defaults to `false` but when set to `true` the `queryFilter` function will mutate the input query as it did in ColdFusion 2016 and 2018. See [bug 4203366](https://tracker.adobe.com/#/view/CF-4203366) for further details. + +## `-Dcoldfusion.datemask.useDasdayofmonth` + +Introduced with ColdFusion 2021 Update 1. It defaults to `false` but when set to `true` and the mask contains `D` (uppercase D), the mask treats the value as `d` (lowercase d), day of the month. Hence, `dateformat(now(), "mm-D-yyyy")` is the same as `dateformat(now(), "mm-d-yyyy")` when flag is set to `true`. See [Adobe article](https://helpx.adobe.com/coldfusion/kb/dateformat-function-coldfusion-2021.html) for more details. + +## `-Dcoldfusion.searchimplicitscopes` + +Introduced in March 2024 via ColdFusion 2021 Update 13 and ColdFusion 2023 Update 7, and on these versions defaults to `false`. When set to `true` unscoped variable resolution will traverse through all the implicit scopes such as `form`, `url`, `cgi`, `cookie`, when `false` the scope needs to be specified. This change was introduced as part of a security hotfix: [APSB24-14](https://helpx.adobe.com/security/products/coldfusion/apsb24-14.html) and Adobe recommends keeping it to `false`. More [info about searchImplicitScopes here](https://www.petefreitag.com/blog/cf-searchimplicitscopes/) + +## `-Dcoldfusion.encryption.useCFMX_COMPATAsDefault` + +Added in June 2024 via ColdFusion 2021 Update 14 and CF2023 update 8. Defaults to `false`, when `true` it uses `CFMX_COMPAT` as the default algorithm for the `encrypt()` `decrypt()` and `hash()` (uses MD5) functions. + +# Standard Java System Properties + +The following system properties apply to the java runtime: + +* [Java Networking System Properties](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/doc-files/net-properties.html) +* [Java Crypto Related System and Security Properties](https://www.java.com/en/configure_crypto.html) +* [Java System Property Reference Guide](https://system-properties.com/) diff --git a/docs/guides/testbox.md b/docs/guides/testbox.md new file mode 100644 index 000000000..3f792c323 --- /dev/null +++ b/docs/guides/testbox.md @@ -0,0 +1,122 @@ +# TestBox Quick Reference + +[TestBox](https://www.ortussolutions.com/products/testbox) is a framework for writing and running tests in CFML. It supports both BDD (Behavior Driven Development) and xUnit style test cases. For full documentation, checkout the [TestBox Book](https://testbox.ortusbooks.com/) + +## BDD Example Test Suite + + component extends="testbox.system.BaseSpec" { + function run() { + describe("A sweet suite", function() { + it("contains spec with an awesome expectation", function() { + expect( true ).toBeTrue(); + }); + }); + } + } + +## Expectation Reference + +See the [`testbox.system.Expectation`](https://apidocs.ortussolutions.com/testbox/current/index.html?testbox/system/Expectation.html) class for a full list of expectations. The `message` argument is optional in all cases. Here are some common expectations: + + //assert value==expected, not case-sensitive + expect(value).toBe(expected, message); + + //assert value==expected, case-sensitive + expect(value).toBeWithCase(expected, message); + + //assert value is true + expect(value).toBeTrue(message); + + //assert value is false + expect(value).toBeFalse(message); + + //assert string, array, struct, query is empty + expect(value).toBeEmpty(message); + + //assert value is null + expect(value).toBeNull(message); + + //assert struct has key, does not search nested structures + expect(value).toHaveKey(key, message); + + //assert struct has key, search nested structures + expect(value).toHaveDeepKey(key, message); + + //assert string, array, struct or query has a given length + expect(value).toHaveLength(length, message); + +Here are some more: + + //assert value is greater than target + expect(value).toBeGT(target, message); + + //assert value is greater than or equal to target + expect(value).toBeGTE(target, message); + + //assert value is less than target + expect(value).toBeLT(target, message); + + //assert value is less than or equal to target + expect(value).toBeLTE(target, message); + + //assert that the needle is included in string or array, not case-sensitive + expect(value).toInclude(needle, message); + + //assert that the needle is included in string or array, case-sensitive + expect(value).toIncludeWithCase(needle, message); + + //assert value between min and max + expect(value).toBeBetween(min, max, message); + + //assert that the value is within +/- a passed delta and optional datepart + expect(value).toBeCloseTo(expected, delta, datePart, message); + + //assert value is of CFML type using isValid function. + expect(value).toBeTypeOf(type, message); + + //assert value an instance of named object type. + expect(value).toBeInstanceOf(typeName, message); + + //assert value to match regex, not case-sensitive. + expect(value).toMatch(regex, message); + + //assert function throws exception, optionally specify type or regex. + expect( function(){ x=1/0; } ).toThrow(type, regex, message); + + // asset that value is a JSON string. + expect(value).toBeJSON(); + +You can prefix any of the expectations with `not`, to negate its meaning, for example + + expect(5).notToBe(6); + +You can also chain expectations: + + expect(5).notToBe(6).toBeGT(0).toBeLT(10); + +## xUnit Style Example Test + + component displayName="My Sweet Suite" extends="testbox.system.BaseSpec" { + function testSomething() { + var something = true; + $assert.isTrue(something); + $assert.notIsEmpty(something); + } + } + +See the [`testbox.system.Assertion`](https://apidocs.ortussolutions.com/testbox/current/index.html?testbox/system/Assertion.html) class for a full list of Assertions. Here are some common assertions, the `message` argument is optional. + + //assert that value is true + $assert.isTrue(value, message); + + //assert that value is false + $assert.isFalse(value, message); + + //assert that expected is equal actual, no case is required. + $assert.isEqual(expected, actual, message); + + //assert that the struct has the given key + $assert.key(struct, key, message); + + //assert the length of a string, array, structure or query + $assert.lengthOf(object, length, message); diff --git a/docs/guides/variables-scope.md b/docs/guides/variables-scope.md new file mode 100644 index 000000000..8350a353f --- /dev/null +++ b/docs/guides/variables-scope.md @@ -0,0 +1,45 @@ +# Variables Scope + +The `VARIABLES` scope is the default scope in ColdFusion. i.e. if a variable is declared in .cfm and .cfc file without explicitly prefixing a scope, or without 'var' to a variable inside a function, ColdFusion assigns VARIABLES scope to that variable. + +### EXAMPLE + +`` is same as `` + +### CF Script EXAMPLE + +```cfml +myVariable = ""; +/* is same as */ +variables.myVariable = ""; +``` + +Similarly, variable declared in `VARIABLES` scope can be referenced without explicitly prefixing the `VARIABLES` scope. + +### EXAMPLE + +```cfml + + +#myVariable# + +#variables.myVariable# +``` + +### CF Script EXAMPLE + +```cfml +myVariable = ""; + +writeOutput(myVariable); +/* is same as */ +writeOutput(variables.myVariable); +``` + +Variables declared in `VARIABLES` scope are accessible only within that .cfm or .cfc file. + +Variables declared in `VARIABLES` scope in a .cfc file are accessible to all functions within the .cfc file. If the variable value is modified in one function, all other functions get the newly updated value. + +Variables declared in `VARIABLES` scope in a .cfc file are **not** accessible from outside the component. + +Adobe `VARIABLES` scope Documentation: https://helpx.adobe.com/coldfusion/cfml-reference/reserved-words-and-variables/scope-specific-built-in-variables/variable-scope.html diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 000000000..f24b8eb34 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,78 @@ +# index + +## categories + +- All CFML Functions [all](categories/all.md) +- Array Functions [array-functions](categories/array-functions.md) +- Cache Functions [cache-functions](categories/cache-functions.md) +- ColdFusion 10 New Functions and Tags [cf10](categories/cf10.md) +- ColdFusion 11 New Functions and Tags [cf11](categories/cf11.md) +- ColdFusion 2016 New Functions and Tags [cf2016](categories/cf2016.md) +- ColdFusion 2018 New Functions and Tags [cf2018](categories/cf2018.md) +- ColdFusion 2021 New Functions and Tags [cf2021](categories/cf2021.md) +- ColdFusion 2023 New Functions and Tags [cf2023](categories/cf2023.md) +- ColdFusion 4 New Functions and Tags [cf4](categories/cf4.md) +- ColdFusion 4.5 New Functions and Tags [cf45](categories/cf45.md) +- ColdFusion 5 New Functions and Tags [cf5](categories/cf5.md) +- ColdFusion 6 New Functions and Tags [cf6](categories/cf6.md) +- ColdFusion 7 New Functions and Tags [cf7](categories/cf7.md) +- ColdFusion 8 New Functions and Tags [cf8](categories/cf8.md) +- ColdFusion 9 New Functions and Tags [cf9](categories/cf9.md) +- Collection Functions [collection-functions](categories/collection-functions.md) +- Conversion Functions [conversion-functions](categories/conversion-functions.md) +- Database Tags [database-tags](categories/database-tags.md) +- Date and Time Functions [date-and-time-functions](categories/date-and-time-functions.md) +- Decision Functions [decision-functions](categories/decision-functions.md) +- Filesystem Functions [filesystem-functions](categories/filesystem-functions.md) +- Formatting Functions [formatting-functions](categories/formatting-functions.md) +- All CFML Functions [functions](categories/functions.md) +- All CFML Guides [guides](categories/guides.md) +- Image Manipulation Functions [image-functions](categories/image-functions.md) +- List Functions [list-functions](categories/list-functions.md) +- Lucee 5 New Functions and Tags [lucee5](categories/lucee5.md) +- Lucee 6 New Functions and Tags [lucee6](categories/lucee6.md) +- Math Functions [math-functions](categories/math-functions.md) +- ORM Functions [orm-functions](categories/orm-functions.md) +- Network Protocol Tags [protocol-tags](categories/protocol-tags.md) +- Query Manipulation Functions [query-functions](categories/query-functions.md) +- Security Functions [security-functions](categories/security-functions.md) +- Spreadsheet Manipulation Functions [spreadsheet-functions](categories/spreadsheet-functions.md) +- String Functions [string-functions](categories/string-functions.md) +- Structure Functions [struct-functions](categories/struct-functions.md) +- System Tags [system-tags](categories/system-tags.md) +- All CFML Tags [tags](categories/tags.md) +- UI Tags [ui-tags](categories/ui-tags.md) + +## guides + +- Adobe ColdFusion only [acf-only](./guides/acf-only.md) +- Application.cfc [application](./guides/application.md) +- CFSqlType Cheatsheet [cfsqltype-cheatsheet](./guides/cfsqltype-cheatsheet.md) +- CGI Scope [cgi-scope](./guides/cgi-scope.md) +- ColdFusion Closures [closures](./guides/closures.md) +- ColdFusion Versions [coldfusion-versions](./guides/coldfusion-versions.md) +- Date Time Cheatsheet [datetime](./guides/datetime.md) +- Deprecated [deprecated](./guides/deprecated.md) +- Discouraged [discouraged](./guides/discouraged.md) +- Elvis Operator [elvis](./guides/elvis.md) +- Error handling [error-handling](./guides/error-handling.md) +- Built in ColdFusion Functions as First Class Citizens [first_class](./guides/first_class.md) +- For Loops in CFML / CFScript [for](./guides/for.md) +- Java Integration Guide [java](./guides/java.md) +- Lucee only [lucee-only](./guides/lucee-only.md) +- ColdFusion Member Functions [member](./guides/member.md) +- New operator [new](./guides/new.md) +- Operators in CFML [operators](./guides/operators.md) +- ORM Settings Struct [ormsettings](./guides/ormsettings.md) +- Scopes [scopes](./guides/scopes.md) +- CFScript Syntax Guide [script](./guides/script.md) +- ColdFusion Security Guide [security](./guides/security.md) +- Authentication Guide [security-authentication](./guides/security-authentication.md) +- Encryption Guide [security-encryption](./guides/security-encryption.md) +- Obfuscation Guide [security-obfuscation](./guides/security-obfuscation.md) +- Session Management Guide [security-session-management](./guides/security-session-management.md) +- Server Scope [server-scope](./guides/server-scope.md) +- Strings [strings](./guides/strings.md) +- ColdFusion Java System Properties [system-properties](./guides/system-properties.md) +- TestBox Quick Reference [testbox](./guides/testbox.md) +- Variables Scope [variables-scope](./guides/variables-scope.md) diff --git a/docs/tags/cf_socialplugin.md b/docs/tags/cf_socialplugin.md new file mode 100644 index 000000000..a73d56c58 --- /dev/null +++ b/docs/tags/cf_socialplugin.md @@ -0,0 +1,154 @@ +# cf_socialplugin + +Dynamically generate social elements for Facebook, Google +, Twitter. + +The supported widgets are: + +Like button +Tweet button +Facebook comment box +Google Plus button +Facebook subscribe button +Like box +Activity feed +Follow + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cf_socialplugin(.. /); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| type | string | Yes | | | /Users/garethedwards/development/github/cfdocs/docs/tags/cf_socialplugin.md|tweet | +| colorscheme | string | No | | | /Users/garethedwards/development/github/cfdocs/docs/tags/cf_socialplugin.md|dark | + +## Like Button + +```html + +``` + +## LikeBox Button + +```html + +``` + +## ActivityFeed + +```html + +``` + +## Follow Button + +```html + +``` + +## PlusOne Button + +```html + +``` + +## Comment Box + +```html + +``` + +## Subscribe Button + +```html + +``` + +## Tweet Button + +```html + +``` diff --git a/docs/tags/cfabort.md b/docs/tags/cfabort.md new file mode 100644 index 000000000..a1a0a88d5 --- /dev/null +++ b/docs/tags/cfabort.md @@ -0,0 +1,64 @@ +# cfabort + +Stops the processing of a CFML page at the tag location. + CFML returns everything that was processed before the + tag. The tag is often used with conditional logic to stop + processing a page when a condition occurs. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +abort; +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| showerror | string | No | | Error to display, in a standard CFML error page,
when tag executes | +| attributecollection | string | No | | You can specify this tag's attributes in an attributeCollection whose value is a
structure. Specify the structure name in the attributeCollection and use the tag‚
attribute names as structure keys. | + +## Example of using abort() to stop processing after an error occurs + +In this example we demonstrate using the abort() function to stop any further processing after we deliberately call a non-existent function. + +```html +try { + // make a call to a non-existent function + firstName = userService.getUserById( 1 ).getFirstName(); +// catch any errors +} catch ( any e ) { + // dump the error to the browser + writeDump( e ); + // abort further processing + abort; +} +``` + +### Expected Result: Error page: Variable USERSERVICE is undefined. + +## Example of using to stop processing after an error occurs + +In this example we demonstrate using the tag to stop any further processing after we deliberately call a non-existent function. + +```html + + + + + + + + + + + +``` + +### Expected Result: Error page: Variable USERSERVICE is undefined. diff --git a/docs/tags/cfadmin.md b/docs/tags/cfadmin.md new file mode 100644 index 000000000..98eeba974 --- /dev/null +++ b/docs/tags/cfadmin.md @@ -0,0 +1,1355 @@ +# cfadmin + +Used internally by Lucee (and Railo) in the administrator to apply settings. This tag is considered undocumented / subject to change. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfadmin(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | The administrative action to perform. | +| type | string | Yes | | The admin context: `web` or `server` | +| password | string | Yes | | The admin password. | + +## Create an admin collection + +```html + +``` + +## Delete an admin collection + +```html + +``` + +## Optimize an admin collection + +```html + +``` + +## Repair an admin collection + +```html + +``` + +## Compile an admin collection + +```html + +``` + +## Connect to admin + +```html + +``` + +## Create an archive + +```html + +``` + +## Create a security manager connection + +```html + +``` + +## Set the default Security Manager + +```html + +``` + +## Execute the spooler task + +```html + +``` + +## Get the application listener + +```html + +``` + +## Get the application settings + +```html + +``` + +## Get the admin char set + +```html + +``` + +## Get the Component admin + +```html + +``` + +## Get an admin contextes + +```html + +``` + +## Get the custom tag mappings + +```html + +``` + +## Get the custom tag setting + +```html + +``` + +## Get the datasource + +```html + +``` + +## Get the datasource drivers available + +```html + +``` + +## Get the datasource settings + +```html + +``` + +## Get Debug + +```html + +``` + +## Get Debug Data + +```html + +``` + +## Get Debugging List + +```html + +``` + +## Get the admin Default Password + +```html + +``` + +## Get the admin default security manager + +```html + +``` + +## Get Error + +```html + +``` + +## Get list of errors + +```html + +``` + +## Get the extension information + +```html + +``` + +## Get the exention providers + +```html + +``` + +## Get extensions + +```html + +``` + +## Get FLDs + +```html + +``` + +## Get JavaCFXTags + +```html + +``` + +## Get the admin locales + +```html + +``` + +## Get mail Servers + +```html + +``` + +## Get mail settings + +```html + +``` + +## Get the mappings + +```html + +``` + +## Get the output settings + +```html + +``` + +## Get the plugin directory + +```html + +``` + +## Get the proxy + +```html + +``` + +## Get regional + +```html + +``` + +## Get remote crunlient + +```html + +``` + +## Get remote clients + +```html + +``` + +## Get remote client usage + +```html + +``` + +## Get scope information + +```html + +``` + +## Get the security manager + +```html + +``` + +## Get the current spooler tasks + +```html + +``` + +## Get the server time zones + +```html + +``` + +## Get the TLDs + +```html + +``` + +## Get any current updates + +```html + +``` + +## Return if the context has a password + +```html + +``` + +## Purge the index + +```html + +``` + +## Update the index + +```html + +``` + +## Remove CFX extension + +```html + +``` + +## Remove a custom tag + +```html + +``` + +## Remove a datasource + +```html + +``` + +## Remove a default password + +```html + +``` + +## Remove an extension + +```html + +``` + +## Remove a mapping + +```html + +``` + +## Remove a proxy + +```html + +``` + +## Remove a remote client + +```html + +``` + +## Remove a security manager + +```html + +``` + +## Remove a spooler task + +```html + +``` + +## Remove an update + +```html + +``` + +## Reset an ID + +```html + +``` + +## Reset a password + +```html + +``` + +## Restart the server + +```html + +``` + +## Run an update + +```html + +``` + +## Delete a scheduled task + +```html + +``` + +## Pause a scheduled task + +```html + +``` + +## Resume a scheduled task + +```html + +``` + +## Run a scheduled task + +```html + +``` + +## Update a scheduled task + +```html + +``` + +## Security Manager access + +```html + +``` + +## Security Manager setting + +```html + +``` + +## Security Manager usage + +```html + +``` + +## Security Manager has access to custom tag + +```html + +``` + +## Security Manager has access to debugging + +```html + +``` + +## Security Manager has access to mail + +```html + +``` + +## Security Manager has access to mapping + +```html + +``` + +## Security Manager has access to remote + +```html + +``` + +## Security Manager has access to search + +```html + +``` + +## Security Manager has access to settings + +```html + +``` + +## Get storage + +```html + +``` + +## Set storage + +```html + +``` + +## Update the application listener + +```html + +``` + +## Update an application setting + +```html + +``` + +## Update a char set + +```html + +``` + +## Update a component + +```html + +``` + +## Update the custom tag info + +```html + +``` + +## Update the custom tag settings + +```html + +``` + +## Update the datasource + +```html + +``` + +## Update the debug settings + +```html + +``` + +## Update the default password + +```html + +``` + +## Update default security + +```html + +``` + +## Update default security manager + +```html + +``` + +## Update an error + +```html + +``` + +## Update an extension + +```html + +``` + +## Update JavaCFX + +```html + +``` + +## Update mail settings + +```html + +``` + +## Update a mapping + +```html + +``` + +## Update output settings + +```html + +``` + +## Update Password + +```html + +``` + +## Update Proxy + +```html + +``` + +## Update PSQ + +```html + +``` + +## Update regional settings + +```html + +``` + +## Update remote client + +```html + +``` + +## Update scope settings + +```html + +``` + +## Update updater settings + +```html + +``` + +## Verify a datasource + +```html + +``` + +## Verify a JavaCFX + +```html + +``` + +## Verify a mail server + +```html + +``` + +## Verify a remote client + +```html + +``` diff --git a/docs/tags/cfajaximport.md b/docs/tags/cfajaximport.md new file mode 100644 index 000000000..ad2958165 --- /dev/null +++ b/docs/tags/cfajaximport.md @@ -0,0 +1,25 @@ +# cfajaximport + +Controls the JavaScript files that are imported for use on pages that use ColdFusion AJAX + tags and features. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfajaximport(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| scriptsrc | string | No | | Specifies the URL, relative to the web root, of the
directory that contains the JavaScript files
used by ColdFusion. When you use this attribute,
the specified directory must have the same
structure as the /CFIDE/scripts directory. | +| csssrc | string | No | | Specifies the URL, relative to the web root, of the
directory that contains the CSS files used by
ColdFusion AJAX features, with the exception of
the rich text editor. This directory must have the
same directory structure, and contain the same
CSS files, and image files required by the CSS
files, as the
web_root/CFIDE/scripts/ajax/resources
directory.
This attribute lets you create different custom
styles for ColdFusion AJAX controls in different
applications. | +| tags | string | No | | A comma-delimited list of tags or tag-attribute
combinations for which to import the supporting
JavaScript files on this page. | +| attributecollection | string | No | | You can specify this tag's attributes in an attributeCollection whose value is a
structure. Specify the structure name in the attributeCollection and use the tag
attribute names as structure keys. | diff --git a/docs/tags/cfajaxproxy.md b/docs/tags/cfajaxproxy.md new file mode 100644 index 000000000..be7cacd32 --- /dev/null +++ b/docs/tags/cfajaxproxy.md @@ -0,0 +1,25 @@ +# cfajaxproxy + +Creates a JavaScript proxy for a ColdFusion component, for use in an AJAX client. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfajaxproxy(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| cfc | string | No | | The CFC for which to create a proxy. You must specify a dot-delimited path to the CFC.
The path can be absolute or relative to location of the CFML page.
For example, if the myCFC CFC is in the cfcs subdirectory of the ColdFusion page, specify cfcs.myCFC.
On UNIX based systems, the tag searches first for a file who's name or path corresponds to the specified name or path, but is in all lower case.
If it does not find it, ColdFusion then searches for a file name or path that corresponds to the attribute value exactly, with identical character casing. (required) | +| jsclassname | string | No | | The name to use for the JavaScript proxy class. (optional) | +| bind | string | No | | A bind expression that specifies a CFC method, JavaScript function, or URL to call. | +| onerror | string | No | | The name of a JavaScript function to invoke when a bind, specified by the bind attribute fails. The function must take two arguments: an error code and an error message. | +| onsuccess | string | No | | The name of a JavaScript function to invoke when a bind, specified by the bind attribute succeeds. The function must take one argument, the bind function return value. If the bind function is a CFC function, the return value is automatically converted to a JavaScript variable before being passed to the onSuccess function. | diff --git a/docs/tags/cfapplet.md b/docs/tags/cfapplet.md new file mode 100644 index 000000000..c33106b4e --- /dev/null +++ b/docs/tags/cfapplet.md @@ -0,0 +1,34 @@ +# cfapplet + +This tag references a registered custom Java applet. To + register a Java applet, in the CFML Administrator, click + Extensions/Java Applets. + Using this tag within a cfform tag is optional. If you use it + within cfform, and the method attribute is defined in the + Administrator, the return value is incorporated into the + form. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfapplet(appletsource="", name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| appletsource | string | Yes | | Name of registered applet | +| name | string | Yes | | Form variable name for applet | +| height | numeric | No | | Control's height, in pixels. | +| width | numeric | No | | Control's width, in pixels. | +| vspace | numeric | No | | Vertical margin above and below control, in pixels. | +| hspace | numeric | No | | Horizontal spacing to left and right of control, in pixels. | +| align | string | No | | Alignment | +| notsupported | string | No | Browser must support Java to
view ColdFusion Java Applets!
| Text to display if a page that contains a Java applet-based
cfform control is opened by a browser that does not
support Java or has Java support disabled. | diff --git a/docs/tags/cfapplication.md b/docs/tags/cfapplication.md new file mode 100644 index 000000000..2cb73200d --- /dev/null +++ b/docs/tags/cfapplication.md @@ -0,0 +1,33 @@ +# cfapplication + +Defines the scope of a CFML application and allows you to set various application specific settings. Consider using Application.cfc instead of Application.cfm files. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +component { /* Application.cfc */ this.name="myAppName"; } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | No | | Name of application. Up to 64 characters | +| loginstorage | string | No | cookie | cookie: store login information in the Cookie scope.
session: store login information in the Session scope. | +| clientmanagement | boolean | No | NO | enables client variables | +| clientstorage | string | No | registry | How client variables are stored
* datasource_name: in ODBC or native data source.
You must create storage repository in the
Administrator.
* registry: in the system registry.
* cookie: on client computer in a cookie. Scalable.
If client disables cookies in the browser, client
variables do not work | +| setclientcookies | boolean | No | YES | No: CFML does not automatically send CFID and CFTOKEN
cookies to client browser; you must manually code CFID and
CFTOKEN on the URL for every page that uses Session or
Client variables | +| sessionmanagement | boolean | No | NO | enables session variables | +| sessiontimeout | numeric | No | | Lifespan of session variables. CreateTimeSpan function and
values in days, hours, minutes, and seconds, separated by
commas | +| applicationtimeout | numeric | No | | Lifespan of application variables. CreateTimeSpan function
and values in days, hours, minutes, and seconds, separated
by commas. | +| setdomaincookies | boolean | No | NO | Yes: Sets CFID and CFTOKEN cookies for a domain (not a host)
Required, for applications running on clusters. | +| scriptprotect | string | No | | Specifies whether to protect variables from cross-site scripting attacks.
- none: do not protect variables
- all: protect Form, URL, CGI, and Cookie variables
- comma-delimited list of ColdFusion scopes: protect variables in the specified scopes | +| securejsonprefix | string | No | | The security prefix to put in front of the value that a ColdFusion function returns in JSON-format
in response to a remote call if the secureJSON setting is true. | +| securejson | boolean | No | | A Boolean value that specifies whether to add a security prefix in front of any value that a ColdFusion function returns in JSON-format
in response to a remote call. | +| serverSideFormValidation | boolean | No | | Enable/Disable ColdFusion‚ server side validation on CFFORM. | diff --git a/docs/tags/cfargument.md b/docs/tags/cfargument.md new file mode 100644 index 000000000..a9d4ba774 --- /dev/null +++ b/docs/tags/cfargument.md @@ -0,0 +1,49 @@ +# cfargument + +Creates a parameter definition within a component definition. Defines a function argument. Used within a cffunction tag. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +myFunction(required any myArgument){} +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | An argument name. | +| type | string | No | | a type name; data type of the argument. | +| required | boolean | No | no | Whether the parameter is required to execute the component method. | +| default | string | No | | If no argument is passed, specifies a default argument value. | +| displayname | string | No | | Meaningful only for CFC method parameters. A value to be displayed when using introspection to show information about the CFC. | +| hint | string | No | | Meaningful only for CFC method parameters. Text to be displayed when using introspection to show information about the CFC. The hint attribute value follows the displayname attribute value in the parameter description line. This attribute can be useful for describing the purpose of the parameter. | + +## Script Syntax + +For Script syntax the argument is inside the () + +```html +public boolean function myFunction(required any myArgument) { + // Some function bits + return true; +} +``` + +## Tag Syntax + +For Tag syntax the argument is its own tag + +```html + + + + + +``` diff --git a/docs/tags/cfassociate.md b/docs/tags/cfassociate.md new file mode 100644 index 000000000..4b5a45814 --- /dev/null +++ b/docs/tags/cfassociate.md @@ -0,0 +1,23 @@ +# cfassociate + +Allows subtag data to be saved with a base tag. Applies only + to custom tags. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfassociate(basetag=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| basetag | string | Yes | | Base tag name | +| datacollection | string | No | | Structure in which base tag stores subtag data | diff --git a/docs/tags/cfbreak.md b/docs/tags/cfbreak.md new file mode 100644 index 000000000..0b8eb380b --- /dev/null +++ b/docs/tags/cfbreak.md @@ -0,0 +1,45 @@ +# cfbreak + +Used within a cfloop tag. Breaks out of a loop. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +break; +``` + +## Break out of a for loop + +Example Using Script Syntax + +```html +for (i=1; i <= 10; i++){ + writeOutput("#i#
"); + if (i >= 5){ + break; + } +} +``` + +### Expected Result: 1 2 3 4 5 + +## Break out of a CFLoop + +Shows tag based syntax. + +```html + + #i#
+ + + +
+``` + +### Expected Result: 1 2 3 4 5 diff --git a/docs/tags/cfcache.md b/docs/tags/cfcache.md new file mode 100644 index 000000000..85cab6c2b --- /dev/null +++ b/docs/tags/cfcache.md @@ -0,0 +1,67 @@ +# cfcache + +Stores a copy of a page on the server and/or client computer, + to improve page rendering performance. To do this, the tag + creates temporary files that contain the static HTML returned + from a CFML page. + + Use this tag if it is not necessary to get dynamic content each + time a user accesses a page. + You can use this tag for simple URLs and for URLs that contain + URL parameters. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfcache(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | No | | * cache: server-side and client-side caching.
* flush: refresh cached page(s).
* clientcache: browser-side caching only. To cache a personalized page, use this option.
* servercache: server-side caching only. Not recommended.
* optimal: same as "cache". | +| directory | string | No | | Absolute path of cache directory. | +| timespan | numeric | No | | The interval until the page is flushed from the cache. | +| expireurl | string | No | | Used with action = "flush". A URL reference. CFML
matches it against the mappings in the specified cache
directory. Can include wildcards. For example:
"*/view.cfm?id=*". | +| username | string | No | | A username | +| password | string | No | | A password | +| port | numeric | No | | Remote port to which to connect | +| protocol | string | No | | Protocol that is used to create URL from cache. | +| value | string | No | | For action="set", object which needs to be stored | +| metadata | string | No | | Name of the struct variable | +| stripwhitespace | boolean | No | NO | Reduces whitespace | +| throwonerror | boolean | No | | A Boolean value specifying whether to throw an error if the
flush action encounters an error. Otherwise the action does not
generate an error if it fails. If this attribute is 'true' you can handle the
error in a cfcatch block, for example, if a specified id value is invalid | +| id | string | No | | Id of the cached object | +| key | string | No | | key to access cache | +| usecache | boolean | No | YES | to use cache or not (if false it will process the content each time) | +| dependson | string | No | | Comma separated list of all variables on which this cache would depend | +| idletime | numeric | No | | Flushes the cached item if it is not accessed for the specified time span. | +| cachedirectory | string | No | | Cache directory | +| name | string | No | | name of return variable, valid with action="get" | + +## Adding a page to the cache + +Puts HTML page into the cache and uses the cached version on subsequent calls to the page. + +```html + +
Hello World!
+
+``` + +### Expected Result:
Hello World!
+ +## Flushing a page from the cache + +Flushes the 'hello-world.cfm' page from the cache. + +```html + +``` diff --git a/docs/tags/cfcalendar.md b/docs/tags/cfcalendar.md new file mode 100644 index 000000000..fe6ab0e3b --- /dev/null +++ b/docs/tags/cfcalendar.md @@ -0,0 +1,40 @@ +# cfcalendar + +Puts an interactive Macromedia Flash format calendar in an HTML + or Flash form. Not supported in XML format forms. The calendar + lets a user select a date for submission as a form variable. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfcalendar(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The name of the calendar. | +| height | numeric | No | | The vertical dimension of the calendar specified in pixels. | +| width | numeric | No | | The horizontal dimension of the calendar specified in pixels. | +| selecteddate | string | No | | The date that is initially selected. It is highlighted in a
color determined by the form skin. Must be in mm/dd/yyyy
or dd/mm/yyyy format, depending on the current locale.
(Use the setlocale tag to set the locale, if necessary.) | +| startrange | string | No | | The start of a range of dates that are disabled. Users
cannot select dates from this date through the date
specified by the endRange attribute. | +| endrange | string | No | | The end of a range of dates that are disabled. Users
cannot select dates from the date specified by the
startRange attribute through this date. | +| disabled | boolean | No | | Disables all user input, making the control read only.
To disable input, specify disabled without an attribute
or disabled="true". To enable input, omit the attribute
or specify disabled="false".
Default is: false | +| mask | string | No | MM/DD/YYYY | A pattern that specifies the format of the submitted date.
Mask characters are:
- D = day, can use 0-2 mask characters
- M = month, can use 0-4 mask characters
- Y = year, can use 0, 2, or 4 characters
- E = day in week, can use 0-4 characters
- Any other character = put the character in the specified location
Default is: MM/DD/YYYY | +| firstdayofweek | numeric | No | 0 | Integer in the range 0-6 specifying the first day of the
week in the calendar, 0 indicates Sunday, 6 indicates Saturday.
Default is: 0 | +| daynames | string | No | S,M,T,W,Th,F,S | A comma-delimited list that sets the names of the
weekdays displayed in the calendar. Sunday is the
first day and the rest of the weekday names follow in
the normal order.
Default is: S,M,T,W,Th,F,S | +| monthnames | string | No | January,February,March,April,May,June,July,August,September,October,November,December | A comma-delimited list of the month names that are
displayed at the top of the calendar. | +| enabled | boolean | No | YES | Flash only: Specifying whether the control is enabled. A
disabled control appears in light gray. This is the inverse
of the disabled attribute. | +| visible | boolean | No | YES | Flash only: Specifying whether to show the control. Space
that would be occupied by an invisible control is blank. | +| tooltip | string | No | | Flash only: Text to display when the mouse pointer hovers
over the control. | +| style | string | No | | Flash only: Actionscript style or styles to apply to the calendar.
Default is: haloGreen | +| onchange | string | No | | Flash only: ActionScript that runs when the user selects a
date. | +| onblur | string | No | | Flash only: ActionScript that runs when the user selects a
date. | +| onfocus | string | No | | Flash only: ActionScript that runs when the user selects a
date. | diff --git a/docs/tags/cfcase.md b/docs/tags/cfcase.md new file mode 100644 index 000000000..cb0d2b384 --- /dev/null +++ b/docs/tags/cfcase.md @@ -0,0 +1,58 @@ +# cfcase + +Used only inside the cfswitch tag body. Contains code to execute when the expression specified in the cfswitch tag has one or more specific values. Note the difference in the tag and script syntax when providing multiple values for a case. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +case "apple": +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | Yes | | The value or values that the expression attribute of the cfswitch tag must match. To specify multiple matching values, for tag syntax, separate the values with the delimiter character; for script syntax list each on the same line. The value or values must be simple constants or constant expressions, not variables. | +| delimiters | string | No | , | Specifies the delimiter character or characters that separate multiple values to match. If you specify multiple delimiter characters, you can use any of them to separate the values to be matched. Used only for tag syntax. | + +## Script Syntax + +```html +fruit = ""; +switch(fruit) { + case "Apple": + writeOutput("I like apples!"); + break; + case "Orange": case "Citrus": + writeOutput("I like oranges!"); + break; + case "Kiwi": + writeOutput("I like kiwi!"); + break; + default: + writeOutput("Fruit, what fruit?"); + break; + } +``` + +### Expected Result: Fruit, what fruit? + +## Tag Syntax + +```html + + + I like apples! + I like oranges! + I like kiwi! + Fruit, what fruit? + +``` + +### Expected Result: I like oranges! diff --git a/docs/tags/cfcatch.md b/docs/tags/cfcatch.md new file mode 100644 index 000000000..3ab9e8cdf --- /dev/null +++ b/docs/tags/cfcatch.md @@ -0,0 +1,55 @@ +# cfcatch + +Used inside a cftry tag. Together, they catch and process + exceptions in CFML pages. Exceptions are events that + disrupt the normal flow of instructions in a CFML page, + such as failed database operations, missing include files, and + developer-specified events. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +catch (any e) { } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| type | string | No | any | `application`: catches application exceptions
`database`: catches database exceptions
`template`: catches ColdFusion page exceptions
`security`: catches security exceptions
`object`: catches object exceptions
`missingInclude`: catches missing include file exceptions
`expression`: catches expression exceptions
`lock`: catches lock exceptions
`custom_type`: catches the specified custom exception type that is defined in a cfthrow tag
`java.lang.Exception`: catches Java object exceptions
`searchengine`: catches Verity search engine exceptions
`any`: catches all exception types | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcatch.md|any | + +## A simple try/catch script based example + +Create a divide by zero error and then catch it. + +```html +try { + x = 5/0; +} +catch (any e) { + writeOutput("Error: " & e.message); +} +``` + +### Expected Result: Error: Division by zero. + +## A simple try/catch tag based example + +Create a divide by zero error and then catch it. + +```html + + + + Error: #cfcatch.message# + + +``` + +### Expected Result: Error: Division by zero. diff --git a/docs/tags/cfchart.md b/docs/tags/cfchart.md new file mode 100644 index 000000000..882521ee1 --- /dev/null +++ b/docs/tags/cfchart.md @@ -0,0 +1,85 @@ +# cfchart + +Generates and displays a chart. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfchart(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| format | string | No | html | File format in which to save graph.
`format=flash` has been deprecated in CF2016+
For Lucee the default value is `png` and the format `html` is not supported. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|png | +| chartheight | numeric | No | 240 | Chart height; integer number of pixels | | +| chartwidth | numeric | No | 320 | Chart width; integer number of pixels | | +| scalefrom | numeric | No | | Y-axis minimum value; integer | | +| scaleto | numeric | No | | Y-axis max value; integer | | +| showxgridlines | boolean | No | NO | yes: display X-axis gridlines | | +| showygridlines | boolean | No | YES | yes: display Y-axis gridlines | | +| gridlines | numeric | No | 10 | Number of grid lines to display on value axis, including
axis; positive integer. | | +| seriesplacement | string | No | default | Applies to charts that have more than one data series.
Relative positions of series. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|percent | +| foregroundcolor | string | No | black | color for control. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|yellow | +| backgroundcolor | string | No | | Color of the area between the data background and the chart
border, around labels and around the legend. Hexadecimal
value or supported named color. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|yellow | +| showborder | boolean | No | NO | Whether to display a border around the chart | | +| databackgroundcolor | string | No | white | color for control. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|yellow | +| font | string | No | arial | Font of data in column. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|arialunicodeMS | +| fontsize | numeric | No | | Size of text in column. | | +| fontitalic | boolean | No | NO | Yes: displays grid control text in italics | | +| fontbold | boolean | No | NO | Yes: displays grid control text in bold | | +| labelformat | string | No | number | Format for Y-axis labels. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|date | +| xaxistitle | string | No | | text; X-axis title | | +| yaxistitle | string | No | | text; X-axis title | | +| xaxistype | string | No | category | CF6.1+ The axis indicates the data category. Data is sorted according to the sortXAxis attribute.
* scale The axis is numeric. All cfchartdata item attribute
values must numeric. The X axis is automatically sorted
numerically. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|scale | +| yaxistype | string | No | category | CF6.1+ Currently has no effect, as Y axis is always used for data
values. Valid values are category and scale | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|scale | +| sortxaxis | boolean | No | NO | Display column labels in alphabetic order along X-axis.
Ignored if the xAxisType attribute is scale. | | +| show3d | boolean | No | YES | Display chart with three-dimensional appearance. | | +| xoffset | numeric | No | 0.1 | Applies if show3D="yes". Number of units by which to
display the chart as angled, horizontally | | +| yoffset | numeric | No | 0.1 | Applies if show3D="yes". Number of units by which to
display the chart as angled, horizontally. | | +| showlegend | boolean | No | YES | CF8+ if chart contains more than one data series, display legend | | +| tipstyle | string | No | mouseOver | Determines the action that opens a popup window to display
information about the current chart element.
* mouseDown: display if the user positions the cursor at the element
and clicks the mouse. Applies only to Flash format graph files.
* mouseOver: displays if the user positions the cursor at the element
* none: suppresses display | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|none | +| tipbgcolor | string | No | white | color for control. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|yellow | +| showmarkers | boolean | No | YES | Applies to chartseries type attribute values line, curve
and scatter.
yes: display markers at data points | | +| markersize | numeric | No | | Size of data point marker. in pixels. Integer. | | +| pieslicestyle | string | No | sliced | Applies to chartseries type attribute value pie. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|sliced | +| URL | string | No | | URL to open if the user clicks item in a data series; the
onClick destination page.

You can specify variables within the URL string;
ColdFusion passes current values of the variables.
* $VALUE$: the value of the selected row. If none, the value is an empty string.
* $ITEMLABEL$: the label of the selected item. If none, the value is an empty string.
* $SERIESLABEL$: the label of the selected series. If none, the value is an empty string. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|$SERIESLABEL$ | +| name | string | No | | Page variable name. String. Generates the graph as
binary data and assigns it to the specified variable.
Suppresses chart display. You can use the name value in
the cffile tag to write the chart to a file. | | +| style | string | No | | CF7+ XML file or string to use to specify the style of the chart. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|yellow | +| title | string | No | | CF7+ Title of the chart. | | +| base64 | boolean | No | false | CF2018+ Can only be used for client side charts. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchart.md|false | + +## CFML Markup + +A Simple PIE chart with hard coded data. + +```html + + + + + + + + +``` + +## Script Syntax (CF11+) + +```html +cfchart(format = "html", title = "Sales Report") { + cfchartseries(type = "pie") { + cfchartdata(item = "2012", value = "#RandRange(300000, 900000)#"); + cfchartdata(item = "2013", value = "#RandRange(300000, 900000)#"); + cfchartdata(item = "2014", value = "#RandRange(300000, 900000)#"); + cfchartdata(item = "2015", value = "#RandRange(300000, 900000)#"); + } +} +``` diff --git a/docs/tags/cfchartdata.md b/docs/tags/cfchartdata.md new file mode 100644 index 000000000..1073242d7 --- /dev/null +++ b/docs/tags/cfchartdata.md @@ -0,0 +1,39 @@ +# cfchartdata + +Used with the cfchart and cfchartseries tags. This tag defines + chart data points. Its data is submitted to the cfchartseries + tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfchartdata(item="", value=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| item | string | Yes | | string; data point name | +| value | string | Yes | | number or expression; data point value | + +## A simple bar chart + +A Simple bar chart with hard coded data. + +```html + + + + + + + + +``` diff --git a/docs/tags/cfchartseries.md b/docs/tags/cfchartseries.md new file mode 100644 index 000000000..29f4bc924 --- /dev/null +++ b/docs/tags/cfchartseries.md @@ -0,0 +1,46 @@ +# cfchartseries + +Used with the cfchart tag. This tag defines the style in which + chart data displays: bar, line, pie, and so on. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfchartseries(type="bar"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| type | string | Yes | | Sets the chart display style | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchartseries.md|pie | +| query | query | No | | Name of CFML query from which to get data. | | +| itemcolumn | string | No | | Name of a column in the query specified in the query
attribute; contains the item label for a data point to
graph. | | +| valuecolumn | string | No | | Name of a column in the query specified in the query
attribute; contains data values to graph. | | +| serieslabel | string | No | | Text of data series label | | +| seriescolor | string | No | | Color of the main element (such as the bars) of a chart.
For a pie chart, the color of the first slice.

Hex value or supported named color; see name list in the
cfchart Usage section.
For a hex value, use the form "##xxxxxx", where x = 0-9 or
A-F; use two pound signs or none. | | +| paintstyle | string | No | plain | Sets the paint display style of the data series. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchartseries.md|light | +| markerstyle | string | No | rectangle | Applies to chartseries type attribute values line, curve
and scatter, and show3D attribute value no. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchartseries.md|rcross | +| colorlist | string | No | | Applies if chartseries type attribute = "pie". Sets pie
slice colors.

Comma-delimited list of hex values or supported, named web
colors; see name list in the cfchart Usage section.

For a hex value, use the form "##xxxxxx", where x = 0-9 or
A-F; use two pound signs or none. | | +| datalabelstyle | string | No | | Specifies the way in which the color is applied to the
item in the series:
- None = nothing is printed (default)
- Value = the value of the datapoint
- Rowlabel = the row's label
- Columnlabel = the column's label
- Pattern | /Users/garethedwards/development/github/cfdocs/docs/tags/cfchartseries.md|pattern | + +## A simple area chart + +A Simple area chart with hard coded data. + +```html + + + + + + + + +``` diff --git a/docs/tags/cfclient.md b/docs/tags/cfclient.md new file mode 100644 index 000000000..9226b1134 --- /dev/null +++ b/docs/tags/cfclient.md @@ -0,0 +1,26 @@ +# cfclient + +Part of the CF11 mobile features for client side (JS) development. Enables output of CFcode to JS. Must read the wikidoc for full understanding of this new cf tag. + +### Syntax + +```html + ...output... +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfclient(); ...output... /cfclient> +``` + +## Basic Example + +Very basic example. Please read the wikidoc entry at Adobe for further usage scenarios. + +```html + + + #myvar# + +``` diff --git a/docs/tags/cfclientsettings.md b/docs/tags/cfclientsettings.md new file mode 100644 index 000000000..6b92af412 --- /dev/null +++ b/docs/tags/cfclientsettings.md @@ -0,0 +1,23 @@ +# cfclientsettings + +Part of the new CF11 mobile development features. This tag is similar to cfprocessingdirective and acts as a compiler directive to include plugins for various features (device detection and device API). You can use this tag to load all the required device detection plugins. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript + cfclientsettings(enableDeviceAPI = "true|false", detectDevice = "true|false", deviceTimeout = Number); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| enableDeviceAPI | boolean | No | false | Enable/disable the device API | +| detectDevice | boolean | No | false | Enable/disable the device detection plugin. | +| deviceTimeout | numeric | No | 10 | The timeout for loading the plugins (in seconds). | diff --git a/docs/tags/cfcol.md b/docs/tags/cfcol.md new file mode 100644 index 000000000..fcc2d01ba --- /dev/null +++ b/docs/tags/cfcol.md @@ -0,0 +1,25 @@ +# cfcol + +Defines table column header, width, alignment, and text. Used + within a cftable tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfcol(header="", text=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| header | string | Yes | | Column header text. To use this attribute, you must also
use the cftable colHeaders attribute. | +| width | numeric | No | 20 | Column width. If the length of data displayed exceeds this
value, data is truncated to fit. To avoid this, use an
HTML table tag. | +| align | string | No | left | Column alignment | +| text | string | Yes | | Double-quotation mark-delimited text; determines what to
display. Rules: same as for cfoutput sections. You can
embed hyperlinks, image references, and input controls | diff --git a/docs/tags/cfcollection.md b/docs/tags/cfcollection.md new file mode 100644 index 000000000..aaa401c13 --- /dev/null +++ b/docs/tags/cfcollection.md @@ -0,0 +1,111 @@ +# cfcollection + +Creates, registers, and administers Verity search engine + collections. + + A collection that is created with the cfcollection tag is + internal. A collection created any other way is external. + + A collection that is registered with CFML using the + cfcollection tag or registered with the K2 Server by editing + the k2server.ini file is registered. Other collections are + unregistered. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfcollection(action="categorylist"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| action | string | Yes | list | categorylist: retrieves categories from the collection and
indicates how many documents are in each one. Returns
a structure of structures in which the category
representing each substructure is associated with a
number of documents. For a category in a category tree,
the number of documents is the number at or below that
level in the tree.
create: registers the collection with CFML.
- If the collection is present: creates a map to it
- If the collection is not present: creates it
delete: unregisters a collection.
- If the collection was registered with action = create:
deletes its directories
- If the collection was registered and mapped: does not
delete collection directories
optimize: optimizes the structure and contents of the
collection for searching; recovers space.
list: returns a query result set, named from the name
attribute value, of the attributes of the collections
that are registered by CFML and K2 Server.
map: creates a map to the collection. It is not necessary
to specify this value. Deprecated in CF7.
repair: fixes data corruption in a collection. Deprecated in CF7. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcollection.md|repair | +| collection | string | No | | A collection name. The name can include spaces | | +| path | string | No | | Absolute path to a Verity/Lucene/SOLR collection. | | +| language | string | No | english | Options are listed in Usage section. Requires the
appropriate (European or Asian) Verity Locales language
pack. | | +| name | string | No | | Name for the query results returned by the list action. | | +| categories | boolean | No | NO | Used only for creating a collection:
- true: This collection includes support for categories.
- false: This collection does not support categories. Default. | | +| engine | string | No | verity | Search engine | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcollection.md|solr | + +## Example of using the cfcollection function to create a collection + +In this example we demonstrate using the cfcollection function to build a function which first checks if a collection already exists (and has records), and if not, creates the collection. + +```html +public boolean function createCollection( required string collectionName ) { + // var scope a variable to check if the collection already exists + var collectionExists = ''; + + // use cfcollection to get a list of documents from the passed in collection + cfcollection( action = 'list', collection = arguments.collectionName, name = 'collectionExists' ); + + // see if the collection has any records + if( !collectionExists.recordCount ) { + // it does not, but wrap create in a try in case it exists but is merely empty + try { + // use cfcollection to create a new collection + cfcollection( action = 'create', collection = arguments.collectionName ); + // catch if this collection already exists + } catch (any e) { + // it does, return false + return false; + } + // otherwise + } else { + // collection already has records (and thus exists), return false + return false; + } + + // the collection was successfully created, return true + return true; +} +``` + +### Expected Result: True, if the collection was created; False, if the collection already exists + +## Example of using the tag to create a collection + +In this example we demonstrate using the <cfcollection> tag to build a function which first checks if a collection already exists (and has records), and if not, creates the collection. + +```html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +### Expected Result: True, if the collection was created; False, if the collection already exists diff --git a/docs/tags/cfcomponent.md b/docs/tags/cfcomponent.md new file mode 100644 index 000000000..a89d346a9 --- /dev/null +++ b/docs/tags/cfcomponent.md @@ -0,0 +1,85 @@ +# cfcomponent + +Creates and defines a component object; encloses functionality that you build in CFML and enclose within cffunction tags. This tag contains one or more cffunction tags that define methods. Code within the body of this tag, other than cffunction tags, is executed when the component is instantiated (like a constructor). Components are saved in a file with a `.cfc` extension. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +component displayname="myComponent" output="false" { } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| extends | string | No | | Name of parent component from which to inherit methods and properties. | | +| output | boolean | No | | Specifies whether constructor code in the component can generate HTML output; does not affect output in the body
of cffunction tags in the component. | | +| displayname | string | No | | A string to be displayed when using introspection to show information about the CFC. The information appears on the
heading, following the component name.
If the style attribute is set to document, the displayname
attribute is used as the name of the service element in the WSDL. | | +| hint | string | No | | Text to be displayed when using introspection to show information about the CFC. The hint attribute value
appears below the component name heading. This attribute
can be useful for describing the purpose of the parameter.
If the style attribute is set to document, the hint
attribute is used as the document element of the service
in the WSDL. | | +| style | string | No | rpc | CF7+ Specifies whether a CFC used for web services uses RPC-encoded style or document-literal style:
- rpc: RPC-encoded style, default
- document: Document-literal style
If you specify document, you must also specify the namespace,
serviceportname, porttypename, and bindingname attributes. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|document | +| namespace | string | No | | CF7+ Specifies the namespace used in the WSDL when using the CFC as a document-literal style web service.
If you don't specify this attribute, ColdFusion MX
derives the namespace from the CFC class name.
This attribute applies only when style="document". | | +| serviceportname | string | No | | CF7+ Specifies the name of the port element in the WSDL. This attribute applies only when style="document". | | +| porttypename | string | No | | CF7+ Specifies the name of the porttype element in the WSDL. This attribute applies only when style="document". | | +| bindingname | string | No | | CF7+ Specifies the name of the binding element in the WSDL. This attribute applies only when style="document". | | +| wsdlfile | string | No | | CF7+ A properly formatted WSDL file to be used instead of WSDL generated by ColdFusion MX.
This attribute applies only when style="document". | | +| implements | string | No | | CF8+ Name of the ColdFusion interface or interfaces that this component implements. If the
component implements an interface, it must
define all the functions in the interface, and the
function definitions must conform to the
definitions specified in the interface. For more
information, see cfinterface.
A component can implement any number of
interfaces. To specify multiple interface, use a
comma delimited list, of the format
interface1,interface2. | | +| serviceaddress | string | No | | CF8+ Specifies the SOAP URL of the web service. | | +| initmethod | string | No | | CF9+ Method that will be called when ColdFusion instantiates the component | | +| persistent | boolean | No | | CF9+ Specifies CFC is persistent or not | | +| entityname | string | No | | CF9+ Specifies the name of the entity. Entity name is the name used by the ORM related functions to work with the persistent CFC. If entityname is not specified, then the CFC name is taken as the entityname. The entityname must be unique in the application. | | +| table | string | No | | CF9+ Specifies the name of the database table to which the CFC maps. | | +| schema | string | No | | CF9+ Used to specify the schema name. | | +| catalog | string | No | | CF9+ Used to specify the database catalog name. | | +| dynamicinsert | boolean | No | NO | CF9+ Specifies whether INSERT SQL is to be generated at runtime.
Only those columns whose values are not null are included in the SQL. | | +| dynamicupdate | boolean | No | NO | CF9+ Specifies whether UPDATE SQL is to be generated at runtime.
Only those columns whose values are not null are included in the SQL. | | +| readonly | boolean | No | | CF9+ Specify whether table is readonly or not | | +| selectbeforeupdate | boolean | No | | CF9+ Specify whether Hibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified.
In cases when a transient object is associated with a new session using update(), Hibernate performs an extra SQL SELECT to determine if an UPDATE is actually required. | | +| batchsize | numeric | No | | CF9+ An integer value that specifies the number of records to be retrieved at a single instance. | | +| optimisticlock | string | No | version | CF9+ Determines the locking strategy.
It can be any one of the following four values:
none
version
dirty
all | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|version | +| lazy | boolean | No | YES | CF9+ Whether loading is to be done lazily or not. | | +| rowid | string | No | | CF9+ Row id | | +| discriminatorColumn | string | No | | CF9+ Use this attribute to define the discriminator column to be used in inheritance mapping | | +| discriminatorValue | string | No | | CF9+ Use this attribute to define the discriminator value to be used in inheritance mapping | | +| joinColumn | string | No | | CF9+ Use this attribute to define the join column for inheritance mapping. | | +| embedded | boolean | No | | CF9+ Marks CFC as embedded, used when a CFC has an embedded object which also needs to be persisted along with the parent's data | | +| cacheUse | string | No | | CF9+ Use this value to specify the caching strategy to be used for caching this component's data in the secondary cache | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|transactional | +| cacheName | string | No | | CF9+ Use this value to specify the name of the secondary cache. | | +| saveMapping | boolean | No | NO | CF9+ Specifies whether the generated Hibernate mapping file has to be saved to disk. If you set the value to true, the Hibernate mapping XML file is saved with the filename "CFC name".hbm.xml in the same directory as the CFC. | | +| accessors | boolean | No | | CF9+ If set to false, ColdFusion ORM does not generate the implicit getters and setters. | | +| serializable | boolean | No | | CF9+ Specifies whether this component can be serialized. If you set this value to false, the component and the data in the component‚ This and Variables scopes cannot be serialized, so they are not retained on session replication, and the component is in its default state. | | +| attribute | boolean | No | YES | CF9+ If the attribute is set to false at the component level, then the implicit getters and setters for the individual properties are ignored. | | +| mappedSuperClass | boolean | No | false | CF9.0.1+ When true on a non persistent CFC, CFCs that extend this component can inherit properties. | | +| rest | boolean | No | false | CF10+ Enables/disables REST.
restPath must be specified to enable REST | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|false | +| restPath | string | No | | CF10+ Path to access the REST-API | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|false | +| httpMethod | string | No | | CF10+ | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|OPTIONS | +| produces | string | No | / | CF10+ Comma-separated list of acceptable MIME types for output | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|... | +| consumes | string | No | / | CF10+ Comma-separated list of acceptable MIME types for input | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|... | +| indexable | boolean | No | false | CF10+ Enables/disables indexing for the component | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|false | +| indexLanguage | string | No | english | CF10+ Set the language to be used to index and search | | +| autoIndex | boolean | No | true | CF10+ Enables/disables auto-indexing | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|false | +| wsVersion | numeric | No | | CF10+ Set the wsVersion of Axis engine | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|2 | +| invokeImplicitAccessor | boolean | No | NO | CF2016+ Get and set component properties using getter and setter methods defined in the component | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcomponent.md|false | + +## Script Syntax + +CF9+ + +```html +component displayname="Script Widget" output="false" { + // functions and properties here +} +``` + +## Tag Syntax + +```html + + + +``` diff --git a/docs/tags/cfcontent.md b/docs/tags/cfcontent.md new file mode 100644 index 000000000..4a1772aa1 --- /dev/null +++ b/docs/tags/cfcontent.md @@ -0,0 +1,40 @@ +# cfcontent + +Does either or both of the following: + * Sets the MIME content encoding header for the current page + * Sends the contents of a file from the server as the page + output + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfcontent(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | No | | The MIME content type of the page, optionally followed by
a semicolon and the character encoding. By default,
CFML sends pages as text/html content type in
the UTF-8 character encoding. | +| deletefile | boolean | No | NO | Applies only if you specify a file with the file attribute.

Yes: deletes the file on the server after sending its
contents to the client.
No: leaves the file on the server. | +| file | string | No | | Name of file whose contents will be the page output. When
using CFML in a distributed configuration, the file
attribute must refer to a path on the system on which the
web server runs. When you use this attribute, any other
output on the current CFML page is ignored; only the
contents of the file is sent to the client. | +| variable | string | No | | Name of a ColdFusion MX binary variable whose contents can
be displayed by the browser, such as the contents of a chart
generated by the cfchart tag or a PDF or Excel file
retrieved by a cffile action="readBinary" tag.
When you use this attribute, any other output on the current
CFML page is ignored; only the contents of the file are sent
to the client. | +| reset | boolean | No | YES | The reset and file attributes are mutually exclusive.
If you specify a file, this attribute has no effect.

Yes: discards output that precedes call to cfcontent
No: preserves output that precedes call to cfcontent. In
this case all output is sent with the specified type. | + +## Sending an Excel xls file back to the client + +```html + +``` + +## Sending an Excel xls file back to the client using cfscript + +```html +cfcontent(type="application/vnd.ms-excel", file="c:/temp/acmesales03.xls"); +``` diff --git a/docs/tags/cfcontinue.md b/docs/tags/cfcontinue.md new file mode 100644 index 000000000..e735cdb00 --- /dev/null +++ b/docs/tags/cfcontinue.md @@ -0,0 +1,35 @@ +# cfcontinue + +Used within a cfloop tag. Skips processing the remainder of the loop iteration, and continues on to the next iteration. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +continue; +``` + +## Continue when query row is empty + +```html +qry = queryNew('ID,Name','integer,varchar',[{ + id: 0, + name: 'hello' +},{},{ + id: 1, + name: 'world' +}]); +for(row in qry) { + if(row.ID is '') { + continue; + } + writeOutput(row.ID&'.: '&row.name&', '); +} +``` + +### Expected Result: 0.: hello, 1.: world, diff --git a/docs/tags/cfcookie.md b/docs/tags/cfcookie.md new file mode 100644 index 000000000..ffc840352 --- /dev/null +++ b/docs/tags/cfcookie.md @@ -0,0 +1,55 @@ +# cfcookie + +Defines web browser cookie variables, including expiration and + security options. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfcookie(name = "cookie name"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | Name of cookie variable. CFML converts cookie names
to all-uppercase. Cookie names set using this tag can
include any printable ASCII characters except commas,
semicolons or white space characters. | | +| value | string | No | | Value to assign to cookie variable. Must be a string or
variable that can be stored as a string. | | +| expires | any | No | | Expiration of cookie variable.

* The default: the cookie expires when the user closes the
browser, that is, the cookie is "session only".
* A date or date/time object (for example, 10/09/97)
* A number of days (for example, 10, or 100)
* now: deletes cookie from client cookie.txt file
(but does not delete the corresponding variable the
Cookie scope of the active page).
* never: The cookie expires in 30 years from the time it
was created (effectively never in web years). | | +| secure | boolean | No | | If browser does not support Secure Sockets Layer (SSL)
security, the cookie is not sent. To use the cookie, the
page must be accessed using the https protocol. | | +| path | string | No | | URL, within a domain, to which the cookie applies;
typically a directory. Only pages in this path can use the
cookie. By default, all pages on the server that set the
cookie can access the cookie.

path = "/services/login" | | +| domain | string | No | | Domain in which cookie is valid and to which cookie content
can be sent from the user's system. By default, the cookie
is only available to the server that set it. Use this
attribute to make the cookie available to other servers.

Must start with a period. If the value is a subdomain, the
valid domain is all domain names that end with this string.
This attribute sets the available subdomains on the site
upon which the cookie can be used. | | +| httpOnly | boolean | No | | CF9+ Specify whether cookie is http cookie or not | | +| encodevalue | boolean | No | | CF10+ Specify if cookie value should be encoded | | +| preserveCase | boolean | No | false | CF10+ Specify if cookie name should be case-sensitive | | +| samesite | string | No | | CF2018+ Tells browsers when and how to fire cookies in first-
or third-party situations. SameSite is used to
identify whether or not to allow a cookie to be
accessed. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfcookie.md|none | + +## Script Syntax + +```html +cfcookie(name="TimeVisited", value=Now(), domain=".local.com", path="/coldfusion" expires=30, httponly="yes", encodevalue="yes" ) +``` + +## Tag Syntax + +```html + +``` + +## Using Cookie Scope + +```html +cookie.TimeVisited = { value="#Now()#", domain=".local.com", path="/coldfusion", expires=30, httponly="yes", encodevalue="yes" }; +``` + +## Using CFHeader + +```html + +``` diff --git a/docs/tags/cfdbinfo.md b/docs/tags/cfdbinfo.md new file mode 100644 index 000000000..3753abf1c --- /dev/null +++ b/docs/tags/cfdbinfo.md @@ -0,0 +1,39 @@ +# cfdbinfo + +Lets you retrieve information about a data source, including details about the database, tables, queries, procedures, foreign keys, indexes, and version information about the database, driver, and JDBC + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfdbinfo(type="Columns", name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | Tables | Type of information to get:

* dbnames: database name and type
* tables: name, type, and remarks
* columns: name, SQL data type, size, decimal precision, default value, maximum length in bytes of a character or integer data type column, whether nulls are allowed, ordinal position, remarks, whether the column is a primary key, whether the column is a foreign key, the table that the foreign key refers to, the key name the foreign key refers to
* version: database product name and version, driver name and version, JDBC major and minor version
* procedures: name, type, and remarks
* foreignkeys: foreign key name and table, primary key name, delete and update rules
* index: name, column on which the index is applied, ordinal position, cardinality, whether the row represents a table statistic or an index, number of pages used by the table or index, whether the index values are unique | +| datasource | string | No | | Datasource to use to connect to the database. | +| name | string | Yes | | Name to use to refer to the result. | +| dbname | string | No | | Name of the database. | +| username | string | No | | User name to connect to the database. | +| password | string | No | | Password to connect to the database. | +| pattern | string | No | | Used only if type = "tables" ,type = "columns" , or type = "procedures"
. Specifies a filter to retrieve information about specific tables, columns, or stored procedures. Use an underline (_) to represent a single wildcard character and a percent sign (%) to represent a wildcard of zero or more characters. | +| table | string | No | | Name of the table from which you retrieve information. | + +## Output Column Names + +Along with the data type and size + +```html + + + #cols.column_name# #cols.type_name#(#cols.column_size#)
+
+``` diff --git a/docs/tags/cfdefaultcase.md b/docs/tags/cfdefaultcase.md new file mode 100644 index 000000000..f6ddfe753 --- /dev/null +++ b/docs/tags/cfdefaultcase.md @@ -0,0 +1,48 @@ +# cfdefaultcase + +Used only inside the cfswitch tag body. Contains code to + execute when the expression specified in the cfswitch tag does + not match any of the values specified by preceding cfcase tags. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfdefaultcase(); +``` + +## Script Syntax + +```html +vegetable = ""; +switch(vegetable) { + case "carrot": + writeOutput("Carrots are orange."); + break; + default: + writeOutput("You don't have any vegetables!"); + break; +} +``` + +### Expected Result: You don't have any vegetables! + +## Tag Syntax + +```html + + + Carrots are orange. + + + You don't have any vegetables! + + +``` + +### Expected Result: You don't have any vegetables! diff --git a/docs/tags/cfdirectory.md b/docs/tags/cfdirectory.md new file mode 100644 index 000000000..28ec226c2 --- /dev/null +++ b/docs/tags/cfdirectory.md @@ -0,0 +1,84 @@ +# cfdirectory + +Allows you to list, create, delete or rename a directory in the server file system. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +directoryList(".", false, " "); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| action | string | No | list | Action to perform | /Users/garethedwards/development/github/cfdocs/docs/tags/cfdirectory.md|rename | +| directory | string | Yes | | Absolute pathname of directory against which to perform action. | | +| name | string | No | | Name for output record set. | | +| filter | string | No | | Filter applied to returned names. For example: *.cfm
You can use a pipe ("|") delimiter to specify multiple filters. For example: *.cfm|*.cfc
Filter pattern matches are case-sensitive on UNIX and Linux. | | +| mode | string | No | | Applies only to UNIX and Linux. Permissions. Octal values of Unix chmod command. Assigned to owner, group, and other, respectively. | | +| sort | string | No | asc | Query column(s) by which to sort directory listing.
Delimited list of columns from query output. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfdirectory.md|desc | +| newdirectory | string | No | | New name for directory. | | +| recurse | boolean | No | NO | Whether ColdFusion performs the action on subdirectories. | | +| type | string | No | all | | /Users/garethedwards/development/github/cfdocs/docs/tags/cfdirectory.md|all | +| listinfo | string | No | all | | /Users/garethedwards/development/github/cfdocs/docs/tags/cfdirectory.md|all | + +## List Files in Directory (Script Syntax) + +Returns a query + +```html +myList = directoryList(expandPath("./"), false, "query"); +``` + +## Create a Directory (Script Syntax) + +```html +directoryCreate(expandPath("./new_directory")); +``` + +## Delete a Directory (Script Syntax) + +Directory Delete + +```html +directoryDelete(expandPath("./my_directory")); +``` + +## Rename a Directory (Script Syntax) + +```html +directoryRename(expandPath("./my_directory"), expandPath("./new_directory")); +``` + +## List File in Directory (Tag Syntax) + +Directory List + +```html + +``` + +## Create a Directory (Tag Syntax) + +```html + +``` + +## Delete a Directory (Tag Syntax) + +```html + +``` + +## Rename a Directory (Tag Syntax) + +```html + +``` diff --git a/docs/tags/cfdiv.md b/docs/tags/cfdiv.md new file mode 100644 index 000000000..85db236f6 --- /dev/null +++ b/docs/tags/cfdiv.md @@ -0,0 +1,26 @@ +# cfdiv + +Creates an HTML tag with specified contents and lets you to use bind expressions to + dynamically control the tag contents. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfdiv(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| id | string | No | | The HTML ID attribute value to assign to the
generated container tag. | | +| onBindError | string | No | | The name of a JavaScript function to execute if
evaluating a bind expression results in an error. The
function must take two attributes: an HTTP status
code and a message.
If you omit this attribute, and have specified a
global error handler (by using the
ColdFusion.setGlobalErrorHandler function), it
displays the error message; otherwise a default
error pop-up displays. | | +| bind | string | No | | A bind expression that returns the container
contents.
Note: If a CFML page specified in this attribute
contains tags that use AJAX features, such as
cfform, cfgrid, and cfwindow, you must use a
tag on the page with the tag.
For more information, see cfajaximport. | | +| tagName | string | No | div | The HTML container tag to create. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfdiv.md|span | +| bindonload | boolean | No | YES | * true: executes the bind attribute expression when first loading the tag.
* false: does not execute the bind attribute expression until the first bound event .
To use this attribute, you must also specify a bind attribute. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfdiv.md|YES | diff --git a/docs/tags/cfdocument.md b/docs/tags/cfdocument.md new file mode 100644 index 000000000..a17fa66d3 --- /dev/null +++ b/docs/tags/cfdocument.md @@ -0,0 +1,138 @@ +# cfdocument + +Creates PDF or FlashPaper output from a text block containing CFML and HTML. + +### Syntax + +```html +html +``` + +### Script Syntax + +```javascript +cfDocument(format="PDF") { writeOutput(html); }; +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| format | string | Yes | | Specifies the report format. | +| filename | string | No | | Specifies the fully qualified path name of a file to
contain the PDF or FlashPaper output. If you omit the
filename attribute, ColdFusion MX streams output to
the browser. | +| localurl | boolean | No | NO | Specifies whether to retrieve image files directly
from the local drive:
* yes: ColdFusion retrieves image files directly from
the local drive rather than by using HTTP, HTTPS, or proxy.
* no: ColdFusion uses HTTP, HTTPS, or proxy to retrieve
image files even if the files are stored locally. | +| overwrite | boolean | No | NO | Specifies whether ColdFusion MX overwrites an
existing file. Used in conjunction with filename.
Default is: false | +| name | string | No | | Specifies the name of an existing variable into which
the tag stores the PDF or FlashPaper output. | +| pagetype | string | No | A4 | Specifies the page size into which ColdFusion
generates the report.
- legal: 8.5 inches x 14 inches
- letter: 8.5 inches x 11 inches
- A4: 8.27 inches x 11.69 inches
- A5: 5.81 inches x 8.25 inches
- B5: 9.81 inches x 13.88 inches
- Custom: Custom height and width.
If you specify custom, you must also specify the pageheight
and pagewidth attributes, can optionally specify margin
attributes, and can optionally specify whether the units
are inches or centimeters. | +| pageheight | numeric | No | | Specifies the page height in inches (default) or
centimeters. This attribute is only valid if
pagetype=custom. To specify page height in
centimeters, include the unit=cm attribute. | +| pagewidth | numeric | No | | Specifies the page width in inches (default) or
centimeters. This attribute is only valid if
pagetype=custom. To specify page width in
centimeters, include the unit=cm attribute. | +| orientation | string | No | portrait | Specifies the page orientation. Specify either of the
following:
- portrait (default)
- landscape | +| margintop | numeric | No | | Specifies the top margin in inches (default) or
centimeters. To specify top margin in centimeters,
include the unit=cm attribute. | +| marginbottom | string | No | | Specifies the bottom margin in inches (default) or
centimeters. To specify bottom margin in
centimeters, include the unit=cm attribute. | +| marginleft | string | No | | Specifies the left margin in inches (default) or
centimeters. To specify left margin in centimeters,
include the unit=cm attribute. | +| marginright | string | No | | Specifies the right margin in inches (default) or
centimeters. To specify right margin in centimeters,
include the unit=cm attribute. | +| unit | string | No | in | Specifies the default unit (inches or centimeters) for
pageheight, pagewidth, and margin attributes. | +| encryption | string | No | none | Specifies whether the output is encrypted (format="PDF" only).
Default is: none | +| ownerpassword | string | No | | Specifies an owner password (format="PDF" only). | +| userpassword | string | No | | Specifies a user password (format="PDF" only). | +| permissions | string | No | | Specifies one or more permissions (format="PDF" only).
Separate multiple permissions with a comma. | +| fontembed | boolean | No | YES | Specifies whether ColdFusion embeds fonts in the output.
Specify one of the following:
- true: Embed fonts
- false: Do not embed fonts.
Selective: Embed all fonts except Java fonts and core fonts. | +| backgroundvisible | boolean | No | NO | Specifies whether the background prints when the
user prints the document:
- yes: include the background when printing.
- no: do not include the background when printing. | +| scale | numeric | No | | Specifies a scale factor as a percentage. Use this
option to reduce the size of the HTML output so that
it fits on that paper. Specify a number less than 100. | +| authpassword | string | No | | Password sent to the target URL for Basic Authentication.
Combined with username to form a base64 encoded string that is passed in the Authenticate header.
Does not provide support for Integrated Windows, NTLM, or Kerebos authentication. | +| authuser | string | No | | User name sent to the target URL for Basic Authentication.
Combined with password to form a base64 encoded string that is passed in the Authenticate header.
Does not provide support for Integrated Windows, NTLM, or Kerebos authentication. | +| bookmark | boolean | No | NO | Specifies whether bookmarks are created in the document:
* yes: creates bookmarks.
* no: does not create bookmarks. | +| mimetype | string | No | text/html | MIME type of the source document | +| proxypassword | string | No | | Password required by the proxy server. | +| proxyuser | string | No | | User name to provide to the proxy server. | +| saveasname | string | No | | (format="PDF" only) The filename that appears in the SaveAs dialog when a user saves a PDF file written to the browser. | +| src | string | No | | URL or the relative path to the web root. You cannot specify both the src and srcfile attributes.
The file must be in a browser-writable format such as, HTML, HTM, BMP, PNG, and so on. | +| srcfile | string | No | | Absolute path of a file that is on the server. You cannot specify both the src and srcfile attributes.
The file must be in a browser-writable format such as, HTML, HTM, BMP, PNG, and so on. | +| useragent | string | No | | Text to put in the HTTP User-Agent request header field. Used to identify the request client software. | +| proxyhost | string | No | | IP address or server name for proxy host. | +| proxyport | string | No | | port of the proxy host. | +| tagged | boolean | No | NO | Determines if PDF are created by using special tags also known as Tagged PDF | +| pdfa | boolean | No | NO | Creates a PDF of type PDF/A-1 (ISO 19005-1:2005) | +| formFields | boolean | No | YES | Specifies whether form fields are exported as widgets or only their fixed print representation is exported. | +| formsType | string | No | FDF | Specifies the submitted format of a PDF form. | +| permissionsPassword | string | No | | This is the password that allows the user to access some permissions restricted if some permissions need to be restricted. The permissions are defined in "permissions" attribute | +| openPassword | string | No | | If the source document is protected specify using this attribute. | + +## Generate and Save a PDF to a file + +Use the cfdocument tag to generate a file on the server either to save to a folder or to attach to an email + +```html + +

Hello ColdFusion

+

This is PDF example document.

+

Generated at: #TimeFormat(Now())# on #DateFormat(Now())#

+
+``` + +### Expected Result: A saved Hello ColdFusion PDF to a temporary directory + +## Dynamic PDF Served to Browser + +PDF is sent back to the browser instead of saving to a file. The cfheader tag is used to suggest a file name to the browser. The cfcontent tag is used to set the Content-Type response header (that could also be done using cfheader) which tells the browser that it is a PDF file. + +```html + + + +

Hello ColdFusion

+

This is PDF example document.

+

Generated at: #TimeFormat(Now())# on #DateFormat(Now())#

+
+``` + +## Script Syntax (CF11+) + +This is a script representation of the the same code above. + +Note that the writeoutput is indeed necessary for any body content in a script-based cfdocument--even if no CFML variables or expressions exist in the string. (This is true also for other script-based tags that may have bodies, including cfdocumentitem and cfdocumentsection, as well as cfhtmltopdf, cfsavecontent, etc.) + +```html + +cfcontent( type="application/pdf" ); +cfheader( name="Content-Disposition", value="attachment;filename=example.pdf" ); +cfdocument (format="pdf"){ +writeoutput(" +

Hello ColdFusion

+

This is PDF example document.

+

Generated at: #TimeFormat(Now())# on #DateFormat(Now())#

+ "); +} +
+``` + +## Print header and footer items with page numbering + +must use evalatprint="true" in order to get current page numbering on the header/footer sections + +```html + + + +#cfdocument.totalpagecount# + +#cfdocument.currentpagenumber# + +cfdocument.currentpagenumber :#cfdocument.currentpagenumber# +cfdocument.totalpagecount :#cfdocument.totalpagecount# +cfdocument.totalsectionpagecount :#cfdocument.totalsectionpagecount# +cfdocument.currentsectionpagenumber :#cfdocument.currentsectionpagenumber# + + + +if#cfdocument.totalpagecount# + +else#cfdocument.currentpagenumber# + + +Example Text + + +``` + +### Expected Result: A PDF with Header & Footer elements diff --git a/docs/tags/cfdocumentitem.md b/docs/tags/cfdocumentitem.md new file mode 100644 index 000000000..8af112a91 --- /dev/null +++ b/docs/tags/cfdocumentitem.md @@ -0,0 +1,41 @@ +# cfdocumentitem + +Specifies action items for a PDF or FlashPaper document + created by the cfdocument tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfdocumentitem(type="pagebreak"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | | Specifies the action:
- pagebreak: start a new page at the location of the tag.
- header: use the text between the
and
tags as the running header.
- footer: use the text between the
and
tags as the running footer. | +| evalAtPrint | boolean | No | | Specifies whether to evaluate expressions inside cfdocumentitem tag at runtime. | + +## Pagebreak (Script Syntax) + +Insert a pagebreak into the document + +```html +cfdocumentitem( type="pagebreak" ); +``` + +## Footer (Script Syntax) + +Insert a page footer into the document + +```html +cfdocumentitem( type="footer" ) { + writeOutput(' -- My Page Footer -- '); +} +``` diff --git a/docs/tags/cfdocumentsection.md b/docs/tags/cfdocumentsection.md new file mode 100644 index 000000000..cd3c781dd --- /dev/null +++ b/docs/tags/cfdocumentsection.md @@ -0,0 +1,65 @@ +# cfdocumentsection + +Divides a PDF or FlashPaper document into sections. + By using this tag in conjunction with a cfdocumentitem + tag, each section can have unique headers, footers, + and page numbers. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfdocumentsection(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| margintop | numeric | No | | Specifies the top margin in inches (default) or
centimeters. To specify the top margin in centimeters,
include the unit="cm" attribute in the parent cfdocument
tag. | +| marginbottom | numeric | No | | Specifies the bottom margin in inches (default) or
centimeters. To specify the bottom margin in
centimeters, include the unit="cm" attribute in the
parent cfdocument tag. | +| marginleft | numeric | No | | Specifies the left margin in inches (default) or
centimeters. To specify the left margin in centimeters,
include the unit="cm" attribute in the parent cfdocument
tag. | +| marginright | numeric | No | | Specifies the right margin in inches (default) or
centimeters. To specify the right margin in centimeters,
include the unit="cm" attribute in the parent cfdocument
tag. | +| authpassword | string | No | | Password sent to the target URL for Basic Authentication.
Combined with username to form a base64 encoded string that is passed in the Authenticate header.
Does not provide support for Integrated Windows, NTLM, or Kerebos authentication. | +| authuser | string | No | | User name sent to the target URL for Basic Authentication.
Combined with password to form a base64 encoded string that is passed in the Authenticate header.
Does not provide support for Integrated Windows, NTLM, or Kerebos authentication. | +| mimetype | string | No | text/html | MIME type of the source document | +| name | string | No | | Bookmark name for the section. | +| src | string | No | | URL or the relative path to the web root. You cannot specify both the src and srcfile attributes. | +| srcfile | string | No | | Absolute path of a file that is on the server.
You cannot specify both the src and srcfile attributes. | +| useragent | string | No | | Text to put in the HTTP User-Agent request header field. Used to identify the request client software. | + +## A simple cfdocumentsection tag based example + +We've example to create pdf with documentsection in tag syntax + +```html + + + + + + + +
Coldfusuionjava
+
+
+``` + +## A simple cfdocumentsection in script based example + +We've example to create pdf with documentsection in script syntax and Used documentsection mime type as text/html. + +```html + +cfdocument (format="pdf",bookmark="yes"){ +cfdocumentsection(mimetype="text/html"){ +writeOutput("
Coldfusuionjava
"); +} +} +
+``` diff --git a/docs/tags/cfdump.md b/docs/tags/cfdump.md new file mode 100644 index 000000000..c56a8cea7 --- /dev/null +++ b/docs/tags/cfdump.md @@ -0,0 +1,64 @@ +# cfdump + +Outputs the contents of a variable of any type for debugging purposes. The variable can be as simple as a string or as complex as a cfc component instance. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +writeDump(var = cgi, label = "CGI Scope"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| var | variableName | Yes | | Variable to display. Enclose a variable name in pound signs. | +| expand | boolean | No | YES | Yes: Expands views | +| label | string | No | | A string; header for the dump output. | +| top | numeric | No | | CF7+ The number of rows to display. For a structure, this is the number of nested levels to display (useful for large structures). | +| format | string | No | text | CF8+ Specify whether to save the results of a cfdump to a file in text or HTML format. | +| hide | string | No | | CF8+ Hide column or keys. | +| keys | numeric | No | | CF8+ For a structure, number of keys to display. | +| metainfo | boolean | No | YES | CF8+ Includes information about the query in the cfdump results. | +| output | string | No | browser | CF8+ Where to send the results of cfdump. | +| show | string | No | | CF8+ Show column or keys. | +| showUDfs | boolean | No | YES | CF8+ Show UDFs in cfdump output. | +| abort | boolean | No | NO | CF9+ Stops further processing of page. | + +## Dump Server Scope (Tag Based) + +Outputs a listing of all the variables in the server scope. + +```html + +``` + +## Dump Server Scope (Script Based) + +Outputs a listing of all the variables in the server scope. + +```html +writeDump(var = server, label = "Server Scope"); +``` + +## LUCEE also supports this syntax (Script Based) + +Outputs a listing of all the variables in the server scope. Only for LUCEE. + +```html +dump(var = server, label = "Server Scope"); +``` + +## Dump Then Abort + +CF9+ Specifying the "abort" attribute without corresponding value is equivalent to assigning it with a "true" value. However, when this attribute is excluded, the default value of "false" is applied. + +```html + +``` diff --git a/docs/tags/cfelse.md b/docs/tags/cfelse.md new file mode 100644 index 000000000..5e5868069 --- /dev/null +++ b/docs/tags/cfelse.md @@ -0,0 +1,42 @@ +# cfelse + +Used as the last control block in a cfif tag block to handle + any case not identified by the cfif tag or a cfelseif tag. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +else { } +``` + +## Script Syntax + +```html +count = 10; + if (count > 20) { + writeOutput(count); + } else if (count == 8) { + writeOutput(count); + } else { + writeOutput(count); + } +``` + +## Tag Syntax + +```html + + + #count# + + #count# + + #count# + +``` diff --git a/docs/tags/cfelseif.md b/docs/tags/cfelseif.md new file mode 100644 index 000000000..4c61eb614 --- /dev/null +++ b/docs/tags/cfelseif.md @@ -0,0 +1,42 @@ +# cfelseif + +Used as a control block in a cfif tag block to handle any case + not identified by the cfif tag or a cfelseif tag. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +else if (expression) { } +``` + +## Script Syntax + +```html +count = 10; + if (count > 20) { + writeOutput(count); + } else if (count == 8) { + writeOutput(count); + } else { + writeOutput(count); + } +``` + +## Tag Syntax + +```html + + + #count# + + #count# + + #count# + +``` diff --git a/docs/tags/cferror.md b/docs/tags/cferror.md new file mode 100644 index 000000000..2c7257256 --- /dev/null +++ b/docs/tags/cferror.md @@ -0,0 +1,26 @@ +# cferror + +Displays a custom HTML page when an error occurs. This lets + you maintain a consistent look and feel among an application's + functional and error pages + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cferror(type="exception", template=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| type | string | Yes | | Type of error that the custom error page handles. The type
also determines how CFML handles the error page. For
more information, see Specifying a custom error page in
Developing CFML MX Applications.

exception: a exception of the type specified by the
exception attribute.
validation: errors recognized by sever-side type
validation.
request: any encountered error.
monitor: deprecated. | /Users/garethedwards/development/github/cfdocs/docs/tags/cferror.md|monitor | +| template | string | Yes | | Relative path to the custom error page.
(A CFML page was formerly called a template.) | | +| mailto | string | No | | An E-mail address. This attribute is available on the
error page as the variable error.mailto. CFML does
not automatically send anything to this address. | | +| exception | string | No | any | Type of exception that the tag handles:

application: application exceptions
database: database exceptions
template: CFML page exceptions
security: security exceptions
object: object exceptions
missingInclude: missing include file exceptions
expression: expression exceptions
lock: lock exceptions
custom_type: developer-defined exceptions, defined in the
cfthrow tag
any: all exception types | /Users/garethedwards/development/github/cfdocs/docs/tags/cferror.md|custom_type | diff --git a/docs/tags/cfexchangecalendar.md b/docs/tags/cfexchangecalendar.md new file mode 100644 index 000000000..ea51dd9e6 --- /dev/null +++ b/docs/tags/cfexchangecalendar.md @@ -0,0 +1,31 @@ +# cfexchangecalendar + +Creates, deletes, modifies, gets, and responds to Microsoft Exchange calendar events, and gets calendar event attachments. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfexchangecalendar(action="create", event="", name="", responsetype="accept", uid=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | The action to take. Must be one of the following: create, delete, get, getAttachments, modify, respond (required) | +| attachmentpath | string | No | | The file path of the destination directory.
If the directory does not exist, ColdFusion creates it.
If you omit this attribute, ColdFusion does not save any attachments.
If you specify a relative path, the path root is the ColdFusion temporary directory, which is returned by the GetTempDirectory function. (optional) | +| connection | variableName | No | | The name of the connection to the Exchange server, as specified in the cfexchangeconnection tag.
If you omit this attribute, you must create a temporary connection by specifying cfexchangeconnection tag connection attributes in the cfexchangecalendar tag. (optional) | +| event | any | Yes | | A reference to the structure that contains the event properties to be set or changed and their values.
You must specify this attribute in number signs (#). (required) | +| generateUniquefilenames | boolean | No | | A Boolean value specifying whether to generate unique file names if multiple attachments have the same file names.
Case "yes": 3x myfile.txt -> myfile.txt, myfile1.txt, and myfile2.txt. (optional, default=no) | +| message | string | No | | The text of an optional message to send in the response or deletion notification. (optional) | +| name | string | Yes | | The name of the ColdFusion query variable that will contain the retrieved events or information about the attachments that were retrieved. (required) | +| notify | boolean | No | | Boolean value specifying whether to notify others of the changes made to the event (optional) | +| responseType | string | Yes | | (respond) Must be one of the following: accept, decline, tentative (required) | +| result | string | No | | The name of a variable that will contain the UID of the event that is created.
You use the UID value in the uid attribute other actions to identify the event to be acted on. (optional) | +| uid | string | Yes | | Case-sensitive Exchange UID value or values that uniquely identify the event or events
on which to perform the action.
For the delete action, this attribute can be a comma delimited list of UID values.
The getAttachments, modify, and respond actions allow only a single UID value. (required) | diff --git a/docs/tags/cfexchangeconnection.md b/docs/tags/cfexchangeconnection.md new file mode 100644 index 000000000..288e13f12 --- /dev/null +++ b/docs/tags/cfexchangeconnection.md @@ -0,0 +1,38 @@ +# cfexchangeconnection + +Opens or closes a persistent connection to an Microsoft Exchange server. + You must have a persistent or temporary connection to use the cfexchangecalendar, + cfexchangecontact, cfexchangemail, and cfexchangetask tags to get or change + information on the Exchange server. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfexchangeconnection(action="open", connection="", server="", username=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | The action to take. Must be open or close. (required) | +| connection | string | Yes | | The name of the connection. You specify this ID when you close the connection
and in tags such as cfexchangemail. (required) | +| mailboxName | string | No | | The ID of the Exchange mailbox to use.
Specify this attribute to access a mailbox whose owner has delegated access
rights to the account specified in the username attribute. (optional) | +| password | string | No | | (open) The users password for accessing the Exchange server. (optional) | +| port | numeric | No | | The port on the server connect to, most commonly port 80. (optional) | +| protocol | string | No | | The protocol to use for the connection. Valid values are http and https. (optional) | +| proxyHost | string | No | | The URL or IP address of the proxy host required for access to the network. (optional) | +| proxyPort | string | No | | The port on the proxy server to connect to, most commonly port 80. (optional) | +| server | string | Yes | | The IP address or URL of the server that is providing access to Exchange. (required) | +| username | string | Yes | | The Exchange user ID (required) | +| folder | string | No | | The forward slash (/) delimited path from the root of the mailbox to the folder for which to get subfolders. | +| recurse | boolean | No | NO | * true: get information on the immediate subfolders of the specified folder only.
* false: get information on all levels of subfolders of the specified folder. | +| name | string | No | | The name of the ColdFusion query variable that contains information about the subfolders. | +| exchangeServerLanguage | string | No | | The language of the Exchange server. Default is English. | +| formBasedAuthentication | boolean | No | | A Boolean value that specifies whether to display a login form and use form based authentication when making the connection. | diff --git a/docs/tags/cfexchangecontact.md b/docs/tags/cfexchangecontact.md new file mode 100644 index 000000000..0dcab083e --- /dev/null +++ b/docs/tags/cfexchangecontact.md @@ -0,0 +1,28 @@ +# cfexchangecontact + +Creates, deletes, modifies, and gets Microsoft Exchange contact records, and gets contact record attachments. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfexchangecontact(action="create", contact="", name="", uid=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | The action to take. Must be one of the following: create, delete, get, getAttachments, modify (required) | +| attachmentPath | string | No | | The absolute file path of the directory in which to put the attachments.
If the directory does not exist, ColdFusion creates it.
If you omit this attribute, ColdFusion does not save any attachments. (optional) | +| connection | variableName | No | | The name of the connection to the Exchange server, as specified in the cfexchangeconnection tag.
If you omit this attribute, you must create a temporary connection by specifying
cfexchangeconnection tag connection attributes in the cfexchangecontact tag. (optional) | +| contact | any | Yes | | A reference to the structure that contains the contact properties to be set or changed and their values.
You must specify this attribute in number signs (#).
For more information on the event structure, see the Usage section. (required) | +| generateUniqueFilenames | boolean | No | | A Boolean value specifying whether to generate unique file names if multiple attachments have the same file names.
Case "yes": 3x myfile.txt -> myfile.txt, myfile1.txt, and myfile2.txt. (optional, default=no) | +| name | string | Yes | | The name of the ColdFusion query variable that will contain the retrieved events or
information about the attachments that were retrieved. (required) | +| result | string | No | | The name of a variable that will contain the UID of the contact that is created.
You use this value in the uid attribute other actions to identify the contact to be acted on. (optional) | +| uid | string | Yes | | A case-sensitive Exchange UID value that uniquely identifies the contacts on which to perform the action.
For the delete action, this attribute can be a comma delimited list of UID values.
The getAttachments and modify action allow only a single UID value. (required) | diff --git a/docs/tags/cfexchangeconversation.md b/docs/tags/cfexchangeconversation.md new file mode 100644 index 000000000..46a5b8f0f --- /dev/null +++ b/docs/tags/cfexchangeconversation.md @@ -0,0 +1,42 @@ +# cfexchangeconversation + +Helps users organize and manage conversations from a Microsoft Exchange account. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfexchangeconversation(action="", connection="", folderID="", name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| action | string | Yes | | The action to take. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfexchangeconversation.md|delete | +| connection | string | Yes | | The name of the connection to the Exchange server, as specified in the `cfexchangeconnection` tag. | | +| name | variableName | No | | (get) The name of the ColdFusion query variable that contains the returned conversation information. | | +| folderID | string | Yes | | A case-sensitive Exchange UID value that uniquely identifies the folder. | | +| UID | string | No | | A case-sensitive Exchange UID value that uniquely identifies the conversation. | | +| isRead | boolean | No | | (setReadState) Indicates the status of the conversation, if read or not. | | +| destinationFolderID | string | No | | (copy/move) A case-sensitive Exchange UID value that uniquely identifies the destination folder. | | +| deleteType | string | No | moveToDeletedItems | (delete) - hardDelete: Removes a folder permanently from the store.
- softDelete: Removes a folder to the dumpster, if dumpster is enabled.
- moveToDeletedItems: Moves a folder to the deleted items folder. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfexchangeconversation.md|moveToDeletedItems | + +## Get conversations + +Gets the conversations in the Inbox folder, filtered by topic and categories. + +```html + + + + + + + +``` diff --git a/docs/tags/cfexchangefilter.md b/docs/tags/cfexchangefilter.md new file mode 100644 index 000000000..1f1fa2dbb --- /dev/null +++ b/docs/tags/cfexchangefilter.md @@ -0,0 +1,24 @@ +# cfexchangefilter + +Specifies the filter parameter for cfexchangemail, cfexchangecalendar, cfexchangetask, and cfexchangecontact, get operations. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfexchangefilter(name="allDayEvent"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | any | Yes | | The type of filter to use. (required) | +| from | any | No | | The start date or date/time combination of the range to use for filtering.
Cannot be used with the value attribute.
If you specify a from attribute without a to attribute, the filter selects for
all entries on or after the specified date or time.
The value can be in any date/time format recognized by ColdFusion, but must
correspond to a value that is appropriate for the filter type. (optional) | +| to | any | No | | The end date or date/time combination for the range used for filtering.
Cannot be used with the value attribute.
If you specify a to attribute without a from attribute, the filter selects for
all entries on or before the specified date or time.
The value can be in any date/time format recognized by ColdFusion, but must
correspond to a value that is appropriate for the filter type. (optional) | +| value | any | No | | The filter value for all filters that do not take a date or time range.
Cannot be used with the from and to attributes.
If the name attribute requires this attribute, ColdFusion generates an error
if it has an empty or null value. (optional) | diff --git a/docs/tags/cfexchangefolder.md b/docs/tags/cfexchangefolder.md new file mode 100644 index 000000000..fd90517e1 --- /dev/null +++ b/docs/tags/cfexchangefolder.md @@ -0,0 +1,43 @@ +# cfexchangefolder + +Lets you perform various actions on the mail folder, such as get folder information, find folders, or create, copy, modify, move, delete, and empty the contents of a folder. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfexchangefolder(action="", folderID="", connection="", name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | The action to take. | +| connection | string | Yes | | The name of the connection to the Exchange server, as specified in the `cfexchangeconnection` tag. | +| uid | string | No | | (getInfo/getExtendedInfo) UID that is used to identify the folder in which the actions are performed. | +| name | variableName | No | | (getInfo/getExtendedInfo/findSubFolders) The name of the ColdFusion query variable that contains the returned information about the folder. | +| folderID | string | No | | (getInfo/getExtendedInfo/findSubFolders/delete/modify/empty) UID that is used to identify the folder in which the actions are performed. | +| folderPath | string | No | | (getInfo/getExtendedInfo) Full path to the folder where the action has to be performed. | +| pathDelimiter | string | No | / | (getInfo/getExtendedInfo) Lets you specify the delimiter that is used to separate the folders. | +| result | variableName | No | | (create/copy/move) The name of a query variable that contains the result returned from the exchange server when one of the action is performed. | +| destinationFolderID | string | No | | (copy/move) A case-sensitive Exchange UID value that uniquely identifies the destination folder. | +| sourceFolderID | string | No | | (copy/move) The UID that is used to identify the folder from which you copy or move folders to the destination folder. | +| deleteType | string | No | moveToDeletedItems | (delete/move) - hardDelete: Removes a folder permanently from the Exchange server.
- softDelete: Moves a folder to the dumpster in Exchange server, if dumpster is enabled.
- moveToDeletedItems: Moves a folder to the deleted items folder. | +| deleteSubFolders | boolean | No | NO | (empty) If true, deletes the subfolder. | +| folder | string | No | | (create/modify) A struct that contains the required information of the folder that has to be created or modified, such as display name and folder class. | + +## Get folder + +Gets the extended information for the Inbox folder. + +```html + + + +``` diff --git a/docs/tags/cfexchangemail.md b/docs/tags/cfexchangemail.md new file mode 100644 index 000000000..c5942c7f2 --- /dev/null +++ b/docs/tags/cfexchangemail.md @@ -0,0 +1,32 @@ +# cfexchangemail + +Gets mail messages and attachments, deletes messages, and sets properties for messages on a Microsoft Exchange server. + The cfexchangemail tag performs mail actions on an Exchange server that you cannot do using the cfmail tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfexchangemail(meetinguid="", message="", name="", uid=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | No | | The name to use for the JavaScript proxy class. (required) | +| attachmentPath | string | No | | The file path of the directory in which to put the attachments.
If the directory does not exist, ColdFusion creates it.
If you omit this attribute, ColdFusion does not save any attachments.
If you specify a relative path, the path root is the ColdFusion temporary directory, which is returned by the GetTempDirectory function. (optional) | +| connection | variableName | No | | The name of the connection to the Exchange server, as specified in the cfexchangeconnection tag.
If you omit this attribute, and you specify cfexchangeconnection tag attributes in this tag, ColdFusion creates a temporary connection. (optional) | +| folder | string | No | | The forward slash (/) delimited path, relative to the inbox, of the folder that contains the message or messages.
The cfechangemail tag looks in the specified folder only, and does not search subfolders.
If you omit this attribute, Exchange looks in the top level of the inbox. (optional) | +| generateUniqueFilenames | boolean | No | | A Boolean value specifying whether to generate unique file names if multiple attachments have the same file names.
Case "yes": 3x myfile.txt -> myfile.txt, myfile1.txt, and myfile2.txt. (optional, default=no) | +| mailUID | string | No | | The case-sensitive UID of the mail message that contains the meeting request, response, or cancellation notification.
You can use this attribute if there are multiple messages about a single meeting. (optional) | +| meetingUID | string | Yes | | The case-sensitive UID of the meeting for which you received the notification. (required) | +| message | any | Yes | | A reference to a structure that contains the properties to be set and their values.
You must specify this attribute in number signs (#). (required) | +| name | string | Yes | | The name of the ColdFusion query variable that will contain the returned mail messages or information
about the attachments that were retrieved. (required) | +| UID | string | Yes | | The case-sensitive UIDs of the messages on which to perform the action.
For the delete action, this attribute can be a comma delimited list of UID values.
The getAttachments and set actions allow only a single UID value. (required) | +| destinationfolder | string | No | | The forward slash (/) delimited path, relative to the root of the mailbox, of the folder to which to move the message or messages. | diff --git a/docs/tags/cfexchangetask.md b/docs/tags/cfexchangetask.md new file mode 100644 index 000000000..12263e555 --- /dev/null +++ b/docs/tags/cfexchangetask.md @@ -0,0 +1,28 @@ +# cfexchangetask + +Creates, deletes, modifies, and gets Microsoft Exchange tasks, and gets task attachments. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfexchangetask(task="", name="", uid=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | No | | The action to take. Must be one of the following: create, delete, get, getAttachments, modify (optional) | +| attachmentPath | string | No | | The file path of the directory in which to put the attachments.
If the directory does not exist, ColdFusion creates it.
If you omit this attribute, ColdFusion does not save any attachments.
If you specify a relative path, the path root is the ColdFusion temporary directory, which is returned
by the GetTempDirectory function. (optional) | +| connection | variableName | No | | The name of the connection to the Exchange server, as specified in the cfexchangeconnection tag.
If you omit this attribute, and you specify cfexchangeconnection tag attributes in this tag,
ColdFusion creates a temporary connection. (optional) | +| task | any | Yes | | A reference to the structure that contains the task properties to be set or changed and their values.
You must specify this attribute in number signs (#).
For more information on the event structure, see the Usage section. (required) | +| name | string | Yes | | The name of the ColdFusion query variable that will contain the returned mail messages or information
about the attachments that were retrieved. (required) | +| results | string | No | | (create) The name of a variable that will contain the UID of the task that is created.
You use this value in the uid attribute of other actions to identify the task to be acted on. (optional) | +| uid | string | Yes | | A case-sensitive Exchange UID value that uniquely identifies the tasks on which to perform the action.
For the delete action, this attribute can be a comma delimited list of UID values.
The getAttachments and modify action allow only a single UID value. (optional) | +| result | string | No | | The name of a variable that contains the UID of the task that is created. You use this value in the uid attribute of other actions to identify the task to be acted on. | diff --git a/docs/tags/cfexecute.md b/docs/tags/cfexecute.md new file mode 100644 index 000000000..5142ca6e7 --- /dev/null +++ b/docs/tags/cfexecute.md @@ -0,0 +1,50 @@ +# cfexecute + +Executes a CFML developer-specified process on a server computer. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfexecute(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Absolute path of the application to execute.

On Windows, you must specify an extension; for example,
C:\myapp.exe. | +| arguments | any | No | | Command-line variables passed to application. If specified
as string, it is processed as follows:
* Windows: passed to process control subsystem for parsing.
* UNIX: tokenized into an array of arguments. The default
token separator is a space; you can delimit arguments
that have embedded spaces with double quotation marks.
If passed as array, it is processed as follows:
* Windows: elements are concatenated into a string of
tokens, separated by spaces. Passed to process control
subsystem for parsing.
* UNIX: elements are copied into an array of exec()
arguments | +| outputfile | string | No | | File to which to direct program output. If no outputfile or
variable attribute is specified, output is displayed on
the page from which it was called.

If not an absolute path (starting a with a drive letter and
a colon, or a forward or backward slash), it is relative
to the CFML temporary directory, which is returned
by the GetTempDirectory function. | +| variable | string | No | | Variable in which to put program output. If no outputfile
or variable attribute is specified, output is displayed on
page from which it was called. | +| timeout | numeric | No | 0 | Length of time, in seconds, that CFML waits for
output from the spawned program. | +| errorVariable | string | No | | The name of a variable in which to save the error stream output. | +| errorFile | string | No | | The pathname of a file in which to save the error stream output. If not an
absolute path (starting a with a drive letter and a colon, or a forward or backward slash), it is
relative to the ColdFusion temporary directory, which is returned by the GetTempDirectory
function. | +| terminateOnTimeout | boolean | No | false | Lucee4.5+ Terminate the process after the specified timeout is reached. Ignored if timeout is not set or is 0. | +| directory | string | No | | Lucee5.3.8+ The working directory in which to execute the command | + +## Script syntax + +If you want to execute a script (.sh,.cmd,.bat), use bash (linux) or cmd.exe (windows) as the command and the script as argument for the shell interpreter. + +```html +cfexecute( name="bash", arguments="/opt/jq.sh #cmdArgs#", variable="standardOut" , errorVariable="errorOut" , timeout="10"); +``` + +## Script syntax with terminateOnTimeout + +Printing a PDF using lpr + +```html +cfexecute( + name="lpr", + arguments="-P 'My Print Job Name' 'C:/Users/devguy/Documents/server/mynewfile.pdf'", + timeout="5", + terminateOnTimeout="true" + ); +``` diff --git a/docs/tags/cfexit.md b/docs/tags/cfexit.md new file mode 100644 index 000000000..6e969ec3f --- /dev/null +++ b/docs/tags/cfexit.md @@ -0,0 +1,42 @@ +# cfexit + +This tag aborts processing of the currently executing CFML + custom tag, exits the page within the currently executing CFML + custom tag, or re-executes a section of code within the + currently executing CFML custom tag. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +exit; +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| method | string | No | | exittag: aborts processing of currently executing tag
exittemplate: exits page of currently executing tag
loop: reexecutes body of currently executing tag | /Users/garethedwards/development/github/cfdocs/docs/tags/cfexit.md|loop | + +## Simple cfexit example + +Here the loop over the 5 number. When it's meet the condition as true then the block of code get exit. + +```html + + + + + + #i# + + + +``` + +### Expected Result: 1 2 diff --git a/docs/tags/cffeed.md b/docs/tags/cffeed.md new file mode 100644 index 000000000..93c7330ab --- /dev/null +++ b/docs/tags/cffeed.md @@ -0,0 +1,41 @@ +# cffeed + +Reads or creates an RSS or Atom syndication feed. + This tag can read RSS versions 0.90, 0.91, 0.92, 0.93, 0.94, 1.0, and 2.0, and Atom 0.3 or 1.0. + It can create RSS 2.0 or Atom 1.0 feeds. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cffeed(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | any | No | | The action to take, one of the following values:
"create" Creates an RSS 2.0 or Atom 1.0 feed XML document and saves it in a variable, writes it to a file, or both.
"read" Parses an RSS or Atom feed from a URL or an XML file and saves it in a structure or query.
You can also get query metadata in a separate structure. (optional, default= read) | +| columnMap | any | No | | Used only for the create action with a query attribute.
A structure specifying a mapping between the names of the columns in the object specified by the query attribute
and the columns of the ColdFusion feed format, as described in the Query attribute section.
The key for each field must be a column name listed in the Query columns section. The value of the field must be
the name of the corresponding column in the query object used as input to the create action. (optional) | +| enclosureDir | string | No | | Used only for the read action.
Path to the directory in which to save any enclosures that are available in the feed being read.
The path can be absolute or relative to the CFML file.
If the directory does not exist, ColdFusion generates an error.
If you omit this attribute, ColdFusion does not save enclosures.
To specify the directory that contains the current page, set this attribute to .(period). (optional) | +| ignoreEnclosureError | boolean | No | | If this attribute is true, ColdFusion attempts to save all enclosures.
If it encounters an error downloading one enclosure, it continues downloading other enclosures and writes the
error information in the server log.
If this attribute is false, ColdFusion stops downloading all enclosures and generates an error when it encounters
an error downloading an enclosure.
Note: Enclosure errors can occur if the specified enclosure is of a type that the web server does not allow to be
downloaded. (optional, default=false) | +| name | string | No | | A structure that contains complete feed data:
The output of a read action.
The input definition of the feed to create.
This structure contains complete feed information.
When you specify the name attribute for a create action, you must put it in pound signs (#). (optional) | +| outputFile | string | No | | Path of the file in which to write the feed as XML text.
The path can be absolute, or relative to the CFML file. (optional) | +| overwrite | boolean | No | | Whether to overwrite the XML feed file if it already exists.
If you do not set this attribute to true and the cffeed tag tries to write to a file that exists, ColdFusion
generates an error. (optional, default=false) | +| overwriteEnclosure | boolean | No | | Used only for the read action.
Whether to overwrite files in the enclosure directory if they already exist.
If you do not set this attribute to true and the cffeed tag tries to write to a file that exists, ColdFusion
generates an error. (optional, default=false) | +| properties | string | No | | A structure containing the feed metadata, the information about the entire feed.
Can contain either of the following:
The output of a read action.
Input to a create action.
The properties and query attributes combined provide complete feed information.
When you specify the properties attribute for a create action, you must put it in pound signs (#) (optional) | +| query | string | No | | A query object containing the Atom entries or RSS items in the feed. Can contain either of the following:
The output of a read action.
Input to a create action.
The properties and query attributes combined provide complete feed information.
When you specify the query attribute for a create action, you must put it in pound signs (#) (optional) | +| source | string | No | | Used only for the read action.
The URL of the feed or the path to the XML file that contains the feed contents.
A path can be absolute, or relative to the CFML file. (required) | +| timeout | numeric | No | | The number of seconds to wait for a response from the feed source. A value of 0 specifies that the request does not time out. | +| proxyServer | string | No | | Host name or IP address of a proxy server to which to send the request. | +| xmlvar | string | No | | A variable in which to save the read or created feed as XML text. | +| proxyPort | numeric | No | | The port to connect to on the proxy server. | +| proxyPassword | string | No | | Password required by the proxy server. | +| userAgent | string | No | | Text to put in the HTTP User-Agent request header field. Used to identify the request client software. | +| proxyUser | string | No | | User name to provide to the proxy server. | +| escapeChars | boolean | No | | Escapes invalid utf8 chars when set to true | diff --git a/docs/tags/cffile.md b/docs/tags/cffile.md new file mode 100644 index 000000000..62fdc8a10 --- /dev/null +++ b/docs/tags/cffile.md @@ -0,0 +1,208 @@ +# cffile + +Manages interactions with server files. + Different combinations cause different attributes to be + required. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +fileRead(path); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | Type of file manipulation that the tag performs. | +| file | string | No | | Pathname of the file. | +| mode | string | No | | Applies only to UNIX and Linux. Permissions. Octal values
of Unix chmod command. Assigned to owner, group, and
other, respectively. | +| output | string | No | | String to add to the file | +| addnewline | boolean | No | YES | Yes: appends newline character to text written to file | +| attributes | string | No | | Applies to Windows. A comma-delimited list of attributes
to set on the file.

If omitted, the file's attributes are maintained. | +| charset | string | No | | The character encoding in which the file contents is
encoded.

For more information on character encodings, see:
www.w3.org/International/O-charset.html. | +| source | string | No | | Pathname of the file (during copy). | +| destination | string | No | | Pathname of a directory or file on web server
(during copy). | +| variable | string | No | | Name of variable to contain contents of text file. | +| filefield | string | No | | Name of form field used to select the file.

Do not use pound signs (#) to specify the field name. | +| nameconflict | string | No | | Action to take if filename is the same as that of a file
in the directory. | +| accept | string | No | | Limits the MIME types to accept. Comma-delimited list. For
example, to permit JPG and Microsoft Word file uploads:

accept = "image/jpg, application/msword" | +| result | variableName | No | cffile | Allows you to specify a name for the variable in which cffile
returns the result (or status) parameters. If you do not specify
a value for this attribute, cffile uses the prefix "cffile". | +| fixnewline | string | No | NO | * Yes: changes embedded line-ending characters in string
variables to operating-system specific line endings
* No: (default) do not change embedded line-ending
characters in string variables. | +| cachedwithin | numeric | No | | Lucee5+ Timespan, using the CreateTimeSpan function. If original
file date falls within the time span, cached file data is
used. CreateTimeSpan defines a period from the present, back. | + +## Script Syntax - Write + +File Write + +```html +fileWrite(expandPath("./myFile.txt"), "Here's some content for my file."); +``` + +## Script Syntax - Append + +File Append - There is no fileAppend() so we access the file and use fileWriteLine() + +```html +myFile = fileOpen(expandPath("./myFile.txt"), "append"); + fileWriteLine(myFile, "Here's some new content."); + fileClose(myFile); +``` + +## Script Syntax - Read + +File Read + +```html +myFile = fileRead(expandPath("./myFile.txt")); +``` + +## Script Syntax - Read Binary + +File Read Binary + +```html +myImageBinary = fileReadBinary(expandPath("./myImage.jpg")); +``` + +## Script Syntax - Rename + +File Rename - Since there is no fileRename(), fileMove() works just as well + +```html +fileMove(expandPath("./myFile.txt"), expandPath("./myNewFileName.txt")); +``` + +## Script Syntax - Copy + +File Copy + +```html +fileCopy(expandPath("./myFile.txt"), expandPath("./some/other/path")); +``` + +## Script Syntax - Move + +File Move + +```html +fileMove(expandPath("./myFile.txt"), expandPath("./some/other/path")); +``` + +## Script Syntax - Delete + +File Delete + +```html +fileDelete(expandPath("./myFile.txt")); +``` + +## Script Syntax - Upload + +File Upload + +```html +fileUpload(getTempDirectory(), "form.myFile", " ", "makeunique"); +``` + +## Script Syntax - Upload All + +File Upload All + +```html +fileUploadAll(getTempDirectory(), " ", "makeunique"); +``` + +## Tag Syntax (action=write) + +Write the contents of a variable to a file. + +```html + +``` + +## Tag Syntax (action=append) + +Append content to the end of a file. + +```html + +``` + +## Tag Syntax (action=read) + +Read a file into a variable + +```html + +``` + +## Tag Syntax (action=readBinary) + +File Read Binary + +```html + +``` + +## Tag Syntax (action=rename) + +Rename a file + +```html + +``` + +## Tag Syntax (action=copy) + +Copy a file + +```html + +``` + +## Tag Syntax (action=move) + +Move a file + +```html + +``` + +## Tag Syntax (action=delete) + +Delete a file + +```html + +``` + +## Tag Syntax (action=upload) + +Upload the file contained in the myFile field. Always upload to a directory outside of the webroot, validate the file extension, file content and then only if necessary copy it back to the web root. + +```html + +``` + +## Tag Syntax (action=upload) with accept + +CF10+ Checks file extensions against a whitelist of allowed file extensions. You must set `strict=false` when specifying a file extension list. + +```html + +``` + +## Tag Syntax (action=uploadall) + +Upload all files in the form scope. + +```html + +``` diff --git a/docs/tags/cffileupload.md b/docs/tags/cffileupload.md new file mode 100644 index 000000000..98fed2bfc --- /dev/null +++ b/docs/tags/cffileupload.md @@ -0,0 +1,42 @@ +# cffileupload + +Ajax File upload + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cffileupload(url=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| url | string | Yes | | The URL to the server where the files are uploaded. | +| width | string | No | | Width of the file upload control, in pixels. | +| title | string | No | | Title for the upload dialog. | +| extensionfilter | string | No | | Use this attribute to specify the type of file that you will allow to be uploaded.
For example, to let only image files to be uploaded, you can specify file extensions like .jpg, .jpeg, or .png | +| uploadbuttonlabel | string | No | | Label of the Upload button. | +| progressbar | boolean | No | | Whether to display Progress Bar or not. Default true | +| height | string | No | | Height of the file upload control, in pixels. | +| maxUploadSize | numeric | No | | The maximum file size, in megabytes, allowed for the upload. Default 10MB. | +| maxFileSelect | string | No | | The maximum number of files allowed for the upload. | +| style | string | No | | A CSS style specification that defines layout styles | +| bgcolor | string | No | | The background color for the file upload control. A hexadecimal value without "#" prefixed. | +| addButtonLabel | string | No | | Label of the Add button | +| name | string | No | | Name of the file upload component. | +| oncomplete | string | No | | The JavaScript function to run after the file upload completes | +| onerror | string | No | | The JavaScript function to run on an error condition. The error can be a network error or server-side error | +| clearButtonLabel | string | No | | Label of the Clear button | +| deleteButtonLabel | string | No | | Label of the Delete button | +| align | string | No | | Specifies the default alignment | +| wmode | string | No | | Specifies the absolute positioning and layering capabilities in your browser: | +| stopOnError | boolean | No | | Specifies whether or not to ignore the exceptions for this operation. When the value is
true, it stops uploading, displays an appropriate error | +| hideUploadButton | boolean | No | | A Boolean value that specifies if the Upload button should appear in the media player | +| onUploadComplete | string | No | | The JavaScript function to run after the all uploads have completed | diff --git a/docs/tags/cffinally.md b/docs/tags/cffinally.md new file mode 100644 index 000000000..f1f6e7536 --- /dev/null +++ b/docs/tags/cffinally.md @@ -0,0 +1,52 @@ +# cffinally + +Used inside a cftry tag. Code in the cffinally block is processed after the main cftry code and, if an exception +occurs, the cfcatch code. The cffinally block code always executes, whether or not there is an exception. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +finally { } +``` + +## Script Syntax + +```html +try { + writeOutput('hello world
'); + throw(message='threw on purpose!'); +}catch(any e){ + writeOutput('Caught an exception
'); +}finally{ + writeOutput('Ran clean-up code regardless of error'); +} +``` + +### Expected Result: hello world +Caught an exception +Ran clean-up code regardless of error + +## Tag Syntax + +```html + + hello world
+ + + Caught an exception
+
+ + Ran clean-up code regardless of error + +
+``` + +### Expected Result: hello world +Caught an exception +Ran clean-up code regardless of error diff --git a/docs/tags/cfflush.md b/docs/tags/cfflush.md new file mode 100644 index 000000000..7eed9ae1a --- /dev/null +++ b/docs/tags/cfflush.md @@ -0,0 +1,42 @@ +# cfflush + +Flushes currently available data to the client. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfflush(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| interval | numeric | No | | Flushes output each time this number of bytes becomes
available. HTML headers, and data that is already
available when the tag is executed, are omitted from the
count. | + +## Simple Script Example + +Outputs 'foo' to the browser approximately 1 second before 'bar' + +```html +writeOutput( "
foo
" ); + cfflush(); + sleep( 1000 ); + writeOutput( "
bar
" ); +``` + +## Simple Tag Example + +Outputs 'foo' to the browser approximately 1 second before 'bar' + +```html +
foo
+ +
bar
+``` diff --git a/docs/tags/cfform.md b/docs/tags/cfform.md new file mode 100644 index 000000000..49a01066e --- /dev/null +++ b/docs/tags/cfform.md @@ -0,0 +1,45 @@ +# cfform + +Builds a form with CFML custom control tags; these provide + more functionality than standard HTML form input elements. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfform(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | No | | In HTML format, if you omit this attribute and specify
an id attribute, ColdFusion does not include a name
attribute in the HTML sent to the browser; this
behavior lets you use the cfform tag to create
XHTML-compliant forms. If you omit the name
attribute and the id attribute, ColdFusion generates
a name of the form CFForm_n where n is a number
that assigned serially to the forms on a page. | +| action | string | No | | Name of CFML page to execute when the form is
submitted for processing. | +| method | string | No | post | The method the browser uses to send the form data
to the server:
- post: Send the data using the HTTP post method,
This method sends the data in a separate message
to the server.
- get: Send the data using the HTTP get method,
which puts the form field contents in the URL
query string. | +| format | string | No | html | - `HTML`: Generate an HTML form and send it to the client.
- `Flash`: DEPRECATED in CF11+ Generate a Flash form and send it to the client. All controls are in Flash format.
- `XML`: DEPRECATED in CF11+ Generate XForms-compliant XML and save
the results in a variable specified by the name
attribute. By default, ColdFusion also applies an XSL skin and displays the result. | +| skin | string | No | | DEPRECATED in CF11+
`Flash`: Use a Macromedia halo color to stylize the output.
`XML`: Specifies whether to apply an XSL skin and
display the resulting HTML to the client. Can be any
of the following:
- ColdFusion MX skin name: Apply the specified skin.
- XSL file name: Apply the skin located in the specified path.
- "none": Do not apply an XSL skin. You must use XForms XML then.
- (omitted) or "default": Use the ColdFusion MX default skin. | +| preservedata | boolean | No | NO | When the cfform action attribute posts back to the same
page as the form, this determines whether to override the
control values with the submitted values.
- false: values specified in the control tag attributes are used
- true: corresponding submitted values are used | +| onload | string | No | | JavaScript to execute when the form loads. | +| onsubmit | string | No | | JavaScript or Actionscript function to execute to
preprocess data before form is submitted. If any
child tags specify onSubmit field validation, ColdFusion
does the validation before executing this JavaScript. | +| codebase | string | No | /CFIDE/classes/cf-j2re-win.cab | URL of downloadable JRE plug-in (for Internet Explorer only).
Default: /CFIDE/classes/cf-j2re-win.cab | +| archive | string | No | /CFIDE/classes/cfapplets.jar | URL of downloadable Java classes for CFML controls.
Default: /CFIDE/classes/cfapplets.jar | +| height | string | No | 100% | The height of the form. Use a number to specify
pixels, In Flash, you can use a percentage value to
specify a percentage of the available width. The
displayed height might be less than the specified size. | +| width | string | No | 100% | The width of the form. Use a number to specify
pixels, In Flash, you can use a percentage value to
specify a percentage of the available width. | +| onerror | string | No | | Applies only for onSubmit or onBlur validation; has
no effect for onServer validation. An ActionScript
expression or expressions to execute if the user
submits a form with one or more validation errors. | +| wmode | string | No | window | Specifies how the Flash form appears relative to
other displayable content that occupies the same
space on an HTML page.
- window: The Flash form is the topmost layer on the
page and obscures anything that would share the
space, such as drop-down dynamic HTML lists.
- transparent: The Flash form honors the z-index of
DHTML so you can float items above it. If the Flash
form is above any item, transparent regions in the
form show the content that is below it.
- opaque: The Flash form honors the z-index of
DHTML so you can float items above it. If the Flash
form is above any item, it blocks any content that is
below it.
Default is: window. | +| accessible | boolean | No | NO | Specifies whether to include support screen readers
in the Flash form. Screen reader support adds
approximately 80KB to the SWF file sent to the
client. Default is: false. | +| preloader | boolean | No | YES | Specifies whether to display a progress bar when
loading the Flash form. Default is: true. | +| timeout | numeric | No | | Integer number of seconds for which to keep the
form data in the Flash cache on the server. A value of
0 prevents the data from being cached. | +| scriptsrc | string | No | | Specifies the URL, relative to the web root, of the
directory that contains the cfform.js file with the
client-side JavaScript used by this tag and its child
tags. For XML format forms, this directory is also the
default directory for XSLT skins. | +| style | string | No | | Styles to apply to the form. In HTML or XML format,
ColdFusion passes the style attribute to the browser
or XML. In Flash format, must be a style specification
in CSS format. | +| onreset | string | No | | JavaScript to execute when the user clicks a reset button. | +| id | string | No | | HTML id passed through to
. | +| target | string | No | | Target window or frame passed through to . | +| passthrough | string | No | | DEPRECATED in CF7+ REMOVED in CF11+ Passes arbitrary attribute-value pairs to the HTML code
that is generated for the tag. You can use either of the
following formats:

passthrough="title=""myTitle"""
passthrough='title="mytitle"' | +| onsuccess | string | No | | Applies only to forms inside cfdiv, cflayout, cfpod, or cfwindow controls. The name of a JavaScript function that will run when an asynchronous form submission succeeds. | diff --git a/docs/tags/cfformgroup.md b/docs/tags/cfformgroup.md new file mode 100644 index 000000000..6a9b1fe15 --- /dev/null +++ b/docs/tags/cfformgroup.md @@ -0,0 +1,36 @@ +# cfformgroup + +Creates a container control for multiple form controls. + Used in the cfform tag body of Macromedia Flash and XML + forms. Ignored in HTML forms. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfformgroup(type="horizontal"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | | For XML forms can be any XForms group type defined in the XSLT.
For Flash see the value options and docs for more information. | +| query | query | No | | The query to use with the repeater. Flash creates an
instance of each of the cfformgroup tag's child tags for
each row in the query. You can use the bind attribute in
the child tags to use data from the query row for the
instance. | +| startrow | numeric | No | 0 | Used only for the repeater type; ignored otherwise.
Specifies the row number of the first row of the query to
use in the Flash form repeater. This attribute is zerobased:
the first row is row 0, not row 1 (as in most ColdFusion tags).
Default: 0 | +| maxrows | numeric | No | | Used only for for the repeater type; ignored otherwise.
Specifies the maximum number of query rows to use in
the Flash form repeater. If the query has more rows than
the sum of the startrow attribute and this value, the
repeater does not use the remaining rows. | +| label | string | No | | Label to apply to the form group. In Flash, does the following:
- For a page or panel form group, determines the label to
put on the corresponding accordion pleat, the tabnavigator tab,
or the panel title bar. For a Flash horizontal or vertical form
group, specifies the label to put to the left of the group.
- Ignored in Flash for repeater, hbox, hdividedbox, vbox,
vdividedbox, tile, accordion, and tabnavigator types. | +| id | string | No | | ID for form input element. | +| style | string | No | | Flash: A Flash style specification in CSS format.
XML: An inline CSS style specification. | +| selectedindex | numeric | No | | Used only for accordion and tabnavigator types; ignored
otherwise. Specifies the page control to display as open,
where 0 (not 1) specifies the first page control defined in
the group. | +| width | numeric | No | | Width of the group container, in pixels. If you omit this
attribute, Flash automatically sizes the container width.
Ignored for Flash repeater type. | +| height | numeric | No | | Height of the group container, in pixels. If you omit this
attribute, Flash automatically sizes the container height.
Ignored for Flash repeater type. | +| enabled | boolean | No | YES | Flash only: Boolean value specifying whether the controls in the
form group are enabled. Disabled controls appear in
light gray.
Default: true | +| visible | boolean | No | YES | Flash only: Boolean value specifying whether the controls in the
form group are visible. If the controls are invisible, the
space that would be occupied by visible controls is blank.
Default: true | +| onchange | string | No | | Flash only: tabnavigator and accordion types only: ActionScript
expression or expressions to execute when a new tab or
accordion page is selected. Note: The onChange event
occurs when the form first displays. | +| tooltip | string | No | | Flash only: Text to display when the mouse pointer hovers in the
form group area. If a control in the form group also
specifies a tooltip, Flash displays the control's tolltip
when the mouse pointer hovers over the control. | diff --git a/docs/tags/cfformitem.md b/docs/tags/cfformitem.md new file mode 100644 index 000000000..83995db20 --- /dev/null +++ b/docs/tags/cfformitem.md @@ -0,0 +1,30 @@ +# cfformitem + +Inserts a horizontal line, a vertical line, a spacer, + or text in a Flash form. Used in the cfform or cfformgroup + tag body for Flash and XML forms. Ignored in HTML forms. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfformitem(type="html"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | | Form item type. See docs for more details. | +| style | string | No | | Flash: Must be a style specification in CSS format.
Ignored if the type attribute is HTML or text.
XML: ColdFusion passes the style attribute to the XML.
ColdFusion skins include the style attribute to the
generated HTML. | +| width | numeric | No | | Width of the item, in pixels. If you omit this attribute, Flash
automatically sizes the width. In ColdFusion XSL skins,
use the style attribute, instead. | +| height | numeric | No | | Height of the item, in pixels. If you omit this attribute,
Flash automatically sizes the width. In ColdFusion XSL
skins, use the style attribute, instead. | +| enabled | boolean | No | YES | Boolean value specifying whether the control is enabled.
Disabled text appear in light gray. Has no effect on
spacers and rules.
Default: true | +| visible | boolean | No | YES | Boolean value specifying whether to show the control.
Space that would be occupied by an invisible control is
blank. Has no effect on spacers.
Default: true | +| tooltip | string | No | | Text to display when the mouse pointer hovers over the
control. Has no effect on spacers. | +| bind | string | No | | A Flash bind expression that populates the field with
information from other form fields. If you use this
attribute, ColdFusion MX ignores any text that you
specify in the body of the cftextitem tag. This attribute
can be useful if the cfformitem tag is in a cfformgroup
type="repeater" tag. | diff --git a/docs/tags/cfforward.md b/docs/tags/cfforward.md new file mode 100644 index 000000000..5fe9f4661 --- /dev/null +++ b/docs/tags/cfforward.md @@ -0,0 +1,33 @@ +# cfforward + +Leads the request to a different page. This tag acts like the tag cflocation except that the relocation is done directly on the server. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +cfforward( "page.cfm" ); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| template | string | Yes | | A logical path to a CFML page. | + +## Script Syntax + +```html +cfforward( "mypage.cfm" ); +``` + +## Tag Syntax + +```html + +``` diff --git a/docs/tags/cfftp.md b/docs/tags/cfftp.md new file mode 100644 index 000000000..72c603ce3 --- /dev/null +++ b/docs/tags/cfftp.md @@ -0,0 +1,88 @@ +# cfftp + +Lets users implement File Transfer Protocol (FTP) operations. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfftp(action="open"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| action | string | Yes | | FTP operation to perform.
open: create an FTP connection
close: terminate an FTP connection | /Users/garethedwards/development/github/cfdocs/docs/tags/cfftp.md|acct | +| username | string | No | | Overrides username specified in ODBC setup. | | +| password | string | No | | Overrides password specified in ODBC setup. | | +| server | string | No | | FTP server to which to connect; for example,
ftp.myserver.com | | +| timeout | numeric | No | 30 | Value in seconds for the timeout of all operations,
including individual data request operations. | | +| port | numeric | No | 21 | Remote port to which to connect | | +| connection | variableName | No | | Name of the FTP connection. If you specify the username,
password, and server attributes, and if no connection
exists for them, CFML creates one. Calls to cfftp
with the same connection name reuse the connection. | | +| proxyserver | string | No | | The proxy server required to access the URL. | | +| retrycount | numeric | No | 1 | Number of retries until failure is reported. | | +| stoponerror | boolean | No | NO | Yes: halts processing, displays an appropriate error.
No: populates the error variables | | +| passive | boolean | No | NO | Yes: enable passive mode | | +| transfermode | string | No | auto | ASCII FTP transfer mode
Binary FTP transfer mode
Auto FTP transfer mode | /Users/garethedwards/development/github/cfdocs/docs/tags/cfftp.md|binary | +| failifexists | boolean | No | YES | Yes: if a local file with same name exists, getFile fails | | +| directory | string | No | | Directory on which to perform an operation | | +| localfile | string | No | | Name of the file on the local file system | | +| remotefile | string | No | | Name of the file on the FTP server file system. | | +| item | string | No | | Object of these actions: file or directory. | | +| existing | string | No | | Current name of the file or directory on the remote server. | | +| new | string | No | | New name of file or directory on the remote server | | +| name | string | No | | Query name of directory listing. | | +| result | string | No | | Specifies a name for the structure in which cfftp
stores the returnValue variable. If set, this value
replaces cfftp as the prefix to use when accessing
returnVariable. | | +| attributes | string | No | | Attributes of the current element: normal or Directory. | | +| passphrase | string | No | | CF8+ Used when `key` is specified. Because private keys are stored in an encrypted form on the client host, the user must supply a passphrase to enable generating the signature. | | +| buffersize | numeric | No | | Buffer size in bytes. | | +| secure | string | No | NO | CF8+ `yes`: enables secure FTP | | +| asciiextensionlist | string | No | | Delimited list of file extensions that force ASCII
transfer mode, if transferMode = "auto". | | +| key | string | No | | CF8+ Public-key-based authentication. Refers to the absolute path to the private key of the user.
Possession of a private key provides authentication by sending a signature created with a private key.
The server must ensure that the key is a valid authentication for the user and that the signature is valid.
Both must be valid to accept the authentication. | | +| actionparam | string | No | | Used only when action is quote, site, or acct. Specifies the command when action is quote or site; specifies account information when action is acct. | | +| fingerprint | string | No | | CF8+ Fingerprint of the host key in the form ssh-dss.ssh-rsa, which is a 16-byte unique identifier for the server attribute that you specify. | | +| systemtype | string | No | | CF11.0.3+ Specifies how to parse file list response, specify `WINDOWS` or `UNIX` or a class which implements `org.apache.commons.net.ftp.FTPFileEntryParser` | /Users/garethedwards/development/github/cfdocs/docs/tags/cfftp.md|UNIX | + +## Script Syntax + +CF9+ using the CFIDE script components + +```html +// Create FTP service and set attributes for connection + ftpService = new ftp(); + ftpService.setConnection("myConn"); + ftpService.setUsername("myUName"); + ftpService.setPassword("myPW"); + ftpService.setServer("ftp.server.com"); + ftpService.setStopOnError(true); + // Open connection + ftpService.open(); + // Get list of dir + fileList = ftpService.listdir(directory = "/ ", name="fileList", stopOnError = true).getResult(); + // Close connection + ftpService.close(); +``` + +## Open Connection + +```html + +``` + +## Get List of Directories + +```html + +``` + +## Close Connection + +```html + +``` diff --git a/docs/tags/cffunction.md b/docs/tags/cffunction.md new file mode 100644 index 000000000..43d7a18b8 --- /dev/null +++ b/docs/tags/cffunction.md @@ -0,0 +1,68 @@ +# cffunction + +Defines a function that you can call in CFML. Required to + defined CFML component methods. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +public boolean function myFunction(required any myArgument) { } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | A string; a component method that is used within the cfcomponent tag. | | +| returntype | string | No | any | String; a type name; data type of the function return value. Required for a web service; optional otherwise. | /Users/garethedwards/development/github/cfdocs/docs/tags/cffunction.md|(component name) | +| roles | string | No | | A comma-delimited list of CFML security roles that can invoke the method. Only users who are logged in with the specified roles can execute the function. If this attribute is omitted, all users can invoke the method. | | +| access | string | No | public | The client security context from which the method can be invoked.

private: Available only to the component that declares the method and any components that extend the component in which it is defined.

package: Available only to the component that declares the method, components that extend the component, or any other components in the package.

public: Available to a locally executing page or component method.

remote: Available to a locally or remotely executing page or component method, or a remote client through a URL, Flash, or a web service. To publish the function as a web service, this option is required. | /Users/garethedwards/development/github/cfdocs/docs/tags/cffunction.md|remote | +| output | boolean | No | | Specifies under which conditions the function can generate HTML output. | | +| displayname | string | No | | Meaningful only for CFC method parameters. A value to be displayed in parentheses following the function name when using introspection to show information about the CFC. | | +| hint | string | No | | Meaningful only for CFC method parameters. Text to be displayed when using introspection to show information about the CFC. The hint attribute value follows the syntax line in the function description. | | +| description | string | No | | Supplies a short text description of the function. | | +| returnformat | string | No | | CF8+ The format in which to return values to a remote caller. | /Users/garethedwards/development/github/cfdocs/docs/tags/cffunction.md|WDDX | +| securejson | boolean | No | | CF8+ A Boolean value that specifies whether to add a security prefix in front of any value that the function returns in JSON-format in response to a remote call. | | +| verifyclient | boolean | No | | CF8+ A Boolean value that specifies whether to require remote function calls to include an encrypted security token. For use with ColdFusion AJAX applications only. | | +| restPath | string | No | | CF10+ Specify to use a sub-resource path for the CFC. The path is case-sensitive. Also, it is preferable to avoid special characters when you specify the path. You can include regular expressions in the path. For details of the expressions that you can specify, see the attribute restPath in cfcomponent. | | +| httpMethod | string | No | | CF10+ The HTTP method to use; must be one of the following.

GET: Requests information from the server. Any data that the server requires to identify the requested information must be in the URL or in `cfhttp type="URL"` tag.

POST: Sends information to the server for processing. Requires one or more cfhttpparam tags. Often used for submitting form-like data.

PUT: Requests the server to store the message body at the specified URL. Use this method to send files to the server.

DELETE: Requests the server to delete the specified URL.

HEAD: Identical to the GET method, but the server does not send a message body in the response. Use this method for testing hypertext links for validity and accessibility, determining the type or modification time of a document, or determining the type of server. If you have not specified HEAD, by default, GET method is called. However, message body is not sent in the response.

OPTIONS: A request for information about the communication options available for the server or the specified URL. This method enables the ColdFusion application to determine the options and requirements associated with a URL, or the capabilities of a server, without requesting any additional activity by the server. If you have not specified OPTIONS, then ColdFusion sends a response. Overrides the value that you specify at component level. | /Users/garethedwards/development/github/cfdocs/docs/tags/cffunction.md|options | +| produces | string | No | | CF10+ Comma-separated list of acceptable MIME types. Used to specify the MIME media type of representation a resource can produce, for example, {{produces="text/plain,text/html"}}. If a resource can produce more than one MIME media type, the function chosen corresponds to the most acceptable media type as declared by the client. If no value is specified, / is taken by default, which means, all MIME types are consumed. Overrides the value that you specify at the component level.

**Note**
If MIME type is a wildcard, the results include any value. For example, if you make a HTTP call with produces as '*/xml' and follow it up with a second HTTP call with produces as '*/json', the results in the second HTTP call might include the first call result as well. | | +| consumes | string | No | | CF10+ Comma-separated list of acceptable MIME types, for example consumes="text/plain,text/html". Used to specify which MIME media types of representation a resource can accept, or consume, from the client. This attribute overrides the same attribute at the component level. If no value is specified, / is taken by default, which means, all MIME types are consumed. Adobe recommends that you avoid conflict scenarios while specifying the attributes produces and consumes. For example, avoid situations such as the following: In function 1, you specify produces as text/xml and consumes as text/ and in function 2, produces as text/ and consumes as text/xml. Here, both the functions are valid for the request with accept = text/xml and consumes as text/xml. | | +| localmode | string | No | classic | Lucee4.5+ Defines how the local scope of this function is invoked when a variable with no scope definition is used. Accepted values include:

classic (default): The local scope is only invoked when the key already exists in it (also aliased as `false`).

modern: The local scope is always invoked (also aliased as `true`). | /Users/garethedwards/development/github/cfdocs/docs/tags/cffunction.md|modern | +| cachedwithin | numeric | No | | Lucee4.5+ possible values are: String "request": If original content was created within the current request, cached content data is used. a timespan (created with function CreateTimeSpan): If original content date falls within the time span, cached content data is used.

To use cached data, the function must be called with the exact same arguments. | | +| modifier | string | No | | Lucee5+ used to denote a function as `abstract` (implementation must be defined in extended component), `static` (does not access instance variables in the component) or `final` (implementation cannot be extended) | /Users/garethedwards/development/github/cfdocs/docs/tags/cffunction.md|static | + +## Script Syntax + +```html +public boolean function myFunction(required any myArgument) { + // Some function bits + return true; + } +``` + +## Tag Syntax + +```html + + + + + +``` + +## Script Syntax: Arrow Function + +Note that as of now, you cannot declare the access or returntype of an arrow function + +```html +myFunction = (required any Arguments) => { + return true; +} +``` diff --git a/docs/tags/cfgrid.md b/docs/tags/cfgrid.md new file mode 100644 index 000000000..824077aec --- /dev/null +++ b/docs/tags/cfgrid.md @@ -0,0 +1,106 @@ +# cfgrid + +Used within the cfform tag. Puts a grid control (a table of + data) in a CFML form. To specify grid columns and row + data, use the cfgridcolumn and cfgridrow tags, or use the + query attribute, with or without cfgridcolumn tags. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfgrid(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name of grid element. | +| bind | string | No | | A bind expression specifying used to fill the
contents of the grid. Cannot be used with the
query attribute. | +| pagesize | numeric | No | | The number of rows to display per page for a
dynamic grid. If the number of available rows
exceeds the page size, the grid displays only
the specified number of entries on a single
page, and the user navigates between pages
to show all data. The grid retrieves data for
each page only when it is required for display.
This attribute is ignored if you specify a query
attribute. | +| striperowcolor | string | No | | The color to use for one of the alternating
stripes. The bgColor setting determines the
other color | +| preservepageonsort | boolean | No | YES | Specifies whether to display the page with
the current page number, or display page 1,
after sorting (or resorting) the grid | +| striperows | boolean | No | YES | Specifies whether to display the page with
the current page number, or display page 1,
after sorting (or resorting) the grid | +| format | string | No | applet | - applet: generates a Java applet.
- Flash: generates a Flash grid control.
- xml: generates an XMLrepresentation of the grid.
In XML format forms, includes the generated XML in the form.
In HTML format forms, puts the XML in a string variable
with the name specified by the name attribute.
Default: applet | +| height | numeric | No | 300 | Control's height, in pixels.
Default for applet: 300 | +| width | numeric | No | | Control's width, in pixels.
Default for applet: 300 | +| autowidth | boolean | No | NO | Yes: sets column widths so that all columns display within
grid width.
No: sets columns to equal widths. User can resize columns.
Horizontal scroll bars are not available, because if
you specify a column width and set autoWidth = "Yes",
CFML sets to this width, if possible | +| vspace | numeric | No | | Vertical margin above and below control, in pixels. | +| hspace | numeric | No | | Horizontal spacing to left and right of control, in pixels. | +| align | string | No | | Alignment of the grid cell contents | +| query | query | No | | Name of query associated with grid control. | +| insert | boolean | No | NO | User can insert row data in grid.
Takes effect only if selectmode="edit" | +| delete | boolean | No | NO | User can delete row data from grid.
Takes effect only if selectmode="edit" | +| sort | boolean | No | NO | The sort button performs simple text sort on column. User
can sort columns by clicking column head or by clicking
sort buttons. Not valid with selectmode=browse.

Yes: sort buttons display on grid control | +| font | string | No | arial | Font of data in column. | +| fontsize | numeric | No | | Size of text in column. | +| italic | boolean | No | NO | Yes: displays grid control text in italics | +| bold | boolean | No | NO | Yes: displays grid control text in bold | +| textcolor | string | No | black | Text color for control. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | +| href | string | No | | URL or query column name that contains a URL to hyperlink
each grid column with. | +| hrefkey | string | No | | The query column to use for the value appended to the href
URL of each column, instead of the column's value. | +| target | string | No | | Frame in which to open link specified in href. | +| appendkey | boolean | No | YES | When used with href, passes CFTREEITEMKEY variable
with the value of the selected tree item in URL to the
application page specified in the cfform action
attribute | +| highlighthref | boolean | No | YES | Yes: Highlights links that are associated with a cftreeitem
with a URL attribute value.
No: Disables highlight. | +| onvalidate | string | No | | JavaScript function to validate user input. The form object,
input object, and input object value are passed to the
specified routine, which should return True if validation
succeeds; False, otherwise. | +| onerror | string | No | | JavaScript function to execute if validation fails. | +| griddataalign | string | No | left | Left: left-aligns data within column.
Right: right-aligns data within column.
Center: center-aligns data within column. | +| gridlines | boolean | No | YES | Yes: enables row and column rules in grid control | +| rowheight | numeric | No | | Minimum row height, in pixels, of grid control. Used with
cfgridcolumn type = "Image"; defines space for graphics to
display in row. | +| rowheaders | boolean | No | YES | Yes: displays a column of numeric row labels in grid
control | +| rowheaderalign | string | No | left | Left: left-aligns data within row header
Right: right-aligns data within row header
Center: center-aligns data within row header | +| rowheaderfont | string | No | | Font of data in column. | +| rowheaderfontsize | numeric | No | | Size of text in column. | +| rowheaderitalic | boolean | No | NO | Yes: displays grid control text in italics | +| rowheaderbold | boolean | No | NO | Yes: displays grid control text in bold | +| rowheadertextcolor | string | No | black | Text color for control. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | +| colheaders | boolean | No | YES | Yes: displays a column of numeric row labels in grid
control | +| colheaderalign | string | No | left | Left: left-aligns data within row header
Right: right-aligns data within row header
Center: center-aligns data within row header | +| colheaderfont | string | No | | Font of data in column. | +| colheaderfontsize | numeric | No | | Size of text in column. | +| colheaderitalic | boolean | No | NO | Yes: displays grid control text in italics | +| colheaderbold | boolean | No | NO | Yes: displays grid control text in bold | +| colheadertextcolor | string | No | | Text color for control. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | +| bgcolor | string | No | | Background color of grid control. | +| selectcolor | string | No | | Background color for a selected item. | +| selectmode | string | No | | Selection mode for items in the control.
- Edit: user can edit grid data. Selecting a cell opens
the editor for the cell type.
- Row: user selections automatically extend to the row
that contains selected cell.
- Single: user selections are limited to selected cell.
(Applet only)
- Column: user selections automatically extend
to column that contains selected cell. (Applet only)
- Browse: user can only browse grid data. (Applet only) | +| maxrows | numeric | No | | Maximum number of rows to display in grid. | +| notsupported | string | No | Browser must support Java to
view ColdFusion Java Applets!
| Text to display if a page that contains a Java applet-based
cfform control is opened by a browser that does not
support Java or has Java support disabled. | +| picturebar | boolean | No | NO | Yes: images for Insert, Delete, Sort buttons | +| insertbutton | string | No | | Text for the insert button. Takes effect only if
selectmode="edit". | +| deletebutton | string | No | | Text of Delete button text. Takes effect only if
selectmode="edit". | +| sortascendingbutton | string | No | | Sort button text | +| sortdescendingbutton | string | No | | Sort button text | +| style | string | No | | Flash only: Must be a style specification in CSS format.
Ignored for type="text". | +| enabled | boolean | No | YES | Flash only: Boolean value specifying
whether the control is enabled. A disabled
control appears in light gray.
Default: true | +| visible | boolean | No | YES | Flash only: Boolean value specifying
whether to show the control. Space that would
be occupied by an invisible control is blank.
Default: true | +| tooltip | string | No | | Flash only: text to display when the
mouse pointer hovers over the control. | +| onchange | string | No | | Flash only: ActionScript to run when the control changes
due to user action in the control. | +| bindonload | boolean | No | YES | * yes: executes the bind attribute expression when first loading the form.
* no: does not execute the bind attribute expression until the first bound event.
Ignored if there is no bind attribute. | +| selectonload | boolean | No | YES | * yes: selects the first row of the grid when the grid loads.
* no: does not select any rows when the grid loads. | +| onblur | string | No | | ActionScript that runs when the grid loses focus. | +| onfocus | string | No | | ActionScript that runs when the grid gets focus. | +| collapsible | boolean | No | | A Boolean value specifying whether the user can collapse the entire grid by clicking an arrow on the title bar. | +| groupfield | string | No | | Puts the grid rows into groups, organized by the column specified in this attribute. Each group is collapsible and has a header with the column name, group field value, and number of entries in the group. | +| onLoad | string | No | | Java Script function that gets called when a grid is loaded for first time | + +## Most basic cfgrid, without using a query + +The CFgrid and related tags offer a LOT of capability and many options, but if you just need a very simple demonstration of a working grid, here you go. + +```html + + + + + + +``` + +### Expected Result: A single-column grid diff --git a/docs/tags/cfgridcolumn.md b/docs/tags/cfgridcolumn.md new file mode 100644 index 000000000..b4fd604c8 --- /dev/null +++ b/docs/tags/cfgridcolumn.md @@ -0,0 +1,51 @@ +# cfgridcolumn + +Used with the cfgrid tag in a cfform. Use this tag to specify + column data in a cfgrid control. The font and alignment + attributes used in cfgridcolumn override global font or + alignment settings defined in cfgrid. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfgridcolumn(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name of grid column element. If grid uses a query, column
name must specify name of a query column. | +| header | string | No | | Column header text. Used only if cfgrid colHeaders = "Yes". | +| width | numeric | No | | Column width, in pixels. | +| font | string | No | arial | Font of data in column. | +| fontsize | numeric | No | | Size of text in column. | +| italic | boolean | No | NO | Yes: displays grid control text in italics | +| bold | boolean | No | NO | Yes: displays grid control text in bold | +| bgcolor | string | No | | Background color of control. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | +| textcolor | string | No | | Text color for control. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | +| href | string | No | | URL or query column name that contains a URL to hyperlink
each grid column with. | +| hrefkey | string | No | | The query column to use for the value appended to the href
URL of each column, instead of the column's value. | +| target | string | No | | Frame in which to open link specified in href. | +| select | boolean | No | | Yes: user can select the column in grid control. | +| display | boolean | No | | No: hides column | +| type | string | No | | image: grid displays image that corresponds to value in
column (a built-in CFML image name, or an image in
cfide\classes directory or subdirectory referenced with
relative URL). If image is larger than column cell, it is
clipped to fit. Built-in image names | +| headerfont | string | No | | Font of data in column. | +| headerfontsize | numeric | No | | Size of text in column. | +| headeritalic | boolean | No | | Yes: displays grid control text in italics | +| headerbold | boolean | No | | Yes: displays grid control text in bold | +| headertextcolor | string | No | | Text color for control. For a hex value, use the form:
textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
signs or none. | +| dataalign | string | No | | Column data alignment | +| headeralign | string | No | | Column header text alignment | +| numberformat | string | No | | Format for displaying numeric data in grid. See
numberFormat mask characters. | +| values | string | No | | Formats cells in column as drop-down list boxes; specify
items in drop-down list. Example:
values = "arthur, scott, charles, 1-20, mabel" | +| valuesdisplay | string | No | | Maps elements in values attribute to string to display in
drop-down list. Delimited strings and/or numeric range(s). | +| valuesdelimiter | string | No | | Maps elements in values attribute to string to display in
drop-down list. Delimited strings and/or numeric range(s). | +| mask | string | No | | A mask pattern that controls the character pattern
that the form displays or allows users to input and
sends to ColdFusion.
For currency type data, use currency symbol.
For text or numeric type data use:
- A = [A-Za-z]
- X = [A-Za-z0-9]
- 9 = [0-9]
- ? = Any character
- all other = the literal character
For date type data use `Ext.Date` masks. | +| headerIcon | string | No | | Header Icon for grid column | diff --git a/docs/tags/cfgridrow.md b/docs/tags/cfgridrow.md new file mode 100644 index 000000000..6f53c6e5f --- /dev/null +++ b/docs/tags/cfgridrow.md @@ -0,0 +1,24 @@ +# cfgridrow + +Lets you define a cfgrid that does not use a query as source + for row data. If a query attribute is specified in cfgrid, the + cfgridrow tags are ignored. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfgridrow(data=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| data | string | Yes | | Delimited list of column values. If a value contains a
comma, it must be escaped with another comma | +| delimiter | string | No | | Delimiter to be used for data | diff --git a/docs/tags/cfgridupdate.md b/docs/tags/cfgridupdate.md new file mode 100644 index 000000000..e19b3ec64 --- /dev/null +++ b/docs/tags/cfgridupdate.md @@ -0,0 +1,34 @@ +# cfgridupdate + +Used within a cfgrid tag. Updates data sources directly from + edited grid data. This tag provides a direct interface with + your data source. + + This tag applies delete row actions first, then insert row + actions, then update row actions. If it encounters an error, + it stops processing rows. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfgridupdate(grid="", datasource="", tablename=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| grid | string | Yes | | Name of cfgrid form element that is the source for the
update action. | +| datasource | string | Yes | | Name of data source for the update action. | +| tablename | string | Yes | | Table in which to insert form fields.

ORACLE drivers: must be uppercase.
Sybase driver: case-sensitive. Must be the same case used
when table was created | +| username | string | No | | Overrides username specified in ODBC setup. | +| password | string | No | | Overrides password specified in ODBC setup. | +| tableowner | string | No | | Table owner, if supported. | +| tablequalifier | string | No | | For data sources that support table qualifiers, use this
field to specify qualifier for table. The purpose of table
qualifiers varies among drivers. For SQL Server and
Oracle, qualifier refers to name of database that contains
table. For Intersolv dBASE driver, qualifier refers to
directory where DBF files are located. | +| keyonly | boolean | No | | Applies to the update action:
Yes: the WHERE criteria are limited to the key values
No: the WHERE criteria include key values and the original
values of changed fields | diff --git a/docs/tags/cfheader.md b/docs/tags/cfheader.md new file mode 100644 index 000000000..d185914f8 --- /dev/null +++ b/docs/tags/cfheader.md @@ -0,0 +1,52 @@ +# cfheader + +Generates custom HTTP response headers to return to the client. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfheader(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | No | | Header name
Required if statusCode not specified | +| value | string | No | | HTTP header value | +| charset | string | No | | The character encoding in which to encode the header value.

For more information on character encodings, see:
www.w3.org/International/O-charset.html. | +| statuscode | numeric | No | | HTTP status code
Required if name not specified | +| statustext | string | No | | Explains status code | + +## Set a HTTP Response Header + +Use cfheader to return a Content-Security-Policy HTTP response header. + +```html + +``` + +## Return a Custom Status Code and Status Text + +Uses cfheader to return a 405 Method Not Allowed status when method is not POST. + +```html + + + Sorry POST only. + +``` + +## Content-Type header in CFScript + +CFScript syntax to return a JSON content type header. + +```html +cfheader( name="Content-Type", value="application/json" ) +``` diff --git a/docs/tags/cfhtmlbody.md b/docs/tags/cfhtmlbody.md new file mode 100644 index 000000000..a57a4dd18 --- /dev/null +++ b/docs/tags/cfhtmlbody.md @@ -0,0 +1,58 @@ +# cfhtmlbody + +Writes the text specified in the text attribute to the 'body' section of a generated HTML page. The cfhtmlbody tag can be useful for embedding JavaScript code, or placing other HTML tags that should go at the bottom of the page just before the closing body tag. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +cfhtmlbody() {} +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | No | append | possible actions are:
append (default): append text to the HTML body
read: return the text already set to HTML body
reset: reset/remove text already set to HTML body
write: write text to HTML body, overwrite already existing text in HTML head
flush: writes the buffer in the HTML head to the response stream | +| variable | string | No | | Name of variable to contain the text for HTML body. | +| id | string | No | | ID of the snippet that is added, used to ensure that the same snippet will not be added more than once. | +| text | string | No | | The text to add to the 'body' area of an HTML page. Alternatively if a closing tag is used then the body between the tags is used. | +| force | boolean | No | | if set to true, it works even within a silent block | + +## Tag wrap + +Lucee tag wrap + +```html +

Hello World

+``` + +## Attribute version + +```html +'> +``` + +## Using cfhtmlbody in cfscript + +```html +cfhtmlbody( text='

Hello World

'); +``` + +## Other actions + +Overwriting, reading, flushing + +```html +

Overwrite Body Buffer

+ +#body# + +

New Body

+ +``` diff --git a/docs/tags/cfhtmlhead.md b/docs/tags/cfhtmlhead.md new file mode 100644 index 000000000..43364b803 --- /dev/null +++ b/docs/tags/cfhtmlhead.md @@ -0,0 +1,52 @@ +# cfhtmlhead + +Writes text to the head section of a generated HTML page. It is + useful for embedding JavaScript code, or putting other HTML + tags, such as meta, link, title, or base in an HTML page + header. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +cfhtmlhead() {} +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| text | string | No | | Text to add to the head area of an HTML page. In Lucee a closing tag can be used and then the body between the tags is added to the head | + +## Add RSS feed link to the HTML head section + +```html + +``` + +## Using cfhtmlhead in cfscript + +```html +cfhtmlhead( text=''); +``` + +## Script syntax alternative + +Lucee4.2+ + +```html +htmlhead text=''; +``` + +## Lucee tag wrap alternative + +Lucee tag wrap + +```html + +``` diff --git a/docs/tags/cfhtmltopdf.md b/docs/tags/cfhtmltopdf.md new file mode 100644 index 000000000..f7d76f363 --- /dev/null +++ b/docs/tags/cfhtmltopdf.md @@ -0,0 +1,86 @@ +# cfhtmltopdf + +Creates PDFs from HTML using a WebKit based rendering engine. + +### Syntax + +```html +html +``` + +### Script Syntax + +```javascript +cfhtmltopdf() { writeOutput(html); }; +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| encryption | string | No | none | | +| source | string | No | | A URL of the source HTML document to use instead of providing content directly. | +| destination | string | No | | Pathname of a file to contain the PDF output. If you omit the destination attribute, ColdFusion displays the output in the browser. | +| marginBottom | numeric | No | | Bottom margin in inches or cm based on unit attribute | +| marginTop | numeric | No | | Top margin in inches or cm based on unit attribute | +| marginLeft | numeric | No | | Left margin in inches or cm based on unit attribute | +| marginRight | numeric | No | | Right margin in inches or cm based on unit attribute | +| name | variableName | No | | Name of an existing variable into which the tag stores the PDF. | +| orientation | string | No | portrait | | +| overwrite | string | No | no | Specifies whether ColdFusion overwrites an existing file. Used in conjunction with the destination attribute. | +| ownerPassword | string | No | | Specifies the owner password. Cannot be same as userPassword. | +| userPassword | string | No | | Specifies a user password. Cannot be same as ownerPassword. | +| permissions | string | No | | Separate multiple permissions with commas. | +| pageType | string | No | letter | Provide a type with standard dimensions or indicate custom to define your own | +| pageWidth | numeric | No | | Only valid if pagetype=custom. based on unit attribute | +| pageHeight | numeric | No | | Only valid if pagetype=custom. based on unit attribute | +| saveAsName | string | No | | The filename that appears in the SaveAs dialog when a user saves a PDF file written to the browser. | +| unit | string | No | in | Default unit for the pageHeight, pageWidth, and margin attributes: | +| language | string | No | English | CF2016+ Document language | + +## Basic Usage + +Put HTML inside the tags to render it as a PDF. When the destination attribute is omitted the pdf is sent back to the browser. + +```html + +

Hello World

+
+``` + +## External Source + +Use the source attribute to specify an external url. + +```html + + +``` + +## Set Margins + +Uses the margintop, marginbottom, marginleft, marginright to set the page margins + +```html + + +``` + +## Protect PDF + +Uses the ownerpassword, encryption, and permissions attributes to produce a password encrypted pdf. + +```html + + +``` diff --git a/docs/tags/cfhtmltopdfitem.md b/docs/tags/cfhtmltopdfitem.md new file mode 100644 index 000000000..998a86aa9 --- /dev/null +++ b/docs/tags/cfhtmltopdfitem.md @@ -0,0 +1,49 @@ +# cfhtmltopdfitem + +Header Footer PageBreak subdefinition for cfhtmltopdf. + +You can access the following scope variables in content: + +_PAGENUMBER – Add current page number. +_LASTPAGENUMBER – Add last page number. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfhtmltopdfitem(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | | Specifies the action:

header: uses the text/image specified between the and tags as the running header.
footer: uses the text/image between the and tags as the running footer.
pagebreak: can be used to insert a pagebreak in the generated PDF. When is used as a service, pagebreak will not work. | +| isBase64 | boolean | No | | Use this only when the image attribute is given a base64 image string | +| image | string | No | | The image file name or object to be used as header or footer.

The following parameters are supported:

A path to the image file
A Base-64 string
A byte array
A object | +| opacity | numeric | No | 10 | Opacity of the header/footer. Specify a valid number. A number between 1 and 10. | +| numberformat | string | No | Numeric | The page number format to be used. | +| showonprint | boolean | No | | Show or hide header/footer when the document is printed. | +| align | string | No | Center | Alignment of the text. Left, Right, or Center. | +| leftmargin | numeric | No | 1.0 | Left margin in inches (default) or centimeters. To specify the left margin in centimeters, include the unit=cm attribute. | +| rightmargin | numeric | No | 1.0 | Right margin in inches (default) or centimeters. To specify the left margin in centimeters, include the unit=cm attribute. | +| topmargin | numeric | No | 0.5 | Top margin in inches (default) or centimeters. To specify the left margin in centimeters, include the unit=cm attribute. | +| bottommargin | numeric | No | 0.5 | Bottom margin in inches (default) or centimeters. To specify the bottom margin in centimeters, include the unit=cm attribute. | + +## Adobe Example + +```html + + + Page: _PAGENUMBER of _LASTPAGENUMBER + + + + + +``` diff --git a/docs/tags/cfhttp.md b/docs/tags/cfhttp.md new file mode 100644 index 000000000..07172f17b --- /dev/null +++ b/docs/tags/cfhttp.md @@ -0,0 +1,89 @@ +# cfhttp + +Generates an HTTP request and parses the response from the server into a structure. The result structure has the following keys: +`statusCode` : The HTTP response code and reason string. +`fileContent` : The body of the HTTP response. Usually a string, but could also be a Byte Array. +`responseHeader` : A structure of response headers, the keys are header names and the values are either the header value or an array of values if multiple headers with the same name exist. +`errorDetail` : An error message if applicable. +`mimeType` : The mime type returned in the Content-Type response header. +`text` : a boolean indicating if the response body is text or binary. +`charset` : The character set returned in the Content-Type header. +`header` : All the http response headers as a single string. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfhttp(url=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| url | string | Yes | | Address of the resource on the server which will handle
the request. The URL must include the hostname or IP
address.

If you do not specify the transaction protocol (http:// or
https://), CFML defaults to http.

If you specify a port number in this attribute, it
overrides any port attribute value.

The cfhttpparam tag URL attribute appends query string
attribute-value pairs to the URL. | +| port | numeric | No | 80/443 | Port number on the server to which to send the request.
A port value in the url attribute overrides this value.
Defaults to standard for either http or https | +| method | string | No | get | * GET Requests information from the server. Any data that
the server requires to identify the requested
information must be in the URL or in cfhttp type="URL"
tags.
* POST Sends information to the server for processing.
Requires one or more cfhttpparam tags. Often used for
submitting form-like data.
* PUT Requests the server to store the message body at the
specified URL. Use this method to send files to the
server.
* DELETE Requests the server to delete the specified URL.
* HEAD Identical to the GET method, but the server does
not send a message body in the response. Use this
method for testing hypertext links for validity and
accessibility, determining the type or modification
time of a document, or determining the type of server.
* TRACE Requests that the server echo the received HTTP
headers back to the sender in the response body. Trace
requests cannot have bodies. This method enables the
CFML application to see what is being received
at the server and use that data for testing or
diagnostic information.
* OPTIONS A request for information about the
communication options available for the server or the
specified URL. This method enables the CFML
application to determine the options and requirements
associated with a URL, or the capabilities of a server,
without requesting any additional activity by the
server.
* PATCH: requests partial updates to the requested entity at the specified URL. Use this method to modify parts of the resource whereas use PUT method to completely replace the resource at the specified URL. CF11+ | +| proxyserver | string | No | | The proxy server required to access the URL. | +| proxyport | numeric | No | 80 | The port to use on the proxy server. | +| proxyuser | string | No | | The user ID to send to the proxy server. | +| proxypassword | string | No | | The user's password on the proxy server. | +| username | string | No | | A username. May be required by server. | +| password | string | No | | A password. May be required by server | +| useragent | string | No | ColdFusion | Text to put in the user agent request header. Used to
identify the request client software. Can make the
CFML application appear to be a browser. | +| charset | string | No | | The character encoding of the request, including the URL
query string and form or file data, and the response.

For more information on character encodings, see:
www.w3.org/International/O-charset.html. | +| resolveurl | boolean | No | NO | No does not resolve URLs in the response body. As a result,
any relative URL links in the response body do not work.
Yes resolves URLs in the response body to absolute URLs,
including the port number, so that links in a retrieved
page remain functional. | +| throwonerror | boolean | No | YES | Yes if the server returns an error response code, throws
an exception that can be caught using the cftry and
cfcatch or CFML error pages.
No does not throw an exception if an error response is
returned. In this case, your application can use the
cfhttp.StatusCode variable to determine if there was
an error and its cause. | +| redirect | boolean | No | YES | If the response header includes a Location field,
determines whether to redirect execution to the URL
specified in the field. | +| timeout | numeric | No | | Value, in seconds of the maximum time the request can take.
If the timeout passes without a response, CFML
considers the request to have failed. | +| getasbinary | string | No | auto | * No If CFML does not recognize the response body
type as text, convert it to a CFML object.
* Auto If CFML does not recognize the response body
type as text, convert it to CFML Binary type data.
* Yes Always convert the response body content into
CFML Binary type data, even if CFML
recognizes the response body type as text.
* Never Prevents the automatic conversion of certain
MIME types to the ColdFusion Binary type data;
treats the returned content as text. CF7.01+ | +| result | string | No | cfhttp | CF7+ Specifies the name of the variable in which you want the result returned. | +| delimiter | string | No | | A character that separates query columns. The response body must use this character to separate the query columns. | +| name | string | No | | Tells ColdFusion to create a query object with the given
name from the returned HTTP response body. | +| columns | string | No | | The column names for the query, separated by commas, with no
spaces. Column names must start with a letter. The remaining
characters can be letters, numbers, or underscore
characters (_).

If there are no column name headers in the response,
specify this attribute to identify the column names.

If you specify this attribute, and the firstrowasHeader
attribute is True (the default), the column names specified
by this attribute replace the first line of the response.
You can use this behavior to replace the column names
retrieved by the request with your own names.

If a duplicate column heading is encountered in either this
attribute or in the column names from the response,
ColdFusion appends an underscore to the name to make it
unique.

If the number of columns specified by this attribute does
not equal the number of columns in the HTTP response body,
ColdFusion generates an error. | +| firstrowasheaders | boolean | No | YES | Determines how ColdFusion processes the first row of the
query record set:
* yes: processes the first row as column heads. If you
specify a columns attribute, ColdFusion ignores the
first row of the file.
* no: processes the first row as data. If you do not
specify a columns attribute, ColdFusion generates column
names by appending numbers to the word "column"; for
example, "column_1". | +| textqualifier | string | No | " | A character that, optionally, specifies the start and end
of a text column. This character must surround any text
fields in the response body that contain the delimiter
character as part of the field value.

To include this character in column text, escape it by
using two characters in place of one. For example, if the
qualifier is a double-quotation mark, escape it as "". | +| file | string | No | | Name of the file in which to store the response body. The directory that the file will be written to must be passed in the `path` attribute. | +| multipart | boolean | No | NO | Tells ColdFusion to send all data specified by cfhttpparam type="formField" tags as multipart form data, with a Content-Type of multipart/form-data. | +| multipartType | string | No | form-data | Allows you to set the multipart header field to related or form-data. By default, the value is form-data. | +| clientcertpassword | string | No | | Password used to decrypt the client certificate. | +| path | string | No | | Required if File is specified. Tells ColdFusion to save the HTTP response body in a file. Contains the absolute path to the directory in which to store the file. | +| clientcert | string | No | | The full path to a PKCS12 format file that contains the client certificate for the request. | +| compression | string | No | | Compression type | +| authType | string | No | BASIC | CF11+ NOTE When authentication type is NTLM, do not set the redirect as false. | +| domain | string | No | | CF11+ The domain name for authentication. (Use for NTLM-based authentication) | +| workstation | string | No | | CF11+ The workstation name for authentication. (Use for NTLM-based authentication) | +| cachedwithin | numeric | No | | Lucee5+ Timespan, using the CreateTimeSpan function. If original
file date falls within the time span, cached file data is
used. CreateTimeSpan defines a period from the present, back. | +| encodeurl | boolean | No | true | Allow the CFML engine to encode the url provided in the url attribute, or prevent it from doing so. | + +## Script Syntax (CF11+) + +```html +cfhttp(method="GET", charset="utf-8", url="https://www.google.com/", result="result") { + cfhttpparam(name="q", type="url", value="cfml"); +} +writeDump(result); +``` + +## Alternate Script Syntax (CF9+). Removed in ColdFusion 2025. + +```html +httpService = new http(method = "GET", charset = "utf-8", url = "https://www.google.com/"); +httpService.addParam(name = "q", type = "url", value = "cfml"); +result = httpService.send().getPrefix(); +writeDump(result); +``` + +## CFHTTP Tag Syntax + +```html + + + + +``` diff --git a/docs/tags/cfhttpparam.md b/docs/tags/cfhttpparam.md new file mode 100644 index 000000000..4f4b97283 --- /dev/null +++ b/docs/tags/cfhttpparam.md @@ -0,0 +1,55 @@ +# cfhttpparam + +Allowed inside cfhttp tag bodies only. Required for cfhttp POST + operations. Optional for all others. Specifies parameters to + build an HTTP request. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfhttpparam(type="header"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| type | string | Yes | | The type of data to send

`header`: Specifies an HTTP header. Does not URL encode the value

`body`: Specifies that the `value` is the body of the HTTP request.

`xml`: Identifies the request as having a content-type of
`text/xml` and specifies that the `value` attribute contains the body of the HTTP request.

`cgi`: Same as `header` but URL encodes the `value` by default.

`file`: Tells CFML to send the contents of the specified file.

`url`: Specifies a URL query string name-value pair to append to the cfhttp url attribute. URL encodes the value.

`formfield`: Specifies a form field to send. URL encodes the value by default.

`cookie`: Specifies a cookie to send as an HTTP header. URL encodes the value. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfhttpparam.md|cookie | +| name | string | No | | Variable name for data that is passed. Ignored for `body` and `xml` type. For `file` type, specifies the filename. | | +| value | string | No | | Value of the data that is sent. Ignored for `file` type. The value must contain string data or data that CFML can convert to a string for all type attributes except Body. Body types can have string or binary values. | | +| file | string | No | | Applies to `file` type; ignored for all other types. The absolute path to the file that is sent with the request. | | +| encoded | boolean | No | | Applies to `formfield` and `cgi` types; ignored for all other
types. Specifies whether to URLEncode the form field or
header. | | +| mimetype | string | No | | Applies to `file` type; invalid for all other types.
Specifies the MIME media type of the file contents.
The content type can include an identifier for the
character encoding of the file; for example, text/html;
charset=ISO-8859-1 indicates that the file is HTML text in
the ISO Latin-1 character encoding. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfhttpparam.md|text/html | + +## Script Syntax (CF11+) + +```html +cfhttp(method="POST", charset="utf-8", url="https://www.google.com/", result="result") { + cfhttpparam(name="q", type="formfield", value="cfml"); +} +writeDump(result); +``` + +## Alternate Script Syntax (CF9+). Removed in ColdFusion 2025. + +```html +httpService = new http(method = "POST", charset = "utf-8", url = "https://www.google.com/"); +httpService.addParam(name = "q", type = "formfield", value = "cfml"); +result = httpService.send().getPrefix(); +writeDump(result); +``` + +## CFHTTP Tag Syntax + +```html + + + + +``` diff --git a/docs/tags/cfif.md b/docs/tags/cfif.md new file mode 100644 index 000000000..9faf4c124 --- /dev/null +++ b/docs/tags/cfif.md @@ -0,0 +1,43 @@ +# cfif + +Creates simple and compound conditional statements in CFML. + Tests an expression, variable, function return value, or + string. Used, optionally, with the cfelse and cfelseif tags. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +if (expression) { } +``` + +## Script Syntax + +```html +count = 10; + if (count > 20) { + writeOutput(count); + } else if (count == 8) { + writeOutput(count); + } else { + writeOutput(count); + } +``` + +## Tag Syntax + +```html + + + #count# + + #count# + + #count# + +``` diff --git a/docs/tags/cfimage.md b/docs/tags/cfimage.md new file mode 100644 index 000000000..7bad97ed4 --- /dev/null +++ b/docs/tags/cfimage.md @@ -0,0 +1,114 @@ +# cfimage + +Creates a ColdFusion image that can be manipulated by using image functions. +You can use the cfimage tag to perform common image manipulation operations as a shortcut to Image functions. +You can use the cfimage tag independently or in conjunction with image functions. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfimage(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| action | string | No | read | The action to take. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfimage.md|writeToBrowser | +| angle | numeric | No | | Angle in degrees to rotate the image. | | +| color | string | No | | (border) Border color.
Hexadecimal value or supported named color.
For a hexadecimal value, use the form "##xxxxxx" or "xxxxxx". (required) | | +| destination | string | No | | Absolute or relative pathname where the image output is written.
The image format is determined by the file extension.
The convert and write actions require a destination.
The border, captcha, resize, and rotate actions require either a name attribute or a destination attribute.
You can specify both.
Scorpio supports only CAPTCHA images in PNG format.
If you do not enter a destination, the CAPTCHA image is placed inline in the HTML output and displayed in the web browser. | | +| difficulty | string | No | low | Level of complexity of the CAPTCHA text. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfimage.md|low | +| fontSize | numeric | No | | Font size of the text in the CAPTCHA image.
The value must be an integer. | | +| format | string | No | | Format of the image displayed in the browser.
If you do not specify a format, the image is displayed in PNG format.
You cannot display a GIF image in a browser.
GIF images are displayed in PNG format. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfimage.md|jpeg | +| height | numeric | No | | Height in pixels of the image.
For the resize attribute, you also can specify the height as a percentage (an integer followed by the "%" symbol).
The value must be an integer. | | +| isBase64 | boolean | No | false | Specifies whether the source is a Base64 string or not. | | +| name | string | No | | Name of the ColdFusion image variable to create.
The read action requires name attribute.
The border, resize, and rotate options require a name attribute or a destination attribute.
You can specify both. | | +| overwrite | boolean | No | false | Valid only if the destination attribute is specified.
If the destination file already exists, ColdFusion generates an error if the overwrite option is not set to yes. | | +| quality | numeric | No | 0.75 | Quality of the JPEG destination file.
Applies only to files with an extension of JPG or JPEG.
Valid values are fractions that range from 0 through 1
(the lower the number, the lower the quality). | | +| source | any | No | | URL of the source image; for example, "http://www.google.com/ images/logo.gif"
Absolute or relative pathname of the source image; for example, "c:\wwwroot\images\logo.jpg"
ColdFusion image variable containing another image, BLOB, or byte array; for example, "#myImage#"
Base64 string; for example, "data:image/jpg;base64,/9j/ 4AAQSkZJRgABAQA.............." | | +| structName | string | No | | Name of the ColdFusion structure to be created. | | +| text | string | No | | Text string displayed in the CAPTCHA image.
Use capital letters for better readability. | | +| thickness | numeric | No | 1 | Border thickness in pixels.
The border is added to the outside edge of the source image,
increasing the image area accordingly.
The value must be an integer. | | +| width | string | No | | Width in pixels of the image.
For resize, you also can specify the width as a percentage
(an integer followed by the "%" symbol).
The value must be an integer. | | +| fonts | string | No | | One or more valid fonts to use for the CAPTCHA text. Separate multiple fonts with commas. ColdFusion supports only the system fonts that the JDK can recognize. | | +| interpolation | string | No | highestQuality | CF10+ Used when action=resize determines the interpolation algorithm to use. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfimage.md|quadratic | + +## Border action + +Add a red border of 5 pixels to an image, write the output to a variable. + +```html + +``` + +## Captcha action + +Generate a CAPTCHA style image using medium difficulty. + +```html + +``` + +## Convert action + +Convert an image to a different format (in this case PNG). + +```html + +``` + +## Info action + +Retrieve meta data from an image and stores that as a structure in a variable. + +```html + + +``` + +## Read action + +Tag syntax for reading an image from a URL. + +```html + +``` + +## Resize action + +Example of resizing an image stored in a variable and storing the result in a variable. + +```html + +``` + +## Rotate action + +Rotate an image 30 degrees clockwise. + +```html + +``` + +## Write action + +Example of writing an image as an 80% compressed jpg image. + +```html + +``` + +## WriteToBrowser action + +Generates HTML to output the image in place. + +```html + +``` diff --git a/docs/tags/cfimap.md b/docs/tags/cfimap.md new file mode 100644 index 000000000..021caf8f7 --- /dev/null +++ b/docs/tags/cfimap.md @@ -0,0 +1,39 @@ +# cfimap + +Queries an IMAP server to retrieve and manage mails within multiple folders. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfimap(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| password | string | No | | Specifies the password for assessing the users e-mail account. | +| secure | boolean | No | | Specifies whether the IMAP server uses a Secure Sockets Layer. | +| action | string | No | getheaderonly | * GetHeaderOnly - Returns the message header information for all retrieved mail.
* GetAll - Returns mail. The information includes the message header information, message text, and any attachments. Set the AttachmentPath attribute to retrieve attachments.
* Delete - Deletes messages from a folder.
* Open - Initiates an open session or connection with the IMAP server.
* Close - Terminates the open session or connection with the IMAP server.
* MarkRead - Marks all messages read from a folder.
* DeleteFolder - Deletes the identified folder.
* CreateFolder - Creates a folder in Inbox.
* RenameFolder - Renames an existing user-defined folder.
* ListAllFolders - Displays a list of all existing folders in the mailbox or under the folder name defined by the Folder attribute.
* MoveMail - Moves mail from one folder to another | +| timeout | numeric | No | | Specifies the number of seconds to wait before timing out connection to IMAP server. An error message is displayed when timeout occurs. | +| messageNumber | string | No | | Specifies the message number or a comma delimited list of message numbers for retrieval, deletion, marking mail as read, or moving mails.
If you set an invalid message number or range, then it is ignored. If you have specified the UID attribute, then MessageNumber attribute is ignored. | +| connection | string | No | | Required for the following actions: Open and Close - Specifies the variable name for the connection/session. For example, the e-mail login to an IMAP server can be used as the value for the connection. If the server attribute has an invalid IP address or invalid domain name,
then the connection fails and ColdFusion returns an error message. | +| newFolder | string | No | | Specifies the name of the destination folder where all mail move. | +| uid | string | No | | Specifies the unique ID or a comma-delimited list of Uids to retrieve or delete. If you set invalid Uids, then they are ignored. | +| folder | string | No | | For mail actions: Specifies the folder name where messages are searched, retrieved, moved, or deleted. If folder name is invalid, ColdFusion defaults to INBOX.
For folder actions: Specifies the folder name that is deleted (DeleteFolder) or created (CreateFolder) or renamed (RenameFolder). | +| port | numeric | No | | Specifies the IMAP port number. Use 993 for secured connections. | +| stoponerror | boolean | No | | Specifies whether or not to ignore the exceptions for this operation. When the value is true, it stops processing, displays an appropriate error. | +| generateUniqueFileNames | boolean | No | | Ensures that unique file names are generated for each attachment file.
The goal is to avoid name conflicts for attachments that have the same filename. | +| maxrows | numeric | No | | Specifies the number of rows to be marked as read, deleted, or moved across folders. When the value is 1, it signals the row determined by StartRow. Any incremental value marks rows starting from the StartRow.
If you have specified the UID or MessageNumber attribute, then MaxRows is ignored. | +| username | string | No | | Specifies the user name. Typically, the user name is same the e-mail login. | +| startRow | numeric | No | | Defines the first row number for reading or deleting. If you have specified the UID or MessageNumber attribute, then StartRow is ignored. You can also specify StartRow for moving mails. | +| attachmentpath | string | No | | Required for GetAll action - Specifies the name of the folder where ColdFusion retrieves attachments. If this folder does not exist, ColdFusion creates it. | +| server | string | No | | Specifies the IMAP server identifier. You can assign a host name or an IP address as the IMAP server identifier. For example, imap.gmail.com. | +| name | string | No | | Specifies the name for the query object that contains the retrieved message information. | +| recurse | boolean | No | | Specifies whether ColdFusion runs the CFIMAP command in subfolders. | diff --git a/docs/tags/cfimapfilter.md b/docs/tags/cfimapfilter.md new file mode 100644 index 000000000..9b7586bf4 --- /dev/null +++ b/docs/tags/cfimapfilter.md @@ -0,0 +1,50 @@ +# cfimapfilter + +Specifies filter parameters that control the actions of cfimap, get operations. + +Two ways to use this tag: [name, value pair attributes] or [name, from, to ]. + + + name = "filter type" + value = "filter value" + +OR + + + name = "filter type" + from = "date/time" + to = "date/time" + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfimapfilter(name="filter type", ...); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | type of imap filter to use. TimeReceived and TimeSent must be used with the from/to attributes | +| from | date | No | | The start date or date/time combination of the range to use for filtering. Cannot be used with the value attribute. If you specify a from attribute without a to attribute, the filter selects for all entries on or after the specified date or time.
The value can be in any date/time format recognized by ColdFusion, but must correspond to a value that is appropriate for the filter type. | +| to | date | No | | The end date or date/time combination for the range used for filtering. Cannot be used with the value attribute. If you specify a to attribute without a from attribute, the filter selects for all entries on or before the specified date or time.
The value can be in any date/time format recognized by ColdFusion, but must correspond to a value that is appropriate for the filter type. | +| value | string | No | | Filter Value | + +## Adobe Example + +```html + + + + + +``` diff --git a/docs/tags/cfimport.md b/docs/tags/cfimport.md new file mode 100644 index 000000000..cbe054a53 --- /dev/null +++ b/docs/tags/cfimport.md @@ -0,0 +1,32 @@ +# cfimport + +You can use the cfimport tag to import either of the following: + + * All CFML pages in a directory, as a tag custom tag + library. + * A Java Server Page (JSP) tag library. A JSP tag library is a + packaged set of tag handlers that conform to the JSP 1.1 tag + extension API. + +### Syntax + +```html + +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| taglib | string | No | | Tag library URI. The path must be relative to the web root
(and start with /), the current page location, or a
directory specified in the Administrator CFML
mappings page.

A directory in which custom CFML tags are stored. In
this case, all the cfm pages in this directory are treated
as custom tags in a tag library.
A path to a JAR in a web-application; for example,
"/WEB-INF/lib/sometags.jar"
A path to a tag library descriptor; for example,
"/sometags.tld"
Note: You must put JSP custom tag libraries in the
/WEB-IN/lib directory. This limitation does not apply to
CFML pages. | +| prefix | string | No | | Prefix by which to access the imported custom CFML tags JSP
tags.

If you import a CFML custom tag directory and specify an
empty value, "", for this attribute, you can call the
custom tags without using a prefix. You must specify and
use a prefix for a JSP tag library. | +| path | string | No | | path of CFC to be imported | + +## Tag Syntax - CFML Custom Tags with Prefix + +Import custom tags and include one using the prefix:tagName syntax. + +```html + + +``` diff --git a/docs/tags/cfinclude.md b/docs/tags/cfinclude.md new file mode 100644 index 000000000..797169852 --- /dev/null +++ b/docs/tags/cfinclude.md @@ -0,0 +1,36 @@ +# cfinclude + +Includes the content from the referenced file (template). The content may be executed as CFML, see compatibility info below. You can embed cfinclude tags recursively. For another way to encapsulate CFML, see cfmodule. (A CFML page was formerly sometimes called a CFML template or a template.) + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +include "template.cfm" runonce=true|false; +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| template | string | Yes | | A logical path to a CFML page. | +| runonce | boolean | No | false | CF10+ If set to true, the given template is not processed again for a given request if it has already been processed. | + +## Script Syntax + +CF9+ + +```html +include "mypage.cfm"; +``` + +## Tag Syntax + +```html + +``` diff --git a/docs/tags/cfindex.md b/docs/tags/cfindex.md new file mode 100644 index 000000000..b8d202a8f --- /dev/null +++ b/docs/tags/cfindex.md @@ -0,0 +1,42 @@ +# cfindex + +Populates a Verity search engine collection with an index of + documents on a file system or of CFML query result sets. + + A collection must exist before it can be populated. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfindex(collection=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| collection | string | Yes | | Name of a collection that is registered by CFML; for
example, "personnel"
Name and absolute path of a collection that is not
registered by CFML; for example:
"e:\collections\personnel" | +| action | string | No | | - update: updates a collection and adds key to the index.
- delete: removes collection documents as specified by
the key attribute.
- purge: deletes all of the documents in a collection.
Causes the collection to be taken offline, preventing
searches.
- refresh: deletes all of the documents in a collection,
and then performs an update. | +| type | string | No | | file: using the key attribute value of the query result as
input, applies action value to filenames or filepaths.
path: using the key attribute value of the query result as
input, applies action to filenames or filepaths that
pass the extensions filter
custom: If action = "update" or "delete": applies action to
custom entities in query results. | +| title | string | No | | * Title for collection
* Query column name for type and a valid query name
Permits searching collections by title or displaying a
separate title from the key | +| key | string | No | | * Absolute path and filename, if type = "file"
* Absolute path, if type = "path"
* A query column name (typically, the primary key column
name), if type = "custom"
* A query column name, if type = any other value

This attribute is required for the actions listed, unless
you intend for its value to be an empty string. | +| body | string | No | | * ASCII text to index
* Query column name(s), if name is specified in query

You can specify columns in a delimited list. For example:
"emp_name, dept_name, location" | +| custom1 | string | No | | Custom field in which you can store data during an indexing
operation. Specify a query column name for type, and a
query name. | +| custom2 | string | No | | Custom field in which you can store data during an indexing
operation. Specify a query column name for type, and a
query name. | +| custom3 | string | No | | Custom field in which you can store data during an indexing
operation. Specify a query column name for type, and a
query name. (Added in ColdFusion 7) | +| custom4 | string | No | | Custom field in which you can store data during an indexing
operation. Specify a query column name for type, and a
query name. (Added in ColdFusion 7) | +| category | string | No | | A string value that specifies one or more search categories
for which to index the data. You can define multiple
categories, separated by commas, for a single index. | +| categoryTree | string | No | | A string value that specifies a hierarchical category or
category tree for searching. It is a series of categories
separated by forward slashes ("/"). You can specify only
one category tree. | +| urlpath | string | No | | If type="file" or "path", specifies the URL path. When the
collection is searched with cfsearch, this pathname is
prefixed to filenames and returned as the url attribute. | +| extensions | string | No | | Delimited list of file extensions that CFML uses to
index files, if type = "Path".
"*." returns files with no extension.

For example: the following code returns files with a
listed extension or no extension:
extensions = ".htm, .html, .cfm, .cfml, "*." | +| query | query | No | | Query against which collection is generated | +| recurse | boolean | No | NO | Yes: if type = "path", directories below the path
specified in key are included in indexing operation | +| language | string | No | english | For options, see cfcollection. Requires the appropriate
Verity Locales language pack (Western Europe, Asia,
Multilanguage, Eastern Europe/Middle Eastern). | +| status | string | No | | The name of the structure into which ColdFusion MX
returns status information. | +| prefix | string | No | | Specifies the location of files to index when the computer that contains the K2 Search Service is not the computer on which you installed ColdFusion, and when you index files with the type attribute set to path. | diff --git a/docs/tags/cfinput.md b/docs/tags/cfinput.md new file mode 100644 index 000000000..913b7015b --- /dev/null +++ b/docs/tags/cfinput.md @@ -0,0 +1,69 @@ +# cfinput + +Used within the cfform tag, to place radio buttons, check boxes, or text boxes on a form. Provides input validation for the specified control type. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfinput(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name for form input element. | +| autosuggest | string | No | | Specifies entry completion suggestions to display as the user types into a text input. The user can select a suggestion to complete the text entry. The valid value can be either of the following:
- A string consisting of the suggestion values separated by the delimiter specified by the delimiter attribute.
- A bind expression that gets the suggestion values based on the current input text.

Valid only for cfinput type="text". | +| autoSuggestBindDelay | numeric | No | | The minimum time between autosuggest bind expression invocations, in seconds. Use this attribute to limit the number of requests that are sent to the server when a user types.

Valid only for cfinput type="text" | +| autoSuggestMinLength | numeric | No | | The minimum number of characters required in the text box before invoking a bind expression to return items for suggestion.

Valid only for cfinput type="text". | +| bindAttribute | string | No | | Specifies the HTML tag attribute whose value is set by the bind attribute. You can only specify attributes in the browser‚ HTML DOM tree, not ColdFusion-specific attributes. Ignored if there is no bind attribute.

Valid only for cfinput type="text". | +| bindonload | boolean | No | NO | A Boolean value that specifies whether to execute the bind attribute expression when first loading the form. Ignored if there is no bind attribute.

Valid only for cfinput type="text". | +| id | string | No | | ID for form input element. | +| type | string | No | text | The input control type to create.

Notes:
- file is not supported in Flash.
- image: clickable button with an image.
- datefield: Flash only; date entry field with an expanding calendar for selecting dates. | +| label | string | No | | Label to put next to the control on a Flash or XML form. Not used for button, hidden, image, reset, or submit types. | +| style | string | No | | In HTML or XML format, ColdFusion passes the style attribute to the browser or XML. In Flash format, must be a style specification in CSS format. | +| class | string | No | | Stylesheet class for form input element. | +| required | boolean | No | NO | | +| mask | string | No | | A mask pattern that controls the character pattern that users can enter, or that the form sends to ColdFusion. In HTML and Flash for type=text use:
- A = [A-Za-z]
- X = [A-Za-z0-9]
- 9 = [0-9]
- ? = Any character
- all other = the literal character

In Flash for type=datefield use:
- D = day; can use 0-2 mask characters.
- M = month; can use 0-4 mask characters.
- Y = year; can use 0, 2, or 4 characters.
- E = day in week; can use 0-4 characters. | +| validate | string | No | | date: verifies format mm/dd/yy.
eurodate: verifies date format dd/mm/yyyy.
time: verifies time format hh:mm:ss.
float: verifies floating point format.
integer: verifies integer format.
telephone: verifies telephone format ###-###-####. The separator can be a blank. Area code and exchange must begin with digit 1 - 9.
zipcode: verifies, in U.S. formats only, 5- or 9-digit format #####-####. The separator can be a blank.
creditcard: strips blanks and dashes; verifies number using mod10 algorithm. Number must have 13-16 digits.
social_security_number: verifies format ###-##-####. The separator can be a blank.
submitonce (ACF-only): Prevents double form submission. Valid Types: Submit and Image only. Valid Formats: HTML/XML.
regular_expression: matches input against pattern attribute. | +| validateat | string | No | onSubmit | How to do the validation; one or more of the following: onSubmit, onServer or onBlur. onBlur and onSubmit are identical in Flash forms. For multiple values, use a comma-delimited list. Not supported on Railo/Lucee. | +| message | string | No | | Message text to display if validation fails | +| range | string | No | | Minimum and maximum value range, separated by a comma. If type = "text" or "password", this applies only to numeric data. | +| maxlength | numeric | No | | Maximum length of text entered, if type=text or password. | +| pattern | string | No | | JavaScript regular expression pattern to validate input. ColdFusion uses this attribute only if you specify regex in the validate attribute. Omit leading and trailing slashes. | +| onvalidate | string | No | | Custom JavaScript function to validate user input. The form object, input object, and input object values are passed to the routine, which should return True if validation succeeds, and False otherwise. If used, the validate attribute is ignored. | +| onerror | string | No | | Custom JavaScript function to execute if validation fails. | +| size | numeric | No | | Size of input control. Ignored, if type=radio or checkbox. If specified in a Flash form, ColdFusion sets the control width pixel value to 10 times the specified size and ignores the width attribute. | +| value | string | No | | HTML: corresponds to the HTML value attribute. Its use depends on control type.
Flash: optional; specifies text for button type inputs: button, submit, and image. | +| bind | string | No | | A Flash bind expression that populates the field with information from other form fields. | +| checked | boolean | No | NO | Selects a control. No value is required. Applies if type=radio or checkbox. | +| disabled | boolean | No | NO | Disables user input, making the control read-only.
HTML: Passes the attribute directly to the HTML. To enable the input you need to omit this attribute. It does not respect the attribute-value.
Flash: Disables the input when the attribute is set without attribute-value or when the attribute-value is an positive boolean value. | +| src | string | No | | Applies to Flash button, reset, submit, and image types, and the HTML image type. URL of an image to use on the button. Flash does not support GIF images. | +| onkeyup | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run when the user releases a keyboard key in the control. | +| onkeydown | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) ActionScript to run when the user presses a keyboard key in the control. | +| onmouseup | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run when the user presses a mouse button in the control. | +| onmousedown | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run when the user releases a mouse button in the control. | +| onchange | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run when the control changes due to user action. In Flash, applies to datefield, password, and text types only. | +| onclick | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run when the user clicks the control. In Flash, applies to button, checkbox, image, radio, reset, and submit types only. | +| daynames | string | No | S,M,T,W,Th,F,S | A comma-delimited list that sets the names of the weekdays displayed in the calendar. Sunday is the first day and the rest of the weekday names follow in the normal order. You can use one-/two-letter, three-letter abbreviation or the full name. | +| firstdayofweek | numeric | No | 0 | Integer in the range 0-6 specifying the first day of the week in the calendar, 0 indicates Sunday, 6 indicates Saturday. | +| monthnames | string | No | | A comma-delimited list of the month names that are displayed at the top of the calendar. You can use three-letter-abbreviation or full month name | +| enabled | boolean | No | YES | Flash only: Boolean value specifying whether the control is enabled. A disabled control appears in light gray. The inverse of the disabled attribute. | +| visible | boolean | No | YES | Flash only: Boolean value specifying whether to show the control. Space that would be occupied by an invisible control is blank. | +| tooltip | string | No | | Flash only: Text to display when the mouse pointer hovers over the control. | +| width | numeric | No | | Applies to most Flash types, HTML image type on some browsers. The width of the control, in pixels. For Flash forms, ColdFusion ignores this attribute if you also specify a size attribute value. | +| height | numeric | No | | Applies to most Flash types, HTML image type on some browsers. The height of the control, in pixels. The displayed height might be less than the specified size. | +| passthrough | string | No | | This attribute is deprecated. Passes arbitrary attribute-value pairs to the HTML code that is generated for the tag. You can use either of the following formats:
- passthrough="title=""myTitle"""
- passthrough='title="mytitle"' | +| delimiter | string | No | | The delimiter to use to separate entries in a static autosuggest list. This attribute is meaningful only if the autosuggest attribute is a string of delimited values. | +| maxresultsdisplayed | numeric | No | | The maximum number suggestions to display in the autosuggest list.
Valid only for cfinput type="text". | +| onbinderror | string | No | | The name of a JavaScript function to execute if evaluating a bind expression, including an autosuggest bind expression, results in an error. The function must take two attributes: an HTTP status code and a message. | +| showautosuggestloadingicon | boolean | No | YES | A Boolean value that specifies whether to display an animated icon when loading an autosuggest value for a text input. | +| sourcefortooltip | string | No | | The URL of a page to display as a tool tip. The page can include HTML markup to control the format, and the tip can include images.
If you specify this attribute, an animated icon appears with the text "Loading..." while the tip is being loaded. | +| typeahead | boolean | No | NO | A Boolean value that specifies whether the autosuggest feature should automatically complete a user's entry with the first result in the suggestion list.
Valid only for cfinput type="text". | +| matchContains | boolean | No | NO | true, match returned "contains" the query string. Default is false so that only results that "start with" the query string are returned. | diff --git a/docs/tags/cfinsert.md b/docs/tags/cfinsert.md new file mode 100644 index 000000000..e154607fe --- /dev/null +++ b/docs/tags/cfinsert.md @@ -0,0 +1,43 @@ +# cfinsert + +Inserts records in data sources from data in a CFML form + or form Scope. + +It can be used instead of cfquery with insert sql command. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfinsert(datasource="", tablename=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datasource | string | Yes | | Data source; contains table. | +| tablename | string | Yes | | Table in which to insert form fields.

ORACLE drivers: must be uppercase.
Sybase driver: case-sensitive. Must be the same case used
when table was created | +| tableowner | string | No | | For data sources that support table ownership (such as SQL
Server, Oracle, and Sybase SQL Anywhere), use this field to
specify the owner of the table. | +| tablequalifier | string | No | | For data sources that support table qualifiers, use this
field to specify qualifier for table. The purpose of table
qualifiers varies among drivers. For SQL Server and
Oracle, qualifier refers to name of database that contains
table. For Intersolv dBASE driver, qualifier refers to
directory where DBF files are located. | +| username | string | No | | Overrides username specified in ODBC setup. | +| password | string | No | | Overrides password specified in ODBC setup. | +| formfields | string | No | | Comma-delimited list of form fields to insert. If not
specified, all fields in the form are included.

If a form field is not matched by a column name in the
database, CFML throws an error.

The database table key field must be present in the form.
It may be hidden. | +| providerdsn | string | No | | | +| dbtype | string | No | | | +| dbname | string | No | | | +| dbserver | string | No | | | +| provider | string | No | | | + +## Insert a record using passed form fields + +Uses the cfinsert function to insert a record into the a users table based on a list form fields + +```html +cfinsert( datasource="myDsn", tablename="users", formFields="firstName,lastName,emailAddress" ); +``` diff --git a/docs/tags/cfinterface.md b/docs/tags/cfinterface.md new file mode 100644 index 000000000..6fd4cc08b --- /dev/null +++ b/docs/tags/cfinterface.md @@ -0,0 +1,47 @@ +# cfinterface + +Defines an interface that consists of a set of signatures for functions. + The interface does not include the full function definitions; + instead, you implement the functions in a CFC. + The interfaces that you define by using this tag can make up + the structure of a reusable application framework. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +interface displayname="My Interface" { + numeric function myFunction(required string myArgument); + } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| displayName | string | No | | A value to be displayed when using introspection to
show a descriptive name for the interface. (optional) | +| extends | string | No | | A comma delimited list of one or more interfaces that this interface extends.
Any CFC that implements an interface must also implement all the functions
in the interfaces specified by this property.
If an interface extends another interface, and the child interface specifies
a function with the same name as one in the parent interface, both functions
must have the same attributes; otherwise ColdFusion generates an error. (optional) | +| hint | string | No | | Text to be displayed when using introspection to show information about the interface.
The hint attribute value follows the syntax line in the function description. (optional) | + +## Script Syntax + +```html +interface displayname="My Interface" { + numeric function myFunction(required string myArgument); + } +``` + +## Tag Syntax + +```html + + + +
+ +``` diff --git a/docs/tags/cfinvoke.md b/docs/tags/cfinvoke.md new file mode 100644 index 000000000..863147bb9 --- /dev/null +++ b/docs/tags/cfinvoke.md @@ -0,0 +1,56 @@ +# cfinvoke + +Does either of the following: + + * Invokes a component method from within a CFML page or + component. + * Invokes a web service. + Different attribute combinations make some attributes required + at sometimes and not at others. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfinvoke(method=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| component | string | No | | String or component object; a reference to a component, or
component to instantiate. | | +| method | string | Yes | | Name of a method. For a web service, the name of an
operation. | | +| returnvariable | variableName | No | | Name of a variable for the invocation result. | | +| argumentcollection | string | No | | Name of a structure; associative array of arguments to pass
to the method. | | +| username | string | No | | Overrides username specified in Administrator > Web Services | | +| password | string | No | | Overrides password specified in Administrator > Web Services | | +| webservice | string | No | | The URL of the WSDL file for the web service. | | +| timeout | numeric | No | | The timeout for the web service request, in seconds | | +| proxyserver | string | No | | The proxy server required to access the webservice URL. | | +| proxyport | numeric | No | | The port to use on the proxy server. | | +| proxyuser | string | No | | The user ID to send to the proxy server. | | +| proxypassword | string | No | | The user's password on the proxy server. | | +| serviceport | string | No | | CF7+ The port name for the web service. This value is
case-sensitive and corresponds to the port element's
name attribute under the service element. Specify this
attribute if the web service contains multiple ports.
Default: first port found in the WSDL. | | +| refreshwsdl | boolean | No | NO | CF8+ * yes: reload the WSDL file and regenerate the artifacts used to consume the web service
* no | | +| wsdl2javaargs | string | No | | CF8+ A string that contains a space-delimited list of arguments to pass to the WSDL2Java tool that generates Java stubs for the web services. | | +| wsVersion | string | No | | CF10+ Used to specify the version of Apache Axis (web service engine used by CF) to use. Specify 1 for Axis Version 1 or 2 for Axis 2. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfinvoke.md|2 | + +## Invoke a SOAP webservice using cfinvoke + +Calls a remote web service to perform an addition, uses cfinvokeargument to pass the arguments to the method. + +```html + + + + +#answer# +``` + +### Expected Result: 5.0 diff --git a/docs/tags/cfinvokeargument.md b/docs/tags/cfinvokeargument.md new file mode 100644 index 000000000..7418dd2c1 --- /dev/null +++ b/docs/tags/cfinvokeargument.md @@ -0,0 +1,37 @@ +# cfinvokeargument + +Passes the name and value of an argument to a component method or a web service method. This tag is used inside of the cfinvoke tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfinvokeargument(name="", value=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The argument name | +| value | string | Yes | | The argument value | +| omit | boolean | No | NO | Enables you to omit a parameter when invoking a web service.
It is an error to specify omit="true" if the cfinvoke
webservice attribute is not specified.
- true: omit this parameter when invoking a web service.
- false: do not omit this parameter when invoking a web service. | + +## Invoke a SOAP webservice and passing arguments using cfinvokeargument + +Calls a remote web service to perform an addition, uses cfinvokeargument to pass the arguments to the method. + +```html + + + + +#answer# +``` + +### Expected Result: 5.0 diff --git a/docs/tags/cfjava.md b/docs/tags/cfjava.md new file mode 100644 index 000000000..90ef9e6c6 --- /dev/null +++ b/docs/tags/cfjava.md @@ -0,0 +1,46 @@ +# cfjava + +Provides support for writing Java code within ColdFusion. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfjava(handle="classInstance"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| handle | variableName | Yes | | The variable that holds the value of class instance of the Java code. | + +## Create Name instance (Tag syntax) + +```html + + public class Name { + private String firstName; + private String lastName; + + public Name(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public String getFullName() { + return firstName + " " + lastName; + } + } + + + +#fullName# +``` + +### Expected Result: John Doe diff --git a/docs/tags/cflayout.md b/docs/tags/cflayout.md new file mode 100644 index 000000000..747fd9d57 --- /dev/null +++ b/docs/tags/cflayout.md @@ -0,0 +1,37 @@ +# cflayout + +Creates a region of its container (such as the browser + window or a cflayoutarea tag) with a specific layout + behavior: a bordered area, a horizontal or vertically + arranged box, or a tabbed navigator. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cflayout(type="accordion"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | Yes | border | The type of layout. | +| align | string | No | center | Specifies the default alignment of the content of
child layout areas. Each cflayoutarea tag can specify
an alignment attribute to override this value. | +| name | string | No | | The name of the layout region. Must be unique
on a page. | +| padding | string | No | | Applies only to hbox and vbox layouts.
You can use any valid CSS length or percent format,
such as 10, 10% 10px, or 10em, for this attribute.
The padding is included in the child layout area
and takes the style of the layout area. | +| style | string | No | | A CSS style specification that defines layout styles. | +| tabheight | numeric | No | | A CSS style specification that defines layout stApplies only to tab type layouts. Specifies the
height of the content area of all child layout
areas. You can override this setting by
specifying a height setting in an individual
cflayoutarea tag style attributes. | +| tabposition | numeric | No | top | Applies only to tab type layouts. Specifies the
location of the tabs relative to the tab region
contents. | +| titlecollapse | boolean | No | YES | Specify whether title bar should act as collapse/expand toggle or not; default=true. | +| activeontop | boolean | No | NO | Specify whether active tab needs to be on top always; default=false. | +| fillheight | boolean | No | YES | True to adjust the active item's height to fill the available space in the container; default=true. | +| fitToWindow | boolean | No | YES | A Boolean value that specifies whether the border layout should occupy 100% of the width and height of the window | +| height | numeric | No | | | +| width | numeric | No | | | +| buttonStyle | string | No | | | diff --git a/docs/tags/cflayoutarea.md b/docs/tags/cflayoutarea.md new file mode 100644 index 000000000..7454ef242 --- /dev/null +++ b/docs/tags/cflayoutarea.md @@ -0,0 +1,43 @@ +# cflayoutarea + +Defines a region within a cflayout tag body, such as an + individual tab of a tabbed layout. This tag is not used in + Flash forms. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cflayoutarea(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| position | string | No | top | The position...(docs don't explain this one). | +| align | string | No | center | Specifies how to align child controls within the
layout area. | +| closable | boolean | No | NO | A Boolean value specifying whether the area can close.
Specifying this attribute adds an x icon on the tab or
title bar that a user can click to close the area.
You cannot use this attribute for border layout areas
with a position attribute value of center. | +| collapsible | boolean | No | NO | A Boolean value specifying whether the area can collapse.
Specifying this attribute adds a >> or << icon on the
title bar that a user can click to collapse the area.
You cannot use this attribute for border layout areas
with a position attribute value of center. | +| disabled | boolean | No | NO | A Boolean value specifying whether the tab is disabled,
that is, whether user can select the tab to display its
contents. Disabled tabs are greyed out. Ignored if the
selected attribute value is true. | +| initCollapsed | boolean | No | NO | A Boolean value specifying whether the area is initially
collapsed. You cannot use this attribute for border layout
areas with a position attribute value of center. Ignored
if the collapsible attribute value is false. | +| initHide | boolean | No | NO | A Boolean value specifying whether the area is initially
hidden. To show an initially hidden area, use the
ColdFusion.Layout.showArea or ColdFusion.Layout.showTab
function. You cannot use this attribute for border layout
areas with a position attribute value of center. | +| maxSize | numeric | No | | For layouts with top or bottom position attributes, the maximum
height of the area, in pixels, that you can set by dragging a
splitter. For layouts with left or right position attributes,
the maximum width of the area. You cannot use this attribute
for border layout areas with a position attribute value of
center. | +| minSize | numeric | No | | For layouts with top or bottom position attributes, the minimum
height of the area, in pixels, that you can set by dragging a
splitter. For layouts with left or right position attributes,
the minimum width of the area., You cannot use this attribute
for border layout areas with a position attribute value of center. | +| name | string | No | | The name of the layout area. | +| onBindError | string | No | | The name of a JavaScript function to execute if evaluating a
bind expression results in an error. The function must take
two attributes: an HTTP status code and a message. If you omit
this attribute, and have specified a global error handler
(by using the ColdFusion.setGlobalErrorHandlerfunction ),
it displays the error message; otherwise a default error
pop-up displays. | +| overflow | string | No | auto | Specifies how to display child content whose size would cause
the control to overflow the window boundaries. ÔøΩ In Internet Explorer, layout areas with
the visible setting expand to fit the size of the contents,
rather than having the contents extend beyond the layout area. | +| selected | boolean | No | | A Boolean value specifying whether this tab is initially
selected so that its contents appears in the layout. | +| size | numeric | No | | For hbox layouts and border layouts with top or bottom position
attributes, the initial height of the area. For vbox layouts
and border layouts with left or right position attributes, the
initial width of the area. For hbox and vbox layouts, you can
use any valid CSS length or percent format
(such as 10, 10% 10px, or 10em) for this attribute. For border
layouts, this attribute value must be an integer number of
pixels. You cannot use this attribute for border layout areas
with a position attribute value of center. ColdFusion
automatically determines the center size based on the
size of all other layout areas. | +| source | string | No | | A URL that returns the layout area contents. ColdFusion uses
standard page path resolution rules. You can use a bind expression
with dependencies in this attribute. If file specified in this
attribute includes tags that use AJAX features, such as cfform,
cfgrid, and cfpod, you must use the cfajaximport tag on the page
that includes the cflayoutarea tag. For more information,
see cfajaximport. | +| splitter | boolean | No | NO | A Boolean value specifying whether the layout area has a divider
between it and the adjacent layoutarea control. Users can drag the
splitter to change the relative sizes of the areas. If this
attribute is set true on a left or right position layout area,
the splitter resizes the area and its adjacent area horizontally.
If this attribute is set true on a top or bottom position
layout area, the splitter resizes the layout vertically.
You cannot use this attribute for border layout areas with
a position attribute value of center | +| style | string | No | | A CSS style specification that controls the appearance of the area. | +| title | string | No | | For tab layouts, the text to display on the tab. For border
layouts, if you specify this attribute ColdFusion creates
a title bar for the layout area with the specified text as
the title. By default, these layouts do not have a title
bar if they are not closable or collapsible. You cannot
use this attribute for border layout areas with a position
attribute value of center. | +| refreshonactivate | boolean | No | NO | * true: Refresh the contents of the tab by running the source bind expression whenever the tab display region shows (for example, when the user selects the tab), in addition to when bind events occur.
* false: Refresh the tab display region only when the bind expression is triggered by its bind event. | +| titleIcon | string | No | | Specifies the location of the icon to display with the title. | +| bindOnLoad | boolean | No | | A Boolean value that specifies whether to execute
the bind attribute expression when first loading the
form. Ignored if there is no bind attribute. | diff --git a/docs/tags/cfldap.md b/docs/tags/cfldap.md new file mode 100644 index 000000000..b258e0fdd --- /dev/null +++ b/docs/tags/cfldap.md @@ -0,0 +1,106 @@ +# cfldap + +Provides an interface to a Lightweight Directory Access Protocol + (LDAP) directory server, such as the Netscape Directory Server. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfldap(server=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| server | string | Yes | | Host name or IP address of LDAP server. | +| port | numeric | No | 389 | Port of the LDAP server (default 389). | +| username | string | No | | The User ID. Required if secure = "CFSSL_BASIC" | +| password | string | No | | Password that corresponds to user name.
If secure = "CFSSL_BASIC", V2 encrypts the password before
transmission. | +| action | string | No | query | * query: returns LDAP entry information only. Requires name,
start, and attributes attributes.
* add: adds LDAP entries to LDAP server. Requires attributes
attribute.
* modify: modifies LDAP entries, except distinguished name dn
attribute, on LDAP server. Requires dn. See modifyType attribute.
* modifyDN: modifies distinguished name attribute for LDAP
entries on LDAP server. Requires dn.
* delete: deletes LDAP entries on an LDAP server. Requires dn. | +| name | string | No | | Required if action = "Query"
Name of LDAP query. The tag validates the value. | +| timeout | numeric | No | 60000 | Maximum length of time, in milliseconds, to wait for LDAP processing.
Default 60000 | +| maxrows | numeric | No | | Maximum number of entries for LDAP queries. | +| start | numeric | No | | Required if action = "Query"
Distinguished name of entry to be used to start a search. | +| scope | string | No | onelevel | Scope of search, from entry specified in start attribute for
action = "Query".
* oneLevel: entries one level below entry.
* base: only the entry.
* subtree: entry and all levels below it. | +| attributes | string | No | | Required if action = "Query", "Add", "ModifyDN", or "Modify"
For queries: comma-delimited list of attributes to return. For
queries, to get all attributes, specify "*".

If action = "add" or "modify", you can specify a list of update
columns. Separate attributes with a semicolon.

If action = "ModifyDN", CFML passes attributes to the
LDAP server without syntax checking. | +| returnasbinary | string | No | | CF7+ A comma-delimited list of columns that are to
be returned as binary values. | +| filter | string | No | | Search criteria for action = "Query".
List attributes in the form:
"(attribute operator value)" Example: "(sn = Smith)" | +| sort | string | No | | Attribute(s) by which to sort query results. Use a comma
delimiter. | +| sortcontrol | string | No | asc | Default asc
* nocase: case-insensitive sort
* asc: ascending (a to z) case-sensitive sort
* desc: descending (z to a) case-sensitive sort

You can enter a combination of sort types; for example,
sortControl = "nocase, asc". | +| dn | string | No | | Distinguished name, for update action. Example:
"cn = Bob Jensen, o = Ace Industry, c = US" | +| startrow | numeric | No | | Used with action = "query". First row of LDAP query to insert
into a CFML query. | +| modifytype | string | No | replace | Default replace

How to process an attribute in a multi-value list.
* add: appends it to any attributes
* delete: deletes it from the set of attributes
* replace: replaces it with specified attributes

You cannot add an attribute that is already present or that is
empty. | +| rebind | boolean | No | NO | * Yes: attempt to rebind referral callback and reissue query by
referred address using original credentials.
* No: referred connections are anonymous | +| referral | numeric | No | | Number of hops allowed in a referral. A value of 0 disables
referred addresses for LDAP; no data is returned. | +| secure | string | No | | Security to employ, and required information. One option:
* CFSSL_BASIC

"CFSSL_BASIC" provides V2 SSL encryption
and server authentication. | +| separator | string | No | , | Default , (a comma)
Delimiter to separate attribute values of multi-value
attributes. Used by query, add, and modify actions, and by
cfldap to output multi-value attributes.

For example, if $ (dollar sign), the attributes attribute could
be "objectclass = top$person", where the first value of
objectclass is top, and the second value is person. This avoids
confusion if values include commas. | +| delimiter | string | No | ; | Separator between attribute name-value pairs. Use this
attribute if:

* the attributes attribute specifies more than one item, or
* an attribute contains the default delimiter (semicolon). For
example: mgrpmsgrejecttext;lang-en

Used by query, add, and modify actions, and by cfldap to output
multi-value attributes.

For example, if $ (dollar sign), you could specify
"cn = Double Tree Inn$street = 1111 Elm; Suite 100 where the
semicolon is part of the street value. | +| clientcert | string | No | | CF11+ A file path to a client certificate. | +| clientcertpassword | string | No | | CF11+ The password for the client certificate file. | +| usetls | boolean | No | false | CF11+ Indicates that the connection should be made using transport layer security. | + +## Runnable LDAP Query Example + +Queries the debian developer LDAP server and returns users with a surname of Smith + +```html + + + +``` + +## Lookup a User in Active Directory Example + +This example gets the user's data from active directory and displays a thumbnail image stored in active directory. + +```html + + + +``` + +## Script Syntax to Authenticate a User via Active Directory + +This is an example of using `cfldap` to authenticate a user against an Active Directory server. The server or domain CA certificate must be imported into the cacerts java keystore for `security="CFSSL_BASIC"` to work. + +```html +cfldap( + server = "ServerName", + port = 636, + action = "QUERY", + name = "qLDAPLookup", + secure = "CFSSL_BASIC", + username = "MYDOMAIN\#encodeForLDAP(arguments.username)#", + password = arguments.password, + start = "dc=MYDOMAIN,dc=MYTLD", + attributes = "cn,userPrincipalName,title,mail", + timeout = "10", + filter = "(sAMAccountName=#encodeForLDAP(arguments.username)#)" +); + +if (qLDAPLookup.recordCount) { + userAuthenticated = true; +} +``` diff --git a/docs/tags/cflocation.md b/docs/tags/cflocation.md new file mode 100644 index 000000000..70f9c767b --- /dev/null +++ b/docs/tags/cflocation.md @@ -0,0 +1,35 @@ +# cflocation + +Stops execution of the current page and redirects to the specified URI. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +location("mypage.cfm", "false", "301"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| url | string | Yes | | URI or URL to redirect to. | +| addtoken | boolean | No | true | Appends the CFID, CFTOKEN, JSESSIONID and possibly other session/client identifiers to the URL. Security best practices recommend setting this to false. | +| statuscode | numeric | No | 302 | The 30X HTTP status code. CF8+ | + +## Script Syntax + +```html +location("mypage.cfm", "false", "301"); +``` + +## Tag Syntax + +```html + +``` diff --git a/docs/tags/cflock.md b/docs/tags/cflock.md new file mode 100644 index 000000000..0aa252aba --- /dev/null +++ b/docs/tags/cflock.md @@ -0,0 +1,46 @@ +# cflock + +Ensures the integrity of shared data. Instantiates the + following kinds of locks: + + * Exclusive allows single-thread access to the CFML constructs + * Read-only allows multiple requests to access CFML constructs + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +lock name="lockName" timeout="3" { } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| timeout | numeric | Yes | | Maximum length of time, in seconds, to wait to obtain a
lock. If lock is obtained, tag execution continues.
Otherwise, behavior depends on throwOnTimeout attribute
value. | +| scope | string | No | | Lock scope. Mutually exclusive with the name attribute.
Lock name. Only one request in the specified scope can
execute the code within this tag (or within any other
cflock tag with the same lock scope scope) at a time. | +| name | string | No | | Lock name. Mutually exclusive with the scope attribute.
Only one request can execute the code within a cflock tag
with a given name at a time. Cannot be an empty string. | +| throwontimeout | boolean | No | YES | How timeout conditions are handled. | +| type | string | No | exclusive | readOnly: lets more than one request read shared data.
exclusive: lets one request read or write shared data. | +| result | string | No | cflock | Lucee4+ Specifies a name for the structure in which cflock returns the statusCode and ExecutionTime variables. Default variable is "cflock". | + +## Script Syntax + +```html +lock timeout="60" scope="session" type="exclusive" { + session.myVar = "Hello"; + } +``` + +## Tag Syntax + +```html + + + +``` diff --git a/docs/tags/cflog.md b/docs/tags/cflog.md new file mode 100644 index 000000000..25a7bb3a2 --- /dev/null +++ b/docs/tags/cflog.md @@ -0,0 +1,39 @@ +# cflog + +Writes a message to a log file. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cflog(text=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| text | string | Yes | | Message text to log. | +| log | string | No | | If you omit the file attribute, writes messages to standard
log file. Ignored, if you specify file attribute.

Application: writes to Application.log, normally used for
application-specific messages.
Scheduler: writes to Scheduler.log, normally used to log
the execution of scheduled tasks. | +| file | string | No | | Message file. Specify only the main part of the filename.
For example, to log to the Testing.log file, specify
"Testing".

The file must be located in the default log directory. You
cannot specify a directory path. If the file does not
exist, it is created automatically, with the suffix .log. | +| type | string | No | | Type (severity) of the message | +| application | boolean | No | | log application name, if it is specified in a cfapplication
tag. | + +## Log to a file you specify + +CFLog will create a file or append to a file named myAppLog.log in the servers logs directory. + +```html + +``` + +## Script Syntax + +```html +writeLog(text = "Logging some info.", type = "information", application = "no", file = "myLogFile"); +``` diff --git a/docs/tags/cflogin.md b/docs/tags/cflogin.md new file mode 100644 index 000000000..7202fedb9 --- /dev/null +++ b/docs/tags/cflogin.md @@ -0,0 +1,46 @@ +# cflogin + +A container for user login and authentication code. CFML + runs the code in this tag if a user is not already logged in. + You put code in the tag that authenticates the user and + identifies the user with a set of roles. Used with cfloginuser + tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cflogin(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| idletimeout | numeric | No | | Time interval with no keyboard activity after which
CFML logs the user off. Seconds. | +| applicationtoken | string | No | | Unique application identifier. Limits the login validity to
one application, as specified by the cfapplication tag. | +| cookiedomain | string | No | | Domain of the cookie that is used to mark a user as logged
in. Use this attribute to enable a user login cookie to
work with multiple clustered servers in the same domain. | + +## CFSCRIPT Example + +The following example shows a simple authentication: + +```html +cflogin(idletimeout=3600, applicationtoken='YOUR_APP_NAME', cookiedomain='YOUR_DOMAIN_NAME') { + cfoauth( + type="Google", + clientid="YOUR_CLIENT_ID", + secretkey="YOUR_GOOGLE_CLIENTSECRET", + redirecturi="YOUR_CALLBACK_URI", + result="res", + scope="YOUR_SCOPES", + state="cftoken=#cftoken#" + ); + cfloginuser(name="#res.other.email#", password="#res.access_token#", roles="user"); + } +``` diff --git a/docs/tags/cfloginuser.md b/docs/tags/cfloginuser.md new file mode 100644 index 000000000..500f00f49 --- /dev/null +++ b/docs/tags/cfloginuser.md @@ -0,0 +1,43 @@ +# cfloginuser + +Identifies an authenticated user to CFML. Specifies the + user ID and roles. Used within a cflogin tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfloginuser(name="", password="", roles=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | A username. | +| password | string | Yes | | A user password. | +| roles | string | Yes | | A comma-delimited list of role identifiers.

CFML processes spaces in a list element as part of
the element. | + +## CFSCRIPT Example + +The following example shows a simple authentication: + +```html +cflogin(idletimeout=3600, applicationtoken='YOUR_APP_NAME', cookiedomain='YOUR_DOMAIN_NAME') { + cfoauth( + type="Google", + clientid="YOUR_CLIENT_ID", + secretkey="YOUR_GOOGLE_CLIENTSECRET", + redirecturi="YOUR_CALLBACK_URI", + result="res", + scope="YOUR_SCOPES", + state="cftoken=#cftoken#" + ); + cfloginuser(name="#res.other.email#", password="#res.access_token#", roles="user"); + } +``` diff --git a/docs/tags/cflogout.md b/docs/tags/cflogout.md new file mode 100644 index 000000000..91856964e --- /dev/null +++ b/docs/tags/cflogout.md @@ -0,0 +1,18 @@ +# cflogout + +Logs the current user out. Removes knowledge of the user ID, + password, and roles from the server. If you do not use this + tag, the user is automatically logged out when the session + ends. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cflogout(); +``` diff --git a/docs/tags/cfloop.md b/docs/tags/cfloop.md new file mode 100644 index 000000000..80be163c2 --- /dev/null +++ b/docs/tags/cfloop.md @@ -0,0 +1,283 @@ +# cfloop + +Different items are required based on loop type. Items listed + as required may not be depending on your loop type. + Loop forms: + [query] [condition] [index + from + to ] [index + list] + [collection + item ] + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +for (i = 1; i <= 10; i++) { } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| index | string | No | | Index value. CFML sets it to from value and
increments or decrements by step value, until it equals to
value. | +| from | numeric | No | | Beginning value of index. | +| to | numeric | No | | Ending value of index. | +| step | numeric | No | | Step by which to increment or decrement the index value. | +| condition | string | No | | Condition that controls the loop. | +| query | query | No | | Query that controls the loop. | +| group | string | No | | CF10+ and Lucee4.5+. Query column to use to group sets of records. Eliminates adjacent duplicate rows when data is sorted. Use if you retrieved a recordset ordered on one or more query columns. | +| groupcasesensitive | boolean | No | No | Lucee4.5+. Boolean indicating whether to group with regard to case or not. The default value is NO; case is considered while grouping. If the query attribute specifies a query object that was generated by a case-insensitive SQL query, set the groupCaseSensitive attribute to NO to keep the recordset intact. | +| startrow | numeric | No | | First row of query that is included in the loop. | +| endrow | numeric | No | | Last row of query that is included in the loop. | +| list | string | No | | The list attribute is used with the `index` (or `item` in Lucee or CF2016+) attribute to loop over a list, variable, or filename; contains a list | +| delimiters | string | No | , | Character(s) that separates items in list | +| collection | any | No | | The collection attribute is used with the item attribute.
often to loop over a structure | +| item | string | No | | The item attribute is used with the collection attribute often to loop over a structure or array

NOTE: If you have item attribute without index, item represents the key. In Lucee4.5+ you can use item with index, but keep in mind, that item will represent the value whereas index will be the key now! | +| array | array | No | | CF8+ An array. | +| characters | numeric | No | | CF8+ The number of characters to read during each iteration of the loop from the file specified in the file attribute.
If the value of the characters attribute is more than the number of characters in the file,
ColdFusion uses the number of characters in the file. | +| file | string | No | | CF8+ The absolute path and filename of the text file to read, one line at a time.
This is helpful when reading large text files, because you can reuse the value of the index variable,
which contains the current line of the file.
When the loop completes, ColdFusion closes the file. | +| times | numeric | No | | Lucee5+ If you want to have a specific iterations you can simply use `times` param instead of `from` and `to` | + +## For Loop (Script Syntax) + +General Purpose Loop + +```html +for (i = 1; i <= 10; i++) { + writeOutput(i); +} +``` + +### Expected Result: 12345678910 + +## For Loop using CFLoop Tag + +General Purpose Loop + +```html + + #i# + +``` + +### Expected Result: 1 2 3 4 5 6 7 8 9 10 + +## Loop Over an Array (Script Syntax) + +Array Loop + +```html +myArray = ["a", "b", "c"]; +// For Loop By index for CF9.0.0 and lower +for (i = 1; i <= arrayLen(myArray); i++) { + writeOutput(myArray[i]); +} +// By For In CF9.0.1+ +for (currentIndex in myArray) { + writeOutput(currentIndex); +} +// By arrayEach() member function CF11+ +myArray.each(function(element, index) { + writeOutput(element & " : " & index); +}); +``` + +## CFLoop over an Array + +Array Loop + +```html + + + + #myArray[i]# + + + + #currentIndex# + + #currentItem# + +``` + +## Loop over a Struct (Script Syntax) + +Struct Loop + +```html +myStruct = {name: "Tony", state: "Florida"}; + // By struct + for (currentKey in myStruct) { + writeOutput("
  • #currentKey# : #myStruct[currentKey]#
  • "); + } + // By structEach() + myStruct.each(function(key, value) { + writeOutput("
  • #key# : #value#
  • "); + }); +``` + +## CFLoop over a Struct + +Loop over a Struct using the collection and item arguments of cfloop. + +```html + + + + +
  • #currentKey# : #myStruct[currentKey]#
  • +
    +``` + +## CFLoop over a Struct + +Lucee4.5+ Loop over a Struct using the collection, index and item arguments of cfloop. + +```html + + + + +
  • #currentKey# : #currentItem#
  • +
    +``` + +## Loop over a List (Script Syntax) + +List Loop + +```html +// Define our list + myList = "a, b, c"; + // By array + for (item in listToArray(myList, ",")) { + writeOutput(item); + } + // By listEach() + myList.each(function(element, index) { + writeOutput(element & " : " & index); + }, ","); +``` + +## CFLoop over a List + +List Loop + +```html + + + + + #item# + + + + #currentIndex# + +``` + +## Loop over a Query (Script Syntax) + +Query Loop + +```html +// Define our query + platform = ["Adobe ColdFusion", "Railo", "Lucee"]; + myQuery = queryNew(" "); + queryAddColumn(myQuery, "platform", "CF_SQL_VARCHAR", platform); + // By row index + for (i = 1; i <= myQuery.recordCount; i++) { + writeOutput("
  • #myQuery["platform"][i]#
  • "); + } + // By query + for (row in myQuery) { + writeOutput("
  • #row.platform#
  • "); + } +``` + +## Loop over a Query with Grouping (Script Syntax) + +Query Loop use grouping + +```html +q = queryNew("pk,fk,data", "integer,integer,varchar",[ + [1, 10, "aa"], + [2, 20, "bb"], + [3, 20, "cc"], + [4, 30, "dd"], + [5, 30, "ee"], + [6, 30, "ff"] +]); +cfloop(query=q, group="fk"){ + writeOutput("#fk#
    "); + cfloop(){ + writeOutput(" #pk#:#data#
    "); + } + writeOutput("
    "); +} +``` + +## CFLoop over a Query + +Query Loop + +```html + + + + + + +
  • #myQuery["platform"][i]#
  • +
    + + +
  • #platform#
  • +
    +``` + +## While Loop (Script Syntax) + +Pre-Condition Loop This form of loop evaluates a single condition at the beginning of each iteration, and continues to loop whilst the condition is true + +```html +while (condition) { + // statements +} +``` + +## Do While Loop (Script Syntax) + +Post-Condition Loop This form of loop evaluates a single condition at the beginning of each iteration, and continues to loop whilst the condition is true + +```html +do { + // statements +} while(condition); +``` + +## Loop over a File (Script Syntax) + +File Loop 16 characters at a time. + +```html +filePath = getCurrentTemplatePath(); + cfloop(file=filePath, index="chars", characters=16, charset="UTF-8"){ + writeOutput(chars); // outputs the contents of this file + } +``` + +## Date Time Loop (Script Syntax) + +Date-Time range Loop (work around) + +```html +from = now(); + to = dateAdd("d", 7, from); + for(date=from; dateCompare(date, to, "d") <= 0; date = dateAdd("d", 1, date)){ + writeOutput(dateTimeFormat(date, "yyyy-mm-dd HH:nn:sstt") & "
    "); + } +``` diff --git a/docs/tags/cfmail.md b/docs/tags/cfmail.md new file mode 100644 index 000000000..40b02c979 --- /dev/null +++ b/docs/tags/cfmail.md @@ -0,0 +1,140 @@ +# cfmail + +Sends an email message that optionally contains query output, using an SMTP server. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfmail(to="", from="", subject=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| async | boolean | No | | Lucee4.5+ Specifies the mail is sent asynchronously by the Lucee Task manager (with multiple tries), if set to false the mail is sent in the same thread that executes the request, which is useful for troubleshooting because you get an error message if there is one. This setting overrides the setting with the same name in the Lucee Administrator. This attribute replaces the old 'spoolenable' attribute which is still supported as an alias. | +| bcc | string | No | | Email address(es) to which to copy the message, without listing them in the message header. | +| cc | string | No | | Email address(es) to which to copy the message | +| charset | string | No | | The character encoding in which the text part is encoded. | +| debug | boolean | No | false | true: sends debugging output to standard output. By default, if the console window is unavailable, ColdFusion sends output to cf_root\runtime\logs\coldfusion-out.log on server configurations. On J2EE configurations, with JRun, the default location is jrun_home/logs/servername-out.log.
    false: does not generate debugging output. | +| encrypt | boolean | No | false | CF11+ Toggles email message encryption | +| encryptionalgorithm | string | No | | CF11+ Algorithm to use when encrypt=true
    Encryption support is provided through S/MIME. | +| failto | string | No | | Email address to which mailing systems should send delivery failure notifications. Sets the mail envelope reverse-path value. | +| from | string | Yes | | Message sender email address. | +| group | string | No | | Query column to use when you group sets of records to send as a message. For example, to send a set of billing statements to a customer, group on "Customer_ID." Case-sensitive. Eliminates adjacent duplicates when data is sorted by the specified field. | +| groupcasesensitive | boolean | No | | Whether to consider case when using the group attribute. To group on case-sensitive records, set this attribute to Yes. | +| keyalias | string | No | | Alias of the key with which the certificate and private key is stored in keystore. If it is not specified then the first entry in the keystore will be picked up. | +| keypassword | string | No | | Password with which the private key is stored. If it is not specified, keystorepassword will be used as keypassword as well. | +| keystore | string | No | | Keystore containing the private key and certificate. The supported type is JKS (java key store) and pkcs12 | +| keystorepassword | string | No | | Password of the keystore | +| mailerid | string | No | | Mailer ID to be passed in X-Mailer SMTP header, which identifies the mailer application. | +| maxrows | numeric | No | | Maximum number of messages to send when looping over a query. | +| mimeattach | string | No | | Path of file to attach to message. Attached file is MIME-encoded. CFML attempts to determine the MIME type of the file; use the cfmailparam tag to send an attachment and specify the MIME type. | +| password | string | No | | A password to send to SMTP servers that require authentication. Requires a username attribute. | +| port | numeric | No | | TCP/IP port on which SMTP server listens for requests (normally 25). A value here overrides the Administrator. | +| priority | string | No | normal | The message priority level. Can be an integer in the range 1-5; 1 represents the highest priority, or one of the following string values, which correspond to the numeric values | +| proxyserver | string | No | | Lucee4.5+ Host name or IP address of a proxy server. | +| proxyport | numeric | No | | Lucee4.5+ The port number on the proxy server from which the object is requested. Default is 80. When used with resolveURL, the URLs of retrieved documents that specify a port number are automatically resolved to preserve links in the retrieved document. | +| proxyuser | string | No | | Lucee4.5+ When required by a proxy server, a valid username. | +| proxypassword | string | No | | Lucee4.5+ When required by a proxy server, a valid password. | +| query | query | No | | Name of cfquery from which to draw data for message(s). Use this attribute to send more than one message, or to send query results within a message. | +| recipientcert | string | No | | CF11+ Path to the public key certificate of the recipient. | +| remove | boolean | No | | Tells ColdFusion to remove any attachments after successful mail delivery. | +| replyto | string | No | | Email address(es) to which the recipient is directed to send replies. | +| sendtime | date | No | | Lucee4.5+ Set a future date time to send an email in the future via the spooler. | +| server | string | No | | SMTP server address, or (Enterprise edition only) a comma-delimited list of server addresses, to use for sending messages. At least one server must be specified here or in the CFML MX Administrator. A value here overrides the Administrator. A value that includes a port specification overrides the port attribute. | +| sign | boolean | No | | Mail will be signed when set to true | +| spoolenable | boolean | No | | Specifies whether to spool mail or always send it Immediately. Overrides the CFML MX Administrator Spool mail messages to disk for delivery setting. | +| startrow | numeric | No | 1 | Row in a query to start from. | +| subject | string | Yes | | Message subject. Can be dynamically generated. | +| timeout | numeric | No | | Number of seconds to wait before timing out connection to SMTP server. A value here overrides the Administrator. | +| to | string | Yes | | Message recipient email addresses. To specify multiple addresses, separate the addresses with commas. | +| type | string | No | text/plain | The MIME media type of the part. Can be a can be valid MIME media type | +| username | string | No | | A user name to send to SMTP servers that require authentication. Requires a password attribute | +| usessl | boolean | No | | Whether to use Secure Sockets Layer. | +| usetls | boolean | No | | Whether to use Transport Level Security. | +| wraptext | numeric | No | | Specifies the maximum line length, in characters of the mail text. If a line has more than the specified number of characters, replaces the last white space character, such as a tab or space, preceding the specified position with a line break. If there are no white space characters, inserts a line break at the specified position. A common value for this attribute is 72. | + +## Send basic email message + +The SMTP server details are provided through the Administrator. + +```html + + Your Email Message!! + +``` + +## Send basic email message overriding default SMTP server + +The SMTP server details are provided in code. + +```html + + Your Email Message!! + +``` + +## Send email messages using a query + +Loop through database records and sends one email per row. + +```html + + + + + Dear #lastname#, + + Text here, containing any variable in the myQuery scope. + +``` + +## Script syntax using new mail(). Removed in ColdFusion 2025. + +CF9+ The cfmail features are also available through the mail component. + +```html +savecontent variable="mailBody" { + writeOutput( "Your Email Message!!" ); +}; + +// Create and populate the mail object +mailService = new mail( + to = "recipient@example.com", + from = "sender@example.com", + subject = "Example email", + body = mailBody +); + +// Send +mailService.send(); +``` + +## Script syntax using function call + +CF11+ Send basic email using function call. + +```html +cfmail( to = "recipient@example.com", from = "sender@example.com", subject = "Example email" ) { WriteOutput( "Your Email Message!!" ); } +``` + +## Script syntax: Lucee + +Lucee Send basic email + +```html +mail + to="recipient@example.com" + from="sender@example.com" + subject="Your Order" { + writeOutput('Hi there,'); + writeOutput('This mail is sent to confirm that we have received your order.'); +}; +``` diff --git a/docs/tags/cfmailparam.md b/docs/tags/cfmailparam.md new file mode 100644 index 000000000..ff230f2da --- /dev/null +++ b/docs/tags/cfmailparam.md @@ -0,0 +1,79 @@ +# cfmailparam + +Attaches a file or adds a header to an e-mail message. Can only + be used in the cfmail tag. You can use more than one + cfmailparam tag within a cfmail tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfmailparam(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| file | string | No | | Attaches file to a message. Mutually exclusive with name
    attribute. The file is MIME encoded before sending. | +| type | string | No | | The MIME media type of the part. Can be a can be valid MIME
    media type | +| name | string | No | | Name of header. Case-insensitive. Mutually exclusive with
    file attribute.
    The values listed are from rfc2822 | +| value | string | No | | Value of the header. | +| contentID | string | No | | The Identifier for the attached file. This ID should
    be globally unique and is used to identify the file in
    an IMG or other tag in the mail body that references
    the file content. | +| disposition | string | No | attachment | How the attached file is to be handled. Can be one
    of the following:
    - attachment: present the file as an attachment
    - inline: display the file contents in the message | +| content | string | No | | Lets you send the contents of a
    ColdFusion variable as an attachment | +| remove | boolean | No | | Tells ColdFusion to remove any attachments after successful mail delivery. | +| filename | string | No | | CF2016+ Lucee5.1.0.17+ The file name of the attachment as seen by the recipient. | + +## Send basic email message with attachment + +The SMTP server details are provided through the Administrator. This example attaches a file. Use the full path of the file. + +```html + + + Your Email Message!! + +``` + +## Send basic email message with attachment and specified MIME type + +The SMTP server details are provided through the Administrator. This example attaches a file. Use the full path of the file. Set the MIME type of the file by using the optional type parameter. + +```html + + + Your Email Message!! + +``` + +## Send basic email message with an additional email header parameter + +The SMTP server details are provided through the Administrator. This example sets an optional X-Header. Check with your email server or service provider to find out what headers are supported. + +```html + + + Your Email Message!! + +``` + +## Send basic email message with attachment (script syntax) + +The SMTP server details are provided through the Administrator. This example attaches a file using cfscript. Use the full path of the file. + +```html +cfmail( + to="recipient@example.com", + from="sender@example.com", + subject="Example email" + ) { + cfmailparam( file="/#attachment#" ) + writeOutput( "Your Email Message!!") + }; +``` diff --git a/docs/tags/cfmailpart.md b/docs/tags/cfmailpart.md new file mode 100644 index 000000000..fddd4a277 --- /dev/null +++ b/docs/tags/cfmailpart.md @@ -0,0 +1,40 @@ +# cfmailpart + +Specifies one part of a multipart e-mail message. Can only be + used in the cfmail tag. You can use more than one cfmailpart + tag within a cfmail tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfmailpart(type="text/plain"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| type | string | Yes | | The MIME media type of the part. Can be a valid MIME
    media type | /Users/garethedwards/development/github/cfdocs/docs/tags/cfmailpart.md|text/html | +| wraptext | numeric | No | | Specifies the maximum line length, in characters of the
    mail text. If a line has more than the specified number of
    characters, replaces the last white space character, such
    as a tab or space, preceding the specified position with a
    line break. If there are no white space characters,
    inserts a line break at the specified position. A common
    value for this attribute is 72. | | +| charset | string | No | | The character encoding in which the part text is encoded.

    For more information on character encodings, see:
    www.w3.org/International/O-charset.html. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfmailpart.md|utf-16 | + +## Script syntax using function call + +. + +```html +cfmail( to = "recipient@example.com", from = "sender@example.com", subject = "Example email" ) { +cfmailpart(type="text/plain") { + writeOutput("If you are seeing this, your e-mail client does not support HTML messages."); +} +cfmailpart(type="text/html") { + writeOutput(htmlVersionOfMessage); +} +} +``` diff --git a/docs/tags/cfmap.md b/docs/tags/cfmap.md new file mode 100644 index 000000000..ad1566377 --- /dev/null +++ b/docs/tags/cfmap.md @@ -0,0 +1,49 @@ +# cfmap + +Embeds a Google map within a ColdFusion web page + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfmap(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| width | string | No | | Map width, in pixels. | +| centerlongitude | numeric | No | | The longitude value for the location, in degrees | +| centeraddress | string | No | | The address of the location, which is set as the center of the map. | +| continuouszoom | boolean | No | | Whether to provide zoom control that enables smooth zooming for the map | +| type | string | No | | Type of the Google map | +| title | string | No | | Title of the panel | +| zoomcontrol | string | No | | Whether to enable zoom control | +| tip | string | No | | A short description of the center location that appears as a tool tip. | +| overview | boolean | No | | Whether to add an Overview panel to the map | +| hideborder | boolean | No | | Whether to hide border for surrounding panel | +| doubleclickzoom | boolean | No | | Whether to enable double-click zoom | +| key | string | No | | The API key of the map. | +| collapsible | boolean | No | | Whether to provide a collapsible property for the surrounding panel | +| zoomlevel | numeric | No | | Specifies the starting zoom value | +| height | string | No | | Height of the map, in pixels | +| centerlatitude | numeric | No | | The latitude value for the location, in degrees. | +| onload | string | No | | Custom JavaScript function that runs after the map loads.. | +| typecontrol | string | No | | What type of typecontrol to provide. Basic includes "map, satellite, hybrid" and Advanced includes "map, satellite, hybrid, earth, terrain" | +| displayscale | boolean | No | | Whether to enable scale control | +| name | string | No | | Name of the map. | +| scrollwheelzoom | boolean | No | YES | Whether to enable mouse wheel zooming control | +| markerBind | string | No | | Uses a bind expression to fetch markup to be displayed in the infowindow opened when the marker is clicked. This is mutually exclusive with the markerwindowtext attribute. This is inherited by all cfmapitem tags | +| showMarkerWindow | boolean | No | YES | When true, the marker infowindow is shown. By default, this is false. This is inherited by all cfmapitem tags. | +| markerWindowContent | string | No | | Static inner HTML markup to be displayed in the infowindow opened when the marker is clicked. This is mutually exclusive with the markerbind attribute | +| markerIcon | string | No | | Location of the icon to use for the marker. | +| markerColor | string | No | | marker color in hexadecimal value. | +| onError | string | No | | The JavaScript function to run when there is a Google map API error.
    The JavaScript function is passed with two parameters, Google map status code and error message. | +| showCenterMarker | boolean | No | YES | Whether to display the marker icon that identifies the map center | +| showScale | boolean | No | YES | Whether to show scale control | diff --git a/docs/tags/cfmapitem.md b/docs/tags/cfmapitem.md new file mode 100644 index 000000000..4d3c7a5ff --- /dev/null +++ b/docs/tags/cfmapitem.md @@ -0,0 +1,29 @@ +# cfmapitem + +This tag creates markers on the map. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfmapitem(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| longitude | string | No | | The longitude value for the marker, in degrees. | +| address | string | No | | The address of the location to set the map marker. | +| tip | string | No | | A short description of the marker location that appears as a tool tip. | +| latitude | string | No | | The latitude value for the marker, in degrees. | +| name | string | No | | The name of the map. | +| showMarkerWindow | boolean | No | YES | When true, the marker infowindow is shown. By default, this is false. This is inherited by all cfmapitem tags. | +| markerWindowContent | string | No | | Static inner HTML markup to be displayed in the infowindow opened when the marker is clicked. This is mutually exclusive with the markerbind attribute | +| markerIcon | string | No | | Location of an image file to use as the marker icon. The attributes markericon and markercolor are mutually exclusive. | +| markerColor | string | No | | Indicates the color of the marker. | diff --git a/docs/tags/cfmediaplayer.md b/docs/tags/cfmediaplayer.md new file mode 100644 index 000000000..ce809d8af --- /dev/null +++ b/docs/tags/cfmediaplayer.md @@ -0,0 +1,37 @@ +# cfmediaplayer + +Creates an in-built media player that lets you play FLV files + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfmediaplayer(source=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| width | string | No | | Width of the media player, in pixels. | +| height | string | No | | Height of the media player, in pixels. | +| fullscreencontrol | boolean | No | | Whether full screen is enabled | +| hideBorder | boolean | No | | A Boolean value that specifies if you want to hide border for the media player panel | +| controlbar | boolean | No | | A Boolean value that specifies if you want to display the control panel for the media player | +| align | string | No | | Specifies the vertical alignment of the media player. | +| onload | string | No | | Custom JavaScript function to run on loading the player component. | +| bgcolor | string | No | | The background color of the media player specified as a Hexadecimal value without a "#" | +| source | string | Yes | | The URL to the FLV file. | +| name | string | No | | Name of the media player.
    The name attribute is required when you invoke JavaScript functions. | +| quality | string | No | | The quality of the media playback | +| hideTitle | boolean | No | | A Boolean value that specifies if you want to hide title for the media player panel | +| oncomplete | string | No | | Custom JavaScript function to run when the FLV file has finished playing. | +| onstart | string | No | | Custom JavaScript function to run when the FLV file starts playing. | +| wmode | string | No | | Specifies the absolute positioning and layering capabilities in your browser | +| autoPlay | boolean | No | | A Boolean value that specifies if the media player should automatically play the FLV file on loading the CFM page. | +| style | string | No | | Specify style for mediaplayer | diff --git a/docs/tags/cfmenu.md b/docs/tags/cfmenu.md new file mode 100644 index 000000000..3fd1431f5 --- /dev/null +++ b/docs/tags/cfmenu.md @@ -0,0 +1,43 @@ +# cfmenu + +Creates a menu or tool bar (a horizontally arranged menu). Any menu item can be the top + level of a submenu. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfmenu(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| bgcolor | string | No | | The color of the menu background. You can
    use any valid HTML color specification.
    This specification is locally overridden by the
    menuStyle attribute of this tag and any
    cfmenuitem tag, but does affect the background
    of the surrounding color of a submenu whose
    background is controlled by a childStyle
    attribute | +| childstyle | string | No | | A CSS style specification that applies to the
    items of the top level menu and all child menu
    items, including the children of submenus. This
    attribute lets you use a single style specification
    for all menu items. | +| font | string | No | | The font to be use for all child menu items. You
    can use any valid HTML font-family style
    attribute. | +| fontcolor | string | No | | The color of the menu text. You can use any
    valid HTML color specification. | +| fontsize | string | No | | The size of the font. Use a numeric value, such
    as 8, to specify a pixel character size. Use a
    percentage value, such as 80% to specify a
    size relative to the default font size.
    Font sizes over 20 pixels can result in submenu
    text exceeding the menu boundary. | +| menustyle | string | No | | A CSS style specification that applies to the
    menu, including any parts of the menu that do not
    have items. If you do not specify style information
    in the cfmenuitem tags, this attribute controls the
    style of the top-level items. | +| name | string | No | | The name of the menu. | +| selectedfontcolor | string | No | | The color of the text for the menu item that has
    the focus. You can use any valid HTML color
    specification. | +| selecteditemcolor | string | No | | The color that highlights the menu item that has
    the focus. You can use any valid HTML color
    specification. | +| type | string | No | horizontal | The orientation of menu. | +| width | string | No | | The width of a vertical menu; not valid for
    horizontal menus. | + +## A simple CFMenu example + +The example about simple menu with menuItems.It is supported in cf 10,11 & 16. + +```html + + + + +``` diff --git a/docs/tags/cfmenuitem.md b/docs/tags/cfmenuitem.md new file mode 100644 index 000000000..33d3d20ef --- /dev/null +++ b/docs/tags/cfmenuitem.md @@ -0,0 +1,43 @@ +# cfmenuitem + +Defines an entry in a menu, including an item that is the head of a submenu. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfmenuitem(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| display | string | No | | The text to show as the menu item label. | +| childstyle | string | No | | A CSS style specification that applies to all child
    menu items, including the children of submenus. | +| divider | string | No | | This attribute specifies that the item is a divider. If
    you specify this attribute, you cannot specify any
    other attributes. | +| href | string | No | | A URL link to activate or JavaScript function to
    call when the user clicks the menu item. | +| image | string | No | | URL of an image to display at the left side of the
    menu item. The file type can be any format the
    browser can display.
    For most displays, you should use 15x15 pixel
    images, because larger images conflict with the
    menu item text | +| menustyle | string | No | | A CSS style specification that controls the overall
    style of any submenu of this menu item. This
    attribute controls the submenu of the current menu
    item, but not to any child submenus of the submenu. | +| name | string | No | | The name of the menu item. | +| style | string | No | | A CSS style specification that applies to the current
    menu item only. It is not overridden by the
    childStyle attribute. | +| target | string | No | | The target in which to display the contents
    returned by the href attribute. The attribute can be
    a browser window or frame name, an HTML target
    value, such as _self. | + +## MenuItem with example + +Here, We have created simple menu items. The main menu having two submenu items such as My account, Project display.It is supported in cf 10,11 & 16. + +```html + + + + + + + +``` diff --git a/docs/tags/cfmessagebox.md b/docs/tags/cfmessagebox.md new file mode 100644 index 000000000..5c40b1dbe --- /dev/null +++ b/docs/tags/cfmessagebox.md @@ -0,0 +1,37 @@ +# cfmessagebox + +Creates MessageBox + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfmessagebox(type="alert", message="", name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| labelcancel | string | No | | The text to put on the cancel button of a prompt message box. | +| callbackHandler | string | No | | callback function which will be called when any ok|no|cancel button is clicked | +| labelok | string | No | | The text to put on an alert button and prompt message box OK button. | +| title | string | No | | The title for the message box. | +| type | string | Yes | | Type of action to be performed | +| message | string | Yes | | Message text which will be displayed | +| labelno | string | No | | The text to put on the button used for a negative response in a confirm message box. | +| labelyes | string | No | | The text to put on the button used for a positive response in a confirm message box. | +| multiline | boolean | No | NO | Applies for prompt action only. Signify whether prompt is textarea(multiliner) or oneliner(textField)Default=false | +| name | string | Yes | | Name of the messageBox | +| bodyStyle | string | No | | A CSS style specification for the body of the message box. As a general rule, use this attribute to set color and font styles | +| buttonType | string | No | | Applies to the control type - confirm
    The buttons to display on the message box | +| icon | string | No | | Specifies the following CSS classes
    error: Provides the error icon. You can use this icon when displaying error messages.
    info: Provides the info icon. You can use this icon when displaying any information.
    question: Provides the question icon. You can use this icon in a confirmation message box that prompts a user response.
    warning: Provides the warning icon. You can use this icon when displaying a warning message | +| modal | boolean | No | | A Boolean value that specifies if the message box should be a modal window | +| width | numeric | No | | Width of the message box in pixels. | +| x | numeric | No | | The X (horizontal) coordinate of the upper-left corner of the message box .
    ColdFusion ignores this attribute if you do not set the y attribute. | +| y | numeric | No | | The Y (vertical) coordinate of the upper-left corner of the message box.
    ColdFusion ignores this attribute if you do not set the x attribute. | diff --git a/docs/tags/cfmodule.md b/docs/tags/cfmodule.md new file mode 100644 index 000000000..f48a43675 --- /dev/null +++ b/docs/tags/cfmodule.md @@ -0,0 +1,74 @@ +# cfmodule + +Invokes a custom tag for use in CFML application pages. + This tag processes custom tag name conflicts. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +cfmodule(template="nameoftemplate.cfm",attributeCollection={}); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| template | string | No | | Mutually exclusive with the name attribute. A path to the
    page that implements the tag.

    Relative path: expanded from the current page
    Absolute path: expanded using CFML mapping
    A physical path is not valid. | +| name | string | No | | Mutually exclusive with the template attribute. A custom
    tag name, in the form "Name.Name.Name..." Identifies
    subdirectory, under the CFML tag root directory,
    that contains custom tag page.
    For example (Windows format):

    `cfmodule name = "superduper.Forums40.GetUserOptions"`

    This identifies the page GetUserOptions.cfm in the
    directory CustomTags\superduper\Forums40 under the
    CFML root directory. | +| attributecollection | struct | No | | A collection of key-value pairs that represent
    attribute names and values. You can specify multiple
    key-value pairs. You can specify this attribute only
    once. | + +## Using the template attribute with an absolute template path + +```html + +``` + +## Using the template attribute with a relative template path + +```html + +``` + +## Using the name attribute + +```html + +``` + +## Passing two ad-hoc attributes in tag body + +```html + +``` + +## Passing two ad-hoc attributes using the attributeCollection attribute + +```html + + +``` + +## Passing content between opening and closing tags + +In this example, the <p> tag and it's content will be available to super-duper-formatter.cfm to perform whatever the formatting logic dictates. + +```html + +

    Some content the module will format

    +
    +``` + +## Using cfscript with attribute collection + +In this example, show how to invoke using cfscript. + +```html +attrs = {theme = "default", pageTitle = "Welcome!"}> +cfmodule(template="myTemplate.cfm",attributeCollection="#attrCollection1#") +``` diff --git a/docs/tags/cfntauthenticate.md b/docs/tags/cfntauthenticate.md new file mode 100644 index 000000000..2c9c6c2e8 --- /dev/null +++ b/docs/tags/cfntauthenticate.md @@ -0,0 +1,28 @@ +# cfntauthenticate + +Authenticates a user name and password against the + NT domain on which ColdFusion server is running, + and optionally retrieves the user's groups. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfntauthenticate(username="", password="", domain=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| username | string | Yes | | User's login name. | +| password | string | Yes | | User's login name. | +| domain | string | Yes | | Domain against which to authenticate the user. The
    ColdFusion J2EE server must be running on this domain. | +| result | variableName | No | cfntauthenticate | Name of the variable in which to return the results.
    Default: cfntauthenticate | +| listgroups | boolean | No | NO | Boolean value specifying whether to Include a
    comma-delimited list of the user's groups in the
    result structure.
    Default: false | +| throwonerror | boolean | No | NO | Boolean value specifying whether to throw an
    exception if the validation fails. If this attribute is true,
    ColdFusion throws an error if the user name or password is
    invalid; the application must handle such errors in a
    try/catch block or ColdFusion error handler page.
    Default: false | diff --git a/docs/tags/cfoauth.md b/docs/tags/cfoauth.md new file mode 100644 index 000000000..ba0685337 --- /dev/null +++ b/docs/tags/cfoauth.md @@ -0,0 +1,69 @@ +# cfoauth + +The tag allows you to easily integrate third-party Oauth 2 authentication provider in your application. This tag currently supports Facebook and Google authentication. Also, this tag supports Oauth providers that support the Oauth 2 protocols. For instance, Microsoft and GitHub. + +If type is not Facebook or Google then use access token endpoint and other attributes. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfoauth(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| Type | string | Yes | | Currently supported values are Facebook and Google. Implicitly supports the authentication workflow of Facebook and Google. | +| clientid | string | Yes | | Unique ID generated while registering your application with the Oauth provider. | +| scope | string | No | | Scopes are the permissions that a developer seeks from the users. These are usually comma separated values of permissions.
    Refer to the Oauth provider's documentations for more information.
    For example, after Facebook authentication, if a developer wants to access an email address and then the friend lists of a user, the developer will use:
    scope=email,read_friendlists.
    Note: The scope name varies for different Oauth providers. | +| state | string | No | | The state variable is used to pass back any information to your web application after the authentication and redirection are completed. Any value passed to this attribute is returned to the web application after authentication. This is useful for CSRF (Cross-site request forgery) protection. You can use ColdFusion’s security-related CSRF functions for this attribute. | +| authendpoint | string | No | | If type is not specified, this will be used as endpoint URL to be invoked for user authentication. | +| accesstokenendpoint | string | No | | If type is not specified this will be used as end point URL to be invoked for app authentication. | +| secretkey | string | No | | Parameter is the App Secret as displayed in your social media app's settings. | +| result | variableName | No | | A struct which will have login info of the user including login success/failure, failure reason, user name, user id. | +| redirecturi | string | No | | This will default to the URL which is executing the code. So if in oauth settings user has given app URL as : http://domainname/appname And the file executing the code is : http://domainname/appname/login.cfm The redirect URI will be : http://domainname/appname/login.cfm | +| urlparams | string | No | | Extra options which will be passed as URL query string to authendpoint. | + +## Adobe Example + +The following example shows a simple authentication: + +```html + + + + + +``` + +## CFSCRIPT Example + +The following example shows a simple authentication: + +```html +cflogin() { + cfoauth( + type="Google", + clientid="YOUR_CLIENT_ID", + secretkey="YOUR_GOOGLE_CLIENTSECRET", + redirecturi="YOUR_CALLBACK_URI", + result="res", + scope="YOUR_SCOPES", + state="cftoken=#cftoken#" + ); + cfloginuser(name="#res.other.email#", password="#res.access_token#", roles="user"); + } +``` diff --git a/docs/tags/cfobject.md b/docs/tags/cfobject.md new file mode 100644 index 000000000..94b7477cf --- /dev/null +++ b/docs/tags/cfobject.md @@ -0,0 +1,86 @@ +# cfobject + +Creates a CFML object, of a specified type. + + The tag syntax depends on the object type. Some types use the + type attribute; others do not. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfobject(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | No | | The object type. You can omit this attribute or specify component. ColdFusion automatically sets the type to component. | +| action | string | No | | * create: instantiates a COM object (typically, a DLL) before invoking methods or properties.
    * connect: connects to a COM object (typically, an EXE) running on server. | +| class | string | No | | Component ProgID for the object to invoke. When using Java stubs to connect to the COM object, the class must be the ProgID of the COM object. | +| name | string | Yes | | name for the instantiated component. | +| context | string | No | | * inproc
    * local
    * remote

    In Windows, if not specified, uses Registry setting. | +| server | string | No | | Server name, using Universal Naming Convention (UNC) or Domain Name Serve (DNS) convention, in one of these forms:

    * \\lanserver
    * lanserver
    * http://www.servername.com
    * www.servername.com
    * 127.0.0.1 | +| component | string | No | | Name of component to instantiate. | +| locale | string | No | | Sets arguments for a call to init_orb. Use this attribute only for VisiBroker ORBs. It is available on C++, Version 3.2. The value must be in the form:
    locale = " -ORBagentAddr 199.99.129.33 -ORBagentPort 19000"

    Each type-value pair must start with a hyphen. | +| webservice | string | No | | One of the following:

    * The absolute URL of the web service.
    * The name (string) assigned in the ColdFusion Administrator to the web service. | +| password | string | No | | The password to use to access the web service. If the webservice attribute specifies a web service name configured in the ColdFusion Administrator, overrides any password specified in the Administrator entry. | +| secure | boolean | No | NO | Whether to secure communications with the .NET-side agent. If true, ColdFusion uses SSL to communicate with .NET. | +| protocol | string | No | tcp | Protocol to use to use for communication between ColdFusion and .NET. Must be one of the following values:
    * http: Use HTTP/SOAP communication protocol. This option is slower than tcp, but might be required for access through a firewall.
    * tcp: Use binary TCP/IP protocol. This method is more efficient than HTTP. | +| proxyserver | string | No | | The proxy server required to access the web service URL. | +| refreshwsdl | boolean | No | NO | * yes: reloads the WSDL file and regenerates the artifacts used to consume the web service
    * no | +| wsportname | string | No | | The port name for the web service. This value is case-sensitive and corresponds to the port element's name attribute under the service element. | +| wsdl2javaargs | string | No | | A string that contains a space-delimited list of arguments to pass to the WSDL2Java tool that generates Java stubs for the web services. | +| proxyport | string | No | | The port to use on the proxy server. | +| port | numeric | No | | Port number at which the .NET-side agent is listening. | +| proxypassword | string | No | | The user's password on the proxy server. | +| assembly | string | No | | For local .NET assemblies, the absolute path or paths to the assembly or assemblies (EXE or DLL files) from which to access the .NET class and its supporting classes.
    For remote .NET assemblies, you must specify the absolute path or paths of the local proxy JAR file or files that represent the assemblies. | +| username | string | No | | The user name to use to access the web service. If the webservice attribute specifies a web service configured name in the ColdFusion Administrator, overrides any user name specified in the Administrator entry. | +| proxyuser | string | No | | The user ID to send to the proxy server. | + +## The simple component file + +Here created the simple component with user defined function name as multiply. + +```html + + + + + + + +``` + +## The simple cfobject example + +Calling the above multiply function by using cfobject tag based code. + +```html + + +#multiplyObj.multiply(1,2)# + +``` + +### Expected Result: 2 + +## The simple (cfobject) example + +Calling the above multiply function by using cfobject script based code. + +```html + +cfobject(name="multiplyNum" type="component" component="multiply"){ +writeOutput(multiplyNum.multiply(6,7)); +} + +``` + +### Expected Result: 42 diff --git a/docs/tags/cfobjectcache.md b/docs/tags/cfobjectcache.md new file mode 100644 index 000000000..972c23a99 --- /dev/null +++ b/docs/tags/cfobjectcache.md @@ -0,0 +1,21 @@ +# cfobjectcache + +Flushes the query cache. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfobjectcache(action="clear"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| action | string | Yes | clear | clear: Clears queries from the cache in the Application
    scope | /Users/garethedwards/development/github/cfdocs/docs/tags/cfobjectcache.md|clear | diff --git a/docs/tags/cfoutput.md b/docs/tags/cfoutput.md new file mode 100644 index 000000000..1e1682f41 --- /dev/null +++ b/docs/tags/cfoutput.md @@ -0,0 +1,83 @@ +# cfoutput + +Displays output that can contain the results of processing CFML variables and functions. You can use the `query` attribute to loop over the result set of a database query. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +writeOutput() +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| query | query | No | | Name of cfquery from which to draw data for output section. | | +| group | string | No | | Query column to use to group sets of records. Eliminates
    adjacent duplicate rows when data is sorted. Use if you
    retrieved a record set ordered on one or more a query
    columns. For example, if a record set is ordered on
    "Customer_ID" in the cfquery tag, you can group the output
    on "Customer_ID." | | +| groupcasesensitive | boolean | No | | Whether to consider the case in grouping rows. | | +| startrow | numeric | No | | Row from which to start output. Only considered when the query attribute is set.
    This attribute in combination with maxrows can be used to create some paging. | | +| maxrows | numeric | No | | Maximum number of rows to display. Only considered when the query attribute is set. | | +| encodefor | string | No | | CF2016+ Lucee5.1+ When set applies an encoder to all variables to prevent XSS. For example if you specify `html` each variable will be wrapped by a call to the `encodeForHTML` function. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfoutput.md|dn | + +## Simple Tag Example + +```html +Some text and a #encodeForHTML(variable)# +``` + +## Loop over a query + +Loops over each row of the query specified and outputs the result. + +```html + +

    #encodeForHTML(news.headline)#

    +

    #encodeForHTML(news.byline)#

    +
    +``` + +## Loop over a range of rows of a query + +Loops over 10 rows of the query specified starting from row 5 and outputs the result. + +```html + +

    #encodeForHTML(news.headline)#

    +

    #encodeForHTML(news.byline)#

    +
    +``` + +## Using the encodeFor attribute + +CF2016+ Lucee5.1+ By specifying `encodefor="html"` each variable is encoded using the `encodeForHTML` function before it is output. + +```html + +

    #news.headline#

    +

    #news.byline#

    +
    +``` + +## Using the group attribute + +Creates a dummy query `food`, with columns `name` and `type`. Then outputs the food by grouping by the type. + +```html + + +

    #type#

    +
      +
    • #name#
    • +
    +
    +``` diff --git a/docs/tags/cfpageencoding.md b/docs/tags/cfpageencoding.md new file mode 100644 index 000000000..bebfa7a32 --- /dev/null +++ b/docs/tags/cfpageencoding.md @@ -0,0 +1,41 @@ +# cfpageencoding + +The character encoding to use to read the content between the opening and closing tags. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +cfpageencoding( charset="utf-8" ) {} +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| charset | string | Yes | | The name of the variable that will contain the value of the time taken. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfpageencoding.md|utf-16 | + +## Tag version + +```html + +Some UTF-8 content + +``` + +### Expected Result: Encoding the buffered content between the tags + +## Script version + +```html +cfpageencoding( charset="utf-8" ){ +writeoutput("Some UTF-8 content"); +} +``` + +### Expected Result: Encoding the buffered content between the tags diff --git a/docs/tags/cfparam.md b/docs/tags/cfparam.md new file mode 100644 index 000000000..c6623a5f9 --- /dev/null +++ b/docs/tags/cfparam.md @@ -0,0 +1,62 @@ +# cfparam + +Tests for a parameter's existence, tests its data type, and, if + a default value is not assigned, optionally provides one. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +cfparam(name="", default="", pattern=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name of parameter to test (such as "client.email" or
    "cookie.backgroundColor"). If omitted, and if the
    parameter does not exist, an error is thrown. | +| type | string | No | Any | The valid format for the data; one of the following.
    * any: any type of value.
    * array: an array of values.
    * binary: a binary value.
    * boolean: a Boolean value: yes, no, true, false, or a number.
    * creditcard: a 13-16 digit number conforming to the mod10 algorithm.
    * date or time: a date-time value.
    * email: a valid e-mail address.
    * eurodate: a date-time value. Any date part must be in the format dd/mm/yy, The format can use /, -, or . characters as delimiters.
    * float or numeric: a numeric value.
    * guid: a Universally Unique Identifier of the form "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" where 'X' is a hexadecimal number.
    * numeric: a numeric value
    * integer: an integer.
    * query: a query object.
    * range: a numeric range, specified by the min and max attributes.
    * regex or regular_expression: matches input against pattern attribute.
    * ssn or social_security_number: a U.S. social security number.
    * string: a string value or single character.
    * struct: a structure.
    * telephone: a standard U.S. telephone number.
    * URL: an http, https, ftp, file, mailto, or news URL.
    * UUID: a ColdFusion Universally Unique Identifier, formatted 'XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXXXXX', where 'X' is a hexadecimal number. See CreateUUID.
    * USdate: a U.S. date of the format mm/dd/yy, with 1-2 digit days and months, 1-4 digit years.
    * variableName: a string formatted according to ColdFusion variable naming conventions.
    * xml: XML objects and XML strings.
    * zipcode: U.S., 5- or 9-digit format ZIP codes. | +| default | any | No | | Value to set parameter to if it does not exist. Any
    expression used for the default attribute is evaluated,
    even if the parameter exists.
    The result is not assigned if the parameter exists,
    but if the expression has side effects, they still occur. | +| max | numeric | No | | The maximum valid value; used only for range validation. | +| min | numeric | No | | The minimum valid value; used only for range validation. | +| pattern | string | No | | A regular expression that the parameter must match;
    used only for regex or regular_expression validation. | + +## cfparam in CFML + +A very basic CFML cfparam example + +```html + +``` + +## cfparam in cfscript + +A very basic cfscript cfparam example + +```html +cfparam(name="userID", default=0); +param userID=0; +``` + +## Tag syntax using a regex + +Throws an error if the value is not one of a list of possible values + +```html + +``` + +## param shorthand in cfscript + +Three ways to use the param shorthand inside of a cfscript tag + +```html +param someVar; //declare the param +param someVar=5; //declare the param with a default value +param numeric someVar=3.1415; //declare the param with adefault value and set the type +``` diff --git a/docs/tags/cfpdf.md b/docs/tags/cfpdf.md new file mode 100644 index 000000000..4519f726a --- /dev/null +++ b/docs/tags/cfpdf.md @@ -0,0 +1,121 @@ +# cfpdf + +Manipulates existing PDF documents. The following list describes some of the + tasks you can perform with the cfpdf tag: + Merge several PDF documents into one PDF document. + Extract pages from multiple PDF documents and generate a new PDF document. + Linearize multipage PDF documents for faster display. + Encrypt or decrypt PDF files for security. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpdf(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | The action to take. | +| ascending | boolean | No | no | Order in which the PDF files are sorted:
    yes: files are sorted in ascending order
    no: files are sorted in descending order | +| copyfrom | string | No | | The filename of the PDF document from which to copy the watermark | +| destination | string | No | | The pathname of the modified PDF document.
    If the destination file exists, you must set the overwrite attribute to yes.
    If the destination file does not exist, ColdFusion creates it as long as
    the parent directory exists. (optional) | +| directory | string | No | | Specify the directory of the PDF documents to merge.
    You must specify either the directory or the source.
    If you specify the directory, you must also specify the order. | +| encrypt | string | No | | Specify the type of encryption used on the source PDF document | +| flatten | boolean | No | no | Specify whether the output file is flattened:
    yes: the formatting is removed and the file is flattened
    no: the format of the source PDF is maintained in the output file. | +| foreground | boolean | No | no | Specify whether the watermark is placed in the foreground of the PDF document:
    yes: the watermark appears in the foreground
    no: the watermark appears in the background | +| image | string | No | | Specify the image used as a watermark.
    You can specify a filename or a ColdFusion image variable. | +| info | string | Yes | | Specify the structure variable for relevant information, for example, #infoStruct#.
    ColdFusion ignores read only information, such as the creation date, application used to create
    the PDF document, and encryption parameters. | +| isBase64 | boolean | No | no | Specify whether the image used a watermark is in Base64 format:
    yes: the image is in Base64 format
    no: the image is not in Base64 format | +| keepbookmark | boolean | No | NO | Specify whether bookmarks from the source PDF
    documents are retained in the merged document:
    yes: the bookmarks are retained
    no: the bookmarks are removed | +| name | string | No | | Specify the PDF document variable name, for example, myPDFdoc.
    If the source is a PDF document variable, you cannot specify the
    name attribute again; you can write the modified PDF document
    to the destination. | +| newOwnerPassword | string | No | | Specify the password for the owner of the PDF document. | +| newUserPassword | string | No | | Specify the password for the user of the PDF document. | +| opacity | string | No | 3 | Specify the opacity of the watermark.
    Valid values are integers in the range 0 (transparent)
    through 10 (opaque). | +| order | string | Yes | | Specify the order in which the PDF documents
    in the directory are merged:
    name: orders the documents alphabetically
    time: orders the documents by timestamp | +| overwrite | string | No | | Specify whether to overwrite the destination file:
    yes: overwrites the destination file
    no: does not overwrite the destination file | +| password | string | No | | Specify the owner or user password of the source PDF document, if it exists. | +| permissions | string | No | | Specify the type of permissions on the PDF document:
    AllowPrintHigh
    AllowPrintLow
    AllowModify
    AllowCopy
    AllowAdd
    AllowSecure
    AllowModifyAnnotations
    AllowExtract
    AllowFillIn
    all
    none
    Except for all or none, you can specify a
    comma separated list of permissions. (optional) | +| position | string | No | | Specify the position on the page where
    the watermark is placed. The position represents the
    top-left corner of the watermark.
    Specify the x and y coordinates; for example 50,30. | +| rotation | numeric | No | | Specify the degree of rotation of
    the watermark image on the page; for example, 30. | +| showonprint | string | No | | Specify whether the watermark is printed with
    the PDF document:
    yes: the watermark is printed with the PDF document
    no: the watermark is not printed with the PDF document | +| source | string | Yes | | Specify the source. The source can be:
    The pathname to a PDF document; for example, c:\work\myPDF.pdf
    A PDF document variable in memory that is generated by the
    cfdocument tag or the cfpdf tag; for example, #myPDFdoc#
    The binary content of PDF document variable. | +| type | string | No | | Specify the type to remove from the source PDF document:
    attachment
    bookmark
    watermark | +| version | string | No | | (write) Specify the version of the PDF document to write. | +| transparent | boolean | No | NO | Specifies whether the image background is transparent or opaque: format=png only
    * yes: the background is transparent.
    * no: the background is opaque. | +| resolution | string | No | | Image quality used to generate thumbnail images:
    * high: use high resolution (uses more memory).
    * low: use low resolution. | +| stoponerror | boolean | No | NO | Valid only if the directory attribute is specified. If the specified directory contains files other then ColdFusion-readable PDF files, ColdFusion either stops merge process or continues.
    * yes: stops the merge process if invalid PDF files exist in the specified directory.
    * no: continues the merge process even if invalid files exist in the specified directory. | +| inputfiles | struct | No | | Structure that maps the PDF source files to the input variables in the DDX file, or a string of elements and their pathname. | +| scale | numeric | No | | Size of the thumbnail relative to the source page. The value represents a percentage from 1 through 100. | +| imageprefix | string | No | | Prefix used for each image thumbnail file generated. The image filenames use the format: imagePrefix_page_n.format. | +| outputfiles | struct | No | | Structure that contains the output files in the DDX file or string as keys and the pathname to the result file as the value. | +| pages | string | No | | Page or pages in the source PDF document on which to perform the action. You can specify multiple pages and page ranges as follows: "1,6-9,56-89,100, 110-120". | +| ddxfile | string | No | | Owner or user password of the source PDF document, if the document is password-protected. | +| saveoption | string | No | full | Save options for the PDF output:
    * full: normal save (default)
    * incremental: required to save modifications to a signed PDF document.
    * linear: for faster display. | +| format | string | No | jpg | File type of thumbnail image output | +| hires | boolean | No | | Sets a high resolution for the thumbnail if set to yes. | +| maxScale | numeric | No | | Specifies the maximum scale of the thumbnail | +| maxBreadth | numeric | No | | CF9+ Specifies maximum width of the thumbnail | +| maxLength | numeric | No | | Specifies the maximum length of the thumbnail | +| compressTIFFs | boolean | No | | Compress thumbnail which are in TIFF format. | +| overridepage | boolean | No | | Specify whether to override page or not | +| package | boolean | No | | Create PDF packages | +| hScale | numeric | No | | Horizontal scale of the image to be modified. Valid values are hscale<1. | +| vScale | numeric | No | | Vertical scale of the image to be modified. Valid values are vscale>0. | +| noBookMarks | boolean | No | | CF9+ Remove bookmarks from PDF document | +| noAttachments | boolean | No | | CF9+ Removes all attachments from PDF documents. | +| noComments | boolean | No | | Remove comments from PDF document | +| noJavaScripts | boolean | No | | CF9+ Remove all document level JavaScript actions | +| noLinks | boolean | No | | Remove external cross-references | +| noMetadata | boolean | No | | CF9+ Remove document information and metadata | +| noThumbnails | boolean | No | | Remove embedded page thumbnails | +| noFonts | boolean | No | | CF9+ Remove font styling | +| algo | string | No | | CF9+ Specifies the algorithm for image downsampling. | +| topMargin | numeric | No | | Specifies the value of the top margin | +| leftMargin | numeric | No | | Specifies the value of the left margin | +| rightMargin | numeric | No | | Specifies the value of the right margin | +| bottomMargin | numeric | No | | Specifies the value of the bottom margin | +| numberFormat | string | No | | Specify the numbering format for PDF pages in the footer. | +| align | string | No | | Aligns the header and footer in PDF. | +| honourspaces | boolean | No | | Set this option to "true" if you need characters to be converted to spaces. | +| addQuads | boolean | No | | Add the position or quadrants of the thumbnail | +| text | string | No | | Specify Text Value | +| useStructure | boolean | No | | CF9+ Specify whether to use structure or not | +| jpgdpi | numeric | No | | CF9+ | +| encodeAll | boolean | No | | Encode streams that are not encoded to optimize page content | + +## Script Syntax - Create Thumbnail + +Creates a JPG thumbnail from a PDF file + +```html +cfpdf( + action="thumbnail", + source=expandPath( "./myFile.pdf" ), + destination=expandPath( "./thumbnails/"), + resolution="high", + overwrite="yes", + pages="1", + scale="75", + transparent="no" +); +``` + +### Expected Result: Creates a file called myFile_page_1.jpg in the /thumbnails/ directory + +## Add Watermark text + +Adds watermark text to the PDF, rotated by 45 degrees, sets flag to print the watermark + +```html + +``` + +### Expected Result: PDF has watermark with text: TEST - DO NOT SEND! diff --git a/docs/tags/cfpdfform.md b/docs/tags/cfpdfform.md new file mode 100644 index 000000000..9eb9d08c3 --- /dev/null +++ b/docs/tags/cfpdfform.md @@ -0,0 +1,39 @@ +# cfpdfform + +Manipulates existing Adobe Acrobat forms and Adobe LiveCycle forms. + The following list describes some of the tasks you can perform with the cfpdfform tag: + Embed an interactive Acrobat form or LiveCycle form within a PDF document. + You use the cfpdfform tag to embed the PDF form within a cfdocument tag. + Render an existing Acrobat form or LiveCycle form. This includes prefilling + fields from a database or an XML data file and processing form data submitted + via HTTP post or PDF format. + Extract or prefill values in stored PDF forms and save the output to a file + or use it to update a data source. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpdfform(action="populate", source=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | The action to perform on the source:
    populate
    read (required) | +| datafile | string | No | | (populate read) Pathname for the XML data file.
    if action="populate", the data from this file
    populates the fields of the PDF form.
    if action="read", ColdFusion writes the data
    to this file.
    You can specify a pathname relative to the context
    root or a relative pathname.
    You must specify either the datafile attribute
    or the result attribute for the read action;
    you can specify both. (optional) | +| destination | string | No | | (populate) Pathname for the output file.
    You can specify an absolute pathname or
    a pathname relative to the context root.
    The file extension must be PDF or XDP.
    The file extension determines the format
    of the file. (The XDP format applies only
    to LiveCycle forms.)
    If you do not specify the destination,
    ColdFusion displays the form in the browser.
    Do not specify the destination when you
    embed a form in a PDF document. (optional) | +| overwrite | boolean | No | | (populate, read) Overwrite the destination file
    (if action="populate)
    or the data file (if action="read"):
    yes
    no (optional) | +| overwritedata | boolean | No | | Specifies whether to overwrite existing data in PDF form fields with data from the data source:

    * yes: Overwrite existing data in the form fields with that from the data source.
    * no: Retain existing data in form fields and populate only those fields without data. | +| result | any | No | | (read) ColdFusion structure that contains the form field values.
    You must specify the datafile attribute or the result attribute;
    you can specify both. (optional) | +| source | string | Yes | | (populate, read) Pathname of the source PDF (absolute path or path
    relative to the context root) or byte array representing a PDF. (required) | +| xmldata | boolean | No | | Pathname for the XML data file.

    * If action="populate", the data from this file, XML object, or XML string populates the form fields. You can specify a pathname relative to the context root or a relative pathname.
    * If action="read", ColdFusion writes the data to the variable. | +| name | string | No | | Specify the PDF document variable name, for example, myPDFdoc.
    If the source is a PDF document variable, you cannot specify the
    name attribute again; you can write the modified PDF document
    to the destination. (optional) | +| fdf | boolean | No | | If set to true, the system creates FDF with subforms and params instead of an XML | +| fdfData | string | No | | For populate, you specify the file name from where the FDF data will be imported.
    For read, you specify the file name where the FDF data will be exported. | diff --git a/docs/tags/cfpdfformparam.md b/docs/tags/cfpdfformparam.md new file mode 100644 index 000000000..0907c2261 --- /dev/null +++ b/docs/tags/cfpdfformparam.md @@ -0,0 +1,25 @@ +# cfpdfformparam + +Provides additional information to the cfpdfform tag. + The cfpdfformparam tag is always a child tag of the cfpdfform or cfpdfsubform tag. + Use the cfpdfformparam tag to populate fields in a PDF form. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpdfformparam(name="", value=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| index | numeric | No | | Specify the index associated with the field name.
    If multiple fields have the same name, the index
    value is used to locate one of them. (optional, default=1) | +| name | string | Yes | | The field name on the PDF form. (required) | +| value | string | Yes | | The value associated with the field name.
    For interactive fields, specify a ColdFusion variable. (optional) | diff --git a/docs/tags/cfpdfparam.md b/docs/tags/cfpdfparam.md new file mode 100644 index 000000000..931ce2306 --- /dev/null +++ b/docs/tags/cfpdfparam.md @@ -0,0 +1,25 @@ +# cfpdfparam + +Provides additional information for the cfpdf tag. + The cfpdfparam tag applies only to the merge action of the cfpdf tag. + The cfpdfparam tag is always a child tag of the cfpdf tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpdfparam(source=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| password | string | No | | Specify the user or owner password, if the source PDF file is passwordprotected. (optional) | +| source | string | Yes | | Specify the source PDF file to merge. (optional) | +| pages | string | No | | Page or pages of the PDF source file to merge. You can specify a range of pages, for example, "1-5 ", or a comma-separated list of pages, for example, "1-5,9-10,18". | diff --git a/docs/tags/cfpdfsubform.md b/docs/tags/cfpdfsubform.md new file mode 100644 index 000000000..d6a5820b0 --- /dev/null +++ b/docs/tags/cfpdfsubform.md @@ -0,0 +1,24 @@ +# cfpdfsubform + +Populates a subform within the cfpdfform tag. + The cfpdfsubform tag can be a child tag of the cfpdfform tag + or nested in another cfpdfsubform tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpdfsubform(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| index | numeric | No | | Index associated with the field name.
    If multiple fields have the same name, ColdFusion
    uses the index value is to locate one of them. (optional, default=1) | +| name | string | Yes | | Name of the subform corresponding to subform name in the PDF form. (required) | diff --git a/docs/tags/cfpod.md b/docs/tags/cfpod.md new file mode 100644 index 000000000..24288f4f4 --- /dev/null +++ b/docs/tags/cfpod.md @@ -0,0 +1,31 @@ +# cfpod + +Creates a pod, an area of the browser window or layout + area with an optional title bar and body that contains + display elements. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpod(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| bodyStyle | string | No | | A CSS style specification for the pod body. As a
    general rule, use this attribute to set color and
    font styles. Using this attribute to set the height
    and width, for example, can result in distorted output. | +| headerStyle | string | No | | A CSS style specification for the pod header. As a
    general rule, use this attribute to set color and font
    styles. Using this attribute to set the height and width,
    for example, can result in distorted output. | +| height | numeric | No | | Height if the control, including the title bar and borders,
    in pixels. Default is 100. | +| name | string | No | | Name of the pod control. | +| onBindError | string | No | | The name of a JavaScript function to execute if
    evaluating a bind expression results in an error.
    The function must take two attributes: an HTTP
    status code and a message. If you omit this
    attribute, and have specified a global error handler
    (by using the ColdFusion.setGlobalErrorHandler
    function), it displays the error message; otherwise
    a default error pop-up displays. | +| overflow | string | No | auto | Specifies how to display child content whose size
    would cause the control to overflow the pod
    boundaries. Note: In Internet Explorer, pods
    with the visible setting expand to fit the size of
    the contents, rather than having the contents extend
    beyond the layout area. | +| source | string | No | | A URL that returns the pod contents. ColdFusion
    uses standard page path resolution rules. If you
    specify this attribute and the cfpod tag has a body,
    ColdFusion ignores the body contents. You can use a a
    bind expression with dependencies in this
    attribute; for more information see the Usage section.
    Note: If a CFML page specified in this attribute contains
    tags that use AJAX features, such as cfform, cfgrid,
    and cfwindow, you must use a cfajaximport tag on the
    page with the cfpod tag.
    For more information, see cfajaximport. | +| title | string | No | | Text to display in the pod's title bar. You can use
    HTML mark up to control the title appearance, of
    example to show the text in red italic font.
    If you omit this attribute, the pod does not
    have a title bar. | +| width | numeric | No | | Width if the control, including the title bar and
    borders, in pixels. Default is 500. | diff --git a/docs/tags/cfpop.md b/docs/tags/cfpop.md new file mode 100644 index 000000000..6853503f3 --- /dev/null +++ b/docs/tags/cfpop.md @@ -0,0 +1,35 @@ +# cfpop + +Retrieves or deletes e-mail messages from a POP mail server. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpop(server=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| server | string | Yes | | POP server identifier:
    A host name; for example, "biff.upperlip.com"
    An IP address; for example, "192.1.2.225" | +| port | numeric | No | | POP port | +| username | string | No | | Overrides username. | +| password | string | No | | Overrides password | +| action | string | No | | getHeaderOnly: returns message header information only
    getAll: returns message header information, message text,
    and attachments if attachmentPath is specified
    delete: deletes messages on POP server
    markRead: marks the message as read | +| name | string | No | | Name for query object that contains the retrieved message
    information. | +| messagenumber | numeric | No | | Message number or comma-delimited list of message numbers
    to get or delete. Invalid message numbers are ignored.
    Ignored if uid is specified. | +| uid | string | No | | UID or a comma-delimited list of UIDs to get or delete.
    Invalid UIDs are ignored. | +| attachmentpath | string | No | | If action="getAll", specifies a directory in which to save
    any attachments. If the directory does not exist,
    CFML creates it.

    If you omit this attribute, CFML does not save any
    attachments. If you specify a relative path, the path root
    is the CFML temporary directory, which is returned by
    the GetTempDirectory function. | +| timeout | numeric | No | | Maximum time, in seconds, to wait for mail processing | +| maxrows | numeric | No | | Number of messages to return or delete, starting with the
    number in startRow. Ignored if messageNumber or uid is
    specified. | +| startrow | numeric | No | | First row number to get or delete. Ignored if messageNumber
    or uid is specified. | +| generateUniqueFileNames | boolean | No | | Yes: Generate unique filenames for files attached to an
    e-mail message, to avoid naming conflicts when files are
    saved | +| secure | boolean | No | false | CF10+ Enables SSL for pop requests. | +| delimiter | string | No | | CF11+ The value of the uid attribute can be a comma-separated
    list of UIDs. If the delimiter attribute is specified, the value
    of delimiter will be used as a delimiter instead of comma. | diff --git a/docs/tags/cfpresentation.md b/docs/tags/cfpresentation.md new file mode 100644 index 000000000..9c3f62ac4 --- /dev/null +++ b/docs/tags/cfpresentation.md @@ -0,0 +1,48 @@ +# cfpresentation + +Defines the look and feel of a dynamic slide presentation. + Use the cfpresentation tag as the parent tag for one or more cfpresentationslide tags, + where you define the content for the presentation. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpresentation(title=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| title | string | Yes | | Specifies the title of the presentation. | | +| backgroundColor | string | No | 0x727971 | Specifies the background color of the presentation.
    The value is hexadecimal: use the form "##xxxxxx" or "##xxxxxxxx",
    where x = 0-9 or A-F; use two number signs or none. | | +| control | string | No | normal | Specifies the presentation control: | /Users/garethedwards/development/github/cfdocs/docs/tags/cfpresentation.md|brief | +| controlLocation | string | No | right | Specifies the location of the presentation control: | /Users/garethedwards/development/github/cfdocs/docs/tags/cfpresentation.md|left | +| directory | string | No | | Specifies the directory where the presentation is saved.
    This can be absolute path or a path relative to the CFM page.
    ColdFusion automatically generates the files necessary to
    run the presentation, including:
    index.htm
    components.swf
    loadflash.js
    viewer.swf
    ColdFusion stores any data files in the presentation,
    including images, video clips, and SWF files referenced by the
    cfpresentationslide tags in a subdirectory called data.
    To run the presentation, open the index.htm file.
    If you do not specify a directory, the presentation
    runs in the client browser. | | +| glowColor | string | No | 0x35D334 | Specifies the color used for glow effects on the buttons.
    The value is hexadecimal: use the form "##xxxxxx" or "##xxxxxxxx",
    where x = 0-9 or AF; use two number signs or none. | | +| initialTab | string | No | outline | Specifies which tab will be on top when the presentation is displayed.
    This applies only when the control value is normal: | /Users/garethedwards/development/github/cfdocs/docs/tags/cfpresentation.md|notes | +| lightColor | string | No | 0x4E5D60 | Specifies the light color used for light-and shadow effects.
    The value is hexadecimal: use the form "##xxxxxx" or "##xxxxxxxx",
    where x = 0-9 or A-F; use two number signs or none. | | +| overwrite | boolean | No | yes | Specifies whether files in the directory are overwritten.
    Specify this attribute only when the you specify the directory.
    yes: overwrites files if they are already present
    no: create new files | | +| primaryColor | string | No | 0x6F8488 | Specifies the primary color of the presentation.
    The value is hexadecimal: use the form "##xxxxxx" or "##xxxxxxxx",
    where x = 0-9 or AF; use two number signs or none. | | +| shadowColor | string | No | 0x000000 | Specifies the shadow color used for light-and shadow effects.
    The value is hexadecimal: use the form "##xxxxxx" or "##xxxxxxxx",
    where x = 0-9 or A-F; use two number signs or none. | | +| showNotes | boolean | No | no | Specifies whether the notes tab is present: | | +| showOutline | boolean | No | yes | Specifies whether the outline is present: | | +| showSearch | boolean | No | yes | Specifies whether the search tab is present: | | +| textColor | string | No | 0xFFFFFF | Specifies the color for all the text in the presentation user interface. | | +| authpassword | string | No | | Sends a password to the target URL for Basic Authentication. Combined with username to form a base64 encoded string that is passed in the Authenticate header. | | +| authuser | string | No | | Sends a user name to the target URL for Basic Authentication. Combined with password to form a base64 encoded string that is passed in the Authenticate header. | | +| autoplay | boolean | No | YES | Specifies whether to play the presentation automatically:
    * true: the presentation automatically runs through the entire presentation at startup.
    * false: the user must click the Play button to start the presentation and click the Next button to advance to the next slide in the presentation. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfpresentation.md|YES | +| loop | boolean | No | NO | Specifies whether the presentation runs in a loop:
    * true: the presentation restarts automatically after it ends.
    * false: the user must click the Play button to restart the presentation. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfpresentation.md|YES | +| proxypassword | string | No | | Password required by the proxy server. | | +| proxyuser | string | No | | User name to provide to the proxy server. | | +| proxyhost | string | No | | Host name or IP address of a proxy server to which to send the request. | | +| proxyport | string | No | | The port to connect to on the proxy server. | | +| useragent | string | No | | Text to put in the HTTP User-Agent request header field. Used to identify the request client software. | | +| destination | string | No | | Destination directory | | +| format | string | No | | Specifies file format for conversion. The `flashpaper` format has been deprecated since CF11+ | /Users/garethedwards/development/github/cfdocs/docs/tags/cfpresentation.md|ppt | diff --git a/docs/tags/cfpresentationslide.md b/docs/tags/cfpresentationslide.md new file mode 100644 index 000000000..7cf81403d --- /dev/null +++ b/docs/tags/cfpresentationslide.md @@ -0,0 +1,44 @@ +# cfpresentationslide + +Creates a slide dynamically from an HTML source file, + HTML and CFML code, or an SWF source file. + If you do not specify a source file, you must include the HTML or CFML code for + the body of the slide within the cfpresentationslide tag. The cfpresentationslide + is the child tag of the cfpresentation tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpresentationslide(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| title | string | Yes | | Specifies the title of the slide. | +| audio | string | No | | Specifies the path of the audio file relative to the CFM page.
    The audio file must be an MP3 file.
    A slide cannot have both audio and video specified | +| bottomMargin | numeric | No | 0 | Specifies the bottom margin of the slide. | +| duration | numeric | No | | Specifies the duration in seconds that the slide is played. (required) | +| notes | string | No | | Specifies the notes used for the slide. | +| presenter | string | No | | Specifies the presenter of the slide.
    A slide can have only one presenter.
    This name must match one of the presenter names in the cfpresenter tag.
    If no presenter is specified, it will take the first presenter
    specified in the presenter list. | +| rightMargin | numeric | No | 0 | Specifies the right margin of the slide. | +| scale | numeric | No | 1.0 | Specifies the scale used for the HTML content on the slide
    presentation. If the scale attribute is not specified and
    the content cannot fit in one slide, it will automatically
    be scaled down to fit on the slide. | +| src | string | No | | HTML or SWF source files used as a slide. You can specify
    the following as the slide source:
    an absolute path
    a path relative to the CFM page
    a URL: you can specify the URL only if the source is an HTML file
    SWF files must be present on the system running ColdFusion and the path
    must either be an absolute path or path relative to the CFM page.
    If the src value is not specified, you must specify HTML/CFML code
    as the body. If you specify a source file and HTML /CFML, ColdFusion
    ignores the source file and displays the HTML/CFML in the slide. | +| topMargin | numeric | No | 0 | Specifies the top margin of the slide. | +| video | string | No | | Specifies the video file used for the presenter of the slide.
    If you specify video for the slide and an image for the presenter,
    the video is used instead of the image for the slide. You cannot specify
    both audio and video for a slide. The video must be an FLV file. | +| advance | string | No | | Overrides the cfpresentation tag autoPlay attribute for the slide:
    * auto: after the slide plays, the presentation advances to the next slide automatically. This is the default value if cfpresentation autoPlay="yes".
    * never: after the slide plays, the presentation does not advance to the next slide until the user clicks the Next button. This is the default value if cfpresentation autoPlay="no".
    * click: after the slide plays, the presentation advances to the next slide if the user clicks anywhere in the main presentation area. | +| authpassword | string | No | | Use to pass a password to the target URL for Basic Authentication. Combined with username to form a base64 encoded string that is passed in the Authenticate header. | +| authuser | string | No | | Use to pass a user name to the target URL for Basic Authentication. Combined with password to form a base64 encoded string that is passed in the Authenticate header. | +| marginbottom | numeric | No | | Bottom margin of the slide. | +| marginleft | numeric | No | | Left margin of the slide. | +| marginright | numeric | No | | Right margin of the slide. | +| margintop | numeric | No | | Top margin of the slide. | +| useragent | string | No | | Text to put in the HTTP User-Agent request header field. Identifies the request client software. | +| slides | string | No | | Used to specify the slide numbers required to export from ppt file | diff --git a/docs/tags/cfpresenter.md b/docs/tags/cfpresenter.md new file mode 100644 index 000000000..b2c78767d --- /dev/null +++ b/docs/tags/cfpresenter.md @@ -0,0 +1,27 @@ +# cfpresenter + +Describes a presenter in a slide presentation. A slide presentation can have multiple presenters. + The presenters must be referenced from the slides defined by the cfpresentationslide tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfpresenter(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| biography | string | Yes | | Specifies the biography of the presenter. | +| name | string | Yes | | Specifies the name of the presenter. | +| email | string | No | | The name to use for the JavaScript proxy class. | +| image | string | No | | Specifies the path for the presenter's image in JPEG format.
    The JPG file must be relative to the CFM page. | +| logo | string | No | | Specifies the path for the presenter's logo or the logo of
    the presenters organization. The logo must be in JPEG format.
    The file must be relative to the CFM page. | +| title | string | No | | Specifies the title of the presenter. | diff --git a/docs/tags/cfprint.md b/docs/tags/cfprint.md new file mode 100644 index 000000000..aced1df8a --- /dev/null +++ b/docs/tags/cfprint.md @@ -0,0 +1,39 @@ +# cfprint + +Prints specified pages from a PDF file. Use this tag to perform automated batch print jobs. + You can use the cfprint tag to print any PDF document, including those generated by the + cfdocument, cfpdf, and cfpdfform tag. Also, you can use this tag to print Report Builder + reports exported in PDF format. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfprint(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| source | string | No | | Source document to print. You can specify
    one of the following:
    An absolute or relative pathname to a PDF
    document; for example,
    c:\work\myPDF.pdf or myPDF.pdf. The
    default directory is the template directory.
    A PDF document variable in memory that
    is generated by the cfdocument tag or the
    cfpdf tag; for example, "myPDFdoc". | +| attributestruct | string | No | | ColdFusion structure used to specify
    additional print instructions. Individually
    named attributes take precedence over the
    key-value pairs in the attribute structure. | +| copies | string | No | | Number of copies to print. The value must be
    greater than or equal to 1. | +| jobname | string | No | | The name of a print job. | +| orientation | string | No | | Orientation of the page to be printed. | +| pages | string | No | | Pages in the source file to print. Duplicate
    pages and pages beyond the total count of
    pages in the document are ignored as long
    as there is at least one page between 1 and
    the total number of pages in the document.
    You can combine individual page numbers
    and page ranges; for example, 1-3,6,10-20.
    If you do not specify a value for the pages
    attribute, ColdFusion prints the entire
    document. | +| password | string | No | | Specifies either the owner or user password
    for the PDF source file. If the PDF file is
    password-protected, you must specify this
    attribute for the file to print. | +| papersize | string | No | | Paper used for the print job. The value can be
    any returned by the GetPrinterInfo
    function. Valid | +| quality | string | No | | Print quality for the print job:

    * draft
    * high
    * normal | +| color | string | No | | Color or monochrome printing | +| coverpage | string | No | | Specifies which job start and end sheets, if any, are printed with a job:

    * none
    * standard | +| type | string | No | | Specifies the file type of the document being
    printed. PDF is the only valid value. | +| printer | string | No | | The name of a printer. An example in
    Windows is \s1001prn02\NTN-2W-
    HP_BW02. The default is the default printer
    for the account where the ColdFusion server
    is running. | +| sides | string | No | | | +| paper | string | No | | Paper used for the print job. The value can be any returned by the GetPrinterInfo function. | +| fidelity | boolean | No | NO | Whether to print a job based on the print requirements specified. Valid values are:
    * yes: if the job cannot be printed exactly as specified in the print requirements, the job is rejected.
    * no: a reasonable attempt to print the job is acceptable | diff --git a/docs/tags/cfprocessingdirective.md b/docs/tags/cfprocessingdirective.md new file mode 100644 index 000000000..4dd287733 --- /dev/null +++ b/docs/tags/cfprocessingdirective.md @@ -0,0 +1,27 @@ +# cfprocessingdirective + +Provides the following information to CFML on how to process the current page: + + * Specifies whether to remove excess whitespace character from + CFML generated content in the tag body. + * Identifies the character encoding (character set) of the page + contents. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfprocessingdirective(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| suppressWhitespace | boolean | No | | Boolean; whether to suppress white space characters within
    the cfprocessingdirective block that are generated by CFML
    tags and often do not affect HTML appearance. Does not
    affect any white space in HTML code. | | +| pageEncoding | string | No | | A string literal; cannot be a variable. Identifies the
    character encoding of the current CFML page. This attribute
    affects the entire page, not just the cfprocessing tag body.
    The value may be enclosed in single or double quotation
    marks, or none.

    For more information on character encodings, see:
    www.w3.org/International/O-charset.html. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfprocessingdirective.md|utf-16 | diff --git a/docs/tags/cfprocparam.md b/docs/tags/cfprocparam.md new file mode 100644 index 000000000..22b3371fa --- /dev/null +++ b/docs/tags/cfprocparam.md @@ -0,0 +1,41 @@ +# cfprocparam + +Defines stored procedure parameters. +This tag is nested within a `cfstoredproc` tag. +This tag does not have a body. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfprocparam(cfsqltype="CF_SQL_BIGINT"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | No | in | This attribute indicates whether the passed variable is an input, output, or input/output.
    `in`: The parameter is used to send data to the database system only. Passes the parameter by value.
    `out`: The parameter is used to receive data from the database system only. Passes the parameter as a bound variable.
    `inout`: The parameter is used to send and receive data. Passes the parameter as a bound variable. | +| variable | string | No | | The name of the variable that references the value of the output parameter after the stored procedure is called.
    Only valid when `type` attribute is `OUT` or `INOUT`. | +| value | string | No | | The actual value that is passed to the stored procedure. | +| cfsqltype | string | Yes | | SQL type to which the parameter (any type) is bound.
    CFML supports the following values, where the last element of the name corresponds to the SQL data type. Different database systems might support different subsets of this list. See your DBMS documentation for information on supported parameter types.
    Refer to https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-p-q/cfqueryparam.html for how the types are mapped. | +| maxlength | numeric | No | 0 | Maximum length of a string or character IN or INOUT value attribute. A maxLength of `0` allows any length. The maxLength attribute is not required when specifying type=out. | +| scale | numeric | No | 0 | Number of decimal places in a numeric parameter. A scale of `0` allows any number of decimal places. | +| null | boolean | No | NO | Whether the parameter is passed in as a null value. Not used with "OUT" `type` parameters. | +| dbVarName | string | No | | This attribute is used to specify named parameters when calling a stored procedure. If used, this attribute should be present with each cfprocparam tag of the stored procedure.
    This attribute was previously deprecated then reintroduced in CF11
    Databases need a variable prefix for named parameters:
    `:` for Oracle
    '@` for SQL Server.
    See the following blog post for more information: https://coldfusion.adobe.com/2015/07/coldfusion-11-and-dbvarname-attribute/. | + +## Basic Example + +```html + + + + + + +``` diff --git a/docs/tags/cfprocresult.md b/docs/tags/cfprocresult.md new file mode 100644 index 000000000..adefb6815 --- /dev/null +++ b/docs/tags/cfprocresult.md @@ -0,0 +1,26 @@ +# cfprocresult + +Associates a query object with a result set returned by a + stored procedure. Other CFML tags, such as cfoutput and + cftable, use this query object to access the result set. This + tag is nested within a cfstoredproc tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfprocresult(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name for the query result set. | +| resultset | numeric | No | | Names one result set, if stored procedure returns more than
    one. | +| maxrows | numeric | No | | Maximum number of rows returned in result set. | diff --git a/docs/tags/cfprogressbar.md b/docs/tags/cfprogressbar.md new file mode 100644 index 000000000..69dbfd1a9 --- /dev/null +++ b/docs/tags/cfprogressbar.md @@ -0,0 +1,30 @@ +# cfprogressbar + +Creates progressbar + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfprogressbar(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| width | string | No | | Width in pixel. Default='300' | +| height | string | No | | Height in pixel. | +| bind | string | No | | A bind expression specifying a client JavaScript function or server CFC that the control calls to get progress information each time the period defined by the
    interval attribute elapses. You cannot use this attribute with a duration attribute. | +| oncomplete | string | No | | This function will be called by CF once work is done. This can be used to reset status of progress bar text or enabling the button, which might be in disable mode while task was under progress or something more. | +| name | string | Yes | | Name of the progressBar. | +| duration | string | No | | If callback is not defined then based on this value, ColdFusion will decide percentage work done. One of the callback or totaltime attribute needs to be defined. | +| interval | string | No | | Time interval on which progressbar will keep on updating. | +| style | string | No | | The following are the supported styles:
    bgcolor: The background color for the progress bar. A hexadecimal value without # prefixed.
    textcolor: Text color on progress bar.
    progresscolor: Color used to indicate the progress | +| autoDisplay | string | No | | Set to true to display the progress bar. | +| onError | string | No | | The JavaScript function to run on an error condition. The error can be a network error or server-side error. | diff --git a/docs/tags/cfproperty.md b/docs/tags/cfproperty.md new file mode 100644 index 000000000..761dad7ed --- /dev/null +++ b/docs/tags/cfproperty.md @@ -0,0 +1,76 @@ +# cfproperty + +Defines properties of a CFML component (CFC). Used to + create complex data types for web services. The attributes of + this tag are exposed as component metadata and are subject to + inheritance rules. + +### Syntax + +```html + +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Specifies the name of the property. | +| type | string | No | | Specifies the ColdFusion data type for the property. | +| required | boolean | No | | Whether the parameter is required | +| default | string | No | | This sets the default value on the property when the object is created. For ORM Entities, this only works for static values. Variable values like the current timestamp can be set by a function "preInsert" in the component. | +| displayname | string | No | | A value to be displayed when using introspection to show
    information about the CFC. The value appears in parentheses
    following the property name. | +| hint | string | No | | Text to be displayed when using introspection to show
    information about the CFC. This attribute can be useful
    for describing the purpose of the parameter. | +| fieldtype | string | No | | This attribute is used to specify the type of the property. Use this attribute to specify the following:
    * Primary key: Specify fieldtype = "id" to map a property to the primary key in the table.
    * Column: Specify the fieldtype = "column" to map a property to a column in the table.
    * Relationship: Specify the fieldtype = "relationship_type". The relationship_type can be one-to-one, one-to-many, many-to-one, or many-to-many.
    * Version: Specify the fieldtype="version” to indicate that the column contains versioned data.
    * Timestamp: Specify the fieldtype="timestamp" to indicate the column contains data with timestamp.
    * Collection: Specify the fieldtype="collection" to define the collection mapping. | +| ormType | string | No | | Used to specify the data type of the primary key. If data type is not set and the ORM setting
    useDBForMapping=true, then the ormtype is determined by inspecting the database. | +| column | string | No | | Used to specify the primary key column name. | +| generator | string | No | | Algorithm used to generate unique identifiers for instances of the persistent CFC. | +| sequence | string | No | | Sequence key name in the database. | +| selectkey | string | No | | The column name that is used to retrieve the primary key generated by a database trigger. | +| params | string | No | | Additional parameters required by the various generators to generate the ID.
    The value for the params attribute should follow the CF Struct syntax. For example: params = {key1='value1', key2='value2'} | +| length | string | No | | Use this attribute to specify the length of the column. This attribute is used for table creation only. | +| precision | string | No | | Specifies the precision value. | +| index | string | No | | Specifies the name of an index that is created using the mapped column | +| setter | boolean | No | | Specifies whether to generate setter methods or not | +| getter | boolean | No | | Specifies whether to generate getter methods or not | +| source | string | No | vm | Specifies the source from where the timestamp has to be retrieved | +| elementcolumn | string | No | | Column name in the table that is used as value in struct. | +| elementtype | string | No | | Data type of the value. | +| structkeytype | string | No | | Specifies the data type of the key, when collectiontype=struct. | +| structkeycolumn | string | No | | The column in the target table to use as key if the collection type is struct. | +| inversejoincolumn | string | No | | Specifies the foreign key column in the Join table that references the primary key column in the target table. | +| linkschema | string | No | | Schema for the link table | +| linkcatalog | string | No | | Catalog for the link table | +| linktable | string | No | | Name of the link table | +| missingRowIgnored | boolean | No | | If the value is true, and the row that is referenced by the foreign key is missing, it is treated as a null
    association. The default is false, in which case an exception occurs. | +| inverse | boolean | No | | A Boolean value that specifies bidirectional association | +| orderby | string | No | | Specifies the Order By string. | +| fkcolumn | string | No | | Specifies the foreign key column | +| fetch | string | No | | Specifies if it is outer-join fetching or sequential select fetching | +| cascade | string | No | | Specifies which operations should be cascaded from the parent object to the associated object | +| constrained | boolean | No | | Whether a constraint is set on this table's Primary Key column to reference the Primary Key in the other table | +| unique | boolean | No | | Specifies if there should be a unique constraint on the column. | +| uniquekey | string | No | | Groups columns in a single unique key constraint. | +| notnull | boolean | No | | A Boolean value that specifies whether a notnull constraint should be added for this column. | +| update | string | No | | Whether the column should be included in the SQL update statement.
    Set update=false and insert=false if the column needs to be read-only. | +| insert | boolean | No | | Whether the column should be included in SQL UPDATE and/or INSERT statements.
    Set update=false and insert=false if the column needs to be read-only. | +| generated | string | No | | Specifies that this property value is actually generated by the database {never|always|insert}
    * never: Specifies that the value for this property is never generated by database
    * always: Specifies that the value for this property is always generated by database
    * insert: Specifies that the value for this property is generated at the time of insert but is not regenerated at updates. | +| formula | string | No | | SQL expression that defines the value of the property. If you specify a formula, the column value is ignored. | +| lazy | string | No | | Specifies if loading is to be done by parts: | +| optimisticLock | boolean | No | | Whether updates to this property require acquisition of the optimistic lock on the table row | +| scale | string | No | | Specifies the scale value | +| mappedby | string | No | | Property in the target CFC that is referenced by the foreign key in the Join table. | +| cfc | string | No | | Name of referenced CFC | +| joinColumn | string | No | | Use this attribute to define the join column for inheritance mapping. | +| validate | string | No | | Takes the validator to be used for validating data when implicit setter for this property is called. | +| validateParams | string | No | | Takes the parameters required by the validator specified in the validate attribute.
    This should be specified in the implicit struct notation eg. validateparams="{min=18,max=60}">.

    min: Minimum value if validate is integer/numeric/
    max: Maximum value if the validate is integer/numeric/
    minLength: Minimum length of the string if the validate is string
    maxLength: Maximum length of the string if the validate is string
    pattern: regex expression if the validator specified in validate attribute is regex | +| cacheUse | string | No | | Type of cache to use | +| sqlType | string | No | | Use this attribute to specify the DB-specific SQLType that should be used for the column. This attribute is used for table creation only.
    If this attribute is not specified, ColdFusion will automatically decide the SQLType based on the ormtype specified for this property. | +| dbDefault | string | No | | This sets the default value of a column in the table when schema is exported. | +| where | string | No | | Where condition | +| persistent | boolean | No | | Specifies whether this property should be persisted. If
    persistent="false‚ all the ORM related attributes are ignored.
    Set this attribute to false if you do not want this property to be persisted by ORM. | +| unSavedValue | string | No | | An identifier property value that indicates that an instance is newly instantiated and not saved/loaded in the database | +| serializable | boolean | No | | Specifies whether this property can be serialized. If you set this value to
    false, the property cannot be serialized, so any changes made are not retained on session replication, and the property has its default value (if any) on the second server.
    Use this attribute to prevent serialization of properties in CFCs that are serializable. | +| singularname | string | No | | Use this property to define the custom name for generated relationship methods. Applies to one-to-many and many-to-many | +| remotingFetch | boolean | No | | If remotingFetch is false, then the value of that attribute is not sent over flash remoting. remotingFetch is true by default was all properties. But in case of cfcs for which persistent = true, the value of the remotingFetch attribute is false by default for any property that shares one-to-one, one-to-many, many-to-one or many-to-many relationship. | +| table | string | No | | Table name | diff --git a/docs/tags/cfquery.md b/docs/tags/cfquery.md new file mode 100644 index 000000000..d696633a1 --- /dev/null +++ b/docs/tags/cfquery.md @@ -0,0 +1,161 @@ +# cfquery + +Passes queries or SQL statements to a data source. + It is recommended that you use the cfqueryparam tag within + every cfquery tag, to help secure your databases from + unauthorized users + +### Syntax + +```html +SQL +``` + +### Script Syntax + +```javascript +queryExecute(sql, params, options); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | No | | Name of query. Used in page to reference query record set.
    Must begin with a letter. Can include letters, numbers,
    and underscores. | +| datasource | string | No | | Name of data source from which query gets data. As of CF9+ you can specify a default datasource in Application.cfc using the variable this.datasource | +| timezone | string | No | | Lucee4+ the timezone used to convert a date object to a timestamp (string), this value is needed when your database runs in another timezone and you are not using cfqueryparam to insert dates. | +| dbtype | string | No | | Type of source query against which the SQL will be executed. Specify either dbtype or dataSource, not both. Supports the following values: `query`: for querying an existing query object (i.e. Query of Queries); `hql`: for querying an ORM. NOTE: Supported SQL syntax varies depending on this value. | +| username | string | No | | Overrides username in data source setup. | +| password | string | No | | Overrides password in data source setup. | +| maxrows | numeric | No | -1 | Maximum number of rows to return in record set.
    -1 returns all records. | +| blockfactor | numeric | No | | Maximum rows to get at a time from server. Range: 1 - 100.
    Might not be supported by some database systems. | +| timeout | numeric | No | | Maximum number of seconds that each action of a query is
    permitted to execute before returning an error. The
    cumulative time may exceed this value.

    For JDBC statements, CFML sets this attribute. For
    other drivers, check driver documentation. | +| cachedafter | date | No | | Date value (for example, April 16, 1999, 4-16-99). If date
    of original query is after this date, CFML uses
    cached query data. To use cached data, current query must
    use same SQL statement, data source, query name, user name,
    password.

    A date/time object is in the range 100 AD-9999 AD.

    When specifying a date value as a string, you must enclose
    it in quotation marks. | +| cachedwithin | numeric | No | | Timespan, using the CreateTimeSpan function. If original
    query date falls within the time span, cached query data is
    used. CreateTimeSpan defines a period from the present,
    back. Takes effect only if query caching is enabled in the
    Administrator.

    To use cached data, the current query must use the same SQL
    statement, data source, query name, user name, and password. | +| debug | boolean | No | NO | Yes: If debugging is enabled, but the Administrator
    Database Activity option is not enabled, displays SQL
    submitted to datasource and number of records returned
    by query.
    No: If the Administrator Database Activity option is
    enabled, suppresses display. | +| result | string | No | | CF8+ Specifies a name for the structure in which cfquery returns
    the result variables.
    * SQL: The SQL statement that was executed. (string)
    * Cached: If the query was cached. (boolean)
    * SqlParameters: An ordered Array of cfqueryparam values. (array)
    * RecordCount: Total number of records in the query. (numeric)
    * ColumnList: Column list, comma separated. (string)
    * ExecutionTime: Execution time for the SQL request. (numeric)
    * GENERATEDKEY: CF9+ If the query was an INSERT with an identity or auto-increment value the value of that ID is placed in this variable. | +| ormoptions | struct | No | | CF9+ A structure of ORM Options when used for HQL queries (9.0.1+). | +| cacheID | string | No | | CF10+ A value to serve as cache identifier when cachedWithin or cachedAfter are specified. | +| cacheRegion | string | No | | CF10+ The name of the region cachedWithin or cachedAfter are specified. | +| clientInfo | struct | No | | CF10+ A structure containing properties to be set on the database connection. | +| fetchClientInfo | boolean | No | false | CF10+ When true returns a struct with the clientInfo argument value passed by the last query | +| lazy | boolean | No | false | Lucee4+ If "lazy" is set to true Lucee does not initially load all the data from the datasource.

    When "true" the data is only loaded when requested, this means the data is dependent on the datasource connection. If the datasource connection has been lost for some reason and the data has not yet been requested,Lucee throws an error if you try to access the data.

    The "lazy" attribute only works if the following attributes are not used:cachewithin,cacheafter and result. | +| psq | boolean | No | false | Lucee4+ When true preserve single quotes within the sql statement | +| returntype | string | No | query | Lucee5+ The return type of the query result. One of the following values is accepted:
    - "query": returns a query object
    - "array_of_entity": returns an array of ORM entities (requires dbtype to be "hql")
    - "array": returns an array of structs
    - "struct": returns a struct of structs (requires columnkey to be defined). | +| columnkey | string | No | | Lucee5+ The struct key used for each result when returntype is "struct". | + +## Example CFQuery with CFQueryParam + +Shows how to use a cfqueryparam tag within cfquery. + +```html + + SELECT id,title,story + FROM news + WHERE id = + +``` + +## Script Syntax using QueryExecute + +CF11+ Also see the Tags Implemented as Components section for another method of using in script. + +```html +myQuery = queryExecute( + "SELECT myCol1, myCol2 FROM myTable + WHERE myCol1 = :myid + ORDER BY myCol1 ASC ", + {myid: 5}, + {datasource = "myDSN"} +); +writeDump(myQuery); +``` + +## Simple Query of Query Example + +A dummy query is first created from scratch using queryNew, then sorted. A query of query is performed by specifying dbtype="query" and then using a query object variable name as in the FROM statement. + +```html + + + + + + + + + + + + + SELECT id, title FROM news + ORDER BY title DESC + + +``` + +## Script Syntax using new Query() + +This syntax was implemented by script-based components in CF 9 & 10. Deprecated in ColdFusion 2018. Removed in ColdFusion 2025. It is superseded by queryExecute() in CF11. + +```html +queryObj = new Query( + name="qryDemo", + datasource="mydatasourcename", + sql = "SELECT col1, col2 + FROM myTable + WHERE id=:id" +); +queryObj.addParam(name="id",value=arguments.id, cfsqltype="cf_sql_integer"); +resultset=queryObj.execute().getResult(); +``` + +## Return Query as an Array of Structs + +Lucee5+ Return a query object converted into an array of structs. + +```html + + + + + + + SELECT * FROM users + + +``` + +### Expected Result: [ { firstname: "Han" } ] + +## Return Query as a Struct of Structs + +Lucee5+ Return a query object converted into a struct of structs. (Struct key is based on the "columnkey" parameter) + +```html + + + + + + + SELECT * FROM users + + +``` + +### Expected Result: { 1: { id: 1, firstname: "Han" } } + +## Insert a Record and Retrieve the Generated Key + +Inserts a new record into a table called myTable. The "ID" column is an auto-incremented primary key column. + +```html + + +INSERT INTO myTable ( name, email ) VALUES ( 'Joe', 'joe@domain.com' ) + + + + +``` diff --git a/docs/tags/cfqueryparam.md b/docs/tags/cfqueryparam.md new file mode 100644 index 000000000..147836f3a --- /dev/null +++ b/docs/tags/cfqueryparam.md @@ -0,0 +1,145 @@ +# cfqueryparam + +Verifies the data type of a query parameter and, for DBMSs that support bind variables, enables CFML to use bind variables in the SQL statement. Bind variable usage enhances performance when executing a cfquery statement multiple times. + + This tag is nested within a cfquery tag, embedded in a query SQL statement. If you specify optional parameters, this tag performs data validation. + +NOTE: Due to security it's highly recommended to use this tag for any user input or non-static value used in a query to prevent code injections and the like. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfqueryparam(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| value | string | No | | Value that CFML passes to the right of the comparison operator in a where clause.

    If CFSQLType is a date or time option, ensure that the date value uses your DBMS-specific date format. Use the CreateODBCDateTime or DateFormat and TimeFormat functions to format the date value. | +| cfsqltype | string | No | | SQL type that parameter (any type) is bound to. As of CF11+ or Lucee4.5+ you can omit the `cf_sql_` prefix.
    See [CFSqlType Cheatsheet](https://cfdocs.org/cfsqltype-cheatsheet) for a mapping of CFSQL data types to DBMS data types. | +| maxlength | numeric | No | | Maximum length of parameter. | +| scale | numeric | No | 0 | Number of decimal places in parameter. Applies to `CF_SQL_NUMERIC` and `CF_SQL_DECIMAL`. | +| null | boolean | No | | Whether parameter is passed as a `NULL` value.

    Yes: ignores the `value` attribute and passes `NULL`
    No: passes the `value` attribute | +| list | boolean | No | | Yes: The value attribute value is a delimited list
    No: it is not | +| separator | string | No | | Character that separates values in list, in value attribute. | + +## Basic example + +Shows how to use a cfqueryparam tag within cfquery. + +```html + + SELECT id,title,story + FROM news + WHERE id = + +``` + +## Using a list on an IN statement + +Assumes url.idList is a comma separated list of integers, eg: 1,2,3 + +```html + + SELECT id,title,story + FROM news + WHERE id IN () + +``` + +## Using an expressions to controll null values + +Shows a basic example of using an expression to control whether null is passed to the queryparam + +```html + + INSERT into test ( key, value ) + VALUES( + + + ) + +``` + +## cfscript equivalent of cfqueryparam + +CF11+ script syntax using queryExecute and struct notation + +```html +exampleData = queryNew("id,title","integer,varchar",[{"id":1,"title":"Dewey defeats Truman"},{"id":2,"title":"Man walks on Moon"}]); + +result = queryExecute( + "SELECT title FROM exampleData WHERE id = :id", + { id = 2 }, + { dbtype="query" } +); + +writeOutput( result.title[1] ); +``` + +### Expected Result: Man walks on Moon + +## cfscript equivalent of cfqueryparam + +CF11+ script syntax using queryExecute and struct notation for multiple parameters + +```html +exampleData = queryNew("id,title","integer,varchar",[{"id":1,"title":"Dewey defeats Truman"},{"id":2,"title":"Man walks on Moon"}]); + +result = queryExecute( + "SELECT * FROM exampleData WHERE id = :id AND title = :title", + { + title={value="Man walks on Moon", cfsqltype="cf_sql_varchar"}, id={value=2, cfsqltype="cf_sql_integer"} + }, + { dbtype="query" } +); + +writeOutput(result.title[1]); +``` + +### Expected Result: Man walks on Moon + +## cfscript equivalent of cfqueryparam + +CF11+ script syntax using queryExecute and full array notation + +```html +exampleData = queryNew("id,title","integer,varchar",[{"id":1,"title":"Dewey defeats Truman"},{"id":2,"title":"Man walks on Moon"}]); + +result = queryExecute( + "SELECT title FROM exampleData WHERE id = ?", + [ + { value=2, cfsqltype="cf_sql_varchar" } + ], + { dbtype="query" } +); + +writeOutput( result.title[1] ); +``` + +### Expected Result: Man walks on Moon + +## cfscript equivalent of cfqueryparam + +CF11+ script syntax using queryExecute and array shorthand + +```html +exampleData = queryNew("id,title","integer,varchar",[{"id":1,"title":"Dewey defeats Truman"},{"id":2,"title":"Man walks on Moon"}]); + +result = queryExecute( + "SELECT title FROM exampleData WHERE id = ?", + [ 2 ], + { dbtype="query" } +); + +writeOutput( result.title[1] ); +``` + +### Expected Result: Man walks on Moon diff --git a/docs/tags/cfregistry.md b/docs/tags/cfregistry.md new file mode 100644 index 000000000..ca3bb6dea --- /dev/null +++ b/docs/tags/cfregistry.md @@ -0,0 +1,37 @@ +# cfregistry + +Reads, writes, and deletes keys and values in the system registry. + Provides persistent storage of client variables. + This tag is deprecated for the UNIX platform. + Note: For this tag to execute, it must be enabled in the ColdFusion MX + Administrator. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfregistry(action="getAll"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | Action to perform | +| branch | string | No | | Name of a registry branch. | +| entry | string | No | | Registry value to access.
    Note: For key deletion this attribute is required. | +| variable | string | No | | Variable into which to put value. | +| type | string | No | String | | +| sort | string | No | | Sorts query column data (case-insensitive). Sorts on Entry, Type,
    and Value columns as text. Specify a combination of columns from
    query output, in a comma-delimited list.
    For example: sort = "value desc, entry asc"
    * asc: ascending (a to z) sort order.
    * desc: descending (z to a) sort order. | +| directory | string | No | | Absolute pathname of directory against which to perform
    action. | +| name | string | No | | Name for output record set. | +| mode | string | No | | Applies only to UNIX and Linux. Permissions. Octal values
    of Unix chmod command. Assigned to owner, group, and
    other, respectively. | +| newdirectory | string | No | | New name for directory. | +| value | string | No | | Value data to set. If you omit this attribute, the cfregistry tag creates default value, as follows:
    * string: creates an empty string: "".
    * dWord: creates a value of 0 (zero). | +| recurse | boolean | No | NO | Whether ColdFusion performs the action on subdirectories. | +| registryversion | string | No | | No Help Available | diff --git a/docs/tags/cfreport.md b/docs/tags/cfreport.md new file mode 100644 index 000000000..1379751e4 --- /dev/null +++ b/docs/tags/cfreport.md @@ -0,0 +1,47 @@ +# cfreport + +Used to do either of the following: + - Execute a report definition created with the ColdFusion + Report Builder, displaying it in PDF, FlashPaper, or Excel + format. You can optionally save this report to a file. + - Run a predefined Crystal Reports report. Applies only to + Windows systems. Uses the CFCRYSTAL.exe file to generate + reports. Sets parameters in the Crystal Reports engine + according to its attribute values. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfreport(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| template | string | No | | Specifies the path to the report definition file,
    relative to the web root. | +| format | string | No | | Specifies the output format. | +| name | string | No | | The name of the ColdFusion variable that will hold
    the report output. You cannot specify both name and
    filename. | +| filename | string | No | | The filename to contain the report. You cannot
    specify both name and filename. | +| query | string | No | | The name of the query that contains input data for
    the report. If you omit this parameter, the report
    definition obtains data from the internal SQL or from
    cfreportparam items. | +| overwrite | boolean | No | NO | Specifies whether to overwrite files that have the
    same name as that specified in the filename attribute.
    Default: false | +| encryption | string | No | none | Specifies whether the output is encrypted. PDF format only.
    Default: none | +| ownerpassword | string | No | | Specifies an owner password. PDF format only. | +| userpassword | string | No | | Specifies a user password. PDF format only. | +| permissions | string | No | | Specifies one or more permissions. PDF format only.
    Separate multiple permissions with a comma. | +| datasource | string | No | | Name of registered or native data source. | +| type | string | No | standard | * standard (not valid for Crystal Reports 8.0)
    * netscape
    * microsoft | +| timeout | numeric | No | | Maximum time, in seconds, in which a connection must be
    made to a Crystal Report. | +| report | string | No | | Report path. Store Crystal Reports files in the same
    directories as CFML page files. | +| orderby | string | No | | Orders results according to your specifications. | +| username | string | No | | Username required for entry into database from which report
    is created. Overrides default settings for data source in
    CFML Administrator. | +| password | string | No | | Password that corresponds to username required for database
    access. Overrides default settings for data source in
    CFML Administrator. | +| formula | string | No | | One or more named formulas. Terminate each formula with a
    semicolon. Use the format:

    formula = "formulaname1='formula1';formulaname2='formula2';"

    If you use a semicolon in a formula, you must escape it by
    typing it twice (;;). For example:

    formula = "Name1 = 'Val_1a;;Val_1b';Name2 = 'Val2';" | +| resourceTimespan | variableName | No | | Life span of the resource directory. Used only with format=HTML | +| style | string | No | | Style in CSS format that overrides a style defined in the Report Builder report at run time. | diff --git a/docs/tags/cfreportparam.md b/docs/tags/cfreportparam.md new file mode 100644 index 000000000..cc0d76db9 --- /dev/null +++ b/docs/tags/cfreportparam.md @@ -0,0 +1,28 @@ +# cfreportparam + +Passes input parameters to a ColdFusion Report Builder + report definition. Allowed inside cfreport tag bodies only. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfreportparam(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | No | | Variable name for data that is passed. The ColdFusion
    Report Builder report definition must include an input
    parameter that matches this name. | +| value | string | No | | Value of the data that is sent. | +| chart | string | No | | Name of the chart contained in a report or subreport. The value of this attribute must match Name property of a chart defined in the Report Builder report. | +| query | query | No | | Query value to pass to a subreport or chart. The ColdFusion query must contain at least all of the columns included in the Report Builder query. | +| series | numeric | No | | Ordinal number of a chart series to use for the query. This attribute is valid only when the chart attribute is specified. | +| style | string | No | | Style in CSS format for a subreport. | +| subreport | string | No | | Name of the subreport. | diff --git a/docs/tags/cfrethrow.md b/docs/tags/cfrethrow.md new file mode 100644 index 000000000..37c6b4f2f --- /dev/null +++ b/docs/tags/cfrethrow.md @@ -0,0 +1,11 @@ +# cfrethrow + +Rethrows the currently active exception. Preserves the + exception's `cfcatch.type` and `cfcatch.tagContext` variable + values. + +### Syntax + +```html + +``` diff --git a/docs/tags/cfretry.md b/docs/tags/cfretry.md new file mode 100644 index 000000000..2b67f0f39 --- /dev/null +++ b/docs/tags/cfretry.md @@ -0,0 +1,72 @@ +# cfretry + +Used within a catch block to jump back to the beginning of the try statement. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +retry +``` + +## Tag Syntax - basic example + +Throw an error and retry within cfcatch until the iteration counter is equal to 3. + +```html + + + + + + + Done! + + + + + + #cfcatch.message# + + + + + + + + +``` + +### Expected Result: Too soon. Too soon. Done! + +## Script Syntax - basic example + +Throw an error and retry within catch until the iteration counter is equal to 3. + +```html +iterations = 1; +limit = 3; + +try { + if (iterations == limit) { + writeOutput('Done!'); + } else { + throw(message='Too soon. '); + } +} +catch(any e) { + writeOutput('#cfcatch.message#'); + + iterations += 1; + if (iterations <= limit) { + retry; + } +} +``` + +### Expected Result: Too soon. Too soon. Done! diff --git a/docs/tags/cfreturn.md b/docs/tags/cfreturn.md new file mode 100644 index 000000000..075c9ccb7 --- /dev/null +++ b/docs/tags/cfreturn.md @@ -0,0 +1,50 @@ +# cfreturn + +Returns result values from a component method. Contains an + expression returned as result of the function. + An expression; the result of the function from which this tag + is called. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +return; +``` + +## A simple cfreturn example + +The function Department return the addition value of a & b. The below code is tag based code example + +```html + + + + + + +#Department(6,7)# +``` + +### Expected Result: 13 + +## A simple cfreturn ( return ) example + +The function Department return the subtraction value of a & b. The below code is script based code example + +```html + + public function Department(a,b){ + c = arguments.a - arguments.b; + return c; + } + +#Department(6,7)# +``` + +### Expected Result: -1 diff --git a/docs/tags/cfsavecontent.md b/docs/tags/cfsavecontent.md new file mode 100644 index 000000000..8e7afa7ed --- /dev/null +++ b/docs/tags/cfsavecontent.md @@ -0,0 +1,37 @@ +# cfsavecontent + +Saves the generated content of the cfsavecontent tag, including the results of evaluating expressions and executing custom tags, in the specified variable. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +savecontent variable="" {}; +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| variable | string | Yes | | Name of the variable in which to save the generated content of the tag. | + +## Script Syntax + +```html +savecontent variable="myContent" { + writeOutput("Somecontent."); +} +``` + +## Tag Syntax + +```html + +Some content. + +``` diff --git a/docs/tags/cfschedule.md b/docs/tags/cfschedule.md new file mode 100644 index 000000000..f1b399587 --- /dev/null +++ b/docs/tags/cfschedule.md @@ -0,0 +1,117 @@ +# cfschedule + +Provides a programmatic interface to the CFML scheduling engine. Can run a CFML page at scheduled intervals, with the option to write the page output to a static HTML page. This feature enables you to schedule pages that publish data, such as reports, without waiting while a database transaction is performed to populate the page. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfschedule(action="delete", task=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | delete: deletes the specified task
    update: updates an existing task or creates a new task, if one with the name specified by the task attribute does not exist
    run: executes the specified task
    pause: Pauses the specified task.
    resume: Continues executing the specified task.
    list: Lists all the scheduled tasks.
    pauseall: CF10+ Pauses all scheduled tasks.
    resumeall: CF10+ Resume all scheduled tasks for a particular application.
    create: CF2018u2+ Create a fresh task. If a task already exists, an error is thrown.
    modify: CF2018u2+ Modifies an existing task while retaining its old values. | +| task | string | No | | Name of the task. Not required if action attribute is set to list, otherwise it is required. | +| operation | string | No | HTTPRequest | Operation that the scheduler performs. Must be HTTPRequest. | +| file | string | No | | Name of the file in which to store the published output of the scheduled task. | +| path | string | No | | Path to the directory in which to put the published file.
    NOTE: This is Required if `publish` is "Yes". | +| startdate | string | No | | Date on which to first run the scheduled task. | +| starttime | string | No | | Time at which to run the scheduled of task starts. | +| URL | string | No | | URL of the page to execute. | +| port | numeric | No | 80 | Port to use on the server that is specified by the url parameter. If resolveURL = "yes", retrieved document URLs that specify a port number are automatically resolved, to preserve links in the retrieved document. A port value in the url attribute overrides this value. | +| publish | boolean | No | NO | Yes: save the result to a file
    No: does not | +| endDate | string | No | | Date when scheduled task ends. | +| endTime | numeric | No | | Time when scheduled task ends (seconds). | +| interval | string | No | | Interval at which task is scheduled.
    * number of seconds (minimum is 60)
    * once
    * daily
    * weekly
    * monthly | +| requesttimeout | numeric | No | | Deprecated as of CF11+, Removed in CF2018 Used to extend the default timeout period. | +| username | string | No | | Username, if URL is protected. | +| password | string | No | | Password, if URL is protected. | +| proxyserver | string | No | | Host name or IP address of a proxy server. | +| proxyport | numeric | No | 80 | Port number to use on the proxy server. | +| proxyuser | string | No | | User name to provide to the proxy server. | +| proxypassword | string | No | | Password to provide to the proxy server. | +| resolveurl | boolean | No | NO | Yes: resolve links in the output page to absolute references
    No: does not | +| group | string | No | default | CF11+ The group to which the scheduled task belongs. | +| mode | string | No | server | CF10+ If the task is server-specific or application specific. | +| result (CF10+)/returnvariable (lucee) | query | No | | Name for the query in which cfschedule returns the result variables.
    NOTE: Required for `action`="list" | +| eventHandler | string | No | | CF10+ A CFC file which implements CFIDE.scheduler.ITaskEventHandler and is invoked for events while running the task.
    Note: CF 2018 Enterprise Required; not supported in Standard Edition | +| onException | string | No | invokeHandler, if eventHandler is specified | CF10+ Specify the action to take if a task results in error.
    Note: CF 2018 Enterprise Required; not supported in Standard Edition | +| onComplete | string | No | invokeHandler | CF10+ The action or task to perform after completion of the current task. Can be used to chain dependent tasks by executing a task after this task completes.
    Note: CF 2018 Enterprise Required; not supported in Standard Edition | +| onMisfire | string | No | invokeHandler if eventHandler is specified | CF10+ Specify what to do if a task misfires. If unspecified, then no action is taken.
    Note: CF 2018 Enterprise Required; not supported in Standard Edition | +| cronTime | numeric | No | | CF10+ Schedule the task time in quartz cron expression format (6 or 7 space-seperated values). Format is: second, minute, hour, day of month, month, day of week, year. Second value is required, as are the rest, but year is optional. | +| repeat | string | No | -1 | CF10+ Specify the number of times a given schedule has to repeat. | +| retryCount | numeric | No | 3 | CF10+ Specify the number of times to retry the task if the task fails. Must be between 0 and 3, inclusive. | +| priority | numeric | No | 5 | CF10+ Set the priority of this task. | +| exclude | string | No | | CF10+ Comma-separated list of dates or date range on which to not execute the scheduled task. | +| cluster | boolean | No | no | CF10+ If yes, the task can be executed in a cluster setup.
    Note: CF 2018 Enterprise Required; not supported in Standard Edition | +| overwrite | boolean | No | true | CF10+ Specify whether to overwrite the output files on task execution (if true) or create new output files (if false). | +| unique | boolean | No | true | lucee4.5+ If true, the scheduled task is only executed once at time. If a task is still running from previous round no new task is started. | +| autodelete | boolean | No | | lucee4.5+ If set to true, the scheduled task will be deleted when there is no possible future execution. | +| readonly | boolean | No | | lucee4.5+ If true, the scheduled task can not be modified or deleted in the Lucee Administrator. | + +## Create or update a task + +Tell ColdFusion to run 'importData.cfm' daily at 7AM + +```html + +``` + +## Delete a scheduled task + +Delete the task 'importMyCSVFileToDB' from the list of ColdFusion scheduled jobs + +```html + +``` + +## Exclude a date from the task execution schedule + +CF10+ Instruct ACF not to execute the task on the set date, date range, or list of dates + +```html + +``` + +## Use cron time format to schedule a task + +CF10+ Execute a task every 2 minutes from 3:00 AM to 10:00 AM and 9:00 PM to 11:58 PM daily + +```html + +``` + +## List all scheduled tasks + +List and dump all scheduled tasks running in ColdFusion instance + +```html + + +``` diff --git a/docs/tags/cfscript.md b/docs/tags/cfscript.md new file mode 100644 index 000000000..e1238542f --- /dev/null +++ b/docs/tags/cfscript.md @@ -0,0 +1,37 @@ +# cfscript + +Encloses a code block that contains cfscript statements. + + You cannot use some CFML reserved words in this tag. You + cannot put a user-defined function whose name begins with any + of these strings within this tag: + cf,cf_,_cf,CFML,CFML_,_CFML + +### Syntax + +```html + +``` + +## Script Syntax + +```html + + x = y = 1; + writeDump(x); + +``` + +## semi-colons are optional (CF2018+) + +CF2018+ Optional to use semicolons at the end of a statement. + +```html + + a = 5 + b = 10 + writeDump(a+b) + +``` + +### Expected Result: 15 diff --git a/docs/tags/cfsearch.md b/docs/tags/cfsearch.md new file mode 100644 index 000000000..06030006b --- /dev/null +++ b/docs/tags/cfsearch.md @@ -0,0 +1,41 @@ +# cfsearch + +Searches Verity collections using CFML or K2Server, whichever search engine a collection is registered by. + (CFML can also search collections that have not been + registered, with the cfcollection tag.) + + A collection must be created and indexed before this tag can + return search results. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfsearch(name="", collection=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name of the search query. | +| collection | string | Yes | | One or more collection names. You can specify more
    than one collection unless you are performing a
    category search (that is, specifying category or
    categoryTree).

    One or more collection names. You can specify more
    than one collection unless you are performing a category search (that is, specifying category or categoryTree). | +| category | string | No | | A list of categories, separated by commas, to which
    the search is limited. If specified, and the collection
    does not have categories enabled, ColdFusion

    throws an exception. | +| categorytree | string | No | | The location in a hierarchical category tree at which
    to start the search. ColdFusion searches at and
    below this level. If specified, and the collection does
    not have categories enabled, ColdFusion throws an
    exception. Can be used in addition to category
    attribute. | +| status | string | No | | Specifies the name of the structure variable into
    which ColdFusion places search information, including
    alternative criteria suggestions (spelling corrections). | +| type | string | No | simple | Used to specify the parser that Verity/SOLR uses to process
    the criteria. | +| criteria | string | No | | Search criteria. Follows the syntax rules of the type
    attribute. If you pass a mixed-case entry in this attribute,
    the search is case-sensitive. If you pass all uppercase or
    all lowercase, the search is case-insensitive. Follow
    Verity syntax and delimiter character rules; see Using Verity Search Expressions in Developing CFML MX Applications. | +| maxrows | numeric | No | all | Maximum number of rows to return in query results.
    Default: all | +| startrow | numeric | No | 1 | First row number to get.
    Default: 1 | +| suggestions | string | No | never | Specifies whether Verity/SOLR returns spelling suggestions
    for possibly misspelled words. | +| contextPassages | numeric | No | 3 | The number of passages/sentences Verity returns in
    the context summary (that is, the context column of
    the results).
    Default: 3 | +| contextBytes | numeric | No | 300 | The maximum number of bytes Verity returns in the
    context summary.
    Default: 300 | +| contextHighlightBegin | string | No | | The HTML to prepend to search terms in the context
    summary. Use this attribute in conjunction with
    contextHighlightEnd to highlight search terms in the
    context summary. | +| contextHighlightEnd | string | No |
    | The HTML to prepend to search terms in the context
    summary. Use this attribute in conjunction with
    contextHighlightEnd to highlight search terms in the
    context summary. | +| previousCriteria | string | No | | The name of a result set from an existing set of search
    results. Verity searches the result set for criteria
    without regard to the previous search score or rank.
    Use this attribute to implement searching within result
    sets. | +| language | string | No | | Deprecated. This attribute is now ignored and the language of the collection is used to perform the search. | diff --git a/docs/tags/cfselect.md b/docs/tags/cfselect.md new file mode 100644 index 000000000..8f9714016 --- /dev/null +++ b/docs/tags/cfselect.md @@ -0,0 +1,57 @@ +# cfselect + +Constructs a drop-down list box form control. Used within a + cfform tag. + + You can populate the list from a query, or by using the HTML + option tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfselect(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name of the select form element | +| id | string | No | | ID for form input element. | +| bind | string | No | | A bind expression that dynamically sets an attribute
    of the control. | +| bindAttribute | string | No | | Specifies the HTML tag attribute whose value is set
    by the bind attribute. You can only specify attributes
    in the browser‚ HTML DOM tree, not ColdFusion-
    specific attributes.
    Ignored if there is no bind attribute. | +| bindOnLoad | boolean | No | NO | A Boolean value that specifies whether to execute
    the bind attribute expression when first loading the
    form. Ignored if there is no bind attribute. | +| editable | boolean | No | NO | Boolean value specifying whether you can edit the
    contents of the control. | +| label | string | No | | Label to put next to the control on a Flash or XML-format form. | +| style | string | No | | In HTML or XML format forms, ColdFusion passes the
    style attribute to the browser or XML.
    In Flash format, must be a style specification in CSS
    format, with the same syntax and contents as used in
    Macromedia Flex for the corresponding Flash element.
    Post alpha we will document specifics. | +| sourceForTooltip | string | No | | The URL of a page to display as a tool tip. The page
    can include CFML and HTML markup to control the
    tip contents and format, and the tip can include
    images.
    If you specify this attribute, an animated icon
    appears with the text "Loading..." while the tip is
    being loaded. | +| size | numeric | No | 1 | Number of entries to display at one time. The default, 1,
    displays a drop-down list. Any other value displays a list
    box with size number of entries visible at one time. | +| required | boolean | No | NO | If true a list element must be selected when form is submitted.
    Note: This attribute has no effect if you omit the size
    attribute or set it to 1 because the browser always submits
    the displayed item. You can work around this issue format
    forms by having an initial option tag with value=" " (note the
    space character between the quotation marks).
    Default: false | +| message | string | No | | Message to display if required="true" and no selection is made. | +| onerror | string | No | | Custom JavaScript function to execute if validation fails. | +| multiple | boolean | No | NO | - true: allow selecting multiple elements in drop-down list
    - false: don't allow selecting multiple elements
    Default: false | +| query | string | No | | Name of query to populate drop-down list. | +| value | string | No | | Query column to use for the value of each list element.
    Used with query attribute. | +| display | string | No | | Query column to use for the display label of each list
    element. Used with query attribute. | +| group | string | No | | Query column to use to group the items in the drop-down
    list into a two-level hierarchical list. | +| queryposition | string | No | above | If you populate the options list with a query and use HTML
    option child tags to specify additional entries, determines
    the location of the items from the query relative to the items
    from the option tags:
    - above: Put the query items above the options items.
    - below: Put the query items below the options items.
    Default: above | +| selected | string | No | | One or more option values to preselect in the selection list.
    To specify multiple values, use a comma-delimited list. This
    attribute applies only if selection list items are generated
    from a query. The cfform preservedata attribute value can
    override this value. | +| onkeyup | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run
    when the user releases a keyboard key in the control. | +| onkeydown | string | No | | JavaScript (HTML/XML) or ActionScript (Flash)
    ActionScript to run when the user depresses a keyboard
    key in the control. | +| onmouseup | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run
    when the user presses a mouse button in the control. | +| onmousedown | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run
    when the user releases a mouse button in the control. | +| onchange | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run
    when the control changes due to user action. | +| onclick | string | No | | JavaScript to run when the user clicks the control. | +| enabled | boolean | No | YES | Flash only: Boolean value specifying whether to show the control.
    Space that would be occupied by an invisible control is
    blank.
    Default: true | +| visible | boolean | No | YES | Flash only: Boolean value specifying whether to show the control.
    Space that would be occupied by an invisible control is
    blank.
    Default: true | +| tooltip | string | No | | Flash only: Text to display when the mouse pointer hovers over the control. | +| height | numeric | No | | The height of the control, in pixels. | +| width | numeric | No | | The width of the control, in pixels. | +| passthrough | string | No | | This attribute is deprecated.

    Passes arbitrary attribute-value pairs to the HTML code
    that is generated for the tag. You can use either of the
    following formats:

    passthrough="title=""myTitle"""
    passthrough='title="mytitle"' | +| onbinderror | string | No | | The name of a JavaScript function to execute if evaluating a bind expression results in an error. The function must take two attributes: an HTTP status code and a message. | diff --git a/docs/tags/cfservlet.md b/docs/tags/cfservlet.md new file mode 100644 index 000000000..2d3b76152 --- /dev/null +++ b/docs/tags/cfservlet.md @@ -0,0 +1,15 @@ +# cfservlet + +Deprecated, invokes a servlet. Use `getPageContext().include(servletPath)` or `getPageContext().forward(servletPath)` instead. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfservlet(); +``` diff --git a/docs/tags/cfservletparam.md b/docs/tags/cfservletparam.md new file mode 100644 index 000000000..a2f2079fd --- /dev/null +++ b/docs/tags/cfservletparam.md @@ -0,0 +1,15 @@ +# cfservletparam + +Deprecated, invokes a servlet. Use `getPageContext().include(servletPath)` or `getPageContext().forward(servletPath)` instead. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfservletparam(); +``` diff --git a/docs/tags/cfset.md b/docs/tags/cfset.md new file mode 100644 index 000000000..6a85ea490 --- /dev/null +++ b/docs/tags/cfset.md @@ -0,0 +1,41 @@ +# cfset + +Sets a value in CFML. Used to create a variable, if it + does not exist, and assign it a value. Also used to call + functions. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +x = 1; +``` + +## Script Syntax + +```html +x = y = 1; +z = [ + !x, + x == 1 && y == 2, + x == 1 || y == 2 +]; +writeDump(z); +``` + +## Tag Syntax + +```html + + + +``` diff --git a/docs/tags/cfsetting.md b/docs/tags/cfsetting.md new file mode 100644 index 000000000..0c5b646dd --- /dev/null +++ b/docs/tags/cfsetting.md @@ -0,0 +1,74 @@ +# cfsetting + +Controls aspects of page processing, such as the output of content outside cfoutput tags. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +setting enablecfoutputonly=true|false; +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| enablecfoutputonly | boolean | No | false | true: Blocks output of content that is outside cfoutput tags.
    false: Displays content that is outside cfoutput tags. | +| showdebugoutput | boolean | No | true | true: If debugging is enabled in the Administrator, displays
    debugging information
    false: suppresses debugging information that would otherwise
    display at end of generated page. | +| requesttimeout | numeric | No | | Integer; number of seconds. Time limit, after which
    CFML processes the page as an unresponsive thread.
    Overrides the timeout set in the CFML Administrator. | + +## Script Syntax + +Enable cfoutput only + +```html +setting enablecfoutputonly=true; +``` + +## Script Syntax + +Disables debug output + +```html +setting showdebugoutput=false; +``` + +## Script Syntax + +Set the request timeout to 30 seconds + +```html +setting requesttimeout=30; +``` + +## Tag Syntax + +Enable cfoutput only + +```html + +Foo bar +``` + +### Expected Result: bar + +## Tag Syntax + +Disables debug output + +```html + +``` + +## Tag Syntax + +Set the request timeout to 30 seconds + +```html + +``` diff --git a/docs/tags/cfsharepoint.md b/docs/tags/cfsharepoint.md new file mode 100644 index 000000000..fa3dec0ca --- /dev/null +++ b/docs/tags/cfsharepoint.md @@ -0,0 +1,29 @@ +# cfsharepoint + +Invokes a feature that SharePoint exposes as a web service action, such as the Document Workspace +getdwsdata action. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfsharepoint(action="cancreatedwsurl"); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| password | string | No | | The password required to connect to the SharePoint server. Required if you do not specify a
    login attribute. | +| action | string | Yes | | The name of a web service action. See Usage for the list of service actions you can specify. | +| login | struct | No | | A structure containing user, password, and domain login credentials to pass to the service. If you do not specify
    domain ,password, and userNameattributes you must specify a login structure with domain, password, and userName entries. | +| params | struct | No | | A structure containing names and values of the parameters to pass to the service. | +| domain | string | No | | The domain name required to connect to the SharePoint server. Required if you do not specify a login attribute. | +| username | string | No | | The user name required to connect to the SharePoint server. Required if you do not specify a
    login attribute. | +| name | string | No | | Name of the result variable in which to put the data returned by the SharePoint service. | +| wsdl | string | No | | Path to the service wsdl file. Required to invoke an action that is not in the list of supported actions. See Usage for details. | diff --git a/docs/tags/cfsilent.md b/docs/tags/cfsilent.md new file mode 100644 index 000000000..dcddcf081 --- /dev/null +++ b/docs/tags/cfsilent.md @@ -0,0 +1,30 @@ +# cfsilent + +Suppresses output produced by CFML within the body of the tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfsilent(); +``` + +## Example for cfsilent tag + +Content within cfsilent tag will not be displayed + +```html + + + + This is from inside cfsilent #a+b# + + This is from outside cfsilent #a-b# +``` + +### Expected Result: This is from outside cfsilent 5 diff --git a/docs/tags/cfsleep.md b/docs/tags/cfsleep.md new file mode 100644 index 000000000..f22d3ec14 --- /dev/null +++ b/docs/tags/cfsleep.md @@ -0,0 +1,32 @@ +# cfsleep + +Causes the current thread to sleep for the given number of milliseconds. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +sleep(duration) +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| time | numeric | Yes | | The number of milliseconds to sleep for. | + +## Tag Syntax + +Dump the current time using a loop, delay 2 seconds each iteration. + +```html + + + + +``` diff --git a/docs/tags/cfslider.md b/docs/tags/cfslider.md new file mode 100644 index 000000000..cc7c57954 --- /dev/null +++ b/docs/tags/cfslider.md @@ -0,0 +1,54 @@ +# cfslider + +Puts a slider control, for selecting a numeric value from a + range, in a ColdFusion form. The slider moves over the slider + groove. As the user moves the slider, the current value + displays. Used within a cfform tag. + Not supported with Flash forms. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfslider(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| name | string | Yes | | Name for cfslider control. | | +| label | string | No | | Label to display with control.
    For example, "Volume" This displays: "Volume %value%"
    To reference the value, use "%value%". If %% is omitted,
    slider value displays directly after label. | | +| range | string | No | 0,100 | Numeric slider range values.
    Separate values with a comma. | | +| scale | numeric | No | | Unsigned integer. Defines slider scale, within range.
    For example: if range = "0,1000" and scale = "100",
    the display values are: 0, 100, 200, 300, ...
    Signed and unsigned integers in ColdFusion are in the
    range -2,147,483,648 to 2,147,483,647. | | +| value | string | No | | Starting slider setting. Must be within the range values. | | +| onvalidate | string | No | | Custom JavaScript function to validate user input; in this
    case, a change to the default slider value. Specify only
    the function name. | | +| message | string | No | | Message text to appear if validation fails. | | +| height | numeric | No | 40 | Slider control height, in pixels. | | +| width | numeric | No | | Slider control width, in pixels. | | +| vspace | numeric | No | | Vertical spacing above and below slider, in pixels. | | +| hspace | numeric | No | | Horizontal spacing to left and right of slider, in pixels. | | +| align | string | No | | Alignment of slider:
    * top
    * left
    * bottom
    * baseline
    * texttop
    * absbottom
    * middle
    * absmiddle
    * right | /Users/garethedwards/development/github/cfdocs/docs/tags/cfslider.md|right | +| lookandfeel | string | No | windows | - motif: renders slider in Motif style
    - windows: renders slider in Windows style
    - metal: renders slider in Java Swing style
    If platform does not support style option, tag defaults to
    platform default style.
    Default: windows | /Users/garethedwards/development/github/cfdocs/docs/tags/cfslider.md|metal | +| vertical | boolean | No | NO | Yes: Renders slider in browser vertically. You must set
    width and height attributes; ColdFusion does not
    automatically swap width and height values.
    No: Renders slider horizontally. | | +| bgcolor | string | No | | Background color of control. For a hex value, use the form:
    textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
    signs or none. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfslider.md|yellow | +| textcolor | string | No | | Text color for control. For a hex value, use the form:
    textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
    signs or none. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfslider.md|yellow | +| font | string | No | arial | Font name for data in tree control. | /Users/garethedwards/development/github/cfdocs/docs/tags/cfslider.md|arialunicodeMS | +| fontsize | numeric | No | | Font size for text in tree control, in points. | | +| italic | boolean | No | NO | Yes: displays tree control text in italics
    No: it does not | | +| bold | boolean | No | NO | Yes: displays tree control text in bold
    No: it does not | | +| notsupported | string | No | Browser must support Java to
    view ColdFusion Java Applets!
    | Text to display if a page that contains a Java applet-based
    cfform control is opened by a browser that does not
    support Java or has Java support disabled. | | +| clickToChange | boolean | No | | Whether clicking the slider changes the value of the pointer: | | +| max | numeric | No | | Maximum value for the slider. | | +| onChange | string | No | | Custom JavaScript function to run when slider value changes.
    Specify only the function name. | | +| min | numeric | No | | Minimum value for the slider. | | +| onDrag | string | No | | Custom JavaScript function to run when you drag the slider.
    Specify only the function name. | | +| onError | string | No | | Custom JavaScript function to run if validation fails.
    Specify only the function name. | | +| increment | string | No | | The unit increment value for a snapping slider. | | +| tip | boolean | No | | Whether the data value has to display as data tips | | +| format | string | No | | Specifies if the format is:html/applet | /Users/garethedwards/development/github/cfdocs/docs/tags/cfslider.md|applet | diff --git a/docs/tags/cfspreadsheet.md b/docs/tags/cfspreadsheet.md new file mode 100644 index 000000000..2c120d04d --- /dev/null +++ b/docs/tags/cfspreadsheet.md @@ -0,0 +1,60 @@ +# cfspreadsheet + +Read and writes Microsoft Excel spreadsheet files. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfspreadsheet(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | read - Reads the contents of an XLS format file.
    update - Adds a new sheet to an existing XLS file. You cannot use the update action to change a sheet in an existing file.
    write - Writes a new XLS format file or overwrites an existing file. | +| autosize | boolean | No | true | CF11+ Toggles automatically adjusting the width of columns to accommodate their contents. | +| columnnames | string | No | | Comma-separated column names. | +| columns | string | No | | Column number or range of columns. Specify a single number, a hyphen-separated column range, a comma-separated list, or any combination of these; for example: 1,3-6,9. | +| excludeHeaderRow | boolean | No | false | CF9.0.1+ If set to true, excludes the headerRow from being included in the query results of a spreadsheet read.. | +| filename | string | No | | The pathname of the file that is written. | +| format | string | No | | Format of the data represented by the name variable. | +| headerrow | numeric | No | | Row number that contains column names. | +| name | string | No | | `action="read"` The variable in which to store the spreadsheet file data. You must specify name or query. If format="csv" then name will contain csv variable.
    if format="html" then name will contain HTML content.
    `action="write|update"` A variable containing CSV-format data or an ColdFusion spreadsheet object containing the data to write. You must specify name or query. | +| overwrite | boolean | No | | A Boolean value specifying whether to overwrite an existing file. | +| password | string | No | | Set a password for modifying the sheet. | +| query | string | No | | `action="read"` The query in which to store the converted spreadsheet file. You must specify format, name, or query.
    `action="write|update"` A query variable containing the data to write. You must specify name or query. | +| rows | string | No | | The range of rows to read. Specify a single number, a hyphen-separated row range, a comma-separated list, or any combination of these. For example: 1,3-6,9. | +| sheet | numeric | No | | Number of the sheet. | +| sheetname | string | No | | Name of the sheet. | +| src | string | No | | The pathname of the file to read. | + +## Read an Excel file as variable + +Reads the Excel file in src into a variable provided in name. + +```html + +``` + +## Read an Excel file as query (script syntax) + +Reads the Excel file in src into a ColdFusion query variable provided in query using the first row as column names. + +```html +cfspreadsheet( action="read", src=expandPath( 'example.xls' ), query="foo", headerrow=1, excludeHeaderRow=true ); +``` + +## Write a spreadsheet + +Writes a query to an Excel file. + +```html +cfspreadsheet( action="write", fileName=expandPath( 'new-example.xls' ), query="foo", overwrite=true ); +``` diff --git a/docs/tags/cfsprydataset.md b/docs/tags/cfsprydataset.md new file mode 100644 index 000000000..5a76e82e2 --- /dev/null +++ b/docs/tags/cfsprydataset.md @@ -0,0 +1,27 @@ +# cfsprydataset + +Creates a Spry data set; can use bind parameters to get data from ColdFusion AJAX controls + to populate the data set. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfsprydataset(bind="", name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| bind | string | Yes | | A bind expression that returns XML data to populate
    the Spry data set. The bind expression can specify a
    CFC function or URL and can include bind parameters
    that represent the values of ColdFusion controls. For
    detailed information on specifying bind expressions,
    see HTML form data binding in cfinput. | +| name | string | Yes | | The name of the Spry data set. | +| onbinderror | string | No | | The name of a JavaScript function to execute if
    evaluating the bind expression results in an error. The
    function must take two attributes: an HTTP status
    code and a message.
    If you omit this attribute, and have specified a global
    error handler (by using the
    ColdFusion.setGlobalErrorHandler function), the
    handler displays the error message; otherwise a
    default error pop-up displays. | +| options | string | No | | A JavaScript object containing options to pass to the
    data set. | +| type | string | No | | Specifies data set type, corresponding to the format of
    the data that is returned by the bind expression. | +| xpath | string | No | | Valid for XML type data sets only. An XPath
    expression that extracts data from the XML returned
    by the bind expression. The data set contains only the
    data that matches the xpath expression. | diff --git a/docs/tags/cfstopwatch.md b/docs/tags/cfstopwatch.md new file mode 100644 index 000000000..68cd4996a --- /dev/null +++ b/docs/tags/cfstopwatch.md @@ -0,0 +1,46 @@ +# cfstopwatch + +Measures the time taken, in milliseconds, for the code between the start tag and end tag to execute. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +cfstopwatch( variable="time" label="timer" ) {} +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| variable | string | Yes | | The name of the variable that will contain the value of the time taken. | +| label | string | No | | The label for the stopwatch, used in debugging output. | + +## Tag version + +```html + +Begin some long running process ... + +done. + +``` + +### Expected Result: The time elapsed while executing the code inside the block is returned as a variable then displayed below. + +## Script version + +```html +cfstopwatch( variable="stopwatchVar", label = "Nap time" ){ +writeoutput("Begin some long running process ... "); +sleep(2000); +} +writeDump( stopwatchVar ); +``` + +### Expected Result: The time elapsed while executing the code inside the block is returned as a variable then displayed below. diff --git a/docs/tags/cfstoredproc.md b/docs/tags/cfstoredproc.md new file mode 100644 index 000000000..51a482311 --- /dev/null +++ b/docs/tags/cfstoredproc.md @@ -0,0 +1,65 @@ +# cfstoredproc + +Executes a stored procedure in a server database. It + specifies database connection information and identifies + the stored procedure. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfstoredproc(procedure=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| procedure | string | Yes | | Name of stored procedure on database server. | +| datasource | string | No | | Name of data source that points to database that contains
    stored procedure. | +| username | string | No | | Overrides username in data source setup. | +| password | string | No | | Overrides password in data source setup. | +| blockfactor | numeric | No | | Maximum number of rows to get at a time from server.
    Range is 1 to 100. | +| debug | boolean | No | NO | Yes: Lists debug information on each statement
    No: does not | +| returncode | boolean | No | NO | Yes: Tag populates cfstoredproc.statusCode with status
    code returned by stored procedure.
    No: does not | +| result | variableName | No | | Specifies a name for the structure in which cfstoredproc
    returns the statusCode and ExecutionTime variables. If
    set, this value replaces cfstoredproc as the prefix to
    use when accessing those variables. | + +## Tag Syntax + +Basic example of calling a stored procedure, passing a parameter, and getting a result set. + +```html + + + + +``` + +## Script Syntax + +Call stored procedure and get back multiple result sets. + +```html +cfstoredproc( procedure="spu_my_storedproc",datasource="myDSN" ) { + cfprocparam( cfsqltype="cf_sql_date", value=myDateParam ); + cfprocresult( name="qSummary", resultset=1 ); + cfprocresult( name="qDetails", resultset=2 ); +} +``` + +## Scripted Tag Syntax (for Lucee) + +Call stored procedure and get back multiple result sets. + +```html +cfstoredproc( procedure="spu_my_storedproc",datasource="myDSN" ) { + procparam( cfsqltype="cf_sql_date", value=myDateParam ); + procresult( name="qSummary", resultset=1 ); + procresult( name="qDetails", resultset=2 ); +} +``` diff --git a/docs/tags/cfswitch.md b/docs/tags/cfswitch.md new file mode 100644 index 000000000..9b679715e --- /dev/null +++ b/docs/tags/cfswitch.md @@ -0,0 +1,75 @@ +# cfswitch + +Evaluates a passed expression and passes control to the cfcase tag that matches the expression result. You can, optionally, code a cfdefaultcase tag, which receives control if there is no matching cfcase tag value. Note the difference in the tag and script syntax when providing multiple values for a case. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +switch (expression) { } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| expression | string | Yes | | CFML expression that yields a scalar value. CFML converts integers, real numbers, Booleans, and dates to numeric values. For example, True, 1, and 1.0 are all equal. | + +## Script Syntax + +```html +fruit = "Orange"; +switch(fruit) { + case "Apple": + writeOutput("I like apples!"); + break; + case "Orange": case "Citrus": + writeOutput("I like oranges!"); + break; + case "Kiwi": + writeOutput("I like kiwi!"); + break; + default: + writeOutput("Fruit, what fruit?"); + break; + } +``` + +### Expected Result: I like oranges! + +## Tag Syntax + +```html + + + I like apples! + I like oranges! + I like kiwi! + Fruit, what fruit? + +``` + +### Expected Result: Fruit, what fruit? + +## Dynamic switch case + +CF2021+ switch cases are support dynamic value + +```html +num = 10; +switch(0) { + case num % 2: + writeOutput("Even number"); + break; +default: + writeOutput("Odd number"); +break; + } +``` + +### Expected Result: Even number diff --git a/docs/tags/cftable.md b/docs/tags/cftable.md new file mode 100644 index 000000000..3a1bd0c9e --- /dev/null +++ b/docs/tags/cftable.md @@ -0,0 +1,30 @@ +# cftable + +Builds a table in a CFML page. This tag renders data as preformatted text, or, with the HTMLTable attribute, in an HTML table. If you do not want to write HTML table tag code, or if your data can be presented as preformatted text, use this tag. Preformatted text (defined in HTML with the <pre> and </pre> tags) displays text in a fixed-width font. It displays white space and line breaks exactly as they are written within the pre tags. For more information, see an HTML reference guide. + + To define table column and row characteristics, use the cfcol tag within this tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cftable(query=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| query | query | Yes | | Name of cfquery from which to draw data. | +| maxrows | numeric | No | | Maximum number of rows to display in the table. | +| colSpacing | numeric | No | | Number of spaces between columns | +| headerLines | numeric | No | | Number of lines to use for table header (the default leaves
    one line between header and first row of table). | +| htmltable | any | No | | Renders data in an HTML 3.0 table.

    If you use this attribute (regardless of its value),
    CFML renders data in an HTML table. | +| border | any | No | | Displays border around table.

    If you use this attribute (regardless of its value),
    CFML displays a border around the table.

    Use this only if you use the HTMLTable attribute. | +| colheaders | any | No | | Displays column heads. If you use this attribute, you must
    also use the cfcol tag header attribute to define them.

    If you use this attribute (regardless of its value),
    CFML displays column heads. | +| startrow | numeric | No | | The query result row to put in the first table row. | diff --git a/docs/tags/cftextarea.md b/docs/tags/cftextarea.md new file mode 100644 index 000000000..85604d865 --- /dev/null +++ b/docs/tags/cftextarea.md @@ -0,0 +1,64 @@ +# cftextarea + +Puts a multiline text entry box in a cfform tag and + controls its display characteristics. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cftextarea(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name of the cftextinput control. | +| label | string | No | | Label to put beside the control on a form. | +| style | string | No | | In HTML or XML format forms, ColdFusion passes the
    style attribute to the browser or XML.
    In Flash format forms, must be a style specification in
    CSS format, with the same syntax and contents as used
    in Macromedia Flex for the corresponding Flash element. | +| required | boolean | No | NO | - true: the field must contain text.
    - false: the field can be empty.
    Default: false | +| html | boolean | No | NO | Boolean value that specifies whether the text area contains HTML.
    Default: false | +| validate | string | No | | The type or types of validation to do. Available validation
    types and algorithms depend on the format. For details,
    see the Usage section of the cfinput tag reference. | +| validateat | string | No | onSubmit | How to do the validation. For Flash format forms, onSubmit
    and onBlur are identical; validation is done on submit.
    For multiple values, use a comma-delimited list.
    For details, see the Usage section of the cfinput tag
    reference.
    Default: onSubmit | +| message | string | No | | Message text to display if validation fails. | +| range | string | No | | Minimum and maximum numeric allowed values. ColdFusion
    uses this attribute only if you specify range in the
    validate attribute.
    If you specify a single number or a single number a
    followed by a comma, it is treated as a minimum, with no
    maximum. If you specify a comma followed by a number,
    the maximum is set to the specified number, with no
    minimum. | +| maxlength | numeric | No | | The maximum length of text that can be entered.
    ColdFusion uses this attribute only if you specify
    maxlength in the validate attribute. | +| pattern | string | No | | JavaScript regular expression pattern to validate input.
    Omit leading and trailing slashes. ColdFusion uses this
    attribute only if you specify regex in the validate attribute. | +| onvalidate | string | No | | Custom JavaScript function to validate user input. The
    JavaScript DOM form object, input object, and input
    object value are passed to routine, which should return
    True if validation succeeds, False otherwise. If you specify
    this attribute, ColdFusion ignores the validate attribute. | +| onerror | string | No | | Custom JavaScript function to execute if validation fails. | +| disabled | boolean | No | NO | Disables user input, making the control read-only. To
    disable input, specify disabled without an attribute, or
    disabled="true". To enable input, omit the attribute or
    specify disabled="false".
    Default: false | +| value | string | No | | Initial value to display in text control. You can specify an
    initial value as an attribute or in the tag body, but not in
    both places. If you specify the value as an attribute, you
    must put the closing cftextarea tag immediately after the
    opening cftextarea tag, with no spaces or line feeds between,
    or place a closing slash at the end of the opening cftextarea
    tag. For example:
    | +| bind | string | No | | Flash only: A Flex bind expression that populates the field with
    information from other form fields. | +| onkeyup | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run
    when the user releases a keyboard key in the control. | +| onkeydown | string | No | | JavaScript (HTML/XML) or ActionScript (Flash)
    ActionScript to run when the user presses a keyboard
    key in the control. | +| onmouseup | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run
    when the user presses a mouse button in the control. | +| onmousedown | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run
    when the user releases a mouse button in the control. | +| onchange | string | No | | JavaScript (HTML/XML) or ActionScript (Flash) to run
    when the control changes due to user action. | +| onclick | string | No | | JavaScript (HTML/XML) to run when the user clicks the
    control. Not supported for Flash forms. | +| enabled | boolean | No | YES | Flash only: Boolean value specifying whether the control is enabled.
    A disabled control appears in light gray. The inverse of the
    disabled attribute.
    Default: true | +| visible | boolean | No | YES | Flash only: Boolean value specifying whether to
    show the control. Space that would be occupied by an
    invisible control is blank.
    Default: true | +| tooltip | string | No | | Flash only: Text to display when the mouse pointer hovers
    over the control. | +| height | numeric | No | | Flash only: The height of the control, in pixels. | +| width | numeric | No | | Flash only: The width of the control, in pixels. | +| basepath | string | No | | Path to the directory that contains the rich text editor. The editor configuration files are at the top level of this directory. | +| bindattribute | string | No | | Specifies the HTML tag attribute whose value is set by the bind attribute. You can only specify attributes in the browser's HTML DOM tree, not ColdFusion-specific attributes. | +| bindonload | boolean | No | NO | A Boolean value that specifies whether to execute the bind attribute expression when first loading the form. | +| fontformats | string | No | | A comma separated list of the font names to display in the rich text editor Formats selector. The formats specify the HTML tags to apply to typed or selected text. | +| fontnames | string | No | | A comma separated list of the font names to display in the rich text editor Font selector. | +| fontsizes | string | No | | A comma separated list of the font sizes to display in the rich text editor Size selector. List entries must have the format of numeric font size/descriptive text. | +| onbinderror | string | No | | The name of a JavaScript function to execute if evaluating a bind expression results in an error. The function must take two attributes: an HTTP status code and a message. | +| richtext | boolean | No | NO | A Boolean value specifying whether this control is a rich text editor with tool bars to control the text formatting. | +| skin | string | No | default | Specifies the skin to be used for the rich text editor. By default, the valid values are Default, silver, and office2003.
    You can also create custom skins that you can then specify in this attribute. | +| wrap | string | No | | * hard: wraps long lines, and sends the carriage return to the server.
    * off: does not wrap long lines.
    * physical: wraps long lines, and transmits the text at all wrap points.
    * soft: wraps long lines, but does not send the carriage return to the server.
    * virtual: wraps long lines, but does not send the carriage return to the server. | +| sourcefortooltip | string | No | | The URL of a page to display as a tool tip.
    The page can include CFML and HTML to control the contents and format, and the tip can include images.
    If you specify this attribute, an animated icon appears with the text "Loading..." while the tip is being loaded. | +| stylesxml | string | No | | The path of the file that defines the styles in the rich text editor Styles selector.
    Relative paths start at the directory that contains the fckeditor.html file, normally cf_webRoot/CFIDE/scripts/ajax/FCKeditor/editor. | +| templatesxml | string | No | | The pathof the file that defines the templates that are displayed when you click the rich text editor Templates icon. | +| toolbar | string | No | | Specifies the rich text editor toolbar. By default, the valid values for this attribute are: Default, a complete set of controls, and Basic, a minimal configuration. | +| toolbaronfocus | boolean | No | | A Boolean value that specifies whether the rich text editor toolbar expands and displays its controls only when the rich text editor has the focus. | +| secureUpload | boolean | No | | If true, enables secure upload using FCKeditor.
    For secure upload, you must have
    sessionManagement set to yes. Secure upload does not work if sessionManagement is set to false. | diff --git a/docs/tags/cftextinput.md b/docs/tags/cftextinput.md new file mode 100644 index 000000000..c7529bb29 --- /dev/null +++ b/docs/tags/cftextinput.md @@ -0,0 +1,44 @@ +# cftextinput + +Puts a single-line text entry box in a cfform tag and controls its display characteristics. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cftextinput(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name for the cftextinput control. | +| value | string | No | | Initial value to display in text control. | +| required | boolean | No | | Yes: the user must enter or change text
    No | +| range | string | No | | Minimum-maximum value range, delimited by a comma.
    Valid only for numeric data. | +| validate | string | No | | date: verifies format mm/dd/yy.
    eurodate: verifies date format dd/mm/yyyy.
    time: verifies time format hh:mm:ss.
    float: verifies floating point format.
    integer: verifies integer format.
    telephone: verifies telephone format ###-###-####. The
    separator can be a blank. Area code and exchange must
    begin with digit 1 - 9.
    zipcode: verifies, in U.S. formats only, 5- or 9-digit
    format #####-####. The separator can be a blank.
    creditcard: strips blanks and dashes; verifies number using
    mod10 algorithm. Number must have 13-16 digits.
    social_security_number: verifies format ###-##-####. The
    separator can be a blank.
    regular_expression: matches input against pattern
    attribute. | +| onvalidate | string | No | | Custom JavaScript function to validate user input. The form
    object, input object, and input object value are passed to
    routine, which should return True if validation succeeds,
    False otherwise. The validate attribute is ignored. | +| pattern | string | No | | JavaScript regular expression pattern to validate input.
    Omit leading and trailing slashes | +| message | string | No | | Message text to display if validation fails | +| onerror | string | No | | Custom JavaScript function to execute if validation fails. | +| size | numeric | No | | Number of characters displayed before horizontal scroll
    bar displays. | +| font | string | No | arial | Font name for data in tree control. | +| fontsize | numeric | No | | Font size for text in tree control, in points. | +| italic | boolean | No | NO | Yes: displays tree control text in italics
    No: it does not | +| bold | boolean | No | NO | Yes: displays tree control text in bold
    No: it does not | +| height | numeric | No | | Tree control height, in pixels. | +| width | numeric | No | | Tree control width, in pixels. | +| vspace | numeric | No | | Vertical margin above and below tree control, in pixels. | +| hspace | numeric | No | | Horizontal spacing to left and right of tree control, in pixels. | +| align | string | No | | * top
    * left
    * bottom
    * baseline
    * texttop
    * absbottom
    * middle
    * absmiddle
    * right | +| bgcolor | string | No | | Background color of control. For a hex value, use the form:
    textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
    signs or none. | +| textcolor | string | No | | Text color for control. For a hex value, use the form:
    textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash
    signs or none. | +| maxlength | numeric | No | | The maximum length of text entered. | +| notsupported | string | No | Browser must support Java to
    view ColdFusion Java Applets!
    | Text to display if a page that contains a Java applet-based
    cfform control is opened by a browser that does not
    support Java or has Java support disabled. | +| label | string | No | | Label for text input | diff --git a/docs/tags/cfthread.md b/docs/tags/cfthread.md new file mode 100644 index 000000000..eadff6016 --- /dev/null +++ b/docs/tags/cfthread.md @@ -0,0 +1,52 @@ +# cfthread + +The cfthread tag enables multithreaded programming in ColdFusion. + Threads are independent streams of execution, and multiple threads + on a page can execute simultaneously and asynchronously, letting you + perform asynchronous processing in CFML. CFML code within the cfthread + tag body executes on a separate thread while the page request thread + continues processing without waiting for the cfthread body to finish. + You use this tag to run or end a thread, temporarily stop thread execution, + or join together multiple threads. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +thread action="" name=""; +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | The name of the thread to which the action applies:
    terminate The name of the thread to stop.
    join The name of the thread or threads to join to the current thread.
    To specify multiple threads, use a comma-delimited list.
    run The name to use to identify the thread being created. (required) | +| action | string | No | | The action to take, one of the following values:
    join Makes the current thread wait until the thread or threads
    specified in the name attribute complete processing, or until the
    period specified in the timeout attribute passes, before continuing
    processing. If you don't specify a timeout and thread you are joining
    to doesn't finish, the current thread also cannot finish processing.

    run Creates a thread and starts it processing.

    sleep Suspends the current threads processing for the time specified
    by the duration attribute. This action is useful if one thread must wait
    for another thread to do processing without joining the threads.

    terminate Stops processing of the thread specified in the name attribute.
    If you terminate a thread, the thread scope includes an ERROR metadata
    structure with information about the termination. (optional, default=run) | +| duration | string | No | | (sleep) The number of milliseconds for which to suspend thread processing. (required) | +| priority | string | No | | The priority level at which to run the thread.
    The following values are valid:
    HIGH, LOW, NORMAL
    Higher priority threads get more processing time than lower priority
    threads. Page-level code, the code that is outside of cfthread tags,
    always has NORMAL priority. (optional, default=NORMAL) | +| timeout | numeric | No | | The number of milliseconds that the current thread waits for
    the thread or threads being joined to finish. If any thread does not
    finish by the specified time, the current thread proceeds.
    If the attribute value is 0, the default, the current thread continues
    waiting until all joining threads finish. If the current thread is the
    page thread, the page continues waiting until the threads are joined,
    even if you specify a page timeout. (optional, default=0) | + +## Script Syntax + +CF9+ + +```html +thread action="run" name="myThread" { + // do single thread stuff +} +thread action="join" name="myThread,myOtherThread"; +``` + +## Tag Syntax + +```html + + + + +``` diff --git a/docs/tags/cfthrow.md b/docs/tags/cfthrow.md new file mode 100644 index 000000000..311517b2f --- /dev/null +++ b/docs/tags/cfthrow.md @@ -0,0 +1,47 @@ +# cfthrow + +Throws a developer-specified exception, which can be caught + with a cfcatch tag that has any of the following type attribute + options: + type = "custom_type" + type = "Application" + type = "Any" + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +throw(message=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| type | string | No | Custom | Do not enter another predefined type; types are not
    generated by CFML applications. If you specify
    Application, you need not specify a type for cfcatch. | +| message | string | No | | Message that describes exception event. | +| detail | string | No | | Description of the event. CFML appends error position
    to description; server uses this parameter if an error is
    not caught by your code. | +| errorcode | string | No | | A custom error code that you supply. | +| extendedinfo | string | No | | A custom error code that you supply. | +| object | any | No | | Requires the value of the cfobject tag name attribute.

    Throws a Java exception from a CFML tag.

    This attribute is mutually exclusive with all other
    attributes of this tag. | + +## Script Example: Try, Throw, Catch, Finally! + +Throw and Finally requires CF9+ in cfscript + +```html +try { + throw(message="Oops", detail="xyz"); //CF9+ +} catch (any e) { + writeOutput("Error: " & e.message); +} finally { //CF9+ + writeOutput("I run even if no error"); +} +``` + +### Expected Result: Error: OopsI run even if no error diff --git a/docs/tags/cftimer.md b/docs/tags/cftimer.md new file mode 100644 index 000000000..d58139c86 --- /dev/null +++ b/docs/tags/cftimer.md @@ -0,0 +1,48 @@ +# cftimer + +Displays execution time for a specified section of + CFML code. ColdFusion MX displays the timing information + along with any output produced by the timed code. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +cftimer() {} +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | Values | +| --- | --- | --- | --- | --- | --- | +| label | string | No | | Label to display with timing information.
    Default: " " | | +| type | string | No | debug | - inline: displays timing information inline, following the
    resulting HTML.
    - outline: displays timing information and also displays a line
    around the output produced by the timed code. The browser
    must support the FIELDSET tag to display the outline.
    - comment: displays timing information in an HTML comment
    in the format . The default label
    is cftimer.
    - debug: displays timing information in the debug output
    under the heading CFTimer Times.
    Default: debug | /Users/garethedwards/development/github/cfdocs/docs/tags/cftimer.md|debug | + +## Tag version + +```html + +Begin some long running process ... + +done. + +``` + +### Expected Result: The time elapsed while executing the code inside the block should be displayed inline. + +## Script version + +```html +cftimer(label = "Nap time", type="outline"){ +writeoutput("Begin some long running process ... "); +sleep(2000); +writeoutput("done."); +} +``` + +### Expected Result: The time elapsed while executing the code inside the cftimer block should be displayed in the output with an outline around any output generated within the cftimer call.. diff --git a/docs/tags/cftooltip.md b/docs/tags/cftooltip.md new file mode 100644 index 000000000..739f61c7a --- /dev/null +++ b/docs/tags/cftooltip.md @@ -0,0 +1,28 @@ +# cftooltip + +Specifies tool tip text that displays when the user hovers the mouse pointer over the elements + in the tag body. This tag does not require a form and is not used inside Flash forms. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cftooltip(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| preventoverlap | string | No | YES | A Boolean value specifying whether to prevent the
    tooltip from overlapping the component that it
    describes. | +| autodismissdelay | string | No | | The number of milliseconds between the time
    when the user moves the mouse pointer over the
    component (and leaves it there) and when the
    tooltip disappears. | +| hidedelay | string | No | | The number of milliseconds to delay between the
    time when the user moves the mouse pointer away
    from the component and when the tooltip
    disappears. | +| showdelay | string | No | | The number of milliseconds to delay between the
    time when the user moves the mouse over the
    component and when the tooltip appears. | +| sourcefortooltip | string | No | | The URL of a page with the tool tip contents. The
    page can include HTML markup to control the
    format, and the tip can include images.
    If you specify this attribute, an animated icon
    appears with the text "Loading..." while the tip is
    being loaded. | +| tooltip | string | No | | Tip text to display. The text can include HTML
    formatting.
    Ignored if you specify a sourceForTooltip attribute | +| style | string | No | | | diff --git a/docs/tags/cftrace.md b/docs/tags/cftrace.md new file mode 100644 index 000000000..6741b4929 --- /dev/null +++ b/docs/tags/cftrace.md @@ -0,0 +1,31 @@ +# cftrace + +Displays and logs debugging data about the state of an + application at the time the cftrace tag executes. Tracks + runtime logic flow, variable values, and execution time. + Displays output at the end of the request or in the debugging + section at the end of the request; + + CFML logs cftrace output to the file logs\cftrace.log, in + the CFML installation directory. + + Note: To permit this tag to execute, you must enable debugging + in the CFML Administrator. Optionally, to report trace + summaries, enable the Trace section. + +### Syntax + +```html + +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| abort | boolean | No | NO | Calls cfabort tag when the tag is executed | +| category | string | No | | User-defined string for identifying trace groups | +| inline | boolean | No | NO | Displays trace code in line on the page in the
    location of the cftrace tag, addition to the debugging
    information output. | +| text | string | No | | User-defined string, which can include simple variable,
    but not complex variables such as arrays. Outputs to cflog
    text attribute | +| type | string | No | information | Corresponds to the cflog type attribute; displays an
    appropriate icon.

    * Information
    * Warning
    * Error
    * Fatal Information | +| var | string | No | | The name of a simple or complex variable to display.

    Useful for displaying a temporary value, or a value that
    does not display on any CFM page. | diff --git a/docs/tags/cftransaction.md b/docs/tags/cftransaction.md new file mode 100644 index 000000000..4a5325979 --- /dev/null +++ b/docs/tags/cftransaction.md @@ -0,0 +1,55 @@ +# cftransaction + +Instructs the database management system to treat multiple + database operations as a single transaction. Provides database + commit and rollback processing. +Note that distributed transactions (transactions across multiple datasources) are not supported - you must commit one transaction and begin a separate transaction to one database before writing a query to another (CFMX7 Manual) + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +transaction { } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | No | begin | `begin`: the start of the block of code to execute
    `commit`: commits a pending transaction
    `rollback`: rolls back a pending transaction
    `setsavepoint`: Marks a place within the transaction as a savepoint. | +| isolation | string | No | | ODBC lock type. | +| savepoint | string | No | | The name of the savepoint in the transaction. Used with `action="setsavepoint"` or `action="rollback"` | +| nested | boolean | No | | specifies whether transaction is nested or not | + +## Script Syntax + +```html +transaction { + try { + // code to run + transaction action="commit"; + } + catch(any e) { + transaction action="rollback"; + } + } +``` + +## Tag Syntax + +```html + + + + + + + + + +``` diff --git a/docs/tags/cftree.md b/docs/tags/cftree.md new file mode 100644 index 000000000..386c5b46f --- /dev/null +++ b/docs/tags/cftree.md @@ -0,0 +1,54 @@ +# cftree + +Inserts a tree control in a form. Validates user selections. + Used within a cftree tag block. You can use a CFML query + to supply data to the tree. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cftree(name=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | Name for tree control. | +| format | string | No | applet | - applet: displays the tree using a Java applet in the
    browser,
    - flash: displays the tree using a Flash control
    - object: returns the tree as a ColdFusion structure with the
    name specified by the name attribute, For details of the
    structure contents, see "object format", below.
    - xml: Generates an XMLrepresentation of the tree.
    In XML format forms, includes the generated XML in the
    form. and puts the XML in a string variable with the name
    specified by the name attribute.
    Default: applet | +| required | boolean | No | NO | - true: user must select an item in tree control
    - false: they do not
    Default: false | +| delimiter | string | No | \\ | Character to separate elements in form variable path.
    Default: \\ | +| completepath | boolean | No | NO | - true: start the Form.treename.path variable with the root
    of the tree path when cftree is submitted.
    - false: omit the root level from the Form.treename.path
    variable; the value starts with the first child node in the
    tree.
    For the preserveData attribute of cfform to work with the
    tree, you must set this attribute to Yes.
    For tree items populated by a query, if you use the
    cftreeitem queryasroot attribute to specify a root name,
    that value is returned. If you do not specify a root name,
    ColdFusion returns the query name.
    Default: false | +| appendkey | boolean | No | YES | - true: if you use cftreeitem href attributes, ColdFusion
    appends a CFTREEITEMKEY query string variable with
    the value of the selected tree item to the cfform action URL.
    - false: do not append the tree item value to the URL.
    Default: true | +| highlighthref | boolean | No | YES | - true: highlights as a link the displayed value for any
    cftreeitem tag that specifies a href attribute.
    - false: disables highlighting.
    Default: true | +| onvalidate | string | No | | JavaScript function to validate user input. The form object,
    input object, and input object value are passed to the
    specified routine, which should return True if validation
    succeeds; False, otherwise. | +| message | string | No | | Message to display if validation fails. | +| onerror | string | No | | JavaScript function to execute if validation fails. | +| lookandfeel | string | No | windows | - motif: renders slider in Motif style
    - windows: renders slider in Windows style
    - metal: renders slider in Java Swing style
    If platform does not support style option, tag defaults to
    platform default style.
    Default: windows | +| font | string | No | arial | Font name for data in tree control. | +| fontsize | numeric | No | | Font size for text in tree control, in points. | +| italic | boolean | No | NO | - true: displays tree control text in italics
    - false: it does not
    Default: false | +| bold | boolean | No | NO | - true: displays tree control text in bold
    - false: it does not
    Default: false | +| height | numeric | No | 320 | Tree control height, in pixels. If you omit this attribute in
    Flash format, Flash automatically sizes the tree.
    Default: 320 (applet only) | +| width | numeric | No | 200 | Tree control width, in pixels. If you omit this attribute in
    Flash format, Flash automatically sizes the tree.
    Default: 200 (applet only) | +| vspace | numeric | No | | Vertical margin above and below tree control, in pixels. | +| hspace | numeric | No | | Horizontal spacing to left and right of tree control, in pixels. | +| align | string | No | | Alignment of the tree control applet object. | +| border | boolean | No | YES | - true: display a border around the tree control.
    - false: no border
    Default: true | +| hscroll | boolean | No | YES | - true: permits horizontal scrolling
    - false: no horizontal scrolling
    Default: true | +| vscroll | boolean | No | YES | - true: permits vertical scrolling
    - false: no vertical scrolling
    Default: true | +| style | string | No | | Flash only: Must be a style specification in CSS format, with the same
    syntax and contents as used in Macromedia Flex for the
    corresponding Flash element. | +| enabled | boolean | No | YES | Flash only: Boolean value specifying whether the
    control is enabled. A disabled control appears in light gray.
    Default: true | +| visible | boolean | No | YES | Flash only: Boolean value specifying whether to
    show the control. Space that would be occupied by an
    invisible control is blank.
    Default: true | +| tooltip | string | No | | Flash only: Text to display when the mouse pointer
    hovers over the control. | +| onchange | string | No | | Flash only: ActionScript to run when the control changes due to user action.
    If you specify an onChange event handler, the Form scope of
    the ColdFusion action page does not automatically get
    information about selected items. The ActionScript onChange
    event handler must handle all changes and selections. | +| onblur | string | No | | Flash only: ActionScript that runs when the calendar loses focus.
    (Added in 7.0.1) | +| onfocus | string | No | | Flash only: ActionScript that runs when the calendar loses focus.
    (Added in 7.0.1) | +| notsupported | string | No | Browser must support Java to
    view ColdFusion Java Applets!
    | Text to display if a page that contains a Java applet-based
    cfform control is opened by a browser that does not
    support Java or has Java support disabled. | +| cache | boolean | No | YES | A Boolean value that specifies whether to get new data each time the user expands tree nodes, as follows:
    * yes: fetches a node's child items only once, when the node is first expanded
    * no: fetches child items each time the node is expanded. | diff --git a/docs/tags/cftreeitem.md b/docs/tags/cftreeitem.md new file mode 100644 index 000000000..a2f0be214 --- /dev/null +++ b/docs/tags/cftreeitem.md @@ -0,0 +1,34 @@ +# cftreeitem + +Populates a form tree control, created with the cftree tag, + with elements. To display icons, you can use the img values + that CFML provides, or reference your own icons. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cftreeitem(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| bind | string | No | | A bind expression specifying a CFC of JavaScript
    function that dynamically gets all tree nodes. You can use
    this attribute only at the top level of the tree, and in this
    case, the tree can have only cftreeitem tag.
    If you use the bind attribute, the only other allowed
    attribute is onBindError. For details creating trees that
    using binding, see "Using HTML format trees" in Chapter
    33, "Using AJAX UI Components and Features" in
    ColdFusion Developer's Guide | +| value | string | No | | Value passed when cfform is submitted. When populating a
    tree with data from a cfquery, specify columns in a
    delimited list. Example: value = "dept_id,emp_id" | +| display | string | No | | Tree item label. When populating a tree with data from a
    query, specify names in a delimited list. Example:
    display = "dept_name,emp_name" | +| parent | string | No | | Value for tree item parent. | +| img | string | No | | Image name, filename, or file URL for tree item icon.

    You can specify a custom image. To do so, include path and
    file extension; for example:

    img = "../images/page1.gif"

    To specify more than one image in a tree, or an image at
    the second or subsequent level, use commas to separate
    names, corresponding to level; for example:


    img = "folder,document"
    img = ",document" (example of second level) | +| imgopen | string | No | | Icon displayed with open tree item. You can specify icon
    filename with a relative path. You can use a CFML
    image. | +| href | string | No | | URL to associate with tree item or query column for a tree
    that is populated from a query. If href is a query column,
    its value is the value populated by query. If href is not
    recognized as a query column, it is assumed that its text
    is an HTML href.

    When populating a tree with data from a query, HREFs can be
    specified in delimited list; for example:

    href = "http://dept_svr,http://emp_svr" | +| target | string | No | | Target attribute of href URL. When populating a tree with
    data from a query, specify target in delimited list:

    target = "FRAME_BODY,_blank" | +| query | string | No | | Query name to generate data for the treeitem. | +| queryAsRoot | string | No | | Defines query as the root level. This avoids having to
    create another parent cftreeitem.

    * Yes
    * No
    * String to use as the root name
    If you do not specify a root name, CFML returns the
    query name as the root. | +| expand | boolean | No | | Yes: expands tree to show tree item children
    No: keeps tree item collapsed | +| onbinderror | string | No | | The name of a JavaScript function to execute if evaluating a bind expression results in an error. The function must take two attributes: an HTTP status code and a message. | diff --git a/docs/tags/cftry.md b/docs/tags/cftry.md new file mode 100644 index 000000000..cacd0201f --- /dev/null +++ b/docs/tags/cftry.md @@ -0,0 +1,49 @@ +# cftry + +Used with one or more cfcatch tags. Together, they catch and + process exceptions in CFML pages. Exceptions are events + that disrupt the normal flow of instructions in a CFML + page, such as failed database operations, missing include + files, and developer-specified events. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +try { } catch (any e) {} +``` + +## A simple try/catch script based example + +Create a divide by zero error and then catch it. + +```html +try { + x = 5/0; +} +catch (any e) { + writeOutput("Error: " & e.message); +} +``` + +### Expected Result: Error: Division by zero. + +## A simple try/catch tag based example + +Create a divide by zero error and then catch it. + +```html + + + + Error: #cfcatch.message# + + +``` + +### Expected Result: Error: Division by zero. diff --git a/docs/tags/cfupdate.md b/docs/tags/cfupdate.md new file mode 100644 index 000000000..99ff2cf27 --- /dev/null +++ b/docs/tags/cfupdate.md @@ -0,0 +1,36 @@ +# cfupdate + +Updates records in a data source from data in a CFML form + or form Scope. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfupdate(datasource="", tablename=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| datasource | string | Yes | | Name of the data source that contains the table | +| tablename | string | Yes | | Name of table to update.
    For ORACLE drivers, must be uppercase.
    For Sybase driver: case-sensitive; must be in same case
    as used when the table was created | +| tableowner | string | No | | For data sources that support table ownership (for example,
    SQL Server, Oracle, Sybase SQL Anywhere), the table owner. | +| tablequalifier | string | No | | For data sources that support table qualifiers. The purpose
    of table qualifiers is as follows:
    SQL Server and Oracle: name of database that contains
    table
    Intersolv dBASE driver: directory of DBF files | +| username | string | No | | Overrides username value specified in ODBC setup. | +| password | string | No | | Overrides password value specified in ODBC setup. | +| formfields | string | No | | Comma-delimited list of form fields to update.

    If a form field is not matched by a column name in the
    database, CFML throws an error.

    The formFields list must include the database table primary
    key field, which must be present in the form. It can be
    hidden. | + +## Update a record using passed form fields + +Uses the cfupdate function to update a record in the a users table based on a list form fields. The primary key must be included in the list of fields + +```html +cfupdate( datasource="myDsn", tablename="users", formFields="userId,firstName,lastName,emailAddress" ); +``` diff --git a/docs/tags/cfwddx.md b/docs/tags/cfwddx.md new file mode 100644 index 000000000..d190f1eef --- /dev/null +++ b/docs/tags/cfwddx.md @@ -0,0 +1,47 @@ +# cfwddx + +Serializes and deserializes CFML data structures to the + XML-based WDDX format. The WDDX is an XML vocabulary for + describing complex data structures in a standard, generic way. + Implementing it lets you use the HTTP protocol to such + information among application server platforms, application + servers, and browsers. + + This tag generates JavaScript statements to instantiate + JavaScript objects equivalent to the contents of a WDDX packet + or CFML data structure. Interoperates with Unicode. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfwddx(action="cfml2wddx", input=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | Yes | | cfml2wddx: serialize CFML to WDDX
    wddx2cfml: deserialize WDDX to CFML
    cfml2js: serialize CFML to JavaScript
    wddx2js: deserialize WDDX to JavaScript | +| input | string | Yes | | A value to process | +| output | variableName | No | | Name of variable for output. If action = "WDDX2JS" or
    "CFML2JS", and this attribute is omitted, result is output
    in HTML stream. | +| toplevelvariable | string | No | | Name of top-level JavaScript object created by
    deserialization. The object is an instance of the
    WddxRecordset object. | +| usetimezoneinfo | boolean | No | YES | Whether to output time-zone information when serializing
    CFML to WDDX.
    - Yes: the hour-minute offset, represented in ISO8601
    format, is output.
    - No: the local time is output. | +| validate | boolean | No | NO | Applies if action = "wddx2cfml" or "wddx2js".
    - Yes: validates WDDX input with an XML parser using
    WDDX DTD. If parser processes input without error,
    packet is deserialized. Otherwise, an error is
    thrown.
    - No: no input validation | + +## Convert cron job file to cfml + +Reads instance's scheduled tasks file and converts it into CFML collection + +```html + + + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfwebsocket(name="", onMessage=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| name | string | Yes | | | +| onMessage | string | Yes | | The JavaScript function that is called when the WebSocket receives a message from the server. | +| onOpen | string | No | | The JavaScript function that is called when the WebSocket establishes a connection. | +| onClose | string | No | | The JavaScript function that is called when the WebSocket closes a connection. | +| onError | string | No | | The JavaScript function that is called if there is an error while performing an action over the WebSocket connection. | +| usecfAuth | boolean | No | false | If set to true (default), users need not authenticate for WebSocket connection (provided they have already logged in to the application). This is the default value. If false, users have to specify the credentials for the WebSocket connection. | +| subscribeTo | string | No | | Comma-separated list of channels to subscribe to. You can specify any or all channels set in your `this.wschannels` Application settings | +| secure | boolean | No | | If true, the web socket communication will happen over SSL. CF11+ | + +## Script Syntax (CF11+) + +```html +cfwebsocket(name="ws", onMessage="handleMessage"); +``` + +## Tag Syntax + +This example creates a JavaScript WebSocket object named `ws`. When a message is pushed, the client runs the `handleMessage` JavaScript function. This example also uses the `subscribeTo` attribute so it will automatically subscribe to the channel `chat`. + +```html + + +``` + +## Sub-channels + +Sub-channels are created dynamically and are referenced by dot notation. When a message is broadcasted to a channel all its sub-channels receive the message as well. This only goes from top to bottom and not the other way around. In this example we create a JavaScript object called `ws` and subscribe to the `room-general` subchannel of the main `chat` channel. + +```html + +``` diff --git a/docs/tags/cfwhile.md b/docs/tags/cfwhile.md new file mode 100644 index 000000000..18a149c7f --- /dev/null +++ b/docs/tags/cfwhile.md @@ -0,0 +1,62 @@ +# cfwhile + +Loops while the condition is true or until break. + +### Syntax + +```html + +``` + +### Script Syntax + +```javascript +while(condition) { } +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| condition | boolean | No | | A boolean condition that determines if the loop should continue. | +| label | string | No | | Used to address loop from `break` or `continue` statement instead of innermost loop. | + +## Tag Syntax - without label + +Output the value of x while it is less than 5. + +```html + + + #x# + + +``` + +### Expected Result: 0 1 2 3 4 + +## Tag Syntax - with label in break + +An outer while loop can be broken from inside a nested loop if the correct label name is passed within the break tag. + +```html + + + + + + + + + + + + [#row#, #col#] + + + + + +``` + +### Expected Result: [0, 0] [0, 1] [0, 2] diff --git a/docs/tags/cfwindow.md b/docs/tags/cfwindow.md new file mode 100644 index 000000000..09d8a65e6 --- /dev/null +++ b/docs/tags/cfwindow.md @@ -0,0 +1,41 @@ +# cfwindow + +Creates a pop-up window in the browser. Does not create a + separate browser pop-up instance. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfwindow(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| bodyStyle | string | No | | A CSS style specification for the window body. As a
    general rule, use this attribute to set color and
    font styles. Using this attribute to set the height
    and width, for example, can result in distorted output. | +| center | boolean | No | NO | A Boolean value specifying whether to center
    the window over the browser window.
    If true, ColdFusion ignores the x and y
    attribute values.
    If false, and you do not specify x and y
    attributes, ColdFusion centers the window. | +| closable | boolean | No | YES | A Boolean value specifying whether the user can
    close the window. If true, the window has an X
    close icon. | +| draggable | boolean | No | YES | A Boolean value specifying whether the user can
    drag the window. To drag the window, click the
    mouse on the title bar and hold the button down
    while dragging. If the window does not have a
    title, users cannot drag it. | +| headerStyle | string | No | | A CSS style specification for the window header.
    As a general rule, use this attribute to set
    color and font styles. Using this attribute to
    set the height and width, for example, can
    result in distorted output. | +| height | numeric | No | | Height of the window in pixels. If you specify
    a value greater than the available space, the
    window occupies the available space and the
    resize handles do not appear. Default is 300. | +| initShow | boolean | No | NO | A Boolean value specifying whether to display
    the window when the containing page first displays.
    If this value is false, use the
    ColdFusion.Layout.show JavaScript function to
    display the window. | +| minHeight | numeric | No | | The minimum height, in pixels, to which users
    can resize the window. Default is 0. | +| minWidth | numeric | No | | The minimum width, in pixels, to which users
    can resize the window. Default is 0. | +| modal | boolean | No | NO | A Boolean value specifying whether the window
    is modal, that is, whether the user can interact
    with the main window while this window displays.
    If true, the user cannot interact with the main
    window. | +| name | string | No | | The name of the window. Must be unique on the
    pages. This attribute is required to interact
    with the window, including to dynamically show
    or hide it. | +| onBindError | string | No | | The name of a JavaScript function to execute
    if evaluating a bind expression results in an
    error. The function must take two attributes:
    an HTTP status code and a message.
    If you omit this attribute, and have specified
    a global error handler
    (by using the ColdFusion.setGlobalErrorHandlerfunction ),
    it displays the error message; otherwise a default
    error pop-up displays. | +| resizable | boolean | No | NO | A Boolean value specifying whether the user can
    resize the window. | +| source | string | No | | A URL that returns the window contents. This
    attribute can use URL parameters to pass data
    to the page. ColdFusion uses standard page path
    resolution rules to locate the page. You can use
    a bind expressions in this attribute; for more
    information see the Usage section. Note: If a
    CFML page specified in this attribute contains
    tags that use AJAX features, such as cfform,
    cfgrid, and cfpod, you must use a cfajaximport
    tag on the page with the cfwindow tag.
    For more information, see cfajaximport | +| title | string | No | | Text to display in the window's title bar. You
    can use HTML mark up to control the title
    appearance, of example to show the text in
    red italic font. If you omit this attribute,
    the window does not have a title bar. | +| width | numeric | No | | Width of the control, including the title bar
    and borders, in pixels. Default is 500. | +| x | numeric | No | | The X (horizontal) coordinate of the upper-left
    corner of the window, relative to the browser
    window. ColdFusion ignores this attribute if
    the center attribute value is true and if you
    do not set the y attribute value. | +| y | numeric | No | | The Y (vertical) coordinate of the upper-left
    corner of the window, relative to the browser
    window. ColdFusion ignores this attribute if
    the center attribute value is true and if you
    do not set the x attribute value. | +| refreshonshow | boolean | No | NO | * true Refresh the contents of the window by running the source bind expression whenever the window shows (for example, by calling the ColdFusion.Window.show JavaScript function), in addition to when bind events occur
    * false Refresh the window only when the bind expression is triggered by its bind event. | +| destroyOnClose | boolean | No | | When destroyOnClose is true, destroys the window when it is closed. By default, this is is false and the window is hidden when it is closed. | diff --git a/docs/tags/cfxml.md b/docs/tags/cfxml.md new file mode 100644 index 000000000..fd0763d5d --- /dev/null +++ b/docs/tags/cfxml.md @@ -0,0 +1,36 @@ +# cfxml + +Creates a CFML XML document object that contains the + markup in the tag body. This tag can include XML and CFML tags. + CFML processes the CFML code in the tag body, then assigns + the resulting text to an XML document object variable. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfxml(variable=""); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| variable | string | Yes | | Name of an XML variable | +| casesensitive | boolean | No | NO | Maintains the case of document elements and attributes | + +## Script Syntax + +Creates a new CFML XML document object. + +```html +cfxml( variable="myXml" ) { + writeOutput( 'Astley, RickNever Gonna Give You Up' ); + } + writeDump( myXml ); +``` diff --git a/docs/tags/cfzip.md b/docs/tags/cfzip.md new file mode 100644 index 000000000..405f57783 --- /dev/null +++ b/docs/tags/cfzip.md @@ -0,0 +1,62 @@ +# cfzip + +Manipulates ZIP and JavaTM Archive (JAR) files. + In addition to the basic zip and unzip functions, use the cfzip tag to delete + entries from an archive, filter files, read files in binary format, list the + contents of an archive, and specify an entrypath used in an executable JAR file. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfzip(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| action | string | No | zip | The action to take. Must be one of the following:
    delete
    list
    read
    readBinary
    unzip
    zip
    If you do not specify an action, ColdFusion
    applies the default action, zip. (optional) | +| charset | string | No | | The character set used to translate the ZIP or JAR
    entry into a text string. Examples of character sets are:
    JIS
    RFC1345
    UTF-16 (optional, default=encoding of the host machine) | +| destination | string | No | | Destination directory where the ZIP or JAR file is extracted. (optional) | +| entrypath | string | No | | Pathname on which the action is performed. (optional) | +| file | string | No | | Absolute pathname of the file on which the action is performed.
    For example, the full pathname of the ZIP file: c:\temp\log.zip.
    If you do not specify the full pathname (for example, file="log.zip"),
    ColdFusion creates the file in a temporary directory. You can use the
    GetTempDirectory function to access the ZIP or JAR file. (required) | +| filter | string | No | | File filter applied to the action. The action
    applies to all files in the pathname specified that match the filter. (optional) | +| name | string | No | | Record set name in which the result of the list action is stored.
    The record set columns are:
    name: filename of the entry in the JAR file. For example, if the entry is
    help/docs/index.htm, the name is index.htm.
    directory: directory containing the entry. For the example above, the
    directory is help/docs. You can obtain the full entry name by concatenating
    directory and name. If an entry is at the root level, the directory is empty ('').
    size: uncompressed size of the entry, in bytes.
    compressedSize: compressed size of the entry, in bytes.
    type: type of entry (directory or file).
    dateLastModified: last modified date of the entry, cfdate object.
    comment: any comment, if present, for the entry.
    crc: crc-32 checksum of the uncompressed entry data. (required) | +| overwrite | boolean | No | | unzip: Specifies whether to overwrite the extracted files:
    yes: if the extracted file already exists at the destination specified,
    the file is overwritten.
    no: if the extracted file already exists at the destination specified,
    the file is not overwritten and that entry is not extracted. The remaining
    entries are extracted.
    zip: Specifies whether to overwrite the contents of a ZIP or JAR file:
    yes: overwrites all of the content in the ZIP or JAR file if it exists.
    no: updates existing entries and adds new entries to the ZIP or JAR file
    if it exists. (optional, default=no) | +| password | string | No | | The password to be used for the archive when action is zip. (optional) | +| prefix | string | No | | String added as a prefix to the ZIP or JAR entry.
    The string is the name of a subdirectory in which the
    entries are added. (optional) | +| recurse | boolean | No | | Specifies whether the action
    applies to subdirectories:
    yes: includes subdirectories.
    no: does not include subdirectories. (optional, default=yes) | +| showDirectory | boolean | No | | yes: lists the directories.
    no: does not list directories. (optional, default= no) | +| source | string | No | | Source directory to be zipped. Not required
    if cfzipparam is specified. (required) | +| storePath | boolean | No | | zip: Specifies whether pathnames are stored in the ZIP or JAR file:
    yes: pathnames of entries are stored in the ZIP or JAR file.
    no: pathnames of the entries are not stored in the ZIP or JAR file.
    All the files are placed at the root level. In case of a name conflict,
    the last file in the iteration is added.
    unzip: Specifies whether files are stored at the entrypath:
    yes: the files are extracted to the entrypath.
    no: the entrypath is ignored and all the files are extracted
    at the root level. (optional, default= yes) | +| variable | string | No | | Variable in which the read content is stored. (required) | + +## Extract / Unzip a zip file into a folder + +Uses `action="unzip"` in the cfzip tag to unzip into the temp directory. + +```html + +``` + +## Extract / Unzip a zip file into a folder (Script Syntax) + +Uses `action="unzip"` in the cfzip tag to unzip into the temp directory. + +```html +cfzip(action="unzip", file="zipFileName", destination=getTempDirectory()); +``` + +## List contents of a zip folder (Script Syntax) + +Uses `action="list"` in the cfzip tag to list the zip contents. + +```html +cfzip(action="list", file="zipFileName", name="zipList"); +``` diff --git a/docs/tags/cfzipparam.md b/docs/tags/cfzipparam.md new file mode 100644 index 000000000..b0a0df5da --- /dev/null +++ b/docs/tags/cfzipparam.md @@ -0,0 +1,42 @@ +# cfzipparam + +Provides additional information to the cfzip tag. + The cfzipparam tag is always a child tag of the cfzip tag. + +### Syntax + +```html + +``` + +### Script Syntax ACF11+, Lucee, Railo 4.2+ + +```javascript +cfzipparam(); +``` + +## Attribute Reference + +| Name | Type | Required | Default | Description | +| --- | --- | --- | --- | --- | +| charset | string | No | encoding of the host machine | Converts string content into binary data before putting
    it into a ZIP or JAR file.

    Used only when cfzip
    action="zip" and the cfzipparam content is a string | +| content | string | No | | Content written to the ZIP or JAR entry.

    Used only when cfzip action="zip".
    Valid content data types are binary and string. If you specify the content
    attribute, you must specify the entrypath attribute. | +| entrypath | string | No | | Pathname used:
    For cfzip action="zip", it is the entrypath used. This is valid only
    when the source is a file. The entrypath creates a subdirectory within
    the ZIP or JAR file.
    For cfzip action="unzip", it is the pathname to unzip.
    For cfzip action="delete", it is the pathname to delete from the
    ZIP or JAR file. | +| filter | string | No | | File filter applied to the action. For example, for the zip action,
    all the files in the source directory matching the filter are zipped. | +| prefix | string | No | | String added as a prefix to the ZIP or JAR entry.

    Used only
    when cfzip action="zip". | +| recurse | boolean | No | true | Recurse the directory to be zipped, unzipped, or deleted,
    as specified by the cfzip parent tag. | +| source | string | No | | Source directory or file.

    Used only when cfzip action="zip".
    Specified file(s) are added to the ZIP or JAR file:
    If you specify source attribute for the cfzip tag, the
    cfzipparam source is relative to it.
    If you do not specify a source attribute for the cfzip
    tag, the cfzipparam source must be an absolute path. | + +## Add a series of files to a zip file + +Adding the contents of a folder to a zip + +```html +var fileList = directoryList(expandPath('/'), false, 'path', '*.jpg'); + +cfzip( file = 'allJPGs.zip' ) { + fileList.each((zipFile)=>{ + cfzipparam( source = zipFile ); + }) +} +``` diff --git a/utilities/.cflintrc b/utilities/.cflintrc new file mode 100644 index 000000000..bcf36386f --- /dev/null +++ b/utilities/.cflintrc @@ -0,0 +1,48 @@ +{ + "rule" : [ ], + "excludes" : [ ], + "includes" : [ + { "code": "MISSING_VAR"}, + { "code": "OUTPUT_ATTR"}, + { "code": "AVOID_USING_CFDUMP_TAG"}, + { "code": "AVOID_USING_CFABORT_TAG"}, + { "code": "AVOID_USING_DEBUG_ATTR"}, + { "code": "AVOID_USING_WRITEDUMP"}, + { "code": "NESTED_CFOUTPUT"}, + { "code": "ARG_VAR_MIXED"}, + { "code": "ARG_VAR_CONFLICT"}, + { "code": "GLOBAL_VAR"}, + { "code": "AVOID_USING_CFEXECUTE_TAG"}, + { "code": "AVOID_USING_ABORT"}, + { "code": "AVOID_USING_CFINSERT_TAG"}, + { "code": "AVOID_USING_CFUPDATE_TAG"}, + { "code": "AVOID_USING_CFFORM_TAG"}, + { "code": "AVOID_USING_CFINPUT_TAG"}, + { "code": "AVOID_USING_CFINVOKE_TAG"}, + { "code": "AVOID_USING_CFFILE_TAG"}, + { "code": "AVOID_USING_CFDIRECTORY_TAG"}, + { "code": "AVOID_USING_CFCOOKIE_TAG"}, + { "code": "AVOID_USING_CFHTTP_TAG"}, + { "code": "ARG_TYPE_MISSING"}, + { "code": "AVOID_USING_ISDEBUGMODE"}, + { "code": "FILE_SHOULD_START_WITH_LOWERCASE"}, + { "code": "AVOID_USING_CREATEOBJECT"}, + { "code": "COMPARE_INSTEAD_OF_ASSIGN"}, + { "code": "AVOID_EMPTY_FILES"}, + { "code": "NO_DEFAULT_INSIDE_SWITCH"}, + { "code": "PARSE_ERROR"}, + { "code": "AVOID_USING_CFMODULE_TAG"}, + { "code": "AVOID_USING_CFSETTING_DEBUG"}, + { "code": "AVOID_USING_CFINCLUDE_TAG"}, + { "code": "AVOID_USING_EVALUATE"}, + { "code": "AVOID_USING_ISDEFINED"}, + { "code": "CFQUERYPARAM_REQ"}, + { "code": "QUERYPARAM_REQ"}, + { "code": "NEVER_USE_QUERY_IN_CFM"}, + { "code": "SQL_SELECT_STAR"}, + { "code": "ADDTOKEN_ATTR"}, + { "code": "IMPLICIT_SCOPE"}, + { "code": "FUNCTION_ACCESS_REMOTE"} + ], + "inheritParent" : false +} \ No newline at end of file diff --git a/utilities/docs-generator.cfm b/utilities/docs-generator.cfm new file mode 100644 index 000000000..eb132eefe --- /dev/null +++ b/utilities/docs-generator.cfm @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ", "ALL")> + + + + + + + + + + + + + + + + + + + + + + ", ");")> + + +