AnsPress_Admin_Ajax::ap_toggle_addons()
Description #
Toggle addons.
Source #
File: admin/ajax.php
public static function ap_toggle_addons() { check_ajax_referer( 'ap-toggle-addons', '__nonce' ); if ( ! is_super_admin( ) ) { wp_die( '' ); } $_REQUEST['option_page'] = 'addons'; $previous_addons = get_option( 'anspress_addons', [] ); $new_addons = array_flip( ap_isset_post_value( 'addon', [] ) ); if ( empty( $new_addons ) ) { update_option( 'anspress_addons', [] ); } $addons = $previous_addons + $new_addons; foreach ( (array) $addons as $file => $status ) { if ( ! isset( $new_addons[ $file ] ) ) { ap_deactivate_addon( $file ); } else { ap_activate_addon( $file ); } } wp_die( ); }
Expand full source code Collapse full source code View on GitHub: admin/ajax.php:243
Add your comment