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  * POS System Status Class
  5  *
  6  * @class    WC_POS_Admin_Status
  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\Admin;
 13 
 14 use WC_POS\Template;
 15 
 16 class Status extends Page {
 17 
 18   /* @var string JS var with page id, used for API requests */
 19   public $wc_pos_adminpage = 'admin_system_status';
 20 
 21   /**
 22    * @var array settings handlers
 23    */
 24   static public $handlers = array(
 25     'tools'     => '\WC_POS\Admin\Settings\Tools',
 26     'status'    => '\WC_POS\Admin\Settings\Status'
 27   );
 28 
 29   /**
 30    * Add Settings page to admin menu
 31    */
 32   public function admin_menu() {
 33     $this->screen_id = add_submenu_page(
 34       \WC_POS\PLUGIN_NAME,
 35       /* translators: woocommerce */
 36       __( 'System Status', 'woocommerce' ),
 37       /* translators: woocommerce */
 38       __( 'System Status', 'woocommerce' ),
 39       'manage_woocommerce_pos',
 40       'wc_pos_system_status',
 41       array( $this, 'display_system_status_page' )
 42     );
 43 
 44     parent::admin_menu();
 45   }
 46 
 47   /**
 48    * Output the settings pages
 49    */
 50   public function display_system_status_page() {
 51     include 'views/settings.php';
 52   }
 53 
 54   /**
 55    * Returns array of settings classes
 56    * @return mixed|void
 57    */
 58   static public function handlers(){
 59     return apply_filters( 'woocommerce_pos_admin_system_status_handlers', self::$handlers);
 60   }
 61 
 62   /**
 63    * Settings scripts
 64    */
 65   public function enqueue_admin_scripts() {
 66     global $wp_scripts;
 67     $wp_scripts->queue = array();
 68 
 69     // deregister scripts
 70     wp_deregister_script( 'jquery' );
 71     wp_deregister_script( 'underscore' );
 72     wp_deregister_script( 'select2' );
 73     wp_deregister_script( 'backbone' );
 74 
 75     // register
 76     $external_libs = Template::get_external_js_libraries();
 77     wp_register_script( 'jquery', $external_libs[ 'jquery' ], false, null, true );
 78     wp_register_script( 'lodash', $external_libs[ 'lodash' ], array( 'jquery' ), null, true );
 79     wp_register_script( 'backbone', $external_libs[ 'backbone' ], array( 'jquery', 'lodash' ), null, true );
 80     wp_register_script( 'backbone.radio', $external_libs[ 'radio' ], array( 'jquery', 'backbone', 'lodash' ), null, true );
 81     wp_register_script( 'marionette', $external_libs[ 'marionette' ], array( 'jquery', 'backbone', 'lodash' ), null, true );
 82     wp_register_script( 'handlebars', $external_libs[ 'handlebars' ], false, null, true );
 83     wp_register_script( 'moment', $external_libs[ 'moment' ], false, null, true );
 84     wp_register_script( 'accounting', $external_libs[ 'accounting' ], false, null, true );
 85 //    wp_register_script( 'select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js', array( 'jquery' ), null, true );
 86 
 87     $build = defined( '\SCRIPT_DEBUG' ) && \SCRIPT_DEBUG ? 'build' : 'min';
 88 
 89     wp_enqueue_script(
 90       'eventsource-polyfill',
 91       \WC_POS\PLUGIN_URL . 'assets/js/vendor/eventsource.min.js',
 92       array(),
 93       null,
 94       true
 95     );
 96 
 97     wp_enqueue_script(
 98       \WC_POS\PLUGIN_NAME . '-admin-system-status-app',
 99       \WC_POS\PLUGIN_URL . 'assets/js/admin-system-status.' . $build . '.js',
100       array( 'backbone', 'backbone.radio', 'marionette', 'handlebars', 'accounting', 'moment' ),
101       \WC_POS\VERSION,
102       true
103     );
104 
105     $scripts = apply_filters( 'woocommerce_pos_admin_enqueue_scripts', array() );
106     if ( isset( $scripts[ 'locale' ] ) ) {
107       wp_enqueue_script(
108         \WC_POS\PLUGIN_NAME . '-js-locale',
109         $scripts[ 'locale' ],
110         array( \WC_POS\PLUGIN_NAME . '-admin-system-status-app' ),
111         \WC_POS\VERSION,
112         true
113       );
114     }
115   }
116 
117 }
API documentation generated by ApiGen