2012-02-25 05:12:43 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Customize Controls
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Customize
|
|
|
|
* @since 3.4.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ( ! defined( 'ABSPATH' ) )
|
|
|
|
die;
|
|
|
|
|
|
|
|
global $wp_scripts;
|
|
|
|
|
|
|
|
$registered = $wp_scripts->registered;
|
|
|
|
$wp_scripts = new WP_Scripts;
|
|
|
|
$wp_scripts->registered = $registered;
|
|
|
|
|
|
|
|
add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 );
|
|
|
|
add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts' );
|
|
|
|
add_action( 'customize_controls_print_styles', 'print_admin_styles', 20 );
|
|
|
|
|
|
|
|
do_action( 'customize_controls_init' );
|
|
|
|
|
|
|
|
wp_enqueue_script( 'customize-controls' );
|
|
|
|
wp_enqueue_style( 'customize-controls' );
|
|
|
|
|
|
|
|
do_action( 'customize_controls_enqueue_scripts' );
|
|
|
|
|
2012-02-28 22:41:19 +01:00
|
|
|
$theme = wp_get_theme();
|
2012-02-29 21:31:56 +01:00
|
|
|
$screenshot = $theme->get_screenshot();
|
2012-02-25 05:12:43 +01:00
|
|
|
|
|
|
|
// Let's roll.
|
|
|
|
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
|
|
|
|
|
|
|
wp_user_settings();
|
|
|
|
_wp_admin_html_begin();
|
|
|
|
|
|
|
|
$admin_title = sprintf( __( '%1$s — WordPress' ), strip_tags( sprintf( __( 'Customize %s' ), $theme['Name'] ) ) );
|
|
|
|
?><title><?php echo $admin_title; ?></title><?php
|
|
|
|
|
|
|
|
do_action( 'customize_controls_print_styles' );
|
|
|
|
do_action( 'customize_controls_print_scripts' );
|
|
|
|
?>
|
|
|
|
</head>
|
2012-03-07 04:19:35 +01:00
|
|
|
<body class="wp-full-overlay">
|
2012-03-23 01:16:46 +01:00
|
|
|
<form id="customize-controls" method="post" class="wrap wp-full-overlay-sidebar" target="_parent" action="<?php echo esc_url( add_query_arg( 'save_customize_controls', '1', admin_url( 'themes.php' ) ) ); ?>">
|
2012-02-25 05:12:43 +01:00
|
|
|
<?php wp_nonce_field( 'customize_controls' ); ?>
|
|
|
|
<input type="hidden" name="customize" value="on" />
|
|
|
|
<input type="hidden" id="customize-template" name="template" value="<?php echo esc_attr( $theme['Template'] ); ?>" />
|
|
|
|
<input type="hidden" id="customize-stylesheet" name="stylesheet" value="<?php echo esc_attr( $theme['Stylesheet'] ); ?>" />
|
2012-03-06 23:48:07 +01:00
|
|
|
|
2012-03-07 04:19:35 +01:00
|
|
|
<div id="customize-header-actions" class="customize-section wp-full-overlay-header"> </div>
|
2012-02-25 05:12:43 +01:00
|
|
|
|
|
|
|
<div id="customize-info" class="customize-section">
|
2012-03-04 03:06:11 +01:00
|
|
|
<div class="customize-section-title">
|
2012-03-04 03:40:18 +01:00
|
|
|
<?php if ( $screenshot ) : ?>
|
|
|
|
<img class="theme-screenshot" src="<?php echo esc_url( $screenshot ); ?>" />
|
|
|
|
<?php endif; ?>
|
2012-02-25 05:12:43 +01:00
|
|
|
<strong class="theme-name"><?php echo $theme['Name']; ?></strong>
|
|
|
|
<span class="theme-by"><?php printf( __( 'By %s' ), $theme['Author'] ); ?></span>
|
2012-03-04 03:06:11 +01:00
|
|
|
</div>
|
|
|
|
<div class="customize-section-content">
|
|
|
|
<?php if ( $screenshot ) : ?>
|
|
|
|
<img class="theme-screenshot" src="<?php echo esc_url( $screenshot ); ?>" />
|
|
|
|
<?php endif; ?>
|
2012-03-04 03:40:18 +01:00
|
|
|
|
|
|
|
<?php if ( $theme->description ): ?>
|
|
|
|
<div class="theme-description"><?php echo $theme->description; ?></div>
|
|
|
|
<?php endif; ?>
|
2012-03-04 03:06:11 +01:00
|
|
|
</div>
|
2012-02-25 05:12:43 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="customize-theme-controls"><ul>
|
|
|
|
<?php
|
|
|
|
foreach ( $this->sections as $section )
|
2012-03-21 23:55:43 +01:00
|
|
|
$section->maybe_render();
|
2012-02-25 05:12:43 +01:00
|
|
|
?>
|
|
|
|
</ul></div>
|
|
|
|
|
2012-03-07 04:19:35 +01:00
|
|
|
<div id="customize-footer-actions" class="customize-section wp-full-overlay-footer">
|
2012-02-25 05:12:43 +01:00
|
|
|
<?php
|
|
|
|
submit_button( __( 'Save' ), 'primary', 'save', false );
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</form>
|
2012-03-07 04:19:35 +01:00
|
|
|
<div id="customize-preview" class="wp-full-overlay-main">
|
2012-02-25 05:12:43 +01:00
|
|
|
<iframe name="customize-target"></iframe>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
do_action( 'customize_controls_print_footer_scripts' );
|
|
|
|
|
2012-02-29 23:43:12 +01:00
|
|
|
// Check current scheme and load the preview with the same scheme
|
|
|
|
$scheme = is_ssl() ? 'https' : 'http';
|
2012-02-25 05:12:43 +01:00
|
|
|
$settings = array(
|
2012-03-06 23:48:07 +01:00
|
|
|
'preview' => esc_url( home_url( '/', $scheme ) ),
|
|
|
|
'controls' => array(),
|
|
|
|
'prefix' => WP_Customize_Setting::name_prefix,
|
2012-02-25 05:12:43 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
foreach ( $this->settings as $id => $setting ) {
|
2012-03-06 23:48:07 +01:00
|
|
|
$settings['controls'][ $id ] = array(
|
|
|
|
'value' => $setting->value(),
|
|
|
|
'control' => $setting->control,
|
|
|
|
);
|
2012-03-22 08:17:26 +01:00
|
|
|
|
|
|
|
if ( $setting->visibility ) {
|
2012-03-22 09:07:44 +01:00
|
|
|
if ( is_string( $setting->visibility ) ) {
|
|
|
|
$settings['controls'][ $id ]['visibility'] = array(
|
|
|
|
'id' => $setting->visibility,
|
|
|
|
'value' => true,
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$settings['controls'][ $id ]['visibility'] = array(
|
|
|
|
'id' => $setting->visibility[0],
|
|
|
|
'value' => $setting->visibility[1],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-03-22 08:17:26 +01:00
|
|
|
}
|
2012-02-25 05:12:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function() {
|
|
|
|
if ( typeof wp === 'undefined' || ! wp.customize )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wp.customize.settings = <?php echo json_encode( $settings ); ?>;
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|