WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/08/2012 06:45:12 PM (10 years ago)
Author:
ryan
Message:

Customizer: Redirect back to referrer. If referrer is a front end page, load that page in the customizer preview. Props nacin, koopersmith. fixes #20877

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/customize.php

    r21014 r21028  
    1111if ( ! current_user_can( 'edit_theme_options' ) )
    1212    wp_die( __( 'Cheatin’ uh?' ) );
     13
     14wp_reset_vars( array( 'url', 'return' ) );
     15$url = urldecode( $url );
     16$url = wp_validate_redirect( $url, home_url( '/' ) );
     17if ( $return )
     18    $return = wp_validate_redirect( urldecode( $return ) );
     19if ( ! $return )
     20    $return = $url;
    1321
    1422global $wp_scripts, $wp_customize;
     
    6573            ?>
    6674            <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" />
    67             <a class="back button" href="<?php echo esc_url( admin_url( 'themes.php' ) ); ?>">
     75            <a class="back button" href="<?php echo esc_url( $return ? $return : admin_url( 'themes.php' ) ); ?>">
    6876                <?php _e( 'Cancel' ); ?>
    6977            </a>
     
    147155        ),
    148156        'url'      => array(
    149             'preview'       => esc_url( home_url( '/' ) ),
     157            'preview'       => esc_url( $url ? $url : home_url( '/' ) ),
    150158            'parent'        => esc_url( admin_url() ),
    151159            'activated'     => esc_url( admin_url( 'themes.php?activated=true' ) ),
     
    154162            'isCrossDomain' => $cross_domain,
    155163            'fallback'      => $fallback_url,
     164            'home'          => esc_url( home_url( '/' ) ),
    156165        ),
    157166        'browser'  => array(
Note: See TracChangeset for help on using the changeset viewer.