function supercustom_cms_plugin_deactivate()
{
    include 'admin.config.php';
    // Delete all the options that are defined in config
    foreach ($_wp_supercustomcms_Options as $opt) {
        if (isset($opt['id'])) {
            delete_option($opt['id']);
        }
    }
    _wp_supercustomcms_UpdateCaps();
    // Restores other caps back to default
    // remove editor changes
    $role = get_role('editor');
    $role->remove_cap('switch_themes');
    $role->remove_cap('edit_theme_options');
}
function _wp_supercustomcms_Save()
{
    include 'includes/admin.config.php';
    update_option('supercustom_cms_o_ver', _wp_supercustomcms_);
    foreach ($_wp_supercustomcms_Options as $value) {
        if (isset($value['id']) && isset($_REQUEST[$value['id']])) {
            update_option($value['id'], $_REQUEST[$value['id']]);
        } elseif (isset($value['id']) && !isset($_REQUEST[$value['id']])) {
            delete_option($value['id']);
        }
    }
    _wp_supercustomcms_UpdateCaps();
    if ($_REQUEST['supercustom_cms_o_editor_template_access'] == "1") {
        $role = get_role('editor');
        $role->add_cap('edit_theme_options');
    } else {
        $role = get_role('editor');
        $role->remove_cap('switch_themes');
        // Legacy
        $role->remove_cap('edit_theme_options');
    }
    //&saved=true
    header("Location: admin.php?page=WP_SuperCustomCMS");
    die;
}