Astra_Addon_Admin_Ajax::update_module_status()
Update pro addon module status. activate/deactivate
Description
Source
File: admin/core/includes/class-astra-addon-admin-ajax.php
public function update_module_status() { $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 ); } $module_id = sanitize_text_field( $_POST['module_id'] ); $module_status = sanitize_text_field( $_POST['module_status'] ); $extensions = Astra_Ext_Extension::get_enabled_addons(); $extensions[ $module_id ] = 'activate' === $module_status ? $module_id : false; $extensions = array_map( 'esc_attr', $extensions ); Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $extensions ); if ( 'http2' == $module_id ) { Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_http2', true ); } set_transient( 'astra_addon_activated_transient', $module_id ); wp_send_json_success(); }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
4.0.0 | Introduced. |