Ticket #9152: 9152.2.patch
| File 9152.2.patch, 1.4 KB (added by Viper007Bond, 4 years ago) |
|---|
-
wp-includes/theme.php
854 854 if ( validate_file($_GET['template']) ) 855 855 return; 856 856 857 add_filter( 'template', create_function('', "return '{$_GET['template']}';") );857 add_filter( 'template', create_function('', "return '{$_GET['template']}';") ); 858 858 859 $preview_theme_path = $_GET['template']; 860 859 861 if ( isset($_GET['stylesheet']) ) { 860 862 $_GET['stylesheet'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['stylesheet']); 861 863 if ( validate_file($_GET['stylesheet']) ) 862 864 return; 863 add_filter('stylesheet', create_function('', "return '{$_GET['stylesheet']}';") ); 865 add_filter( 'stylesheet', create_function('', "return '{$_GET['stylesheet']}';") ); 866 867 $preview_theme_path = $_GET['stylesheet']; 864 868 } 865 869 870 // Prevent theme mods to current theme being used on theme being previewed 871 $preview_theme = get_theme_data( WP_CONTENT_DIR . "/themes/$preview_theme_path/style.css" ); 872 $preview_theme_name = $preview_theme['Name']; 873 $current_theme = get_current_theme(); 874 if ( $current_theme !== $preview_theme_name ) 875 add_filter( "pre_option_mods_{$current_theme}", create_function('', "return get_option(\"mods_{$preview_theme_name}\");") ); 876 866 877 ob_start( 'preview_theme_ob_filter' ); 867 878 } 868 879 add_action('setup_theme', 'preview_theme');
