diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 782973a9cb..73c2b8a8bc 100644
|
|
|
|
| 2986 | 2986 | * @returns {void} |
| 2987 | 2987 | */ |
| 2988 | 2988 | attachEvents: function() { |
| 2989 | | var panel = this, toggleDisabledNotification; |
| | 2989 | var panel = this; |
| 2990 | 2990 | |
| 2991 | 2991 | // Attach regular panel events. |
| 2992 | 2992 | api.Panel.prototype.attachEvents.apply( panel ); |
| 2993 | 2993 | |
| 2994 | | toggleDisabledNotification = function() { |
| | 2994 | // Temporary since supplying SFTP credentials does not work yet. See #42184 |
| | 2995 | if ( api.settings.theme._filesystemCredentialsNeeded ) { |
| | 2996 | panel.notifications.add( new api.Notification( 'theme_install_unavailable', { |
| | 2997 | message: api.l10n.themeInstallUnavailable, |
| | 2998 | type: 'info', |
| | 2999 | dismissible: true |
| | 3000 | } ) ); |
| | 3001 | } |
| | 3002 | |
| | 3003 | function toggleDisabledNotifications() { |
| 2995 | 3004 | if ( 'publish' === api.state( 'selectedChangesetStatus' ).get() ) { |
| 2996 | 3005 | panel.notifications.remove( 'theme_switch_unavailable' ); |
| 2997 | 3006 | } else { |
| … |
… |
|
| 3000 | 3009 | type: 'warning' |
| 3001 | 3010 | } ) ); |
| 3002 | 3011 | } |
| 3003 | | }; |
| 3004 | | toggleDisabledNotification(); |
| 3005 | | api.state( 'selectedChangesetStatus' ).bind( toggleDisabledNotification ); |
| | 3012 | } |
| | 3013 | toggleDisabledNotifications(); |
| | 3014 | api.state( 'selectedChangesetStatus' ).bind( toggleDisabledNotifications ); |
| 3006 | 3015 | |
| 3007 | 3016 | // Collapse panel to customize the current theme. |
| 3008 | 3017 | panel.contentContainer.on( 'click', '.customize-theme', function() { |
| … |
… |
|
| 3096 | 3105 | var panel = this, preview, onInstallSuccess, slug = $( event.target ).data( 'slug' ), deferred = $.Deferred(), request; |
| 3097 | 3106 | preview = $( event.target ).hasClass( 'preview' ); |
| 3098 | 3107 | |
| | 3108 | // Temporary since supplying SFTP credentials does not work yet. See #42184. |
| | 3109 | if ( api.settings.theme._filesystemCredentialsNeeded ) { |
| | 3110 | deferred.reject({ |
| | 3111 | errorCode: 'theme_install_unavailable' |
| | 3112 | }); |
| | 3113 | return deferred.promise(); |
| | 3114 | } |
| | 3115 | |
| 3099 | 3116 | // Prevent loading a non-active theme preview when there is a drafted/scheduled changeset. |
| 3100 | 3117 | if ( 'publish' !== api.state( 'selectedChangesetStatus' ).get() && slug !== api.settings.theme.stylesheet ) { |
| 3101 | 3118 | deferred.reject({ |
| … |
… |
|
| 3296 | 3313 | |
| 3297 | 3314 | event.preventDefault(); |
| 3298 | 3315 | |
| | 3316 | // Temporary since supplying SFTP credentials does not work yet. See #42184. |
| | 3317 | if ( api.settings.theme._filesystemCredentialsNeeded ) { |
| | 3318 | return; |
| | 3319 | } |
| | 3320 | |
| 3299 | 3321 | // Confirmation dialog for deleting a theme. |
| 3300 | 3322 | if ( ! window.confirm( api.settings.l10n.confirmDeleteTheme ) ) { |
| 3301 | 3323 | return; |
| … |
… |
|
| 4983 | 5005 | * @since 4.2.0 |
| 4984 | 5006 | */ |
| 4985 | 5007 | ready: function() { |
| 4986 | | var control = this, disableSwitchButtons, updateButtons; |
| | 5008 | var control = this; |
| 4987 | 5009 | |
| 4988 | | disableSwitchButtons = function() { |
| | 5010 | function disableSwitchButtons() { |
| 4989 | 5011 | return 'publish' !== api.state( 'selectedChangesetStatus' ).get() && control.params.theme.id !== api.settings.theme.stylesheet; |
| 4990 | | }; |
| 4991 | | updateButtons = function() { |
| 4992 | | control.container.find( 'button' ).toggleClass( 'disabled', disableSwitchButtons() ); |
| 4993 | | }; |
| | 5012 | } |
| 4994 | 5013 | |
| 4995 | | api.state( 'selectedChangesetStatus' ).bind( updateButtons ); |
| | 5014 | // Temporary special function since supplying SFTP credentials does not work yet. See #42184. |
| | 5015 | function disableInstallButtons() { |
| | 5016 | return disableSwitchButtons() || true === api.settings.theme._filesystemCredentialsNeeded; |
| | 5017 | } |
| | 5018 | function updateButtons( container ) { |
| | 5019 | var _container = container || control.container; |
| | 5020 | _container.find( 'button.preview' ).toggleClass( 'disabled', disableSwitchButtons() ); |
| | 5021 | _container.find( 'button.theme-install' ).toggleClass( 'disabled', disableInstallButtons() ); |
| | 5022 | } |
| | 5023 | |
| | 5024 | api.state( 'selectedChangesetStatus' ).bind( function() { |
| | 5025 | updateButtons(); |
| | 5026 | }); |
| 4996 | 5027 | updateButtons(); |
| 4997 | 5028 | |
| 4998 | 5029 | control.container.on( 'touchmove', '.theme', function() { |
| … |
… |
|
| 5019 | 5050 | event.preventDefault(); // Keep this AFTER the key filter above |
| 5020 | 5051 | section = api.section( control.section() ); |
| 5021 | 5052 | section.showDetails( control.params.theme, function() { |
| 5022 | | section.overlay.find( '.theme-actions button' ).toggleClass( 'disabled', disableSwitchButtons() ); |
| | 5053 | updateButtons( section.overlay.find( '.theme-actions' ) ); |
| | 5054 | |
| | 5055 | // Temporary special function since supplying SFTP credentials does not work yet. See #42184. |
| | 5056 | if ( api.settings.theme._filesystemCredentialsNeeded ) { |
| | 5057 | section.overlay.find( '.theme-actions .delete-theme' ).remove(); |
| | 5058 | } |
| 5023 | 5059 | } ); |
| 5024 | 5060 | }); |
| 5025 | 5061 | |
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index 9127650a13..86b79115eb 100644
|
|
|
final class WP_Customize_Manager { |
| 4618 | 4618 | ), |
| 4619 | 4619 | ); |
| 4620 | 4620 | |
| | 4621 | // Temporarily disable installation in Customizer. See #42184. |
| | 4622 | $filesystem_method = get_filesystem_method(); |
| | 4623 | ob_start(); |
| | 4624 | $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); |
| | 4625 | ob_end_clean(); |
| | 4626 | if ( $filesystem_method != 'direct' && ! $filesystem_credentials_are_stored ) { |
| | 4627 | $settings['theme']['_filesystemCredentialsNeeded'] = true; |
| | 4628 | } |
| | 4629 | |
| 4621 | 4630 | // Prepare Customize Section objects to pass to JavaScript. |
| 4622 | 4631 | foreach ( $this->sections() as $id => $section ) { |
| 4623 | 4632 | if ( $section->check_capabilities() ) { |
diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php
index 96ecd1dacd..c46b78daaf 100644
|
|
|
function wp_default_scripts( &$scripts ) { |
| 593 | 593 | ), |
| 594 | 594 | 'scheduleDescription' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ), |
| 595 | 595 | 'themePreviewUnavailable' => __( 'Sorry, you can’t preview new themes when you have changes scheduled or saved as a draft. Please publish your changes, or wait until they publish to preview new themes.' ), |
| | 596 | 'themeInstallUnavailable' => sprintf( |
| | 597 | /* translators: %s is URL to Add Themes admin screen */ |
| | 598 | __( 'You won’t be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">Add Themes</a> in the admin.' ), |
| | 599 | esc_url( admin_url( 'theme-install.php' ) ) |
| | 600 | ), |
| 596 | 601 | ) ); |
| 597 | 602 | $scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 ); |
| 598 | 603 | |