context: function TinyMCE_wordpress_cleanup(type, content) {	switch (type) {			case "insert_to_editor":			var startPos = 0;			var altMore = tinyMCE.getLang('lang_wordpress_more_alt');			var altPage = tinyMCE.getLang('lang_wordpress_page_alt');			// Parse all <!--more--> tags and replace them with images			while ((startPos = content.indexOf('<!--more-->', startPos)) != -1) {				// Insert image				var contentAfter = content.substring(startPos + 11);				content = content.substring(0, startPos);				content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';				content += ' width="100%" height="10px" ';				content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" />';				content += contentAfter;				startPos++;			}			var startPos = 0;			// Parse all <!--page--> tags and replace them with images			while ((startPos = content.indexOf('<!--nextpage-->', startPos)) != -1) {				// Insert image				var contentAfter = content.substring(startPos + 15);				content = content.substring(0, startPos);				content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';				content += ' width="100%" height="10px" ';				content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" />';				content += contentAfter;				startPos++;			}			// It's supposed to be WYSIWYG, right?			content = content.replace(new RegExp('&', 'g'), '&amp;');			break;		case "get_from_editor":			// Parse all img tags and replace them with <!--more-->			var startPos = -1;			while ((startPos = content.indexOf('<img', startPos+1)) != -1) {				var endPos = content.indexOf('/>', startPos);				var attribs = TinyMCE_wordpress_parseAttributes(content.substring(startPos + 4, endPos));				if (attribs['class'] == "mce_plugin_wordpress_more") {					endPos += 2;						var embedHTML = '<!--more-->';						// Insert embed/object chunk					chunkBefore = content.substring(0, startPos);					chunkAfter = content.substring(endPos);					content = chunkBefore + embedHTML + chunkAfter;				}				if (attribs['class'] == "mce_plugin_wordpress_page") {					endPos += 2;						var embedHTML = '<!--nextpage-->';						// Insert embed/object chunk					chunkBefore = content.substring(0, startPos);					chunkAfter = content.substring(endPos);					content = chunkBefore + embedHTML + chunkAfter;				}			}			// If it says & in the WYSIWYG editor, it should say &amp; in the html.			content = content.replace(new RegExp('&', 'g'), '&amp;');			content = content.replace(new RegExp('&amp;nbsp;', 'g'), '&nbsp;');			// Remove anonymous, empty paragraphs.			content = content.replace(new RegExp('<p>(\\s|&nbsp;)*</p>', 'mg'), '');			// Handle table badness.			content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>');			content = content.replace(new RegExp('<(tr|thead|tfoot)>.*?<((td|th)( [^>]*)?)>', 'mg'), '<$1><$2>');			content = content.replace(new RegExp('</(td|th)>.*?<(td( [^>]*)?|th( [^>]*)?|/tr|/thead|/tfoot)>', 'mg'), '</$1><$2>');			content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>');			content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>');			// Pretty it up for the source editor.			var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p';			content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');			content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>\\s*', 'mg'), '\n<$1>');			content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>');			content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>');			content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');			content = content.replace(new RegExp('^\\s*', ''), '');			content = content.replace(new RegExp('\\s*$', ''), '');						break;	}	// Pass through to next handler in chain	return content;}
meta: 4999	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/4999/dd202ce1f93f17941127eb74391df1f09672971b/editor_plugin.js/buggy/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js