mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Themes: Remove legacy theme preview.
The pre-3.4 theme previewer doesn't work when using a static front page. We kept the old theme preview for no-JS and some browsers that were less capable. But since browsers are doing a better job today we don't need to continue fixing/shipping this legacy code. Bye! fixes #33178. git-svn-id: https://develop.svn.wordpress.org/trunk@33492 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -213,14 +213,6 @@ do_action( 'customize_controls_print_scripts' );
|
||||
*/
|
||||
$allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) );
|
||||
|
||||
$fallback_url = add_query_arg( array(
|
||||
'preview' => 1,
|
||||
'template' => $wp_customize->get_template(),
|
||||
'stylesheet' => $wp_customize->get_stylesheet(),
|
||||
'preview_iframe' => true,
|
||||
'TB_iframe' => 'true'
|
||||
), home_url( '/' ) );
|
||||
|
||||
$login_url = add_query_arg( array(
|
||||
'interim-login' => 1,
|
||||
'customize-login' => 1
|
||||
@@ -239,7 +231,6 @@ do_action( 'customize_controls_print_scripts' );
|
||||
'ajax' => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ),
|
||||
'allowed' => array_map( 'esc_url_raw', $allowed_urls ),
|
||||
'isCrossDomain' => $cross_domain,
|
||||
'fallback' => esc_url_raw( $fallback_url ),
|
||||
'home' => esc_url_raw( home_url( '/' ) ),
|
||||
'login' => esc_url_raw( $login_url ),
|
||||
),
|
||||
|
||||
@@ -174,17 +174,10 @@ class WP_Themes_List_Table extends WP_List_Table {
|
||||
|
||||
$activate_link = wp_nonce_url( "themes.php?action=activate&template=" . urlencode( $template ) . "&stylesheet=" . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet );
|
||||
|
||||
$preview_link = esc_url( add_query_arg(
|
||||
array( 'preview' => 1, 'template' => urlencode( $template ), 'stylesheet' => urlencode( $stylesheet ), 'preview_iframe' => true, 'TB_iframe' => 'true' ),
|
||||
home_url( '/' ) ) );
|
||||
|
||||
$actions = array();
|
||||
$actions['activate'] = '<a href="' . $activate_link . '" class="activatelink" title="'
|
||||
. esc_attr( sprintf( __( 'Activate “%s”' ), $title ) ) . '">' . __( 'Activate' ) . '</a>';
|
||||
|
||||
$actions['preview'] = '<a href="' . $preview_link . '" class="hide-if-customize" title="'
|
||||
. esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '">' . __( 'Preview' ) . '</a>';
|
||||
|
||||
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
|
||||
$actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="load-customize hide-if-no-customize">'
|
||||
. __( 'Live Preview' ) . '</a>';
|
||||
@@ -205,11 +198,11 @@ class WP_Themes_List_Table extends WP_List_Table {
|
||||
|
||||
?>
|
||||
|
||||
<a href="<?php echo $preview_link; ?>" class="screenshot hide-if-customize">
|
||||
<span class="screenshot hide-if-customize">
|
||||
<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
|
||||
<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</span>
|
||||
<a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize">
|
||||
<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
|
||||
<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
|
||||
|
||||
@@ -650,12 +650,6 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
|
||||
$stylesheet = $this->upgrader->result['destination_name'];
|
||||
$template = $theme_info->get_template();
|
||||
|
||||
$preview_link = add_query_arg( array(
|
||||
'preview' => 1,
|
||||
'template' => urlencode( $template ),
|
||||
'stylesheet' => urlencode( $stylesheet ),
|
||||
), trailingslashit( home_url() ) );
|
||||
|
||||
$activate_link = add_query_arg( array(
|
||||
'action' => 'activate',
|
||||
'template' => urlencode( $template ),
|
||||
@@ -664,7 +658,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
|
||||
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
|
||||
|
||||
$install_actions = array();
|
||||
$install_actions['preview'] = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-customize"><span aria-hidden="true">' . __( 'Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Preview “%s”' ), $name ) . '</span></a>';
|
||||
|
||||
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
|
||||
$install_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview “%s”' ), $name ) . '</span></a>';
|
||||
}
|
||||
@@ -732,12 +726,6 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
|
||||
$stylesheet = $this->upgrader->result['destination_name'];
|
||||
$template = $theme_info->get_template();
|
||||
|
||||
$preview_link = add_query_arg( array(
|
||||
'preview' => 1,
|
||||
'template' => urlencode( $template ),
|
||||
'stylesheet' => urlencode( $stylesheet ),
|
||||
), trailingslashit( home_url() ) );
|
||||
|
||||
$activate_link = add_query_arg( array(
|
||||
'action' => 'activate',
|
||||
'template' => urlencode( $template ),
|
||||
@@ -750,7 +738,6 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
|
||||
$update_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize “%s”' ), $name ) . '</span></a>';
|
||||
}
|
||||
} elseif ( current_user_can( 'switch_themes' ) ) {
|
||||
$update_actions['preview'] = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-customize"><span aria-hidden="true">' . __( 'Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Preview “%s”' ), $name ) . '</span></a>';
|
||||
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
|
||||
$update_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview “%s”' ), $name ) . '</span></a>';
|
||||
}
|
||||
|
||||
@@ -479,13 +479,6 @@ function wp_prepare_themes_for_js( $themes = null ) {
|
||||
'actions' => array(
|
||||
'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null,
|
||||
'customize' => ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) ? wp_customize_url( $slug ) : null,
|
||||
'preview' => add_query_arg( array(
|
||||
'preview' => 1,
|
||||
'template' => urlencode( $theme->get_template() ),
|
||||
'stylesheet' => urlencode( $slug ),
|
||||
'preview_iframe' => true,
|
||||
'TB_iframe' => true,
|
||||
), home_url( '/' ) ),
|
||||
'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -3036,9 +3036,10 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Redirect to the fallback preview if any incompatibilities are found.
|
||||
if ( ! $.support.postMessage || ( ! $.support.cors && api.settings.isCrossDomain ) )
|
||||
return window.location = api.settings.url.fallback;
|
||||
// Bail if any incompatibilities are found.
|
||||
if ( ! $.support.postMessage || ( ! $.support.cors && api.settings.isCrossDomain ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var parent, topFocus,
|
||||
body = $( document.body ),
|
||||
|
||||
@@ -245,7 +245,6 @@ foreach ( $themes as $theme ) :
|
||||
<a class="button button-secondary activate" href="<?php echo $theme['actions']['activate']; ?>"><?php _e( 'Activate' ); ?></a>
|
||||
<?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
|
||||
<a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
|
||||
<a class="button button-secondary hide-if-customize" href="<?php echo $theme['actions']['preview']; ?>"><?php _e( 'Preview' ); ?></a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
@@ -347,7 +346,6 @@ $can_delete = current_user_can( 'delete_themes' );
|
||||
<# } else { #>
|
||||
<a class="button button-secondary activate" href="{{{ data.actions.activate }}}"><?php _e( 'Activate' ); ?></a>
|
||||
<a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
|
||||
<a class="button button-secondary hide-if-customize" href="{{{ data.actions.preview }}}"><?php _e( 'Preview' ); ?></a>
|
||||
<# } #>
|
||||
|
||||
</div>
|
||||
@@ -409,7 +407,6 @@ $can_delete = current_user_can( 'delete_themes' );
|
||||
<a href="{{{ data.actions.activate }}}" class="button button-secondary activate"><?php _e( 'Activate' ); ?></a>
|
||||
<# } #>
|
||||
<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
|
||||
<a href="{{{ data.actions.preview }}}" class="button button-secondary hide-if-customize"><?php _e( 'Preview' ); ?></a>
|
||||
</div>
|
||||
|
||||
<# if ( ! data.active && data.actions['delete'] ) { #>
|
||||
|
||||
Reference in New Issue
Block a user