PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 1.2.3
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v1.2.3
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
sellkit / includes / contact-segmentation / conditions / shipping-country.php

shipping-country.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 1.2.3, at includes/contact-segmentation/conditions/shipping-country.php

99 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Sellkit\Contact_Segmentation\Conditions;
4
5 use Sellkit\Contact_Segmentation\Conditions\Condition_Base;
6
7 defined( 'ABSPATH' ) || die();
8
9 /**
10 * Class Shipping Country.
11 *
12 * @package Sellkit\Contact_Segmentation\Conditions
13 * @since 1.1.0
14 */
15 class Shipping_Country extends Condition_Base {
16
17 /**
18 * Condition name.
19 *
20 * @since 1.1.0
21 */
22 public function get_name() {
23 return 'shipping-country';
24 }
25
26 /**
27 * Condition title.
28 *
29 * @since 1.1.0
30 */
31 public function get_title() {
32 return __( 'Shipping Country', 'sellkit' );
33 }
34
35 /**
36 * Condition type.
37 *
38 * @since 1.1.0
39 */
40 public function get_type() {
41 return self::SELLKIT_MULTISELECT_CONDITION_VALUE;
42 }
43
44 /**
45 * Get Countries.
46 *
47 * @since 1.1.0
48 * @return array
49 */
50 public function get_options() {
51 $input_value = ! empty( $_GET['input_value'] ) ? sanitize_text_field( $_GET['input_value'] ) : ''; // phpcs:ignore
52 $countries = new \WC_Countries();
53 $countries = $countries->get_countries();
54 $filtered_countries = [];
55
56 if ( empty( $input_value ) ) {
57 return $countries;
58 }
59
60 foreach ( $countries as $key => $country ) {
61
62 if ( strpos( strtolower( $country ), strtolower( $input_value ) ) !== 0 ) {
63 continue;
64 }
65
66 $filtered_countries[ $key ] = html_entity_decode( $country );
67 }
68
69 return $filtered_countries;
70 }
71
72 /**
73 * It is pro feature or not.
74 *
75 * @since 1.1.0
76 */
77 public function is_pro() {
78 return true;
79 }
80
81 /**
82 * It searchable.
83 *
84 * @since 1.1.0
85 */
86 public function is_searchable() {
87 return true;
88 }
89
90 /**
91 * It searchable.
92 *
93 * @since 1.1.0
94 */
95 public function open_menu_on_click() {
96 return true;
97 }
98 }
99