Move theme preview away from using create_function and to predefined functions. See #10729.
git-svn-id: http://svn.automattic.com/wordpress/trunk@11957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5e4dc4dfd4
commit
6ed2dfd478
|
@ -886,13 +886,13 @@ function preview_theme() {
|
||||||
if ( validate_file($_GET['template']) )
|
if ( validate_file($_GET['template']) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
add_filter( 'template', create_function('', "return '{$_GET['template']}';") );
|
add_filter( 'template', '_preview_theme_template_filter' );
|
||||||
|
|
||||||
if ( isset($_GET['stylesheet']) ) {
|
if ( isset($_GET['stylesheet']) ) {
|
||||||
$_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']);
|
$_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']);
|
||||||
if ( validate_file($_GET['stylesheet']) )
|
if ( validate_file($_GET['stylesheet']) )
|
||||||
return;
|
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
|
// Prevent theme mods to current theme being used on theme being previewed
|
||||||
|
@ -902,6 +902,24 @@ function preview_theme() {
|
||||||
}
|
}
|
||||||
add_action('setup_theme', '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.
|
* Callback function for ob_start() to capture all links in the theme.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue