Customize: Register the Publish Settings section in JS to ensure it does not get unregistered via PHP.

The `publish_settings` section is a fundamental dependency for Customizer, so it must be guaranteed to be registered.

Also unconditionally register core types for panels, sections, and controls in case plugin unhooks all `customize_register` actions.

See #39896.
Fixes #42337.

Built from https://develop.svn.wordpress.org/trunk@42025


git-svn-id: http://core.svn.wordpress.org/trunk@41859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-10-25 21:45:49 +00:00
parent 3ed6bbf4a4
commit a6af74ec32
5 changed files with 31 additions and 32 deletions

View File

@ -7001,6 +7001,15 @@
publishSettingsBtn = $( '#publish-settings' ),
footerActions = $( '#customize-footer-actions' );
// Add publish settings section in JS instead of PHP since the Customizer depends on it to function.
api.bind( 'ready', function() {
api.section.add( new api.OuterSection( 'publish_settings', {
title: api.l10n.publishSettings,
priority: 0,
active: api.settings.theme.active
} ) );
} );
// Set up publish settings section and its controls.
api.section( 'publish_settings', function( section ) {
var updateButtonsState, trashControl, updateSectionActive, isSectionActive, statusControl, dateControl, toggleDateControl, publishWhenTime, pollInterval, updateTimeArrivedPoller, cancelScheduleButtonReminder, timeArrivedPollingInterval = 1000;

File diff suppressed because one or more lines are too long

View File

@ -891,6 +891,24 @@ final class WP_Customize_Manager {
*/
public function wp_loaded() {
// Unconditionally register core types for panels, sections, and controls in case plugin unhooks all customize_register actions.
$this->register_panel_type( 'WP_Customize_Panel' );
$this->register_panel_type( 'WP_Customize_Themes_Panel' );
$this->register_section_type( 'WP_Customize_Section' );
$this->register_section_type( 'WP_Customize_Sidebar_Section' );
$this->register_section_type( 'WP_Customize_Themes_Section' );
$this->register_control_type( 'WP_Customize_Color_Control' );
$this->register_control_type( 'WP_Customize_Media_Control' );
$this->register_control_type( 'WP_Customize_Upload_Control' );
$this->register_control_type( 'WP_Customize_Image_Control' );
$this->register_control_type( 'WP_Customize_Background_Image_Control' );
$this->register_control_type( 'WP_Customize_Background_Position_Control' );
$this->register_control_type( 'WP_Customize_Cropped_Image_Control' );
$this->register_control_type( 'WP_Customize_Site_Icon_Control' );
$this->register_control_type( 'WP_Customize_Theme_Control' );
$this->register_control_type( 'WP_Customize_Code_Editor_Control' );
$this->register_control_type( 'WP_Customize_Date_Time_Control' );
/**
* Fires once WordPress has loaded, allowing scripts and styles to be initialized.
*
@ -4726,35 +4744,6 @@ final class WP_Customize_Manager {
*/
public function register_controls() {
/* Panel, Section, and Control Types */
$this->register_panel_type( 'WP_Customize_Panel' );
$this->register_panel_type( 'WP_Customize_Themes_Panel' );
$this->register_section_type( 'WP_Customize_Section' );
$this->register_section_type( 'WP_Customize_Sidebar_Section' );
$this->register_section_type( 'WP_Customize_Themes_Section' );
$this->register_control_type( 'WP_Customize_Color_Control' );
$this->register_control_type( 'WP_Customize_Media_Control' );
$this->register_control_type( 'WP_Customize_Upload_Control' );
$this->register_control_type( 'WP_Customize_Image_Control' );
$this->register_control_type( 'WP_Customize_Background_Image_Control' );
$this->register_control_type( 'WP_Customize_Background_Position_Control' );
$this->register_control_type( 'WP_Customize_Cropped_Image_Control' );
$this->register_control_type( 'WP_Customize_Site_Icon_Control' );
$this->register_control_type( 'WP_Customize_Theme_Control' );
$this->register_control_type( 'WP_Customize_Code_Editor_Control' );
$this->register_control_type( 'WP_Customize_Date_Time_Control' );
/* Publish Settings */
// Note the controls for this section are added via JS.
$this->add_section( 'publish_settings', array(
'title' => __( 'Publish Settings' ),
'priority' => 0,
'capability' => 'customize',
'type' => 'outer',
'active_callback' => array( $this, 'is_theme_active' ),
) );
/* Themes (controls are loaded via ajax) */
$this->add_panel( new WP_Customize_Themes_Panel( $this, 'themes', array(

View File

@ -598,6 +598,7 @@ function wp_default_scripts( &$scripts ) {
__( 'You won&#8217;t be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">add themes in the admin</a>.' ),
esc_url( admin_url( 'theme-install.php' ) )
),
'publishSettings' => __( 'Publish Settings' ),
) );
$scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-beta4-42024';
$wp_version = '4.9-beta4-42025';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.