]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/theme.php
Wordpress 2.8.5
[autoinstalls/wordpress.git] / wp-includes / theme.php
index 9d56a6403d0f8a801276a49c8ef9360f3a509c94..2c800535aecc11ed549859d339ef66b98e965c80 100644 (file)
@@ -875,13 +875,13 @@ function preview_theme() {
        if ( validate_file($_GET['template']) )
                return;
 
-       add_filter( 'template', create_function('', "return '{$_GET['template']}';") );
+       add_filter( 'template', '_preview_theme_template_filter' );
 
        if ( isset($_GET['stylesheet']) ) {
                $_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']);
                if ( validate_file($_GET['stylesheet']) )
                        return;
-               add_filter( 'stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
+               add_filter( 'stylesheet', '_preview_theme_stylesheet_filter' );
        }
 
        // Prevent theme mods to current theme being used on theme being previewed
@@ -891,6 +891,24 @@ function preview_theme() {
 }
 add_action('setup_theme', 'preview_theme');
 
+/**
+ * Private function to modify the current template when previewing a theme
+ * 
+ * @return string
+ */
+function _preview_theme_template_filter() {
+       return isset($_GET['template']) ? $_GET['template'] : '';
+}
+
+/**
+ * Private function to modify the current stylesheet when previewing a theme
+ * 
+ * @return string
+ */
+function _preview_theme_stylesheet_filter() {
+       return isset($_GET['stylesheet']) ? $_GET['stylesheet'] : '';
+}
+
 /**
  * Callback function for ob_start() to capture all links in the theme.
  *