PluginProbe
BuddyCommerce: WooCommerce and BuddyPress Integration / 1.0.8
BuddyCommerce: WooCommerce and BuddyPress Integration v1.0.8
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8
buddycommerce / buddycommerce.php

buddycommerce.php in BuddyCommerce: WooCommerce and BuddyPress Integration 1.0.8, at buddycommerce.php

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