-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpwacommerce.php
65 lines (45 loc) · 1.74 KB
/
pwacommerce.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
<?php
/**
* Plugin Name: PWAcommerce
* Plugin URI: http://wordpress.org/plugins/pwacommerce/
* Description: WooCommerce mobile plugin to package your online store into a Progressive Web App.
* Author: PWAcommerce.com
* Author URI: http://pwacommerce.com
* Version: 0.5.1
* Copyright (c) 2020 PWAcommerce.com
* License: The PWAcommerce plugin is Licensed under the Apache License, Version 3.0
* Text Domain: pwacommerce
*/
namespace PWAcommerce;
require_once 'vendor/autoload.php';
require_once 'core/config.php';
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
global $pwacommerce_options;
$pwacommerce_options = new Core\PWAcommerce();
function PWAcommerce_admin_init() {
new Admin\Admin_Init();
}
function PWAcommerce_frontend_init() {
new Frontend\Frontend_Init();
}
global $pwacommerce;
$pwacommerce = new Core\PWAcommerce();
global $pwacommerce_api;
$pwacommerce_api = new Includes\PWAcommerce_API();
add_action('rest_api_init', [ $pwacommerce_api, 'register_pwacommerce_routes' ]);
register_activation_hook( __FILE__, [ $pwacommerce, 'activate' ] );
if ( is_admin() ) {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
$pwacommerce_ajax = new Admin\Admin_Ajax();
add_action( 'wp_ajax_pwacommerce_settings', [ $pwacommerce_ajax, 'settings' ] );
add_action( 'wp_ajax_pwacommerce_subscribe', [ $pwacommerce_ajax, 'subscribe' ] );
add_action( 'wp_ajax_pwacommerce_editimages', [ $pwacommerce_ajax, 'editimages' ] );
add_action( 'wp_ajax_pwacommerce_wookeys', [ $pwacommerce_ajax, 'wookeys' ] );
} else {
add_action( 'plugins_loaded', 'PWAcommerce\pwacommerce_admin_init' );
}
} else {
if ( is_plugin_active ( 'woocommerce/woocommerce.php' ) ) {
add_action( 'plugins_loaded', 'PWAcommerce\pwacommerce_frontend_init' );
}
}