Make WordPress Core


Ignore:
Timestamp:
09/21/2009 09:43:41 PM (15 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r11930 r11957  
    887887        return;
    888888
    889     add_filter( 'template', create_function('', "return '{$_GET['template']}';") );
     889    add_filter( 'template', '_preview_theme_template_filter' );
    890890
    891891    if ( isset($_GET['stylesheet']) ) {
     
    893893        if ( validate_file($_GET['stylesheet']) )
    894894            return;
    895         add_filter( 'stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
     895        add_filter( 'stylesheet', '_preview_theme_stylesheet_filter' );
    896896    }
    897897
     
    902902}
    903903add_action('setup_theme', 'preview_theme');
     904
     905/**
     906 * Private function to modify the current template when previewing a theme
     907 *
     908 * @return string
     909 */
     910function _preview_theme_template_filter() {
     911    return isset($_GET['template']) ? $_GET['template'] : '';
     912}
     913
     914/**
     915 * Private function to modify the current stylesheet when previewing a theme
     916 *
     917 * @return string
     918 */
     919function _preview_theme_stylesheet_filter() {
     920    return isset($_GET['stylesheet']) ? $_GET['stylesheet'] : '';
     921}
    904922
    905923/**
Note: See TracChangeset for help on using the changeset viewer.