wp/wp-admin/customize.php
author ymh <ymh.work@gmail.com>
Tue, 09 Jun 2015 03:35:32 +0200
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
permissions -rw-r--r--
upgrade wordpress + plugins
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     3
 * Theme Customize Screen.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * @subpackage Customize
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 * @since 3.4.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
define( 'IFRAME_REQUEST', true );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    12
/** Load WordPress Administration Bootstrap */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
require_once( dirname( __FILE__ ) . '/admin.php' );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    14
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    15
if ( ! current_user_can( 'customize' ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    16
	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    17
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
wp_reset_vars( array( 'url', 'return' ) );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    20
$url = wp_unslash( $url );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
$url = wp_validate_redirect( $url, home_url( '/' ) );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    22
if ( $return ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    23
	$return = wp_unslash( $return );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    24
	$return = wp_validate_redirect( $return );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    25
}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    26
if ( ! $return ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    27
	if ( $url ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    28
		$return = $url;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    29
	} elseif ( current_user_can( 'edit_theme_options' ) || current_user_can( 'switch_themes' ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    30
		$return = admin_url( 'themes.php' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    31
	} else {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    32
		$return = admin_url();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    33
	}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    34
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
global $wp_scripts, $wp_customize;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
$registered = $wp_scripts->registered;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
$wp_scripts = new WP_Scripts;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
$wp_scripts->registered = $registered;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
add_action( 'customize_controls_print_scripts',        'print_head_scripts', 20 );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts'     );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
add_action( 'customize_controls_print_styles',         'print_admin_styles', 20 );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
 * Fires when Customizer controls are initialized, before scripts are enqueued.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
 * @since 3.4.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
do_action( 'customize_controls_init' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
wp_enqueue_script( 'customize-controls' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
wp_enqueue_style( 'customize-controls' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
 * Enqueue Customizer control scripts.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
 * @since 3.4.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
do_action( 'customize_controls_enqueue_scripts' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
// Let's roll.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
wp_user_settings();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
_wp_admin_html_begin();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    69
$body_class = 'wp-core-ui wp-customizer js';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
if ( wp_is_mobile() ) :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
	$body_class .= ' mobile';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    74
	?><meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=1.2" /><?php
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
endif;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
$is_ios = wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    79
if ( $is_ios ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
	$body_class .= ' ios';
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    81
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    83
if ( is_rtl() ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    84
	$body_class .= ' rtl';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    85
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    88
if ( $wp_customize->is_theme_active() ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    89
	$document_title_tmpl = _x( 'Customize: %s', 'Placeholder is the document title from the preview' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    90
} else {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    91
	$document_title_tmpl = _x( 'Live Preview: %s', 'Placeholder is the document title from the preview' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    92
}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    93
$document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); // because exported to JS and assigned to document.title
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    94
$admin_title = sprintf( $document_title_tmpl, __( 'Loading&hellip;' ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    96
?><title><?php echo $admin_title; ?></title>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    97
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    98
<script type="text/javascript">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    99
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   100
</script>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   101
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   102
<?php
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
/**
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   104
 * Fires when Customizer control styles are printed.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
 * @since 3.4.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
do_action( 'customize_controls_print_styles' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
/**
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   111
 * Fires when Customizer control scripts are printed.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
 * @since 3.4.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
do_action( 'customize_controls_print_scripts' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
</head>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
<body class="<?php echo esc_attr( $body_class ); ?>">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
<div class="wp-full-overlay expanded">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
	<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
		<div id="customize-header-actions" class="wp-full-overlay-header">
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   122
			<div class="primary-actions">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   123
				<?php
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   124
					$save_text = $wp_customize->is_theme_active() ? __( 'Save &amp; Publish' ) : __( 'Save &amp; Activate' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   125
					submit_button( $save_text, 'primary save', 'save', false );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   126
				?>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   127
				<span class="spinner"></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   128
				<a class="customize-controls-preview-toggle" href="#">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   129
					<span class="controls"><?php _e( 'Customize' ); ?></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   130
					<span class="preview"><?php _e( 'Preview' ); ?></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   131
				</a>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   132
				<a class="customize-controls-close" href="<?php echo esc_url( $return ); ?>">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   133
					<span class="screen-reader-text"><?php _e( 'Cancel' ); ?></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   134
				</a>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   135
				<span class="control-panel-back" tabindex="-1"><span class="screen-reader-text"><?php _e( 'Back' ); ?></span></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   136
			</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   137
			<div class="secondary-actions">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   138
				<button type="button" class="customize-overlay-close">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   139
					<span class="screen-reader-text"><?php _e( 'Close overlay' ); ?></span>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   140
				</button>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   141
			</div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
		</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   144
		<div id="widgets-right"><!-- For Widget Customizer, many widgets try to look for instances under div#widgets-right, so we have to add that ID to a container div in the Customizer for compat -->
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   145
		<div class="wp-full-overlay-sidebar-content" tabindex="-1">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   146
			<div id="customize-info" class="accordion-section">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   147
				<div class="accordion-section-title" aria-label="<?php esc_attr_e( 'Customizer Options' ); ?>" tabindex="0">
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
					<span class="preview-notice"><?php
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   149
						echo sprintf( __( 'You are customizing %s' ), '<strong class="theme-name site-title">' . get_bloginfo( 'name' ) . '</strong>' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
					?></span>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
				</div>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   152
				<div class="accordion-section-content"><?php
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   153
					echo __( 'The Customizer allows you to preview changes to your site before publishing them. You can also navigate to different pages on your site to preview them.' );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   154
				?></div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
			</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   157
			<div id="customize-theme-controls">
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   158
				<ul><?php // Panels and sections are managed here via JavaScript ?></ul>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   159
			</div>
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   160
		</div>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
		</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
		<div id="customize-footer-actions" class="wp-full-overlay-footer">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
			<a href="#" class="collapse-sidebar button-secondary" title="<?php esc_attr_e('Collapse Sidebar'); ?>">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
				<span class="collapse-sidebar-arrow"></span>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
				<span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
			</a>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
		</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
	</form>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
	<div id="customize-preview" class="wp-full-overlay-main"></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
	<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   173
	// Render control templates.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   174
	$wp_customize->render_control_templates();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   175
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
	 * Print Customizer control scripts in the footer.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
	 * @since 3.4.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
	do_action( 'customize_controls_print_footer_scripts' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   183
	/*
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   184
	 * If the frontend and the admin are served from the same domain, load the
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   185
	 * preview over ssl if the Customizer is being loaded over ssl. This avoids
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   186
	 * insecure content warnings. This is not attempted if the admin and frontend
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   187
	 * are on different domains to avoid the case where the frontend doesn't have
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   188
	 * ssl certs. Domain mapping plugins can allow other urls in these conditions
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   189
	 * using the customize_allowed_urls filter.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   190
	 */
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
	$allowed_urls = array( home_url('/') );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
	$admin_origin = parse_url( admin_url() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
	$home_origin  = parse_url( home_url() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
	$cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
	if ( is_ssl() && ! $cross_domain )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
		$allowed_urls[] = home_url( '/', 'https' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
	/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
	 * Filter the list of URLs allowed to be clicked and followed in the Customizer preview.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
	 * @since 3.4.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
	 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
	 * @param array $allowed_urls An array of allowed URLs.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
	 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
	$allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
	$fallback_url = add_query_arg( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
		'preview'        => 1,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
		'template'       => $wp_customize->get_template(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
		'stylesheet'     => $wp_customize->get_stylesheet(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
		'preview_iframe' => true,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
		'TB_iframe'      => 'true'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
	), home_url( '/' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
	$login_url = add_query_arg( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
		'interim-login' => 1,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
		'customize-login' => 1
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
	), wp_login_url() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   222
	// Prepare Customizer settings to pass to JavaScript.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
	$settings = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
		'theme'    => array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
			'stylesheet' => $wp_customize->get_stylesheet(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
			'active'     => $wp_customize->is_theme_active(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
		),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
		'url'      => array(
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   229
			'preview'       => esc_url_raw( $url ? $url : home_url( '/' ) ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   230
			'parent'        => esc_url_raw( admin_url() ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   231
			'activated'     => esc_url_raw( home_url( '/' ) ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   232
			'ajax'          => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   233
			'allowed'       => array_map( 'esc_url_raw', $allowed_urls ),
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
			'isCrossDomain' => $cross_domain,
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   235
			'fallback'      => esc_url_raw( $fallback_url ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   236
			'home'          => esc_url_raw( home_url( '/' ) ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   237
			'login'         => esc_url_raw( $login_url ),
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
		),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   239
		'browser'  => array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   240
			'mobile' => wp_is_mobile(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
			'ios'    => $is_ios,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
		),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
		'settings' => array(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
		'controls' => array(),
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   245
		'panels'   => array(),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   246
		'sections' => array(),
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
		'nonce'    => array(
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   248
			'save'    => wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   249
			'preview' => wp_create_nonce( 'preview-customize_' . $wp_customize->get_stylesheet() )
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   250
		),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   251
		'autofocus' => array(),
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   252
		'documentTitleTmpl' => $document_title_tmpl,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   255
	// Prepare Customize Setting objects to pass to JavaScript.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
	foreach ( $wp_customize->settings() as $id => $setting ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
		$settings['settings'][ $id ] = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
			'value'     => $setting->js_value(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
			'transport' => $setting->transport,
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   260
			'dirty'     => $setting->dirty,
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
		);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   264
	// Prepare Customize Control objects to pass to JavaScript.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
	foreach ( $wp_customize->controls() as $id => $control ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   266
		$settings['controls'][ $id ] = $control->json();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   267
	}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   268
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   269
	// Prepare Customize Section objects to pass to JavaScript.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   270
	foreach ( $wp_customize->sections() as $id => $section ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   271
		$settings['sections'][ $id ] = $section->json();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   272
	}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   273
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   274
	// Prepare Customize Panel objects to pass to JavaScript.
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   275
	foreach ( $wp_customize->panels() as $id => $panel ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   276
		$settings['panels'][ $id ] = $panel->json();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   277
		foreach ( $panel->sections as $section_id => $section ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   278
			$settings['sections'][ $section_id ] = $section->json();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   279
		}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   280
	}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   281
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   282
	// Pass to frontend the Customizer construct being deeplinked
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   283
	if ( isset( $_GET['autofocus'] ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   284
		$autofocus = wp_unslash( $_GET['autofocus'] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   285
		if ( is_array( $autofocus ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   286
			foreach ( $autofocus as $type => $id ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   287
				if ( isset( $settings[ $type . 's' ][ $id ] ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   288
					$settings['autofocus'][ $type ] = $id;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   289
				}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   290
			}
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   291
		}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   293
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
	?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
	<script type="text/javascript">
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   296
		var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
	</script>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
</body>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
</html>