Edit File by line
/home/barbar84/www/wp-admin
File: customize.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Theme Customize Screen.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Customize
[5] Fix | Delete
* @since 3.4.0
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
define( 'IFRAME_REQUEST', true );
[9] Fix | Delete
[10] Fix | Delete
/** Load WordPress Administration Bootstrap */
[11] Fix | Delete
require_once __DIR__ . '/admin.php';
[12] Fix | Delete
[13] Fix | Delete
if ( ! current_user_can( 'customize' ) ) {
[14] Fix | Delete
wp_die(
[15] Fix | Delete
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
[16] Fix | Delete
'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
[17] Fix | Delete
403
[18] Fix | Delete
);
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* @global WP_Scripts $wp_scripts
[23] Fix | Delete
* @global WP_Customize_Manager $wp_customize
[24] Fix | Delete
*/
[25] Fix | Delete
global $wp_scripts, $wp_customize;
[26] Fix | Delete
[27] Fix | Delete
if ( $wp_customize->changeset_post_id() ) {
[28] Fix | Delete
$changeset_post = get_post( $wp_customize->changeset_post_id() );
[29] Fix | Delete
[30] Fix | Delete
if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) {
[31] Fix | Delete
wp_die(
[32] Fix | Delete
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
[33] Fix | Delete
'<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
[34] Fix | Delete
403
[35] Fix | Delete
);
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
$missed_schedule = (
[39] Fix | Delete
'future' === $changeset_post->post_status &&
[40] Fix | Delete
get_post_time( 'G', true, $changeset_post ) < time()
[41] Fix | Delete
);
[42] Fix | Delete
if ( $missed_schedule ) {
[43] Fix | Delete
/*
[44] Fix | Delete
* Note that an Ajax request spawns here instead of just calling `wp_publish_post( $changeset_post->ID )`.
[45] Fix | Delete
*
[46] Fix | Delete
* Because WP_Customize_Manager is not instantiated for customize.php with the `settings_previewed=false`
[47] Fix | Delete
* argument, settings cannot be reliably saved. Some logic short-circuits if the current value is the
[48] Fix | Delete
* same as the value being saved. This is particularly true for options via `update_option()`.
[49] Fix | Delete
*
[50] Fix | Delete
* By opening an Ajax request, this is avoided and the changeset is published. See #39221.
[51] Fix | Delete
*/
[52] Fix | Delete
$nonces = $wp_customize->get_nonces();
[53] Fix | Delete
$request_args = array(
[54] Fix | Delete
'nonce' => $nonces['save'],
[55] Fix | Delete
'customize_changeset_uuid' => $wp_customize->changeset_uuid(),
[56] Fix | Delete
'wp_customize' => 'on',
[57] Fix | Delete
'customize_changeset_status' => 'publish',
[58] Fix | Delete
);
[59] Fix | Delete
ob_start();
[60] Fix | Delete
?>
[61] Fix | Delete
<?php wp_print_scripts( array( 'wp-util' ) ); ?>
[62] Fix | Delete
<script>
[63] Fix | Delete
wp.ajax.post( 'customize_save', <?php echo wp_json_encode( $request_args ); ?> );
[64] Fix | Delete
</script>
[65] Fix | Delete
<?php
[66] Fix | Delete
$script = ob_get_clean();
[67] Fix | Delete
[68] Fix | Delete
wp_die(
[69] Fix | Delete
'<h1>' . __( 'Your scheduled changes just published' ) . '</h1>' .
[70] Fix | Delete
'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>' . $script,
[71] Fix | Delete
200
[72] Fix | Delete
);
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) {
[76] Fix | Delete
wp_die(
[77] Fix | Delete
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
[78] Fix | Delete
'<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
[79] Fix | Delete
'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
[80] Fix | Delete
403
[81] Fix | Delete
);
[82] Fix | Delete
}
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
[86] Fix | Delete
wp_reset_vars( array( 'url', 'return', 'autofocus' ) );
[87] Fix | Delete
if ( ! empty( $url ) ) {
[88] Fix | Delete
$wp_customize->set_preview_url( wp_unslash( $url ) );
[89] Fix | Delete
}
[90] Fix | Delete
if ( ! empty( $return ) ) {
[91] Fix | Delete
$wp_customize->set_return_url( wp_unslash( $return ) );
[92] Fix | Delete
}
[93] Fix | Delete
if ( ! empty( $autofocus ) && is_array( $autofocus ) ) {
[94] Fix | Delete
$wp_customize->set_autofocus( wp_unslash( $autofocus ) );
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
$registered = $wp_scripts->registered;
[98] Fix | Delete
$wp_scripts = new WP_Scripts;
[99] Fix | Delete
$wp_scripts->registered = $registered;
[100] Fix | Delete
[101] Fix | Delete
add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 );
[102] Fix | Delete
add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts' );
[103] Fix | Delete
add_action( 'customize_controls_print_styles', 'print_admin_styles', 20 );
[104] Fix | Delete
[105] Fix | Delete
/**
[106] Fix | Delete
* Fires when Customizer controls are initialized, before scripts are enqueued.
[107] Fix | Delete
*
[108] Fix | Delete
* @since 3.4.0
[109] Fix | Delete
*/
[110] Fix | Delete
do_action( 'customize_controls_init' );
[111] Fix | Delete
[112] Fix | Delete
wp_enqueue_script( 'heartbeat' );
[113] Fix | Delete
wp_enqueue_script( 'customize-controls' );
[114] Fix | Delete
wp_enqueue_style( 'customize-controls' );
[115] Fix | Delete
[116] Fix | Delete
/**
[117] Fix | Delete
* Enqueue Customizer control scripts.
[118] Fix | Delete
*
[119] Fix | Delete
* @since 3.4.0
[120] Fix | Delete
*/
[121] Fix | Delete
do_action( 'customize_controls_enqueue_scripts' );
[122] Fix | Delete
[123] Fix | Delete
// Let's roll.
[124] Fix | Delete
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
[125] Fix | Delete
[126] Fix | Delete
wp_user_settings();
[127] Fix | Delete
_wp_admin_html_begin();
[128] Fix | Delete
[129] Fix | Delete
$body_class = 'wp-core-ui wp-customizer js';
[130] Fix | Delete
[131] Fix | Delete
if ( wp_is_mobile() ) :
[132] Fix | Delete
$body_class .= ' mobile';
[133] Fix | Delete
add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' );
[134] Fix | Delete
endif;
[135] Fix | Delete
[136] Fix | Delete
if ( $wp_customize->is_ios() ) {
[137] Fix | Delete
$body_class .= ' ios';
[138] Fix | Delete
}
[139] Fix | Delete
[140] Fix | Delete
if ( is_rtl() ) {
[141] Fix | Delete
$body_class .= ' rtl';
[142] Fix | Delete
}
[143] Fix | Delete
$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
[144] Fix | Delete
[145] Fix | Delete
$admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading&hellip;' ) );
[146] Fix | Delete
[147] Fix | Delete
?>
[148] Fix | Delete
<title><?php echo esc_html( $admin_title ); ?></title>
[149] Fix | Delete
[150] Fix | Delete
<script type="text/javascript">
[151] Fix | Delete
var ajaxurl = <?php echo wp_json_encode( admin_url( 'admin-ajax.php', 'relative' ) ); ?>,
[152] Fix | Delete
pagenow = 'customize';
[153] Fix | Delete
</script>
[154] Fix | Delete
[155] Fix | Delete
<?php
[156] Fix | Delete
/**
[157] Fix | Delete
* Fires when Customizer control styles are printed.
[158] Fix | Delete
*
[159] Fix | Delete
* @since 3.4.0
[160] Fix | Delete
*/
[161] Fix | Delete
do_action( 'customize_controls_print_styles' );
[162] Fix | Delete
[163] Fix | Delete
/**
[164] Fix | Delete
* Fires when Customizer control scripts are printed.
[165] Fix | Delete
*
[166] Fix | Delete
* @since 3.4.0
[167] Fix | Delete
*/
[168] Fix | Delete
do_action( 'customize_controls_print_scripts' );
[169] Fix | Delete
[170] Fix | Delete
/**
[171] Fix | Delete
* Fires in head section of Customizer controls.
[172] Fix | Delete
*
[173] Fix | Delete
* @since 5.5.0
[174] Fix | Delete
*/
[175] Fix | Delete
do_action( 'customize_controls_head' );
[176] Fix | Delete
?>
[177] Fix | Delete
</head>
[178] Fix | Delete
<body class="<?php echo esc_attr( $body_class ); ?>">
[179] Fix | Delete
<div class="wp-full-overlay expanded">
[180] Fix | Delete
<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
[181] Fix | Delete
<div id="customize-header-actions" class="wp-full-overlay-header">
[182] Fix | Delete
<?php
[183] Fix | Delete
$compatible_wp = is_wp_version_compatible( $wp_customize->theme()->get( 'RequiresWP' ) );
[184] Fix | Delete
$compatible_php = is_php_version_compatible( $wp_customize->theme()->get( 'RequiresPHP' ) );
[185] Fix | Delete
?>
[186] Fix | Delete
<?php if ( $compatible_wp && $compatible_php ) : ?>
[187] Fix | Delete
<?php $save_text = $wp_customize->is_theme_active() ? __( 'Publish' ) : __( 'Activate &amp; Publish' ); ?>
[188] Fix | Delete
<div id="customize-save-button-wrapper" class="customize-save-button-wrapper" >
[189] Fix | Delete
<?php submit_button( $save_text, 'primary save', 'save', false ); ?>
[190] Fix | Delete
<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>
[191] Fix | Delete
</div>
[192] Fix | Delete
<?php else : ?>
[193] Fix | Delete
<?php $save_text = _x( 'Cannot Activate', 'theme' ); ?>
[194] Fix | Delete
<div id="customize-save-button-wrapper" class="customize-save-button-wrapper disabled" >
[195] Fix | Delete
<button class="button button-primary disabled" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled><?php echo $save_text; ?></button>
[196] Fix | Delete
</div>
[197] Fix | Delete
<?php endif; ?>
[198] Fix | Delete
<span class="spinner"></span>
[199] Fix | Delete
<button type="button" class="customize-controls-preview-toggle">
[200] Fix | Delete
<span class="controls"><?php _e( 'Customize' ); ?></span>
[201] Fix | Delete
<span class="preview"><?php _e( 'Preview' ); ?></span>
[202] Fix | Delete
</button>
[203] Fix | Delete
<a class="customize-controls-close" href="<?php echo esc_url( $wp_customize->get_return_url() ); ?>">
[204] Fix | Delete
<span class="screen-reader-text"><?php _e( 'Close the Customizer and go back to the previous page' ); ?></span>
[205] Fix | Delete
</a>
[206] Fix | Delete
</div>
[207] Fix | Delete
[208] Fix | Delete
<div id="customize-sidebar-outer-content">
[209] Fix | Delete
<div id="customize-outer-theme-controls">
[210] Fix | Delete
<ul class="customize-outer-pane-parent"><?php // Outer panel and sections are not implemented, but its here as a placeholder to avoid any side-effect in api.Section. ?></ul>
[211] Fix | Delete
</div>
[212] Fix | Delete
</div>
[213] Fix | Delete
[214] Fix | Delete
<div id="widgets-right" class="wp-clearfix"><!-- 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 -->
[215] Fix | Delete
<div id="customize-notifications-area" class="customize-control-notifications-container">
[216] Fix | Delete
<ul></ul>
[217] Fix | Delete
</div>
[218] Fix | Delete
<div class="wp-full-overlay-sidebar-content" tabindex="-1">
[219] Fix | Delete
<div id="customize-info" class="accordion-section customize-info">
[220] Fix | Delete
<div class="accordion-section-title">
[221] Fix | Delete
<span class="preview-notice">
[222] Fix | Delete
<?php
[223] Fix | Delete
/* translators: %s: The site/panel title in the Customizer. */
[224] Fix | Delete
printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
[225] Fix | Delete
?>
[226] Fix | Delete
</span>
[227] Fix | Delete
<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
[228] Fix | Delete
</div>
[229] Fix | Delete
<div class="customize-panel-description">
[230] Fix | Delete
<?php
[231] Fix | Delete
_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.' );
[232] Fix | Delete
?>
[233] Fix | Delete
</div>
[234] Fix | Delete
</div>
[235] Fix | Delete
[236] Fix | Delete
<div id="customize-theme-controls">
[237] Fix | Delete
<ul class="customize-pane-parent"><?php // Panels and sections are managed here via JavaScript ?></ul>
[238] Fix | Delete
</div>
[239] Fix | Delete
</div>
[240] Fix | Delete
</div>
[241] Fix | Delete
[242] Fix | Delete
<div id="customize-footer-actions" class="wp-full-overlay-footer">
[243] Fix | Delete
<button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php echo esc_attr( _x( 'Hide Controls', 'label for hide controls button without length constraints' ) ); ?>">
[244] Fix | Delete
<span class="collapse-sidebar-arrow"></span>
[245] Fix | Delete
<span class="collapse-sidebar-label"><?php _ex( 'Hide Controls', 'short (~12 characters) label for hide controls button' ); ?></span>
[246] Fix | Delete
</button>
[247] Fix | Delete
<?php $previewable_devices = $wp_customize->get_previewable_devices(); ?>
[248] Fix | Delete
<?php if ( ! empty( $previewable_devices ) ) : ?>
[249] Fix | Delete
<div class="devices-wrapper">
[250] Fix | Delete
<div class="devices">
[251] Fix | Delete
<?php foreach ( (array) $previewable_devices as $device => $settings ) : ?>
[252] Fix | Delete
<?php
[253] Fix | Delete
if ( empty( $settings['label'] ) ) {
[254] Fix | Delete
continue;
[255] Fix | Delete
}
[256] Fix | Delete
$active = ! empty( $settings['default'] );
[257] Fix | Delete
$class = 'preview-' . $device;
[258] Fix | Delete
if ( $active ) {
[259] Fix | Delete
$class .= ' active';
[260] Fix | Delete
}
[261] Fix | Delete
?>
[262] Fix | Delete
<button type="button" class="<?php echo esc_attr( $class ); ?>" aria-pressed="<?php echo esc_attr( $active ); ?>" data-device="<?php echo esc_attr( $device ); ?>">
[263] Fix | Delete
<span class="screen-reader-text"><?php echo esc_html( $settings['label'] ); ?></span>
[264] Fix | Delete
</button>
[265] Fix | Delete
<?php endforeach; ?>
[266] Fix | Delete
</div>
[267] Fix | Delete
</div>
[268] Fix | Delete
<?php endif; ?>
[269] Fix | Delete
</div>
[270] Fix | Delete
</form>
[271] Fix | Delete
<div id="customize-preview" class="wp-full-overlay-main"></div>
[272] Fix | Delete
<?php
[273] Fix | Delete
[274] Fix | Delete
/**
[275] Fix | Delete
* Prints templates, control scripts, and settings in the footer.
[276] Fix | Delete
*
[277] Fix | Delete
* @since 3.4.0
[278] Fix | Delete
*/
[279] Fix | Delete
do_action( 'customize_controls_print_footer_scripts' );
[280] Fix | Delete
?>
[281] Fix | Delete
</div>
[282] Fix | Delete
</body>
[283] Fix | Delete
</html>
[284] Fix | Delete
[285] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function