CLICK HERE TO BUY IT TODAY! OR GET IT FREE VIA TRIALPAY  

PHP Demo Application - Source Code

/Framework/Model/Vendor/CkEditor/_source/core/htmlparser/filter.js



/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
	    CKEDITOR.htmlParser.filter CKEDITOR.tools.createClass(
	    {
		        $ : function( rules )
		        {
			            this.=
			            {
				                elementNames [],
				                attributeNames [],
				                elements : { $length 0
					},
				                attributes : { $length 0
					}
				            };
			            if ( rules )
			                this.addRulesrules10 );
			        },
		        proto :
		        {
			            addRules : function( rulespriority )
			            {
				                if ( typeof priority != 'number' )
				                    priority 10;
				                // Add the elementNames.
				                addItemsToListthis._.elementNamesrules.elementNamespriority );
				                // Add the attributeNames.
				                addItemsToListthis._.attributeNamesrules.attributeNamespriority );
				                // Add the elements.
				                addNamedItemsthis._.elementsrules.elementspriority );
				                // Add the attributes.
				                addNamedItemsthis._.attributesrules.attributespriority );
				                // Add the text.
				                this._.text transformNamedItemthis._.textrules.textpriority ) || this._.text;
				                // Add the comment.
				                this._.comment transformNamedItemthis._.commentrules.commentpriority ) || this._.comment;
				                // Add root fragment.
				                this._.root transformNamedItemthis._.rootrules.rootpriority ) || this._.root;
				            },
			            onElementName : function( name )
			            {
				                return filterNamenamethis._.elementNames );
				            },
			            onAttributeName : function( name )
			            {
				                return filterNamenamethis._.attributeNames );
				            },
			            onText : function( text )
			            {
				                var textFilter this._.text;
				                return textFilter textFilter.filtertext ) : text;
				            },
			            onComment : function( commentTextcomment )
			            {
				                var textFilter this._.comment;
				                return textFilter textFilter.filtercommentTextcomment ) : commentText;
				            },
			            onFragment : function( element )
			            {
				                var rootFilter this._.root;
				                return rootFilter rootFilter.filterelement ) : element;
				            },
			            onElement : function( element )
			            {
				                // We must apply filters set to the specific element name as
				                // well as those set to the generic $ name. So, add both to an
				                // array and process them in a small loop.
				                var filters = [ this._.elements'^' ], this._.elementselement.name ], this._.elements.$ ],
				                    filterret;
				                for ( var ;
				 ;
				 i++ )
				                {
					                    filter filters];
					                    if ( filter )
					                    {
						                        ret filter.filterelementthis );
						                        if ( ret === false )
						                            return null;
						                        if ( ret && ret != element )
						                            return this.onNoderet );
						                        // The non-root element has been dismissed by one of the filters.
						                        if ( element.parent && !element.name )
						                            break;
						                    }
					                }
				                return element;
				            },
			            onNode : function( node )
			            {
				                var type node.type;
				                return type == CKEDITOR.NODE_ELEMENT this.onElementnode ) :
				                    type == CKEDITOR.NODE_TEXT ? new CKEDITOR.htmlParser.textthis.onTextnode.value ) ) :
				                    type == CKEDITOR.NODE_COMMENT ? new CKEDITOR.htmlParser.commentthis.onCommentnode.value ) ):
				                    null;
				            },
			            onAttribute : function( elementnamevalue )
			            {
				                var filter this._.attributesname ];
				                if ( filter )
				                {
					                    var ret filter.filtervalueelementthis );
					                    if ( ret === false )
					                        return false;
					                    if ( typeof ret != 'undefined' )
					                        return ret;
					                }
				                return value;
				            }
			        }
		    });
	    function filterNamenamefilters )
	    {
		        for ( var ;
		 name && filters.length ;
		 i++ )
		        {
			            var filter filters];
			            name name.replacefilter], filter] );
			        }
		        return name;
		    }
	    function addItemsToList( list, itemspriority )
	    {
		        if ( typeof items == 'function' )
		            items = [ items ];
		        var ij,
		            listLength = list.length,
		            itemsLength items && items.length;
		        if ( itemsLength )
		        {
			            // Find the index to insert the items at.
			            for ( ;
			 listLength && list[ ].pri priority ;
			 i++ )
			            { /*jsl:pass*/
				}
			            // Add all new items to the list at the specific index.
			            for ( itemsLength ;
			 >= ;
			 j-- )
			            {
				                var item items];
				                if ( item )
				                {
					                    item.pri priority;
					                    list.splicei0item );
					                }
				            }
			        }
		    }
	    function addNamedItemshashTableitemspriority )
	    {
		        if ( items )
		        {
			            for ( var name in items )
			            {
				                var current hashTablename ];
				                hashTablename ] =
				                    transformNamedItem(
				                        current,
				                        itemsname ],
				                        priority );
				                if ( !current )
				                    hashTable.$length++;
				            }
			        }
		    }
	    function transformNamedItemcurrentitempriority )
	    {
		        if ( item )
		        {
			            item.pri priority;
			            if ( current )
			            {
				                // If the current item is not an Array, transform it.
				                if ( !current.splice )
				                {
					                    if ( current.pri priority )
					                        current = [ itemcurrent ];
					                    else
					                        current = [ currentitem ];
					                    current.filter callItems;
					                }
				                else
				                    addItemsToListcurrentitempriority );
				                return current;
				            }
			            else
			            {
				                item.filter item;
				                return item;
				            }
			        }
		    }
	    // Invoke filters sequentially on the array, break the iteration
	    // when it doesn't make sense to continue anymore.
	    function callItemscurrentEntry )
	    {
		        var isNode currentEntry.type
		            || currentEntry instanceof CKEDITOR.htmlParser.fragment;
		        for ( var ;
		 this.length ;
		 i++ )
		        {
			            // Backup the node info before filtering.
			            if ( isNode )
			            {
				                var orgType currentEntry.type,
				                        orgName currentEntry.name;
				            }
			            var item this],
			                ret item.applywindowarguments );
			            if ( ret === false )
			                return ret;
			            // We're filtering node (element/fragment).
			            if ( isNode )
			            {
				                // No further filtering if it's not anymore
				                // fitable for the subsequent filters.
				                if ( ret && ( ret.name != orgName
				                    || ret.type != orgType ) )
				                {
					                    return ret;
					                }
				            }
			            // Filtering value (nodeName/textValue/attrValue).
			            else
			            {
				                // No further filtering if it's not
				                // any more values.
				                if ( typeof ret != 'string' )
				                    return ret;
				            }
			            ret != undefined && ( currentEntry ret );
			        }
		        return currentEntry;
		    }
	})();
// "entities" plugin
/*
{
	    text : function( text )
	    {
		        // TODO : Process entities.
		        return text.toUpperCase();
		    }
	};
*/





PHP Demo Source Code Index