TinyMCE fixes from azaozz. fixes #6272

git-svn-id: http://svn.automattic.com/wordpress/trunk@7378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-03-18 06:59:53 +00:00
parent c700c87195
commit b530b3b7dc
20 changed files with 147 additions and 65 deletions

View File

@ -26,14 +26,16 @@ switchEditors = {
pre_wpautop : function(content) { pre_wpautop : function(content) {
// We have a TON of cleanup to do. // We have a TON of cleanup to do.
// Remove anonymous, empty paragraphs.
content = content.replace(new RegExp('<p>(\\s|&nbsp;|<br />)*</p>', 'mg'), '');
// Mark </p> if it has any attributes. // Mark </p> if it has any attributes.
content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>'); content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>');
//content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '</p>\n\n');
//content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '<br />\n');
//content = content.replace(new RegExp('( )+', 'g'), ' ');
// Get it ready for wpautop. // Get it ready for wpautop.
content = content.replace(new RegExp('\\s*<p>', 'mgi'), ''); content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'g'), '<div$1>\n\n');
content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n'); content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');

View File

@ -37,10 +37,10 @@ date_fmt:"' . mce_escape( __('%Y-%m-%d') ) . '",
time_fmt:"' . mce_escape( __('%H:%M:%S') ) . '", time_fmt:"' . mce_escape( __('%H:%M:%S') ) . '",
insertdate_desc:"' . mce_escape( __('Insert date') ) . '", insertdate_desc:"' . mce_escape( __('Insert date') ) . '",
inserttime_desc:"' . mce_escape( __('Insert time') ) . '", inserttime_desc:"' . mce_escape( __('Insert time') ) . '",
months_long:"' . mce_escape( __('January').','.__('February').','.__('March').','.__('April').','.__('May').','.__('June').','.__('July').','.__('August').','.__('September').','.__('October').','.__('November').','.__('December') ) . '", months_long:"' . mce_escape( _c('January,February,March,April,May,June,July,August,September,October,November,December|Comma separated list of the months. No spaces between them.') ) . '",
months_short:"' . mce_escape( __('Jan_January_abbreviation').','.__('Feb_February_abbreviation').','.__('Mar_March_abbreviation').','.__('Apr_April_abbreviation').','.__('May_May_abbreviation').','.__('Jun_June_abbreviation').','.__('Jul_July_abbreviation').','.__('Aug_August_abbreviation').','.__('Sep_September_abbreviation').','.__('Oct_October_abbreviation').','.__('Nov_November_abbreviation').','.__('Dec_December_abbreviation') ) . '", months_short:"' . mce_escape( _c('Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec|Comma separated list of the abbreviated names of the months. No spaces between them.') ) . '",
day_long:"' . mce_escape( __('Sunday').','.__('Monday').','.__('Tuesday').','.__('Wednesday').','.__('Thursday').','.__('Friday').','.__('Saturday') ) . '", day_long:"' . mce_escape( _c('Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday|Comma separated list of the days of the week. No spaces between them.') ) . '",
day_short:"' . mce_escape( __('Sun').','.__('Mon').','.__('Tue').','.__('Wed').','.__('Thu').','.__('Fri').','.__('Sat') ) . '" day_short:"' . mce_escape( _c('Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun|Comma separated list of the abbreviated names for the days of the week. No spaces between them.') ) . '"
}, },
print:{ print:{
print_desc:"' . mce_escape( __('Print') ) . '" print_desc:"' . mce_escape( __('Print') ) . '"
@ -390,7 +390,7 @@ flv_jscallback:"' . mce_escape( __('JS Callback') ) . '"
}); });
tinyMCE.addI18n("' . $language . '.wordpress",{ tinyMCE.addI18n("' . $language . '.wordpress",{
wp_adv_desc:"' . mce_escape( __('Show/Hide Kitchen Sink') ) . ' (Alt+Shift+Z)", wp_adv_desc:"' . mce_escape( __('Show/Hide Advanced Toolbar') ) . ' (Alt+Shift+Z)",
wp_more_desc:"' . mce_escape( __('Insert More tag') ) . ' (Alt+Shift+T)", wp_more_desc:"' . mce_escape( __('Insert More tag') ) . ' (Alt+Shift+T)",
wp_page_desc:"' . mce_escape( __('Insert Page break') ) . ' (Alt+Shift+P)", wp_page_desc:"' . mce_escape( __('Insert Page break') ) . ' (Alt+Shift+P)",
wp_help_desc:"' . mce_escape( __('Help') ) . ' (Alt+Shift+H)", wp_help_desc:"' . mce_escape( __('Help') ) . ' (Alt+Shift+H)",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,7 @@
<option value="flash">Flash</option> <option value="flash">Flash</option>
<!-- <option value="flv">Flash video (FLV)</option> --> <!-- <option value="flv">Flash video (FLV)</option> -->
<option value="qt">Quicktime</option> <option value="qt">Quicktime</option>
<option value="shockwave">Shockwave</option> <option value="shockwave">Shockware</option>
<option value="wmp">Windows Media</option> <option value="wmp">Windows Media</option>
<option value="rmp">Real Media</option> <option value="rmp">Real Media</option>
</select> </select>
@ -812,11 +812,11 @@
<div class="mceActionPanel"> <div class="mceActionPanel">
<div style="float: left"> <div style="float: left">
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> <input type="submit" id="insert" name="insert" value="{#insert}" />
</div> </div>
<div style="float: right"> <div style="float: right">
<input type="submit" id="insert" name="insert" value="{#insert}" /> <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div> </div>
</div> </div>
</form> </form>

File diff suppressed because one or more lines are too long

View File

@ -45,7 +45,8 @@
}); });
ed.onInit.add(function() { ed.onInit.add(function() {
ed.dom.loadCSS(url + '/css/content.css'); if (ed.settings.content_css !== false)
ed.dom.loadCSS(url + '/css/content.css');
}); });
ed.onClick.add(t._showMenu, t); ed.onClick.add(t._showMenu, t);
@ -227,7 +228,7 @@
m = ed.controlManager.createDropMenu('spellcheckermenu', { m = ed.controlManager.createDropMenu('spellcheckermenu', {
offset_x : p1.x, offset_x : p1.x,
offset_y : p1.y, offset_y : p1.y,
'class' : 'noIcons' 'class' : 'mceNoIcons'
}); });
t._menu = m; t._menu = m;

View File

@ -102,6 +102,10 @@
// Add listeners to handle more break // Add listeners to handle more break
t._handleMoreBreak(ed, url); t._handleMoreBreak(ed, url);
ed.onPostProcess.add(function(se, o) {
o.content = o.content.replace(/\r?\n/g, ' ');
});
// Add custom shortcuts // Add custom shortcuts
ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter'); ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter');
ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight'); ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight');

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@ tinyMCEPopup.requireLangPack();
var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
var colors = new Array( var colors = [
"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099", "#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff", "#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
@ -30,7 +30,7 @@ var colors = new Array(
"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33", "#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99", "#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
); ];
var named = { var named = {
'#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',

View File

@ -116,7 +116,7 @@ var LinkDialog = {
if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) {
tinymce.each(v.split(','), function(v) { tinymce.each(v.split(','), function(v) {
v = v.split('='); v = v.split('=');
html += '<option value="' + v[1] + '">' + v[0] + '</option>'; lst.options[lst.options.length] = new Option(v[0], v[1]);
}); });
} }
} }

View File

@ -76,8 +76,8 @@
.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} .defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} .defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}
.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A} .defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A}
.defaultSkin .mceColorPreview {position:absolute; top:15px; left:2px; width:16px; height:4px; overflow:hidden} .defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a}
.defaultSkin .mce_forecolor, .defaultSkin .mce_backcolor {position:relative} .defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px}
/* Menu */ /* Menu */
.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8} .defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8}

View File

@ -77,8 +77,8 @@
.o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF} .o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
.o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2} .o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}
.o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A} .o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A}
.o2k7Skin .mceColorPreview {position:absolute; top:15px; left:2px; width:16px; height:4px; overflow:hidden} .o2k7Skin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a}
.o2k7Skin .mce_forecolor, .o2k7Skin .mce_backcolor {position:relative} .o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px}
/* Menu */ /* Menu */
.o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD} .o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD}

View File

@ -1,6 +1,13 @@
body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px; } body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
body.mceContentBody {background:#FFF; color:#000;} body {background:#FFF;}
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceVisualAid {border: 1px dashed #BBB;} body.mceForceColors {background:#FFF; color:#000;}
h1 {font-size: 2em}
h2 {font-size: 1.5em}
h3 {font-size: 1.17em}
h4 {font-size: 1em}
h5 {font-size: .83em}
h6 {font-size: .75em}
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;} a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;}
img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;} img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;}
img {border:0;} img {border:0;}

View File

@ -247,6 +247,18 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
.wp_themeSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px} .wp_themeSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
.wp_themeSkin .mcePlaceHolder {border:1px dotted gray} .wp_themeSkin .mcePlaceHolder {border:1px dotted gray}
/* Formats */
.wp_themeSkin .mce_formatPreview a {font-size:10px}
.wp_themeSkin .mce_p span.mceText {}
.wp_themeSkin .mce_address span.mceText {font-style:italic}
.wp_themeSkin .mce_pre span.mceText {font-family:monospace}
.wp_themeSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}
.wp_themeSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}
.wp_themeSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}
.wp_themeSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}
.wp_themeSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}
.wp_themeSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}
/* Theme */ /* Theme */
.wp_themeSkin span.mce_bold {background-position:0 0} .wp_themeSkin span.mce_bold {background-position:0 0}
.wp_themeSkin span.mce_italic {background-position:-60px 0} .wp_themeSkin span.mce_italic {background-position:-60px 0}

File diff suppressed because one or more lines are too long

View File

@ -53,6 +53,8 @@ $mce_css = $baseurl . '/wordpress.css';
$mce_css = apply_filters('mce_css', $mce_css); $mce_css = apply_filters('mce_css', $mce_css);
if ( $https ) str_replace('http://', 'https://', $mce_css); if ( $https ) str_replace('http://', 'https://', $mce_css);
$mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
/* /*
Setting mce_valid_elements to *[*] skips all of the internal cleanup and can cause problems. Setting mce_valid_elements to *[*] skips all of the internal cleanup and can cause problems.
The minimal setting would be -strong/-b[*],-em/-i[*],*[*]. The minimal setting would be -strong/-b[*],-em/-i[*],*[*].
@ -69,8 +71,7 @@ $extended_valid_elements = apply_filters('mce_extended_valid_elements', $extende
/* /*
The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu. The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server. By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
The + sign marks the default language. The + sign marks the default language. More information:
More information:
http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
*/ */
$mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv'); $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');
@ -78,19 +79,49 @@ $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+Engl
$plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen' ); $plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen' );
/* /*
The following filter takes an associative array of external plugins for TinyMCE in the form "name" => "url". The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin. It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin.
The url should be absolute and should include the js file name to be loaded. The url should be absolute and should include the js file name to be loaded. Example:
Example: array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' ). array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
If the plugin uses a button, it should be added with one of the "$mce_buttons" filters. If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
*/ */
$mce_external_plugins = apply_filters('mce_external_plugins', array()); $mce_external_plugins = apply_filters('mce_external_plugins', array());
$ext_plugins = "\n"; $ext_plugins = "\n";
if ( ! empty($mce_external_plugins) ) { if ( ! empty($mce_external_plugins) ) {
/*
The following filter loads external language files for TinyMCE plugins.
It takes an associative array 'plugin_name' => 'path', where path is the
include path to the file. The language file should follow the same format as
/tinymce/langs/wp-langs.php and should define a variable $strings that
holds all translated strings. Example:
$strings = 'tinyMCE.addI18n("' . $mce_locale . '.mypluginname_dlg",{tab_general:"General", ... })';
*/
$mce_external_languages = apply_filters('mce_external_languages', array());
$loaded_langs = array();
$strings = '';
if ( ! empty($mce_external_languages) ) {
foreach ( $mce_external_languages as $name => $path ) {
$loaded_langs[] = $name;
if ( is_file($path) ) include_once($path);
$ext_plugins .= $strings;
}
}
foreach ( $mce_external_plugins as $name => $url ) { foreach ( $mce_external_plugins as $name => $url ) {
if ( $https ) str_replace('http://', 'https://', $url); if ( $https ) str_replace('http://', 'https://', $url);
$plugins[] = '-' . $name; $plugins[] = '-' . $name;
if ( in_array($name, $loaded_langs) ) {
$plugurl = dirname($url);
$ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
}
$ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n"; $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
} }
} }
@ -108,8 +139,6 @@ $mce_buttons_3 = implode($mce_buttons_3, ',');
$mce_buttons_4 = apply_filters('mce_buttons_4', array()); $mce_buttons_4 = apply_filters('mce_buttons_4', array());
$mce_buttons_4 = implode($mce_buttons_4, ','); $mce_buttons_4 = implode($mce_buttons_4, ',');
$mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
// TinyMCE init settings // TinyMCE init settings
$initArray = array ( $initArray = array (
'mode' => 'none', 'mode' => 'none',
@ -145,7 +174,7 @@ $initArray = array (
); );
if ( $valid_elements ) $initArray['valid_elements'] = $valid_elements; if ( $valid_elements ) $initArray['valid_elements'] = $valid_elements;
if ( $extended_valid_elements ) $initArray['extended_valid_elements'] = $extended_valid_elements; //if ( $extended_valid_elements ) $initArray['extended_valid_elements'] = $extended_valid_elements;
if ( $invalid_elements ) $initArray['invalid_elements'] = $invalid_elements; if ( $invalid_elements ) $initArray['invalid_elements'] = $invalid_elements;
// For people who really REALLY know what they're doing with TinyMCE // For people who really REALLY know what they're doing with TinyMCE
@ -178,18 +207,14 @@ if ( $disk_cache && ! is_dir($cache_path) )
$disk_cache = wp_mkdir_p($cache_path); $disk_cache = wp_mkdir_p($cache_path);
$cache_ext = '.js'; $cache_ext = '.js';
$plugins = explode( ',', $initArray['plugins'] ); $plugins = explode( ',', $initArray['plugins'] );
$theme = ( 'simple' == $initArray['theme'] ) ? 'simple' : 'advanced'; $theme = ( 'simple' == $initArray['theme'] ) ? 'simple' : 'advanced';
$language = isset($initArray['language']) ? substr( $initArray['language'], 0, 2 ) : 'en'; $language = isset($initArray['language']) ? substr( $initArray['language'], 0, 2 ) : 'en';
$enc = $cacheKey = $suffix = $mce_options = ''; $cacheKey = $mce_options = '';
// Check if browser supports gzip // Check if browser supports gzip
if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
$encodings = explode( ',', strtolower( preg_replace('/\s+/', '', $_SERVER['HTTP_ACCEPT_ENCODING']) ) ); if ( ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') || isset($_SERVER['---------------']) ) && function_exists('gzencode') && ! ini_get('zlib.output_compression') ) {
if ( (in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------']) ) && function_exists('ob_gzhandler') && (ini_get('zlib.output_compression') == false) ) {
$enc = in_array('x-gzip', $encodings) ? 'x-gzip' : 'gzip';
$cache_ext = '.gz'; $cache_ext = '.gz';
} }
} }
@ -197,24 +222,45 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
// Setup cache info // Setup cache info
if ( $disk_cache ) { if ( $disk_cache ) {
$ver = isset($_GET['ver']) ? (int) $_GET['ver'] : ''; $cacheKey = apply_filters('tiny_mce_version', '20080317');
$cacheKey = $suffix . $ver;
foreach ( $initArray as $v ) foreach ( $initArray as $v )
$cacheKey .= $v; $cacheKey .= $v;
if ( ! empty($mce_external_plugins) ) {
foreach ( $mce_external_plugins as $n => $v )
$cacheKey .= $n;
}
$cacheKey = md5( $cacheKey ); $cacheKey = md5( $cacheKey );
$cache_file = $cache_path . '/tinymce_' . $cacheKey . $cache_ext; $cache_file = $cache_path . '/tinymce_' . $cacheKey . $cache_ext;
} }
cache_javascript_headers(); $expiresOffset = 864000; // 10 days
header( 'Content-Type: application/x-javascript; charset=UTF-8' );
header( 'Vary: Accept-Encoding' ); // Handle proxies
header( 'Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . ' GMT' );
// Use cached file if exists // Use cached file if exists
if ( $disk_cache && file_exists($cache_file) ) { if ( $disk_cache && is_file($cache_file) ) {
if ( '.gz' == $cache_ext )
header( 'Content-Encoding: ' . $enc );
echo getFileContents( $cache_file ); $mtime = gmdate("D, d M Y H:i:s", filemtime($cache_file)) . " GMT";
if ( isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $mtime ) {
header('HTTP/1.1 304 Not Modified');
exit;
}
header("Last-Modified: " . $mtime);
header("Cache-Control: must-revalidate", false);
$content = getFileContents( $cache_file );
if ( '.gz' == $cache_ext )
header( 'Content-Encoding: gzip' );
header( 'Content-Length: ' . strlen($content) );
echo $content;
exit; exit;
} }
@ -224,13 +270,13 @@ foreach ( $initArray as $k => $v )
$mce_options .= $mce_deprecated1; $mce_options .= $mce_deprecated1;
$mce_options = rtrim( trim($mce_options), '\n\r,' ); $mce_options = rtrim( trim($mce_options), '\n\r,' );
$content .= 'var tinyMCEPreInit = { settings : { themes : "' . $theme . '", plugins : "' . $initArray['plugins'] . '", languages : "' . $language . '", debug : false }, base : "' . $baseurl . '", suffix : "' . $suffix . '" };'; $content = 'var tinyMCEPreInit = { settings : { themes : "' . $theme . '", plugins : "' . $initArray['plugins'] . '", languages : "' . $language . '", debug : false }, base : "' . $baseurl . '", suffix : "" };';
// Load patch // Load patch
$content .= getFileContents( 'tiny_mce_ext.js' ); $content .= getFileContents( 'tiny_mce_ext.js' );
// Add core // Add core
$content .= getFileContents( 'tiny_mce' . $suffix . '.js' ); $content .= getFileContents( 'tiny_mce.js' );
// Patch loading functions // Patch loading functions
$content .= 'tinyMCEPreInit.start();'; $content .= 'tinyMCEPreInit.start();';
@ -240,24 +286,21 @@ include_once( dirname(__FILE__).'/langs/wp-langs.php' );
$content .= $strings; $content .= $strings;
// Add themes // Add themes
$content .= getFileContents( 'themes/' . $theme . '/editor_template' . $suffix . '.js' ); $content .= getFileContents( 'themes/' . $theme . '/editor_template.js' );
// Add plugins // Add plugins
foreach ( $plugins as $plugin ) foreach ( $plugins as $plugin )
$content .= getFileContents( 'plugins/' . $plugin . '/editor_plugin' . $suffix . '.js' ); $content .= getFileContents( 'plugins/' . $plugin . '/editor_plugin.js' );
// Add external plugins and init // Add external plugins and init
$content .= $ext_plugins . 'tinyMCE.init({' . $mce_options . '});'; $content .= $ext_plugins . 'tinyMCE.init({' . $mce_options . '});';
// Generate GZIP'd content // Generate GZIP'd content
if ( '.gz' == $cache_ext ) { if ( '.gz' == $cache_ext ) {
header('Content-Encoding: ' . $enc); header('Content-Encoding: gzip');
$content = gzencode( $content, 9, FORCE_GZIP ); $content = gzencode( $content, 9, FORCE_GZIP );
} }
// Stream to client
echo $content;
// Write file // Write file
if ( '' != $cacheKey ) { if ( '' != $cacheKey ) {
if ( is_dir($cache_path) ) { if ( is_dir($cache_path) ) {
@ -272,7 +315,7 @@ if ( '' != $cacheKey ) {
closedir($handle); closedir($handle);
krsort($old_cache); krsort($old_cache);
if ( 1 >= (int) $old_cache_max ) $del_cache = $old_cache; if ( 1 >= $old_cache_max ) $del_cache = $old_cache;
else $del_cache = array_slice( $old_cache, ($old_cache_max - 1) ); else $del_cache = array_slice( $old_cache, ($old_cache_max - 1) );
foreach ( $del_cache as $key ) foreach ( $del_cache as $key )
@ -280,5 +323,13 @@ if ( '' != $cacheKey ) {
} }
putFileContents( $cache_file, $content ); putFileContents( $cache_file, $content );
$mtime = gmdate( "D, d M Y H:i:s", filemtime($cache_file) ) . " GMT";
header( 'Last-Modified: ' . $mtime );
} }
// Stream to client
header( 'Cache-Control: must-revalidate', false );
header( 'Content-Length: ' . strlen($content) );
echo $content;
?> ?>

View File

@ -27,3 +27,10 @@ tinyMCEPreInit.start = function() {
} }
}); });
}; };
tinyMCEPreInit.load_ext = function(url,lang) {
var sl = tinymce.ScriptLoader;
// sl.add(url + '/langs/lang.php');
sl.markDone(url + '/langs/' + lang + '.js');
sl.markDone(url + '/langs/' + lang + '_dlg.js');
};

View File

@ -10,23 +10,21 @@ header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
<?php <?php
wp_admin_css( 'css/global' ); wp_admin_css( 'css/global' );
wp_admin_css(); wp_admin_css();
wp_admin_css( 'css/colors' );
?> ?>
<style type="text/css"> <style type="text/css">
body { body {
background-color: #eaf3fa;
} }
#wphead { #wphead {
padding-top: 2px; padding-top: 2px;
padding-left: 15px; padding-left: 15px;
font-size: 80%; font-size: 80%;
border-top: 0; border-top: 0;
background-color: #eaf3fa;
} }
#adminmenu { #adminmenu {
padding-top: 2px; padding-top: 2px;
padding-left: 15px; padding-left: 15px;
font-size: 80%; font-size: 80%;
background-color: #eaf3fa;
} }
#user_info { #user_info {
right: 5%; right: 5%;

View File

@ -33,10 +33,10 @@ class WP_Scripts {
$visual_editor = apply_filters('visual_editor', array('tiny_mce')); $visual_editor = apply_filters('visual_editor', array('tiny_mce'));
$this->add( 'editor', false, $visual_editor, '20080218' ); $this->add( 'editor', false, $visual_editor, '20080218' );
$this->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080312' ); $this->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080317' );
// Modify this version when tinyMCE plugins are changed. // Modify this version when tinyMCE plugins are changed.
$mce_version = apply_filters('tiny_mce_version', '20080312'); $mce_version = apply_filters('tiny_mce_version', '20080317');
$this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');