wp/wp-admin/customize.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    82 			403
    82 			403
    83 		);
    83 		);
    84 	}
    84 	}
    85 }
    85 }
    86 
    86 
    87 
    87 $url       = ! empty( $_REQUEST['url'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['url'] ) ) : '';
    88 wp_reset_vars( array( 'url', 'return', 'autofocus' ) );
    88 $return    = ! empty( $_REQUEST['return'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['return'] ) ) : '';
       
    89 $autofocus = ! empty( $_REQUEST['autofocus'] ) && is_array( $_REQUEST['autofocus'] )
       
    90 	? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['autofocus'] ) )
       
    91 	: array();
       
    92 
    89 if ( ! empty( $url ) ) {
    93 if ( ! empty( $url ) ) {
    90 	$wp_customize->set_preview_url( wp_unslash( $url ) );
    94 	$wp_customize->set_preview_url( $url );
    91 }
    95 }
    92 if ( ! empty( $return ) ) {
    96 if ( ! empty( $return ) ) {
    93 	$wp_customize->set_return_url( wp_unslash( $return ) );
    97 	$wp_customize->set_return_url( $return );
    94 }
    98 }
    95 if ( ! empty( $autofocus ) && is_array( $autofocus ) ) {
    99 if ( ! empty( $autofocus ) ) {
    96 	$wp_customize->set_autofocus( wp_unslash( $autofocus ) );
   100 	$wp_customize->set_autofocus( $autofocus );
    97 }
   101 }
    98 
   102 
    99 $registered             = $wp_scripts->registered;
   103 $registered             = $wp_scripts->registered;
   100 $wp_scripts             = new WP_Scripts;
   104 $wp_scripts             = new WP_Scripts();
   101 $wp_scripts->registered = $registered;
   105 $wp_scripts->registered = $registered;
   102 
   106 
   103 add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 );
   107 add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 );
   104 add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts' );
   108 add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts' );
   105 add_action( 'customize_controls_print_styles', 'print_admin_styles', 20 );
   109 add_action( 'customize_controls_print_styles', 'print_admin_styles', 20 );
   114 wp_enqueue_script( 'heartbeat' );
   118 wp_enqueue_script( 'heartbeat' );
   115 wp_enqueue_script( 'customize-controls' );
   119 wp_enqueue_script( 'customize-controls' );
   116 wp_enqueue_style( 'customize-controls' );
   120 wp_enqueue_style( 'customize-controls' );
   117 
   121 
   118 /**
   122 /**
   119  * Enqueue Customizer control scripts.
   123  * Fires when enqueuing Customizer control scripts.
   120  *
   124  *
   121  * @since 3.4.0
   125  * @since 3.4.0
   122  */
   126  */
   123 do_action( 'customize_controls_enqueue_scripts' );
   127 do_action( 'customize_controls_enqueue_scripts' );
   124 
   128 
   205 			<button type="button" class="customize-controls-preview-toggle">
   209 			<button type="button" class="customize-controls-preview-toggle">
   206 				<span class="controls"><?php _e( 'Customize' ); ?></span>
   210 				<span class="controls"><?php _e( 'Customize' ); ?></span>
   207 				<span class="preview"><?php _e( 'Preview' ); ?></span>
   211 				<span class="preview"><?php _e( 'Preview' ); ?></span>
   208 			</button>
   212 			</button>
   209 			<a class="customize-controls-close" href="<?php echo esc_url( $wp_customize->get_return_url() ); ?>">
   213 			<a class="customize-controls-close" href="<?php echo esc_url( $wp_customize->get_return_url() ); ?>">
   210 				<span class="screen-reader-text"><?php _e( 'Close the Customizer and go back to the previous page' ); ?></span>
   214 				<span class="screen-reader-text">
       
   215 					<?php
       
   216 					/* translators: Hidden accessibility text. */
       
   217 					_e( 'Close the Customizer and go back to the previous page' );
       
   218 					?>
       
   219 				</span>
   211 			</a>
   220 			</a>
   212 		</div>
   221 		</div>
   213 
   222 
   214 		<div id="customize-sidebar-outer-content">
   223 		<div id="customize-sidebar-outer-content">
   215 			<div id="customize-outer-theme-controls">
   224 			<div id="customize-outer-theme-controls">
   228 						<?php
   237 						<?php
   229 							/* translators: %s: The site/panel title in the Customizer. */
   238 							/* translators: %s: The site/panel title in the Customizer. */
   230 							printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
   239 							printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
   231 						?>
   240 						?>
   232 						</span>
   241 						</span>
   233 						<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
   242 						<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text">
       
   243 							<?php
       
   244 							/* translators: Hidden accessibility text. */
       
   245 							_e( 'Help' );
       
   246 							?>
       
   247 						</span></button>
   234 					</div>
   248 					</div>
   235 					<div class="customize-panel-description">
   249 					<div class="customize-panel-description">
   236 						<p>
   250 						<p>
   237 							<?php
   251 							<?php
   238 							_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.' );
   252 							_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.' );
   239 							?>
   253 							?>
   240 						</p>
   254 						</p>
   241 						<p>
   255 						<p>
   242 							<?php
   256 							<?php
   243 							_e( '<a href="https://wordpress.org/support/article/appearance-customize-screen/">Documentation on Customizer</a>' );
   257 							_e( '<a href="https://wordpress.org/documentation/article/customizer/">Documentation on Customizer</a>' );
   244 							?>
   258 							?>
   245 						</p>
   259 						</p>
   246 					</div>
   260 					</div>
   247 				</div>
   261 				</div>
   248 
   262