Ticket #42645: 42645.5.diff
File 42645.5.diff, 2.2 KB (added by , 5 years ago) |
---|
-
src/wp-includes/theme.php
1917 1917 * It is a better option to use that class and add any RTL styles to the main stylesheet. 1918 1918 * 1919 1919 * @since 3.0.0 1920 * @since 5.3.0 Add version support. 1920 1921 * 1921 1922 * @global array $editor_styles 1922 1923 * 1923 1924 * @param array|string $stylesheet Optional. Stylesheet name or array thereof, relative to theme root. 1924 1925 * Defaults to 'editor-style.css' 1926 * @param array|string $veresion Optional. Stylesheet version or array thereof. 1927 * The versions will be attach to stylesheets 1928 * respectively. 1925 1929 */ 1926 function add_editor_style( $stylesheet = 'editor-style.css' ) {1930 function add_editor_style( $stylesheet = 'editor-style.css', $version = '' ) { 1927 1931 global $editor_styles; 1928 1932 1929 1933 add_theme_support( 'editor-style' ); … … 1931 1935 $editor_styles = (array) $editor_styles; 1932 1936 $stylesheet = (array) $stylesheet; 1933 1937 1938 if ( $version ) { 1939 $version = (array) $version; 1940 $count = min( count( $version ), count( $stylesheet ) ); 1941 for ( $i = 0; $i < $count; $i++ ) { 1942 $stylesheet[ $i ] .= '?ver=' . $version[ $i ]; 1943 } 1944 } 1945 1934 1946 if ( is_rtl() ) { 1935 1947 $rtl_stylesheet = str_replace( '.css', '-rtl.css', $stylesheet[0] ); 1936 1948 $stylesheet[] = $rtl_stylesheet; … … 1992 2004 $template_dir = get_template_directory(); 1993 2005 1994 2006 foreach ( $editor_styles as $key => $file ) { 1995 if ( $file && file_exists( "$template_dir/$file" ) ) { 2007 $real_file = $file; 2008 $ver_pos = strpos( $file, '?ver=' ); 2009 if( $ver_pos ) { 2010 $real_file = substr( $file, 0, $ver_pos ); 2011 } 2012 if ( $file && file_exists( "$template_dir/$real_file" ) ) { 1996 2013 $stylesheets[] = "$template_uri/$file"; 1997 2014 } 1998 2015 } 1999 2016 } 2000 2017 2001 2018 foreach ( $editor_styles as $file ) { 2002 if ( $file && file_exists( "$style_dir/$file" ) ) { 2019 $real_file = $file; 2020 $ver_pos = strpos( $file, '?ver=' ); 2021 if( $ver_pos ) { 2022 $real_file = substr( $file, 0, $ver_pos ); 2023 } 2024 if ( $file && file_exists( "$style_dir/$real_file" ) ) { 2003 2025 $stylesheets[] = "$style_uri/$file"; 2004 2026 } 2005 2027 }