WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/20/2009 05:05:42 PM (9 years ago)
Author:
westi
Message:

Move theme preview away from using create_function and to predefined functions. See #10729 for 2.8 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.8/wp-includes/theme.php

    r11545 r12070  
    876876        return;
    877877
    878     add_filter( 'template', create_function('', "return '{$_GET['template']}';") );
     878    add_filter( 'template', '_preview_theme_template_filter' );
    879879
    880880    if ( isset($_GET['stylesheet']) ) {
     
    882882        if ( validate_file($_GET['stylesheet']) )
    883883            return;
    884         add_filter( 'stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
     884        add_filter( 'stylesheet', '_preview_theme_stylesheet_filter' );
    885885    }
    886886
     
    891891}
    892892add_action('setup_theme', 'preview_theme');
     893
     894/**
     895 * Private function to modify the current template when previewing a theme
     896 *
     897 * @return string
     898 */
     899function _preview_theme_template_filter() {
     900    return isset($_GET['template']) ? $_GET['template'] : '';
     901}
     902
     903/**
     904 * Private function to modify the current stylesheet when previewing a theme
     905 *
     906 * @return string
     907 */
     908function _preview_theme_stylesheet_filter() {
     909    return isset($_GET['stylesheet']) ? $_GET['stylesheet'] : '';
     910}
    893911
    894912/**
Note: See TracChangeset for help on using the changeset viewer.