mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	distinguish between ColdFusion HTML and ColdFusion CFCs
allows for using both ColdFusion Lexers provided by pigments and allows for proper syntax highlighting of cfscript based CFCs Signed-off-by: Sean Coyne <sean@n42designs.com>
This commit is contained in:
		| @@ -403,14 +403,27 @@ CoffeeScript: | |||||||
|  |  | ||||||
| ColdFusion: | ColdFusion: | ||||||
|   type: programming |   type: programming | ||||||
|  |   group: ColdFusion | ||||||
|   lexer: Coldfusion HTML |   lexer: Coldfusion HTML | ||||||
|   ace_mode: coldfusion |   ace_mode: coldfusion | ||||||
|   color: "#ed2cd6" |   color: "#ed2cd6" | ||||||
|   search_term: cfm |   search_term: cfm | ||||||
|   aliases: |   aliases: | ||||||
|   - cfm |   - cfm | ||||||
|  |   - cfml | ||||||
|   extensions: |   extensions: | ||||||
|   - .cfm |   - .cfm | ||||||
|  |  | ||||||
|  | ColdFusion CFC: | ||||||
|  |   type: programming | ||||||
|  |   group: ColdFusion | ||||||
|  |   lexer: Coldfusion CFC | ||||||
|  |   ace_mode: coldfusion | ||||||
|  |   color: "#ed2cd6" | ||||||
|  |   search_term: cfc | ||||||
|  |   aliases: | ||||||
|  |   - cfc | ||||||
|  |   extensions: | ||||||
|   - .cfc |   - .cfc | ||||||
|  |  | ||||||
| Common Lisp: | Common Lisp: | ||||||
|   | |||||||
| @@ -97,6 +97,12 @@ | |||||||
|     "CoffeeScript": [ |     "CoffeeScript": [ | ||||||
|       ".coffee" |       ".coffee" | ||||||
|     ], |     ], | ||||||
|  |     "ColdFusion": [ | ||||||
|  |       ".cfm" | ||||||
|  |     ], | ||||||
|  |     "ColdFusion CFC": [ | ||||||
|  |       ".cfc" | ||||||
|  |     ], | ||||||
|     "Common Lisp": [ |     "Common Lisp": [ | ||||||
|       ".cl", |       ".cl", | ||||||
|       ".lisp" |       ".lisp" | ||||||
| @@ -797,8 +803,8 @@ | |||||||
|       "exception.zep.php" |       "exception.zep.php" | ||||||
|     ] |     ] | ||||||
|   }, |   }, | ||||||
|   "tokens_total": 630435, |   "tokens_total": 631177, | ||||||
|   "languages_total": 869, |   "languages_total": 872, | ||||||
|   "tokens": { |   "tokens": { | ||||||
|     "ABAP": { |     "ABAP": { | ||||||
|       "*/**": 1, |       "*/**": 1, | ||||||
| @@ -16022,6 +16028,224 @@ | |||||||
|       "xFF": 1, |       "xFF": 1, | ||||||
|       "ip.join": 1 |       "ip.join": 1 | ||||||
|     }, |     }, | ||||||
|  |     "ColdFusion": { | ||||||
|  |       "-": 12, | ||||||
|  |       "<html>": 1, | ||||||
|  |       "<head>": 1, | ||||||
|  |       "<title>": 1, | ||||||
|  |       "Date": 1, | ||||||
|  |       "Functions": 1, | ||||||
|  |       "</title>": 1, | ||||||
|  |       "</head>": 1, | ||||||
|  |       "<body>": 1, | ||||||
|  |       "<cfset>": 15, | ||||||
|  |       "RightNow": 7, | ||||||
|  |       "Now": 1, | ||||||
|  |       "<cfoutput>": 3, | ||||||
|  |       "#RightNow#": 1, | ||||||
|  |       "<br>": 8, | ||||||
|  |       "#DateFormat": 2, | ||||||
|  |       "(": 8, | ||||||
|  |       ")": 8, | ||||||
|  |       "#": 8, | ||||||
|  |       "#TimeFormat": 2, | ||||||
|  |       "#IsDate": 3, | ||||||
|  |       "#DaysInMonth": 1, | ||||||
|  |       "</cfoutput>": 3, | ||||||
|  |       "x=": 1, | ||||||
|  |       "y=": 1, | ||||||
|  |       "z=": 1, | ||||||
|  |       "group=": 1, | ||||||
|  |       "#x#": 1, | ||||||
|  |       "#y#": 1, | ||||||
|  |       "#z#": 1, | ||||||
|  |       "</body>": 1, | ||||||
|  |       "</html>": 1, | ||||||
|  |       "person": 2, | ||||||
|  |       "Paul": 1, | ||||||
|  |       "greeting": 2, | ||||||
|  |       "Hello": 2, | ||||||
|  |       "world": 1, | ||||||
|  |       "a": 7, | ||||||
|  |       "5": 1, | ||||||
|  |       "b": 7, | ||||||
|  |       "10": 1, | ||||||
|  |       "c": 6, | ||||||
|  |       "MOD": 1, | ||||||
|  |       "comment": 1 | ||||||
|  |     }, | ||||||
|  |     "ColdFusion CFC": { | ||||||
|  |       "component": 1, | ||||||
|  |       "extends": 1, | ||||||
|  |       "singleton": 1, | ||||||
|  |       "{": 22, | ||||||
|  |       "//": 16, | ||||||
|  |       "DI": 1, | ||||||
|  |       "property": 10, | ||||||
|  |       "name": 10, | ||||||
|  |       "inject": 10, | ||||||
|  |       ";": 55, | ||||||
|  |       "ContentService": 1, | ||||||
|  |       "function": 12, | ||||||
|  |       "init": 2, | ||||||
|  |       "(": 58, | ||||||
|  |       "entityName": 2, | ||||||
|  |       ")": 58, | ||||||
|  |       "it": 1, | ||||||
|  |       "super.init": 1, | ||||||
|  |       "arguments.entityName": 1, | ||||||
|  |       "useQueryCaching": 1, | ||||||
|  |       "true": 12, | ||||||
|  |       "Test": 1, | ||||||
|  |       "scope": 1, | ||||||
|  |       "coloring": 1, | ||||||
|  |       "in": 1, | ||||||
|  |       "pygments": 1, | ||||||
|  |       "this.colorTestVar": 1, | ||||||
|  |       "cookie.colorTestVar": 1, | ||||||
|  |       "client.colorTestVar": 1, | ||||||
|  |       "session.colorTestVar": 1, | ||||||
|  |       "application.colorTestVar": 1, | ||||||
|  |       "return": 11, | ||||||
|  |       "this": 10, | ||||||
|  |       "}": 22, | ||||||
|  |       "clearAllCaches": 1, | ||||||
|  |       "boolean": 6, | ||||||
|  |       "async": 7, | ||||||
|  |       "false": 7, | ||||||
|  |       "var": 15, | ||||||
|  |       "settings": 6, | ||||||
|  |       "settingService.getAllSettings": 6, | ||||||
|  |       "asStruct": 6, | ||||||
|  |       "Get": 6, | ||||||
|  |       "appropriate": 6, | ||||||
|  |       "cache": 12, | ||||||
|  |       "provider": 6, | ||||||
|  |       "cacheBox.getCache": 6, | ||||||
|  |       "settings.cb_content_cacheName": 6, | ||||||
|  |       "cache.clearByKeySnippet": 3, | ||||||
|  |       "keySnippet": 3, | ||||||
|  |       "arguments.async": 3, | ||||||
|  |       "clearAllPageWrapperCaches": 1, | ||||||
|  |       "clearPageWrapperCaches": 1, | ||||||
|  |       "required": 5, | ||||||
|  |       "any": 5, | ||||||
|  |       "slug": 2, | ||||||
|  |       "clearPageWrapper": 1, | ||||||
|  |       "cache.clear": 3, | ||||||
|  |       "searchContent": 1, | ||||||
|  |       "searchTerm": 1, | ||||||
|  |       "numeric": 2, | ||||||
|  |       "max": 2, | ||||||
|  |       "offset": 2, | ||||||
|  |       "asQuery": 2, | ||||||
|  |       "sortOrder": 2, | ||||||
|  |       "isPublished": 1, | ||||||
|  |       "searchActiveContent": 1, | ||||||
|  |       "results": 2, | ||||||
|  |       "c": 1, | ||||||
|  |       "newCriteria": 1, | ||||||
|  |       "only": 1, | ||||||
|  |       "published": 1, | ||||||
|  |       "content": 2, | ||||||
|  |       "if": 4, | ||||||
|  |       "isBoolean": 1, | ||||||
|  |       "arguments.isPublished": 3, | ||||||
|  |       "Published": 2, | ||||||
|  |       "bit": 1, | ||||||
|  |       "c.isEq": 1, | ||||||
|  |       "javaCast": 1, | ||||||
|  |       "eq": 1, | ||||||
|  |       "evaluate": 1, | ||||||
|  |       "other": 1, | ||||||
|  |       "params": 1, | ||||||
|  |       "c.isLt": 1, | ||||||
|  |       "now": 2, | ||||||
|  |       ".": 1, | ||||||
|  |       "or": 3, | ||||||
|  |       "c.restrictions.isNull": 1, | ||||||
|  |       "c.restrictions.isGT": 1, | ||||||
|  |       ".isEq": 1, | ||||||
|  |       "Search": 1, | ||||||
|  |       "Criteria": 1, | ||||||
|  |       "len": 1, | ||||||
|  |       "arguments.searchTerm": 1, | ||||||
|  |       "like": 1, | ||||||
|  |       "disjunctions": 1, | ||||||
|  |       "c.createAlias": 1, | ||||||
|  |       "Do": 1, | ||||||
|  |       "we": 1, | ||||||
|  |       "search": 1, | ||||||
|  |       "title": 2, | ||||||
|  |       "and": 2, | ||||||
|  |       "active": 1, | ||||||
|  |       "just": 1, | ||||||
|  |       "arguments.searchActiveContent": 1, | ||||||
|  |       "c.": 1, | ||||||
|  |       "c.restrictions.like": 2, | ||||||
|  |       "else": 1, | ||||||
|  |       "c.like": 1, | ||||||
|  |       "run": 1, | ||||||
|  |       "criteria": 1, | ||||||
|  |       "query": 1, | ||||||
|  |       "projections": 1, | ||||||
|  |       "count": 1, | ||||||
|  |       "results.count": 1, | ||||||
|  |       "c.count": 1, | ||||||
|  |       "results.content": 1, | ||||||
|  |       "c.resultTransformer": 1, | ||||||
|  |       "c.DISTINCT_ROOT_ENTITY": 1, | ||||||
|  |       ".list": 1, | ||||||
|  |       "arguments.offset": 1, | ||||||
|  |       "arguments.max": 1, | ||||||
|  |       "arguments.sortOrder": 1, | ||||||
|  |       "arguments.asQuery": 1, | ||||||
|  |       "private": 4, | ||||||
|  |       "syncUpdateHits": 1, | ||||||
|  |       "contentID": 1, | ||||||
|  |       "q": 1, | ||||||
|  |       "new": 1, | ||||||
|  |       "Query": 1, | ||||||
|  |       "sql": 1, | ||||||
|  |       ".execute": 1, | ||||||
|  |       "closureTest": 1, | ||||||
|  |       "methodCall": 1, | ||||||
|  |       "param1": 2, | ||||||
|  |       "arg1": 4, | ||||||
|  |       "arg2": 2, | ||||||
|  |       "StructliteralTest": 1, | ||||||
|  |       "foo": 3, | ||||||
|  |       "bar": 1, | ||||||
|  |       "brad": 3, | ||||||
|  |       "func": 1, | ||||||
|  |       "array": 1, | ||||||
|  |       "[": 2, | ||||||
|  |       "wood": 2, | ||||||
|  |       "null": 2, | ||||||
|  |       "]": 2, | ||||||
|  |       "last": 1, | ||||||
|  |       "arrayliteralTest": 1, | ||||||
|  |       "<cfcomponent>": 1, | ||||||
|  |       "<cffunction>": 2, | ||||||
|  |       "name=": 4, | ||||||
|  |       "access=": 2, | ||||||
|  |       "returntype=": 2, | ||||||
|  |       "<cfargument>": 2, | ||||||
|  |       "type=": 2, | ||||||
|  |       "required=": 2, | ||||||
|  |       "<cfset>": 2, | ||||||
|  |       "myVariable": 1, | ||||||
|  |       "arguments": 2, | ||||||
|  |       "<cfreturn>": 1, | ||||||
|  |       "</cffunction>": 2, | ||||||
|  |       "<cfif>": 1, | ||||||
|  |       "structKeyExists": 1, | ||||||
|  |       "writeoutput": 1, | ||||||
|  |       "Argument": 1, | ||||||
|  |       "exists": 1, | ||||||
|  |       "</cfif>": 1, | ||||||
|  |       "</cfcomponent>": 1 | ||||||
|  |     }, | ||||||
|     "Common Lisp": { |     "Common Lisp": { | ||||||
|       ";": 152, |       ";": 152, | ||||||
|       "@file": 1, |       "@file": 1, | ||||||
| @@ -69764,6 +69988,8 @@ | |||||||
|     "Cirru": 244, |     "Cirru": 244, | ||||||
|     "Clojure": 510, |     "Clojure": 510, | ||||||
|     "CoffeeScript": 2951, |     "CoffeeScript": 2951, | ||||||
|  |     "ColdFusion": 131, | ||||||
|  |     "ColdFusion CFC": 611, | ||||||
|     "Common Lisp": 2186, |     "Common Lisp": 2186, | ||||||
|     "Component Pascal": 825, |     "Component Pascal": 825, | ||||||
|     "Coq": 18259, |     "Coq": 18259, | ||||||
| @@ -69964,6 +70190,8 @@ | |||||||
|     "Cirru": 9, |     "Cirru": 9, | ||||||
|     "Clojure": 7, |     "Clojure": 7, | ||||||
|     "CoffeeScript": 9, |     "CoffeeScript": 9, | ||||||
|  |     "ColdFusion": 1, | ||||||
|  |     "ColdFusion CFC": 2, | ||||||
|     "Common Lisp": 3, |     "Common Lisp": 3, | ||||||
|     "Component Pascal": 2, |     "Component Pascal": 2, | ||||||
|     "Coq": 12, |     "Coq": 12, | ||||||
| @@ -70137,5 +70365,5 @@ | |||||||
|     "fish": 3, |     "fish": 3, | ||||||
|     "wisp": 1 |     "wisp": 1 | ||||||
|   }, |   }, | ||||||
|   "md5": "1edee1d2c454fb877027ae980cd163ef" |   "md5": "9f2e70b08b9943b57c05e7ce6196827f" | ||||||
| } | } | ||||||
							
								
								
									
										239
									
								
								samples/ColdFusion CFC/exampleScript.cfc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										239
									
								
								samples/ColdFusion CFC/exampleScript.cfc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,239 @@ | |||||||
|  | /** | ||||||
|  | ******************************************************************************** | ||||||
|  | ContentBox - A Modular Content Platform | ||||||
|  | Copyright 2012 by Luis Majano and Ortus Solutions, Corp | ||||||
|  | www.gocontentbox.org | www.luismajano.com | www.ortussolutions.com | ||||||
|  | ******************************************************************************** | ||||||
|  | Apache License, Version 2.0 | ||||||
|  |  | ||||||
|  | Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp] | ||||||
|  |  | ||||||
|  | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  | you may not use this file except in compliance with the License. | ||||||
|  | You may obtain a copy of the License at | ||||||
|  |  | ||||||
|  | http://www.apache.org/licenses/LICENSE-2.0 | ||||||
|  |  | ||||||
|  | Unless required by applicable law or agreed to in writing, software | ||||||
|  | distributed under the License is distributed on an "AS IS" BASIS, | ||||||
|  | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
|  | See the License for the specific language governing permissions and | ||||||
|  | limitations under the License. | ||||||
|  | ******************************************************************************** | ||||||
|  | * A generic content service for content objects | ||||||
|  | */ | ||||||
|  | component extends="coldbox.system.orm.hibernate.VirtualEntityService" singleton{ | ||||||
|  |  | ||||||
|  | 	// DI | ||||||
|  | 	property name="settingService"			inject="id:settingService@cb"; | ||||||
|  | 	property name="cacheBox"				inject="cachebox"; | ||||||
|  | 	property name="log"						inject="logbox:logger:{this}"; | ||||||
|  | 	property name="customFieldService" 	 	inject="customFieldService@cb"; | ||||||
|  | 	property name="categoryService" 	 	inject="categoryService@cb"; | ||||||
|  | 	property name="commentService" 	 		inject="commentService@cb"; | ||||||
|  | 	property name="contentVersionService"	inject="contentVersionService@cb"; | ||||||
|  | 	property name="authorService"			inject="authorService@cb"; | ||||||
|  | 	property name="populator"				inject="wirebox:populator"; | ||||||
|  | 	property name="systemUtil"				inject="SystemUtil@cb"; | ||||||
|  | 	 | ||||||
|  | 	/* | ||||||
|  | 	* Constructor | ||||||
|  | 	* @entityName.hint The content entity name to bind this service to. | ||||||
|  | 	*/ | ||||||
|  | 	ContentService function init(entityName="cbContent"){ | ||||||
|  | 		// init it | ||||||
|  | 		super.init(entityName=arguments.entityName, useQueryCaching=true); | ||||||
|  |  | ||||||
|  | 		// Test scope coloring in pygments | ||||||
|  | 		this.colorTestVar = "Just for testing pygments!"; | ||||||
|  | 		cookie.colorTestVar = ""; | ||||||
|  | 		client.colorTestVar = "" | ||||||
|  | 		session.colorTestVar = ""; | ||||||
|  | 		application.colorTestVar = ""; | ||||||
|  |  | ||||||
|  | 		return this; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	* Clear all content caches | ||||||
|  | 	* @async.hint Run it asynchronously or not, defaults to false | ||||||
|  | 	*/ | ||||||
|  | 	function clearAllCaches(boolean async=false){ | ||||||
|  | 		var settings = settingService.getAllSettings(asStruct=true); | ||||||
|  | 		// Get appropriate cache provider | ||||||
|  | 		var cache = cacheBox.getCache( settings.cb_content_cacheName ); | ||||||
|  | 		cache.clearByKeySnippet(keySnippet="cb-content",async=arguments.async); | ||||||
|  | 		return this; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	* Clear all page wrapper caches | ||||||
|  | 	* @async.hint Run it asynchronously or not, defaults to false | ||||||
|  | 	*/ | ||||||
|  | 	function clearAllPageWrapperCaches(boolean async=false){ | ||||||
|  | 		var settings = settingService.getAllSettings(asStruct=true); | ||||||
|  | 		// Get appropriate cache provider | ||||||
|  | 		var cache = cacheBox.getCache( settings.cb_content_cacheName ); | ||||||
|  | 		cache.clearByKeySnippet(keySnippet="cb-content-pagewrapper",async=arguments.async); | ||||||
|  | 		return this; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	* Clear all page wrapper caches | ||||||
|  | 	* @slug.hint The slug partial to clean on | ||||||
|  | 	* @async.hint Run it asynchronously or not, defaults to false | ||||||
|  | 	*/ | ||||||
|  | 	function clearPageWrapperCaches(required any slug, boolean async=false){ | ||||||
|  | 		var settings = settingService.getAllSettings(asStruct=true); | ||||||
|  | 		// Get appropriate cache provider | ||||||
|  | 		var cache = cacheBox.getCache( settings.cb_content_cacheName ); | ||||||
|  | 		cache.clearByKeySnippet(keySnippet="cb-content-pagewrapper-#arguments.slug#",async=arguments.async); | ||||||
|  | 		return this; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	* Clear a page wrapper cache | ||||||
|  | 	* @slug.hint The slug to clean | ||||||
|  | 	* @async.hint Run it asynchronously or not, defaults to false | ||||||
|  | 	*/ | ||||||
|  | 	function clearPageWrapper(required any slug, boolean async=false){ | ||||||
|  | 		var settings = settingService.getAllSettings(asStruct=true); | ||||||
|  | 		// Get appropriate cache provider | ||||||
|  | 		var cache = cacheBox.getCache( settings.cb_content_cacheName ); | ||||||
|  | 		cache.clear("cb-content-pagewrapper-#arguments.slug#/"); | ||||||
|  | 		return this; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	* Searches published content with cool paramters, remember published content only | ||||||
|  | 	* @searchTerm.hint The search term to search | ||||||
|  | 	* @max.hint The maximum number of records to paginate | ||||||
|  | 	* @offset.hint The offset in the pagination | ||||||
|  | 	* @asQuery.hint Return as query or array of objects, defaults to array of objects | ||||||
|  | 	* @sortOrder.hint The sorting of the search results, defaults to publishedDate DESC | ||||||
|  | 	* @isPublished.hint Search for published, non-published or both content objects [true, false, 'all'] | ||||||
|  | 	* @searchActiveContent.hint Search only content titles or both title and active content. Defaults to both. | ||||||
|  | 	*/ | ||||||
|  | 	function searchContent( | ||||||
|  | 		any searchTerm="",  | ||||||
|  | 		numeric max=0,  | ||||||
|  | 		numeric offset=0,  | ||||||
|  | 		boolean asQuery=false,  | ||||||
|  | 		any sortOrder="publishedDate DESC",  | ||||||
|  | 		any isPublished=true,  | ||||||
|  | 		boolean searchActiveContent=true){ | ||||||
|  |  | ||||||
|  | 		var results = {}; | ||||||
|  | 		var c = newCriteria(); | ||||||
|  |  | ||||||
|  | 		// only published content | ||||||
|  | 		if( isBoolean( arguments.isPublished ) ){ | ||||||
|  | 			// Published bit | ||||||
|  | 			c.isEq( "isPublished", javaCast( "Boolean", arguments.isPublished ) ); | ||||||
|  | 			// Published eq true evaluate other params | ||||||
|  | 			if( arguments.isPublished ){ | ||||||
|  | 				c.isLt("publishedDate", now() ) | ||||||
|  | 				.$or( c.restrictions.isNull("expireDate"), c.restrictions.isGT("expireDate", now() ) ) | ||||||
|  | 				.isEq("passwordProtection",""); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		// Search Criteria | ||||||
|  | 		if( len( arguments.searchTerm ) ){ | ||||||
|  | 			// like disjunctions | ||||||
|  | 			c.createAlias("activeContent","ac"); | ||||||
|  | 			// Do we search title and active content or just title? | ||||||
|  | 			if( arguments.searchActiveContent ){ | ||||||
|  | 				c.$or( c.restrictions.like("title","%#arguments.searchTerm#%"), | ||||||
|  | 				  	  c.restrictions.like("ac.content", "%#arguments.searchTerm#%") ); | ||||||
|  | 			} | ||||||
|  | 			else{ | ||||||
|  | 				c.like( "title", "%#arguments.searchTerm#%" );  | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		// run criteria query and projections count | ||||||
|  | 		results.count = c.count( "contentID" ); | ||||||
|  | 		results.content = c.resultTransformer( c.DISTINCT_ROOT_ENTITY ) | ||||||
|  | 							.list(offset=arguments.offset, max=arguments.max, sortOrder=arguments.sortOrder, asQuery=arguments.asQuery); | ||||||
|  | 	 | ||||||
|  | 		return results; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | /********************************************* PRIVATE *********************************************/ | ||||||
|  | 	 | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	* Update the content hits | ||||||
|  | 	* @contentID.hint The content id to update | ||||||
|  | 	*/ | ||||||
|  | 	private function syncUpdateHits(required contentID){ | ||||||
|  | 		var q = new Query(sql="UPDATE cb_content SET hits = hits + 1 WHERE contentID = #arguments.contentID#").execute(); | ||||||
|  | 		return this; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	 | ||||||
|  | 	private function closureTest(){ | ||||||
|  | 		methodCall( | ||||||
|  | 			param1, | ||||||
|  | 			function( arg1, required arg2 ){ | ||||||
|  | 				var settings = settingService.getAllSettings(asStruct=true); | ||||||
|  | 				// Get appropriate cache provider | ||||||
|  | 				var cache = cacheBox.getCache( settings.cb_content_cacheName ); | ||||||
|  | 				cache.clear("cb-content-pagewrapper-#arguments.slug#/"); | ||||||
|  | 				return this; | ||||||
|  | 			}, | ||||||
|  | 			param1 | ||||||
|  | 		); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private function StructliteralTest(){ | ||||||
|  | 		return { | ||||||
|  | 			foo = bar, | ||||||
|  | 			brad = 'Wood', | ||||||
|  | 			func = function( arg1, required arg2 ){ | ||||||
|  | 				var settings = settingService.getAllSettings(asStruct=true); | ||||||
|  | 				// Get appropriate cache provider | ||||||
|  | 				var cache = cacheBox.getCache( settings.cb_content_cacheName ); | ||||||
|  | 				cache.clear("cb-content-pagewrapper-#arguments.slug#/"); | ||||||
|  | 				return this; | ||||||
|  | 			}, | ||||||
|  | 			array = [ | ||||||
|  | 				1, | ||||||
|  | 				2, | ||||||
|  | 				3, | ||||||
|  | 				4, | ||||||
|  | 				5, | ||||||
|  | 				'test', | ||||||
|  | 				'testing', | ||||||
|  | 				'testerton', | ||||||
|  | 				{ | ||||||
|  | 					foo = true, | ||||||
|  | 					brad = false, | ||||||
|  | 					wood = null | ||||||
|  | 				} | ||||||
|  | 			], | ||||||
|  | 			last = "final" | ||||||
|  | 		}; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	private function arrayliteralTest(){ | ||||||
|  | 		return [ | ||||||
|  | 			1, | ||||||
|  | 			2, | ||||||
|  | 			3, | ||||||
|  | 			4, | ||||||
|  | 			5, | ||||||
|  | 			'test', | ||||||
|  | 			'testing', | ||||||
|  | 			'testerton', | ||||||
|  | 			{ | ||||||
|  | 				foo = true, | ||||||
|  | 				brad = false, | ||||||
|  | 				wood = null | ||||||
|  | 			}, | ||||||
|  | 			'testy-von-testavich' | ||||||
|  | 		]; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | } | ||||||
							
								
								
									
										18
									
								
								samples/ColdFusion CFC/exampleTag.cfc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								samples/ColdFusion CFC/exampleTag.cfc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | |||||||
|  | <cfcomponent> | ||||||
|  | 	 | ||||||
|  | 	<cffunction name="init" access="public" returntype="any"> | ||||||
|  | 		<cfargument name="arg1" type="any" required="true"> | ||||||
|  | 		<cfset this.myVariable = arguments.arg1> | ||||||
|  |  | ||||||
|  | 		<cfreturn this> | ||||||
|  | 	</cffunction> | ||||||
|  |  | ||||||
|  | 	<cffunction name="testFunc" access="private" returntype="void"> | ||||||
|  | 		<cfargument name="arg1" type="any" required="false"> | ||||||
|  | 		 | ||||||
|  | 		<cfif structKeyExists(arguments, "arg1")> | ||||||
|  | 			<cfset writeoutput("Argument exists")> | ||||||
|  | 		</cfif> | ||||||
|  | 	</cffunction> | ||||||
|  | 	 | ||||||
|  | </cfcomponent> | ||||||
							
								
								
									
										50
									
								
								samples/ColdFusion/example.cfm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								samples/ColdFusion/example.cfm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | |||||||
|  | <!--- cfcomment ---> | ||||||
|  | <!--- nested <!--- cfcomment ---> ---> | ||||||
|  | <!--- multi-line | ||||||
|  | nested | ||||||
|  | <!--- | ||||||
|  | cfcomment | ||||||
|  | ---> | ||||||
|  | ---> | ||||||
|  | <!-- html comment --> | ||||||
|  | <html> | ||||||
|  | <head> | ||||||
|  | <title>Date Functions</title> | ||||||
|  | </head> | ||||||
|  | <body> | ||||||
|  | <cfset RightNow = Now()> | ||||||
|  | <cfoutput> | ||||||
|  |  #RightNow#<br /> | ||||||
|  |  #DateFormat(RightNow)#<br /> | ||||||
|  |  #DateFormat(RightNow,"mm/dd/yy")#<br /> | ||||||
|  |  #TimeFormat(RightNow)#<br /> | ||||||
|  |  #TimeFormat(RightNow,"hh:mm tt")#<br /> | ||||||
|  |  #IsDate(RightNow)#<br /> | ||||||
|  |  #IsDate("January 31, 2007")#<br /> | ||||||
|  |  #IsDate("foo")#<br /> | ||||||
|  |  #DaysInMonth(RightNow)# | ||||||
|  | </cfoutput> | ||||||
|  | <cfset x="x"> | ||||||
|  | <cfset y="y"> | ||||||
|  | <cfset z="z"> | ||||||
|  | <cfoutput group="x"> | ||||||
|  |     #x# | ||||||
|  |     <cfoutput>#y#</cfoutput> | ||||||
|  |     #z# | ||||||
|  | </cfoutput> | ||||||
|  | </body> | ||||||
|  | </html> | ||||||
|  |  | ||||||
|  | <cfset person = "Paul"> | ||||||
|  | <cfset greeting = "Hello #person#"> | ||||||
|  |  | ||||||
|  | <cfset greeting = "Hello" & " world!"> | ||||||
|  | <cfset a = 5> | ||||||
|  | <cfset b = 10> | ||||||
|  | <cfset c = a^b> | ||||||
|  | <cfset c = a MOD b> | ||||||
|  | <cfset c = a / b> | ||||||
|  | <cfset c = a * b> | ||||||
|  | <cfset c = a + b> | ||||||
|  | <cfset c = a - b> | ||||||
|  | <!--- <!-- another <!--- nested --> ---> comment ---> | ||||||
		Reference in New Issue
	
	Block a user