Permalink
Browse files

More code clean up

  • Loading branch information...
1 parent 69a3e9e commit c9eb27adbd1c5914bc46d901823e0c277c070451 @raulriera raulriera committed with Russ Johnson Apr 11, 2010
Showing with 0 additions and 108 deletions.
  1. +0 −108 events/functions.cfm
  2. 0 miscellaneous/parser.cfc
View
@@ -1,111 +1,3 @@
-<cfscript>
-/**
-* Calls both DateFormat and TimeFormat on a data object.
-*
-* @param time A data object.
-* @param dateFormat The string to use to format dates. Defaults to
-* @param timeFormat The string to use to format time. Defaults to
-* @param joinStr This string is placed between the date and time. Defaults to one space character.
-* @return This function returns a string.
-* @author Raymond Camden (ray@camdenfamily.com)
-* @version 1, November 26, 2001
-*/
-function DateTimeFormat(time) {
- var str = "";
- var dateFormat = "mmddyyyy";
- var timeFormat = "HHmmssL";
-
- return DateFormat(time, dateFormat) & TimeFormat(time, timeFormat);
-}
-
-/**
-* Returns the content enclosed in a tag pair.
-*
-* @param tag The tag to look for. Should be passed without < or > and without attributes. (Required)
-* @param string The string to search. (Required)
-* @return Returns a string.
-* @author Johan Steenkamp (johan@orbital.co.nz)
-* @version 1, September 16, 2002
-*/
-function getTagContent(tag,str) {
- var matchStruct = structNew();
- var startTag = "<#tag#[^>]*>";
- var endTag = "</#tag#>";
- var endTagStart = 0;
- matchStruct = REFindNoCase(startTag,str,1,"true");
- if(matchStruct.len[1] eq 0 ) return "";
- endTagStart = REFindNoCase(endTag,str,matchStruct.pos[1],"false");
- return Mid(str,matchStruct.pos[1]+matchStruct.len[1],endTagStart-matchStruct.pos[1]-matchStruct.len[1]);
-}
-</cfscript>
-
-<cfscript>
-/**
-* @param stripmode A string, disallow or allow. Specifies if the list of tags in the mytags attribute is a list of tags to allow or disallow. (Required)
-* @param mytags List of tags to either allow or disallow. (Required)
-* @param mystring The string to check. (Required)
-* @param findonly Boolean value. If true, returns the first match. If false, all instances are replaced. (Optional)
-* @return Returns either a string or the first instance of a match.
-*/
-function getSplashTag(stripmode,mytags,mystring) {
- var spanquotes = "([^"">]*""[^""]*"")*";
- var spanstart = "[[:space:]]*/?[[:space:]]*";
- var endstring = "[^>$]*?(>|$)";
- var x = 1;
- var currenttag = structNew();
- var subex = "";
- var findonly = false;
- var cfversion = iif(structKeyExists(GetFunctionList(),"getPageContext"), 6, 5);
- var backref = "\\1"; // this backreference works in cf 5 but not cf mx
- var rexlimit = len(mystring);
-
- if (arraylen(arguments) gt 3) { findonly = arguments[4]; }
- if (cfversion gt 5) { backref = "\#backref#"; } // fix backreference for mx and later cf versions
- else { rexlimit = 19000; } // limit regular expression searches to 19000 characters to support CF 5 regex character limit
-
- if (len(trim(mystring))) {
- // initialize defaults for examining this string
- currenttag.pos = ListToArray("0");
- currenttag.len = ListToArray("0");
-
- mytags = ArrayToList(ListToArray(mytags)); // remove any empty items in the list
- if (len(trim(mytags))) {
- // turn the comma delimited list of tags with * as a wildcard into a regular expression
- mytags = REReplace(mytags,"[[:space:]]","","ALL");
- mytags = REReplace(mytags,"([[:punct:]])",backref,"ALL");
- mytags = Replace(mytags,"\*","[^$>[:space:]]*","ALL");
- mytags = Replace(mytags,"\,","[$>[:space:]]|","ALL");
- mytags = "#mytags#[$>[:space:]]";
- } else { mytags = "$"; } // set the tag list to end of string to evaluate the "allow nothing" condition
-
- // loop over the string
- for (x = 1; x gt 0 and x lt len(mystring); x = x + currenttag.pos[1] + currenttag.len[1] -1)
- {
- // find the next tag within rexlimit characters of the starting point
- currenttag = REFind("<#spanquotes##endstring#",mid(mystring,x,rexlimit),1,true);
- if (currenttag.pos[1])
- {
- // if a tag was found, compare it to the regular expression
- subex = mid(mystring,x + currenttag.pos[1] -1,currenttag.len[1]);
- if (stripmode is "allow" XOR REFindNoCase("^<#spanstart#(#mytags#)",subex,1,false) eq 1)
- {
- if (findonly) { return subex; } // return invalid tag as an error message
- else { // remove the invalid tag from the string
- myString = RemoveChars(myString,x + currenttag.pos[1] -1,currenttag.len[1]);
- currenttag.len[1] = 0; // set the length of the tag string found to zero because it was removed
- }
- }
- }
- // no tag was found within rexlimit characters
- // move to the next block of rexlimit characters -- CF 5 regex limitation
- else { currenttag.pos[1] = rexlimit; }
- }
- }
- if (findonly) { return ""; } // return an empty string indicating no invalid tags found
- else { return mystring; } // return the new string discluding any invalid tags
-}
-</cfscript>
-
<!---
QueryTreeSort takes a query and efficiently (O(n)) resorts it hierarchically (parent-child), adding a Depth column that can then be used when displaying the data.
View
No changes.

0 comments on commit c9eb27a

Please sign in to comment.