public function customize_pane_settings()
{
$login_url = add_query_arg(array('interim-login' => 1, 'customize-login' => 1), wp_login_url());
// Ensure dirty flags are set for modified settings.
foreach (array_keys($this->unsanitized_post_values()) as $setting_id) {
$setting = $this->get_setting($setting_id);
if ($setting) {
$setting->dirty = true;
}
}
// Prepare Customizer settings to pass to JavaScript.
$settings = array('changeset' => array('uuid' => $this->changeset_uuid(), 'status' => $this->changeset_post_id() ? get_post_status($this->changeset_post_id()) : ''), 'timeouts' => array('windowRefresh' => 250, 'changesetAutoSave' => AUTOSAVE_INTERVAL * 1000, 'keepAliveCheck' => 2500, 'reflowPaneContents' => 100, 'previewFrameSensitivity' => 2000), 'theme' => array('stylesheet' => $this->get_stylesheet(), 'active' => $this->is_theme_active()), 'url' => array('preview' => esc_url_raw($this->get_preview_url()), 'parent' => esc_url_raw(admin_url()), 'activated' => esc_url_raw(home_url('/')), 'ajax' => esc_url_raw(admin_url('admin-ajax.php', 'relative')), 'allowed' => array_map('esc_url_raw', $this->get_allowed_urls()), 'isCrossDomain' => $this->is_cross_domain(), 'home' => esc_url_raw(home_url('/')), 'login' => esc_url_raw($login_url)), 'browser' => array('mobile' => wp_is_mobile(), 'ios' => $this->is_ios()), 'panels' => array(), 'sections' => array(), 'nonce' => $this->get_nonces(), 'autofocus' => $this->get_autofocus(), 'documentTitleTmpl' => $this->get_document_title_template(), 'previewableDevices' => $this->get_previewable_devices());
// Prepare Customize Section objects to pass to JavaScript.
foreach ($this->sections() as $id => $section) {
if ($section->check_capabilities()) {
$settings['sections'][$id] = $section->json();
}
}
// Prepare Customize Panel objects to pass to JavaScript.
foreach ($this->panels() as $panel_id => $panel) {
if ($panel->check_capabilities()) {
$settings['panels'][$panel_id] = $panel->json();
foreach ($panel->sections as $section_id => $section) {
if ($section->check_capabilities()) {
$settings['sections'][$section_id] = $section->json();
}
}
}
}
?>
<script type="text/javascript">
var _wpCustomizeSettings = <?php
echo wp_json_encode($settings);
?>
;
_wpCustomizeSettings.controls = {};
_wpCustomizeSettings.settings = {};
<?php
// Serialize settings one by one to improve memory usage.
echo "(function ( s ){\n";
foreach ($this->settings() as $setting) {
if ($setting->check_capabilities()) {
printf("s[%s] = %s;\n", wp_json_encode($setting->id), wp_json_encode($setting->json()));
}
}
echo "})( _wpCustomizeSettings.settings );\n";
// Serialize controls one by one to improve memory usage.
echo "(function ( c ){\n";
foreach ($this->controls() as $control) {
if ($control->check_capabilities()) {
printf("c[%s] = %s;\n", wp_json_encode($control->id), wp_json_encode($control->json()));
}
}
echo "})( _wpCustomizeSettings.controls );\n";
?>
</script>
<?php
}