Make WordPress Core

Changeset 20059


Ignore:
Timestamp:
03/01/2012 12:18:26 AM (14 years ago)
Author:
azaozz
Message:

Don't pass non-existing rtl stylesheet to TinyMCE, update phpdoc for add_editor_style(), see #19437

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-editor.php

    r19945 r20059  
    329329                                        $editor_styles = array_unique($editor_styles);
    330330                                        $style_uri = get_stylesheet_directory_uri();
    331                                         if ( ! is_child_theme() ) {
    332                                                 foreach ( $editor_styles as $file )
     331                                        $style_dir = get_stylesheet_directory();
     332
     333                                        foreach ( $editor_styles as $key => $file ) {
     334                                                if ( $file && file_exists( "$style_dir/$file" ) ) {
    333335                                                        $mce_css[] = "$style_uri/$file";
    334                                         } else {
    335                                                 $style_dir    = get_stylesheet_directory();
     336                                                        $editor_styles[$key] = '';
     337                                                }
     338                                        }
     339
     340                                        if ( is_child_theme() ) {
    336341                                                $template_uri = get_template_directory_uri();
    337342                                                $template_dir = get_template_directory();
    338343
    339344                                                foreach ( $editor_styles as $file ) {
    340                                                         if ( file_exists( "$template_dir/$file" ) )
     345                                                        if ( $file && file_exists( "$template_dir/$file" ) )
    341346                                                                $mce_css[] = "$template_uri/$file";
    342347                                                }
    343 
    344                                                 foreach ( $editor_styles as $file ) {
    345                                                         if ( file_exists( "$style_dir/$file" ) )
    346                                                                 $mce_css[] = "$style_uri/$file";
    347                                                 }
    348348                                        }
     349
    349350                                        $mce_css = implode( ',', $mce_css );
    350351                                } else {
  • trunk/wp-includes/theme.php

    r20053 r20059  
    13351335 * It is optional and defaults to 'editor-style.css'.
    13361336 *
    1337  * Supports RTL stylesheets automatically by searching for the -rtl prefix, e.g.
    1338  * editor-style-rtl.css. If an array of stylesheets is passed to add_editor_style(),
     1337 * This function automatically adds another stylesheet with -rtl prefix, e.g. editor-style-rtl.css.
     1338 * If that file doesn't exist, it is removed before adding the stylesheet(s) to TinyMCE.
     1339 * If an array of stylesheets is passed to add_editor_style(),
    13391340 * RTL is only added for the first stylesheet.
     1341 *
     1342 * Since version 3.4 the TinyMCE body has .rtl CSS class.
     1343 * It is a better option to use that class and add any RTL styles to the main stylesheet.
    13401344 *
    13411345 * @since 3.0.0
Note: See TracChangeset for help on using the changeset viewer.