diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-06-22 18:31:50 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-06-22 18:31:50 +0000 |
commit | d48e85e0ac5e675ca33fac173f30c75403d1033f (patch) | |
tree | 1164430fa3b83a4d9283961b09c1576f2885e6b2 /wp-includes/js/tinymce/plugins | |
parent | 086dcde66603301531efc6d8087bd06d0546f148 (diff) | |
download | wordpress-mu-d48e85e0ac5e675ca33fac173f30c75403d1033f.tar.gz wordpress-mu-d48e85e0ac5e675ca33fac173f30c75403d1033f.tar.xz wordpress-mu-d48e85e0ac5e675ca33fac173f30c75403d1033f.zip |
Moved everything in wp-inst down a directory.
Uses's Ryan Boren's htaccess rules and mods
If you're upgrading, try this on a test server first!
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@591 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/js/tinymce/plugins')
57 files changed, 4237 insertions, 0 deletions
diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js new file mode 100644 index 0000000..4b88d2e --- /dev/null +++ b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js @@ -0,0 +1,48 @@ +/**
+ * $RCSfile: editor_plugin_src.js,v $
+ * $Revision: 1.11 $
+ * $Date: 2006/03/22 12:21:21 $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('autosave', 'en,tr,sv,cs,he,nb,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,pl,pt_br');
+
+var TinyMCE_AutoSavePlugin = {
+ getInfo : function() {
+ return {
+ longname : 'Auto save',
+ author : 'Moxiecode Systems',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+ },
+
+ // Private plugin internal methods
+
+ _beforeUnloadHandler : function() {
+ var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg");
+
+ if (tinyMCE.getParam("fullscreen_is_enabled"))
+ return;
+
+ for (n in tinyMCE.instances) {
+ inst = tinyMCE.instances[n];
+
+ if (!tinyMCE.isInstance(inst))
+ continue;
+
+ if (inst.isDirty())
+ return msg;
+ }
+
+ return;
+ }
+};
+
+window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler;
+
+tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin);
diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js new file mode 100644 index 0000000..102d69b --- /dev/null +++ b/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js @@ -0,0 +1,30 @@ +/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
+
+function TinyMCE_autosave_getInfo() {
+ return {
+ longname : 'Auto save',
+ author : 'Moxiecode Systems',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+};
+
+function TinyMCE_autosave_beforeUnloadHandler() {
+ var msg = tinyMCE.getLang("lang_autosave_unload_msg");
+
+ var anyDirty = false;
+ for (var n in tinyMCE.instances) {
+ var inst = tinyMCE.instances[n];
+ if (!tinyMCE.isInstance(inst))
+ continue;
+
+ if (inst.isDirty())
+ return msg;
+ }
+
+ return;
+}
+
+window.onbeforeunload = TinyMCE_autosave_beforeUnloadHandler;
diff --git a/wp-includes/js/tinymce/plugins/autosave/langs/cs.js b/wp-includes/js/tinymce/plugins/autosave/langs/cs.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/autosave/langs/cs.js diff --git a/wp-includes/js/tinymce/plugins/autosave/langs/en.js b/wp-includes/js/tinymce/plugins/autosave/langs/en.js new file mode 100644 index 0000000..0195133 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/autosave/langs/en.js @@ -0,0 +1,5 @@ +// EN lang variables
+
+tinyMCE.addToLang('',{
+autosave_unload_msg : 'The changes you made will be lost if you navigate away from this page.'
+});
diff --git a/wp-includes/js/tinymce/plugins/autosave/langs/sv.js b/wp-includes/js/tinymce/plugins/autosave/langs/sv.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/autosave/langs/sv.js diff --git a/wp-includes/js/tinymce/plugins/autosave/readme.txt b/wp-includes/js/tinymce/plugins/autosave/readme.txt new file mode 100644 index 0000000..4fdb78a --- /dev/null +++ b/wp-includes/js/tinymce/plugins/autosave/readme.txt @@ -0,0 +1 @@ +Check the TinyMCE documentation for details on this plugin.
diff --git a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js new file mode 100644 index 0000000..c866b53 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js @@ -0,0 +1,83 @@ +/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('directionality', 'en,sv,fr_ca,zh_cn,cs,da,he,no,de,hu,ru,ru_KOI8-R,ru_UTF-8,es,cy,is,pl');
+
+function TinyMCE_directionality_getInfo() {
+ return {
+ longname : 'Directionality',
+ author : 'Moxiecode Systems',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+};
+
+function TinyMCE_directionality_getControlHTML(control_name) {
+ switch (control_name) {
+ case "ltr":
+ var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionLTR\');return false;';
+ return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}_ltr" src="{$pluginurl}/images/ltr.gif" title="{$lang_directionality_ltr_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>'
+ + '<div class="zerosize"><input type="button" accesskey="." onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionLTR\',false);" /></div>';
+
+ case "rtl":
+ var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionRTL\');return false;';
+ return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}_rtl" src="{$pluginurl}/images/rtl.gif" title="{$lang_directionality_rtl_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>'
+ + '<div class="zerosize"><input type="button" accesskey="," onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionRTL\',false);" /></div>';
+ }
+
+ return "";
+}
+
+function TinyMCE_directionality_execCommand(editor_id, element, command, user_interface, value) {
+ // Handle commands
+ switch (command) {
+ case "mceDirectionLTR":
+ var inst = tinyMCE.getInstanceById(editor_id);
+ var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
+
+ if (elm)
+ elm.setAttribute("dir", "ltr");
+
+ tinyMCE.triggerNodeChange(false);
+ return true;
+
+ case "mceDirectionRTL":
+ var inst = tinyMCE.getInstanceById(editor_id);
+ var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
+
+ if (elm)
+ elm.setAttribute("dir", "rtl");
+
+ tinyMCE.triggerNodeChange(false);
+ return true;
+ }
+
+ // Pass to next handler in chain
+ return false;
+}
+
+function TinyMCE_directionality_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
+ function getAttrib(elm, name) {
+ return elm.getAttribute(name) ? elm.getAttribute(name) : "";
+ }
+
+ tinyMCE.switchClassSticky(editor_id + '_ltr', 'mceButtonNormal', false);
+ tinyMCE.switchClassSticky(editor_id + '_rtl', 'mceButtonNormal', false);
+
+ if (node == null)
+ return;
+
+ var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
+ if (!elm) {
+ tinyMCE.switchClassSticky(editor_id + '_ltr', 'mceButtonDisabled', true);
+ tinyMCE.switchClassSticky(editor_id + '_rtl', 'mceButtonDisabled', true);
+ return;
+ }
+
+ var dir = getAttrib(elm, "dir");
+ if (dir == "ltr" || dir == "")
+ tinyMCE.switchClassSticky(editor_id + '_ltr', 'mceButtonSelected', false);
+ else
+ tinyMCE.switchClassSticky(editor_id + '_rtl', 'mceButtonSelected', false);
+
+ return true;
+}
diff --git a/wp-includes/js/tinymce/plugins/directionality/images/ltr.gif b/wp-includes/js/tinymce/plugins/directionality/images/ltr.gif Binary files differnew file mode 100644 index 0000000..ac8f30c --- /dev/null +++ b/wp-includes/js/tinymce/plugins/directionality/images/ltr.gif diff --git a/wp-includes/js/tinymce/plugins/directionality/images/rtl.gif b/wp-includes/js/tinymce/plugins/directionality/images/rtl.gif Binary files differnew file mode 100644 index 0000000..0348f99 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/directionality/images/rtl.gif diff --git a/wp-includes/js/tinymce/plugins/directionality/langs/en.js b/wp-includes/js/tinymce/plugins/directionality/langs/en.js new file mode 100644 index 0000000..5b392fe --- /dev/null +++ b/wp-includes/js/tinymce/plugins/directionality/langs/en.js @@ -0,0 +1,6 @@ +// UK lang variables
+
+tinyMCE.addToLang('',{
+directionality_ltr_desc : 'Direction left to right (Alt-.)',
+directionality_rtl_desc : 'Direction right to left (Alt-,)'
+});
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css b/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css new file mode 100644 index 0000000..43be823 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/css/inlinepopup.css @@ -0,0 +1,69 @@ +/* Window classes */
+
+.mceWindow {
+ position: absolute;
+ left: 0;
+ top: 0;
+ border: 1px solid black;
+ background-color: #D4D0C8;
+}
+
+.mceWindowHead {
+ background-color: #334F8D;
+ width: 100%;
+ height: 18px;
+ cursor: move;
+ overflow: hidden;
+}
+
+.mceWindowBody {
+ clear: both;
+ background-color: white;
+}
+
+.mceWindowStatusbar {
+ background-color: #D4D0C8;
+ height: 12px;
+ border-top: 1px solid black;
+}
+
+.mceWindowTitle {
+ float: left;
+ font-family: "MS Sans Serif";
+ font-size: 9pt;
+ font-weight: bold;
+ line-height: 18px;
+ color: white;
+ margin-left: 2px;
+ overflow: hidden;
+}
+
+.mceWindowHeadTools {
+ margin-right: 2px;
+}
+
+.mceWindowClose, .mceWindowMinimize, .mceWindowMaximize {
+ display: block;
+ float: right;
+ overflow: hidden;
+ margin-top: 2px;
+}
+
+.mceWindowClose {
+ margin-left: 2px;
+}
+
+.mceWindowMinimize {
+}
+
+.mceWindowMaximize {
+}
+
+.mceWindowResize {
+ display: block;
+ float: right;
+ overflow: hidden;
+ cursor: se-resize;
+ width: 12px;
+ height: 12px;
+}
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js new file mode 100644 index 0000000..74d1805 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js @@ -0,0 +1,665 @@ +/**
+ * $RCSfile: editor_plugin_src.js,v $
+ * $Revision: 1.8 $
+ * $Date: 2006/02/06 20:02:38 $
+ *
+ * Moxiecode DHTML Windows script.
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+// Patch openWindow, closeWindow TinyMCE functions
+
+var TinyMCE_InlinePopupsPlugin = {
+ getInfo : function() {
+ return {
+ longname : 'Inline Popups',
+ author : 'Moxiecode Systems',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+ }
+};
+
+tinyMCE.addPlugin("inlinepopups", TinyMCE_InlinePopupsPlugin);
+
+// Patch openWindow, closeWindow TinyMCE functions
+
+TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow;
+
+TinyMCE_Engine.prototype.openWindow = function(template, args) {
+ // Does the caller support inline
+ if (args['inline'] != "yes" || tinyMCE.isOpera || tinyMCE.getParam("plugins").indexOf('inlinepopups') == -1) {
+ mcWindows.selectedWindow = null;
+ args['mce_inside_iframe'] = false;
+ this.orgOpenWindow(template, args);
+ return;
+ }
+
+ var url, resizable, scrollbars;
+
+ args['mce_inside_iframe'] = true;
+ tinyMCE.windowArgs = args;
+
+ if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)
+ url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file'];
+ else
+ url = template['file'];
+
+ if (!(width = parseInt(template['width'])))
+ width = 320;
+
+ if (!(height = parseInt(template['height'])))
+ height = 200;
+
+ resizable = (args && args['resizable']) ? args['resizable'] : "no";
+ scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no";
+
+ height += 18;
+
+ // Replace all args as variables in URL
+ for (var name in args) {
+ if (typeof(args[name]) == 'function')
+ continue;
+
+ url = tinyMCE.replaceVar(url, name, escape(args[name]));
+ }
+
+ var elm = document.getElementById(this.selectedInstance.editorId + '_parent');
+ var pos = tinyMCE.getAbsPosition(elm);
+
+ // Center div in editor area
+ pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2));
+ pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2));
+
+ url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : '';
+
+ mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop);
+};
+
+TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow;
+
+TinyMCE_Engine.prototype.closeWindow = function(win) {
+ if (mcWindows.selectedWindow != null)
+ mcWindows.selectedWindow.close();
+ else
+ this.orgCloseWindow(win);
+};
+
+TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) {
+ for (var n in mcWindows.windows) {
+ var win = mcWindows.windows[n];
+ if (typeof(win) == 'function')
+ continue;
+
+ if (win_ref.name == win.id + "_iframe")
+ window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title;
+ }
+};
+
+// * * * * * TinyMCE_Windows classes below
+
+// Windows handler
+function TinyMCE_Windows() {
+ this.settings = new Array();
+ this.windows = new Array();
+ this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
+ this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
+ this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
+ this.isMac = navigator.userAgent.indexOf('Mac') != -1;
+ this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
+ this.action = "none";
+ this.selectedWindow = null;
+ this.lastSelectedWindow = null;
+ this.zindex = 100;
+ this.mouseDownScreenX = 0;
+ this.mouseDownScreenY = 0;
+ this.mouseDownLayerX = 0;
+ this.mouseDownLayerY = 0;
+ this.mouseDownWidth = 0;
+ this.mouseDownHeight = 0;
+ this.idCounter = 0;
+};
+
+TinyMCE_Windows.prototype.init = function(settings) {
+ this.settings = settings;
+
+ if (this.isMSIE)
+ this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
+ else
+ this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
+
+ this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
+
+ this.doc = document;
+};
+
+TinyMCE_Windows.prototype.getParam = function(name, default_value) {
+ var value = null;
+
+ value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
+
+ // Fix bool values
+ if (value == "true" || value == "false")
+ return (value == "true");
+
+ return value;
+};
+
+TinyMCE_Windows.prototype.eventDispatcher = function(e) {
+ e = typeof(e) == "undefined" ? window.event : e;
+
+ if (mcWindows.selectedWindow == null)
+ return;
+
+ // Switch focus
+ if (mcWindows.isGecko && e.type == "mousedown") {
+ var elm = e.currentTarget;
+
+ for (var n in mcWindows.windows) {
+ var win = mcWindows.windows[n];
+
+ if (win.headElement == elm || win.resizeElement == elm) {
+ win.focus();
+ break;
+ }
+ }
+ }
+
+ switch (e.type) {
+ case "mousemove":
+ mcWindows.selectedWindow.onMouseMove(e);
+ break;
+
+ case "mouseup":
+ mcWindows.selectedWindow.onMouseUp(e);
+ break;
+
+ case "mousedown":
+ mcWindows.selectedWindow.onMouseDown(e);
+ break;
+
+ case "focus":
+ mcWindows.selectedWindow.onFocus(e);
+ break;
+ }
+};
+
+TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) {
+ if (this.isMSIE)
+ obj.attachEvent("on" + name, handler);
+ else
+ obj.addEventListener(name, handler, true);
+};
+
+TinyMCE_Windows.prototype.cancelEvent = function(e) {
+ if (this.isMSIE) {
+ e.returnValue = false;
+ e.cancelBubble = true;
+ } else
+ e.preventDefault();
+};
+
+TinyMCE_Windows.prototype.parseFeatures = function(opts) {
+ // Cleanup the options
+ opts = opts.toLowerCase();
+ opts = opts.replace(/;/g, ",");
+ opts = opts.replace(/[^0-9a-z=,]/g, "");
+
+ var optionChunks = opts.split(',');
+ var options = new Array();
+
+ options['left'] = "10";
+ options['top'] = "10";
+ options['width'] = "300";
+ options['height'] = "300";
+ options['resizable'] = "yes";
+ options['minimizable'] = "yes";
+ options['maximizable'] = "yes";
+ options['close'] = "yes";
+ options['movable'] = "yes";
+ options['statusbar'] = "yes";
+ options['scrollbars'] = "auto";
+ options['modal'] = "no";
+
+ if (opts == "")
+ return options;
+
+ for (var i=0; i<optionChunks.length; i++) {
+ var parts = optionChunks[i].split('=');
+
+ if (parts.length == 2)
+ options[parts[0]] = parts[1];
+ }
+
+ options['left'] = parseInt(options['left']);
+ options['top'] = parseInt(options['top']);
+ options['width'] = parseInt(options['width']);
+ options['height'] = parseInt(options['height']);
+
+ return options;
+};
+
+TinyMCE_Windows.prototype.open = function(url, name, features) {
+ this.lastSelectedWindow = this.selectedWindow;
+
+ var win = new TinyMCE_Window();
+ var winDiv, html = "", id;
+ var imgPath = this.getParam("images_path");
+
+ features = this.parseFeatures(features);
+
+ // Create div
+ id = "mcWindow_" + name;
+ win.deltaHeight = 18;
+
+ if (features['statusbar'] == "yes") {
+ win.deltaHeight += 13;
+
+ if (this.isMSIE)
+ win.deltaHeight += 1;
+ }
+
+ width = parseInt(features['width']);
+ height = parseInt(features['height'])-win.deltaHeight;
+
+ if (this.isMSIE)
+ width -= 2;
+
+ // Setup first part of window
+ win.id = id;
+ win.url = url;
+ win.name = name;
+ win.features = features;
+ this.windows[name] = win;
+
+ iframeWidth = width;
+ iframeHeight = height;
+
+ // Create inner content
+ html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
+ html += '<html>';
+ html += '<head>';
+ html += '<title>Wrapper iframe</title>';
+ html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
+ html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />';
+ if ( this.isMac ) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>';
+ html += '</head>';
+ html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
+
+ html += '<div id="' + id + '_container" class="mceWindow">';
+ html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
+ html += ' <div id="' + id + '_title" class="mceWindowTitle"';
+ html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';
+ html += ' <div class="mceWindowHeadTools">';
+ html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>';
+// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"></a>';
+// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
+ html += ' </div>';
+ html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
+ html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe" scrolling="' + features['scrollbars'] + '"></iframe></div>';
+
+ if (features['statusbar'] == "yes") {
+ html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
+
+ if (features['resizable'] == "yes") {
+ if (this.isGecko)
+ html += '<div id="' + id + '_resize" class="mceWindowResize"><div style="background-image: url(\'' + imgPath + '/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';
+ else
+ html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="' + imgPath + '/window_resize.gif" /></div>';
+ }
+
+ html += '</div>';
+ }
+
+ html += '</div>';
+
+ html += '</body>';
+ html += '</html>';
+
+ // Create iframe
+ this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
+};
+
+// Blocks the document events by placing a image over the whole document
+TinyMCE_Windows.prototype.setDocumentLock = function(state) {
+ if (state) {
+ var elm = document.getElementById('mcWindowEventBlocker');
+ if (elm == null) {
+ elm = document.createElement("div");
+
+ elm.id = "mcWindowEventBlocker";
+ elm.style.position = "absolute";
+ elm.style.left = "0";
+ elm.style.top = "0";
+
+ document.body.appendChild(elm);
+ }
+
+ elm.style.display = "none";
+
+ var imgPath = this.getParam("images_path");
+ var width = document.body.clientWidth;
+ var height = document.body.clientHeight;
+
+ elm.style.width = width;
+ elm.style.height = height;
+ elm.innerHTML = '<img src="' + imgPath + '/spacer.gif" width="' + width + '" height="' + height + '" />';
+
+ elm.style.zIndex = mcWindows.zindex-1;
+ elm.style.display = "block";
+ } else {
+ var elm = document.getElementById('mcWindowEventBlocker');
+
+ if (mcWindows.windows.length == 0)
+ elm.parentNode.removeChild(elm);
+ else
+ elm.style.zIndex = mcWindows.zindex-1;
+ }
+};
+
+// Gets called when wrapper iframe is initialized
+TinyMCE_Windows.prototype.onLoad = function(name) {
+ var win = mcWindows.windows[name];
+ var id = "mcWindow_" + name;
+ var wrapperIframe = window.frames[id + "_iframe"].frames[0];
+ var wrapperDoc = window.frames[id + "_iframe"].document;
+ var doc = window.frames[id + "_iframe"].document;
+ var winDiv = document.getElementById("mcWindow_" + name + "_div");
+ var realIframe = window.frames[id + "_iframe"].frames[0];
+
+ // Set window data
+ win.id = "mcWindow_" + name;
+ win.winElement = winDiv;
+ win.bodyElement = doc.getElementById(id + '_body');
+ win.iframeElement = doc.getElementById(id + '_iframe');
+ win.headElement = doc.getElementById(id + '_head');
+ win.titleElement = doc.getElementById(id + '_title');
+ win.resizeElement = doc.getElementById(id + '_resize');
+ win.containerElement = doc.getElementById(id + '_container');
+ win.left = win.features['left'];
+ win.top = win.features['top'];
+ win.frame = window.frames[id + '_iframe'].frames[0];
+ win.wrapperFrame = window.frames[id + '_iframe'];
+ win.wrapperIFrameElement = document.getElementById(id + "_iframe");
+
+ // Add event handlers
+ mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
+
+ if (win.resizeElement != null)
+ mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
+
+ if (mcWindows.isMSIE) {
+ mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
+ } else {
+ mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
+ mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
+ }
+
+ for (var i=0; i<window.frames.length; i++) {
+ if (!window.frames[i]._hasMouseHandlers) {
+ if (mcWindows.isMSIE) {
+ mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
+ } else {
+ mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
+ }
+
+ window.frames[i]._hasMouseHandlers = true;
+ }
+ }
+
+ if (mcWindows.isMSIE) {
+ mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
+ } else {
+ mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
+ mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
+ }
+
+ // Dispatch open window event
+ var func = this.getParam("on_open_window", "");
+ if (func != "")
+ eval(func + "(win);");
+
+ win.focus();
+
+ if (win.features['modal'] == "yes")
+ mcWindows.setDocumentLock(true);
+};
+
+TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
+ var iframe = document.createElement("iframe");
+ var div = document.createElement("div");
+
+ width = parseInt(width);
+ height = parseInt(height)+1;
+
+ // Create wrapper div
+ div.setAttribute("id", id_prefix + "_div");
+ div.setAttribute("width", width);
+ div.setAttribute("height", (height));
+ div.style.position = "absolute";
+ div.style.left = left + "px";
+ div.style.top = top + "px";
+ div.style.width = width + "px";
+ div.style.height = (height) + "px";
+ div.style.backgroundColor = "white";
+ div.style.display = "none";
+
+ if (this.isGecko) {
+ iframeWidth = width + 2;
+ iframeHeight = height + 2;
+ } else {
+ iframeWidth = width;
+ iframeHeight = height + 1;
+ }
+
+ // Create iframe
+ iframe.setAttribute("id", id_prefix + "_iframe");
+ iframe.setAttribute("name", id_prefix + "_iframe");
+ iframe.setAttribute("border", "0");
+ iframe.setAttribute("frameBorder", "0");
+ iframe.setAttribute("marginWidth", "0");
+ iframe.setAttribute("marginHeight", "0");
+ iframe.setAttribute("leftMargin", "0");
+ iframe.setAttribute("topMargin", "0");
+ iframe.setAttribute("width", iframeWidth);
+ iframe.setAttribute("height", iframeHeight);
+// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
+ // iframe.setAttribute("allowtransparency", "false");
+ iframe.setAttribute("scrolling", "no");
+ iframe.style.width = iframeWidth + "px";
+ iframe.style.height = iframeHeight + "px";
+ iframe.style.backgroundColor = "white";
+ div.appendChild(iframe);
+
+ document.body.appendChild(div);
+
+ // Fixed MSIE 5.0 issue
+ div.innerHTML = div.innerHTML;
+
+ if (this.isSafari) {
+ // Give Safari some time to setup
+ window.setTimeout(function() {
+ doc = window.frames[id_prefix + '_iframe'].document;
+ doc.open();
+ doc.write(html);
+ doc.close();
+ }, 10);
+ } else {
+ doc = window.frames[id_prefix + '_iframe'].window.document;
+ doc.open();
+ doc.write(html);
+ doc.close();
+ }
+
+ div.style.display = "block";
+
+ return div;
+};
+
+// Window instance
+function TinyMCE_Window() {
+};
+
+TinyMCE_Window.prototype.focus = function() {
+ if (this != mcWindows.selectedWindow) {
+ this.winElement.style.zIndex = ++mcWindows.zindex;
+ mcWindows.lastSelectedWindow = mcWindows.selectedWindow;
+ mcWindows.selectedWindow = this;
+ }
+};
+
+TinyMCE_Window.prototype.minimize = function() {
+};
+
+TinyMCE_Window.prototype.maximize = function() {
+
+};
+
+TinyMCE_Window.prototype.startResize = function() {
+ mcWindows.action = "resize";
+};
+
+TinyMCE_Window.prototype.startMove = function(e) {
+ mcWindows.action = "move";
+};
+
+TinyMCE_Window.prototype.close = function() {
+ if (this.frame && this.frame['tinyMCEPopup'])
+ this.frame['tinyMCEPopup'].restoreSelection();
+
+ if (mcWindows.lastSelectedWindow != null)
+ mcWindows.lastSelectedWindow.focus();
+
+ var mcWindowsNew = new Array();
+ for (var n in mcWindows.windows) {
+ var win = mcWindows.windows[n];
+ if (typeof(win) == 'function')
+ continue;
+
+ if (win.name != this.name)
+ mcWindowsNew[n] = win;
+ }
+
+ mcWindows.windows = mcWindowsNew;
+
+// alert(mcWindows.doc.getElementById(this.id + "_iframe"));
+
+ var e = mcWindows.doc.getElementById(this.id + "_iframe");
+ e.parentNode.removeChild(e);
+
+ var e = mcWindows.doc.getElementById(this.id + "_div");
+ e.parentNode.removeChild(e);
+
+ mcWindows.setDocumentLock(false);
+};
+
+TinyMCE_Window.prototype.onMouseMove = function(e) {
+ var scrollX = 0;//this.doc.body.scrollLeft;
+ var scrollY = 0;//this.doc.body.scrollTop;
+
+ // Calculate real X, Y
+ var dx = e.screenX - mcWindows.mouseDownScreenX;
+ var dy = e.screenY - mcWindows.mouseDownScreenY;
+
+ switch (mcWindows.action) {
+ case "resize":
+ width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
+ height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
+
+ width = width < 100 ? 100 : width;
+ height = height < 100 ? 100 : height;
+
+ this.wrapperIFrameElement.style.width = width+2;
+ this.wrapperIFrameElement.style.height = height+2;
+ this.wrapperIFrameElement.width = width+2;
+ this.wrapperIFrameElement.height = height+2;
+ this.winElement.style.width = width;
+ this.winElement.style.height = height;
+
+ height = height - this.deltaHeight;
+
+ this.containerElement.style.width = width;
+
+ this.iframeElement.style.width = width;
+ this.iframeElement.style.height = height;
+ this.bodyElement.style.width = width;
+ this.bodyElement.style.height = height;
+ this.headElement.style.width = width;
+ //this.statusElement.style.width = width;
+
+ mcWindows.cancelEvent(e);
+ break;
+
+ case "move":
+ this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
+ this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
+ this.winElement.style.left = this.left + "px";
+ this.winElement.style.top = this.top + "px";
+
+ mcWindows.cancelEvent(e);
+ break;
+ }
+};
+
+function debug(msg) {
+ document.getElementById('debug').value += msg + "\n";
+}
+
+TinyMCE_Window.prototype.onMouseUp = function(e) {
+ mcWindows.action = "none";
+};
+
+TinyMCE_Window.prototype.onFocus = function(e) {
+ // Gecko only handler
+ var winRef = e.currentTarget;
+
+ for (var n in mcWindows.windows) {
+ var win = mcWindows.windows[n];
+ if (typeof(win) == 'function')
+ continue;
+
+ if (winRef.name == win.id + "_iframe") {
+ win.focus();
+ return;
+ }
+ }
+};
+
+TinyMCE_Window.prototype.onMouseDown = function(e) {
+ var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
+
+ var scrollX = 0;//this.doc.body.scrollLeft;
+ var scrollY = 0;//this.doc.body.scrollTop;
+
+ mcWindows.mouseDownScreenX = e.screenX;
+ mcWindows.mouseDownScreenY = e.screenY;
+ mcWindows.mouseDownLayerX = this.left;
+ mcWindows.mouseDownLayerY = this.top;
+ mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
+ mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
+
+ if (this.resizeElement != null && elm == this.resizeElement.firstChild)
+ this.startResize(e);
+ else
+ this.startMove(e);
+
+ mcWindows.cancelEvent(e);
+};
+
+// Global instance
+var mcWindows = new TinyMCE_Windows();
+
+// Initialize windows
+mcWindows.init({
+ images_path : tinyMCE.baseURL + "/plugins/inlinepopups/images",
+ css_file : tinyMCE.baseURL + "/plugins/inlinepopups/css/inlinepopup.css"
+});
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/spacer.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/spacer.gif Binary files differnew file mode 100644 index 0000000..fc25609 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/images/spacer.gif diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_close.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_close.gif Binary files differnew file mode 100644 index 0000000..3469e5a --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_close.gif diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_maximize.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_maximize.gif Binary files differnew file mode 100644 index 0000000..fcae73e --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_maximize.gif diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_minimize.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_minimize.gif Binary files differnew file mode 100644 index 0000000..94f167a --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_minimize.gif diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/images/window_resize.gif b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_resize.gif Binary files differnew file mode 100644 index 0000000..6c402d0 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/images/window_resize.gif diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js b/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js new file mode 100644 index 0000000..a88ffd7 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js @@ -0,0 +1,455 @@ +/**
+ * $RCSfile: mcwindows.js,v $
+ * $Revision: 1.2 $
+ * $Date: 2005/10/18 13:59:43 $
+ *
+ * Moxiecode DHTML Windows script.
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
+ */
+
+// Windows handler
+function MCWindows() {
+ this.settings = new Array();
+ this.windows = new Array();
+ this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
+ this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
+ this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
+ this.isMac = navigator.userAgent.indexOf('Mac') != -1;
+ this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
+ this.action = "none";
+ this.selectedWindow = null;
+ this.zindex = 100;
+ this.mouseDownScreenX = 0;
+ this.mouseDownScreenY = 0;
+ this.mouseDownLayerX = 0;
+ this.mouseDownLayerY = 0;
+ this.mouseDownWidth = 0;
+ this.mouseDownHeight = 0;
+};
+
+MCWindows.prototype.init = function(settings) {
+ this.settings = settings;
+
+ if (this.isMSIE)
+ this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
+ else
+ this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
+
+ this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
+};
+
+MCWindows.prototype.getParam = function(name, default_value) {
+ var value = null;
+
+ value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
+
+ // Fix bool values
+ if (value == "true" || value == "false")
+ return (value == "true");
+
+ return value;
+};
+
+MCWindows.prototype.eventDispatcher = function(e) {
+ e = typeof(e) == "undefined" ? window.event : e;
+
+ if (mcWindows.selectedWindow == null)
+ return;
+
+ // Switch focus
+ if (mcWindows.isGecko && e.type == "mousedown") {
+ var elm = e.currentTarget;
+
+ for (var n in mcWindows.windows) {
+ var win = mcWindows.windows[n];
+ if (typeof(win) == 'function')
+ continue;
+
+ if (win.headElement == elm || win.resizeElement == elm) {
+ win.focus();
+ break;
+ }
+ }
+ }
+
+ switch (e.type) {
+ case "mousemove":
+ mcWindows.selectedWindow.onMouseMove(e);
+ break;
+
+ case "mouseup":
+ mcWindows.selectedWindow.onMouseUp(e);
+ break;
+
+ case "mousedown":
+ mcWindows.selectedWindow.onMouseDown(e);
+ break;
+
+ case "focus":
+ mcWindows.selectedWindow.onFocus(e);
+ break;
+ }
+}
+
+MCWindows.prototype.addEvent = function(obj, name, handler) {
+ if (this.isMSIE)
+ obj.attachEvent("on" + name, handler);
+ else
+ obj.addEventListener(name, handler, true);
+};
+
+MCWindows.prototype.cancelEvent = function(e) {
+ if (this.isMSIE) {
+ e.returnValue = false;
+ e.cancelBubble = true;
+ } else
+ e.preventDefault();
+};
+
+MCWindows.prototype.parseFeatures = function(opts) {
+ // Cleanup the options
+ opts = opts.toLowerCase();
+ opts = opts.replace(/;/g, ",");
+ opts = opts.replace(/[^0-9a-z=,]/g, "");
+
+ var optionChunks = opts.split(',');
+ var options = new Array();
+
+ options['left'] = 10;
+ options['top'] = 10;
+ options['width'] = 300;
+ options['height'] = 300;
+ options['resizable'] = true;
+ options['minimizable'] = true;
+ options['maximizable'] = true;
+ options['close'] = true;
+ options['movable'] = true;
+
+ if (opts == "")
+ return options;
+
+ for (var i=0; i<optionChunks.length; i++) {
+ var parts = optionChunks[i].split('=');
+
+ if (parts.length == 2)
+ options[parts[0]] = parts[1];
+ }
+
+ return options;
+};
+
+MCWindows.prototype.open = function(url, name, features) {
+ var win = new MCWindow();
+ var winDiv, html = "", id;
+
+ features = this.parseFeatures(features);
+
+ // Create div
+ id = "mcWindow_" + name;
+
+ width = parseInt(features['width']);
+ height = parseInt(features['height'])-12-19;
+
+ if (this.isMSIE)
+ width -= 2;
+
+ // Setup first part of window
+ win.id = id;
+ win.url = url;
+ win.name = name;
+ win.features = features;
+ this.windows[name] = win;
+
+ iframeWidth = width;
+ iframeHeight = height;
+
+ // Create inner content
+ html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
+ html += '<html>';
+ html += '<head>';
+ html += '<title>Wrapper iframe</title>';
+ html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
+ html += '<link href="../jscripts/tiny_mce/themes/advanced/css/editor_ui.css" rel="stylesheet" type="text/css" />';
+ html += '</head>';
+ html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
+
+ html += '<div id="' + id + '_container" class="mceWindow">';
+ html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
+ html += ' <div id="' + id + '_title" class="mceWindowTitle"';
+ html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">No name window</div>';
+ html += ' <div class="mceWindowHeadTools">';
+ html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_close.gif" /></a>';
+// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
+// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
+ html += ' </div>';
+ html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
+ html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" onfocus="parent.mcWindows.windows[\'' + name + '\'].focus();" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe"></iframe></div>';
+ html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
+ html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_resize.gif" /></div>';
+ html += '</div>';
+ html += '</div>';
+
+ html += '</body>';
+ html += '</html>';
+
+ // Create iframe
+ this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
+};
+
+// Gets called when wrapper iframe is initialized
+MCWindows.prototype.onLoad = function(name) {
+ var win = mcWindows.windows[name];
+ var id = "mcWindow_" + name;
+ var wrapperIframe = window.frames[id + "_iframe"].frames[0];
+ var wrapperDoc = window.frames[id + "_iframe"].document;
+ var doc = window.frames[id + "_iframe"].document;
+ var winDiv = document.getElementById("mcWindow_" + name + "_div");
+ var realIframe = window.frames[id + "_iframe"].frames[0];
+
+ // Set window data
+ win.id = "mcWindow_" + name + "_iframe";
+ win.winElement = winDiv;
+ win.bodyElement = doc.getElementById(id + '_body');
+ win.iframeElement = doc.getElementById(id + '_iframe');
+ win.headElement = doc.getElementById(id + '_head');
+ win.titleElement = doc.getElementById(id + '_title');
+ win.resizeElement = doc.getElementById(id + '_resize');
+ win.containerElement = doc.getElementById(id + '_container');
+ win.left = win.features['left'];
+ win.top = win.features['top'];
+ win.frame = window.frames[id + '_iframe'].frames[0];
+ win.wrapperFrame = window.frames[id + '_iframe'];
+ win.wrapperIFrameElement = document.getElementById(id + "_iframe");
+
+ // Add event handlers
+ mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
+ mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
+
+ if (mcWindows.isMSIE) {
+ mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
+ } else {
+ mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
+ mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
+ }
+
+ for (var i=0; i<window.frames.length; i++) {
+ if (!window.frames[i]._hasMouseHandlers) {
+ if (mcWindows.isMSIE) {
+ mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
+ } else {
+ mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
+ }
+
+ window.frames[i]._hasMouseHandlers = true;
+ }
+ }
+
+ if (mcWindows.isMSIE) {
+ mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
+ } else {
+ mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
+ mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
+ mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
+ }
+
+ this.selectedWindow = win;
+};
+
+MCWindows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
+ var iframe = document.createElement("iframe");
+ var div = document.createElement("div");
+
+ width = parseInt(width);
+ height = parseInt(height)+1;
+
+ // Create wrapper div
+ div.setAttribute("id", id_prefix + "_div");
+ div.setAttribute("width", width);
+ div.setAttribute("height", (height));
+ div.style.position = "absolute";
+ div.style.left = left + "px";
+ div.style.top = top + "px";
+ div.style.width = width + "px";
+ div.style.height = (height) + "px";
+ div.style.backgroundColor = "white";
+ div.style.display = "none";
+
+ if (this.isGecko) {
+ iframeWidth = width + 2;
+ iframeHeight = height + 2;
+ } else {
+ iframeWidth = width;
+ iframeHeight = height + 1;
+ }
+
+ // Create iframe
+ iframe.setAttribute("id", id_prefix + "_iframe");
+ iframe.setAttribute("name", id_prefix + "_iframe");
+ iframe.setAttribute("border", "0");
+ iframe.setAttribute("frameBorder", "0");
+ iframe.setAttribute("marginWidth", "0");
+ iframe.setAttribute("marginHeight", "0");
+ iframe.setAttribute("leftMargin", "0");
+ iframe.setAttribute("topMargin", "0");
+ iframe.setAttribute("width", iframeWidth);
+ iframe.setAttribute("height", iframeHeight);
+// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
+ // iframe.setAttribute("allowtransparency", "false");
+ iframe.setAttribute("scrolling", "no");
+ iframe.style.width = iframeWidth + "px";
+ iframe.style.height = iframeHeight + "px";
+ iframe.style.backgroundColor = "white";
+ div.appendChild(iframe);
+
+ document.body.appendChild(div);
+
+ // Fixed MSIE 5.0 issue
+ div.innerHTML = div.innerHTML;
+
+ if (this.isSafari) {
+ // Give Safari some time to setup
+ window.setTimeout(function() {
+ doc = window.frames[id_prefix + '_iframe'].document;
+ doc.open();
+ doc.write(html);
+ doc.close();
+ }, 10);
+ } else {
+ doc = window.frames[id_prefix + '_iframe'].window.document
+ doc.open();
+ doc.write(html);
+ doc.close();
+ }
+
+ div.style.display = "block";
+
+ return div;
+};
+
+// Window instance
+function MCWindow() {
+};
+
+MCWindow.prototype.focus = function() {
+ this.winElement.style.zIndex = mcWindows.zindex++;
+ mcWindows.selectedWindow = this;
+};
+
+MCWindow.prototype.minimize = function() {
+};
+
+MCWindow.prototype.maximize = function() {
+
+};
+
+MCWindow.prototype.startResize = function() {
+ mcWindows.action = "resize";
+};
+
+MCWindow.prototype.startMove = function(e) {
+ mcWindows.action = "move";
+};
+
+MCWindow.prototype.close = function() {
+ document.body.removeChild(this.winElement);
+ mcWindows.windows[this.name] = null;
+};
+
+MCWindow.prototype.onMouseMove = function(e) {
+ var scrollX = 0;//this.doc.body.scrollLeft;
+ var scrollY = 0;//this.doc.body.scrollTop;
+
+ // Calculate real X, Y
+ var dx = e.screenX - mcWindows.mouseDownScreenX;
+ var dy = e.screenY - mcWindows.mouseDownScreenY;
+
+ switch (mcWindows.action) {
+ case "resize":
+ width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
+ height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
+
+ width = width < 100 ? 100 : width;
+ height = height < 100 ? 100 : height;
+
+ this.wrapperIFrameElement.style.width = width+2;
+ this.wrapperIFrameElement.style.height = height+2;
+ this.wrapperIFrameElement.width = width+2;
+ this.wrapperIFrameElement.height = height+2;
+ this.winElement.style.width = width;
+ this.winElement.style.height = height;
+
+ height = height-12-19;
+
+ this.containerElement.style.width = width;
+
+ this.iframeElement.style.width = width;
+ this.iframeElement.style.height = height;
+ this.bodyElement.style.width = width;
+ this.bodyElement.style.height = height;
+ this.headElement.style.width = width;
+ //this.statusElement.style.width = width;
+
+ mcWindows.cancelEvent(e);
+ break;
+
+ case "move":
+ this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
+ this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
+ this.winElement.style.left = this.left + "px";
+ this.winElement.style.top = this.top + "px";
+
+ mcWindows.cancelEvent(e);
+ break;
+ }
+};
+
+MCWindow.prototype.onMouseUp = function(e) {
+ mcWindows.action = "none";
+};
+
+MCWindow.prototype.onFocus = function(e) {
+ // Gecko only handler
+ var winRef = e.currentTarget;
+
+ for (var n in mcWindows.windows) {
+ var win = mcWindows.windows[n];
+ if (typeof(win) == 'function')
+ continue;
+
+ if (winRef.name == win.id) {
+ win.focus();
+ return;
+ }
+ }
+};
+
+MCWindow.prototype.onMouseDown = function(e) {
+ var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
+
+ var scrollX = 0;//this.doc.body.scrollLeft;
+ var scrollY = 0;//this.doc.body.scrollTop;
+
+ mcWindows.mouseDownScreenX = e.screenX;
+ mcWindows.mouseDownScreenY = e.screenY;
+ mcWindows.mouseDownLayerX = this.left;
+ mcWindows.mouseDownLayerY = this.top;
+ mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
+ mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
+
+ if (elm == this.resizeElement.firstChild)
+ this.startResize(e);
+ else
+ this.startMove(e);
+
+ mcWindows.cancelEvent(e);
+};
+
+// Global instance
+var mcWindows = new MCWindows();
diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt b/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/inlinepopups/readme.txt diff --git a/wp-includes/js/tinymce/plugins/paste/blank.htm b/wp-includes/js/tinymce/plugins/paste/blank.htm new file mode 100644 index 0000000..1ddf829 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/blank.htm @@ -0,0 +1,19 @@ +<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>blank_page</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <script language="javascript">
+ function init() {
+ document.body.contentEditable = true;
+ document.designMode = 'on';
+ parent.initIframe(document);
+ window.focus();
+ }
+ </script>
+ <link href="css/blank.css" rel="stylesheet" type="text/css" />
+ <base target="_self" />
+</head>
+<body onload="init();">
+
+</body>
+</html>
diff --git a/wp-includes/js/tinymce/plugins/paste/css/blank.css b/wp-includes/js/tinymce/plugins/paste/css/blank.css new file mode 100644 index 0000000..eca411a --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/css/blank.css @@ -0,0 +1,13 @@ +body {
+ background-color: #FFFFFF;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 10px;
+ scrollbar-3dlight-color: #F0F0EE;
+ scrollbar-arrow-color: #676662;
+ scrollbar-base-color: #F0F0EE;
+ scrollbar-darkshadow-color: #DDDDDD;
+ scrollbar-face-color: #E0E0DD;
+ scrollbar-highlight-color: #F0F0EE;
+ scrollbar-shadow-color: #F0F0EE;
+ scrollbar-track-color: #F5F5F5;
+}
diff --git a/wp-includes/js/tinymce/plugins/paste/css/pasteword.css b/wp-includes/js/tinymce/plugins/paste/css/pasteword.css new file mode 100644 index 0000000..b3be627 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/css/pasteword.css @@ -0,0 +1,3 @@ +.sourceIframe {
+ border: 1px solid #808080;
+}
diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js new file mode 100644 index 0000000..916e29f --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js @@ -0,0 +1,388 @@ +/**
+ * $RCSfile: editor_plugin_src.js,v $
+ * $Revision: 1.36 $
+ * $Date: 2006/03/20 12:03:44 $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('paste', 'en,tr,sv,cs,zh_cn,fr_ca,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,pl,nl,fr,pt_br');
+
+var TinyMCE_PastePlugin = {
+ getInfo : function() {
+ return {
+ longname : 'Paste text/word',
+ author : 'Moxiecode Systems',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+ },
+
+ initInstance : function(inst) {
+ if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false))
+ tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent);
+ },
+
+ getControlHTML : function(cn) {
+ switch (cn) {
+ case "pastetext":
+ return tinyMCE.getButtonHTML(cn, 'lang_paste_text_desc', '{$pluginurl}/images/pastetext.gif', 'mcePasteText', true);
+
+ case "pasteword":
+ return tinyMCE.getButtonHTML(cn, 'lang_paste_word_desc', '{$pluginurl}/images/pasteword.gif', 'mcePasteWord', true);
+
+ case "selectall":
+ return tinyMCE.getButtonHTML(cn, 'lang_selectall_desc', '{$pluginurl}/images/selectall.gif', 'mceSelectAll', true);
+ }
+
+ return '';
+ },
+
+ execCommand : function(editor_id, element, command, user_interface, value) {
+ switch (command) {
+ case "mcePasteText":
+ if (user_interface) {
+ if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false))
+ TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"), true);
+ else {
+ var template = new Array();
+ template['file'] = '../../plugins/paste/pastetext.htm'; // Relative to theme
+ template['width'] = 450;
+ template['height'] = 400;
+ var plain_text = "";
+ tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
+ }
+ } else
+ TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']);
+
+ return true;
+
+ case "mcePasteWord":
+ if (user_interface) {
+ if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) {
+ var html = TinyMCE_PastePlugin._clipboardHTML();
+
+ if (html && html.length > 0)
+ TinyMCE_PastePlugin._insertWordContent(html);
+ } else {
+ var template = new Array();
+ template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme
+ template['width'] = 450;
+ template['height'] = 400;
+ var plain_text = "";
+ tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
+ }
+ } else
+ TinyMCE_PastePlugin._insertWordContent(value);
+
+ return true;
+
+ case "mceSelectAll":
+ tinyMCE.execInstanceCommand(editor_id, 'selectall');
+ return true;
+
+ }
+
+ // Pass to next handler in chain
+ return false;
+ },
+
+ // Private plugin internal methods
+
+ _handlePasteEvent : function(e) {
+ switch (e.type) {
+ case "paste":
+ var html = TinyMCE_PastePlugin._clipboardHTML();
+ var r, inst = tinyMCE.selectedInstance;
+
+ // Removes italic, strong etc, the if was needed due to bug #1437114
+ if (inst && (r = inst.getRng()) && r.text.length > 0)
+ tinyMCE.execCommand('delete');
+
+ if (html && html.length > 0)
+ tinyMCE.execCommand('mcePasteWord', false, html);
+
+ tinyMCE.cancelEvent(e);
+ return false;
+ }
+
+ return true;
+ },
+
+ _insertText : function(content, bLinebreaks) {
+ if (content && content.length > 0) {
+ if (bLinebreaks) {
+ // Special paragraph treatment
+ if (tinyMCE.getParam("paste_create_paragraphs", true)) {
+ var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
+ for (var i=0; i<rl.length; i+=2)
+ content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
+
+ content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi");
+ content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi");
+ content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi");
+
+ // Has paragraphs
+ if ((pos = content.indexOf('</p><p>')) != -1) {
+ tinyMCE.execCommand("Delete");
+
+ var node = tinyMCE.selectedInstance.getFocusElement();
+
+ // Get list of elements to break
+ var breakElms = new Array();
+
+ do {
+ if (node.nodeType == 1) {
+ // Don't break tables and break at body
+ if (node.nodeName == "TD" || node.nodeName == "BODY")
+ break;
+
+ breakElms[breakElms.length] = node;
+ }
+ } while(node = node.parentNode);
+
+ var before = "", after = "</p>";
+ before += content.substring(0, pos);
+
+ for (var i=0; i<breakElms.length; i++) {
+ before += "</" + breakElms[i].nodeName + ">";
+ after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
+ }
+
+ before += "<p>";
+ content = before + content.substring(pos+7) + after;
+ }
+ }
+
+ if (tinyMCE.getParam("paste_create_linebreaks", true)) {
+ content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
+ content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
+ content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
+ }
+ }
+
+ tinyMCE.execCommand("mceInsertRawHTML", false, content);
+ }
+ },
+
+ _insertWordContent : function(content) {
+ if (content && content.length > 0) {
+ // Cleanup Word content
+ var bull = String.fromCharCode(8226);
+ var middot = String.fromCharCode(183);
+ var cb;
+
+ if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
+ content = eval(cb + "('before', content)");
+
+ var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
+ for (var i=0; i<rl.length; i+=2)
+ content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
+
+ if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
+ content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
+ }
+
+ content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
+ content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
+ content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
+ content = content.replace(/<o:p><\/o:p>/gi, "");
+ content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
+ content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
+
+ if (tinyMCE.getParam("paste_remove_spans", true))
+ content = content.replace(/<\/?span[^>]*>/gi, "");
+
+ if (tinyMCE.getParam("paste_remove_styles", true))
+ content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
+
+ content = content.replace(/<\/?font[^>]*>/gi, "");
+
+ // Strips class attributes.
+ switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) {
+ case "all":
+ content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
+ break;
+
+ case "mso":
+ content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
+ break;
+ }
+
+ content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']);
+ content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
+ content = content.replace(/<\\?\?xml[^>]*>/gi, "");
+ content = content.replace(/<\/?\w+:[^>]*>/gi, "");
+ content = content.replace(/-- page break --\s*<p> <\/p>/gi, ""); // Remove pagebreaks
+ content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
+
+ // content = content.replace(/\/? */gi, "");
+ // content = content.replace(/<p> <\/p>/gi, '');
+
+ if (!tinyMCE.settings['force_p_newlines']) {
+ content = content.replace('', '' ,'gi');
+ content = content.replace('</p>', '<br /><br />' ,'gi');
+ }
+
+ if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
+ content = content.replace(/<\/?p[^>]*>/gi, "");
+ }
+
+ content = content.replace(/<\/?div[^>]*>/gi, "");
+
+ // Convert all middlot lists to UL lists
+ if (tinyMCE.getParam("paste_convert_middot_lists", true)) {
+ var div = document.createElement("div");
+ div.innerHTML = content;
+
+ // Convert all middot paragraphs to li elements
+ var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList");
+
+ while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull
+ while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot
+ while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull
+
+ content = div.innerHTML;
+ }
+
+ // Replace all headers with strong and fix some other issues
+ if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
+ content = content.replace(/<h[1-6]> <\/h[1-6]>/gi, '<p> </p>');
+ content = content.replace(/<h[1-6]>/gi, '<p><b>');
+ content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
+ content = content.replace(/<b> <\/b>/gi, '<b> </b>');
+ content = content.replace(/^( )*/gi, '');
+ }
+
+ content = content.replace(/--list--/gi, ""); // Remove --list--
+
+ if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
+ content = eval(cb + "('after', content)");
+
+ // Insert cleaned content
+ tinyMCE.execCommand("mceInsertContent", false, content);
+ window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread
+ }
+ },
+
+ _reEscape : function(s) {
+ var l = "?.\\*[](){}+^$:";
+ var o = "";
+
+ for (var i=0; i<s.length; i++) {
+ var c = s.charAt(i);
+
+ if (l.indexOf(c) != -1)
+ o += '\\' + c;
+ else
+ o += c;
+ }
+
+ return o;
+ },
+
+ _convertMiddots : function(div, search, class_name) {
+ var mdot = String.fromCharCode(183);
+ var bull = String.fromCharCode(8226);
+
+ var nodes = div.getElementsByTagName("p");
+ var prevul;
+ for (var i=0; i<nodes.length; i++) {
+ var p = nodes[i];
+
+ // Is middot
+ if (p.innerHTML.indexOf(search) == 0) {
+ var ul = document.createElement("ul");
+
+ if (class_name)
+ ul.className = class_name;
+
+ // Add the first one
+ var li = document.createElement("li");
+ li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
+ ul.appendChild(li);
+
+ // Add the rest
+ var np = p.nextSibling;
+ while (np) {
+ // If the node is whitespace, then
+ // ignore it and continue on.
+ if (np.nodeType == 3 && /^\s$/m.test(np.nodeValue)) {
+ np = np.nextSibling;
+ continue;
+ }
+
+ if (search == mdot) {
+ if (np.nodeType == 1 && /^o(\s+| )/.test(np.innerHTML)) {
+ // Second level of nesting
+ if (!prevul) {
+ prevul = ul;
+ ul = document.createElement("ul");
+ prevul.appendChild(ul);
+ }
+ np.innerHTML = np.innerHTML.replace(/^o/, '');
+ } else {
+ // Pop the stack if we're going back up to the first level
+ if (prevul) {
+ ul = prevul;
+ prevul = null;
+ }
+ // Not element or middot paragraph
+ if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
+ break;
+ }
+ } else {
+ // Not element or middot paragraph
+ if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
+ break;
+ }
+
+ var cp = np.nextSibling;
+ var li = document.createElement("li");
+ li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
+ np.parentNode.removeChild(np);
+ ul.appendChild(li);
+ np = cp;
+ }
+
+ p.parentNode.replaceChild(ul, p);
+
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ _clipboardHTML : function() {
+ var div = document.getElementById('_TinyMCE_clipboardHTML');
+
+ if (!div) {
+ var div = document.createElement('DIV');
+ div.id = '_TinyMCE_clipboardHTML';
+
+ with (div.style) {
+ visibility = 'hidden';
+ overflow = 'hidden';
+ position = 'absolute';
+ width = 1;
+ height = 1;
+ }
+
+ document.body.appendChild(div);
+ }
+
+ div.innerHTML = '';
+ var rng = document.body.createTextRange();
+ rng.moveToElementText(div);
+ rng.execCommand('Paste');
+ var html = div.innerHTML;
+ div.innerHTML = '';
+ return html;
+ }
+};
+
+tinyMCE.addPlugin("paste", TinyMCE_PastePlugin);
diff --git a/wp-includes/js/tinymce/plugins/paste/images/pastetext.gif b/wp-includes/js/tinymce/plugins/paste/images/pastetext.gif Binary files differnew file mode 100644 index 0000000..e381cc6 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/images/pastetext.gif diff --git a/wp-includes/js/tinymce/plugins/paste/images/pasteword.gif b/wp-includes/js/tinymce/plugins/paste/images/pasteword.gif Binary files differnew file mode 100644 index 0000000..0ccb008 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/images/pasteword.gif diff --git a/wp-includes/js/tinymce/plugins/paste/images/selectall.gif b/wp-includes/js/tinymce/plugins/paste/images/selectall.gif Binary files differnew file mode 100644 index 0000000..c4f9901 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/images/selectall.gif diff --git a/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js b/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js new file mode 100644 index 0000000..927745b --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/jscripts/pastetext.js @@ -0,0 +1,34 @@ +function saveContent() {
+ if (document.forms[0].htmlSource.value == '') {
+ tinyMCEPopup.close();
+ return false;
+ }
+
+ tinyMCEPopup.execCommand('mcePasteText', false, {
+ html : document.forms[0].htmlSource.value,
+ linebreaks : document.forms[0].linebreaks.checked
+ });
+
+ tinyMCEPopup.close();
+}
+
+function onLoadInit() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ resizeInputs();
+}
+
+var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
+
+function resizeInputs() {
+ if (!tinyMCE.isMSIE) {
+ wHeight = self.innerHeight-80;
+ wWidth = self.innerWidth-17;
+ } else {
+ wHeight = document.body.clientHeight-80;
+ wWidth = document.body.clientWidth-17;
+ }
+
+ document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
+ document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
+}
diff --git a/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js b/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js new file mode 100644 index 0000000..c56ea81 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/jscripts/pasteword.js @@ -0,0 +1,46 @@ +function saveContent() {
+ var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
+
+ if (html == ''){
+ tinyMCEPopup.close();
+ return false;
+ }
+
+ tinyMCEPopup.execCommand('mcePasteWord', false, html);
+ tinyMCEPopup.close();
+}
+
+function onLoadInit() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ // Fix for endless reloading in FF
+ window.setTimeout('createIFrame();', 10);
+}
+
+function createIFrame() {
+ document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
+}
+
+var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
+
+function initIframe(doc) {
+ var dir = tinyMCE.selectedInstance.settings['directionality'];
+ doc.body.dir = dir;
+ resizeInputs();
+}
+
+function resizeInputs() {
+ if (!tinyMCE.isMSIE) {
+ wHeight = self.innerHeight - 80;
+ wWidth = self.innerWidth - 18;
+ } else {
+ wHeight = document.body.clientHeight - 80;
+ wWidth = document.body.clientWidth - 18;
+ }
+
+ var elm = document.getElementById('frmData');
+ if (elm) {
+ elm.style.height = Math.abs(wHeight) + 'px';
+ elm.style.width = Math.abs(wWidth) + 'px';
+ }
+}
diff --git a/wp-includes/js/tinymce/plugins/paste/langs/en.js b/wp-includes/js/tinymce/plugins/paste/langs/en.js new file mode 100644 index 0000000..b125d51 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/langs/en.js @@ -0,0 +1,10 @@ +// UK lang variables
+
+tinyMCE.addToLang('',{
+paste_text_desc : 'Paste as Plain Text',
+paste_text_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
+paste_text_linebreaks : 'Keep linebreaks',
+paste_word_desc : 'Paste from Word',
+paste_word_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
+selectall_desc : 'Select All'
+});
diff --git a/wp-includes/js/tinymce/plugins/paste/pastetext.htm b/wp-includes/js/tinymce/plugins/paste/pastetext.htm new file mode 100644 index 0000000..63ff000 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/pastetext.htm @@ -0,0 +1,34 @@ +<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{$lang_paste_text_desc}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script language="javascript" type="text/javascript" src="jscripts/pastetext.js"></script>
+ <base target="_self" />
+</head>
+<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');" onresize="resizeInputs();" style="display: none">
+<form name="source" onsubmit="saveContent();">
+ <div style="float: left" class="title">{$lang_paste_text_desc}</div>
+
+ <div style="float: right">
+ <input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{$lang_paste_text_linebreaks}</label>
+ </div>
+
+ <br style="clear: both" />
+
+ <div>{$lang_paste_text_title}</div>
+
+ <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft"></textarea>
+
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="button" name="insert" value="{$lang_insert}" onclick="saveContent();" id="insert" />
+ </div>
+
+ <div style="float: right">
+ <input type="button" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
+ </div>
+ </div>
+</form>
+</body>
+</html>
\ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/paste/pasteword.htm b/wp-includes/js/tinymce/plugins/paste/pasteword.htm new file mode 100644 index 0000000..7acc7f7 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/paste/pasteword.htm @@ -0,0 +1,29 @@ +<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>{$lang_paste_word_desc}</title>
+ <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script language="javascript" type="text/javascript" src="jscripts/pasteword.js"></script>
+ <link href="css/pasteword.css" rel="stylesheet" type="text/css" />
+ <base target="_self" />
+</head>
+<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');" onresize="resizeInputs();" style="display: none">
+ <form name="source" onsubmit="saveContent();" action="#">
+ <div class="title">{$lang_paste_word_desc}</div>
+
+ <div>{$lang_paste_word_title}</div>
+
+ <div id="iframecontainer"></div>
+
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="saveContent();" />
+ </div>
+
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+ </form>
+</body>
+</html>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php new file mode 100755 index 0000000..cae27f0 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php @@ -0,0 +1,339 @@ +<?php + +/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ ) + Manual: http://scripts.incutio.com/httpclient/ +*/ + +class HttpClient { + // Request vars + var $host; + var $port; + var $path; + var $method; + var $postdata = ''; + var $cookies = array(); + var $referer; + var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*'; + var $accept_encoding = 'gzip'; + var $accept_language = 'en-us'; + var $user_agent = 'Incutio HttpClient v0.9'; + // Options + var $timeout = 20; + var $use_gzip = true; + var $persist_cookies = true; // If true, received cookies are placed in the $this->cookies array ready for the next request + // Note: This currently ignores the cookie path (and time) completely. Time is not important, + // but path could possibly lead to security problems. + var $persist_referers = true; // For each request, sends path of last request as referer + var $debug = false; + var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found + var $max_redirects = 5; + var $headers_only = false; // If true, stops receiving once headers have been read. + // Basic authorization variables + var $username; + var $password; + // Response vars + var $status; + var $headers = array(); + var $content = ''; + var $errormsg; + // Tracker variables + var $redirect_count = 0; + var $cookie_host = ''; + function HttpClient($host, $port=80) { + $this->host = $host; + $this->port = $port; + } + function get($path, $data = false) { + $this->path = $path; + $this->method = 'GET'; + if ($data) { + $this->path .= '?'.$this->buildQueryString($data); + } + return $this->doRequest(); + } + function post($path, $data) { + $this->path = $path; + $this->method = 'POST'; + $this->postdata = $this->buildQueryString($data); + return $this->doRequest(); + } + function buildQueryString($data) { + $querystring = ''; + if (is_array($data)) { + // Change data in to postable data + foreach ($data as $key => $val) { + if (is_array($val)) { + foreach ($val as $val2) { + $querystring .= urlencode($key).'='.urlencode($val2).'&'; + } + } else { + $querystring .= urlencode($key).'='.urlencode($val).'&'; + } + } + $querystring = substr($querystring, 0, -1); // Eliminate unnecessary & + } else { + $querystring = $data; + } + return $querystring; + } + function doRequest() { + // Performs the actual HTTP request, returning true or false depending on outcome + if (!$fp = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout)) { + // Set error message + switch($errno) { + case -3: + $this->errormsg = 'Socket creation failed (-3)'; + case -4: + $this->errormsg = 'DNS lookup failure (-4)'; + case -5: + $this->errormsg = 'Connection refused or timed out (-5)'; + default: + $this->errormsg = 'Connection failed ('.$errno.')'; + $this->errormsg .= ' '.$errstr; + $this->debug($this->errormsg); + } + return false; + } + socket_set_timeout($fp, $this->timeout); + $request = $this->buildRequest(); + $this->debug('Request', $request); + fwrite($fp, $request); + // Reset all the variables that should not persist between requests + $this->headers = array(); + $this->content = ''; + $this->errormsg = ''; + // Set a couple of flags + $inHeaders = true; + $atStart = true; + // Now start reading back the response + while (!feof($fp)) { + $line = fgets($fp, 4096); + if ($atStart) { + // Deal with first line of returned data + $atStart = false; + if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) { + $this->errormsg = "Status code line invalid: ".htmlentities($line); + $this->debug($this->errormsg); + return false; + } + $http_version = $m[1]; // not used + $this->status = $m[2]; + $status_string = $m[3]; // not used + $this->debug(trim($line)); + continue; + } + if ($inHeaders) { + if (trim($line) == '') { + $inHeaders = false; + $this->debug('Received Headers', $this->headers); + if ($this->headers_only) { + break; // Skip the rest of the input + } + continue; + } + if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) { + // Skip to the next header + continue; + } + $key = strtolower(trim($m[1])); + $val = trim($m[2]); + // Deal with the possibility of multiple headers of same name + if (isset($this->headers[$key])) { + if (is_array($this->headers[$key])) { + $this->headers[$key][] = $val; + } else { + $this->headers[$key] = array($this->headers[$key], $val); + } + } else { + $this->headers[$key] = $val; + } + continue; + } + // We're not in the headers, so append the line to the contents + $this->content .= $line; + } + fclose($fp); + // If data is compressed, uncompress it + if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') { + $this->debug('Content is gzip encoded, unzipping it'); + $this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php + $this->content = gzinflate($this->content); + } + // If $persist_cookies, deal with any cookies + if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) { + $cookies = $this->headers['set-cookie']; + if (!is_array($cookies)) { + $cookies = array($cookies); + } + foreach ($cookies as $cookie) { + if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) { + $this->cookies[$m[1]] = $m[2]; + } + } + // Record domain of cookies for security reasons + $this->cookie_host = $this->host; + } + // If $persist_referers, set the referer ready for the next request + if ($this->persist_referers) { + $this->debug('Persisting referer: '.$this->getRequestURL()); + $this->referer = $this->getRequestURL(); + } + // Finally, if handle_redirects and a redirect is sent, do that + if ($this->handle_redirects) { + if (++$this->redirect_count >= $this->max_redirects) { + $this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')'; + $this->debug($this->errormsg); + $this->redirect_count = 0; + return false; + } + $location = isset($this->headers['location']) ? $this->headers['location'] : ''; + $uri = isset($this->headers['uri']) ? $this->headers['uri'] : ''; + if ($location || $uri) { + $url = parse_url($location.$uri); + // This will FAIL if redirect is to a different site + return $this->get($url['path']); + } + } + return true; + } + function buildRequest() { + $headers = array(); + $headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding + $headers[] = "Host: {$this->host}"; + $headers[] = "User-Agent: {$this->user_agent}"; + $headers[] = "Accept: {$this->accept}"; + if ($this->use_gzip) { + $headers[] = "Accept-encoding: {$this->accept_encoding}"; + } + $headers[] = "Accept-language: {$this->accept_language}"; + if ($this->referer) { + $headers[] = "Referer: {$this->referer}"; + } + // Cookies + if ($this->cookies) { + $cookie = 'Cookie: '; + foreach ($this->cookies as $key => $value) { + $cookie .= "$key=$value; "; + } + $headers[] = $cookie; + } + // Basic authentication + if ($this->username && $this->password) { + $headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password); + } + // If this is a POST, set the content type and length + if ($this->postdata) { + $headers[] = 'Content-Type: application/x-www-form-urlencoded'; + $headers[] = 'Content-Length: '.strlen($this->postdata); + } + $request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata; + return $request; + } + function getStatus() { + return $this->status; + } + function getContent() { + return $this->content; + } + function getHeaders() { + return $this->headers; + } + function getHeader($header) { + $header = strtolower($header); + if (isset($this->headers[$header])) { + return $this->headers[$header]; + } else { + return false; + } + } + function getError() { + return $this->errormsg; + } + function getCookies() { + return $this->cookies; + } + function getRequestURL() { + $url = 'http://'.$this->host; + if ($this->port != 80) { + $url .= ':'.$this->port; + } + $url .= $this->path; + return $url; + } + // Setter methods + function setUserAgent($string) { + $this->user_agent = $string; + } + function setAuthorization($username, $password) { + $this->username = $username; + $this->password = $password; + } + function setCookies($array) { + $this->cookies = $array; + } + // Option setting methods + function useGzip($boolean) { + $this->use_gzip = $boolean; + } + function setPersistCookies($boolean) { + $this->persist_cookies = $boolean; + } + function setPersistReferers($boolean) { + $this->persist_referers = $boolean; + } + function setHandleRedirects($boolean) { + $this->handle_redirects = $boolean; + } + function setMaxRedirects($num) { + $this->max_redirects = $num; + } + function setHeadersOnly($boolean) { + $this->headers_only = $boolean; + } + function setDebug($boolean) { + $this->debug = $boolean; + } + // "Quick" static methods + function quickGet($url) { + $bits = parse_url($url); + $host = $bits['host']; + $port = isset($bits['port']) ? $bits['port'] : 80; + $path = isset($bits['path']) ? $bits['path'] : '/'; + if (isset($bits['query'])) { + $path .= '?'.$bits['query']; + } + $client = new HttpClient($host, $port); + if (!$client->get($path)) { + return false; + } else { + return $client->getContent(); + } + } + function quickPost($url, $data) { + $bits = parse_url($url); + $host = $bits['host']; + $port = isset($bits['port']) ? $bits['port'] : 80; + $path = isset($bits['path']) ? $bits['path'] : '/'; + $client = new HttpClient($host, $port); + if (!$client->post($path, $data)) { + return false; + } else { + return $client->getContent(); + } + } + function debug($msg, $object = false) { + if ($this->debug) { + print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClient Debug:</strong> '.$msg; + if ($object) { + ob_start(); + print_r($object); + $content = htmlentities(ob_get_contents()); + ob_end_clean(); + print '<pre>'.$content.'</pre>'; + } + print '</div>'; + } + } +} + +?>
\ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php new file mode 100755 index 0000000..971da10 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php @@ -0,0 +1,73 @@ +<?php
+/* *
+ * Tiny Spelling Interface for TinyMCE Spell Checking.
+ *
+ * Copyright © 2006 Moxiecode Systems AB
+ */
+
+require_once("HttpClient.class.php");
+
+class TinyGoogleSpell {
+ var $lang;
+
+ function TinyGoogleSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
+ $this->lang = $lang;
+ }
+
+ // Returns array with bad words or false if failed.
+ function checkWords($word_array) {
+ $words = array();
+ $wordstr = implode(' ', $word_array);
+
+ $matches = $this->_getMatches($wordstr);
+
+ for ($i=0; $i<count($matches); $i++)
+ $words[] = substr($wordstr, $matches[$i][1], $matches[$i][2]);
+
+ return $words;
+ }
+
+ // Returns array with suggestions or false if failed.
+ function getSuggestion($word) {
+ $sug = array();
+
+ $matches = $this->_getMatches($word);
+
+ if (count($matches) > 0)
+ $sug = explode("\t", $matches[0][4]);
+
+ return $sug;
+ }
+
+ function _getMatches($word_list) {
+ $xml = "";
+
+ // Setup HTTP Client
+ $client = new HttpClient('www.google.com');
+ $client->setUserAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR');
+ $client->setHandleRedirects(false);
+ $client->setDebug(false);
+
+ // Setup XML request
+ $xml .= '<?xml version="1.0" encoding="utf-8" ?>';
+ $xml .= '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">';
+ $xml .= '<text>' . htmlentities($word_list) . '</text></spellrequest>';
+
+ // Execute HTTP Post to Google
+ if (!$client->post('/tbproxy/spell?lang=' . $this->lang, $xml)) {
+ $this->errorMsg[] = 'An error occurred: ' . $client->getError();
+ return array();
+ }
+
+ // Grab and parse content
+ $xml = $client->getContent();
+ preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
+
+ return $matches;
+ }
+}
+
+// Setup classname, should be the same as the name of the spellchecker class
+$spellCheckerConfig['class'] = "TinyGoogleSpell";
+
+?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php new file mode 100755 index 0000000..21fb194 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php @@ -0,0 +1,64 @@ +<?php
+/* *
+ * Tiny Spelling Interface for TinyMCE Spell Checking.
+ *
+ * Copyright © 2006 Moxiecode Systems AB
+ *
+ */
+
+class TinyPSpell {
+ var $lang;
+ var $mode;
+ var $string;
+ var $plink;
+ var $errorMsg;
+
+ var $jargon;
+ var $spelling;
+ var $encoding;
+
+ function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
+ $this->lang = $lang;
+ $this->mode = $mode;
+ $this->plink = false;
+ $this->errorMsg = array();
+
+ if (!function_exists("pspell_new")) {
+ $this->errorMsg[] = "PSpell not found.";
+ return;
+ }
+
+ $this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
+ }
+
+ // Returns array with bad words or false if failed.
+ function checkWords($wordArray) {
+ if (!$this->plink) {
+ $this->errorMsg[] = "No PSpell link found for checkWords.";
+ return array();
+ }
+
+ $wordError = array();
+ foreach($wordArray as $word) {
+ if(!pspell_check($this->plink, trim($word)))
+ $wordError[] = $word;
+ }
+
+ return $wordError;
+ }
+
+ // Returns array with suggestions or false if failed.
+ function getSuggestion($word) {
+ if (!$this->plink) {
+ $this->errorMsg[] = "No PSpell link found for getSuggestion.";
+ return array();
+ }
+
+ return pspell_suggest($this->plink, $word);
+ }
+}
+
+// Setup classname, should be the same as the name of the spellchecker class
+$spellCheckerConfig['class'] = "TinyPspell";
+
+?>
\ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php new file mode 100755 index 0000000..41c0948 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php @@ -0,0 +1,102 @@ +<?php
+/* *
+ * Tiny Spelling Interface for TinyMCE Spell Checking.
+ *
+ * Copyright © 2006 Moxiecode Systems AB
+ *
+ */
+
+class TinyPspellShell {
+ var $lang;
+ var $mode;
+ var $string;
+ var $error;
+ var $errorMsg;
+
+ var $cmd;
+ var $tmpfile;
+
+ var $jargon;
+ var $spelling;
+ var $encoding;
+
+ function TinyPspellShell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
+ $this->lang = $lang;
+ $this->mode = $mode;
+ $this->error = false;
+ $this->errorMsg = array();
+
+ $this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
+ $this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang;
+ }
+
+ // Returns array with bad words or false if failed.
+ function checkWords($wordArray) {
+ if ($fh = fopen($this->tmpfile, "w")) {
+ fwrite($fh, "!\n");
+ foreach($wordArray as $key => $value)
+ fwrite($fh, "^" . $value . "\n");
+
+ fclose($fh);
+ } else {
+ $this->errorMsg[] = "PSpell not found.";
+ return array();
+ }
+
+ $data = shell_exec($this->cmd);
+ @unlink($this->tmpfile);
+ $returnData = array();
+ $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
+
+ foreach($dataArr as $dstr) {
+ $matches = array();
+
+ // Skip this line.
+ if (strpos($dstr, "@") === 0)
+ continue;
+
+ preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches);
+
+ if (!empty($matches[1]))
+ $returnData[] = $matches[1];
+ }
+
+ return $returnData;
+ }
+
+ // Returns array with suggestions or false if failed.
+ function getSuggestion($word) {
+ if ($fh = fopen($this->tmpfile, "w")) {
+ fwrite($fh, "!\n");
+ fwrite($fh, "^$word\n");
+ fclose($fh);
+ } else
+ die("Error opening tmp file.");
+
+ $data = shell_exec($this->cmd);
+ @unlink($this->tmpfile);
+ $returnData = array();
+ $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
+
+ foreach($dataArr as $dstr) {
+ $matches = array();
+
+ // Skip this line.
+ if (strpos($dstr, "@") === 0)
+ continue;
+
+ preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches);
+
+ if (!empty($matches[1])) {
+ // For some reason, the exec version seems to add commas?
+ $returnData[] = str_replace(",", "", $matches[1]);
+ }
+ }
+ return $returnData;
+ }
+}
+
+// Setup classname, should be the same as the name of the spellchecker class
+$spellCheckerConfig['class'] = "TinyPspellShell";
+
+?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/config.php b/wp-includes/js/tinymce/plugins/spellchecker/config.php new file mode 100755 index 0000000..a528565 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/config.php @@ -0,0 +1,29 @@ +<?php
+ $spellCheckerConfig = array();
+
+ // General settings
+ $spellCheckerConfig['enabled'] = true;
+
+ // Pspell shell specific settings
+ $spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell';
+ $spellCheckerConfig['tinypspellshell.tmp'] = '/tmp';
+
+ // Default settings
+ $spellCheckerConfig['default.language'] = 'en';
+ $spellCheckerConfig['default.mode'] = PSPELL_FAST;
+
+ // Normaly not required to configure
+ $spellCheckerConfig['default.spelling'] = "";
+ $spellCheckerConfig['default.jargon'] = "";
+ $spellCheckerConfig['default.encoding'] = "";
+
+ // Spellchecker class use
+ if ( function_exists('pspell_new') )
+ require_once("classes/TinyPspell.class.php"); // Internal PHP version
+
+ elseif ( file_exists($spellCheckerConfig['tinypspellshell.aspell']) )
+ require_once("classes/TinyPspellShell.class.php"); // Command line pspell
+
+ else
+ require_once("classes/TinyGoogleSpell.class.php"); // Google web service
+?>
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/css/content.css b/wp-includes/js/tinymce/plugins/spellchecker/css/content.css new file mode 100755 index 0000000..fb82733 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/css/content.css @@ -0,0 +1,5 @@ +.mceItemHiddenSpellWord {
+ background: url('../images/wline.gif') repeat-x bottom left;
+ bo2rder-bottom: 1px dashed red;
+ cursor: default;
+}
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css b/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css new file mode 100755 index 0000000..aa4a8ea --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css @@ -0,0 +1,34 @@ +.mceMsgBox {
+ border: 1px solid gray;
+ padding: 8px;
+}
+
+.mceMsgBox span {
+ vertical-align: top;
+ color: #555555;
+}
+
+/* Misc */
+
+.mceBlockBox {
+ display: none;
+ position: absolute;
+ left: 0;
+ top: 0;
+ z-index: 100;
+ filter:progid:DXImageTransform.Microsoft.Alpha(style=0, opacity=60);
+ -moz-opacity:0.6;
+ opacity: 0.6;
+ background-color: white;
+}
+
+.mceMsgBox {
+ display: none;
+ z-index: 101;
+ position: absolute;
+ left: 0;
+ top: 0;
+ font-family: Arial, Verdana, Tahoma, Helvetica;
+ font-weight: bold;
+ font-size: 11px;
+}
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js b/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js new file mode 100755 index 0000000..ab3fc6b --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js @@ -0,0 +1,573 @@ +/**
+ * $RCSfile: editor_plugin_src.js,v $
+ * $Revision: 1.4 $
+ * $Date: 2006/03/24 17:24:50 $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+tinyMCE.importPluginLanguagePack('spellchecker', 'en,sv,nn,nb');
+
+// Plucin static class
+var TinyMCE_SpellCheckerPlugin = {
+ _contextMenu : new TinyMCE_Menu(),
+ _menu : new TinyMCE_Menu(),
+ _counter : 0,
+
+ getInfo : function() {
+ return {
+ longname : 'Spellchecker',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_spellchecker.html',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+ },
+
+ handleEvent : function(e) {
+ var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
+ var inst = tinyMCE.selectedInstance, args = '';
+ var self = TinyMCE_SpellCheckerPlugin;
+ var cm = self._contextMenu;
+ var p, p2, x, y, sx, sy, h, elm;
+
+ // Handle click on word
+ if ((e.type == "click" || e.type == "contextmenu") && elm) {
+ do {
+ if (tinyMCE.getAttrib(elm, 'class') == "mceItemHiddenSpellWord") {
+ inst.spellCheckerElm = elm;
+
+ // Setup arguments
+ args += 'id=' + inst.editorId + "|" + (++self._counter);
+ args += '&cmd=suggest&check=' + escape(elm.innerHTML);
+ args += '&lang=' + escape(inst.spellCheckerLang);
+
+ elm = inst.spellCheckerElm;
+ p = tinyMCE.getAbsPosition(inst.iframeElement);
+ p2 = tinyMCE.getAbsPosition(elm);
+ h = parseInt(elm.offsetHeight);
+ sx = inst.getBody().scrollLeft;
+ sy = inst.getBody().scrollTop;
+ x = p.absLeft + p2.absLeft - sx;
+ y = p.absTop + p2.absTop - sy + h;
+
+ cm.clear();
+ cm.addTitle(tinyMCE.getLang('lang_spellchecker_wait', '', true));
+ cm.show();
+ cm.moveTo(x, y);
+
+ inst.selection.selectNode(elm, false, false);
+
+ self._sendAjax(self.baseURL + "/tinyspell.php", self._ajaxResponse, 'post', args);
+
+ tinyMCE.cancelEvent(e);
+ return false;
+ }
+ } while ((elm = elm.parentNode));
+ }
+
+ return true;
+ },
+
+ initInstance : function(inst) {
+ var self = TinyMCE_SpellCheckerPlugin, m = self._menu, cm = self._contextMenu, e;
+
+ tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/spellchecker/css/content.css");
+
+ if (!tinyMCE.hasMenu('spellcheckercontextmenu')) {
+ tinyMCE.importCSS(document, tinyMCE.baseURL + "/plugins/spellchecker/css/spellchecker.css");
+
+ cm.init({drop_menu : false});
+ tinyMCE.addMenu('spellcheckercontextmenu', cm);
+ }
+
+ if (!tinyMCE.hasMenu('spellcheckermenu')) {
+ m.init({});
+ tinyMCE.addMenu('spellcheckermenu', m);
+ }
+
+ inst.spellCheckerLang = 'en';
+ self._buildSettingsMenu(inst, null);
+
+ e = self._getBlockBoxLayer(inst).create('div', 'mceBlockBox', document.getElementById(inst.editorId + '_parent'));
+ self._getMsgBoxLayer(inst).create('div', 'mceMsgBox', document.getElementById(inst.editorId + '_parent'));
+ },
+
+ _getMsgBoxLayer : function(inst) {
+ if (!inst.spellCheckerMsgBoxL)
+ inst.spellCheckerMsgBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerMsgBox', false);
+
+ return inst.spellCheckerMsgBoxL;
+ },
+
+ _getBlockBoxLayer : function(inst) {
+ if (!inst.spellCheckerBoxL)
+ inst.spellCheckerBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerBlockBox', false);
+
+ return inst.spellCheckerBoxL;
+ },
+
+ _buildSettingsMenu : function(inst, lang) {
+ var i, ar = tinyMCE.getParam('spellchecker_languages', '+English=en').split(','), p;
+ var self = TinyMCE_SpellCheckerPlugin, m = self._menu, c;
+
+ m.clear();
+ m.addTitle(tinyMCE.getLang('lang_spellchecker_langs', '', true));
+
+ for (i=0; i<ar.length; i++) {
+ if (ar[i] != '') {
+ p = ar[i].split('=');
+ c = 'mceMenuCheckItem';
+
+ if (p[0].charAt(0) == '+') {
+ p[0] = p[0].substring(1);
+
+ if (lang == null) {
+ c = 'mceMenuSelectedItem';
+ inst.spellCheckerLang = p[1];
+ }
+ }
+
+ if (lang == p[1])
+ c = 'mceMenuSelectedItem';
+
+ m.add({text : p[0], js : "tinyMCE.execInstanceCommand('" + inst.editorId + "','mceSpellCheckerSetLang',false,'" + p[1] + "');", class_name : c});
+ }
+ }
+ },
+
+ setupContent : function(editor_id, body, doc) {
+ TinyMCE_SpellCheckerPlugin._removeWords(doc);
+ },
+
+ getControlHTML : function(cn) {
+ switch (cn) {
+ case "spellchecker":
+ return TinyMCE_SpellCheckerPlugin._getMenuButtonHTML(cn, 'lang_spellchecker_desc', '{$pluginurl}/images/spellchecker.gif', 'lang_spellchecker_desc', 'mceSpellCheckerMenu', 'mceSpellCheck');
+ }
+
+ return "";
+ },
+
+ /**
+ * Returns the HTML code for a normal button control.
+ *
+ * @param {string} id Button control id, this will be the suffix for the element id, the prefix is the editor id.
+ * @param {string} lang Language variable key name to insert as the title/alt of the button image.
+ * @param {string} img Image URL to insert, {$themeurl} and {$pluginurl} will be replaced.
+ * @param {string} mlang Language variable key name to insert as the title/alt of the menu button image.
+ * @param {string} mid Menu by id to display when the menu button is pressed.
+ * @param {string} cmd Command to execute when the user clicks the button.
+ * @param {string} ui Optional user interface boolean for command.
+ * @param {string} val Optional value for command.
+ * @return HTML code for a normal button based in input information.
+ * @type string
+ */
+ _getMenuButtonHTML : function(id, lang, img, mlang, mid, cmd, ui, val) {
+ var h = '', m, x;
+
+ cmd = 'tinyMCE.hideMenus();tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
+
+ if (typeof(ui) != "undefined" && ui != null)
+ cmd += ',' + ui;
+
+ if (typeof(val) != "undefined" && val != null)
+ cmd += ",'" + val + "'";
+
+ cmd += ');';
+
+ // Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
+ if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isMSIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
+ // Tiled button
+ x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
+ h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';
+ h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';
+ h += '<img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" onclick="' + mcmd + 'return false;" />';
+ h += '</a>';
+ } else {
+ if (tinyMCE.isMSIE && !tinyMCE.isOpera)
+ h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE.plugins.spellchecker._menuButtonEvent(\'over\',this);" onmouseout="tinyMCE.plugins.spellchecker._menuButtonEvent(\'out\',this);">';
+ else
+ h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
+
+ h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
+ h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
+ h += '<a href="#" onclick="tinyMCE.plugins.spellchecker._toggleMenu(\'{$editor_id}\',\'' + mid + '\');return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
+ h += '</a></span>';
+ }
+
+ return h;
+ },
+
+ _menuButtonEvent : function(e, o) {
+ if (o.className == 'mceMenuButtonFocus')
+ return;
+
+ if (e == 'over')
+ o.className = o.className + ' mceMenuHover';
+ else
+ o.className = o.className.replace(/\s.*$/, '');
+ },
+
+ _toggleMenu : function(editor_id, id) {
+ var self = TinyMCE_SpellCheckerPlugin;
+ var e = document.getElementById(editor_id + '_spellchecker');
+ var inst = tinyMCE.getInstanceById(editor_id);
+
+ if (self._menu.isVisible()) {
+ tinyMCE.hideMenus();
+ return;
+ }
+
+ tinyMCE.lastMenuBtnClass = e.className.replace(/\s.*$/, '');
+ tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonFocus');
+
+ self._menu.moveRelativeTo(e, 'bl');
+ self._menu.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? 0 : 1, -1);
+
+ if (tinyMCE.isOpera)
+ self._menu.moveBy(0, -2);
+
+ self._onMenuEvent(inst, self._menu, 'show');
+
+ self._menu.show();
+
+ tinyMCE.lastSelectedMenuBtn = editor_id + '_spellchecker';
+ },
+
+ _onMenuEvent : function(inst, m, n) {
+ TinyMCE_SpellCheckerPlugin._buildSettingsMenu(inst, inst.spellCheckerLang);
+ },
+
+ execCommand : function(editor_id, element, command, user_interface, value) {
+ var inst = tinyMCE.getInstanceById(editor_id), self = TinyMCE_SpellCheckerPlugin, args = '', co, bb, mb, nl, i, e;
+
+ // Handle commands
+ switch (command) {
+ case "mceSpellCheck":
+ if (!inst.spellcheckerOn) {
+ inst.spellCheckerBookmark = inst.selection.getBookmark();
+
+ // Setup arguments
+ args += 'id=' + inst.editorId + "|" + (++self._counter);
+ args += '&cmd=spell&check=' + escape(self._getWordList(inst.getBody())).replace(/%20/g, '+');
+ args += '&lang=' + escape(inst.spellCheckerLang);
+
+ co = document.getElementById(inst.editorId + '_parent').firstChild;
+ bb = self._getBlockBoxLayer(inst);
+ bb.moveRelativeTo(co, 'tl');
+ bb.resizeTo(co.offsetWidth, co.offsetHeight);
+ bb.show();
+
+ // Setup message box
+ mb = self._getMsgBoxLayer(inst);
+ e = mb.getElement();
+ e.innerHTML = '<span>' + tinyMCE.getLang('lang_spellchecker_swait', '', true) + '</span>';
+ mb.show();
+ mb.moveRelativeTo(co, 'cc');
+
+ if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+ nl = co.getElementsByTagName('select');
+ for (i=0; i<nl.length; i++)
+ nl[i].disabled = true;
+ }
+
+ inst.spellcheckerOn = true;
+ tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
+
+ self._sendAjax(self.baseURL + "/tinyspell.php", self._ajaxResponse, 'post', args);
+ } else {
+ self._removeWords(inst.getDoc());
+ inst.spellcheckerOn = false;
+ tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
+ }
+
+ return true;
+
+ case "mceSpellCheckReplace":
+ if (inst.spellCheckerElm)
+ tinyMCE.setOuterHTML(inst.spellCheckerElm, value);
+
+ self._checkDone(inst);
+ self._contextMenu.hide();
+ self._menu.hide();
+
+ return true;
+
+ case "mceSpellCheckIgnore":
+ if (inst.spellCheckerElm)
+ self._removeWord(inst.spellCheckerElm);
+
+ self._checkDone(inst);
+ self._contextMenu.hide();
+ self._menu.hide();
+ return true;
+
+ case "mceSpellCheckIgnoreAll":
+ if (inst.spellCheckerElm)
+ self._removeWords(inst.getDoc(), inst.spellCheckerElm.innerHTML);
+
+ self._checkDone(inst);
+ self._contextMenu.hide();
+ self._menu.hide();
+ return true;
+
+ case "mceSpellCheckerSetLang":
+ tinyMCE.hideMenus();
+ inst.spellCheckerLang = value;
+ self._removeWords(inst.getDoc());
+ inst.spellcheckerOn = false;
+ tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
+ return true;
+ }
+
+ // Pass to next handler in chain
+ return false;
+ },
+
+ cleanup : function(type, content, inst) {
+ switch (type) {
+ case "get_from_editor_dom":
+ TinyMCE_SpellCheckerPlugin._removeWords(content);
+ inst.spellcheckerOn = false;
+ break;
+ }
+
+ return content;
+ },
+
+ // Private plugin specific methods
+
+ _displayUI : function(inst) {
+ var self = TinyMCE_SpellCheckerPlugin;
+ var bb = self._getBlockBoxLayer(inst);
+ var mb = self._getMsgBoxLayer(inst);
+ var nl, i;
+ var co = document.getElementById(inst.editorId + '_parent').firstChild;
+
+ if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
+ nl = co.getElementsByTagName('select');
+ for (i=0; i<nl.length; i++)
+ nl[i].disabled = false;
+ }
+
+ bb.hide();
+ mb.hide();
+ },
+
+ _ajaxResponse : function(xml) {
+ var el = xml ? xml.documentElement : null;
+ var inst = tinyMCE.selectedInstance, self = TinyMCE_SpellCheckerPlugin;
+ var cmd = el ? el.getAttribute("cmd") : null, err, id = el ? el.getAttribute("id") : null;
+
+ if (id)
+ inst = tinyMCE.getInstanceById(id.substring(0, id.indexOf('|')));
+
+ self._displayUI(inst);
+
+ // Ignore suggestions for other ajax responses
+ if (cmd == "suggest" && id != inst.editorId + "|" + self._counter)
+ return;
+
+ if (!el) {
+ inst.spellcheckerOn = false;
+ tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
+ alert("Could not execute AJAX call, server didn't return valid a XML.");
+ return;
+ }
+
+ err = el.getAttribute("error");
+
+ if (err == "true") {
+ inst.spellcheckerOn = false;
+ tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
+ alert(el.getAttribute("msg"));
+ return;
+ }
+
+ switch (cmd) {
+ case "spell":
+ if (xml.documentElement.firstChild) {
+ self._markWords(inst.getDoc(), inst.getBody(), el.firstChild.nodeValue.split(' '));
+ inst.selection.moveToBookmark(inst.spellCheckerBookmark);
+ } else
+ alert(tinyMCE.getLang('lang_spellchecker_no_mpell', '', true));
+
+ self._checkDone(inst);
+
+ break;
+
+ case "suggest":
+ self._buildMenu(el.firstChild ? el.firstChild.nodeValue.split(' ') : null, 10);
+ self._contextMenu.show();
+ break;
+ }
+ },
+
+ _getWordSeparators : function() {
+ var i, re = '', ch = tinyMCE.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
+
+ for (i=0; i<ch.length; i++)
+ re += '\\' + ch.charAt(i);
+
+ return re;
+ },
+
+ _getWordList : function(n) {
+ var i, x, s, nv = '', nl = tinyMCE.getNodeTree(n, new Array(), 3), wl = new Array();
+ var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
+
+ for (i=0; i<nl.length; i++)
+ nv += nl[i].nodeValue + " ";
+
+ nv = nv.replace(new RegExp('([0-9]|[' + re + '])', 'g'), ' ');
+ nv = tinyMCE.trim(nv.replace(/(\s+)/g, ' '));
+
+ nl = nv.split(/\s+/);
+ for (i=0; i<nl.length; i++) {
+ s = false;
+ for (x=0; x<wl.length; x++) {
+ if (wl[x] == nl[i]) {
+ s = true;
+ break;
+ }
+ }
+
+ if (!s)
+ wl[wl.length] = nl[i];
+ }
+
+ return wl.join(' ');
+ },
+
+ _removeWords : function(doc, word) {
+ var i, c, nl = doc.getElementsByTagName("span");
+ var self = TinyMCE_SpellCheckerPlugin;
+ var inst = tinyMCE.selectedInstance, b = inst ? inst.selection.getBookmark() : null;
+
+ word = typeof(word) == 'undefined' ? null : word;
+
+ for (i=nl.length-1; i>=0; i--) {
+ c = tinyMCE.getAttrib(nl[i], 'class');
+
+ if ((c == 'mceItemHiddenSpellWord' || c == 'mceItemHidden') && (word == null || nl[i].innerHTML == word))
+ self._removeWord(nl[i]);
+ }
+
+ if (b)
+ inst.selection.moveToBookmark(b);
+ },
+
+ _checkDone : function(inst) {
+ var i, w = 0, nl = inst.getDoc().getElementsByTagName("span")
+ var self = TinyMCE_SpellCheckerPlugin;
+
+ for (i=nl.length-1; i>=0; i--) {
+ c = tinyMCE.getAttrib(nl[i], 'class');
+
+ if (c == 'mceItemHiddenSpellWord')
+ w++;
+ }
+
+ if (w == 0) {
+ self._removeWords(inst.getDoc());
+ inst.spellcheckerOn = false;
+ tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
+ }
+ },
+
+ _removeWord : function(e) {
+ tinyMCE.setOuterHTML(e, e.innerHTML);
+ },
+
+ _markWords : function(doc, n, wl) {
+ var i, nv, nn, nl = tinyMCE.getNodeTree(n, new Array(), 3);
+ var r1, r2, r3, r4, r5, w = '';
+ var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
+
+ for (i=0; i<wl.length; i++)
+ w += wl[i] + ((i == wl.length-1) ? '' : '|');
+
+ r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');
+ r2 = new RegExp('^(' + w + ')', 'g');
+ r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');
+ r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');
+ r5 = new RegExp('(' + w + ')([' + re + '])', 'g');
+
+ for (i=0; i<nl.length; i++) {
+ nv = nl[i].nodeValue;
+ if (r1.test(nv) || r2.test(nv) || r3.test(nv) || r4.test(nv)) {
+ nv = tinyMCE.xmlEncode(nv);
+ nv = nv.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');
+ nv = nv.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');
+
+ nn = doc.createElement('span');
+ nn.className = "mceItemHidden";
+ nn.innerHTML = nv;
+
+ // Remove old text node
+ nl[i].parentNode.replaceChild(nn, nl[i]);
+ }
+ }
+ },
+
+ _buildMenu : function(sg, max) {
+ var i, self = TinyMCE_SpellCheckerPlugin, cm = self._contextMenu;
+
+ cm.clear();
+
+ if (sg != null) {
+ cm.addTitle(tinyMCE.getLang('lang_spellchecker_sug', '', true));
+
+ for (i=0; i<sg.length && i<max; i++)
+ cm.addItem(sg[i], 'tinyMCE.execCommand("mceSpellCheckReplace",false,"' + sg[i] + '");');
+
+ cm.addSeparator();
+ cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_word', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnore\');');
+ cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_words', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnoreAll\');');
+ } else
+ cm.addTitle(tinyMCE.getLang('lang_spellchecker_no_sug', '', true));
+
+ cm.update();
+ },
+
+ _getAjaxHTTP : function() {
+ try {
+ return new ActiveXObject('Msxml2.XMLHTTP')
+ } catch (e) {
+ try {
+ return new ActiveXObject('Microsoft.XMLHTTP')
+ } catch (e) {
+ return new XMLHttpRequest();
+ }
+ }
+ },
+
+ /**
+ * Perform AJAX call.
+ *
+ * @param {string} u URL of AJAX service.
+ * @param {function} f Function to call when response arrives.
+ * @param {string} m Request method post or get.
+ * @param {Array} a Array with arguments to send.
+ */
+ _sendAjax : function(u, f, m, a) {
+ var x = TinyMCE_SpellCheckerPlugin._getAjaxHTTP();
+
+ x.open(m, u, true);
+
+ x.onreadystatechange = function() {
+ if (x.readyState == 4)
+ f(x.responseXML);
+ };
+
+ if (m == 'post')
+ x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+
+ x.send(a);
+ }
+};
+
+// Register plugin
+tinyMCE.addPlugin('spellchecker', TinyMCE_SpellCheckerPlugin);
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/images/spellchecker.gif b/wp-includes/js/tinymce/plugins/spellchecker/images/spellchecker.gif Binary files differnew file mode 100755 index 0000000..294a9d2 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/images/spellchecker.gif diff --git a/wp-includes/js/tinymce/plugins/spellchecker/images/wline.gif b/wp-includes/js/tinymce/plugins/spellchecker/images/wline.gif Binary files differnew file mode 100755 index 0000000..7d0a4db --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/images/wline.gif diff --git a/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js b/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js new file mode 100755 index 0000000..f40b202 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/langs/en.js @@ -0,0 +1,14 @@ +// UK lang variables
+
+tinyMCE.addToLang('spellchecker',{
+ desc : 'Toggle spellchecker',
+ menu : 'Spellchecker settings',
+ ignore_word : 'Ignore word',
+ ignore_words : 'Ignore all',
+ langs : 'Languages',
+ wait : 'Please wait...',
+ swait : 'Spellchecking, please wait...',
+ sug : 'Suggestions',
+ no_sug : 'No suggestions',
+ no_mpell : 'No misspellings found.'
+});
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php b/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php new file mode 100755 index 0000000..88da57d --- /dev/null +++ b/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php @@ -0,0 +1,133 @@ +<?php
+/**
+ * $RCSfile: tinyspell.php,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/14 17:33:47 $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+ require_once("config.php");
+
+ $id = sanitize($_POST['id'], "loose");
+
+ if (!$spellCheckerConfig['enabled']) {
+ header('Content-type: text/xml; charset=utf-8');
+ echo '<?xml version="1.0" encoding="utf-8" ?><res id="' . $id . '" error="true" msg="You must enable the spellchecker by modifying the config.php file." />';
+ die;
+ }
+
+ // Basic config
+ $defaultLanguage = $spellCheckerConfig['default.language'];
+ $defaultMode = $spellCheckerConfig['default.mode'];
+
+ // Normaly not required to configure
+ $defaultSpelling = $spellCheckerConfig['default.spelling'];
+ $defaultJargon = $spellCheckerConfig['default.jargon'];
+ $defaultEncoding = $spellCheckerConfig['default.encoding'];
+ $outputType = "xml"; // Do not change
+
+ // Get input parameters.
+
+ $check = $_POST['check'];
+ $cmd = sanitize($_POST['cmd']);
+ $lang = sanitize($_POST['lang'], "strict");
+ $mode = sanitize($_POST['mode'], "strict");
+ $spelling = sanitize($_POST['spelling'], "strict");
+ $jargon = sanitize($_POST['jargon'], "strict");
+ $encoding = sanitize($_POST['encoding'], "strict");
+ $sg = sanitize($_POST['sg'], "bool");
+ $words = array();
+
+ $validRequest = true;
+
+ if (empty($check))
+ $validRequest = false;
+
+ if (empty($lang))
+ $lang = $defaultLanguage;
+
+ if (empty($mode))
+ $mode = $defaultMode;
+
+ if (empty($spelling))
+ $spelling = $defaultSpelling;
+
+ if (empty($jargon))
+ $jargon = $defaultJargon;
+
+ if (empty($encoding))
+ $encoding = $defaultEncoding;
+
+ function sanitize($str, $type="strict") {
+ switch ($type) {
+ case "strict":
+ $str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str);
+ break;
+ case "loose":
+ $str = preg_replace("/</i", ">", $str);
+ $str = preg_replace("/>/i", "<", $str);
+ break;
+ case "bool":
+ if ($str == "true" || $str == true)
+ $str = true;
+ else
+ $str = false;
+ break;
+ }
+
+ return $str;
+ }
+
+ $result = array();
+ $tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);
+
+ if (count($tinyspell->errorMsg) == 0) {
+ switch($cmd) {
+ case "spell":
+ // Space for non-exec version and \n for the exec version.
+ $words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
+ $result = $tinyspell->checkWords($words);
+ break;
+ case "suggest":
+ $result = $tinyspell->getSuggestion($check);
+ break;
+ default:
+ // Just use this for now.
+ $tinyspell->errorMsg[] = "No command.";
+ $outputType = $outputType . "error";
+ break;
+ }
+ } else
+ $outputType = $outputType . "error";
+
+ if (!$result)
+ $result = array();
+
+ // Output data
+ switch($outputType) {
+ case "xml":
+ header('Content-type: text/xml; charset=utf-8');
+ echo '<?xml version="1.0" encoding="utf-8" ?>';
+ echo "\n";
+ if (count($result) == 0)
+ echo '<res id="' . $id . '" cmd="'. $cmd .'" />';
+ else
+ echo '<res id="' . $id . '" cmd="'. $cmd .'">'. utf8_encode(implode(" ", $result)) .'</res>';
+
+ break;
+ case "xmlerror";
+ header('Content-type: text/xml; charset=utf-8');
+ echo '<?xml version="1.0" encoding="utf-8" ?>';
+ echo "\n";
+ echo '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
+ break;
+ case "html":
+ var_dump($result);
+ break;
+ case "htmlerror":
+ echo "Error";
+ break;
+ }
+?>
diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js new file mode 100644 index 0000000..e5067c0 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js @@ -0,0 +1,400 @@ +/* Import plugin specific language pack */ +tinyMCE.importPluginLanguagePack('wordpress', 'en'); + +var TinyMCE_wordpressPlugin = { + getInfo : function() { + return { + longname : 'WordPress Plugin', + author : 'WordPress', + authorurl : 'http://wordpress.org', + infourl : 'http://wordpress.org', + version : '1' + }; + }, + + getControlHTML : function(control_name) { + switch (control_name) { + case "wp_more": + return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_more_button', '{$pluginurl}/images/more.gif', 'wpMore'); + case "wp_page": + return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_page_button', '{$pluginurl}/images/page.gif', 'wpPage'); + case "wp_help": + var buttons = tinyMCE.getButtonHTML(control_name, 'lang_help_button_title', '{$pluginurl}/images/help.gif', 'wpHelp'); + var hiddenControls = '<div class="zerosize">' + + '<input type="button" accesskey="n" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSpellCheck\',false);" />' + + '<input type="button" accesskey="k" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />' + + '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />' + + '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />' + + '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />' + + '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />' + + '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />' + + '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />' + + '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />' + + '<input type="button" accesskey="j" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyFull\',false);" />' + + '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />' + + '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />' + + '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />' + + '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpMore\');" />' + + '<input type="button" accesskey="g" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpPage\');" />' + + '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />' + + '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />' + + '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />' + + '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpHelp\',false);" />' + + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />' + + '</div>'; + return buttons+hiddenControls; + case "wp_adv": + return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_adv_button', '{$pluginurl}/images/toolbars.gif', 'wpAdv'); + case "wp_adv_start": + return '<div id="wpadvbar" style="display:none;"><br />'; + case "wp_adv_end": + return '</div>'; + } + return ''; + }, + + execCommand : function(editor_id, element, command, user_interface, value) { + var inst = tinyMCE.getInstanceById(editor_id); + var focusElm = inst.getFocusElement(); + var doc = inst.getDoc(); + + function getAttrib(elm, name) { + return elm.getAttribute(name) ? elm.getAttribute(name) : ""; + } + + // Handle commands + switch (command) { + case "wpMore": + var flag = ""; + var template = new Array(); + var altMore = tinyMCE.getLang('lang_wordpress_more_alt'); + + // Is selection a image + if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { + flag = getAttrib(focusElm, 'class'); + + if (flag != 'mce_plugin_wordpress_more') // Not a wordpress + return true; + + action = "update"; + } + + html = '' + + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ' + + ' width="100%" height="10px" ' + + 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />'; + tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, html); + tinyMCE.selectedInstance.repaint(); + return true; + + case "wpPage": + var flag = ""; + var template = new Array(); + var altPage = tinyMCE.getLang('lang_wordpress_more_alt'); + + // Is selection a image + if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { + flag = getAttrib(focusElm, 'name'); + + if (flag != 'mce_plugin_wordpress_page') // Not a wordpress + return true; + + action = "update"; + } + + html = '' + + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ' + + ' width="100%" height="10px" ' + + 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />'; + tinyMCE.execCommand("mceInsertContent",true,html); + tinyMCE.selectedInstance.repaint(); + return true; + + case "wpHelp": + var template = new Array(); + + template['file'] = tinyMCE.baseURL + '/wp-mce-help.php'; + template['width'] = 480; + template['height'] = 380; + + args = { + resizable : 'yes', + scrollbars : 'yes' + }; + + tinyMCE.openWindow(template, args); + return true; + case "wpAdv": + var adv = document.getElementById('wpadvbar'); + if ( adv.style.display == 'none' ) { + adv.style.display = 'block'; + tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonSelected'); + } else { + adv.style.display = 'none'; + tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonNormal'); + } + return true; + } + + // Pass to next handler in chain + return false; + }, + + cleanup : function(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" name="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" name="mce_plugin_wordpress_page" />'; + content += contentAfter; + + startPos++; + } + + // Look for \n in <pre>, replace with <br> + var startPos = -1; + while ((startPos = content.indexOf('<pre', startPos+1)) != -1) { + var endPos = content.indexOf('</pre>', startPos+1); + var innerPos = content.indexOf('>', startPos+1); + var chunkBefore = content.substring(0, innerPos); + var chunkAfter = content.substring(endPos); + + var innards = content.substring(innerPos, endPos); + innards = innards.replace(/\n/g, '<br />'); + content = chunkBefore + innards + chunkAfter; + } + + 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 = this._parseAttributes(content.substring(startPos + 4, endPos)); + + if (attribs['class'] == "mce_plugin_wordpress_more" || attribs['name'] == "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" || attribs['name'] == "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; + } + } + + // Remove normal line breaks + content = content.replace(/\n|\r/g, ' '); + + // Look for <br> in <pre>, replace with \n + var startPos = -1; + while ((startPos = content.indexOf('<pre', startPos+1)) != -1) { + var endPos = content.indexOf('</pre>', startPos+1); + var innerPos = content.indexOf('>', startPos+1); + var chunkBefore = content.substring(0, innerPos); + var chunkAfter = content.substring(endPos); + + var innards = content.substring(innerPos, endPos); + innards = innards.replace(new RegExp('<br\\s?/?>', 'g'), '\n'); + innards = innards.replace(new RegExp('\\s$', ''), ''); + content = chunkBefore + innards + chunkAfter; + } + + // Remove anonymous, empty paragraphs. + content = content.replace(new RegExp('<p>(\\s| )*</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; + }, + + handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { + + tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonNormal'); + tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonNormal'); + + if (node == null) + return; + + do { + if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0) + tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonSelected'); + if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0) + tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonSelected'); + } while ((node = node.parentNode)); + + return true; + }, + + saveCallback : function(el, content, body) { + // We have a TON of cleanup to do. + + // Mark </p> if it has any attributes. + content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>'); + + // Decode the ampersands of time. + // content = content.replace(new RegExp('&', 'g'), '&'); + + // Get it ready for wpautop. + content = content.replace(new RegExp('[\\s]*<p>[\\s]*', 'mgi'), ''); + content = content.replace(new RegExp('[\\s]*</p>[\\s]*', 'mgi'), '\n\n'); + content = content.replace(new RegExp('\\n\\s*\\n\\s*\\n*', 'mgi'), '\n\n'); + content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); + + // Fix some block element newline issues + var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre'; + content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); + content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n'); + content = content.replace(new RegExp('<li>', 'g'), '\t<li>'); + + // Unmark special paragraph closing tags + content = content.replace(new RegExp('</p#>', 'g'), '</p>\n'); + content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1'); + + // Trim any whitespace + content = content.replace(new RegExp('^\\s*', ''), ''); + content = content.replace(new RegExp('\\s*$', ''), ''); + + // Hope. + return content; + + }, + + _parseAttributes : function(attribute_string) { + var attributeName = ""; + var attributeValue = ""; + var withInName; + var withInValue; + var attributes = new Array(); + var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g'); + var titleText = tinyMCE.getLang('lang_wordpress_more'); + var titleTextPage = tinyMCE.getLang('lang_wordpress_page'); + + if (attribute_string == null || attribute_string.length < 2) + return null; + + withInName = withInValue = false; + + for (var i=0; i<attribute_string.length; i++) { + var chr = attribute_string.charAt(i); + + if ((chr == '"' || chr == "'") && !withInValue) + withInValue = true; + else if ((chr == '"' || chr == "'") && withInValue) { + withInValue = false; + + var pos = attributeName.lastIndexOf(' '); + if (pos != -1) + attributeName = attributeName.substring(pos+1); + + attributes[attributeName.toLowerCase()] = attributeValue.substring(1).toLowerCase(); + + attributeName = ""; + attributeValue = ""; + } else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue) + withInName = true; + + if (chr == '=' && withInName) + withInName = false; + + if (withInName) + attributeName += chr; + + if (withInValue) + attributeValue += chr; + } + + return attributes; + } +}; + +tinyMCE.addPlugin("wordpress", TinyMCE_wordpressPlugin); + +/* This little hack protects our More and Page placeholders from the removeformat command */ +tinyMCE.orgExecCommand = tinyMCE.execCommand; +tinyMCE.execCommand = function (command, user_interface, value) { + re = this.orgExecCommand(command, user_interface, value); + + if ( command == 'removeformat' ) { + var inst = tinyMCE.getInstanceById('mce_editor_0'); + doc = inst.getDoc(); + var imgs = doc.getElementsByTagName('img'); + for (i=0;img=imgs[i];i++) + img.className = img.name; + } + return re; +}; + +tinyMCE.orgFixGeckoBaseHREFBug = tinyMCE.fixGeckoBaseHREFBug; +tinyMCE.fixGeckoBaseHREFBug = function(m, e, h) { + if ( tinyMCE.isGecko && m == 1 ) + h = h.replace(new RegExp('<((a|img|select|area|iframe|base|input|script|embed|object|link)\\s([^>]*\\s)?)(src|href)\\s*=', 'gi'), '<$1 x$4='); + else + h = tinyMCE.orgFixGeckoBaseHREFBug(m, e, h); + + return h; +}; + +tinyMCE.orgStoreAwayURLs = tinyMCE.storeAwayURLs; +tinyMCE.storeAwayURLs = function(s) { + // Remove all mce_src, mce_href and replace them with new ones + s = s.replace(new RegExp('mce_(href|src)\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); + s = s.replace(new RegExp('<((a|img|select|area|iframe|base|input|script|embed|object|link)\\s([^>]*\\s)?)(src|href)\\s*=\\s*"([^"]*)"', 'gi'), '<$1 $4="$5" mce_$4="$5"'); + + return s; +}; diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/help.gif b/wp-includes/js/tinymce/plugins/wordpress/images/help.gif Binary files differnew file mode 100644 index 0000000..51a1ee4 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/images/help.gif diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/more.gif b/wp-includes/js/tinymce/plugins/wordpress/images/more.gif Binary files differnew file mode 100644 index 0000000..4ff564d --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/images/more.gif diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/more_bug.gif b/wp-includes/js/tinymce/plugins/wordpress/images/more_bug.gif Binary files differnew file mode 100644 index 0000000..4589cb4 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/images/more_bug.gif diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/page.gif b/wp-includes/js/tinymce/plugins/wordpress/images/page.gif Binary files differnew file mode 100644 index 0000000..1cea78a --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/images/page.gif diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/page_bug.gif b/wp-includes/js/tinymce/plugins/wordpress/images/page_bug.gif Binary files differnew file mode 100644 index 0000000..9ea3565 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/images/page_bug.gif diff --git a/wp-includes/js/tinymce/plugins/wordpress/images/toolbars.gif b/wp-includes/js/tinymce/plugins/wordpress/images/toolbars.gif Binary files differnew file mode 100755 index 0000000..dcb7066 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/images/toolbars.gif diff --git a/wp-includes/js/tinymce/plugins/wordpress/langs/en.js b/wp-includes/js/tinymce/plugins/wordpress/langs/en.js new file mode 100644 index 0000000..f38e89d --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/langs/en.js @@ -0,0 +1,33 @@ +// EN lang variables
+
+if (navigator.userAgent.indexOf('Mac OS') != -1) {
+// Mac OS browsers use Ctrl to hit accesskeys
+ var metaKey = 'Ctrl';
+}
+else {
+ var metaKey = 'Alt';
+}
+
+tinyMCE.addToLang('',{
+wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)',
+wordpress_page_button : 'Split post with Page tag',
+wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+b)',
+wordpress_more_alt : 'More...',
+wordpress_page_alt : '...page...',
+help_button_title : 'Help (' + metaKey + '+h)',
+bold_desc : 'Bold (Ctrl+B)',
+italic_desc : 'Italic (Ctrl+I)',
+underline_desc : 'Underline (Ctrl+U)',
+link_desc : 'Insert/edit link (' + metaKey + '+a)',
+unlink_desc : 'Unlink (' + metaKey + '+s)',
+image_desc : 'Insert/edit image (' + metaKey + '+m)',
+striketrough_desc : 'Strikethrough (' + metaKey + '+k)',
+justifyleft_desc : 'Align left (' + metaKey + '+f)',
+justifycenter_desc : 'Align center (' + metaKey + '+c)',
+justifyright_desc : 'Align right (' + metaKey + '+r)',
+justifyfull_desc : 'Align full (' + metaKey + '+j)',
+bullist_desc : 'Unordered list (' + metaKey + '+l)',
+numlist_desc : 'Ordered list (' + metaKey + '+o)',
+outdent_desc : 'Outdent (' + metaKey + '+w)',
+indent_desc : 'Indent List/Blockquote (' + metaKey + '+q)'
+});
diff --git a/wp-includes/js/tinymce/plugins/wordpress/popups.css b/wp-includes/js/tinymce/plugins/wordpress/popups.css new file mode 100644 index 0000000..2d97665 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/popups.css @@ -0,0 +1,354 @@ +/* This file contains the CSS data for all popups in TinyMCE */ + +body { + background-color: #F0F0EE; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + scrollbar-3dlight-color: #F0F0EE; + scrollbar-arrow-color: #676662; + scrollbar-base-color: #F0F0EE; + scrollbar-darkshadow-color: #DDDDDD; + scrollbar-face-color: #E0E0DD; + scrollbar-highlight-color: #F0F0EE; + scrollbar-shadow-color: #F0F0EE; + scrollbar-track-color: #F5F5F5; + margin: 8px; +} + +td { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; +} + +input { + background: #FFFFFF; + border: 1px solid #cccccc; +} + +td, input, select, textarea { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10px; +} + +input, select, textarea { + border: 1px solid #808080; +} + +.input_noborder { + border: 0; +} + +#insert, .updateButton { + font-weight: bold; + width: 90px; + height: 21px; + border: 0; + background-image: url('../images/insert_button_bg.gif'); + cursor: pointer; +} + +#cancel { + font-weight: bold; + width: 90px; + height: 21px; + border: 0; + background-image: url('../images/cancel_button_bg.gif'); + cursor: pointer; +} + +/* Mozilla only style */ +html>body #insert, html>body #cancel { + padding-bottom: 2px; +} + +.title { + display: block; + padding-top: 5px; + padding-bottom: 5px; + padding-left: 15px; + font-size: 15px; +} + + +table.charmap { + border-style: solid; + border-width: 1px; + border-color: #AAAAAA; +} + +td.charmap, td.charmapOver { + color: #000000; + border-color: #AAAAAA; + border-style: solid; + border-width: 1px; + text-align: center; + font-size: 12px; +} + +td.charmapOver { + background-color: #CCCCCC; + cursor: default; +} + +a.charmap { + color: #000000; + text-decoration: none +} + +.wordWrapCode { + vertical-align: middle; + border: 1px none #000000; + background-color: transparent; +} + +input.radio { + border: 1px none #000000; + background-color: transparent; + vertical-align: middle; +} + +input.checkbox { + border: 1px none #000000; + background-color: transparent; + vertical-align: middle; +} + +.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected { + margin-left: 1px; +} + +.mceButtonNormal { + border-top: 1px solid; + border-left: 1px solid; + border-bottom: 1px solid; + border-right: 1px solid; + border-color: #F0F0EE; + cursor: default; +} + +.mceButtonOver { + border: 1px solid #0A246A; + cursor: default; + background-color: #B6BDD2; +} + +.mceButtonDown { + cursor: default; + border: 1px solid #0A246A; + background-color: #8592B5; +} + +.mceButtonDisabled { + filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); + -moz-opacity:0.3; + opacity: 0.3; + border-top: 1px solid; + border-left: 1px solid; + border-bottom: 1px solid; + border-right: 1px solid; + border-color: #F0F0EE; + cursor: default; +} + +.mceActionPanel { + margin-top: 5px; +} + +/* Tabs classes */ + +.tabs { + float: left; + width: 100%; + line-height: normal; + background-image: url("../images/xp/tabs_bg.gif"); +} + +.tabs ul { + margin: 0; + padding: 0 0 0; + list-style: none; +} + +.tabs li { + float: left; + background: url("../images/xp/tab_bg.gif") no-repeat left top; + margin: 0; + margin-left: 0; + margin-right: 2px; + padding: 0 0 0 10px; + line-height: 18px; +} + +.tabs li.current { + background: url("../images/xp/tab_sel_bg.gif") no-repeat left top; + margin-right: 2px; +} + +.tabs span { + float: left; + display: block; + background: url("../images/xp/tab_end.gif") no-repeat right top; + padding: 0px 10px 0 0; +} + +.tabs .current span { + background: url("../images/xp/tab_sel_end.gif") no-repeat right top; +} + +.tabs a { + text-decoration: none; + font-family: Verdana, Arial; + font-size: 10px; +} + +.tabs a:link, .tabs a:visited, .tabs a:hover { + color: black; +} + +.tabs a:hover { +} + +.tabs .current { +} + +.tabs .current a, .tabs .current a:link, .tabs .current a:visited { +} + +.panel_wrapper div.panel { + display: none; +} + +.panel_wrapper div.current { + display: block; + width: 100%; + height: 300px; + overflow: visible; /* Should be auto but that breaks Safari */ +} + +.panel_wrapper { + border: 1px solid #919B9C; + border-top: 0px; + padding: 10px; + padding-top: 5px; + clear: both; + background-color: white; +} + +fieldset { + border: 1px solid #919B9C; + font-family: Verdana, Arial; + font-size: 10px; + padding: 0; + margin: 0; + padding: 4px; +} + +legend { + color: #2B6FB6; + font-weight: bold; +} + +.properties { + width: 100%; +} + +.properties .column1 { +} + +.properties .column2 { + text-align: left; +} + +a:link, a:visited { + color: black; +} + +a:hover { + color: #2B6FB6; +} + +#plugintable thead { + font-weight: bold; + background-color: #DDDDDD; +} + +#plugintable, #about #plugintable td { + border: 1px solid #919B9C; +} + +#plugintable { + width: 99%; + margin-top: 10px; +} + +#pluginscontainer { + height: 290px; + overflow: auto; +} + +/* MSIE Specific styles */ + +* html .panel_wrapper { + width: 100%; +} + +.column { + float: left; +} + +h1, h2, h3, h4 { + color: #2B6FB6; + margin: 0; + padding: 0; + padding-top: 5px; +} + +h3 { + font-size: 14px; +} + +#link .panel_wrapper, #link div.current { + height: 125px; +} + +#image .panel_wrapper, #image div.current { + height: 190px; +} + +/* Disables the advanced tab in the table plugin. */ +/* +#table #advanced_tab { + display: none; +} +*/ + +/* Disables the border input field and label in the table plugin. */ +/* +#table #border, #table #borderlabel { + display: none; +} +*/ + +#insert, #cancel, .submitbutton { + font: 13px Verdana, Arial, Helvetica, sans-serif; + height: auto; + width: auto; + background-color: transparent; + background-image: url(../../../../../wp-admin/images/fade-butt.png); + background-repeat: repeat; + border: 3px double; + border-right-color: rgb(153, 153, 153); + border-bottom-color: rgb(153, 153, 153); + border-left-color: rgb(204, 204, 204); + border-top-color: rgb(204, 204, 204); + color: rgb(51, 51, 51); + padding: 0.25em 0.75em; +} + +#insert:active, #cancel:active, .submitbutton:active { + background: #f4f4f4; + border-left-color: #999; + border-top-color: #999; +} + + diff --git a/wp-includes/js/tinymce/plugins/wordpress/wordpress.css b/wp-includes/js/tinymce/plugins/wordpress/wordpress.css new file mode 100644 index 0000000..3698741 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wordpress/wordpress.css @@ -0,0 +1,84 @@ +.mce_plugin_wordpress_more {
+ border: 0px;
+ border-top: 1px dotted #cccccc;
+ display:block;
+ background-color: #ffffff;
+ margin-top:15px;
+ background-image: url(images/more_bug.gif);
+ background-repeat: no-repeat;
+ background-position: right top;
+}
+
+.mce_plugin_wordpress_page {
+ border: 0px;
+ border-top: 1px dotted #cccccc;
+ display:block;
+ background-color: #ffffff;
+ margin-top:15px;
+ background-image: url(images/page_bug.gif);
+ background-repeat: no-repeat;
+ background-position: right top;
+}
+
+/* This file contains the CSS data for the editable area(iframe) of TinyMCE */
+/* You can extend this CSS by adding your own CSS file with the the content_css option */
+
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 0.9em;
+ line-height: 1.2em;
+ padding: .3em;
+ background-color: #FFFFFF;
+}
+
+td {
+ font-size: 10px;
+}
+
+pre {
+ font-family: "Courier New", fixed;
+ font-size: 11px;
+ line-height: 13px;
+}
+
+.mceVisualAid {
+ border: 1px dashed #BBBBBB !important;
+}
+
+.mceItemAnchor {
+ width: 12px;
+ line-height: 6px;
+ overflow: hidden;
+ padding-left: 12px;
+ background-image: url('../images/anchor_symbol.gif');
+ background-position: bottom;
+ background-repeat: no-repeat;
+}
+
+/* Important is needed in Gecko browsers inorder to style links */
+/*
+a {
+ color: green !important;
+}
+*/
+
+/* Style selection range colors in Gecko browsers */
+/*
+::-moz-selection {
+ background-color: red;
+ color: green;
+}
+*/
+
+/* MSIE specific */
+
+* html body {
+ scrollbar-3dlight-color: #F0F0EE;
+ scrollbar-arrow-color: #676662;
+ scrollbar-base-color: #F0F0EE;
+ scrollbar-darkshadow-color: #DDDDDD;
+ scrollbar-face-color: #E0E0DD;
+ scrollbar-highlight-color: #F0F0EE;
+ scrollbar-shadow-color: #F0F0EE;
+ scrollbar-track-color: #F5F5F5;
+}
\ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/wphelp/editor_plugin.js b/wp-includes/js/tinymce/plugins/wphelp/editor_plugin.js new file mode 100644 index 0000000..204e447 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wphelp/editor_plugin.js @@ -0,0 +1,57 @@ +/* Import plugin specific language pack */
+tinyMCE.importPluginLanguagePack('wphelp', '');
+
+function TinyMCE_wphelp_getControlHTML(control_name) {
+ switch (control_name) {
+ case "wphelp":
+ var titleHelp = tinyMCE.getLang('lang_help_button_title');
+ var buttons = '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\');return false;"><img id="{$editor_id}_help" src="{$pluginurl}/images/help.gif" title="'+titleHelp+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
+ var hiddenControls = '<div class="zerosize">'
+ + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
+ + '<input type="button" accesskey="i" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Italic\',false);" />'
+ + '<input type="button" accesskey="d" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
+ + '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
+ + '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
+ + '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
+ + '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />'
+ + '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />'
+ + '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />'
+ + '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />'
+ + '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
+ + '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />'
+ + '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />'
+ + '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');" />'
+ + '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
+ + '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
+ + '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
+ + '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\',false);" />'
+ + '</div>';
+ return buttons+hiddenControls;
+ }
+
+ return "";
+}
+
+function TinyMCE_wphelp_execCommand(editor_id, element, command, user_interface, value) {
+
+ // Handle commands
+ switch (command) {
+ case "mceWordPressHelp":
+ var template = new Array();
+
+ template['file'] = tinyMCE.baseURL + '/wp-mce-help.php';
+ template['width'] = 480;
+ template['height'] = 380;
+
+ args = {
+ resizable : 'yes',
+ scrollbars : 'yes'
+ };
+
+ tinyMCE.openWindow(template, args);
+ return true;
+ }
+
+ // Pass to next handler in chain
+ return false;
+}
diff --git a/wp-includes/js/tinymce/plugins/wphelp/images/help.gif b/wp-includes/js/tinymce/plugins/wphelp/images/help.gif Binary files differnew file mode 100644 index 0000000..51a1ee4 --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wphelp/images/help.gif diff --git a/wp-includes/js/tinymce/plugins/wphelp/langs/en.js b/wp-includes/js/tinymce/plugins/wphelp/langs/en.js new file mode 100644 index 0000000..b7b2aba --- /dev/null +++ b/wp-includes/js/tinymce/plugins/wphelp/langs/en.js @@ -0,0 +1,5 @@ +// EN lang variables
+
+tinyMCE.addToLang('',{
+help_button_title : 'Help (Alt+h)'
+});
|