wp/wp-admin/customize.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     8  */
     8  */
     9 
     9 
    10 define( 'IFRAME_REQUEST', true );
    10 define( 'IFRAME_REQUEST', true );
    11 
    11 
    12 /** Load WordPress Administration Bootstrap */
    12 /** Load WordPress Administration Bootstrap */
    13 require_once( dirname( __FILE__ ) . '/admin.php' );
    13 require_once __DIR__ . '/admin.php';
    14 
    14 
    15 if ( ! current_user_can( 'customize' ) ) {
    15 if ( ! current_user_can( 'customize' ) ) {
    16 	wp_die(
    16 	wp_die(
    17 		'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    17 		'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
    18 		'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
    18 		'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
   121  * @since 3.4.0
   121  * @since 3.4.0
   122  */
   122  */
   123 do_action( 'customize_controls_enqueue_scripts' );
   123 do_action( 'customize_controls_enqueue_scripts' );
   124 
   124 
   125 // Let's roll.
   125 // Let's roll.
   126 @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
   126 header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
   127 
   127 
   128 wp_user_settings();
   128 wp_user_settings();
   129 _wp_admin_html_begin();
   129 _wp_admin_html_begin();
   130 
   130 
   131 $body_class = 'wp-core-ui wp-customizer js';
   131 $body_class = 'wp-core-ui wp-customizer js';
   132 
   132 
   133 if ( wp_is_mobile() ) :
   133 if ( wp_is_mobile() ) :
   134 	$body_class .= ' mobile';
   134 	$body_class .= ' mobile';
   135 
   135 	add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' );
   136 	?>
       
   137 	<meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=1.2" />
       
   138 	<?php
       
   139 endif;
   136 endif;
   140 
   137 
   141 if ( $wp_customize->is_ios() ) {
   138 if ( $wp_customize->is_ios() ) {
   142 	$body_class .= ' ios';
   139 	$body_class .= ' ios';
   143 }
   140 }
   148 $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
   145 $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
   149 
   146 
   150 $admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading&hellip;' ) );
   147 $admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading&hellip;' ) );
   151 
   148 
   152 ?>
   149 ?>
   153 <title><?php echo $admin_title; ?></title>
   150 <title><?php echo esc_html( $admin_title ); ?></title>
   154 
   151 
   155 <script type="text/javascript">
   152 <script type="text/javascript">
   156 var ajaxurl = <?php echo wp_json_encode( admin_url( 'admin-ajax.php', 'relative' ) ); ?>,
   153 var ajaxurl = <?php echo wp_json_encode( admin_url( 'admin-ajax.php', 'relative' ) ); ?>,
   157 	pagenow = 'customize';
   154 	pagenow = 'customize';
   158 </script>
   155 </script>
   169  * Fires when Customizer control scripts are printed.
   166  * Fires when Customizer control scripts are printed.
   170  *
   167  *
   171  * @since 3.4.0
   168  * @since 3.4.0
   172  */
   169  */
   173 do_action( 'customize_controls_print_scripts' );
   170 do_action( 'customize_controls_print_scripts' );
       
   171 
       
   172 /**
       
   173  * Fires in head section of Customizer controls.
       
   174  *
       
   175  * @since 5.5.0
       
   176  */
       
   177 do_action( 'customize_controls_head' );
   174 ?>
   178 ?>
   175 </head>
   179 </head>
   176 <body class="<?php echo esc_attr( $body_class ); ?>">
   180 <body class="<?php echo esc_attr( $body_class ); ?>">
   177 <div class="wp-full-overlay expanded">
   181 <div class="wp-full-overlay expanded">
   178 	<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
   182 	<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
   179 		<div id="customize-header-actions" class="wp-full-overlay-header">
   183 		<div id="customize-header-actions" class="wp-full-overlay-header">
   180 			<?php $save_text = $wp_customize->is_theme_active() ? __( 'Publish' ) : __( 'Activate &amp; Publish' ); ?>
   184 			<?php
   181 			<div id="customize-save-button-wrapper" class="customize-save-button-wrapper" >
   185 			$compatible_wp  = is_wp_version_compatible( $wp_customize->theme()->get( 'RequiresWP' ) );
   182 				<?php submit_button( $save_text, 'primary save', 'save', false ); ?>
   186 			$compatible_php = is_php_version_compatible( $wp_customize->theme()->get( 'RequiresPHP' ) );
   183 				<button id="publish-settings" class="publish-settings button-primary button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled></button>
   187 			?>
   184 			</div>
   188 			<?php if ( $compatible_wp && $compatible_php ) : ?>
       
   189 				<?php $save_text = $wp_customize->is_theme_active() ? __( 'Publish' ) : __( 'Activate &amp; Publish' ); ?>
       
   190 				<div id="customize-save-button-wrapper" class="customize-save-button-wrapper" >
       
   191 					<?php submit_button( $save_text, 'primary save', 'save', false ); ?>
       
   192 					<button id="publish-settings" class="publish-settings button-primary button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled></button>
       
   193 				</div>
       
   194 			<?php else : ?>
       
   195 				<?php $save_text = _x( 'Cannot Activate', 'theme' ); ?>
       
   196 				<div id="customize-save-button-wrapper" class="customize-save-button-wrapper disabled" >
       
   197 					<button class="button button-primary disabled" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled><?php echo $save_text; ?></button>
       
   198 				</div>
       
   199 			<?php endif; ?>
   185 			<span class="spinner"></span>
   200 			<span class="spinner"></span>
   186 			<button type="button" class="customize-controls-preview-toggle">
   201 			<button type="button" class="customize-controls-preview-toggle">
   187 				<span class="controls"><?php _e( 'Customize' ); ?></span>
   202 				<span class="controls"><?php _e( 'Customize' ); ?></span>
   188 				<span class="preview"><?php _e( 'Preview' ); ?></span>
   203 				<span class="preview"><?php _e( 'Preview' ); ?></span>
   189 			</button>
   204 			</button>
   205 			<div class="wp-full-overlay-sidebar-content" tabindex="-1">
   220 			<div class="wp-full-overlay-sidebar-content" tabindex="-1">
   206 				<div id="customize-info" class="accordion-section customize-info">
   221 				<div id="customize-info" class="accordion-section customize-info">
   207 					<div class="accordion-section-title">
   222 					<div class="accordion-section-title">
   208 						<span class="preview-notice">
   223 						<span class="preview-notice">
   209 						<?php
   224 						<?php
   210 							echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
   225 							/* translators: %s: The site/panel title in the Customizer. */
       
   226 							printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
   211 						?>
   227 						?>
   212 						</span>
   228 						</span>
   213 						<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
   229 						<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
   214 					</div>
   230 					</div>
   215 					<div class="customize-panel-description">
   231 					<div class="customize-panel-description">