WordPress.org

Make WordPress Core

Ticket #12292: 12292.2.diff

File 12292.2.diff, 2.7 KB (added by nacin, 5 years ago)

Full RTL+.dev support

  • class.wp-styles.php

     
    6868 
    6969                $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle ); 
    7070                if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) { 
    71                         if ( is_bool( $this->registered[$handle]->extra['rtl'] ) ) 
    72                                 $rtl_href = str_replace( '.css', '-rtl.css', $this->_css_href( $this->registered[$handle]->src , $ver, "$handle-rtl" )); 
    73                         else 
     71                        if ( is_bool( $this->registered[$handle]->extra['rtl'] ) ) { 
     72                                $suffix = isset( $this->registered[$handle]->extra['suffix'] ) ? $this->registered[$handle]->extra['suffix'] : ''; 
     73                                $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $this->registered[$handle]->src , $ver, "$handle-rtl" )); 
     74                        } else { 
    7475                                $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" ); 
     76                        } 
    7577 
    7678                        $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle ); 
    7779                } 
  • script-loader.php

     
    424424        $styles->default_dirs = array('/wp-admin/'); 
    425425 
    426426        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; 
     427        // Any stylesheets that don't have a .dev version for ltr or rtl 
     428        $no_suffix = array( 'farbtastic' ); 
    427429 
    428430        $rtl_styles = array( 'wp-admin', 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' ); 
    429431 
     
    432434 
    433435        $styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20100217' ); 
    434436 
    435         $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20100108' ); 
     437        $styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20100108' ); 
    436438        $styles->add_data( 'ie', 'conditional', 'lte IE 7' ); 
    437439 
    438440        // Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string. 
     
    460462        $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' ); 
    461463        $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' ); 
    462464 
    463         foreach ( $rtl_styles as $rtl_style ) 
     465        foreach ( $rtl_styles as $rtl_style ) { 
    464466                $styles->add_data( $rtl_style, 'rtl', true ); 
     467                if ( $suffix && ! in_array( $rtl_style, $no_suffix ) ) 
     468                        $styles->add_data( $rtl_style, 'suffix', $suffix ); 
     469        } 
    465470} 
    466471 
    467472/**