From 496752e14ec85e0467e03920d2addfe068f24b23 Mon Sep 17 00:00:00 2001 From: nacin Date: Tue, 23 Feb 2010 23:46:07 +0000 Subject: [PATCH] Proper RTL + .dev.css support, first pass. See #12292 git-svn-id: http://svn.automattic.com/wordpress/trunk@13351 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class.wp-styles.php | 8 +++++--- wp-includes/script-loader.php | 7 ++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/wp-includes/class.wp-styles.php b/wp-includes/class.wp-styles.php index 97acdf804a..ecc0bb9e22 100644 --- a/wp-includes/class.wp-styles.php +++ b/wp-includes/class.wp-styles.php @@ -68,10 +68,12 @@ class WP_Styles extends WP_Dependencies { $tag .= apply_filters( 'style_loader_tag', "\n", $handle ); if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) { - if ( is_bool( $this->registered[$handle]->extra['rtl'] ) ) - $rtl_href = str_replace( '.css', '-rtl.css', $this->_css_href( $this->registered[$handle]->src , $ver, "$handle-rtl" )); - else + if ( is_bool( $this->registered[$handle]->extra['rtl'] ) ) { + $suffix = isset( $this->registered[$handle]->extra['suffix'] ) ? $this->registered[$handle]->extra['suffix'] : ''; + $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $this->registered[$handle]->src , $ver, "$handle-rtl" )); + } else { $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" ); + } $tag .= apply_filters( 'style_loader_tag', "\n", $handle ); } diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index b3f04ded9b..adf900de5e 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -433,6 +433,8 @@ function wp_default_styles( &$styles ) { $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; $rtl_styles = array( 'wp-admin', 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' ); + // Any rtl stylesheets that don't have a .dev version for ltr + $no_suffix = array( 'farbtastic' ); // all colors stylesheets need to have the same query strings (cache manifest compat) $colors_version = '20100217'; @@ -468,8 +470,11 @@ function wp_default_styles( &$styles ) { $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' ); $styles->add( 'custom-navigation', "/wp-admin/css/custom-navigation$suffix.css", array(), '20100215' ); - foreach ( $rtl_styles as $rtl_style ) + foreach ( $rtl_styles as $rtl_style ) { $styles->add_data( $rtl_style, 'rtl', true ); + if ( $suffix && ! in_array( $rtl_style, $no_suffix ) ) + $styles->add_data( $rtl_style, 'suffix', $suffix ); + } } /**