diff --git a/includes/bootstrap.php b/includes/bootstrap.php index 7a5b5d19c..e0e0318e7 100644 --- a/includes/bootstrap.php +++ b/includes/bootstrap.php @@ -223,35 +223,33 @@ function() { * * @since x.x.x */ -add_action( - 'load-plugins.php', - static function() { - // Exit if deactivating plugin from sub site. - $screen = get_current_screen(); - if ( ! ( ! is_multisite() || $screen->in_admin( 'network' ) ) ) { - return; - } +function register_deactivation_modal() { + // Exit if deactivating plugin from sub site. + $screen = get_current_screen(); + if ( ! ( ! is_multisite() || $screen->in_admin( 'network' ) ) ) { + return; + } - wp_enqueue_script( 'jquery-ui-dialog' ); - wp_enqueue_style( 'wp-jquery-ui-dialog' ); + wp_enqueue_script( 'jquery-ui-dialog' ); + wp_enqueue_style( 'wp-jquery-ui-dialog' ); - add_action( - 'admin_footer', - static function () { - printf( - '', - esc_html__( 'Would you like to delete all Distributor data?', 'distributor' ), - esc_html__( 'By default the database entries are not deleted when you deactivate Distributor. If you are deleting Distributor completely from your website and want those items removed as well check, add below code to wp-config.php .', 'distributor' ), - 'define(\'DT_REMOVE_ALL_DATA\', true)', - esc_html__( 'After adding this code, the Distributor plugin data will be removed from the main website database when deleting the plugin. You can review uninstall.php (in the plugin root directory) to learn more about deleted data. After deleting the Distributor plugin, you can remove the code.', 'distributor' ) - ); - } - ); + add_action( + 'admin_footer', + static function () { + printf( + '', + esc_html__( 'Would you like to delete all Distributor data?', 'distributor' ), + esc_html__( 'By default the database entries are not deleted when you deactivate Distributor. If you are deleting Distributor completely from your website and want those items removed as well check, add below code to wp-config.php .', 'distributor' ), + 'define(\'DT_REMOVE_ALL_DATA\', true)', + esc_html__( 'After adding this code, the Distributor plugin data will be removed from the main website database when deleting the plugin. You can review uninstall.php (in the plugin root directory) to learn more about deleted data. After deleting the Distributor plugin, you can remove the code.', 'distributor' ) + ); + } + ); - $modal_title = esc_js( esc_html__( 'Distributor Deactivation', 'distributor' ) ); - $modal_button_title_deactivate = esc_js( esc_html__( 'Deactivate', 'distributor' ) ); - $modal_button_title_cancel = esc_js( esc_html__( 'Cancel', 'distributor' ) ); - $script = <<