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  * Administrative Tools
 5  *
 6  * @class    WC_POS_Admin_Settings_Tools
 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\Settings;
13 
14 class HotKeys extends Page {
15 
16   protected static $instance;
17   private $labels;
18 
19   /**
20    * Each settings tab requires an id and label
21    */
22   public function __construct() {
23     $this->id    = 'hotkeys';
24     $this->label = _x( 'HotKeys', 'keyboard shortcuts', 'woocommerce-pos' );
25 
26     $this->defaults = array(
27       'hotkeys' => array(
28         'help' => array(
29           'key' => '?'
30         ),
31         'barcode' => array(
32           'key' => 'B'
33         ),
34         'search' => array(
35           'key' => 'V'
36         ),
37         'sync' => array(
38           'key' => 'S'
39         )
40       )
41     );
42 
43     $this->labels = array(
44       'help'    => __( 'Help screen', 'woocommerce-pos' ),
45       'barcode' => __( 'Barcode search', 'woocommerce-pos' ),
46       'search'  => /* translators: woocommerce */__( 'Search', 'woocommerce' ),
47       'new'     => __( 'New order', 'woocommerce-pos' ),
48       'sync'    => __( 'Sync with server', 'woocommerce-pos' )
49     );
50   }
51 
52   public function get($key = false){
53     $data = get_option( $this->option_name() );
54     if(!$data){ $data = $this->defaults; }
55     $data['hotkeys'] = array_merge($this->defaults['hotkeys'], $data['hotkeys']);
56 
57     foreach($data['hotkeys'] as $slug => &$arr){
58       $arr['label'] = $this->labels[$slug];
59     }
60 
61     if($key && is_array($data)) {
62       $data = array_key_exists($key, $data) ? $data[$key] : false;
63     }
64 
65     return $data;
66   }
67 
68 }
API documentation generated by ApiGen