}
public static function editor_settings($editor_id, $set) {
- global $editor_styles;
$first_run = false;
if ( empty(self::$first_init) ) {
$qtInit = array_merge($qtInit, $set['quicktags']);
if ( empty($qtInit['buttons']) )
- $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close';
+ $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
if ( $set['dfw'] )
$qtInit['buttons'] .= ',fullscreen';
self::$baseurl = includes_url('js/tinymce');
self::$mce_locale = $mce_locale = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) ); // only ISO 639-1
$no_captions = (bool) apply_filters( 'disable_captions', '' );
- $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
+ $plugins = array( 'inlinepopups', 'tabfocus', 'paste', 'media', 'fullscreen', 'wordpress', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
$first_run = true;
$ext_plugins = '';
self::$plugins = $plugins;
self::$ext_plugins = $ext_plugins;
- /*
- translators: These languages show up in the spellchecker drop-down menu, in the order specified, and with the first
- language listed being the default language. They must be comma-separated and take the format of name=code, where name
- is the language name (which you may internationalize), and code is a valid ISO 639 language code. Please test the
- spellchecker with your values.
- */
- $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' );
-
- /*
- 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.
- The + sign marks the default language. More: http://www.tinymce.com/wiki.php/Plugin:spellchecker.
- */
- $mce_spellchecker_languages = apply_filters( 'mce_spellchecker_languages', '+' . $mce_spellchecker_languages );
+ if ( in_array( 'spellchecker', $plugins ) ) {
+ /*
+ translators: These languages show up in the spellchecker drop-down menu, in the order specified, and with the first
+ language listed being the default language. They must be comma-separated and take the format of name=code, where name
+ is the language name (which you may internationalize), and code is a valid ISO 639 language code. Please test the
+ spellchecker with your values.
+ */
+ $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' );
+
+ /*
+ 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.
+ The + sign marks the default language. More: http://www.tinymce.com/wiki.php/Plugin:spellchecker.
+ */
+ $mce_spellchecker_languages = apply_filters( 'mce_spellchecker_languages', '+' . $mce_spellchecker_languages );
+ }
self::$first_init = array(
'mode' => 'exact',
'theme' => 'advanced',
'skin' => 'wp_theme',
'language' => self::$mce_locale,
- 'spellchecker_languages' => $mce_spellchecker_languages,
'theme_advanced_toolbar_location' => 'top',
'theme_advanced_toolbar_align' => 'left',
'theme_advanced_statusbar_location' => 'bottom',
'paste_strip_class_attributes' => 'all',
'paste_text_use_dialog' => true,
'webkit_fake_resize' => false,
- 'spellchecker_rpc_url' => self::$baseurl . '/plugins/spellchecker/rpc.php',
+ 'preview_styles' => 'font-family font-weight text-decoration text-transform',
'schema' => 'html5',
'wpeditimage_disable_captions' => $no_captions,
'wp_fullscreen_content_css' => self::$baseurl . '/plugins/wpfullscreen/css/wp-fullscreen.css',
'plugins' => implode( ',', $plugins )
);
+ if ( in_array( 'spellchecker', $plugins ) ) {
+ self::$first_init['spellchecker_rpc_url'] = self::$baseurl . '/plugins/spellchecker/rpc.php';
+ self::$first_init['spellchecker_languages'] = $mce_spellchecker_languages;
+ }
+
// load editor_style.css if the current theme supports it
- if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) {
+ if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) {
+ $editor_styles = $GLOBALS['editor_styles'];
+
$mce_css = array();
- $editor_styles = array_unique($editor_styles);
+ $editor_styles = array_unique( array_filter( $editor_styles ) );
$style_uri = get_stylesheet_directory_uri();
$style_dir = get_stylesheet_directory();
+ // Support externally referenced styles (like, say, fonts).
+ foreach ( $editor_styles as $key => $file ) {
+ if ( preg_match( '~^(https?:)?//~', $file ) ) {
+ $mce_css[] = esc_url_raw( $file );
+ unset( $editor_styles[ $key ] );
+ }
+ }
+
+ // Look in a parent theme first, that way child theme CSS overrides.
if ( is_child_theme() ) {
$template_uri = get_template_directory_uri();
$template_dir = get_template_directory();
$body_class = $editor_id;
- if ( $post = get_post() )
- $body_class .= ' post-type-' . $post->post_type;
+ if ( $post = get_post() ) {
+ $body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status );
+ if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
+ $post_format = get_post_format( $post );
+ if ( $post_format && ! is_wp_error( $post_format ) )
+ $body_class .= ' post-format-' . sanitize_html_class( $post_format );
+ else
+ $body_class .= ' post-format-standard';
+ }
+ }
if ( !empty($set['tinymce']['body_class']) ) {
$body_class .= ' ' . $set['tinymce']['body_class'];