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  * WC POS Admin Gateways Class
 5  *
 6  * @class    WC_POS_Admin_Gateways
 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 class Gateways {
15 
16   public function __construct() {
17     add_filter( 'woocommerce_payment_gateways_setting_columns', array( $this, 'woocommerce_payment_gateways_setting_columns' ), 10, 1 );
18     add_action( 'woocommerce_payment_gateways_setting_column_pos_status', array( $this, 'pos_status' ), 10, 1 );
19     add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
20   }
21 
22   /**
23    * Add POS Status column
24    *
25    * @param  array $columns
26    * @return array $new_columns
27    */
28   public function woocommerce_payment_gateways_setting_columns( $columns ) {
29     $new_columns = array();
30     foreach ( $columns as $key => $column ) {
31       $new_columns[$key] = $column;
32       if( $key == 'status' ) {
33         $new_columns['status'] = __( 'Online Store', 'woocommerce-pos' );
34         $new_columns['pos_status'] = __( 'POS', 'woocommerce-pos' );
35       }
36     }
37     return $new_columns;
38   }
39 
40   /**
41    * POS Status for each gateway
42    *
43    * @param  object $gateway
44    */
45   public function pos_status( $gateway ) {
46     $settings = wc_pos_get_option( 'checkout', 'enabled' );
47     $enabled = is_array($settings) ? array_keys($settings, true) : array();
48 
49     echo '<td class="pos_status">';
50     if ( in_array( $gateway->id, $enabled ) )
51       echo '<span class="status-enabled tips" data-tip="' . /* translators: woocommerce */ __( 'Enabled', 'woocommerce' ) . '">' . /* translators: woocommerce */ __( 'Enabled', 'woocommerce' ) . '</span>';
52     else
53       echo '-';
54     echo '</td>';
55   }
56 
57   /**
58    * CSS
59    */
60   public function enqueue_admin_styles() {
61     $screen = get_current_screen();
62 
63     if ( $screen->id == 'woocommerce_page_wc-settings' ) {
64       $css = '
65         table.wc_gateways .pos_status, table.wc_gateways .pos_enabled { text-align: center; }
66         table.wc_gateways .pos_status .tips, table.wc_gateways .pos_enabled .tips { margin: 0 auto; }
67         .status-disabled:before { font-family:WooCommerce; speak:none; font-weight:400; font-variant:normal; text-transform:none; line-height:1; -webkit-font-smoothing:antialiased; margin:0; text-indent:0; position:absolute; top:0;left:0; width:100%; height:100%; text-align:center; content: "\e602"; color:#E0E0E0; }
68       ';
69       wp_add_inline_style( 'wp-admin', $css );
70     }
71 
72   }
73 
74 }
API documentation generated by ApiGen