PluginProbe
WANotifier for Forms and Actions / 2.4.3
WANotifier for Forms and Actions v2.4.3
3.1.1 3.1.0 3.0.4 2.7.10 2.7.11 2.7.12 2.7.13 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 3.0.0 3.0.1 3.0.2 3.0.3 trunk 0.1.0 0.1.1 1.0.0 1.0.1 1.0.2 All 67 releases
← All changes | includes/classes/class-notifier-settings.php +14 -106 2.7.42.4.3 View file →
@@ -38,19 +38,13 @@
38 38 * Get settings tabs
39 39 */
40 40 private static function get_settings_tabs() {
41 41 $tabs = array(
42 - 'general' => 'General',
43 - 'woocommerce' => 'WooCommerce',
42 + 'general' => 'General',
44 43 'click_to_chat' => 'Click to Chat',
45 - 'api' => 'API',
46 - 'advanced' => 'Advanced',
44 + 'api' => 'API',
45 + 'advanced' => 'Advanced'
47 46 );
48 -
49 - if ( ! class_exists( 'WooCommerce' ) ) {
50 - unset($tabs['woocommerce']);
51 - }
52 -
53 47 return $tabs;
54 48 }
55 49
56 50 /**
@@ -80,9 +74,8 @@
80 74 $settings = array(
81 75 array(
82 76 'title' => 'General',
83 77 'type' => 'title',
84 - 'description' => ''
85 78 ),
86 79 array(
87 80 'id' => 'default_country_code',
88 81 'title' => 'Default Country Code (Optional)',
@@ -91,36 +84,8 @@
91 84 'description' => 'Enter default country code that will be added to all recipient phone number fields before sending to WANotifier that do not start with a + sign.',
92 85 'default' => ''
93 86 ),
94 87 );
95 -
96 - if ( class_exists( 'WooCommerce' ) ) {
97 - $settings = array_merge( $settings, array(
98 - array(
99 - 'title' => 'WooCommerce',
100 - 'type' => 'title',
101 - 'description' => ''
102 - ),
103 - array(
104 - 'id' => 'enable_opt_in_checkbox_checkout',
105 - 'title' => 'Opt-in Consent on Checkout',
106 - 'type' => 'checkbox',
107 - 'default' => '',
108 - 'label' => 'Enable',
109 - 'name' => 'enable_opt_in_checkbox_checkout',
110 - 'description' => 'Add an opt-in checkbox to WooCommerce checkout form. Once enabled, WhatsApp notification will be sent only to customers who opt-in during checkout.'
111 - ),
112 - array(
113 - 'id' => 'checkout_opt_in_checkbox_text',
114 - 'title' => 'Opt-in Checkbox Text',
115 - 'type' => 'textarea',
116 - 'placeholder' => 'Enter text for the opt-in checkbox',
117 - 'default' => 'Receive updates on WhatsApp',
118 - 'name' => 'checkout_opt_in_checkbox_text',
119 - )
120 - ) );
121 - }
122 -
123 88 break;
124 89 case 'click_to_chat':
125 90 $settings = array(
126 91 array(
@@ -157,9 +122,16 @@
157 122 'name' => 'ctc_button_style',
158 123 'class' => 'chat-button-style',
159 124 'type' => 'select',
160 125 'default' => '',
161 - 'options' => self::get_button_styles(),
126 + 'options' => array(
127 + 'default' => 'Select button style',
128 + 'btn-style-1' => 'Style 1' ,
129 + 'btn-style-2' => 'Style 2',
130 + 'btn-style-3' => 'Style 3',
131 + 'btn-style-4' => 'Style 4',
132 + 'btn-custom-image' => 'Add your own image'
133 + ),
162 134 'description' => 'Select a button style. Preview will be shown on bottom right of this screen. You can update button style by writing custom CSS in your theme.',
163 135 ),
164 136 array(
165 137 'id' => 'ctc_custom_button_image_url',
@@ -198,58 +170,23 @@
198 170 'type' => 'title',
199 171 ),
200 172 array(
201 173 'id' => 'hidden_custom_keys',
202 - 'title' => 'Hidden custom meta keys',
174 + 'title' => 'Enable hidden custom meta keys',
203 175 'type' => 'checkbox',
204 - 'label' => 'Enable',
205 176 'description' => 'Enable hidden custom meta keys that start with underscores (e.g. _field_name) to be avaialbe in Data and Recipient Fields. Note that enabling this might impact your website performance slightly.',
206 177 'default' => ''
207 178 ),
208 179 array(
209 180 'id' => 'enable_async_triggers',
210 - 'title' => 'Async triggers',
181 + 'title' => 'Enable async triggers',
211 182 'type' => 'checkbox',
212 183 'default' => '',
213 - 'label' => 'Enable',
214 184 'name' => 'enable_async_triggers',
215 185 'description' => 'Plugin slowing down checkout or form submission? Enable this option to send triggers asynchronously using Action Scheduler. Note that if you have a site with strong caching, this might not work as expected.' ,
216 186 ),
217 - array(
218 - 'id' => 'enable_activity_log',
219 - 'title' => 'Activity log',
220 - 'type' => 'checkbox',
221 - 'default' => '',
222 - 'label' => 'Enable',
223 - 'name' => 'enable_activity_log',
224 - 'description' => 'Enabling this option will activate the activity logging feature. You can view activity logs <a href="/wp-admin/admin.php?page=notifier-tools">here</a>.' ,
225 - ),
226 187 );
227 188 break;
228 - case 'woocommerce':
229 - if ( class_exists( 'WooCommerce' ) ) {
230 - $settings = array(
231 - array(
232 - 'id' => 'enable_abandonment_cart_tracking',
233 - 'title' => 'Abandoned cart tracking',
234 - 'type' => 'checkbox',
235 - 'default' => '',
236 - 'label' => 'Start capturing abandoned carts',
237 - 'name' => 'enable_abandonment_cart_tracking',
238 - 'description' => 'Enable this to start capturing abandoned carts in database. Carts will be considered as abandoned if order is not placed by the user after adding items in the cart within cart abandoned cut-off time set below.'
239 - ),
240 - array(
241 - 'id' => 'abandonment_cart_cron_run_time',
242 - 'title' => 'Cart abandoned cut-off time',
243 - 'type' => 'number',
244 - 'placeholder' => 'Enter time in minutes. Eg. 20',
245 - 'description' => 'Enter time in minutes after which the cart will be considered as abandoned. This is the time from when items are added / updated in cart.',
246 - 'default' => '20',
247 - 'custom_attributes' => array('min' => 20),
248 - ),
249 - );
250 - }
251 - break;
252 189 }
253 190 $settings = apply_filters( 'notifier_$tab_settings_fields', $settings );
254 191 return $settings;
255 192 }
@@ -257,14 +194,8 @@
257 194 /**
258 195 * Generate HTML for displaying individual fields
259 196 */
260 197 public static function display_field( $field ) {
261 - $field = wp_parse_args($field, array(
262 - 'title' => '',
263 - 'description' => '',
264 - 'label' => ''
265 - ));
266 -
267 198 $html = '';
268 199
269 200 if (isset($field['id'])) {
270 201 $option_name = NOTIFIER_PREFIX . $field['id'];
@@ -270,9 +201,9 @@
270 201 $option_name = NOTIFIER_PREFIX . $field['id'];
271 202 $option = get_option( $option_name );
272 203 }
273 204
274 - $data = isset($option) ? $option : '';
205 + $data = $option;
275 206 if ( isset( $field['default'] ) && empty($option) ) {
276 207 $data = $field['default'];
277 208 }
278 209
@@ -596,35 +527,12 @@
596 527 }
597 528 }
598 529
599 530 /**
600 - * Get button styles
601 - */
602 - public static function get_button_styles(){
603 - return array(
604 - 'default' => 'Select button style',
605 - 'btn-style-1' => 'Style 1' ,
606 - 'btn-style-2' => 'Style 2',
607 - 'btn-style-3' => 'Style 3',
608 - 'btn-style-4' => 'Style 4',
609 - 'btn-custom-image' => 'Add your own image'
610 - );
611 - }
612 -
613 - /**
614 531 * Show Chat Button Preview
615 532 */
616 533 public static function preview_btn_style(){
617 534 $btn_style = isset($_POST['btn_style']) ? sanitize_text_field($_POST['btn_style']) : '';
618 -
619 - $button_styles = self::get_button_styles();
620 - $button_style_keys = array_keys($button_styles);
621 -
622 - if(! in_array($btn_style, $button_style_keys)){
623 - wp_send_json( array(
624 - 'preview' => 'Invalid request'
625 - ) );
626 - }
627 535
628 536 ob_start();
629 537 include_once NOTIFIER_PATH.'templates/buttons/'.$btn_style.'.php';
630 538 $btn_output = ob_get_clean();