PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.7
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.7
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.7, at includes/class-charitable-install.php

103 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) 2018, Eric Daams
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' ) ) { exit; }
16
17 if ( ! class_exists( 'Charitable_Install' ) ) :
18
19 /**
20 * Charitable_Install
21 *
22 * @since 1.0.0
23 */
24 class Charitable_Install {
25
26 /**
27 * Install the plugin.
28 *
29 * @since 1.0.0
30 */
31 public function __construct() {
32 $this->setup_roles();
33 $this->create_tables();
34 $this->setup_upgrade_log();
35
36 set_transient( 'charitable_install', 1, 0 );
37 }
38
39 /**
40 * Finish the plugin installation.
41 *
42 * @since 1.3.4
43 *
44 * @return void
45 */
46 public static function finish_installing() {
47 Charitable_Cron::schedule_events();
48
49 add_action( 'init', 'flush_rewrite_rules' );
50 }
51
52 /**
53 * Create wp roles and assign capabilities
54 *
55 * @since 1.0.0
56 *
57 * @return void
58 */
59 protected function setup_roles() {
60 require_once( 'users/class-charitable-roles.php' );
61 $roles = new Charitable_Roles();
62 $roles->add_roles();
63 $roles->add_caps();
64 }
65
66 /**
67 * Create database tables.
68 *
69 * @since 1.0.0
70 *
71 * @return void
72 */
73 protected function create_tables() {
74 require_once( 'abstracts/abstract-class-charitable-db.php' );
75
76 $tables = array(
77 'db/class-charitable-donors-db.php' => 'Charitable_Donors_DB',
78 'db/class-charitable-donormeta-db.php' => 'Charitable_Donormeta_DB',
79 'db/class-charitable-campaign-donations-db.php' => 'Charitable_Campaign_Donations_DB',
80 );
81
82 foreach ( $tables as $file => $class ) {
83 require_once( $file );
84 $table = new $class;
85 $table->create_table();
86 }
87 }
88
89 /**
90 * Set up the upgrade log.
91 *
92 * @since 1.3.0
93 *
94 * @return void
95 */
96 protected function setup_upgrade_log() {
97 require_once( 'admin/upgrades/class-charitable-upgrade.php' );
98 Charitable_Upgrade::get_instance()->populate_upgrade_log_on_install();
99 }
100 }
101
102 endif;
103