PluginProbe
Age Gate / trunk
Age Gate vtrunk
trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 All 112 releases
age-gate / src / Update / Uninstall.php

Uninstall.php in Age Gate trunk, at src/Update/Uninstall.php

44 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AgeGate\Update;
4
5 use Asylum\Utility\Storage;
6 use AgeGate\Common\Immutable\Constants;
7
8 class Uninstall
9 {
10 public static function uninstall()
11 {
12 // delete options
13 foreach (Constants::AGE_GATE_OPTIONS as $option) {
14 delete_option($option);
15 }
16
17 // delete legacy options
18 delete_option('age_gate_updated_from');
19 delete_option('wp_age_gate_restrictions');
20 delete_option('wp_age_gate_messages');
21 delete_option('wp_age_gate_validation_messages');
22 delete_option('wp_age_gate_appearance');
23 delete_option('wp_age_gate_advanced');
24 delete_option('wp_age_gate_access');
25 delete_option('age_gate_dev');
26
27 // delete custom css file
28 // no longer required
29 // wp_delete_file( Storage::storageDir('css', 'age-gate') . '/custom.css' );
30
31 // remove caps
32 foreach (wp_roles()->roles ?? [] as $role => $data) {
33 $r = get_role($role);
34
35 foreach (Constants::AGE_GATE_PERMISSION_ARRAY as $cap) {
36 $r->remove_cap($cap);
37 }
38 }
39
40 // delete version
41 delete_option('age_gate_version');
42 }
43 }
44