1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace WC_POS;
13
14 class Setup {
15
16 17 18
19 public function __construct() {
20
21
22 require_once PLUGIN_PATH . 'includes/wc-pos-functions.php';
23
24 add_action( 'init', array( $this, 'init' ) );
25 add_action( 'woocommerce_api_loaded', array( $this, 'load_woocommerce_pos_api') );
26 do_action( 'woocommerce_pos_loaded' );
27
28 }
29
30 31 32
33 public function init() {
34
35
36 new i18n();
37 new Gateways();
38 new Products();
39 new Customers();
40
41
42 if( is_admin() && (defined('\DOING_AJAX') && \DOING_AJAX) ){
43 new AJAX();
44 }
45
46
47 if( is_admin() && !(defined('\DOING_AJAX') && \DOING_AJAX) ){
48 new Admin();
49 }
50
51
52 else {
53 new Template();
54 }
55
56
57 $this->integrations();
58
59 }
60
61 62 63
64 public function load_woocommerce_pos_api(){
65 if( is_pos() ){
66 new API();
67 }
68 }
69
70 71 72
73 private function integrations(){
74
75
76 if( class_exists( 'WC-Bookings' ) ){
77 new Integrations\Bookings();
78 }
79
80 }
81
82 }