Astra_Addon_Admin_Ajax::bulk_activate_modules()
Activate all module
Description
Source
File: admin/core/includes/class-astra-addon-admin-ajax.php
public function bulk_activate_modules() { $response_data = array( 'message' => $this->get_error_msg( 'permission' ) ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( $response_data ); } if ( empty( $_POST ) ) { $response_data = array( 'message' => $this->get_error_msg( 'invalid' ) ); wp_send_json_error( $response_data ); } /** * Nonce verification. */ if ( ! check_ajax_referer( 'astra_addon_update_admin_setting', 'security', false ) ) { $response_data = array( 'message' => $this->get_error_msg( 'nonce' ) ); wp_send_json_error( $response_data ); } // Get all extensions. $all_extensions = Astra_Ext_Extension::get_addons(); // Sanitize Addon list. foreach ( $all_extensions as $key => $value ) { $all_extensions[ sanitize_key( $key ) ] = $value; } $new_extensions = array(); // Set all extension to enabled. foreach ( $all_extensions as $slug => $value ) { $new_extensions[ $slug ] = $slug; } // Escape attrs. $new_extensions = array_map( 'esc_attr', $new_extensions ); // Update new_extensions. Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $new_extensions ); Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_http2', true ); set_transient( 'astra_addon_activated_transient', $new_extensions ); wp_send_json_success(); }
Expand full source code Collapse full source code View on Trac