Make WordPress Core

Ticket #38867: 38867.0.diff

File 38867.0.diff, 1.5 KB (added by westonruter, 10 years ago)
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index d047620..43ad9e0 100644
    final class WP_Customize_Manager {  
    13531353
    13541354                wp_enqueue_script( 'customize-preview' );
    13551355                add_action( 'wp_head', array( $this, 'customize_preview_loading_style' ) );
     1356                if ( $this->messenger_channel ) {
     1357                        add_action( 'wp_head', array( $this, 'remove_frameless_preview_messenger_channel' ) );
     1358                }
    13561359                add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 );
    13571360                add_filter( 'get_edit_post_link', '__return_empty_string' );
    13581361
    final class WP_Customize_Manager {  
    14881491        }
    14891492
    14901493        /**
     1494         * Remove customize_messenger_channel query parameter from the preview window when it is not in an iframe.
     1495         *
     1496         * @since 4.7.0
     1497         * @access public
     1498         */
     1499        public function remove_frameless_preview_messenger_channel( ){
     1500                if ( ! $this->messenger_channel ) {
     1501                        return;
     1502                }
     1503                ?>
     1504                <script>
     1505                ( function() {
     1506                        var urlParser;
     1507                        if ( parent !== window ) {
     1508                                return;
     1509                        }
     1510                        urlParser = document.createElement( 'a' );
     1511                        urlParser.href = location.href;
     1512                        urlParser.search = urlParser.search.replace( /(^|&)customize_messenger_channel=(.+?)(?=$|&)/, '' );
     1513                        if ( urlParser.search !== location.search ) {
     1514                                location.replace( urlParser.href );
     1515                        }
     1516                } )();
     1517                </script>
     1518                <?php
     1519        }
     1520
     1521        /**
    14911522         * Print JavaScript settings for preview frame.
    14921523         *
    14931524         * @since 3.4.0