Astra_Theme_Extension::bulk_activate_modules()

Activate all module


Description


Source

File: classes/class-astra-theme-extension.php

		public function bulk_activate_modules() {

			check_ajax_referer( 'astra-addon-module-nonce', 'nonce' );

			// 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 );

			echo 'success';

			die();
		}

User Contributed Notes

You must log in before being able to contribute a note or feedback.