Customizer: Escape theme preview URLs.

props johnbillion, ocean90.
see #31896.
Built from https://develop.svn.wordpress.org/trunk@32134


git-svn-id: http://core.svn.wordpress.org/trunk@32113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-04-15 16:33:25 +00:00
parent ee9adc354a
commit 786bce5b9c
3 changed files with 6 additions and 3 deletions

View File

@ -511,6 +511,8 @@ function wp_prepare_themes_for_js( $themes = null ) {
* @since 4.2.0
*/
function customize_themes_print_templates() {
$preview_url = esc_url( add_query_arg( 'theme', '__THEME__' ) ); // Token because esc_url() strips curly braces.
$preview_url = str_replace( '__THEME__', '{{ data.id }}', $preview_url );
?>
<script type="text/html" id="tmpl-customize-themes-details-view">
<div class="theme-backdrop"></div>
@ -550,7 +552,7 @@ function customize_themes_print_templates() {
<# if ( ! data.active ) { #>
<div class="theme-actions">
<div class="inactive-theme">
<a href="<?php echo add_query_arg( 'theme', '{{ data.id }}' ); ?>" target="_top" class="button button-primary"><?php _e( 'Live Preview' ); ?></a>
<a href="<?php echo $preview_url; ?>" target="_top" class="button button-primary"><?php _e( 'Live Preview' ); ?></a>
</div>
</div>
<# } #>

View File

@ -1243,7 +1243,8 @@ class WP_Customize_Theme_Control extends WP_Customize_Control {
*/
public function content_template() {
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$preview_url = add_query_arg( 'theme', '{{ data.theme.id }}', $current_url );
$preview_url = esc_url( add_query_arg( 'theme', '__THEME__', $current_url ) ); // Token because esc_url() strips curly braces.
$preview_url = str_replace( '__THEME__', '{{ data.theme.id }}', $preview_url );
?>
<div class="theme" tabindex="0" data-preview-url="<?php echo esc_attr( $preview_url ); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name">
<# if ( data.theme.screenshot[0] ) { #>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-beta4-32133';
$wp_version = '4.2-beta4-32134';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.