id = 'integration-agechecker'; $this->method_title = 'AgeChecker.Net'; $product_categories = get_terms('product_cat'); if (!function_exists('get_editable_roles')) { require_once(ABSPATH . '/wp-admin/includes/user.php'); } $roles = array(); 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->categories_mode = $this->get_option('categories_mode'); $this->excluded_groups = $this->get_option('excluded_groups'); $this->groups_mode = $this->get_option('groups_mode'); $this->page = $this->get_option('page'); $this->client_config = wp_specialchars_decode($this->get_option('client_config'), 'double'); $this->before_script = wp_specialchars_decode($this->get_option('before_script'), 'double'); // Set settings to version without entity codes. $this->settings['client_config'] = $this->client_config; $this->settings['before_script'] = $this->before_script; } public function init_form_fields() { $this->form_fields = array( 'key' => array( 'title' => 'API Key', 'type' => 'text', 'description' => 'The API key for this domain. Find it in the websites tab of your AgeChecker.Net account.', 'default' => '', 'desc_tip' => false, ), 'store_name' => array( 'title' => 'Store Name', 'type' => 'text', 'description' => 'Display name of your store in the popup.', 'default' => get_bloginfo('name'), 'desc_tip' => false, ), 'element' => array( 'title' => 'Element', 'type' => 'text', 'description' => 'Element selector to attach the popup event to. You may need to change this if you use a custom theme/template. Please contact us if the popup is not showing when the element is clicked. The default element is the final checkout button.', 'default' => '#place_order', 'desc_tip' => false, ), 'excluded_categories' => array( 'title' => 'Exclude/Include Categories', 'type' => 'listbox', 'default' => '', 'list' => 'categories', 'desc_tip' => false, ), 'categories_mode' => array( 'type' => 'radio', 'default' => 'exclude', 'list' => 'categories', 'desc_tip' => false, ), 'excluded_groups' => array( 'title' => 'Exclude/Include Groups', 'type' => 'listbox', 'default' => '', 'list' => 'roles', 'desc_tip' => false, ), 'groups_mode' => array( 'type' => 'radio', 'default' => 'exclude', 'list' => 'roles', 'desc_tip' => false, ), 'page' => array( 'title' => 'Page', 'type' => 'text', 'description' => 'Page to show AgeChecker.Net on.', 'default' => 'checkout', 'desc_tip' => false, ), 'client_config' => array( 'title' => 'Additional Config (Advanced)', 'type' => 'textarea', 'description' => 'Other additional configuration options from our client API.', 'desc_tip' => false, 'css' => 'width: 400px' ), 'before_script' => array( 'title' => 'Before Load Script (Advanced)', 'type' => 'textarea', 'description' => 'Custom code to run before the script is loaded. Use "return" to prevent loading.', 'desc_tip' => false, 'css' => 'width: 400px' ) ); } public function generate_radio_html($key, $data) { $field = $this->plugin_id . $this->id . '_' . $key; $excluded = true; if($this->get_option($key) == 'include') $excluded = false; ob_start(); ?>
Invalid excluded roles.
Invalid excluded roles.
API key invalid! Use the 32-character domain key from the website tab in your AgeChecker.Net account area.'