PluginProbe
Connector for Gravity Forms and Google Sheets / trunk
Connector for Gravity Forms and Google Sheets vtrunk
1.3.0 trunk 1.0.2 1.0.3 1.0.4 1.0.7 1.1.1 1.2.0 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9
wp-gravity-forms-spreadsheets / includes / install.php

install.php in Connector for Gravity Forms and Google Sheets trunk, at includes/install.php

77 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4
5
6 if( !class_exists( 'vxg_install_googlesheets' ) ):
7
8 class vxg_install_googlesheets extends vxg_googlesheets{
9 public static $sending_req=false;
10 public function get_roles(){
11 $roles=array(
12 $this->id."_read_feeds",
13 $this->id."_edit_feeds",
14 $this->id."_read_logs" ,
15 $this->id."_export_logs" ,
16 $this->id."_read_settings" ,
17 $this->id."_edit_settings" ,
18 $this->id."_send_to_crm" ,
19 $this->id."_read_license",
20 $this->id."_uninstall"
21 );
22 return $roles;
23
24 }
25 public function create_roles(){
26 global $wp_roles;
27 if ( ! class_exists( 'WP_Roles' ) ) {
28 return;
29 }
30 $roles=$this->get_roles();
31 foreach($roles as $role){
32 $wp_roles->add_cap( 'administrator', $role );
33 }
34 $wp_roles->add_cap( 'administrator', 'vx_crmperks_view_addons' );
35 $wp_roles->add_cap( 'administrator', 'vx_crmperks_edit_addons' );
36 }
37
38 public function remove_roles(){
39 global $wp_roles;
40 if ( ! class_exists( 'WP_Roles' ) ) {
41 return;
42 }
43 $roles=$this->get_roles();
44 foreach($roles as $role){
45 $wp_roles->remove_cap( 'administrator', $role );
46 }
47 }
48 public function remove_data(){
49 global $wpdb;
50
51 //delete options
52 delete_option($this->type."_version");
53 delete_option($this->type."_updates");
54 delete_option($this->type."_settings");
55 $other_version=$this->other_plugin_version();
56 if(empty($other_version)){ //if other version not found
57 delete_option($this->id."_crm");
58 delete_option($this->id."_meta");
59 $this->deactivate('uninstall');
60 $data=$this->get_data_object();
61 $data->drop_tables();
62 $this->remove_roles();
63 }
64
65 $this->deactivate_plugin();
66 }
67 public function deactivate_plugin(){
68 $slug=$this->get_slug();
69 //deactivate
70 deactivate_plugins($slug);
71 update_option('recently_activated', array($slug => time()) + (array)get_option('recently_activated'));
72 }
73
74 }
75
76 endif;
77