Location: PHPKode > projects > Php Site Manager > template/tinymce_integration.php
			<script type="text/javascript">
			<!--
				/* Version 1.1
				 * Author: Moxiecode Systems 
				 */
				
				var tinyMCE_on = false;
				
				tinyMCE.init(
				{
					mode : "exact",
					
					theme : "advanced",
					language : "{[$LANG]}",
					
					plugins : "contextmenu,table,emotions,insertdatetime,media,fullscreen,searchreplace,print,paste",
					
					theme_advanced_buttons1 : "bold,italic,underline,separator,undo,redo,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,separator,outdent,indent,separator,link,unlink,separator",
					theme_advanced_buttons1_add: "forecolor,formatselect,fontselect,fontsizeselect,styleselect,separator",
					
					theme_advanced_buttons2_add_before : "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator,image,media,emotions,separator",
					theme_advanced_buttons2 : "hr,separator,tablecontrols,separator,insertdate,inserttime,charmap,separator,print,fullscreen,separator,removeformat,cleanup,code",
					
					theme_advanced_buttons3 : "",
					
					theme_advanced_toolbar_location : "top",
					theme_advanced_toolbar_align : "center",
					theme_advanced_resize_horizontal : false,
					theme_advanced_resizing : true,
					theme_advanced_path_location : "bottom",
					theme_advanced_styles : "Code=code;Quote=quote",

					/*force_br_newlines : true,*/
					force_p_newlines : true,

					save_callback : "TinyMCESaving",
					add_form_submit_trigger : false,
					submit_patch : false,
					add_unload_trigger : false,
					entity_encoding : "raw",
					
					content_css : "http://{[$SERVER_URL]}/{[$TEMPLATE_DIR]}/content.css",
					
					relative_urls : false,
					remove_script_host : false,
					convert_fonts_to_styles : true
				});
			
				function TinyMCESaving() {
					if (tinyMCE_on == true)
						document.forms["page_form"].page_content.value = convertFromMCEToXHTML(tinyMCE.getContent());
				}
			
				function convertFromMCEToXHTML(source)
				{
					source = source.replace(/<font face=\"(.*?)\" size=\"(.*?)\" color=\"(.*?)\">(.*?)<\/font>/gi, "<span class=\"font_size_$2\" style=\"font-family: $1\;color: $3\">$4</span>");
					source = source.replace(/<font face=\"(.*?)\" size=\"(.*?)\">(.*?)<\/font>/gi, "<span class=\"font_size_$2\" style=\"font-family: $1\">$3</span>");
					source = source.replace(/<font face=\"(.*?)\" color=\"(.*?)\">(.*?)<\/font>/gi, "<span style=\"font-family: $1\;color: $2\">$3</span>");
					source = source.replace(/<font face=\"(.*?)\">(.*?)<\/font>/gi, "<span style=\"font-family: $1\">$2</span>");

					source = source.replace(/<font size=\"(.*?)\" color=\"(.*?)\">(.*?)<\/font>/gi, "<span class=\"font_size_$1\" style=\"color: $2\">$3</span>");
					source = source.replace(/<font size=\"(.*?)\">(.*?)<\/font>/gi, "<span class=\"font_size_$1\">$2</span>");
					
					source = source.replace(/<font color=\"(.*?)\">(.*?)<\/font>/gi, "<span style=\"color: $1\">$2</span>");
					
					
					/* xHTML ISSUES */
					source = source.replace(/ border=\"(.*?)\"/gi,"");
					source = source.replace(/ target=\"(.*?)\"/gi,"");
					source = source.replace(/“/gi, "&ldquo;");
					source = source.replace(/”/gi, "&rdquo;");
										
					return source;
				}
			
				function convertFromXHTMLToMCE(source)
				{
					source = source.replace(/<span class=\"font_size_(.*?)\" style=\"font-family: (.*?)\;color: (.*?)\">(.*?)<\/span>/gi, "<font face=\"$2\" size=\"$1\" color=\"$3\">$4<\/font>");
					source = source.replace(/<span class=\"font_size_(.*?)\" style=\"font-family: (.*?)\">(.*?)<\/span>/gi, "<font face=\"$2\" size=\"$1\">$3<\/font>");
					source = source.replace(/<span style=\"font-family: (.*?);color: (.*?)\">(.*?)<\/span>/gi, "<font face=\"$1\" color=\"$2\">$3<\/font>");
					source = source.replace(/<span style=\"font-family: (.*?)\">(.*?)<\/span>/gi, "<font face=\"$1\">$2<\/font>");
					source = source.replace(/<span class=\"font_size_(.*?)\" style=\"color: (.*?)\">(.*?)<\/span>/gi, "<font size=\"$1\" color=\"$2\">$3<\/font>");
					source = source.replace(/<span class=\"font_size_(.*?)\">(.*?)<\/span>/gi, "<font size=\"$1\">$2<\/font>");
					source = source.replace(/<span style=\"color: (.*?)\">(.*?)<\/span>/gi, "<font color=\"$1\">$2<\/font>");
					
					/* xHTML ISSUES */
					source = source.replace(/ border=\"(.*?)\"/gi,"");
					source = source.replace(/ target=\"(.*?)\"/gi,"");
					source = source.replace(/“/gi, "&ldquo;");
					source = source.replace(/”/gi, "&rdquo;");
					
					return source; 
				}
				
				function toggleTinyMCE() {
					if (tinyMCE_on == true) {
						// if mce is on, we toggle it off and convert to BBCode
						tinyMCE.execCommand("mceRemoveControl", false, "page_content");
						document.forms["page_form"].page_content.value = convertFromMCEToXHTML(document.forms["page_form"].page_content.value);
						tinyMCE_on = false;
						return;
					} else {
						// if mce is off, we toggle it on and convert to HTML code
						document.forms["page_form"].page_content.value = convertFromXHTMLToMCE(document.forms["page_form"].page_content.value);			
						tinyMCE.execCommand("mceAddControl", false, "page_content");
						tinyMCE_on = true;
						return;
					}
				}
			
				function submitForm(the_form) {
					TinyMCESaving();
					return process_form(the_form);
				}
			-->
			</script>

			<script type="text/javascript">
				function toggle(obj)
				{
					var el = document.getElementById(obj);
					el.style.display = (el.style.display != 'none' ? 'none' : '' );
				}
				
				//
				// Swap Text Visual Editor
				//
				var VEditor_on = false;
				
				function swap_text(obj)
				{
					var element = document.getElementById(obj);
					
					if (VEditor_on == false)
					{
						element.innerHTML = '{[$L__EDIT_PAGE__TINYMCE_OPEN]}';
						VEditor_on = true;
					}
					else
					{
						element.innerHTML = '{[$L__EDIT_PAGE__TINYMCE_CLOSE]}';
						VEditor_on = false;
					}
				}
			</script>
			
			<script type="text/javascript">
				window.onload = function()
				{
					toggleTinyMCE();
				}
			</script>
Return current item: Php Site Manager