PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.31
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.31
1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 1.8.0 All 210 releases
charitable / includes / class-charitable-install.php

class-charitable-install.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.6.31, at includes/class-charitable-install.php

105 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Charitable Install class.
4 *
5 * The responsibility of this class is to manage the events that need to happen
6 * when the plugin is activated.
7 *
8 * @package Charitable/Class/Charitable Install
9 * @copyright Copyright (c) 2020, Studio 164a
10 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
11 * @since 1.0.0
12 * @version 1.5.0
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 if ( ! class_exists( 'Charitable_Install' ) ) :
20
21 /**
22 * Charitable_Install
23 *
24 * @since 1.0.0
25 */
26 class Charitable_Install {
27
28 /**
29 * Install the plugin.
30 *
31 * @since 1.0.0
32 */
33 public function __construct() {
34 $this->setup_roles();
35 $this->create_tables();
36 $this->setup_upgrade_log();
37
38 set_transient( 'charitable_install', 1, 0 );
39 }
40
41 /**
42 * Finish the plugin installation.
43 *
44 * @since 1.3.4
45 *
46 * @return void
47 */
48 public static function finish_installing() {
49 Charitable_Cron::schedule_events();
50
51 add_action( 'init', 'flush_rewrite_rules' );
52 }
53
54 /**
55 * Create wp roles and assign capabilities
56 *
57 * @since 1.0.0
58 *
59 * @return void
60 */
61 protected function setup_roles() {
62 require_once( 'users/class-charitable-roles.php' );
63 $roles = new Charitable_Roles();
64 $roles->add_roles();
65 $roles->add_caps();
66 }
67
68 /**
69 * Create database tables.
70 *
71 * @since 1.0.0
72 *
73 * @return void
74 */
75 protected function create_tables() {
76 require_once( 'abstracts/abstract-class-charitable-db.php' );
77
78 $tables = array(
79 'db/class-charitable-donors-db.php' => 'Charitable_Donors_DB',
80 'db/class-charitable-donormeta-db.php' => 'Charitable_Donormeta_DB',
81 'db/class-charitable-campaign-donations-db.php' => 'Charitable_Campaign_Donations_DB',
82 );
83
84 foreach ( $tables as $file => $class ) {
85 require_once( $file );
86 $table = new $class;
87 $table->create_table();
88 }
89 }
90
91 /**
92 * Set up the upgrade log.
93 *
94 * @since 1.3.0
95 *
96 * @return void
97 */
98 protected function setup_upgrade_log() {
99 require_once( 'admin/upgrades/class-charitable-upgrade.php' );
100 Charitable_Upgrade::get_instance()->populate_upgrade_log_on_install();
101 }
102 }
103
104 endif;
105