Overview
  • Namespace
  • Class

Namespaces

  • None
  • WC_POS
    • Admin
      • Settings
        • Receipt
    • API
    • Gateways
    • Integrations
    • Products

Classes

  • WC_POS\Activator
  • WC_POS\Admin
  • WC_POS\Admin\Gateways
  • WC_POS\Admin\Menu
  • WC_POS\Admin\Notices
  • WC_POS\Admin\Orders
  • WC_POS\Admin\Page
  • WC_POS\Admin\Permalink
  • WC_POS\Admin\Plugins
  • WC_POS\Admin\Products
  • WC_POS\Admin\Settings
  • WC_POS\Admin\Settings\Access
  • WC_POS\Admin\Settings\Checkout
  • WC_POS\Admin\Settings\Customers
  • WC_POS\Admin\Settings\Gateways
  • WC_POS\Admin\Settings\General
  • WC_POS\Admin\Settings\HotKeys
  • WC_POS\Admin\Settings\Page
  • WC_POS\Admin\Settings\Receipt\Options
  • WC_POS\Admin\Settings\Receipt\Template
  • WC_POS\Admin\Settings\Receipts
  • WC_POS\Admin\Settings\Status
  • WC_POS\Admin\Settings\Tools
  • WC_POS\Admin\Status
  • WC_POS\Ajax
  • WC_POS\API
  • WC_POS\API\Coupons
  • WC_POS\API\Customers
  • WC_POS\API\Gateways
  • WC_POS\API\i18n
  • WC_POS\API\Orders
  • WC_POS\API\Params
  • WC_POS\API\Payload
  • WC_POS\API\Products
  • WC_POS\API\Settings
  • WC_POS\API\Support
  • WC_POS\API\Templates
  • WC_POS\Customers
  • WC_POS\Deactivator
  • WC_POS\Gateways
  • WC_POS\Gateways\Card
  • WC_POS\Gateways\Cash
  • WC_POS\i18n
  • WC_POS\Integrations\Bookings
  • WC_POS\Products
  • WC_POS\Products\Visibility
  • WC_POS\Setup
  • WC_POS\Status
  • WC_POS\Tax
  • WC_POS\Template

Functions

  • is_pos
  • is_pos_admin
  • wc_pos_get_option
  • wc_pos_json_encode
  • wc_pos_locate_template
  • wc_pos_trim_html_string
  • wc_pos_update_option
  • wc_pos_url
 1 <?php
 2 
 3 /**
 4  * The main POS Class
 5  *
 6  * @class     WC_POS
 7  * @package   WooCommerce POS
 8  * @author    Paul Kilmurray <paul@kilbot.com.au>
 9  * @link      http://www.woopos.com.au
10  */
11 
12 namespace WC_POS;
13 
14 class Setup {
15 
16   /**
17    * Constructor
18    */
19   public function __construct() {
20 
21     // global helper functions
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    * Load the required resources
32    */
33   public function init() {
34 
35     // common classes
36     new i18n();
37     new Gateways();
38     new Products();
39     new Customers();
40 
41     // ajax only
42     if( is_admin() && (defined('\DOING_AJAX') && \DOING_AJAX) ){
43       new AJAX();
44     }
45 
46     // admin only
47     if( is_admin() && !(defined('\DOING_AJAX') && \DOING_AJAX) ){
48       new Admin();
49     }
50 
51     // frontend only
52     else {
53       new Template();
54     }
55 
56     // load integrations
57     $this->integrations();
58 
59   }
60 
61   /**
62    * Loads the POS API and patches to the WC REST API
63    */
64   public function load_woocommerce_pos_api(){
65     if( is_pos() ){
66       new API();
67     }
68   }
69 
70   /**
71    * Loads POS integrations with third party plugins
72    */
73   private function integrations(){
74 
75     // WooCommerce Bookings - http://www.woothemes.com/products/woocommerce-bookings/
76     if( class_exists( 'WC-Bookings' ) ){
77       new Integrations\Bookings();
78     }
79 
80   }
81 
82 }
API documentation generated by ApiGen