-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuddycommerce.php
82 lines (72 loc) · 2.47 KB
/
buddycommerce.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Main Plugin file.
*
* @package BuddyCommerce
*
* @wordpress-plugin
* Plugin Name: BuddyCommerce
* Plugin URI: https://buddydev.com/plugins/buddycommerce/
* Description: BuddyPress and WooCommerce Integration.
* Version: 1.0.8
* Author: BuddyDev
* Author URI: https://buddydev.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: buddycommerce
* Domain Path: /languages
* Requires PHP: 5.4
*/
use BuddyCommerce\Bootstrap\BC_Autoloader;
use BuddyCommerce\Bootstrap\BC_Bootstrapper;
// Do not allow direct access over web.
defined( 'ABSPATH' ) || exit;
/**
* Copyright (C) 2019, Brajesh Singh
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License,
* or any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, see <http://www.gnu.org/licenses>.
*/
// Do not allow direct access over web.
defined( 'ABSPATH' ) || exit;
// Load autoloader.
require_once 'src/bootstrap/class-bc-autoloader.php';
require_once 'class-buddycommerce.php';
// Register autoloader.
try {
spl_autoload_register( new BC_Autoloader( 'BuddyCommerce\\', __DIR__ . '/src/' ) );
// Boot the main class.
BuddyCommerce::boot();
// setup bootstrapper.
BC_Bootstrapper::boot();
} catch ( Exception $e ) {
error_log( 'BuddyCommerce: ' . __( 'Unable to register autoloader. The plugin will not work.', 'buddycommerce' ) );
}
/**
* Save default settings on activate.
*/
function bcommerce_on_activate() {
if ( ! get_option( 'buddycommerce_settings' ) ) {
require_once plugin_dir_path( __FILE__ ) . 'src/core/bc-general-functions.php';
update_option( 'buddycommerce_settings', bcommerce_get_default_options() );
}
update_site_option( 'buddycommerce_plugin_version', buddycommerce()->version );
}
register_activation_hook( __FILE__, 'bcommerce_on_activate' );
/**
* Helper method to access BuddyCommerce instance.
*
* @return BuddyCommerce
*/
function buddycommerce() {
return BuddyCommerce::get_instance();
}