diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index f1b53f156..2e22aa993 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1305,7 +1305,7 @@ function post_preview() { * @param mixed $settings optional An array that can add to or overwrite the default TinyMCE settings. */ function wp_tiny_mce( $teeny = false, $settings = false ) { - global $concatenate_scripts, $compress_scripts, $tinymce_version; + global $concatenate_scripts, $compress_scripts, $tinymce_version, $editor_styles; if ( ! user_can_richedit() ) return; @@ -1467,7 +1467,29 @@ function wp_tiny_mce( $teeny = false, $settings = false ) { 'plugins' => $plugins ); - $mce_css = trim(apply_filters('mce_css', ''), ' ,'); + if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) { + $mce_css = array(); + $style_uri = get_stylesheet_directory_uri(); + if ( TEMPLATEPATH == STYLESHEETPATH ) { + foreach ( $editor_styles as $file ) + $mce_css[] = "$style_uri/$file"; + } else { + $style_dir = get_stylesheet_directory(); + $template_uri = get_template_directory_uri(); + $template_dir = get_template_directory(); + foreach ( $editor_styles as $file ) { + if ( file_exists( "$style_dir/$file" ) ) + $mce_css[] = "$style_uri/$file"; + if ( file_exists( "$template_dir/$file" ) ) + $mce_css[] = "$template_uri/$file"; + } + } + $mce_css = implode( ',', $mce_css ); + } else { + $mce_css = ''; + } + + $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' ); if ( ! empty($mce_css) ) $initArray['content_css'] = $mce_css; diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 0e80fcb1e..6168facfc 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1465,35 +1465,10 @@ function add_editor_style( $stylesheet = 'editor-style.css' ) { if ( ! is_admin() ) return; - global $editor_style; - $editor_style = (array) $editor_style; - $stylesheet = (array) $stylesheet; - foreach ( $stylesheet as $file ) { - if ( file_exists( get_stylesheet_directory() . "/$file" ) - && ( $uri = get_stylesheet_directory_uri() . "/$file" ) - && ! in_array( $uri, $editor_style ) ) - $editor_style[] = $uri; - elseif ( TEMPLATEPATH !== STYLESHEETPATH - && file_exists( get_template_directory() . "/$file" ) - && ( $uri = get_template_directory_uri() . "/$file" ) - && ! in_array( $uri, $editor_style ) ) - $editor_style[] = $uri; - } - add_filter( 'mce_css', '_editor_style_cb' ); -} - -/** - * Callback for custom editor stylesheet support. - * - * @since 3.0.0 - * @see add_editor_style() - * @access protected - */ -function _editor_style_cb( $url ) { - global $editor_style; - if ( ! empty( $url ) ) - $url .= ','; - return $url . implode( ',', $editor_style ); + global $editor_styles; + $editor_styles = (array) $editor_styles; + $stylesheet = (array) $stylesheet; + $editor_styles = array_merge( $editor_styles, $stylesheet ); } /** @@ -1520,7 +1495,6 @@ function add_theme_support( $feature ) { * @param string $feature the feature being checked * @return boolean */ - function current_theme_supports( $feature ) { global $_wp_theme_features;