id = 'integration-agechecker'; $this->method_title = __('AgeChecker.Net', 'woocommerce-integration-agechecker'); $this->method_description = __('E-Commerce Age Verification', 'woocommerce-integration-agechecker'); $args = array( 'number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids ); $product_categories = get_terms( 'product_cat', $args ); if ( !function_exists('get_editable_roles') ) { require_once( ABSPATH . '/wp-admin/includes/user.php' ); } $roles = []; foreach(get_editable_roles() as $role_name => $role_info) $roles[] = $role_name; $this->init_form_fields(); $this->init_settings(); add_action('wp_head', array( $this, 'add_script' ), 1); add_action('woocommerce_update_options_integration_integration-agechecker', array( $this, 'process_admin_options' )); add_action('woocommerce_checkout_process', array( $this, 'validate_order' )); $this->key = $this->get_option('key'); $this->store_name = $this->get_option('store_name'); $this->element = $this->get_option('element'); $this->excluded_categories = $this->get_option('excluded_categories'); $this->excluded_groups = $this->get_option('excluded_groups'); $this->page = $this->get_option('page'); } public function init_form_fields() { $args = array( 'number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids ); $product_categories = get_terms( 'product_cat', $args ); $this->form_fields = array( 'key' => array( 'title' => __('API Key', 'woocommerce-integration-agechecker'), 'type' => 'text', 'description' => __('The API key for this domain. Find it in the websites tab of your AgeChecker.Net account', 'woocommerce-integration-agechecker'), 'default' => '' ), 'store_name' => array( 'title' => __('Store Name', 'woocommerce-integration-agechecker'), 'type' => 'text', 'description' => __('Display name of your store in the popup.', 'woocommerce-integration-agechecker'), 'default' => '' ), 'element' => array( 'title' => __('Element', 'woocommerce-integration-agechecker'), 'type' => 'text', 'description' => __('Element selector to attach the popup event to. (You may need to change this if you use a custom theme/template)', 'woocommerce-integration-agechecker'), 'default' => '#place_order' ), 'excluded_categories' => array( 'title' => __('Exclude Categories', 'woocommerce-integration-agechecker'), 'type' => 'listbox', 'description' => __('Age verification will not be required if all of the cart products are in one these categories.', 'woocommerce-integration-agechecker'), 'default' => '', 'list' => 'categories' ), 'excluded_groups' => array( 'title' => __('Exclude Groups', 'woocommerce-integration-agechecker'), 'type' => 'listbox', 'description' => __('Age verification will be not required if the customer is in one of these groups.', 'woocommerce-integration-agechecker'), 'default' => '', 'list' => 'roles' ), 'page' => array( 'title' => __('Page', 'woocommerce-integration-agechecker'), 'type' => 'text', 'description' => __('Page to show AgeChecker.Net on.', 'woocommerce-integration-agechecker'), 'default' => 'checkout' ) ); } public function generate_listbox_html( $key, $data ) { $field = $this->plugin_id . $this->id . '_' . $key; $defaults = array( 'class' => '', 'css' => '', 'custom_attributes' => array(), 'desc_tip' => false, 'description' => '', 'title' => '', 'list' => array(), ); $args = array( 'number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids ); $product_categories = get_terms( 'product_cat', $args ); $roles = []; foreach(get_editable_roles() as $role_name => $role_info) $roles[] = $role_name; ob_start(); ?>
Invalid excluded roles.', 'woocommerce-integration-agechecker'); ?>
Invalid excluded roles.', 'woocommerce-integration-agechecker'); ?>
API key invalid! Use the 32-character domain key from the website tab in your AgeChecker.Net account area.', 'woocommerce-integration-agechecker'); ?>