WhatsApp me - Version 3.1.0

Version Description

  • NEW: WhatsApp button image.
  • NEW: WhatsApp button tooltip.
  • NEW: Start WhatsApp button text on Chat Window.
  • NEW: Option to disable automatic open of Chat Window.
  • For devs: static functions moved to a WhatsAppMe_Util class.
Download this release

Release Info

Developer creapuntome
Plugin Icon 128x128 WhatsApp me
Version 3.1.0
Comparing to
See all releases

Code changes from version 3.0.3 to 3.1.0

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: whatsapp business, whatsapp, click to chat, button, whatsapp support chat,
5
  Requires at least: 3.0.1
6
  Tested up to: 5.2
7
  Requires PHP: 5.3
8
- Stable tag: 3.0.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -19,6 +19,8 @@ Connect a WordPress chat with WhatsApp. The best solution for marketing and supp
19
 
20
  ### New in WAme 3.0 📍
21
 
 
 
22
  🛒 **Better Integration with WooCommerce**. Define CTAs and Custom Messages for product pages, you can use dynamic variables such as {SKU}, {PRICE} or {PRODUCT}.
23
 
24
  📈 **Facebook Pixel integration**. Sends a custom event when user launch WhatsApp.
@@ -135,18 +137,30 @@ There is a Javascript event that WAme triggers automatically before launch Whats
135
 
136
  == Screenshots ==
137
 
138
- 1. WAme general settings.
139
- 2. WAme advanced visibility settings.
140
- 3. WAme on post/page edition.
 
 
 
 
 
141
 
142
  == Changelog ==
143
 
 
 
 
 
 
 
 
144
  = 3.0.3 =
145
  * FIX in landscape or with long CTAs the chat window could be higher than view and can't be closed.
146
  * For developers:
147
- * New metabox filters 'whatsappme_metabox_output' and 'whatsappme_metabox_save'.
148
- * Change filter 'whatsappme_message_replacements' to 'whatsappme_format_replacements'.
149
- * Change filter 'whatsappme_message_send_replacements' to 'whatsappme_variable_replacements'.
150
 
151
  = 3.0.2 =
152
  * **NEW:** Send Facebook Pixel custom event when user launch WhatsApp.
5
  Requires at least: 3.0.1
6
  Tested up to: 5.2
7
  Requires PHP: 5.3
8
+ Stable tag: 3.1.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
19
 
20
  ### New in WAme 3.0 📍
21
 
22
+ 🔮 **Magic WhatsApp button**. Add your logo, profile picture or even an animated gif. You can define a tooltip to capture the user's attention, the limit is set by your creativity.
23
+
24
  🛒 **Better Integration with WooCommerce**. Define CTAs and Custom Messages for product pages, you can use dynamic variables such as {SKU}, {PRICE} or {PRODUCT}.
25
 
26
  📈 **Facebook Pixel integration**. Sends a custom event when user launch WhatsApp.
137
 
138
  == Screenshots ==
139
 
140
+ 1. Button on desktop.
141
+ 2. Button with tooltip and custom image.
142
+ 3. Call to action on desktop.
143
+ 4. Button and call to action on mobile.
144
+ 5. WAme general settings.
145
+ 6. WAme advanced visibility settings.
146
+ 7. WAme WooCommerce settings.
147
+ 8. WAme on post/page edition.
148
 
149
  == Changelog ==
150
 
151
+ = 3.1.0 =
152
+ * **NEW:** WhatsApp button image.
153
+ * **NEW:** WhatsApp button tooltip.
154
+ * **NEW:** Start WhatsApp button text on Chat Window.
155
+ * **NEW:** Option to disable automatic open of Chat Window.
156
+ * For devs: static functions moved to a WhatsAppMe_Util class.
157
+
158
  = 3.0.3 =
159
  * FIX in landscape or with long CTAs the chat window could be higher than view and can't be closed.
160
  * For developers:
161
+ * New metabox filters 'whatsappme_metabox_output' and 'whatsappme_metabox_save'.
162
+ * Change filter 'whatsappme_message_replacements' to 'whatsappme_format_replacements'.
163
+ * Change filter 'whatsappme_message_send_replacements' to 'whatsappme_variable_replacements'.
164
 
165
  = 3.0.2 =
166
  * **NEW:** Send Facebook Pixel custom event when user launch WhatsApp.
admin/class-whatsappme-admin.php CHANGED
@@ -3,9 +3,6 @@
3
  /**
4
  * The admin-specific functionality of the plugin.
5
  *
6
- * Defines the plugin name, version, and two examples hooks for how to
7
- * enqueue the admin-specific stylesheet and JavaScript.
8
- *
9
  * @since 1.0.0
10
  * @since 2.0.0 Added advanced visibility settings
11
  * @since 3.0.0 More extendable admin via hooks
@@ -88,6 +85,7 @@ class WhatsAppMe_Admin {
88
  * @since 2.1.0 Added message_badge
89
  * @since 2.3.0 Added button_delay and whatsapp_web settings, message_delay in seconds
90
  * @since 3.0.0 Is public and added plugin enhanced_phone and tabs
 
91
  */
92
  public function get_settings() {
93
 
@@ -107,12 +105,15 @@ class WhatsAppMe_Admin {
107
  array(
108
  'telephone' => '',
109
  'mobile_only' => 'no',
 
 
110
  'button_delay' => 3,
111
  'whatsapp_web' => 'no',
112
  'message_text' => '',
113
  'message_delay' => 10,
114
  'message_badge' => 'no',
115
  'message_send' => '',
 
116
  'position' => 'right',
117
  'visibility' => array( 'all' => 'yes' ),
118
  ),
@@ -224,6 +225,7 @@ class WhatsAppMe_Admin {
224
  * Return an array of sections and fields for the admin tab
225
  *
226
  * @since 3.0.0
 
227
  * @param string $tab The id of the admin tab.
228
  * @return array
229
  */
@@ -234,16 +236,19 @@ class WhatsAppMe_Admin {
234
  $sections = array(
235
  'button' => array(
236
  'telephone' => '<label for="whatsappme_phone">' . __( 'Telephone', 'creame-whatsapp-me' ) . '</label>',
 
237
  'mobile_only' => __( 'Mobile Only', 'creame-whatsapp-me' ),
238
  'position' => __( 'Position On Screen', 'creame-whatsapp-me' ),
 
 
239
  'button_delay' => '<label for="whatsappme_button_delay">' . __( 'Button Delay', 'creame-whatsapp-me' ) . '</label>',
240
  'whatsapp_web' => __( 'WhatsApp Web', 'creame-whatsapp-me' ),
241
  ),
242
  'chat' => array(
243
  'message_text' => '<label for="whatsappme_message_text">' . __( 'Call To Action', 'creame-whatsapp-me' ) . '</label>',
244
- 'message_send' => '<label for="whatsappme_message_send">' . __( 'Message', 'creame-whatsapp-me' ) . '</label>',
245
  'message_delay' => '<label for="whatsappme_message_delay">' . __( 'Chat Delay', 'creame-whatsapp-me' ) . '</label>',
246
- 'message_badge' => __( 'Hide Chat', 'creame-whatsapp-me' ),
247
  ),
248
  );
249
 
@@ -312,19 +317,25 @@ class WhatsAppMe_Admin {
312
  * @since 2.1.0 Added message_badge
313
  * @since 2.3.0 Added button_delay and whatsapp_web settings, WPML integration
314
  * @since 3.0.0 Added filter for extra settings and action for extra tasks
 
315
  * @param array $input contain keys 'id', 'title' and 'callback'.
316
  * @return array
317
  */
318
  public function settings_validate( $input ) {
319
 
320
- $input['telephone'] = self::clean_input( $input['telephone'] );
 
 
321
  $input['mobile_only'] = isset( $input['mobile_only'] ) ? 'yes' : 'no';
 
 
322
  $input['button_delay'] = intval( $input['button_delay'] );
323
  $input['whatsapp_web'] = isset( $input['whatsapp_web'] ) ? 'yes' : 'no';
324
- $input['message_text'] = self::clean_input( $input['message_text'] );
325
- $input['message_delay'] = intval( $input['message_delay'] );
326
  $input['message_badge'] = isset( $input['message_badge'] ) ? 'yes' : 'no';
327
- $input['message_send'] = self::clean_input( $input['message_send'] );
 
 
328
  $input['position'] = $input['position'] != 'left' ? 'right' : 'left';
329
  if ( isset( $input['view'] ) ) {
330
  $input['visibility'] = array_filter(
@@ -345,8 +356,10 @@ class WhatsAppMe_Admin {
345
  * Note: don't translate string $name to prevent missing translations if
346
  * public front lang is different of admin lang
347
  */
 
348
  do_action( 'wpml_register_single_string', 'WhatsApp me', 'Call To Action', $input['message_text'] );
349
  do_action( 'wpml_register_single_string', 'WhatsApp me', 'Message', $input['message_send'] );
 
350
 
351
  // Action to register more WPML strings or other tasks
352
  do_action( 'whatsappme_settings_validate', $input );
@@ -402,7 +415,7 @@ class WhatsAppMe_Admin {
402
  break;
403
 
404
  case 'whatsappme_tab_general__chat':
405
- $output = '<h2 class="title">' . __( 'Chat Window', 'creame-whatsapp-me' ) . '</h2>' .
406
  '<p>' .
407
  __( 'Set the behavior of the chat window.', 'creame-whatsapp-me' ) . ' ' .
408
  ' <em>' . __( 'You can use styles and dynamic variables', 'creame-whatsapp-me' ) . '</em> ' .
@@ -437,6 +450,7 @@ class WhatsAppMe_Admin {
437
  * Field HTML output
438
  *
439
  * @since 3.0.0
 
440
  * @return void
441
  */
442
  public function field_output( $field_id ) {
@@ -480,6 +494,23 @@ class WhatsAppMe_Admin {
480
  __( 'Right', 'creame-whatsapp-me' ) . '</label></fieldset>';
481
  break;
482
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
  case 'button_delay':
484
  $output = '<input id="whatsappme_button_delay" name="whatsappme[button_delay]" value="' . $value . '" type="number" min="0" max="120" style="width:5em"> ' . __( 'seconds', 'creame-whatsapp-me' ) .
485
  '<p class="description">' . __( 'Time since the page is opened until the WhatsApp button is displayed', 'creame-whatsapp-me' ) . '</p>';
@@ -493,22 +524,27 @@ class WhatsAppMe_Admin {
493
 
494
  case 'message_text':
495
  $output = '<textarea id="whatsappme_message_text" name="whatsappme[message_text]" rows="4" class="regular-text" placeholder="' . esc_attr__( "Hello 👋\nCan we help you?", 'creame-whatsapp-me' ) . '">' . $value . '</textarea>' .
496
- '<p class="description">' . __( 'Define a text to encourage users to contact by WhatsApp <strong>(optional)</strong>', 'creame-whatsapp-me' ) . '</p>';
497
  break;
498
 
499
  case 'message_send':
500
- $output = '<textarea id="whatsappme_message_send" name="whatsappme[message_send]" rows="3" class="regular-text" placeholder="' . esc_attr__( 'Hi *{SITE}*! I need more info about {TITLE}', 'creame-whatsapp-me' ) . '">' . $value . '</textarea>' .
501
- '<p class="description">' . __( 'Predefined text with which user can start the conversation <strong>(optional)</strong>', 'creame-whatsapp-me' ) . '</p>';
 
 
 
 
 
502
  break;
503
 
504
  case 'message_delay':
505
- $output = '<input id="whatsappme_message_delay" name="whatsappme[message_delay]" value="' . $value . '" type="number" min="0" max="120" style="width:5em"> ' . __( 'seconds', 'creame-whatsapp-me' ) .
506
- '<p class="description">' . __( 'Time since the WhatsApp button is displayed until the Chat Window opens', 'creame-whatsapp-me' ) . '</p>';
507
  break;
508
 
509
  case 'message_badge':
510
- $output = '<fieldset><legend class="screen-reader-text"><span>' . __( 'Hide Chat', 'creame-whatsapp-me' ) . '</span></legend>' .
511
- '<label><input name="whatsappme[message_badge]" value="yes" type="checkbox"' . checked( 'yes', $value, false ) . '> ' .
512
  __( 'Display a notification balloon instead of opening the Chat Window for a "less intrusive" mode', 'creame-whatsapp-me' ) . '</label></fieldset>';
513
  break;
514
 
@@ -537,7 +573,6 @@ class WhatsAppMe_Admin {
537
  'all' => array( 'front_page', 'blog_page', '404_page', 'search', 'archive', 'singular', 'cpts' ),
538
  'archive' => array( 'date', 'author' ),
539
  'singular' => array( 'page', 'post' ),
540
- // 'woocommerce': ['product', 'cart', 'checkout', 'account_page']
541
  )
542
  );
543
 
@@ -641,6 +676,8 @@ class WhatsAppMe_Admin {
641
  */
642
  function options_page() {
643
 
 
 
644
  // Enqueue assets
645
  wp_enqueue_script( 'whatsappme-admin' );
646
  wp_enqueue_style( 'whatsappme-admin' );
@@ -793,7 +830,7 @@ class WhatsAppMe_Admin {
793
 
794
  // Clean and delete empty/false fields
795
  $metadata = array_filter(
796
- self::clean_input(
797
  array(
798
  'telephone' => $_POST['whatsappme_telephone'],
799
  'message_text' => $_POST['whatsappme_message'],
@@ -811,23 +848,4 @@ class WhatsAppMe_Admin {
811
  delete_post_meta( $post_id, '_whatsappme' );
812
  }
813
  }
814
-
815
- /**
816
- * Clean user input fields
817
- *
818
- * @since 2.0.0
819
- * @access public
820
- * @param mixed $value to clean
821
- * @return mixed $value cleaned
822
- */
823
- public static function clean_input( $value ) {
824
- if ( is_array( $value ) ) {
825
- return array_map( 'self::clean_input', $value );
826
- } elseif ( is_string( $value ) ) {
827
- // Split lines, clean and re-join lines
828
- return implode( "\n", array_map( 'sanitize_text_field', explode( "\n", trim( $value ) ) ) );
829
- } else {
830
- return $value;
831
- }
832
- }
833
  }
3
  /**
4
  * The admin-specific functionality of the plugin.
5
  *
 
 
 
6
  * @since 1.0.0
7
  * @since 2.0.0 Added advanced visibility settings
8
  * @since 3.0.0 More extendable admin via hooks
85
  * @since 2.1.0 Added message_badge
86
  * @since 2.3.0 Added button_delay and whatsapp_web settings, message_delay in seconds
87
  * @since 3.0.0 Is public and added plugin enhanced_phone and tabs
88
+ * @since 3.1.0 Added tooltip and image
89
  */
90
  public function get_settings() {
91
 
105
  array(
106
  'telephone' => '',
107
  'mobile_only' => 'no',
108
+ 'button_image' => '',
109
+ 'button_tip' => '',
110
  'button_delay' => 3,
111
  'whatsapp_web' => 'no',
112
  'message_text' => '',
113
  'message_delay' => 10,
114
  'message_badge' => 'no',
115
  'message_send' => '',
116
+ 'message_start' => '',
117
  'position' => 'right',
118
  'visibility' => array( 'all' => 'yes' ),
119
  ),
225
  * Return an array of sections and fields for the admin tab
226
  *
227
  * @since 3.0.0
228
+ * @since 3.1.0 Added tooltip and image
229
  * @param string $tab The id of the admin tab.
230
  * @return array
231
  */
236
  $sections = array(
237
  'button' => array(
238
  'telephone' => '<label for="whatsappme_phone">' . __( 'Telephone', 'creame-whatsapp-me' ) . '</label>',
239
+ 'message_send' => '<label for="whatsappme_message_send">' . __( 'Message', 'creame-whatsapp-me' ) . '</label>',
240
  'mobile_only' => __( 'Mobile Only', 'creame-whatsapp-me' ),
241
  'position' => __( 'Position On Screen', 'creame-whatsapp-me' ),
242
+ 'button_image' => __( 'Image', 'creame-whatsapp-me' ),
243
+ 'button_tip' => __( 'Tooltip', 'creame-whatsapp-me' ),
244
  'button_delay' => '<label for="whatsappme_button_delay">' . __( 'Button Delay', 'creame-whatsapp-me' ) . '</label>',
245
  'whatsapp_web' => __( 'WhatsApp Web', 'creame-whatsapp-me' ),
246
  ),
247
  'chat' => array(
248
  'message_text' => '<label for="whatsappme_message_text">' . __( 'Call To Action', 'creame-whatsapp-me' ) . '</label>',
249
+ 'message_start' => '<label for="whatsappme_message_start">' . __( 'Start WhatsApp Button', 'creame-whatsapp-me' ) . '</label>',
250
  'message_delay' => '<label for="whatsappme_message_delay">' . __( 'Chat Delay', 'creame-whatsapp-me' ) . '</label>',
251
+ 'message_badge' => __( 'Notification Balloon', 'creame-whatsapp-me' ),
252
  ),
253
  );
254
 
317
  * @since 2.1.0 Added message_badge
318
  * @since 2.3.0 Added button_delay and whatsapp_web settings, WPML integration
319
  * @since 3.0.0 Added filter for extra settings and action for extra tasks
320
+ * @since 3.1.0 Added tooltip and image
321
  * @param array $input contain keys 'id', 'title' and 'callback'.
322
  * @return array
323
  */
324
  public function settings_validate( $input ) {
325
 
326
+ $util = new WhatsAppMe_Util(); // Shortcut
327
+
328
+ $input['telephone'] = $util::clean_input( $input['telephone'] );
329
  $input['mobile_only'] = isset( $input['mobile_only'] ) ? 'yes' : 'no';
330
+ $input['button_image'] = intval( $input['button_image'] );
331
+ $input['button_tip'] = $util::substr( $util::clean_input( $input['button_tip'] ), 0, 40 );
332
  $input['button_delay'] = intval( $input['button_delay'] );
333
  $input['whatsapp_web'] = isset( $input['whatsapp_web'] ) ? 'yes' : 'no';
334
+ $input['message_text'] = $util::clean_input( $input['message_text'] );
 
335
  $input['message_badge'] = isset( $input['message_badge'] ) ? 'yes' : 'no';
336
+ $input['message_send'] = $util::clean_input( $input['message_send'] );
337
+ $input['message_start'] = $util::substr( $util::clean_input( $input['message_start'] ), 0, 20 );
338
+ $input['message_delay'] = intval( $input['message_delay'] );
339
  $input['position'] = $input['position'] != 'left' ? 'right' : 'left';
340
  if ( isset( $input['view'] ) ) {
341
  $input['visibility'] = array_filter(
356
  * Note: don't translate string $name to prevent missing translations if
357
  * public front lang is different of admin lang
358
  */
359
+ do_action( 'wpml_register_single_string', 'WhatsApp me', 'Tooltip', $input['button_tip'] );
360
  do_action( 'wpml_register_single_string', 'WhatsApp me', 'Call To Action', $input['message_text'] );
361
  do_action( 'wpml_register_single_string', 'WhatsApp me', 'Message', $input['message_send'] );
362
+ do_action( 'wpml_register_single_string', 'WhatsApp me', 'Start WhatsApp Button', $input['message_start'] );
363
 
364
  // Action to register more WPML strings or other tasks
365
  do_action( 'whatsappme_settings_validate', $input );
415
  break;
416
 
417
  case 'whatsappme_tab_general__chat':
418
+ $output = '<hr><h2 class="title">' . __( 'Chat Window', 'creame-whatsapp-me' ) . '</h2>' .
419
  '<p>' .
420
  __( 'Set the behavior of the chat window.', 'creame-whatsapp-me' ) . ' ' .
421
  ' <em>' . __( 'You can use styles and dynamic variables', 'creame-whatsapp-me' ) . '</em> ' .
450
  * Field HTML output
451
  *
452
  * @since 3.0.0
453
+ * @since 3.1.0 Added tooltip and image
454
  * @return void
455
  */
456
  public function field_output( $field_id ) {
494
  __( 'Right', 'creame-whatsapp-me' ) . '</label></fieldset>';
495
  break;
496
 
497
+ case 'button_image':
498
+ $image = intval( $value ) > 0 ? WhatsAppMe_Util::thumb( $value, 116, 116 )['url'] : false;
499
+
500
+ $output = '<div id="whatsappme_button_image_wrapper">' .
501
+ '<div id="whatsappme_button_image_holder" ' . ( $image ? "style=\"background-size:cover; background-image:url('$image');\"" : '' ) . '></div>' .
502
+ '<input id="whatsappme_button_image" name="whatsappme[button_image]" type="hidden" value="' . $value . '">' .
503
+ '<input id="whatsappme_button_image_add" type="button" value="' . esc_attr__( 'Select an image', 'creame-whatsapp-me' ) . '" class="button-primary" ' .
504
+ 'data-title="' . esc_attr__( 'Select button image', 'creame-whatsapp-me' ) . '" data-button="' . esc_attr__( 'Use image', 'creame-whatsapp-me' ) . '"> ' .
505
+ '<input id="whatsappme_button_image_remove" type="button" value="' . esc_attr__( 'Remove', 'creame-whatsapp-me' ) . '" class="button-secondary' . ( $image ? '' : ' wame-hidden' ) . '">' .
506
+ '<p class="description">' . __( 'The image will alternate with WhatsApp logo', 'creame-whatsapp-me' ) . '</p></div>';
507
+ break;
508
+
509
+ case 'button_tip':
510
+ $output = '<input id="whatsappme_button_tip" name="whatsappme[button_tip]" value="' . $value . '" type="text" maxlength="40" class="regular-text" placeholder="' . esc_attr__( '💬 Need help?', 'creame-whatsapp-me' ) . '"> ' .
511
+ '<p class="description">' . __( 'Short text shown next to WhatsApp button', 'creame-whatsapp-me' ) . '</p>';
512
+ break;
513
+
514
  case 'button_delay':
515
  $output = '<input id="whatsappme_button_delay" name="whatsappme[button_delay]" value="' . $value . '" type="number" min="0" max="120" style="width:5em"> ' . __( 'seconds', 'creame-whatsapp-me' ) .
516
  '<p class="description">' . __( 'Time since the page is opened until the WhatsApp button is displayed', 'creame-whatsapp-me' ) . '</p>';
524
 
525
  case 'message_text':
526
  $output = '<textarea id="whatsappme_message_text" name="whatsappme[message_text]" rows="4" class="regular-text" placeholder="' . esc_attr__( "Hello 👋\nCan we help you?", 'creame-whatsapp-me' ) . '">' . $value . '</textarea>' .
527
+ '<p class="description">' . __( 'Define a text to encourage users to contact by WhatsApp', 'creame-whatsapp-me' ) . '</p>';
528
  break;
529
 
530
  case 'message_send':
531
+ $output = '<textarea id="whatsappme_message_send" name="whatsappme[message_send]" rows="3" class="regular-text" placeholder="' . esc_attr__( 'Hi *{SITE}*! I need more info about {TITLE} {URL}', 'creame-whatsapp-me' ) . '">' . $value . '</textarea>' .
532
+ '<p class="description">' . __( 'Predefined text for the first message the user will send you', 'creame-whatsapp-me' ) . '</p>';
533
+ break;
534
+
535
+ case 'message_start':
536
+ $output = '<input id="whatsappme_message_start" name="whatsappme[message_start]" value="' . $value . '" type="text" maxlength="20" class="regular-text" placeholder="' . esc_attr__( 'Open chat', 'creame-whatsapp-me' ) . '"> ' .
537
+ '<p class="description">' . __( 'Text of the start WhatsApp button on Chat Window', 'creame-whatsapp-me' ) . '</p>';
538
  break;
539
 
540
  case 'message_delay':
541
+ $output = '<input id="whatsappme_message_delay" name="whatsappme[message_delay]" value="' . $value . '" type="number" min="0" max="120" style="width:5em"> ' . __( 'seconds (0 disabled)', 'creame-whatsapp-me' ) .
542
+ '<p class="description">' . __( 'Chat Window is automatically displayed after delay', 'creame-whatsapp-me' ) . '</p>';
543
  break;
544
 
545
  case 'message_badge':
546
+ $output = '<fieldset><legend class="screen-reader-text"><span>' . __( 'Notification Balloon', 'creame-whatsapp-me' ) . '</span></legend>' .
547
+ '<label><input id="whatsappme_message_badge" name="whatsappme[message_badge]" value="yes" type="checkbox"' . checked( 'yes', $value, false ) . '> ' .
548
  __( 'Display a notification balloon instead of opening the Chat Window for a "less intrusive" mode', 'creame-whatsapp-me' ) . '</label></fieldset>';
549
  break;
550
 
573
  'all' => array( 'front_page', 'blog_page', '404_page', 'search', 'archive', 'singular', 'cpts' ),
574
  'archive' => array( 'date', 'author' ),
575
  'singular' => array( 'page', 'post' ),
 
576
  )
577
  );
578
 
676
  */
677
  function options_page() {
678
 
679
+ // Enqueue WordPress media scripts
680
+ wp_enqueue_media();
681
  // Enqueue assets
682
  wp_enqueue_script( 'whatsappme-admin' );
683
  wp_enqueue_style( 'whatsappme-admin' );
830
 
831
  // Clean and delete empty/false fields
832
  $metadata = array_filter(
833
+ WhatsAppMe_Util::clean_input(
834
  array(
835
  'telephone' => $_POST['whatsappme_telephone'],
836
  'message_text' => $_POST['whatsappme_message'],
848
  delete_post_meta( $post_id, '_whatsappme' );
849
  }
850
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851
  }
admin/class-whatsappme-wooadmin.php CHANGED
@@ -60,8 +60,8 @@ class WhatsAppMe_WooAdmin {
60
  */
61
  public function settings_validate( $input ) {
62
 
63
- $input['message_text_product'] = WhatsAppMe_Admin::clean_input( $input['message_text_product'] );
64
- $input['message_send_product'] = WhatsAppMe_Admin::clean_input( $input['message_send_product'] );
65
 
66
  return $input;
67
  }
@@ -178,13 +178,13 @@ class WhatsAppMe_WooAdmin {
178
  $output = '<textarea id="whatsappme_message_text_product" name="whatsappme[message_text_product]" rows="4" class="regular-text" ' .
179
  'placeholder="' . esc_attr__( "This *{PRODUCT}* can be yours for only *{PRICE}*!\nIf you have any questions, ask us.", 'creame-whatsapp-me' ) . '">' .
180
  $value . '</textarea>' .
181
- '<p class="description">' . __( 'Define a text to encourage clients to contact by WhatsApp <strong>(optional)</strong>', 'creame-whatsapp-me' ) . '</p>';
182
  break;
183
 
184
  case 'message_send_product':
185
  $output = '<textarea id="whatsappme_message_send_product" name="whatsappme[message_send_product]" rows="3" class="regular-text" ' .
186
  'placeholder="' . esc_attr__( "*Hi {SITE}!*\nI have a question about *{PRODUCT} ({SKU})*", 'creame-whatsapp-me' ) . '">' . $value . '</textarea>' .
187
- '<p class="description">' . __( 'Predefined text with which client can start the conversation <strong>(optional)</strong>', 'creame-whatsapp-me' ) . '</p>';
188
  break;
189
  }
190
 
60
  */
61
  public function settings_validate( $input ) {
62
 
63
+ $input['message_text_product'] = WhatsAppMe_Util::clean_input( $input['message_text_product'] );
64
+ $input['message_send_product'] = WhatsAppMe_Util::clean_input( $input['message_send_product'] );
65
 
66
  return $input;
67
  }
178
  $output = '<textarea id="whatsappme_message_text_product" name="whatsappme[message_text_product]" rows="4" class="regular-text" ' .
179
  'placeholder="' . esc_attr__( "This *{PRODUCT}* can be yours for only *{PRICE}*!\nIf you have any questions, ask us.", 'creame-whatsapp-me' ) . '">' .
180
  $value . '</textarea>' .
181
+ '<p class="description">' . __( 'Define a text to encourage clients to contact by WhatsApp', 'creame-whatsapp-me' ) . '</p>';
182
  break;
183
 
184
  case 'message_send_product':
185
  $output = '<textarea id="whatsappme_message_send_product" name="whatsappme[message_send_product]" rows="3" class="regular-text" ' .
186
  'placeholder="' . esc_attr__( "*Hi {SITE}!*\nI have a question about *{PRODUCT} ({SKU})*", 'creame-whatsapp-me' ) . '">' . $value . '</textarea>' .
187
+ '<p class="description">' . __( 'Predefined text for the first message the client will send you', 'creame-whatsapp-me' ) . '</p>';
188
  break;
189
  }
190
 
admin/css/whatsappme.css CHANGED
@@ -1,5 +1,9 @@
1
  /* WAme chat settings page */
2
 
 
 
 
 
3
  .js #whatsappme_form textarea {
4
  overflow: hidden;
5
  min-height: 100px;
@@ -82,6 +86,34 @@
82
  padding-left: 52px !important;
83
  }
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  /* WAme chat metabox */
86
 
87
  .whatsappme-metabox code {
1
  /* WAme chat settings page */
2
 
3
+ .wame-hidden {
4
+ display: none !important;
5
+ }
6
+
7
  .js #whatsappme_form textarea {
8
  overflow: hidden;
9
  min-height: 100px;
86
  padding-left: 52px !important;
87
  }
88
 
89
+ #whatsappme_button_image_wrapper {
90
+ position: relative;
91
+ padding: 8px 0 0 80px;
92
+ }
93
+
94
+ #whatsappme_button_image_holder {
95
+ position: absolute;
96
+ top: 0;
97
+ left: 0;
98
+ box-sizing: border-box;
99
+ width: 60px;
100
+ height: 60px;
101
+ border: 1px solid #25d366;
102
+ border-radius: 50%;
103
+ background: #25d366 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="36" height="36"><path fill="%23fff" d="M3.516 3.516c4.686-4.686 12.284-4.686 16.97 0 4.686 4.686 4.686 12.283 0 16.97a12.004 12.004 0 01-13.754 2.299l-5.814.735a.392.392 0 01-.438-.44l.748-5.788A12.002 12.002 0 013.517 3.517zm3.61 17.043l.3.158a9.846 9.846 0 0011.534-1.758c3.843-3.843 3.843-10.074 0-13.918-3.843-3.843-10.075-3.843-13.918 0a9.846 9.846 0 00-1.747 11.554l.16.303-.51 3.942a.196.196 0 00.219.22l3.961-.501zm6.534-7.003l-.933 1.164a9.843 9.843 0 01-3.497-3.495l1.166-.933a.792.792 0 00.23-.94L9.561 6.96a.793.793 0 00-.924-.445 1291.6 1291.6 0 00-2.023.524.797.797 0 00-.588.88 11.754 11.754 0 0010.005 10.005.797.797 0 00.88-.587l.525-2.023a.793.793 0 00-.445-.923L14.6 13.327a.792.792 0 00-.94.23z"/></svg>') no-repeat center;
104
+ box-shadow: 1px 6px 24px 0 rgba(7, 94, 84, .24);
105
+ overflow: hidden;
106
+ }
107
+
108
+ [dir=rtl] #whatsappme_button_image_wrapper {
109
+ padding: 8px 80px 0 0;
110
+ }
111
+
112
+ [dir=rtl] #whatsappme_button_image_holder {
113
+ right: 0;
114
+ left: auto;
115
+ }
116
+
117
  /* WAme chat metabox */
118
 
119
  .whatsappme-metabox code {
admin/css/whatsappme.min.css CHANGED
@@ -1 +1 @@
1
- .js #whatsappme_form textarea{overflow:hidden;min-height:100px}.wametab{display:none}.wametab-active{display:block!important}#whatsappme_tab_advanced tr:hover{background:rgba(0,0,0,.05)}#whatsappme_tab_advanced td,#whatsappme_tab_advanced th{padding:7px 15px}#whatsappme_tab_advanced label{margin-right:15px}#whatsappme_tab_advanced .dashicons{opacity:.5}#whatsappme_tab_advanced input[type=radio]+span{transition:all .2s}#whatsappme_tab_advanced input[type=radio]:checked+span{color:#79ba49;opacity:1}#whatsappme_tab_advanced input[type=radio]:checked+.dashicons-hidden{color:#ca4a1f}.whatsappme-show-help{display:inline-block;width:1.1em;height:1.1em;line-height:1.1em;border-radius:50%;background:#999;color:#fff;font-weight:700;text-decoration:none;text-align:center}.whatsappme-show-help:active,.whatsappme-show-help:focus,.whatsappme-show-help:hover{background:#444;color:#fff}#tab-panel-styles-and-vars span{white-space:nowrap}#tab-panel-styles-and-vars code{-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all}.form-table td p.whatsappme-addon{font-size:13px}.iti--allow-dropdown input{padding-left:52px!important}.whatsappme-metabox code{-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all;padding:2px 1px;font-size:smaller;vertical-align:text-bottom}.whatsappme-metabox .dashicons{opacity:.5}.whatsappme-metabox input::placeholder{color:#dedfe0}.whatsappme-metabox input::-ms-input-placeholder{color:#dedfe0}.whatsappme-metabox input[type=radio]{margin-right:1px}.whatsappme-metabox input[type=radio]+span{margin-right:5px;transition:all .2s}.whatsappme-metabox input[type=radio]:checked+span{color:#79ba49;opacity:1}.whatsappme-metabox input[type=radio]:checked+.dashicons-hidden{color:#ca4a1f}.js .whatsappme-metabox textarea{overflow:hidden;min-height:3em}
1
+ .wame-hidden{display:none!important}.js #whatsappme_form textarea{overflow:hidden;min-height:100px}.wametab{display:none}.wametab-active{display:block!important}#whatsappme_tab_advanced tr:hover{background:rgba(0,0,0,.05)}#whatsappme_tab_advanced td,#whatsappme_tab_advanced th{padding:7px 15px}#whatsappme_tab_advanced label{margin-right:15px}#whatsappme_tab_advanced .dashicons{opacity:.5}#whatsappme_tab_advanced input[type=radio]+span{transition:all .2s}#whatsappme_tab_advanced input[type=radio]:checked+span{color:#79ba49;opacity:1}#whatsappme_tab_advanced input[type=radio]:checked+.dashicons-hidden{color:#ca4a1f}.whatsappme-show-help{display:inline-block;width:1.1em;height:1.1em;line-height:1.1em;border-radius:50%;background:#999;color:#fff;font-weight:700;text-decoration:none;text-align:center}.whatsappme-show-help:active,.whatsappme-show-help:focus,.whatsappme-show-help:hover{background:#444;color:#fff}#tab-panel-styles-and-vars span{white-space:nowrap}#tab-panel-styles-and-vars code{-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all}.form-table td p.whatsappme-addon{font-size:13px}.iti--allow-dropdown input{padding-left:52px!important}#whatsappme_button_image_wrapper{position:relative;padding:8px 0 0 80px}#whatsappme_button_image_holder{position:absolute;top:0;left:0;box-sizing:border-box;width:60px;height:60px;border:1px solid #25d366;border-radius:50%;background:#25d366 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="36" height="36"><path fill="%23fff" d="M3.516 3.516c4.686-4.686 12.284-4.686 16.97 0 4.686 4.686 4.686 12.283 0 16.97a12.004 12.004 0 01-13.754 2.299l-5.814.735a.392.392 0 01-.438-.44l.748-5.788A12.002 12.002 0 013.517 3.517zm3.61 17.043l.3.158a9.846 9.846 0 0011.534-1.758c3.843-3.843 3.843-10.074 0-13.918-3.843-3.843-10.075-3.843-13.918 0a9.846 9.846 0 00-1.747 11.554l.16.303-.51 3.942a.196.196 0 00.219.22l3.961-.501zm6.534-7.003l-.933 1.164a9.843 9.843 0 01-3.497-3.495l1.166-.933a.792.792 0 00.23-.94L9.561 6.96a.793.793 0 00-.924-.445 1291.6 1291.6 0 00-2.023.524.797.797 0 00-.588.88 11.754 11.754 0 0010.005 10.005.797.797 0 00.88-.587l.525-2.023a.793.793 0 00-.445-.923L14.6 13.327a.792.792 0 00-.94.23z"/></svg>') no-repeat center;box-shadow:1px 6px 24px 0 rgba(7,94,84,.24);overflow:hidden}[dir=rtl] #whatsappme_button_image_wrapper{padding:8px 80px 0 0}[dir=rtl] #whatsappme_button_image_holder{right:0;left:auto}.whatsappme-metabox code{-webkit-user-select:all;-moz-user-select:all;-ms-user-select:all;user-select:all;padding:2px 1px;font-size:smaller;vertical-align:text-bottom}.whatsappme-metabox .dashicons{opacity:.5}.whatsappme-metabox input::placeholder{color:#dedfe0}.whatsappme-metabox input::-ms-input-placeholder{color:#dedfe0}.whatsappme-metabox input[type=radio]{margin-right:1px}.whatsappme-metabox input[type=radio]+span{margin-right:5px;transition:all .2s}.whatsappme-metabox input[type=radio]:checked+span{color:#79ba49;opacity:1}.whatsappme-metabox input[type=radio]:checked+.dashicons-hidden{color:#ca4a1f}.js .whatsappme-metabox textarea{overflow:hidden;min-height:3em}
admin/js/whatsappme.js CHANGED
@@ -1,7 +1,13 @@
1
  (function ($) {
2
  'use strict';
3
 
 
 
 
 
4
  $(function () {
 
 
5
  if (typeof (intlTelInput) === 'function' && $('#whatsappme_phone').length) {
6
  var country_request = JSON.parse(localStorage.whatsappme_country_code || '{}');
7
  var country_code = (country_request.code && country_request.date == new Date().toDateString()) ? country_request.code : false;
@@ -39,30 +45,6 @@
39
  });
40
  }
41
 
42
- function propagate_inheritance(field, show) {
43
- field = field || 'all';
44
- show = show || $('input[name="whatsappme[view][' + field + ']"]:checked').val();
45
-
46
- $('.view_inheritance_' + field)
47
- .toggleClass('dashicons-visibility', show == 'yes')
48
- .toggleClass('dashicons-hidden', show == 'no');
49
-
50
- if (field == 'cpts') {
51
- $('[class*=view_inheritance_cpt_]')
52
- .toggleClass('dashicons-visibility', show == 'yes')
53
- .toggleClass('dashicons-hidden', show == 'no');
54
- } else if (field in inheritance) {
55
- var value = $('input[name="whatsappme[view][' + field + ']"]:checked').val();
56
- value = value === '' ? show : value;
57
-
58
- $.each(inheritance[field], function () { propagate_inheritance(this, value); });
59
- }
60
- }
61
-
62
- function textarea_autoheight() {
63
- $(this).height(0).height(this.scrollHeight);
64
- }
65
-
66
  if ($('#whatsappme_form').length === 1) {
67
  // Tabs
68
  $('.nav-tab').click(function (e) {
@@ -77,7 +59,12 @@
77
 
78
  // Toggle WhatsApp web option
79
  $('#whatsappme_mobile_only').change(function () {
80
- $('#whatsappme_whatsapp_web').closest('tr').toggleClass('hide-if-js', this.checked);
 
 
 
 
 
81
  }).change();
82
 
83
  // Show help
@@ -102,6 +89,26 @@
102
  'singular': ['page', 'post'],
103
  };
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  $('input', $tab_advanced).change(function () {
106
  propagate_inheritance();
107
  });
@@ -114,6 +121,47 @@
114
  });
115
 
116
  propagate_inheritance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
  if ($('.whatsappme-metabox').length === 1) {
1
  (function ($) {
2
  'use strict';
3
 
4
+ function textarea_autoheight() {
5
+ $(this).height(0).height(this.scrollHeight);
6
+ }
7
+
8
  $(function () {
9
+ var media_frame;
10
+
11
  if (typeof (intlTelInput) === 'function' && $('#whatsappme_phone').length) {
12
  var country_request = JSON.parse(localStorage.whatsappme_country_code || '{}');
13
  var country_code = (country_request.code && country_request.date == new Date().toDateString()) ? country_request.code : false;
45
  });
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  if ($('#whatsappme_form').length === 1) {
49
  // Tabs
50
  $('.nav-tab').click(function (e) {
59
 
60
  // Toggle WhatsApp web option
61
  $('#whatsappme_mobile_only').change(function () {
62
+ $('#whatsappme_whatsapp_web').closest('tr').toggleClass('wame-hidden', this.checked);
63
+ }).change();
64
+
65
+ // Toggle WhatsApp badge option
66
+ $('#whatsappme_message_delay').on('change input', function () {
67
+ $('#whatsappme_message_badge').closest('tr').toggleClass('wame-hidden', this.value == '0');
68
  }).change();
69
 
70
  // Show help
89
  'singular': ['page', 'post'],
90
  };
91
 
92
+ function propagate_inheritance(field, show) {
93
+ field = field || 'all';
94
+ show = show || $('input[name="whatsappme[view][' + field + ']"]:checked').val();
95
+
96
+ $('.view_inheritance_' + field)
97
+ .toggleClass('dashicons-visibility', show == 'yes')
98
+ .toggleClass('dashicons-hidden', show == 'no');
99
+
100
+ if (field == 'cpts') {
101
+ $('[class*=view_inheritance_cpt_]')
102
+ .toggleClass('dashicons-visibility', show == 'yes')
103
+ .toggleClass('dashicons-hidden', show == 'no');
104
+ } else if (field in inheritance) {
105
+ var value = $('input[name="whatsappme[view][' + field + ']"]:checked').val();
106
+ value = value === '' ? show : value;
107
+
108
+ $.each(inheritance[field], function () { propagate_inheritance(this, value); });
109
+ }
110
+ }
111
+
112
  $('input', $tab_advanced).change(function () {
113
  propagate_inheritance();
114
  });
121
  });
122
 
123
  propagate_inheritance();
124
+
125
+ $('#whatsappme_button_image_add').click(function (e) {
126
+ e.preventDefault();
127
+
128
+ if (!media_frame) {
129
+ // Define media_frame as wp.media object
130
+ media_frame = wp.media({
131
+ title: $(this).data('title') || 'Select button image',
132
+ button: { text: $(this).data('button') || 'Use Image' },
133
+ library: { type: 'image' },
134
+ multiple: false,
135
+ });
136
+
137
+ // When an image is selected in the media library...
138
+ media_frame.on('select', function () {
139
+ // Get media attachment details from the frame state
140
+ var attachment = media_frame.state().get('selection').first().toJSON();
141
+ var url = attachment.sizes && attachment.sizes.thumbnail && attachment.sizes.thumbnail.url || attachment.url;
142
+
143
+ $('#whatsappme_button_image_holder').css({ 'background-size': 'cover', 'background-image': 'url(' + url + ')' });
144
+ $('#whatsappme_button_image').val(attachment.id);
145
+ $('#whatsappme_button_image_remove').removeClass('wame-hidden');
146
+ });
147
+
148
+ media_frame.on('open', function () {
149
+ // Pre-selected attachment
150
+ var attachment = wp.media.attachment($('#whatsappme_button_image').val());
151
+ media_frame.state().get('selection').add(attachment ? [attachment] : []);
152
+ });
153
+ }
154
+
155
+ media_frame.open();
156
+ });
157
+
158
+ $('#whatsappme_button_image_remove').click(function (e) {
159
+ e.preventDefault();
160
+
161
+ $('#whatsappme_button_image_holder').removeAttr('style');
162
+ $('#whatsappme_button_image').val('');
163
+ $(this).addClass('wame-hidden');
164
+ });
165
  }
166
 
167
  if ($('.whatsappme-metabox').length === 1) {
admin/js/whatsappme.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";e(function(){if("function"==typeof intlTelInput&&e("#whatsappme_phone").length){var t=JSON.parse(localStorage.whatsappme_country_code||"{}"),a=!(!t.code||t.date!=(new Date).toDateString())&&t.code,n=e("#whatsappme_phone");intlTelInput(n.get(0),{hiddenInput:n.data("name")||"whatsappme[telephone]",initialCountry:"auto",preferredCountries:[a||""],geoIpLookup:function(t){a?t(a):e.getJSON("https://ipinfo.io").always(function(e){var a=e&&e.country?e.country:"";localStorage.whatsappme_country_code=JSON.stringify({code:a,date:(new Date).toDateString()}),t(a)})},utilsScript:"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/"+intl_tel_input_version+"/js/utils.js"}).hiddenInput.value=n.val(),n.on("input",function(){var t=e(this),a=intlTelInputGlobals.getInstance(this);t.css("color",t.val().trim()&&!a.isValidNumber()?"#ca4a1f":""),a.hiddenInput.value=a.getNumber()}).on("blur",function(){var e=intlTelInputGlobals.getInstance(this);e.setNumber(e.getNumber())})}function i(t,a){if(t=t||"all",a=a||e('input[name="whatsappme[view]['+t+']"]:checked').val(),e(".view_inheritance_"+t).toggleClass("dashicons-visibility","yes"==a).toggleClass("dashicons-hidden","no"==a),"cpts"==t)e("[class*=view_inheritance_cpt_]").toggleClass("dashicons-visibility","yes"==a).toggleClass("dashicons-hidden","no"==a);else if(t in c){var n=e('input[name="whatsappme[view]['+t+']"]:checked').val();n=""===n?a:n,e.each(c[t],function(){i(this,n)})}}function s(){e(this).height(0).height(this.scrollHeight)}if(1===e("#whatsappme_form").length){e(".nav-tab").click(function(t){t.preventDefault();var a=e(this);e(".nav-tab").removeClass("nav-tab-active").attr("aria-selected","false"),a.addClass("nav-tab-active").attr("aria-selected","true").get(0).blur(),e(".wametab").removeClass("wametab-active"),e(a.attr("href")).addClass("wametab-active").find("textarea").each(s)}),e("#whatsappme_mobile_only").change(function(){e("#whatsappme_whatsapp_web").closest("tr").toggleClass("hide-if-js",this.checked)}).change(),e(".whatsappme-show-help").click(function(t){t.preventDefault(),e("#contextual-help-wrap").is(":visible")?e("html, body").animate({scrollTop:0}):e("#contextual-help-link").click(),e("#tab-link-styles-and-vars a").click()}),e("textarea","#whatsappme_form").on("input",s).each(s);var l=e("#whatsappme_tab_advanced"),c=e(".whatsappme_view_all").data("inheritance")||{all:["front_page","blog_page","404_page","search","archive","singular","cpts"],archive:["date","author"],singular:["page","post"]};e("input",l).change(function(){i()}),e(".whatsappme_view_reset").click(function(t){t.preventDefault(),e('input[value=""]',l).prop("checked",!0),e(".whatsappme_view_all input",l).first().prop("checked",!0),i()}),i()}1===e(".whatsappme-metabox").length&&e("textarea",".whatsappme-metabox").on("focus input",s).each(s)})}(jQuery);
1
+ !function(e){"use strict";function t(){e(this).height(0).height(this.scrollHeight)}e(function(){var a;if("function"==typeof intlTelInput&&e("#whatsappme_phone").length){var n=JSON.parse(localStorage.whatsappme_country_code||"{}"),i=!(!n.code||n.date!=(new Date).toDateString())&&n.code,s=e("#whatsappme_phone");intlTelInput(s.get(0),{hiddenInput:s.data("name")||"whatsappme[telephone]",initialCountry:"auto",preferredCountries:[i||""],geoIpLookup:function(t){i?t(i):e.getJSON("https://ipinfo.io").always(function(e){var a=e&&e.country?e.country:"";localStorage.whatsappme_country_code=JSON.stringify({code:a,date:(new Date).toDateString()}),t(a)})},utilsScript:"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/"+intl_tel_input_version+"/js/utils.js"}).hiddenInput.value=s.val(),s.on("input",function(){var t=e(this),a=intlTelInputGlobals.getInstance(this);t.css("color",t.val().trim()&&!a.isValidNumber()?"#ca4a1f":""),a.hiddenInput.value=a.getNumber()}).on("blur",function(){var e=intlTelInputGlobals.getInstance(this);e.setNumber(e.getNumber())})}if(1===e("#whatsappme_form").length){e(".nav-tab").click(function(a){a.preventDefault();var n=e(this);e(".nav-tab").removeClass("nav-tab-active").attr("aria-selected","false"),n.addClass("nav-tab-active").attr("aria-selected","true").get(0).blur(),e(".wametab").removeClass("wametab-active"),e(n.attr("href")).addClass("wametab-active").find("textarea").each(t)}),e("#whatsappme_mobile_only").change(function(){e("#whatsappme_whatsapp_web").closest("tr").toggleClass("wame-hidden",this.checked)}).change(),e("#whatsappme_message_delay").on("change input",function(){e("#whatsappme_message_badge").closest("tr").toggleClass("wame-hidden","0"==this.value)}).change(),e(".whatsappme-show-help").click(function(t){t.preventDefault(),e("#contextual-help-wrap").is(":visible")?e("html, body").animate({scrollTop:0}):e("#contextual-help-link").click(),e("#tab-link-styles-and-vars a").click()}),e("textarea","#whatsappme_form").on("input",t).each(t);var l=e("#whatsappme_tab_advanced"),o=e(".whatsappme_view_all").data("inheritance")||{all:["front_page","blog_page","404_page","search","archive","singular","cpts"],archive:["date","author"],singular:["page","post"]};function p(t,a){if(t=t||"all",a=a||e('input[name="whatsappme[view]['+t+']"]:checked').val(),e(".view_inheritance_"+t).toggleClass("dashicons-visibility","yes"==a).toggleClass("dashicons-hidden","no"==a),"cpts"==t)e("[class*=view_inheritance_cpt_]").toggleClass("dashicons-visibility","yes"==a).toggleClass("dashicons-hidden","no"==a);else if(t in o){var n=e('input[name="whatsappme[view]['+t+']"]:checked').val();n=""===n?a:n,e.each(o[t],function(){p(this,n)})}}e("input",l).change(function(){p()}),e(".whatsappme_view_reset").click(function(t){t.preventDefault(),e('input[value=""]',l).prop("checked",!0),e(".whatsappme_view_all input",l).first().prop("checked",!0),p()}),p(),e("#whatsappme_button_image_add").click(function(t){t.preventDefault(),a||((a=wp.media({title:e(this).data("title")||"Select button image",button:{text:e(this).data("button")||"Use Image"},library:{type:"image"},multiple:!1})).on("select",function(){var t=a.state().get("selection").first().toJSON(),n=t.sizes&&t.sizes.thumbnail&&t.sizes.thumbnail.url||t.url;e("#whatsappme_button_image_holder").css({"background-size":"cover","background-image":"url("+n+")"}),e("#whatsappme_button_image").val(t.id),e("#whatsappme_button_image_remove").removeClass("wame-hidden")}),a.on("open",function(){var t=wp.media.attachment(e("#whatsappme_button_image").val());a.state().get("selection").add(t?[t]:[])})),a.open()}),e("#whatsappme_button_image_remove").click(function(t){t.preventDefault(),e("#whatsappme_button_image_holder").removeAttr("style"),e("#whatsappme_button_image").val(""),e(this).addClass("wame-hidden")})}1===e(".whatsappme-metabox").length&&e("textarea",".whatsappme-metabox").on("focus input",t).each(t)})}(jQuery);
includes/class-whatsappme-util.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Utility class.
5
+ *
6
+ * Include static methods.
7
+ *
8
+ * @since 3.1.0
9
+ * @package WhatsAppMe
10
+ * @subpackage WhatsAppMe/includes
11
+ * @author Creame <hola@crea.me>
12
+ */
13
+ class WhatsAppMe_Util {
14
+
15
+ /**
16
+ * Clean user input fields
17
+ *
18
+ * @since 3.1.0
19
+ * @access public
20
+ * @param mixed $value to clean
21
+ * @return mixed $value cleaned
22
+ */
23
+ public static function clean_input( $value ) {
24
+ if ( is_array( $value ) ) {
25
+ return array_map( 'self::clean_input', $value );
26
+ } elseif ( is_string( $value ) ) {
27
+ // Split lines, clean and re-join lines
28
+ return implode( "\n", array_map( 'sanitize_text_field', explode( "\n", trim( $value ) ) ) );
29
+ } else {
30
+ return $value;
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Apply mb_substr() if available or fallback to substr()
36
+ *
37
+ * @since 3.1.0
38
+ * @access public
39
+ * @param string $str The input string
40
+ * @param int $start The first position used in str
41
+ * @param int $length The maximum length of the returned string
42
+ * @return string The portion of str specified by the start and length parameters
43
+ */
44
+ public static function substr( $str, $start, $length = null ) {
45
+ return function_exists( 'mb_substr' ) ? mb_substr( $str, $start, $length ) : substr( $str, $start, $length );
46
+ }
47
+
48
+ /**
49
+ * Return thumbnail url and size.
50
+ *
51
+ * Create thumbnail of size if not exists and return url an size info.
52
+ *
53
+ * @since 3.1.0
54
+ * @access public
55
+ * @param mixed $img Image path or attachment ID
56
+ * @param int $width The widht of thumbnail
57
+ * @param int $height The height of thumbnail
58
+ * @param bool $crop If crop to exact thumbnail size or not
59
+ * @return array With thumbnail info (url, width, height)
60
+ */
61
+ public static function thumb( $img, $width, $height, $crop = true ) {
62
+
63
+ $uploads = wp_get_upload_dir();
64
+ $img_path = intval( $img ) > 0 ? get_attached_file( $img ) : $img;
65
+ $img_info = pathinfo( $img_path );
66
+ $new_img_path = "{$img_info['dirname']}/{$img_info['filename']}-{$width}x{$height}.{$img_info['extension']}";
67
+
68
+ if ( ! file_exists( $new_img_path ) ) {
69
+ $new_img = wp_get_image_editor( $img_path );
70
+ $new_img->resize( $width, $height, $crop );
71
+ $new_img = $new_img->save( $new_img_path );
72
+
73
+ $thumb = array(
74
+ 'url' => str_replace( $uploads['basedir'], $uploads['baseurl'], $new_img_path ),
75
+ 'width' => $new_img['width'],
76
+ 'height' => $new_img['height'],
77
+ );
78
+ } else {
79
+ @list($w, $h) = getimagesize( $new_img_path );
80
+
81
+ $thumb = array(
82
+ 'url' => str_replace( $uploads['basedir'], $uploads['baseurl'], $new_img_path ),
83
+ 'width' => $w,
84
+ 'height' => $h,
85
+ );
86
+ }
87
+
88
+ return $thumb;
89
+
90
+ }
91
+
92
+ /**
93
+ * Return if image is animated gif.
94
+ *
95
+ * @since 3.1.0
96
+ * @access public
97
+ * @param mixed $img Image path or attachment ID
98
+ * @return bool true if is an animated gif, false otherwise
99
+ */
100
+ public static function is_animated_gif( $img ) {
101
+ $img_path = intval( $img ) > 0 ? get_attached_file( $img ) : $img;
102
+
103
+ return (bool) preg_match( '#(\x00\x21\xF9\x04.{4}\x00\x2C.*){2,}#s', file_get_contents( $img_path ) );
104
+ }
105
+
106
+ /**
107
+ * Format raw message text for html output.
108
+ * Also apply styles transformations like WhatsApp app.
109
+ *
110
+ * @since 3.1.0
111
+ * @param string $string string to apply format replacements
112
+ * @return string string formated
113
+ */
114
+ public static function formated_message( $string ) {
115
+
116
+ $replacements = apply_filters(
117
+ 'whatsappme_format_replacements', array(
118
+ '/_(\S[^_]*\S)_/mu' => '<em>$1</em>',
119
+ '/\*(\S[^\*]*\S)\*/mu' => '<strong>$1</strong>',
120
+ '/~(\S[^~]*\S)~/mu' => '<del>$1</del>',
121
+ )
122
+ );
123
+
124
+ $replacements = apply_filters_deprecated( 'whatsappme_message_replacements', array( $replacements ), '3.0.3', 'whatsappme_format_replacements' );
125
+
126
+ $patterns = array_keys( $replacements );
127
+
128
+ // Split text into lines and apply replacements line by line
129
+ $lines = explode( "\n", $string );
130
+ foreach ( $lines as $key => $line ) {
131
+ $lines[ $key ] = preg_replace( $patterns, $replacements, esc_html( $line ) );
132
+ }
133
+
134
+ return self::replace_variables( implode( '<br>', $lines ) );
135
+
136
+ }
137
+
138
+ /**
139
+ * Format message send, replace vars.
140
+ *
141
+ * @since 3.1.0
142
+ * @param string $string string to apply variable replacements
143
+ * @return string string with replaced variables
144
+ */
145
+ public static function replace_variables( $string ) {
146
+ global $wp;
147
+
148
+ $replacements = apply_filters(
149
+ 'whatsappme_variable_replacements', array(
150
+ 'SITE' => get_bloginfo( 'name' ),
151
+ 'URL' => home_url( $wp->request ),
152
+ 'TITLE' => self::get_title(),
153
+ )
154
+ );
155
+
156
+ // Convert VAR to regex {VAR}
157
+ $patterns = array_map(
158
+ function ( $var ) {
159
+ return "/\{$var\}/i";
160
+ }, array_keys( $replacements )
161
+ );
162
+
163
+ $replacements = apply_filters_deprecated( 'whatsappme_message_send_replacements', array( array_combine( $patterns, $replacements ) ), '3.0.3', 'whatsappme_variable_replacements' );
164
+
165
+ return preg_replace( array_keys( $replacements ), $replacements, $string );
166
+
167
+ }
168
+
169
+ /**
170
+ * Get current page title
171
+ *
172
+ * @since 3.1.0
173
+ * @return string message formated string
174
+ */
175
+ public static function get_title() {
176
+
177
+ if ( is_home() || is_singular() ) {
178
+ $title = single_post_title( '', false );
179
+ } elseif ( is_tax() ) {
180
+ $title = single_term_title( '', false );
181
+ } elseif ( function_exists( 'wp_get_document_title' ) ) {
182
+ $title = wp_get_document_title();
183
+
184
+ // Try to remove sitename from $title for cleaner title
185
+ $sep = apply_filters( 'document_title_separator', '-' );
186
+ $site = get_bloginfo( 'name', 'display' );
187
+ $title = str_replace( esc_html( convert_chars( wptexturize( " $sep " . $site ) ) ), '', $title );
188
+ } else {
189
+ $title = get_bloginfo( 'name' );
190
+ }
191
+
192
+ return apply_filters( 'whatsappme_get_title', $title );
193
+
194
+ }
195
+
196
+ }
includes/class-whatsappme.php CHANGED
@@ -85,6 +85,7 @@ class WhatsAppMe {
85
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-whatsappme-loader.php';
86
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-whatsappme-i18n.php';
87
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-whatsappme-integrations.php';
 
88
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-whatsappme-admin.php';
89
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-whatsappme-public.php';
90
 
85
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-whatsappme-loader.php';
86
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-whatsappme-i18n.php';
87
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-whatsappme-integrations.php';
88
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-whatsappme-util.php';
89
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-whatsappme-admin.php';
90
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-whatsappme-public.php';
91
 
languages/creame-whatsapp-me.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WAme chat\n"
5
- "POT-Creation-Date: 2019-09-18 14:00+0200\n"
6
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
7
  "Last-Translator: Your Name <you@example.com>\n"
8
  "Language-Team: Creame <hola@crea.me>\n"
@@ -21,291 +21,338 @@ msgstr ""
21
  "X-Generator: Poedit 1.8.7.1\n"
22
  "X-Poedit-SearchPath-0: .\n"
23
 
24
- #: admin/class-whatsappme-admin.php:100
25
  msgid "General"
26
  msgstr ""
27
 
28
- #: admin/class-whatsappme-admin.php:101
29
  msgid "Advanced"
30
  msgstr ""
31
 
32
- #: admin/class-whatsappme-admin.php:235 admin/class-whatsappme-admin.php:739
33
  msgid "Telephone"
34
  msgstr ""
35
 
36
- #: admin/class-whatsappme-admin.php:236 admin/class-whatsappme-admin.php:468
 
 
 
 
 
37
  msgid "Mobile Only"
38
  msgstr ""
39
 
40
- #: admin/class-whatsappme-admin.php:237 admin/class-whatsappme-admin.php:474
41
  msgid "Position On Screen"
42
  msgstr ""
43
 
44
- #: admin/class-whatsappme-admin.php:238
 
 
 
 
 
 
 
 
45
  msgid "Button Delay"
46
  msgstr ""
47
 
48
- #: admin/class-whatsappme-admin.php:239 admin/class-whatsappme-admin.php:487
49
  msgid "WhatsApp Web"
50
  msgstr ""
51
 
52
- #: admin/class-whatsappme-admin.php:242 admin/class-whatsappme-admin.php:743
53
  #: admin/class-whatsappme-wooadmin.php:128
54
  msgid "Call To Action"
55
  msgstr ""
56
 
57
- #: admin/class-whatsappme-admin.php:243 admin/class-whatsappme-admin.php:747
58
- #: admin/class-whatsappme-wooadmin.php:129
59
- msgid "Message"
60
  msgstr ""
61
 
62
- #: admin/class-whatsappme-admin.php:244
63
  msgid "Chat Delay"
64
  msgstr ""
65
 
66
- #: admin/class-whatsappme-admin.php:245 admin/class-whatsappme-admin.php:508
67
- msgid "Hide Chat"
68
  msgstr ""
69
 
70
- #: admin/class-whatsappme-admin.php:254
71
  msgid "Global"
72
  msgstr ""
73
 
74
- #: admin/class-whatsappme-admin.php:259
75
  msgid "Front Page"
76
  msgstr ""
77
 
78
- #: admin/class-whatsappme-admin.php:260
79
  msgid "Blog Page"
80
  msgstr ""
81
 
82
- #: admin/class-whatsappme-admin.php:261
83
  msgid "404 Page"
84
  msgstr ""
85
 
86
- #: admin/class-whatsappme-admin.php:262
87
  msgid "Search Results"
88
  msgstr ""
89
 
90
- #: admin/class-whatsappme-admin.php:263
91
  msgid "Archives"
92
  msgstr ""
93
 
94
- #: admin/class-whatsappme-admin.php:264
95
  msgid "Date Archives"
96
  msgstr ""
97
 
98
- #: admin/class-whatsappme-admin.php:265
99
  msgid "Author Archives"
100
  msgstr ""
101
 
102
- #: admin/class-whatsappme-admin.php:266
103
  msgid "Singular"
104
  msgstr ""
105
 
106
- #: admin/class-whatsappme-admin.php:267
107
  msgid "Page"
108
  msgstr ""
109
 
110
- #: admin/class-whatsappme-admin.php:268
111
  msgid "Post"
112
  msgstr ""
113
 
114
- #: admin/class-whatsappme-admin.php:353
115
  msgid "Settings saved"
116
  msgstr ""
117
 
118
- #: admin/class-whatsappme-admin.php:398
119
  msgid "Button"
120
  msgstr ""
121
 
122
- #: admin/class-whatsappme-admin.php:399
123
  msgid ""
124
  "Set the contact number and where you want the WhatsApp button to be "
125
  "displayed."
126
  msgstr ""
127
 
128
- #: admin/class-whatsappme-admin.php:403
129
  msgid "Chat Window"
130
  msgstr ""
131
 
132
- #: admin/class-whatsappme-admin.php:405
133
  msgid "Set the behavior of the chat window."
134
  msgstr ""
135
 
136
- #: admin/class-whatsappme-admin.php:406
137
  #: admin/class-whatsappme-wooadmin.php:154
138
  msgid "You can use styles and dynamic variables"
139
  msgstr ""
140
 
141
- #: admin/class-whatsappme-admin.php:407
142
  #: admin/class-whatsappme-wooadmin.php:155
143
  msgid "Show Help"
144
  msgstr ""
145
 
146
- #: admin/class-whatsappme-admin.php:412
147
  msgid "Advanced Visibility Settings"
148
  msgstr ""
149
 
150
- #: admin/class-whatsappme-admin.php:413
151
  msgid ""
152
  "From here you can configure on which pages the WhatsApp button will be "
153
  "visible."
154
  msgstr ""
155
 
156
- #: admin/class-whatsappme-admin.php:414
157
  msgid "Restore default visibility"
158
  msgstr ""
159
 
160
- #: admin/class-whatsappme-admin.php:422
161
  msgid "Custom Post Types"
162
  msgstr ""
163
 
164
- #: admin/class-whatsappme-admin.php:447 admin/class-whatsappme-admin.php:544
165
- #: admin/class-whatsappme-admin.php:755
166
  msgid "Show"
167
  msgstr ""
168
 
169
- #: admin/class-whatsappme-admin.php:449 admin/class-whatsappme-admin.php:546
170
- #: admin/class-whatsappme-admin.php:757
171
  msgid "Hide"
172
  msgstr ""
173
 
174
- #: admin/class-whatsappme-admin.php:451
175
  msgid "Inherit"
176
  msgstr ""
177
 
178
- #: admin/class-whatsappme-admin.php:460
179
  msgid ""
180
  "Contact phone number <strong>(the button will not be shown if it's empty)</"
181
  "strong>"
182
  msgstr ""
183
 
184
- #: admin/class-whatsappme-admin.php:462
185
  #, php-format
186
  msgid "Add unlimited numbers with %s"
187
  msgstr ""
188
 
189
- #: admin/class-whatsappme-admin.php:470
190
  msgid "Only display the button on mobile devices"
191
  msgstr ""
192
 
193
- #: admin/class-whatsappme-admin.php:476
194
  msgid "Left"
195
  msgstr ""
196
 
197
- #: admin/class-whatsappme-admin.php:478
198
  msgid "Right"
199
  msgstr ""
200
 
201
- #: admin/class-whatsappme-admin.php:482 admin/class-whatsappme-admin.php:503
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  msgid "seconds"
203
  msgstr ""
204
 
205
- #: admin/class-whatsappme-admin.php:483
206
  msgid "Time since the page is opened until the WhatsApp button is displayed"
207
  msgstr ""
208
 
209
- #: admin/class-whatsappme-admin.php:489
210
  msgid "Open <em>WhatsApp Web</em> directly on desktop"
211
  msgstr ""
212
 
213
- #: admin/class-whatsappme-admin.php:493
214
  msgid ""
215
  "Hello 👋\n"
216
  "Can we help you?"
217
  msgstr ""
218
 
219
- #: admin/class-whatsappme-admin.php:494
220
- msgid ""
221
- "Define a text to encourage users to contact by WhatsApp <strong>(optional)</"
222
- "strong>"
223
  msgstr ""
224
 
225
- #: admin/class-whatsappme-admin.php:498
226
- msgid "Hi *{SITE}*! I need more info about {TITLE}"
227
  msgstr ""
228
 
229
- #: admin/class-whatsappme-admin.php:499
230
- msgid ""
231
- "Predefined text with which user can start the conversation "
232
- "<strong>(optional)</strong>"
233
  msgstr ""
234
 
235
- #: admin/class-whatsappme-admin.php:504
236
- msgid ""
237
- "Time since the WhatsApp button is displayed until the Chat Window opens"
 
 
 
 
 
 
 
238
  msgstr ""
239
 
240
- #: admin/class-whatsappme-admin.php:510
 
 
 
 
241
  msgid ""
242
  "Display a notification balloon instead of opening the Chat Window for a "
243
  "\"less intrusive\" mode"
244
  msgstr ""
245
 
246
- #: admin/class-whatsappme-admin.php:575
247
  msgid "Styles and Variables"
248
  msgstr ""
249
 
250
- #: admin/class-whatsappme-admin.php:578
251
  msgid ""
252
  "You can use formatting styles like in WhatsApp: _<em>italic</em>_ "
253
  "*<strong>bold</strong>* ~<del>strikethrough</del>~."
254
  msgstr ""
255
 
256
- #: admin/class-whatsappme-admin.php:579
257
  msgid ""
258
  "You can use dynamic variables that will be replaced by the values of the "
259
  "page the user visits:"
260
  msgstr ""
261
 
262
- #: admin/class-whatsappme-admin.php:583
263
  msgid "Page Title"
264
  msgstr ""
265
 
266
- #: admin/class-whatsappme-admin.php:592
267
  msgid "Support and Help"
268
  msgstr ""
269
 
270
- #: admin/class-whatsappme-admin.php:595
271
  #, php-format
272
  msgid ""
273
  "If you need help, please check the <a href=\"%s\" rel=\"external\" target="
274
  "\"_blank\">plugin support forum</a>."
275
  msgstr ""
276
 
277
- #: admin/class-whatsappme-admin.php:598
278
  msgid "If you like WAme 😍"
279
  msgstr ""
280
 
281
- #: admin/class-whatsappme-admin.php:601
282
  #, php-format
283
  msgid "Subscribe to our newsletter and our blog at %s."
284
  msgstr ""
285
 
286
- #: admin/class-whatsappme-admin.php:605
287
  #, php-format
288
  msgid "Learn from our tutorials on %s."
289
  msgstr ""
290
 
291
- #: admin/class-whatsappme-admin.php:609
292
  #, php-format
293
  msgid "Or rate us on %s."
294
  msgstr ""
295
 
296
- #: admin/class-whatsappme-admin.php:626
297
  msgid "Settings"
298
  msgstr ""
299
 
300
- #: admin/class-whatsappme-admin.php:689
301
  msgid "WAme chat"
302
  msgstr ""
303
 
304
- #: admin/class-whatsappme-admin.php:750
305
  msgid "You can use vars:"
306
  msgstr ""
307
 
308
- #: admin/class-whatsappme-admin.php:759
309
  msgid "Default visibility"
310
  msgstr ""
311
 
@@ -350,9 +397,7 @@ msgid ""
350
  msgstr ""
351
 
352
  #: admin/class-whatsappme-wooadmin.php:181
353
- msgid ""
354
- "Define a text to encourage clients to contact by WhatsApp "
355
- "<strong>(optional)</strong>"
356
  msgstr ""
357
 
358
  #: admin/class-whatsappme-wooadmin.php:186
@@ -362,9 +407,7 @@ msgid ""
362
  msgstr ""
363
 
364
  #: admin/class-whatsappme-wooadmin.php:187
365
- msgid ""
366
- "Predefined text with which client can start the conversation "
367
- "<strong>(optional)</strong>"
368
  msgstr ""
369
 
370
  #: admin/class-whatsappme-wooadmin.php:222
@@ -374,7 +417,3 @@ msgstr ""
374
  #: admin/class-whatsappme-wooadmin.php:224
375
  msgid "Product Name"
376
  msgstr ""
377
-
378
- #: public/class-whatsappme-public.php:219
379
- msgid "Powered by"
380
- msgstr ""
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WAme chat\n"
5
+ "POT-Creation-Date: 2019-10-18 18:29+0200\n"
6
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
7
  "Last-Translator: Your Name <you@example.com>\n"
8
  "Language-Team: Creame <hola@crea.me>\n"
21
  "X-Generator: Poedit 1.8.7.1\n"
22
  "X-Poedit-SearchPath-0: .\n"
23
 
24
+ #: admin/class-whatsappme-admin.php:101
25
  msgid "General"
26
  msgstr ""
27
 
28
+ #: admin/class-whatsappme-admin.php:102
29
  msgid "Advanced"
30
  msgstr ""
31
 
32
+ #: admin/class-whatsappme-admin.php:241 admin/class-whatsappme-admin.php:788
33
  msgid "Telephone"
34
  msgstr ""
35
 
36
+ #: admin/class-whatsappme-admin.php:242 admin/class-whatsappme-admin.php:796
37
+ #: admin/class-whatsappme-wooadmin.php:129
38
+ msgid "Message"
39
+ msgstr ""
40
+
41
+ #: admin/class-whatsappme-admin.php:243 admin/class-whatsappme-admin.php:487
42
  msgid "Mobile Only"
43
  msgstr ""
44
 
45
+ #: admin/class-whatsappme-admin.php:244 admin/class-whatsappme-admin.php:493
46
  msgid "Position On Screen"
47
  msgstr ""
48
 
49
+ #: admin/class-whatsappme-admin.php:245
50
+ msgid "Image"
51
+ msgstr ""
52
+
53
+ #: admin/class-whatsappme-admin.php:246
54
+ msgid "Tooltip"
55
+ msgstr ""
56
+
57
+ #: admin/class-whatsappme-admin.php:247
58
  msgid "Button Delay"
59
  msgstr ""
60
 
61
+ #: admin/class-whatsappme-admin.php:248 admin/class-whatsappme-admin.php:523
62
  msgid "WhatsApp Web"
63
  msgstr ""
64
 
65
+ #: admin/class-whatsappme-admin.php:251 admin/class-whatsappme-admin.php:792
66
  #: admin/class-whatsappme-wooadmin.php:128
67
  msgid "Call To Action"
68
  msgstr ""
69
 
70
+ #: admin/class-whatsappme-admin.php:252
71
+ msgid "Start WhatsApp Button"
 
72
  msgstr ""
73
 
74
+ #: admin/class-whatsappme-admin.php:253
75
  msgid "Chat Delay"
76
  msgstr ""
77
 
78
+ #: admin/class-whatsappme-admin.php:254 admin/class-whatsappme-admin.php:549
79
+ msgid "Notification Balloon"
80
  msgstr ""
81
 
82
+ #: admin/class-whatsappme-admin.php:263
83
  msgid "Global"
84
  msgstr ""
85
 
86
+ #: admin/class-whatsappme-admin.php:268
87
  msgid "Front Page"
88
  msgstr ""
89
 
90
+ #: admin/class-whatsappme-admin.php:269
91
  msgid "Blog Page"
92
  msgstr ""
93
 
94
+ #: admin/class-whatsappme-admin.php:270
95
  msgid "404 Page"
96
  msgstr ""
97
 
98
+ #: admin/class-whatsappme-admin.php:271
99
  msgid "Search Results"
100
  msgstr ""
101
 
102
+ #: admin/class-whatsappme-admin.php:272
103
  msgid "Archives"
104
  msgstr ""
105
 
106
+ #: admin/class-whatsappme-admin.php:273
107
  msgid "Date Archives"
108
  msgstr ""
109
 
110
+ #: admin/class-whatsappme-admin.php:274
111
  msgid "Author Archives"
112
  msgstr ""
113
 
114
+ #: admin/class-whatsappme-admin.php:275
115
  msgid "Singular"
116
  msgstr ""
117
 
118
+ #: admin/class-whatsappme-admin.php:276
119
  msgid "Page"
120
  msgstr ""
121
 
122
+ #: admin/class-whatsappme-admin.php:277
123
  msgid "Post"
124
  msgstr ""
125
 
126
+ #: admin/class-whatsappme-admin.php:370
127
  msgid "Settings saved"
128
  msgstr ""
129
 
130
+ #: admin/class-whatsappme-admin.php:416
131
  msgid "Button"
132
  msgstr ""
133
 
134
+ #: admin/class-whatsappme-admin.php:417
135
  msgid ""
136
  "Set the contact number and where you want the WhatsApp button to be "
137
  "displayed."
138
  msgstr ""
139
 
140
+ #: admin/class-whatsappme-admin.php:421
141
  msgid "Chat Window"
142
  msgstr ""
143
 
144
+ #: admin/class-whatsappme-admin.php:423
145
  msgid "Set the behavior of the chat window."
146
  msgstr ""
147
 
148
+ #: admin/class-whatsappme-admin.php:424
149
  #: admin/class-whatsappme-wooadmin.php:154
150
  msgid "You can use styles and dynamic variables"
151
  msgstr ""
152
 
153
+ #: admin/class-whatsappme-admin.php:425
154
  #: admin/class-whatsappme-wooadmin.php:155
155
  msgid "Show Help"
156
  msgstr ""
157
 
158
+ #: admin/class-whatsappme-admin.php:430
159
  msgid "Advanced Visibility Settings"
160
  msgstr ""
161
 
162
+ #: admin/class-whatsappme-admin.php:431
163
  msgid ""
164
  "From here you can configure on which pages the WhatsApp button will be "
165
  "visible."
166
  msgstr ""
167
 
168
+ #: admin/class-whatsappme-admin.php:432
169
  msgid "Restore default visibility"
170
  msgstr ""
171
 
172
+ #: admin/class-whatsappme-admin.php:440
173
  msgid "Custom Post Types"
174
  msgstr ""
175
 
176
+ #: admin/class-whatsappme-admin.php:466 admin/class-whatsappme-admin.php:584
177
+ #: admin/class-whatsappme-admin.php:804
178
  msgid "Show"
179
  msgstr ""
180
 
181
+ #: admin/class-whatsappme-admin.php:468 admin/class-whatsappme-admin.php:586
182
+ #: admin/class-whatsappme-admin.php:806
183
  msgid "Hide"
184
  msgstr ""
185
 
186
+ #: admin/class-whatsappme-admin.php:470
187
  msgid "Inherit"
188
  msgstr ""
189
 
190
+ #: admin/class-whatsappme-admin.php:479
191
  msgid ""
192
  "Contact phone number <strong>(the button will not be shown if it's empty)</"
193
  "strong>"
194
  msgstr ""
195
 
196
+ #: admin/class-whatsappme-admin.php:481
197
  #, php-format
198
  msgid "Add unlimited numbers with %s"
199
  msgstr ""
200
 
201
+ #: admin/class-whatsappme-admin.php:489
202
  msgid "Only display the button on mobile devices"
203
  msgstr ""
204
 
205
+ #: admin/class-whatsappme-admin.php:495
206
  msgid "Left"
207
  msgstr ""
208
 
209
+ #: admin/class-whatsappme-admin.php:497
210
  msgid "Right"
211
  msgstr ""
212
 
213
+ #: admin/class-whatsappme-admin.php:506
214
+ msgid "Select an image"
215
+ msgstr ""
216
+
217
+ #: admin/class-whatsappme-admin.php:507
218
+ msgid "Select button image"
219
+ msgstr ""
220
+
221
+ #: admin/class-whatsappme-admin.php:507
222
+ msgid "Use image"
223
+ msgstr ""
224
+
225
+ #: admin/class-whatsappme-admin.php:508
226
+ msgid "Remove"
227
+ msgstr ""
228
+
229
+ #: admin/class-whatsappme-admin.php:509
230
+ msgid "The image will alternate with WhatsApp logo"
231
+ msgstr ""
232
+
233
+ #: admin/class-whatsappme-admin.php:513
234
+ msgid "💬 Need help?"
235
+ msgstr ""
236
+
237
+ #: admin/class-whatsappme-admin.php:514
238
+ msgid "Short text shown next to WhatsApp button"
239
+ msgstr ""
240
+
241
+ #: admin/class-whatsappme-admin.php:518
242
  msgid "seconds"
243
  msgstr ""
244
 
245
+ #: admin/class-whatsappme-admin.php:519
246
  msgid "Time since the page is opened until the WhatsApp button is displayed"
247
  msgstr ""
248
 
249
+ #: admin/class-whatsappme-admin.php:525
250
  msgid "Open <em>WhatsApp Web</em> directly on desktop"
251
  msgstr ""
252
 
253
+ #: admin/class-whatsappme-admin.php:529
254
  msgid ""
255
  "Hello 👋\n"
256
  "Can we help you?"
257
  msgstr ""
258
 
259
+ #: admin/class-whatsappme-admin.php:530
260
+ msgid "Define a text to encourage users to contact by WhatsApp"
 
 
261
  msgstr ""
262
 
263
+ #: admin/class-whatsappme-admin.php:534
264
+ msgid "Hi *{SITE}*! I need more info about {TITLE} {URL}"
265
  msgstr ""
266
 
267
+ #: admin/class-whatsappme-admin.php:535
268
+ msgid "Predefined text for the first message the user will send you"
 
 
269
  msgstr ""
270
 
271
+ #: admin/class-whatsappme-admin.php:539
272
+ msgid "Open chat"
273
+ msgstr ""
274
+
275
+ #: admin/class-whatsappme-admin.php:540
276
+ msgid "Text of the start WhatsApp button on Chat Window"
277
+ msgstr ""
278
+
279
+ #: admin/class-whatsappme-admin.php:544
280
+ msgid "seconds (0 disabled)"
281
  msgstr ""
282
 
283
+ #: admin/class-whatsappme-admin.php:545
284
+ msgid "Chat Window is automatically displayed after delay"
285
+ msgstr ""
286
+
287
+ #: admin/class-whatsappme-admin.php:551
288
  msgid ""
289
  "Display a notification balloon instead of opening the Chat Window for a "
290
  "\"less intrusive\" mode"
291
  msgstr ""
292
 
293
+ #: admin/class-whatsappme-admin.php:615
294
  msgid "Styles and Variables"
295
  msgstr ""
296
 
297
+ #: admin/class-whatsappme-admin.php:618
298
  msgid ""
299
  "You can use formatting styles like in WhatsApp: _<em>italic</em>_ "
300
  "*<strong>bold</strong>* ~<del>strikethrough</del>~."
301
  msgstr ""
302
 
303
+ #: admin/class-whatsappme-admin.php:619
304
  msgid ""
305
  "You can use dynamic variables that will be replaced by the values of the "
306
  "page the user visits:"
307
  msgstr ""
308
 
309
+ #: admin/class-whatsappme-admin.php:623
310
  msgid "Page Title"
311
  msgstr ""
312
 
313
+ #: admin/class-whatsappme-admin.php:632
314
  msgid "Support and Help"
315
  msgstr ""
316
 
317
+ #: admin/class-whatsappme-admin.php:635
318
  #, php-format
319
  msgid ""
320
  "If you need help, please check the <a href=\"%s\" rel=\"external\" target="
321
  "\"_blank\">plugin support forum</a>."
322
  msgstr ""
323
 
324
+ #: admin/class-whatsappme-admin.php:638
325
  msgid "If you like WAme 😍"
326
  msgstr ""
327
 
328
+ #: admin/class-whatsappme-admin.php:641
329
  #, php-format
330
  msgid "Subscribe to our newsletter and our blog at %s."
331
  msgstr ""
332
 
333
+ #: admin/class-whatsappme-admin.php:645
334
  #, php-format
335
  msgid "Learn from our tutorials on %s."
336
  msgstr ""
337
 
338
+ #: admin/class-whatsappme-admin.php:649
339
  #, php-format
340
  msgid "Or rate us on %s."
341
  msgstr ""
342
 
343
+ #: admin/class-whatsappme-admin.php:666
344
  msgid "Settings"
345
  msgstr ""
346
 
347
+ #: admin/class-whatsappme-admin.php:735
348
  msgid "WAme chat"
349
  msgstr ""
350
 
351
+ #: admin/class-whatsappme-admin.php:799
352
  msgid "You can use vars:"
353
  msgstr ""
354
 
355
+ #: admin/class-whatsappme-admin.php:808
356
  msgid "Default visibility"
357
  msgstr ""
358
 
397
  msgstr ""
398
 
399
  #: admin/class-whatsappme-wooadmin.php:181
400
+ msgid "Define a text to encourage clients to contact by WhatsApp"
 
 
401
  msgstr ""
402
 
403
  #: admin/class-whatsappme-wooadmin.php:186
407
  msgstr ""
408
 
409
  #: admin/class-whatsappme-wooadmin.php:187
410
+ msgid "Predefined text for the first message the client will send you"
 
 
411
  msgstr ""
412
 
413
  #: admin/class-whatsappme-wooadmin.php:222
417
  #: admin/class-whatsappme-wooadmin.php:224
418
  msgid "Product Name"
419
  msgstr ""
 
 
 
 
public/class-whatsappme-public.php CHANGED
@@ -91,12 +91,15 @@ class WhatsAppMe_Public {
91
  array(
92
  'telephone' => '',
93
  'mobile_only' => 'no',
 
 
94
  'button_delay' => 3,
95
  'whatsapp_web' => 'no',
96
  'message_text' => '',
97
  'message_delay' => 10,
98
  'message_badge' => 'no',
99
  'message_send' => '',
 
100
  'position' => 'right',
101
  'visibility' => array( 'all' => 'yes' ),
102
  ),
@@ -116,8 +119,10 @@ class WhatsAppMe_Public {
116
  }
117
 
118
  // Load WPML/Polylang translated strings
119
- $settings['message_text'] = apply_filters( 'wpml_translate_single_string', $settings['message_text'], 'WhatsApp me', 'Call To Action' );
120
- $settings['message_send'] = apply_filters( 'wpml_translate_single_string', $settings['message_send'], 'WhatsApp me', 'Message' );
 
 
121
 
122
  // Filter for site settings (can be overriden by post settings)
123
  // You can translate more WPML strings or add/change other settings
@@ -142,30 +147,31 @@ class WhatsAppMe_Public {
142
  $settings['whatsapp_web'] = 'yes' == $settings['whatsapp_web'];
143
  $settings['message_badge'] = 'yes' == $settings['message_badge'] && '' != $settings['message_text'];
144
  $settings['position'] = 'right' == $settings['position'] ? 'right' : 'left';
145
- $settings['message_send'] = self::replace_variables( $settings['message_send'] );
146
  // Set true to link http://web.whatsapp.com instead http://api.whatsapp.com
147
  $settings['whatsapp_web'] = apply_filters( 'whatsappme_whatsapp_web', 'yes' == $settings['whatsapp_web'] );
148
 
149
  // Only show if there is a phone number
150
  if ( '' != $settings['telephone'] ) {
151
  if ( isset( $settings['view'] ) && 'yes' == $settings['view'] ) {
152
- $this->show = true;
153
  } elseif ( isset( $settings['view'] ) && 'no' == $settings['view'] ) {
154
- $this->show = false;
155
  } else {
156
- $this->show = $this->check_visibility( $settings['visibility'] );
157
  }
158
  }
159
  // Unset post 'view' setting
160
  unset( $settings['view'] );
161
-
162
- $this->settings = $settings;
 
163
  }
164
 
165
  // Apply filters to final settings after site and post settings
166
- $this->settings = apply_filters( 'whatsappme_get_settings', $this->settings, $obj );
167
  // Apply filters to alter 'show' value
168
- $this->show = apply_filters( 'whatsappme_show', $this->show, $this->settings, $obj );
169
 
170
  // Ensure not show if not phone
171
  if ( '' == $this->settings['telephone'] ) {
@@ -217,19 +223,47 @@ class WhatsAppMe_Public {
217
  if ( $this->show ) {
218
 
219
  // Clean unnecessary settings on front
220
- $excluded_fields = apply_filters( 'whatsappme_excluded_fields', array( 'visibility', 'position' ) );
221
- $data = array_diff_key( $this->settings, array_flip( $excluded_fields ) );
 
 
 
 
 
 
 
 
 
222
 
223
- $copy = apply_filters( 'whatsappme_copy', __( 'Powered by', 'creame-whatsapp-me' ) );
224
 
225
  $powered_url = urlencode( home_url( $wp->request ) );
226
  $powered_site = urlencode( get_bloginfo( 'name' ) );
227
  $powered_link = "https://wame.chat/powered/?site={$powered_site}&url={$powered_url}";
228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  ?>
230
  <div class="whatsappme <?php echo apply_filters( 'whatsappme_classes', "whatsappme--{$this->settings['position']}" ); ?>" data-settings="<?php echo esc_attr( json_encode( $data ) ); ?>">
231
  <div class="whatsappme__button">
232
- <svg class="whatsappme__button__open" viewBox="0 0 24 24"><path fill="#fff" d="M3.516 3.516c4.686-4.686 12.284-4.686 16.97 0 4.686 4.686 4.686 12.283 0 16.97a12.004 12.004 0 0 1-13.754 2.299l-5.814.735a.392.392 0 0 1-.438-.44l.748-5.788A12.002 12.002 0 0 1 3.517 3.517zm3.61 17.043l.3.158a9.846 9.846 0 0 0 11.534-1.758c3.843-3.843 3.843-10.074 0-13.918-3.843-3.843-10.075-3.843-13.918 0a9.846 9.846 0 0 0-1.747 11.554l.16.303-.51 3.942a.196.196 0 0 0 .219.22l3.961-.501zm6.534-7.003l-.933 1.164a9.843 9.843 0 0 1-3.497-3.495l1.166-.933a.792.792 0 0 0 .23-.94L9.561 6.96a.793.793 0 0 0-.924-.445 1291.6 1291.6 0 0 0-2.023.524.797.797 0 0 0-.588.88 11.754 11.754 0 0 0 10.005 10.005.797.797 0 0 0 .88-.587l.525-2.023a.793.793 0 0 0-.445-.923L14.6 13.327a.792.792 0 0 0-.94.23z"/></svg>
 
 
 
 
 
 
233
  <svg class="whatsappme__button__send" viewbox="0 0 400 400" fill="none" fill-rule="evenodd" stroke="#fff" stroke-linecap="round" stroke-width="33">
234
  <path class="wame_plain" stroke-dasharray="1096.67" stroke-dashoffset="1096.67" d="M168.83 200.504H79.218L33.04 44.284a1 1 0 0 1 1.386-1.188L365.083 199.04a1 1 0 0 1 .003 1.808L34.432 357.903a1 1 0 0 1-1.388-1.187l29.42-99.427"/>
235
  <path class="wame_chat" stroke-dasharray="1019.22" stroke-dashoffset="1019.22" d="M318.087 318.087c-52.982 52.982-132.708 62.922-195.725 29.82l-80.449 10.18 10.358-80.112C18.956 214.905 28.836 134.99 81.913 81.913c65.218-65.217 170.956-65.217 236.174 0 42.661 42.661 57.416 102.661 44.265 157.316"/>
@@ -237,6 +271,9 @@ class WhatsAppMe_Public {
237
  <?php if ( $this->settings['message_badge'] ) : ?>
238
  <div class="whatsappme__badge">1</div>
239
  <?php endif; ?>
 
 
 
240
  </div>
241
  <?php if ( $this->settings['message_text'] ) : ?>
242
  <div class="whatsappme__box">
@@ -244,7 +281,7 @@ class WhatsAppMe_Public {
244
  <svg viewBox="0 0 120 28"><path fill="#fff" fill-rule="evenodd" d="M117.2 17c0 .4-.2.7-.4 1-.1.3-.4.5-.7.7l-1 .2c-.5 0-.9 0-1.2-.2l-.7-.7a3 3 0 0 1-.4-1 5.4 5.4 0 0 1 0-2.3c0-.4.2-.7.4-1l.7-.7a2 2 0 0 1 1.1-.3 2 2 0 0 1 1.8 1l.4 1a5.3 5.3 0 0 1 0 2.3zm2.5-3c-.1-.7-.4-1.3-.8-1.7a4 4 0 0 0-1.3-1.2c-.6-.3-1.3-.4-2-.4-.6 0-1.2.1-1.7.4a3 3 0 0 0-1.2 1.1V11H110v13h2.7v-4.5c.4.4.8.8 1.3 1 .5.3 1 .4 1.6.4a4 4 0 0 0 3.2-1.5c.4-.5.7-1 .8-1.6.2-.6.3-1.2.3-1.9s0-1.3-.3-2zm-13.1 3c0 .4-.2.7-.4 1l-.7.7-1.1.2c-.4 0-.8 0-1-.2-.4-.2-.6-.4-.8-.7a3 3 0 0 1-.4-1 5.4 5.4 0 0 1 0-2.3c0-.4.2-.7.4-1 .1-.3.4-.5.7-.7a2 2 0 0 1 1-.3 2 2 0 0 1 1.9 1l.4 1a5.4 5.4 0 0 1 0 2.3zm1.7-4.7a4 4 0 0 0-3.3-1.6c-.6 0-1.2.1-1.7.4a3 3 0 0 0-1.2 1.1V11h-2.6v13h2.7v-4.5c.3.4.7.8 1.2 1 .6.3 1.1.4 1.7.4a4 4 0 0 0 3.2-1.5c.4-.5.6-1 .8-1.6.2-.6.3-1.2.3-1.9s-.1-1.3-.3-2c-.2-.6-.4-1.2-.8-1.6zm-17.5 3.2l1.7-5 1.7 5h-3.4zm.2-8.2l-5 13.4h3l1-3h5l1 3h3L94 7.3h-3zm-5.3 9.1l-.6-.8-1-.5a11.6 11.6 0 0 0-2.3-.5l-1-.3a2 2 0 0 1-.6-.3.7.7 0 0 1-.3-.6c0-.2 0-.4.2-.5l.3-.3h.5l.5-.1c.5 0 .9 0 1.2.3.4.1.6.5.6 1h2.5c0-.6-.2-1.1-.4-1.5a3 3 0 0 0-1-1 4 4 0 0 0-1.3-.5 7.7 7.7 0 0 0-3 0c-.6.1-1 .3-1.4.5l-1 1a3 3 0 0 0-.4 1.5 2 2 0 0 0 1 1.8l1 .5 1.1.3 2.2.6c.6.2.8.5.8 1l-.1.5-.4.4a2 2 0 0 1-.6.2 2.8 2.8 0 0 1-1.4 0 2 2 0 0 1-.6-.3l-.5-.5-.2-.8H77c0 .7.2 1.2.5 1.6.2.5.6.8 1 1 .4.3.9.5 1.4.6a8 8 0 0 0 3.3 0c.5 0 1-.2 1.4-.5a3 3 0 0 0 1-1c.3-.5.4-1 .4-1.6 0-.5 0-.9-.3-1.2zM74.7 8h-2.6v3h-1.7v1.7h1.7v5.8c0 .5 0 .9.2 1.2l.7.7 1 .3a7.8 7.8 0 0 0 2 0h.7v-2.1a3.4 3.4 0 0 1-.8 0l-1-.1-.2-1v-4.8h2V11h-2V8zm-7.6 9v.5l-.3.8-.7.6c-.2.2-.7.2-1.2.2h-.6l-.5-.2a1 1 0 0 1-.4-.4l-.1-.6.1-.6.4-.4.5-.3a4.8 4.8 0 0 1 1.2-.2 8.3 8.3 0 0 0 1.2-.2l.4-.3v1zm2.6 1.5v-5c0-.6 0-1.1-.3-1.5l-1-.8-1.4-.4a10.9 10.9 0 0 0-3.1 0l-1.5.6c-.4.2-.7.6-1 1a3 3 0 0 0-.5 1.5h2.7c0-.5.2-.9.5-1a2 2 0 0 1 1.3-.4h.6l.6.2.3.4.2.7c0 .3 0 .5-.3.6-.1.2-.4.3-.7.4l-1 .1a21.9 21.9 0 0 0-2.4.4l-1 .5c-.3.2-.6.5-.8.9-.2.3-.3.8-.3 1.3s.1 1 .3 1.3c.1.4.4.7.7 1l1 .4c.4.2.9.2 1.3.2a6 6 0 0 0 1.8-.2c.6-.2 1-.5 1.5-1a4 4 0 0 0 .2 1H70l-.3-1v-1.2zm-11-6.7c-.2-.4-.6-.6-1-.8-.5-.2-1-.3-1.8-.3-.5 0-1 .1-1.5.4a3 3 0 0 0-1.3 1.2v-5h-2.7v13.4H53v-5.1c0-1 .2-1.7.5-2.2.3-.4.9-.6 1.6-.6.6 0 1 .2 1.3.6.3.4.4 1 .4 1.8v5.5h2.7v-6c0-.6 0-1.2-.2-1.6 0-.5-.3-1-.5-1.3zm-14 4.7l-2.3-9.2h-2.8l-2.3 9-2.2-9h-3l3.6 13.4h3l2.2-9.2 2.3 9.2h3l3.6-13.4h-3l-2.1 9.2zm-24.5.2L18 15.6c-.3-.1-.6-.2-.8.2A20 20 0 0 1 16 17c-.2.2-.4.3-.7.1-.4-.2-1.5-.5-2.8-1.7-1-1-1.7-2-2-2.4-.1-.4 0-.5.2-.7l.5-.6.4-.6v-.6L10.4 8c-.3-.6-.6-.5-.8-.6H9c-.2 0-.6.1-.9.5C7.8 8.2 7 9 7 10.7c0 1.7 1.3 3.4 1.4 3.6.2.3 2.5 3.7 6 5.2l1.9.8c.8.2 1.6.2 2.2.1.6-.1 2-.8 2.3-1.6.3-.9.3-1.5.2-1.7l-.7-.4zM14 25.3c-2 0-4-.5-5.8-1.6l-.4-.2-4.4 1.1 1.2-4.2-.3-.5A11.5 11.5 0 0 1 22.1 5.7 11.5 11.5 0 0 1 14 25.3zM14 0A13.8 13.8 0 0 0 2 20.7L0 28l7.3-2A13.8 13.8 0 1 0 14 0z"/></svg>
245
  <div class="whatsappme__close"><svg viewBox="0 0 24 24"><path fill="#fff" d="M24 2.4L21.6 0 12 9.6 2.4 0 0 2.4 9.6 12 0 21.6 2.4 24l9.6-9.6 9.6 9.6 2.4-2.4-9.6-9.6L24 2.4z"/></svg></div>
246
  </div>
247
- <div class="whatsappme__message"><div class="whatsappme__message__wrap"><div class="whatsappme__message__content"><?php echo self::formated_message( $this->settings['message_text'] ); ?></div></div></div>
248
  <?php if ( $copy ) : ?>
249
  <div class="whatsappme__copy"><?php echo $copy; ?> <a href="<?php echo $powered_link; ?>" rel="nofollow noopener" target="_blank"><svg viewBox="0 0 72 17"><path fill="#fff" fill-rule="evenodd" d="M25.371 10.429l2.122-6.239h.045l2.054 6.239h-4.22zm32.2 2.397c-.439.495-.88.953-1.325 1.375-.797.755-1.332 1.232-1.604 1.43-.622.438-1.156.706-1.604.805-.447.1-.787.13-1.02.09a3.561 3.561 0 0 1-.7-.239c-.66-.318-1.02-.864-1.079-1.64-.058-.774.03-1.619.263-2.533.35-1.987 1.108-4.133 2.274-6.438a73.481 73.481 0 0 0-2.8 3.04c-.816.954-1.7 2.096-2.653 3.428a44.068 44.068 0 0 0-2.77 4.441c-.738 0-1.341-.159-1.808-.477-.427-.278-.748-.695-.962-1.252-.214-.556-.165-1.41.146-2.563l.204-.626c.097-.298.204-.606.32-.924.117-.318.234-.626.35-.924.117-.298.195-.507.234-.626v.06c.272-.756.603-1.56.991-2.415a56.92 56.92 0 0 1 1.4-2.832 62.832 62.832 0 0 0-3.266 3.875 61.101 61.101 0 0 0-2.945 3.995 57.072 57.072 0 0 0-2.886 4.71c-.387 0-.736-.044-1.048-.131l.195.545h-3.72l-1.23-3.786h-6.093L23.158 17h-3.605l6.16-17h3.674l4.357 12.16c.389-1.35.97-2.736 1.74-4.16a41.336 41.336 0 0 0 2.013-4.232.465.465 0 0 0 .058-.18c0-.039.02-.098.058-.178.04-.08.078-.199.117-.358.039-.159.097-.337.175-.536.039-.12.078-.219.117-.298a.465.465 0 0 0 .058-.18c.078-.277.175-.575.292-.893.116-.318.194-.597.233-.835V.25c-.039-.04-.039-.08 0-.119l.233-.12c.117-.039.292.02.525.18.156.08.292.179.408.298.272.199.564.427.875.685.311.259.583.557.816.895a2.9 2.9 0 0 1 .467 1.043c.078.358.039.735-.117 1.133a8.127 8.127 0 0 1-.35.775c0 .08-.038.159-.116.238a2.93 2.93 0 0 1-.175.298 7.05 7.05 0 0 0-.35.656c-.039.04-.058.07-.058.09 0 .02-.02.05-.059.089a61.988 61.988 0 0 1-1.633 2.385c-.544.755-.913 1.35-1.108 1.788a79.39 79.39 0 0 1 3.5-4.233 101.59 101.59 0 0 1 3.12-3.398C45.651 1.82 46.612.986 47.468.43c.739.278 1.341.596 1.808.954.428.318.768.676 1.02 1.073.253.398.244.835-.029 1.312l-1.4 2.325a36.928 36.928 0 0 0-1.749 3.279 53.748 53.748 0 0 1 1.633-1.848 46.815 46.815 0 0 1 4.024-3.875c.7-.597 1.38-1.113 2.041-1.55.739.278 1.341.596 1.808.953.428.318.768.676 1.02 1.073.253.398.243.835-.029 1.312-.155.318-.408.795-.758 1.43a152.853 152.853 0 0 0-2.04 3.846 97.87 97.87 0 0 0-.467.924c-.35.835-.632 1.55-.846 2.146-.214.597-.282.934-.204 1.014a.63.63 0 0 0 .291-.06c.234-.119.564-.348.992-.685.428-.338.875-.736 1.341-1.193.467-.457.914-.914 1.341-1.37.217-.232.409-.45.575-.657a15.4 15.4 0 0 1 .957-2.514c.34-.696.708-1.333 1.108-1.91.399-.576.778-1.044 1.137-1.402a19.553 19.553 0 0 1 1.796-1.7 32.727 32.727 0 0 1 1.497-1.164 8.821 8.821 0 0 1 1.317-.835C66.292.989 66.83.83 67.269.83c.32 0 .649.11.988.328.34.22.649.478.928.776.28.299.519.607.718.925.2.318.3.557.3.716.04.597-.06 1.253-.3 1.97a7.14 7.14 0 0 1-1.107 2.058 8.534 8.534 0 0 1-1.826 1.76 6.522 6.522 0 0 1-2.395 1.074c-.2.08-.36.06-.48-.06a.644.644 0 0 1-.179-.477c0-.358.14-.616.42-.776.837-.318 1.536-.735 2.095-1.253.559-.517.998-1.034 1.317-1.551.4-.597.699-1.213.898-1.85 0-.199-.09-.308-.27-.328a4.173 4.173 0 0 0-.448-.03 4.83 4.83 0 0 0-1.318.597c-.399.239-.848.577-1.347 1.014-.499.438-1.028 1.015-1.586 1.73-.918 1.154-1.587 2.298-2.006 3.432-.42 1.134-.629 1.979-.629 2.536 0 .915.19 1.482.569 1.7.38.22.728.329 1.048.329.638 0 1.347-.15 2.125-.448a16.248 16.248 0 0 0 2.305-1.104 30.05 30.05 0 0 0 2.126-1.342 27.256 27.256 0 0 0 1.646-1.224c.08-.04.18-.1.3-.179l.24-.12a.54.54 0 0 1 .239-.059c.08 0 .16.02.24.06.08.04.119.16.119.358 0 .239-.08.457-.24.656a19.115 19.115 0 0 1-2.245 1.82 35.445 35.445 0 0 1-2.185 1.403c-.759.437-1.497.855-2.215 1.253a8.461 8.461 0 0 1-1.647.387c-.499.06-.968.09-1.407.09-.998 0-1.796-.16-2.395-.477-.599-.319-1.048-.706-1.347-1.164a4.113 4.113 0 0 1-.599-1.372c-.1-.457-.15-.843-.15-1.161zm-42.354-1.111L17.887 0h3.514L17.02 17h-3.56L10.7 5.428h-.046L7.94 17H4.312L0 0h3.582L6.16 11.571h.045L9.035 0h3.354l2.783 11.715h.045z"/></svg></a></div>
250
  <?php endif; ?>
@@ -253,103 +290,6 @@ class WhatsAppMe_Public {
253
  </div>
254
  <?php
255
  }
256
-
257
- }
258
-
259
-
260
- /**
261
- * Format raw message text for html output.
262
- * Also apply styles transformations like WhatsApp app.
263
- *
264
- * @since 1.3.0
265
- * @since 2.3.0 apply replace_message_variables
266
- * @since 3.0.3 make static and take $string param
267
- * @param string $string string to apply format replacements
268
- * @return string string formated
269
- */
270
- public static function formated_message( $string ) {
271
-
272
- $replacements = apply_filters(
273
- 'whatsappme_format_replacements', array(
274
- '/_(\S[^_]*\S)_/mu' => '<em>$1</em>',
275
- '/\*(\S[^\*]*\S)\*/mu' => '<strong>$1</strong>',
276
- '/~(\S[^~]*\S)~/mu' => '<del>$1</del>',
277
- )
278
- );
279
-
280
- $replacements = apply_filters_deprecated( 'whatsappme_message_replacements', array( $replacements ), '3.0.3', 'whatsappme_format_replacements' );
281
-
282
- $patterns = array_keys( $replacements );
283
-
284
- // Split text into lines and apply replacements line by line
285
- $lines = explode( "\n", $string );
286
- foreach ( $lines as $key => $line ) {
287
- $lines[ $key ] = preg_replace( $patterns, $replacements, esc_html( $line ) );
288
- }
289
-
290
- return self::replace_variables( implode( '<br>', $lines ) );
291
-
292
- }
293
-
294
- /**
295
- * Format message send, replace vars.
296
- *
297
- * @since 1.4.0
298
- * @since 2.3.0 renamed from formated_message_send to replace_message_variables
299
- * @since 3.0.3 renamed to replace_variables and make static
300
- * @param string $string string to apply variable replacements
301
- * @return string string with replaced variables
302
- */
303
- public static function replace_variables( $string ) {
304
- global $wp;
305
-
306
- $replacements = apply_filters(
307
- 'whatsappme_variable_replacements', array(
308
- 'SITE' => get_bloginfo( 'name' ),
309
- 'URL' => home_url( $wp->request ),
310
- 'TITLE' => self::get_title(),
311
- )
312
- );
313
-
314
- // Convert VAR to regex {VAR}
315
- $patterns = array_map(
316
- function ( $var ) {
317
- return "/\{$var\}/i";
318
- }, array_keys( $replacements )
319
- );
320
-
321
- $replacements = apply_filters_deprecated( 'whatsappme_message_send_replacements', array( array_combine( $patterns, $replacements ) ), '3.0.3', 'whatsappme_variable_replacements' );
322
-
323
- return preg_replace( array_keys( $replacements ), $replacements, $string );
324
-
325
- }
326
-
327
- /**
328
- * Get current page title
329
- *
330
- * @since 1.4.0
331
- * @since 3.0.3 make static
332
- * @return string message formated string
333
- */
334
- public static function get_title() {
335
-
336
- if ( is_home() || is_singular() ) {
337
- $title = single_post_title( '', false );
338
- } elseif ( is_tax() ) {
339
- $title = single_term_title( '', false );
340
- } elseif ( function_exists( 'wp_get_document_title' ) ) {
341
- $title = wp_get_document_title();
342
-
343
- // Try to remove sitename from $title for cleaner title
344
- $sep = apply_filters( 'document_title_separator', '-' );
345
- $site = get_bloginfo( 'name', 'display' );
346
- $title = str_replace( esc_html( convert_chars( wptexturize( " $sep " . $site ) ) ), '', $title );
347
- } else {
348
- $title = get_bloginfo( 'name' );
349
- }
350
-
351
- return apply_filters( 'whatsappme_get_title', $title );
352
-
353
  }
354
 
355
  /**
91
  array(
92
  'telephone' => '',
93
  'mobile_only' => 'no',
94
+ 'button_image' => '',
95
+ 'button_tip' => '',
96
  'button_delay' => 3,
97
  'whatsapp_web' => 'no',
98
  'message_text' => '',
99
  'message_delay' => 10,
100
  'message_badge' => 'no',
101
  'message_send' => '',
102
+ 'message_start' => '',
103
  'position' => 'right',
104
  'visibility' => array( 'all' => 'yes' ),
105
  ),
119
  }
120
 
121
  // Load WPML/Polylang translated strings
122
+ $settings['button_tip'] = apply_filters( 'wpml_translate_single_string', $settings['button_tip'], 'WhatsApp me', 'Tooltip' );
123
+ $settings['message_text'] = apply_filters( 'wpml_translate_single_string', $settings['message_text'], 'WhatsApp me', 'Call To Action' );
124
+ $settings['message_send'] = apply_filters( 'wpml_translate_single_string', $settings['message_send'], 'WhatsApp me', 'Message' );
125
+ $settings['message_start'] = apply_filters( 'wpml_translate_single_string', $settings['message_start'], 'WhatsApp me', 'Start WhatsApp Button' );
126
 
127
  // Filter for site settings (can be overriden by post settings)
128
  // You can translate more WPML strings or add/change other settings
147
  $settings['whatsapp_web'] = 'yes' == $settings['whatsapp_web'];
148
  $settings['message_badge'] = 'yes' == $settings['message_badge'] && '' != $settings['message_text'];
149
  $settings['position'] = 'right' == $settings['position'] ? 'right' : 'left';
150
+ $settings['message_send'] = WhatsAppMe_Util::replace_variables( $settings['message_send'] );
151
  // Set true to link http://web.whatsapp.com instead http://api.whatsapp.com
152
  $settings['whatsapp_web'] = apply_filters( 'whatsappme_whatsapp_web', 'yes' == $settings['whatsapp_web'] );
153
 
154
  // Only show if there is a phone number
155
  if ( '' != $settings['telephone'] ) {
156
  if ( isset( $settings['view'] ) && 'yes' == $settings['view'] ) {
157
+ $show = true;
158
  } elseif ( isset( $settings['view'] ) && 'no' == $settings['view'] ) {
159
+ $show = false;
160
  } else {
161
+ $show = $this->check_visibility( $settings['visibility'] );
162
  }
163
  }
164
  // Unset post 'view' setting
165
  unset( $settings['view'] );
166
+ } else {
167
+ $settings = $default_settings;
168
+ $show = false;
169
  }
170
 
171
  // Apply filters to final settings after site and post settings
172
+ $this->settings = apply_filters( 'whatsappme_get_settings', $settings, $obj );
173
  // Apply filters to alter 'show' value
174
+ $this->show = apply_filters( 'whatsappme_show', $show, $this->settings, $obj );
175
 
176
  // Ensure not show if not phone
177
  if ( '' == $this->settings['telephone'] ) {
223
  if ( $this->show ) {
224
 
225
  // Clean unnecessary settings on front
226
+ $excluded_fields = apply_filters(
227
+ 'whatsappme_excluded_fields', array(
228
+ 'visibility',
229
+ 'position',
230
+ 'button_tip',
231
+ 'button_image',
232
+ 'message_start',
233
+ )
234
+ );
235
+
236
+ $data = array_diff_key( $this->settings, array_flip( $excluded_fields ) );
237
 
238
+ $copy = apply_filters( 'whatsappme_copy', 'Powered by' );
239
 
240
  $powered_url = urlencode( home_url( $wp->request ) );
241
  $powered_site = urlencode( get_bloginfo( 'name' ) );
242
  $powered_link = "https://wame.chat/powered/?site={$powered_site}&url={$powered_url}";
243
 
244
+ $image = false;
245
+ if ( $this->settings['button_image'] ) {
246
+ $img_path = get_attached_file( $this->settings['button_image'] );
247
+
248
+ if ( apply_filters( 'whatsappme_image_original', WhatsAppMe_Util::is_animated_gif( $img_path ) ) ) {
249
+ $image = '<img src="' . wp_get_attachment_url( $this->settings['button_image'] ) . '" alt="">';
250
+ } else {
251
+ $image = '<img src="' . WhatsAppMe_Util::thumb( $img_path, 58, 58 )['url'] . '" srcset="' .
252
+ WhatsAppMe_Util::thumb( $img_path, 116, 116 )['url'] . ' 2x, ' .
253
+ WhatsAppMe_Util::thumb( $img_path, 174, 174 )['url'] . ' 3x" alt="">';
254
+ }
255
+ }
256
+
257
  ?>
258
  <div class="whatsappme <?php echo apply_filters( 'whatsappme_classes', "whatsappme--{$this->settings['position']}" ); ?>" data-settings="<?php echo esc_attr( json_encode( $data ) ); ?>">
259
  <div class="whatsappme__button">
260
+ <svg class="whatsappme__button__open" viewBox="0 0 24 24"><path fill="#fff" d="M3.516 3.516c4.686-4.686 12.284-4.686 16.97 0 4.686 4.686 4.686 12.283 0 16.97a12.004 12.004 0 01-13.754 2.299l-5.814.735a.392.392 0 01-.438-.44l.748-5.788A12.002 12.002 0 013.517 3.517zm3.61 17.043l.3.158a9.846 9.846 0 0011.534-1.758c3.843-3.843 3.843-10.074 0-13.918-3.843-3.843-10.075-3.843-13.918 0a9.846 9.846 0 00-1.747 11.554l.16.303-.51 3.942a.196.196 0 00.219.22l3.961-.501zm6.534-7.003l-.933 1.164a9.843 9.843 0 01-3.497-3.495l1.166-.933a.792.792 0 00.23-.94L9.561 6.96a.793.793 0 00-.924-.445 1291.6 1291.6 0 00-2.023.524.797.797 0 00-.588.88 11.754 11.754 0 0010.005 10.005.797.797 0 00.88-.587l.525-2.023a.793.793 0 00-.445-.923L14.6 13.327a.792.792 0 00-.94.23z"/></svg>
261
+ <?php if ( $image ) : ?>
262
+ <div class="whatsappme__button__image"><?php echo $image; ?></div>
263
+ <?php endif; ?>
264
+ <?php if ( $this->settings['message_start'] ) : ?>
265
+ <div class="whatsappme__button__sendtext"><?php echo $this->settings['message_start']; ?></div>
266
+ <?php endif; ?>
267
  <svg class="whatsappme__button__send" viewbox="0 0 400 400" fill="none" fill-rule="evenodd" stroke="#fff" stroke-linecap="round" stroke-width="33">
268
  <path class="wame_plain" stroke-dasharray="1096.67" stroke-dashoffset="1096.67" d="M168.83 200.504H79.218L33.04 44.284a1 1 0 0 1 1.386-1.188L365.083 199.04a1 1 0 0 1 .003 1.808L34.432 357.903a1 1 0 0 1-1.388-1.187l29.42-99.427"/>
269
  <path class="wame_chat" stroke-dasharray="1019.22" stroke-dashoffset="1019.22" d="M318.087 318.087c-52.982 52.982-132.708 62.922-195.725 29.82l-80.449 10.18 10.358-80.112C18.956 214.905 28.836 134.99 81.913 81.913c65.218-65.217 170.956-65.217 236.174 0 42.661 42.661 57.416 102.661 44.265 157.316"/>
271
  <?php if ( $this->settings['message_badge'] ) : ?>
272
  <div class="whatsappme__badge">1</div>
273
  <?php endif; ?>
274
+ <?php if ( $this->settings['button_tip'] ) : ?>
275
+ <div class="whatsappme__tooltip"><div><?php echo $this->settings['button_tip']; ?></div></div>
276
+ <?php endif; ?>
277
  </div>
278
  <?php if ( $this->settings['message_text'] ) : ?>
279
  <div class="whatsappme__box">
281
  <svg viewBox="0 0 120 28"><path fill="#fff" fill-rule="evenodd" d="M117.2 17c0 .4-.2.7-.4 1-.1.3-.4.5-.7.7l-1 .2c-.5 0-.9 0-1.2-.2l-.7-.7a3 3 0 0 1-.4-1 5.4 5.4 0 0 1 0-2.3c0-.4.2-.7.4-1l.7-.7a2 2 0 0 1 1.1-.3 2 2 0 0 1 1.8 1l.4 1a5.3 5.3 0 0 1 0 2.3zm2.5-3c-.1-.7-.4-1.3-.8-1.7a4 4 0 0 0-1.3-1.2c-.6-.3-1.3-.4-2-.4-.6 0-1.2.1-1.7.4a3 3 0 0 0-1.2 1.1V11H110v13h2.7v-4.5c.4.4.8.8 1.3 1 .5.3 1 .4 1.6.4a4 4 0 0 0 3.2-1.5c.4-.5.7-1 .8-1.6.2-.6.3-1.2.3-1.9s0-1.3-.3-2zm-13.1 3c0 .4-.2.7-.4 1l-.7.7-1.1.2c-.4 0-.8 0-1-.2-.4-.2-.6-.4-.8-.7a3 3 0 0 1-.4-1 5.4 5.4 0 0 1 0-2.3c0-.4.2-.7.4-1 .1-.3.4-.5.7-.7a2 2 0 0 1 1-.3 2 2 0 0 1 1.9 1l.4 1a5.4 5.4 0 0 1 0 2.3zm1.7-4.7a4 4 0 0 0-3.3-1.6c-.6 0-1.2.1-1.7.4a3 3 0 0 0-1.2 1.1V11h-2.6v13h2.7v-4.5c.3.4.7.8 1.2 1 .6.3 1.1.4 1.7.4a4 4 0 0 0 3.2-1.5c.4-.5.6-1 .8-1.6.2-.6.3-1.2.3-1.9s-.1-1.3-.3-2c-.2-.6-.4-1.2-.8-1.6zm-17.5 3.2l1.7-5 1.7 5h-3.4zm.2-8.2l-5 13.4h3l1-3h5l1 3h3L94 7.3h-3zm-5.3 9.1l-.6-.8-1-.5a11.6 11.6 0 0 0-2.3-.5l-1-.3a2 2 0 0 1-.6-.3.7.7 0 0 1-.3-.6c0-.2 0-.4.2-.5l.3-.3h.5l.5-.1c.5 0 .9 0 1.2.3.4.1.6.5.6 1h2.5c0-.6-.2-1.1-.4-1.5a3 3 0 0 0-1-1 4 4 0 0 0-1.3-.5 7.7 7.7 0 0 0-3 0c-.6.1-1 .3-1.4.5l-1 1a3 3 0 0 0-.4 1.5 2 2 0 0 0 1 1.8l1 .5 1.1.3 2.2.6c.6.2.8.5.8 1l-.1.5-.4.4a2 2 0 0 1-.6.2 2.8 2.8 0 0 1-1.4 0 2 2 0 0 1-.6-.3l-.5-.5-.2-.8H77c0 .7.2 1.2.5 1.6.2.5.6.8 1 1 .4.3.9.5 1.4.6a8 8 0 0 0 3.3 0c.5 0 1-.2 1.4-.5a3 3 0 0 0 1-1c.3-.5.4-1 .4-1.6 0-.5 0-.9-.3-1.2zM74.7 8h-2.6v3h-1.7v1.7h1.7v5.8c0 .5 0 .9.2 1.2l.7.7 1 .3a7.8 7.8 0 0 0 2 0h.7v-2.1a3.4 3.4 0 0 1-.8 0l-1-.1-.2-1v-4.8h2V11h-2V8zm-7.6 9v.5l-.3.8-.7.6c-.2.2-.7.2-1.2.2h-.6l-.5-.2a1 1 0 0 1-.4-.4l-.1-.6.1-.6.4-.4.5-.3a4.8 4.8 0 0 1 1.2-.2 8.3 8.3 0 0 0 1.2-.2l.4-.3v1zm2.6 1.5v-5c0-.6 0-1.1-.3-1.5l-1-.8-1.4-.4a10.9 10.9 0 0 0-3.1 0l-1.5.6c-.4.2-.7.6-1 1a3 3 0 0 0-.5 1.5h2.7c0-.5.2-.9.5-1a2 2 0 0 1 1.3-.4h.6l.6.2.3.4.2.7c0 .3 0 .5-.3.6-.1.2-.4.3-.7.4l-1 .1a21.9 21.9 0 0 0-2.4.4l-1 .5c-.3.2-.6.5-.8.9-.2.3-.3.8-.3 1.3s.1 1 .3 1.3c.1.4.4.7.7 1l1 .4c.4.2.9.2 1.3.2a6 6 0 0 0 1.8-.2c.6-.2 1-.5 1.5-1a4 4 0 0 0 .2 1H70l-.3-1v-1.2zm-11-6.7c-.2-.4-.6-.6-1-.8-.5-.2-1-.3-1.8-.3-.5 0-1 .1-1.5.4a3 3 0 0 0-1.3 1.2v-5h-2.7v13.4H53v-5.1c0-1 .2-1.7.5-2.2.3-.4.9-.6 1.6-.6.6 0 1 .2 1.3.6.3.4.4 1 .4 1.8v5.5h2.7v-6c0-.6 0-1.2-.2-1.6 0-.5-.3-1-.5-1.3zm-14 4.7l-2.3-9.2h-2.8l-2.3 9-2.2-9h-3l3.6 13.4h3l2.2-9.2 2.3 9.2h3l3.6-13.4h-3l-2.1 9.2zm-24.5.2L18 15.6c-.3-.1-.6-.2-.8.2A20 20 0 0 1 16 17c-.2.2-.4.3-.7.1-.4-.2-1.5-.5-2.8-1.7-1-1-1.7-2-2-2.4-.1-.4 0-.5.2-.7l.5-.6.4-.6v-.6L10.4 8c-.3-.6-.6-.5-.8-.6H9c-.2 0-.6.1-.9.5C7.8 8.2 7 9 7 10.7c0 1.7 1.3 3.4 1.4 3.6.2.3 2.5 3.7 6 5.2l1.9.8c.8.2 1.6.2 2.2.1.6-.1 2-.8 2.3-1.6.3-.9.3-1.5.2-1.7l-.7-.4zM14 25.3c-2 0-4-.5-5.8-1.6l-.4-.2-4.4 1.1 1.2-4.2-.3-.5A11.5 11.5 0 0 1 22.1 5.7 11.5 11.5 0 0 1 14 25.3zM14 0A13.8 13.8 0 0 0 2 20.7L0 28l7.3-2A13.8 13.8 0 1 0 14 0z"/></svg>
282
  <div class="whatsappme__close"><svg viewBox="0 0 24 24"><path fill="#fff" d="M24 2.4L21.6 0 12 9.6 2.4 0 0 2.4 9.6 12 0 21.6 2.4 24l9.6-9.6 9.6 9.6 2.4-2.4-9.6-9.6L24 2.4z"/></svg></div>
283
  </div>
284
+ <div class="whatsappme__message"><div class="whatsappme__message__wrap"><div class="whatsappme__message__content"><?php echo WhatsAppMe_Util::formated_message( $this->settings['message_text'] ); ?></div></div></div>
285
  <?php if ( $copy ) : ?>
286
  <div class="whatsappme__copy"><?php echo $copy; ?> <a href="<?php echo $powered_link; ?>" rel="nofollow noopener" target="_blank"><svg viewBox="0 0 72 17"><path fill="#fff" fill-rule="evenodd" d="M25.371 10.429l2.122-6.239h.045l2.054 6.239h-4.22zm32.2 2.397c-.439.495-.88.953-1.325 1.375-.797.755-1.332 1.232-1.604 1.43-.622.438-1.156.706-1.604.805-.447.1-.787.13-1.02.09a3.561 3.561 0 0 1-.7-.239c-.66-.318-1.02-.864-1.079-1.64-.058-.774.03-1.619.263-2.533.35-1.987 1.108-4.133 2.274-6.438a73.481 73.481 0 0 0-2.8 3.04c-.816.954-1.7 2.096-2.653 3.428a44.068 44.068 0 0 0-2.77 4.441c-.738 0-1.341-.159-1.808-.477-.427-.278-.748-.695-.962-1.252-.214-.556-.165-1.41.146-2.563l.204-.626c.097-.298.204-.606.32-.924.117-.318.234-.626.35-.924.117-.298.195-.507.234-.626v.06c.272-.756.603-1.56.991-2.415a56.92 56.92 0 0 1 1.4-2.832 62.832 62.832 0 0 0-3.266 3.875 61.101 61.101 0 0 0-2.945 3.995 57.072 57.072 0 0 0-2.886 4.71c-.387 0-.736-.044-1.048-.131l.195.545h-3.72l-1.23-3.786h-6.093L23.158 17h-3.605l6.16-17h3.674l4.357 12.16c.389-1.35.97-2.736 1.74-4.16a41.336 41.336 0 0 0 2.013-4.232.465.465 0 0 0 .058-.18c0-.039.02-.098.058-.178.04-.08.078-.199.117-.358.039-.159.097-.337.175-.536.039-.12.078-.219.117-.298a.465.465 0 0 0 .058-.18c.078-.277.175-.575.292-.893.116-.318.194-.597.233-.835V.25c-.039-.04-.039-.08 0-.119l.233-.12c.117-.039.292.02.525.18.156.08.292.179.408.298.272.199.564.427.875.685.311.259.583.557.816.895a2.9 2.9 0 0 1 .467 1.043c.078.358.039.735-.117 1.133a8.127 8.127 0 0 1-.35.775c0 .08-.038.159-.116.238a2.93 2.93 0 0 1-.175.298 7.05 7.05 0 0 0-.35.656c-.039.04-.058.07-.058.09 0 .02-.02.05-.059.089a61.988 61.988 0 0 1-1.633 2.385c-.544.755-.913 1.35-1.108 1.788a79.39 79.39 0 0 1 3.5-4.233 101.59 101.59 0 0 1 3.12-3.398C45.651 1.82 46.612.986 47.468.43c.739.278 1.341.596 1.808.954.428.318.768.676 1.02 1.073.253.398.244.835-.029 1.312l-1.4 2.325a36.928 36.928 0 0 0-1.749 3.279 53.748 53.748 0 0 1 1.633-1.848 46.815 46.815 0 0 1 4.024-3.875c.7-.597 1.38-1.113 2.041-1.55.739.278 1.341.596 1.808.953.428.318.768.676 1.02 1.073.253.398.243.835-.029 1.312-.155.318-.408.795-.758 1.43a152.853 152.853 0 0 0-2.04 3.846 97.87 97.87 0 0 0-.467.924c-.35.835-.632 1.55-.846 2.146-.214.597-.282.934-.204 1.014a.63.63 0 0 0 .291-.06c.234-.119.564-.348.992-.685.428-.338.875-.736 1.341-1.193.467-.457.914-.914 1.341-1.37.217-.232.409-.45.575-.657a15.4 15.4 0 0 1 .957-2.514c.34-.696.708-1.333 1.108-1.91.399-.576.778-1.044 1.137-1.402a19.553 19.553 0 0 1 1.796-1.7 32.727 32.727 0 0 1 1.497-1.164 8.821 8.821 0 0 1 1.317-.835C66.292.989 66.83.83 67.269.83c.32 0 .649.11.988.328.34.22.649.478.928.776.28.299.519.607.718.925.2.318.3.557.3.716.04.597-.06 1.253-.3 1.97a7.14 7.14 0 0 1-1.107 2.058 8.534 8.534 0 0 1-1.826 1.76 6.522 6.522 0 0 1-2.395 1.074c-.2.08-.36.06-.48-.06a.644.644 0 0 1-.179-.477c0-.358.14-.616.42-.776.837-.318 1.536-.735 2.095-1.253.559-.517.998-1.034 1.317-1.551.4-.597.699-1.213.898-1.85 0-.199-.09-.308-.27-.328a4.173 4.173 0 0 0-.448-.03 4.83 4.83 0 0 0-1.318.597c-.399.239-.848.577-1.347 1.014-.499.438-1.028 1.015-1.586 1.73-.918 1.154-1.587 2.298-2.006 3.432-.42 1.134-.629 1.979-.629 2.536 0 .915.19 1.482.569 1.7.38.22.728.329 1.048.329.638 0 1.347-.15 2.125-.448a16.248 16.248 0 0 0 2.305-1.104 30.05 30.05 0 0 0 2.126-1.342 27.256 27.256 0 0 0 1.646-1.224c.08-.04.18-.1.3-.179l.24-.12a.54.54 0 0 1 .239-.059c.08 0 .16.02.24.06.08.04.119.16.119.358 0 .239-.08.457-.24.656a19.115 19.115 0 0 1-2.245 1.82 35.445 35.445 0 0 1-2.185 1.403c-.759.437-1.497.855-2.215 1.253a8.461 8.461 0 0 1-1.647.387c-.499.06-.968.09-1.407.09-.998 0-1.796-.16-2.395-.477-.599-.319-1.048-.706-1.347-1.164a4.113 4.113 0 0 1-.599-1.372c-.1-.457-.15-.843-.15-1.161zm-42.354-1.111L17.887 0h3.514L17.02 17h-3.56L10.7 5.428h-.046L7.94 17H4.312L0 0h3.582L6.16 11.571h.045L9.035 0h3.354l2.783 11.715h.045z"/></svg></a></div>
287
  <?php endif; ?>
290
  </div>
291
  <?php
292
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  }
294
 
295
  /**
public/css/whatsappme.css CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  .whatsappme {
2
  position: fixed;
3
  z-index: 1000;
@@ -19,12 +24,15 @@
19
  fill: currentColor !important;
20
  }
21
 
22
- .whatsappme--show {
23
  transform: scale3d(1, 1, 1);
24
  transition: transform .5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
25
  }
26
 
27
  .whatsappme__button {
 
 
 
28
  position: absolute;
29
  z-index: 2;
30
  bottom: 8px;
@@ -78,6 +86,55 @@
78
  margin: 12px 12px;
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  .whatsappme__badge {
82
  position: absolute;
83
  top: -4px;
@@ -97,21 +154,17 @@
97
  }
98
 
99
  .whatsappme__badge.whatsappme__badge--in {
100
- animation: badge--in 500ms cubic-bezier(0.27, 0.9, 0.41, 1.28) 1 both;
101
  }
102
 
103
  .whatsappme__badge.whatsappme__badge--out {
104
- animation: badge--out 400ms cubic-bezier(0.215, 0.61, 0.355, 1) 1 both;
105
  }
106
 
107
  .whatsappme--dialog .whatsappme__button {
108
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
109
  }
110
 
111
- .whatsappme--dialog .whatsappme__button svg {
112
- margin: 12px 11px 12px 13px;
113
- }
114
-
115
  .whatsappme .whatsappme__button__send path {
116
  fill: none !important;
117
  stroke: #fff !important;
@@ -122,13 +175,52 @@
122
  animation-name: wame_chat;
123
  }
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  .whatsappme__button__open,
126
  .whatsappme--dialog .whatsappme__button__send {
127
  display: block;
128
  }
129
 
130
  .whatsappme__button__send,
131
- .whatsappme--dialog .whatsappme__button__open {
 
 
132
  display: none;
133
  }
134
 
@@ -179,6 +271,8 @@
179
  }
180
 
181
  .whatsappme__close {
 
 
182
  display: flex;
183
  position: absolute;
184
  top: 18px;
@@ -195,11 +289,6 @@
195
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
196
  }
197
 
198
- [dir=rtl] .whatsappme__close {
199
- right: auto;
200
- left: 24px;
201
- }
202
-
203
  .whatsappme__close:hover {
204
  opacity: .6;
205
  }
@@ -234,12 +323,6 @@
234
  background-size: 100%;
235
  }
236
 
237
- [dir=rtl] .whatsappme__message:before {
238
- left: auto;
239
- right: -18px;
240
- transform: rotateY(180deg);
241
- }
242
-
243
  .whatsappme__message__wrap {
244
  max-height: calc(100vh - 270px);
245
  padding: 0 20px 0 22px;
@@ -260,22 +343,23 @@
260
  background: rgba(0, 0, 0, 0.2);
261
  }
262
 
 
 
 
 
 
263
  .whatsappme__copy {
264
  position: absolute;
265
- bottom: 4px;
266
- left: 40px;
267
  color: #2e8c7d;
268
  font-size: 11px;
269
  letter-spacing: 0.2px;
 
270
  opacity: 0.4;
271
  transition: opacity 0.25s;
272
  }
273
 
274
- .whatsappme--left .whatsappme__copy {
275
- left: auto;
276
- right: 40px;
277
- }
278
-
279
  .whatsappme__copy:hover {
280
  opacity: 0.8;
281
  transition: opacity 0.5s ease-out 0.5s;
@@ -304,6 +388,26 @@
304
  .whatsappme--left .whatsappme__button {
305
  right: auto;
306
  left: 8px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  }
308
 
309
  .whatsappme--left .whatsappme__box {
@@ -311,6 +415,31 @@
311
  left: 0;
312
  }
313
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  @media (max-width: 480px),
315
  (orientation: landscape) and (max-width: 767px) {
316
  .whatsappme {
@@ -350,7 +479,13 @@
350
  }
351
  }
352
 
353
- @keyframes badge--in {
 
 
 
 
 
 
354
  from {
355
  opacity: 0;
356
  transform: translateY(50px);
@@ -362,7 +497,7 @@
362
  }
363
  }
364
 
365
- @keyframes badge--out {
366
  from {
367
  opacity: 1;
368
  transform: translateY(0);
@@ -375,18 +510,12 @@
375
  }
376
 
377
  @keyframes wame_plain {
378
- 5% {
379
- stroke-dashoffset: 0;
380
- }
381
-
382
  45% {
383
  stroke-dashoffset: 0;
384
  }
385
 
386
- 50% {
387
- stroke-dashoffset: 1096.67;
388
- }
389
-
390
  100% {
391
  stroke-dashoffset: 1096.67;
392
  }
@@ -397,11 +526,43 @@
397
  stroke-dashoffset: 1019.22;
398
  }
399
 
400
- 55% {
 
401
  stroke-dashoffset: 0;
402
  }
 
403
 
404
- 95% {
405
- stroke-dashoffset: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
  }
407
  }
1
+ @font-face {
2
+ font-family: 'WAmeIcons';
3
+ src: url('data:font/woff;base64,d09GRgABAAAAAARgAAsAAAAABBQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIFgGNtYXAAAAFoAAAAVAAAAFQXVtKIZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAHQAAAB0gkciwGhlYWQAAAI4AAAANgAAADYVuuUSaGhlYQAAAnAAAAAkAAAAJAbCA8dobXR4AAAClAAAABgAAAAYDgACM2xvY2EAAAKsAAAADgAAAA4AYgBAbWF4cAAAArwAAAAgAAAAIAAIAAVuYW1lAAAC3AAAAWIAAAFicC7V7nBvc3QAAARAAAAAIAAAACAAAwAAAAMDVQGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QEDwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkB//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQEzAM0DAALNAAIAAAkBEQMA/jMBzf8AAgAAAAEBAADNAs0CzQACAAABEQECzf4zAs3+AAEAAAABAAAAAQAAtqSnv18PPPUACwQAAAAAANnOUKQAAAAA2c5QpAAAAAADAALNAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAMAAAEAAAAAAAAAAAAAAAAAAAAGBAAAAAAAAAAAAAAAAgAAAAQAATMEAAEAAAAAAAAKABQAHgAsADoAAAABAAAABgADAAEAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABAAAAAEAAAAAAAIABwBFAAEAAAAAAAMABAAtAAEAAAAAAAQABABaAAEAAAAAAAUACwAMAAEAAAAAAAYABAA5AAEAAAAAAAoAGgBmAAMAAQQJAAEACAAEAAMAAQQJAAIADgBMAAMAAQQJAAMACAAxAAMAAQQJAAQACABeAAMAAQQJAAUAFgAXAAMAAQQJAAYACAA9AAMAAQQJAAoANACAd2FtZQB3AGEAbQBlVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwd2FtZQB3AGEAbQBld2FtZQB3AGEAbQBlUmVndWxhcgBSAGUAZwB1AGwAYQByd2FtZQB3AGEAbQBlRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==') format('woff');
4
+ }
5
+
6
  .whatsappme {
7
  position: fixed;
8
  z-index: 1000;
24
  fill: currentColor !important;
25
  }
26
 
27
+ .whatsappme.whatsappme--show {
28
  transform: scale3d(1, 1, 1);
29
  transition: transform .5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
30
  }
31
 
32
  .whatsappme__button {
33
+ display: -ms-flexbox;
34
+ display: -webkit-flex;
35
+ display: flex;
36
  position: absolute;
37
  z-index: 2;
38
  bottom: 8px;
86
  margin: 12px 12px;
87
  }
88
 
89
+ .whatsappme__button .whatsappme__button__send {
90
+ margin: 12px 11px 12px 13px;
91
+ }
92
+
93
+ .whatsappme__button__image {
94
+ position: absolute;
95
+ top: 1px;
96
+ right: 1px;
97
+ width: 58px;
98
+ height: 58px;
99
+ border-radius: 50%;
100
+ overflow: hidden;
101
+ opacity: 0;
102
+ }
103
+
104
+ .whatsappme__button__image img {
105
+ display: block;
106
+ width: 100%;
107
+ height: 100%;
108
+ object-fit: cover;
109
+ }
110
+
111
+ .whatsappme--show .whatsappme__button__image {
112
+ animation: wame_image_loop 20s linear 5s infinite normal both;
113
+ }
114
+
115
+ .whatsappme--image .whatsappme__button__image {
116
+ opacity: 1;
117
+ animation: none;
118
+ }
119
+
120
+ .whatsappme__button__sendtext {
121
+ padding: 0;
122
+ max-width: 0;
123
+ font-weight: 600;
124
+ line-height: 60px;
125
+ white-space: nowrap;
126
+ opacity: 0;
127
+ overflow: hidden;
128
+ transition: none;
129
+ }
130
+
131
+ .whatsappme--dialog .whatsappme__button__sendtext {
132
+ padding: 0 4px 0 24px;
133
+ max-width: 200px;
134
+ opacity: 1;
135
+ transition: max-width 0.2s linear, opacity 0.4s ease-out 0.2s;
136
+ }
137
+
138
  .whatsappme__badge {
139
  position: absolute;
140
  top: -4px;
154
  }
155
 
156
  .whatsappme__badge.whatsappme__badge--in {
157
+ animation: wame_badge_in 500ms cubic-bezier(0.27, 0.9, 0.41, 1.28) 1 both;
158
  }
159
 
160
  .whatsappme__badge.whatsappme__badge--out {
161
+ animation: wame_badge_out 400ms cubic-bezier(0.215, 0.61, 0.355, 1) 1 both;
162
  }
163
 
164
  .whatsappme--dialog .whatsappme__button {
165
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
166
  }
167
 
 
 
 
 
168
  .whatsappme .whatsappme__button__send path {
169
  fill: none !important;
170
  stroke: #fff !important;
175
  animation-name: wame_chat;
176
  }
177
 
178
+ .whatsappme__tooltip {
179
+ position: absolute;
180
+ top: 14px;
181
+ right: 76px;
182
+ max-width: calc(100vw - 105px);
183
+ height: 32px;
184
+ padding: 0 14px;
185
+ border: none;
186
+ border-radius: 16px;
187
+ background: #fff;
188
+ color: #075E54;
189
+ line-height: 31px;
190
+ white-space: nowrap;
191
+ box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.4);
192
+ opacity: 0;
193
+ }
194
+
195
+ .whatsappme__tooltip::after {
196
+ font: normal normal 400 20px/1em WAmeIcons;
197
+ content: '\e900';
198
+ position: absolute;
199
+ top: 6px;
200
+ right: -12px;
201
+ color: #fff;
202
+ text-align: right;
203
+ text-shadow: 2px 1px 3px rgba(0, 0, 0, .4);
204
+ }
205
+
206
+ .whatsappme__tooltip div {
207
+ overflow: hidden;
208
+ text-overflow: ellipsis;
209
+ }
210
+
211
+ .whatsappme--tooltip .whatsappme__tooltip {
212
+ animation: wame_tootlip 20s linear 5s 1 normal both;
213
+ }
214
+
215
  .whatsappme__button__open,
216
  .whatsappme--dialog .whatsappme__button__send {
217
  display: block;
218
  }
219
 
220
  .whatsappme__button__send,
221
+ .whatsappme--dialog .whatsappme__button__open,
222
+ .whatsappme--dialog .whatsappme__button__image,
223
+ .whatsappme--dialog .whatsappme__tooltip {
224
  display: none;
225
  }
226
 
271
  }
272
 
273
  .whatsappme__close {
274
+ display: -ms-flexbox;
275
+ display: -webkit-flex;
276
  display: flex;
277
  position: absolute;
278
  top: 18px;
289
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
290
  }
291
 
 
 
 
 
 
292
  .whatsappme__close:hover {
293
  opacity: .6;
294
  }
323
  background-size: 100%;
324
  }
325
 
 
 
 
 
 
 
326
  .whatsappme__message__wrap {
327
  max-height: calc(100vh - 270px);
328
  padding: 0 20px 0 22px;
343
  background: rgba(0, 0, 0, 0.2);
344
  }
345
 
346
+ .whatsappme__message a {
347
+ text-decoration: underline;
348
+ color: #2e8c7d;
349
+ }
350
+
351
  .whatsappme__copy {
352
  position: absolute;
353
+ bottom: 9px;
354
+ left: 28px;
355
  color: #2e8c7d;
356
  font-size: 11px;
357
  letter-spacing: 0.2px;
358
+ line-height: 16px;
359
  opacity: 0.4;
360
  transition: opacity 0.25s;
361
  }
362
 
 
 
 
 
 
363
  .whatsappme__copy:hover {
364
  opacity: 0.8;
365
  transition: opacity 0.5s ease-out 0.5s;
388
  .whatsappme--left .whatsappme__button {
389
  right: auto;
390
  left: 8px;
391
+ -ms-flex-direction: row-reverse;
392
+ -webkit-flex-direction: row-reverse;
393
+ flex-direction: row-reverse;
394
+ }
395
+
396
+ .whatsappme--left.whatsappme--dialog .whatsappme__button__sendtext {
397
+ padding: 0 24px 0 4px;
398
+ }
399
+
400
+ .whatsappme--left .whatsappme__tooltip {
401
+ right: auto;
402
+ left: 76px;
403
+ }
404
+
405
+ .whatsappme--left .whatsappme__tooltip::after {
406
+ content: '\e901';
407
+ left: -12px;
408
+ right: auto;
409
+ text-align: left;
410
+ text-shadow: -2px 1px 3px rgba(0, 0, 0, .4);
411
  }
412
 
413
  .whatsappme--left .whatsappme__box {
415
  left: 0;
416
  }
417
 
418
+ .whatsappme--left .whatsappme__copy {
419
+ left: auto;
420
+ right: 28px;
421
+ text-align: right;
422
+ }
423
+
424
+ /* rtl */
425
+
426
+ [dir=rtl] .whatsappme__close {
427
+ right: auto;
428
+ left: 24px;
429
+ }
430
+
431
+ [dir=rtl] .whatsappme__message:before {
432
+ left: auto;
433
+ right: -18px;
434
+ transform: rotateY(180deg);
435
+ }
436
+
437
+ [dir=rtl] .whatsappme--left .whatsappme__button {
438
+ -ms-flex-direction: row;
439
+ -webkit-flex-direction: row;
440
+ flex-direction: row;
441
+ }
442
+
443
  @media (max-width: 480px),
444
  (orientation: landscape) and (max-width: 767px) {
445
  .whatsappme {
479
  }
480
  }
481
 
482
+ @media (max-width: 360px) {
483
+ .whatsappme__copy {
484
+ width: 70px;
485
+ }
486
+ }
487
+
488
+ @keyframes wame_badge_in {
489
  from {
490
  opacity: 0;
491
  transform: translateY(50px);
497
  }
498
  }
499
 
500
+ @keyframes wame_badge_out {
501
  from {
502
  opacity: 1;
503
  transform: translateY(0);
510
  }
511
 
512
  @keyframes wame_plain {
513
+ 5%,
 
 
 
514
  45% {
515
  stroke-dashoffset: 0;
516
  }
517
 
518
+ 50%,
 
 
 
519
  100% {
520
  stroke-dashoffset: 1096.67;
521
  }
526
  stroke-dashoffset: 1019.22;
527
  }
528
 
529
+ 55%,
530
+ 95% {
531
  stroke-dashoffset: 0;
532
  }
533
+ }
534
 
535
+ @keyframes wame_image_loop {
536
+ 0% {
537
+ opacity: 0;
538
+ }
539
+
540
+ 3%,
541
+ 20% {
542
+ opacity: 1;
543
+ }
544
+
545
+ 23%,
546
+ 100% {
547
+ opacity: 0;
548
+ }
549
+ }
550
+
551
+ @keyframes wame_tootlip {
552
+ 0% {
553
+ opacity: 0;
554
+ transform: scaleY(0);
555
+ }
556
+
557
+ 1%,
558
+ 20% {
559
+ opacity: 1;
560
+ transform: scaleY(1);
561
+ }
562
+
563
+ 23%,
564
+ 100% {
565
+ opacity: 0;
566
+ transform: scaleY(1);
567
  }
568
  }
public/css/whatsappme.min.css CHANGED
@@ -1 +1 @@
1
- .whatsappme{position:fixed;z-index:1000;right:20px;bottom:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:16px;line-height:26px;color:#262626;transform:scale3d(0,0,0);transition:transform .3s ease-in-out;user-select:none;-ms-user-select:none;-moz-user-select:none;-webkit-user-select:none}.whatsappme svg path{fill:currentColor!important}.whatsappme--show{transform:scale3d(1,1,1);transition:transform .5s cubic-bezier(.18,.89,.32,1.28)}.whatsappme__button{position:absolute;z-index:2;bottom:8px;right:8px;height:60px;min-width:60px;max-width:95vw;background-color:#25d366;color:#fff;border-radius:30px;box-shadow:1px 6px 24px 0 rgba(7,94,84,.24);cursor:pointer;transition:background-color .2s linear;-webkit-tap-highlight-color:transparent}.whatsappme__button:hover{background-color:#128c7e;transition:background-color 1.5s linear}.whatsappme--dialog .whatsappme__button{background-color:#128c7e;transition:background-color .2s linear}.whatsappme--dialog .whatsappme__button:hover{background-color:#075e54}.whatsappme__button:active{background-color:#075e54;transition:none}@supports (-webkit-overflow-scrolling:touch){.whatsappme--dialog .whatsappme__button{background-color:#34b7f1}.whatsappme--dialog .whatsappme__button:hover,.whatsappme__button:active{background-color:#228bb9}}.whatsappme__button svg{width:36px;height:36px;margin:12px 12px}.whatsappme__badge{position:absolute;top:-4px;right:-4px;width:20px;height:20px;border:none;border-radius:50%;background:#e82c0c;font-size:12px;font-weight:600;line-height:20px;text-align:center;box-shadow:none;opacity:0;pointer-events:none}.whatsappme__badge.whatsappme__badge--in{animation:badge--in .5s cubic-bezier(.27,.9,.41,1.28) 1 both}.whatsappme__badge.whatsappme__badge--out{animation:badge--out .4s cubic-bezier(.215,.61,.355,1) 1 both}.whatsappme--dialog .whatsappme__button{box-shadow:0 1px 2px 0 rgba(0,0,0,.3)}.whatsappme--dialog .whatsappme__button svg{margin:12px 11px 12px 13px}.whatsappme .whatsappme__button__send path{fill:none!important;stroke:#fff!important;animation:wame_plain 6s 0s ease-in-out infinite}.whatsappme .whatsappme__button__send path.wame_chat{animation-name:wame_chat}.whatsappme--dialog .whatsappme__button__send,.whatsappme__button__open{display:block}.whatsappme--dialog .whatsappme__button__open,.whatsappme__button__send{display:none}.whatsappme__box{position:absolute;bottom:0;right:0;z-index:1;width:calc(100vw - 40px);max-width:400px;min-height:280px;padding-bottom:60px;border-radius:32px;background:#ede4dd url(../images/background.webp) center repeat-y;background-size:100% auto;box-shadow:0 2px 6px 0 rgba(0,0,0,.5);overflow:hidden;transform:scale3d(0,0,0);opacity:0;transition:opacity .4s ease-out,transform 0s linear .3s}.nowebp .whatsappme__box{background-image:url(../images/background.png)}.whatsappme--dialog .whatsappme__box{opacity:1;transform:scale3d(1,1,1);transition:opacity .2s ease-out,transform 0s linear}.whatsappme__header{float:none;display:block;position:static;width:100%;height:70px;padding:0 26px;margin:0;background-color:#2e8c7d;color:rgba(255,255,255,.5)}.whatsappme__header svg{width:120px;height:100%}.whatsappme__close{display:flex;position:absolute;top:18px;right:24px;width:34px;height:34px;border-radius:50%;background:#000;color:#fff;text-align:center;opacity:.4;cursor:pointer;transition:opacity .3s ease-out;-webkit-tap-highlight-color:transparent}[dir=rtl] .whatsappme__close{right:auto;left:24px}.whatsappme__close:hover{opacity:.6}.whatsappme__close svg{display:block;width:12px;height:12px;margin:auto}.whatsappme__message{position:relative;min-height:80px;padding:20px 2px 20px 0;margin:34px 26px;border-radius:32px;background-color:#fff;color:#4a4a4a;box-shadow:0 1px 2px 0 rgba(0,0,0,.3)}.whatsappme__message:before{content:'';display:block;position:absolute;bottom:30px;left:-18px;width:18px;height:18px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAAA1CAYAAADlE3NNAAAEr0lEQVRo3t2aT0gjVxzHf++9mcn8zWhW6bpELWzcogFNaRar7a4tBNy2WATbHpacpdZ6redeZE+9CL02B1ktXsRD/xwsilhoSwsqag/xYK09hCQlmCiTf28vGRnGmZhE183MFx5vmGQy7zO/P/P7PYLAHUIAQCqDAwDPxMREG3IpHL+zs/MZcgkYAgAMAIwOl8lkYm6xGgYAFgAEAGgZHx9/vVwun7nJJTkAEAGgdW9v73NKKXWLSzIA4AEAGQDazs/P/3ALnNEl1a2trY9oRW6wmu6SEgC0ZrPZn9wCp2dIHgCU1dXVtymlZafDIatEksvlfqYGueG9xgOAcnBw8JSa5GR3vIi1aDTaUSwWj5wOZ3RHPUN6U6nUN9RCTnZHDwDI+/v745TSkpPhrOpHcWlpqbdcLieojZwGpseZMDo66svn87/RKnIaGAsAfCAQ8J6dnX1Pr5DjwABAzmazMVqDHAd2enr6La1RjgGLRCJqLpeL0TrUjFDGrMgCAD8/P38vn8//QutUs1pLT/fC5ubmQKFQOKANqNmspbuhBwDEZDL5BaX0lDaoZoK62NxZXFzs1DRthV5TrxrKGFue/v5+KZ1Of1kul5P0BtQUUAAgxOPx9wuFwl/0BvWq3O8C6vDw8F1N036gL0G3ZaVLUEdHRxFN036kL1E3DWMHxAEAPzc3dyedTk+XSqUdegu6CRijy5mBPLOzs2oikfhU07RFSmmG3qKuaxkdxuhy/MzMjDeRSHyiadrz2wYyClUBMh9bzRfAu7u7PX6//z1RFB9zHBcBALUZKoRqUMgEgyvHeHt7+353d/cjQRBGWJZ9jBDqaMYKHKpYBAEAXltbawsGg2FFUd7iOO4hIeQhQuiOEzpdOzCSTCaftLS0fEUIGXbiHiBjU5njVCr1sc/nW6wkDcduS1u1HKRUKv2KMR4ABwvbAWKMA+BwYbsasFgs/uMWuEtxd3x8/J3b4C4Ag8Hg83g8/iyfz//n5IRi1eZzla00HgA8oijyDMNwlFJCCGH0axiGQQAAXq+XyLLMeL1eRlEURpZlRpIkhud5oigK297eLvl8Prm1tVVSFEWSJEkWRVESBMGrqupriqLcFQThLsaYu612n6vUip4KMFv5HJssjhooEi5laoZh0NjYWNvw8PC9np6ejkAg8MDv9w+oqnrfxsNqhgNTh2wE1MGYChyyWGA9RYJVFWTM3MhwjMPhsDw9PT0QDocHOjs731RV9Y1rv+cMlb4Oiy3garWW1b2sPMfceZgHmZqa6pycnPywr6/vA47jfPXAWbU0xOCOqE44u2K8Wl9oBUfMa+rq6hIWFhbGBwcHn9pBohogcRWwRiCRTUiACQ6ZYpxY9JAkFAopy8vLM4FAYKyRrgA1GGf1JperLGgEM4cNG4vF3olGo18TQkT9JsRmAdQw66NsGlbn7Ibdd0um2XzOblz6/ZWVlX8JIb8PDQ090gFJDU+e2sBeZ1hBU9NcqvIQzDMFALq+vp7GGP85MjLyBCHE1tPO1LP4eq4FG/hqnlGyeSiwsbHxfygUOu7t7Y00059JUY3ZHFm8k1lT0cGfnJw8c0ojepWFzd6CMpnM3y8AJPEkZ9khO4IAAAAASUVORK5CYII=);background-size:100%}[dir=rtl] .whatsappme__message:before{left:auto;right:-18px;transform:rotateY(180deg)}.whatsappme__message__wrap{max-height:calc(100vh - 270px);padding:0 20px 0 22px;overflow:auto}.whatsappme__message__wrap::-webkit-scrollbar{width:5px;background:rgba(0,0,0,0)}.whatsappme__message__wrap::-webkit-scrollbar-thumb{border-radius:3px;background:rgba(0,0,0,0)}.whatsappme__message__wrap:hover::-webkit-scrollbar-thumb{background:rgba(0,0,0,.2)}.whatsappme__copy{position:absolute;bottom:4px;left:40px;color:#2e8c7d;font-size:11px;letter-spacing:.2px;opacity:.4;transition:opacity .25s}.whatsappme--left .whatsappme__copy{left:auto;right:40px}.whatsappme__copy:hover{opacity:.8;transition:opacity .5s ease-out .5s}.whatsappme__copy a,.whatsappme__copy a:active,.whatsappme__copy a:hover{color:inherit;text-decoration:none}.whatsappme__copy svg{width:40px;height:10px;vertical-align:inherit}.whatsappme--left{right:auto;left:20px}.whatsappme--left .whatsappme__button{right:auto;left:8px}.whatsappme--left .whatsappme__box{right:auto;left:0}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.whatsappme{bottom:6px;right:6px}.whatsappme--left{right:auto;left:6px}.whatsappme__box{width:calc(100vw - 12px);min-height:0}.whatsappme__header{height:55px}.whatsappme__close{top:13px;width:28px;height:28px}.whatsappme__message{padding:16px 0;margin:15px 21px 20px;line-height:24px}.whatsappme__message__wrap{max-height:calc(100vh - 194px);padding:0 14px}}@keyframes badge--in{from{opacity:0;transform:translateY(50px)}to{opacity:1;transform:translateY(0)}}@keyframes badge--out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes wame_plain{5%{stroke-dashoffset:0}45%{stroke-dashoffset:0}50%{stroke-dashoffset:1096.67}100%{stroke-dashoffset:1096.67}}@keyframes wame_chat{50%{stroke-dashoffset:1019.22}55%{stroke-dashoffset:0}95%{stroke-dashoffset:0}}
1
+ @font-face{font-family:WAmeIcons;src:url(data:font/woff;base64,d09GRgABAAAAAARgAAsAAAAABBQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgDxIFgGNtYXAAAAFoAAAAVAAAAFQXVtKIZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAAAHQAAAB0gkciwGhlYWQAAAI4AAAANgAAADYVuuUSaGhlYQAAAnAAAAAkAAAAJAbCA8dobXR4AAAClAAAABgAAAAYDgACM2xvY2EAAAKsAAAADgAAAA4AYgBAbWF4cAAAArwAAAAgAAAAIAAIAAVuYW1lAAAC3AAAAWIAAAFicC7V7nBvc3QAAARAAAAAIAAAACAAAwAAAAMDVQGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA6QEDwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADgAAAAKAAgAAgACAAEAIOkB//3//wAAAAAAIOkA//3//wAB/+MXBAADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQEzAM0DAALNAAIAAAkBEQMA/jMBzf8AAgAAAAEBAADNAs0CzQACAAABEQECzf4zAs3+AAEAAAABAAAAAQAAtqSnv18PPPUACwQAAAAAANnOUKQAAAAA2c5QpAAAAAADAALNAAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAMAAAEAAAAAAAAAAAAAAAAAAAAGBAAAAAAAAAAAAAAAAgAAAAQAATMEAAEAAAAAAAAKABQAHgAsADoAAAABAAAABgADAAEAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEABAAAAAEAAAAAAAIABwBFAAEAAAAAAAMABAAtAAEAAAAAAAQABABaAAEAAAAAAAUACwAMAAEAAAAAAAYABAA5AAEAAAAAAAoAGgBmAAMAAQQJAAEACAAEAAMAAQQJAAIADgBMAAMAAQQJAAMACAAxAAMAAQQJAAQACABeAAMAAQQJAAUAFgAXAAMAAQQJAAYACAA9AAMAAQQJAAoANACAd2FtZQB3AGEAbQBlVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwd2FtZQB3AGEAbQBld2FtZQB3AGEAbQBlUmVndWxhcgBSAGUAZwB1AGwAYQByd2FtZQB3AGEAbQBlRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format('woff')}.whatsappme{position:fixed;z-index:1000;right:20px;bottom:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:16px;line-height:26px;color:#262626;transform:scale3d(0,0,0);transition:transform .3s ease-in-out;user-select:none;-ms-user-select:none;-moz-user-select:none;-webkit-user-select:none}.whatsappme svg path{fill:currentColor!important}.whatsappme.whatsappme--show{transform:scale3d(1,1,1);transition:transform .5s cubic-bezier(.18,.89,.32,1.28)}.whatsappme__button{display:-ms-flexbox;display:-webkit-flex;display:flex;position:absolute;z-index:2;bottom:8px;right:8px;height:60px;min-width:60px;max-width:95vw;background-color:#25d366;color:#fff;border-radius:30px;box-shadow:1px 6px 24px 0 rgba(7,94,84,.24);cursor:pointer;transition:background-color .2s linear;-webkit-tap-highlight-color:transparent}.whatsappme__button:hover{background-color:#128c7e;transition:background-color 1.5s linear}.whatsappme--dialog .whatsappme__button{background-color:#128c7e;transition:background-color .2s linear}.whatsappme--dialog .whatsappme__button:hover{background-color:#075e54}.whatsappme__button:active{background-color:#075e54;transition:none}@supports (-webkit-overflow-scrolling:touch){.whatsappme--dialog .whatsappme__button{background-color:#34b7f1}.whatsappme--dialog .whatsappme__button:hover,.whatsappme__button:active{background-color:#228bb9}}.whatsappme__button svg{width:36px;height:36px;margin:12px 12px}.whatsappme__button .whatsappme__button__send{margin:12px 11px 12px 13px}.whatsappme__button__image{position:absolute;top:1px;right:1px;width:58px;height:58px;border-radius:50%;overflow:hidden;opacity:0}.whatsappme__button__image img{display:block;width:100%;height:100%;object-fit:cover}.whatsappme--show .whatsappme__button__image{animation:wame_image_loop 20s linear 5s infinite normal both}.whatsappme--image .whatsappme__button__image{opacity:1;animation:none}.whatsappme__button__sendtext{padding:0;max-width:0;font-weight:600;line-height:60px;white-space:nowrap;opacity:0;overflow:hidden;transition:none}.whatsappme--dialog .whatsappme__button__sendtext{padding:0 4px 0 24px;max-width:200px;opacity:1;transition:max-width .2s linear,opacity .4s ease-out .2s}.whatsappme__badge{position:absolute;top:-4px;right:-4px;width:20px;height:20px;border:none;border-radius:50%;background:#e82c0c;font-size:12px;font-weight:600;line-height:20px;text-align:center;box-shadow:none;opacity:0;pointer-events:none}.whatsappme__badge.whatsappme__badge--in{animation:wame_badge_in .5s cubic-bezier(.27,.9,.41,1.28) 1 both}.whatsappme__badge.whatsappme__badge--out{animation:wame_badge_out .4s cubic-bezier(.215,.61,.355,1) 1 both}.whatsappme--dialog .whatsappme__button{box-shadow:0 1px 2px 0 rgba(0,0,0,.3)}.whatsappme .whatsappme__button__send path{fill:none!important;stroke:#fff!important;animation:wame_plain 6s 0s ease-in-out infinite}.whatsappme .whatsappme__button__send path.wame_chat{animation-name:wame_chat}.whatsappme__tooltip{position:absolute;top:14px;right:76px;max-width:calc(100vw - 105px);height:32px;padding:0 14px;border:none;border-radius:16px;background:#fff;color:#075e54;line-height:31px;white-space:nowrap;box-shadow:0 1px 4px 0 rgba(0,0,0,.4);opacity:0}.whatsappme__tooltip::after{font:normal normal 400 20px/1em WAmeIcons;content:'\e900';position:absolute;top:6px;right:-12px;color:#fff;text-align:right;text-shadow:2px 1px 3px rgba(0,0,0,.4)}.whatsappme__tooltip div{overflow:hidden;text-overflow:ellipsis}.whatsappme--tooltip .whatsappme__tooltip{animation:wame_tootlip 20s linear 5s 1 normal both}.whatsappme--dialog .whatsappme__button__send,.whatsappme__button__open{display:block}.whatsappme--dialog .whatsappme__button__image,.whatsappme--dialog .whatsappme__button__open,.whatsappme--dialog .whatsappme__tooltip,.whatsappme__button__send{display:none}.whatsappme__box{position:absolute;bottom:0;right:0;z-index:1;width:calc(100vw - 40px);max-width:400px;min-height:280px;padding-bottom:60px;border-radius:32px;background:#ede4dd url(../images/background.webp) center repeat-y;background-size:100% auto;box-shadow:0 2px 6px 0 rgba(0,0,0,.5);overflow:hidden;transform:scale3d(0,0,0);opacity:0;transition:opacity .4s ease-out,transform 0s linear .3s}.nowebp .whatsappme__box{background-image:url(../images/background.png)}.whatsappme--dialog .whatsappme__box{opacity:1;transform:scale3d(1,1,1);transition:opacity .2s ease-out,transform 0s linear}.whatsappme__header{float:none;display:block;position:static;width:100%;height:70px;padding:0 26px;margin:0;background-color:#2e8c7d;color:rgba(255,255,255,.5)}.whatsappme__header svg{width:120px;height:100%}.whatsappme__close{display:-ms-flexbox;display:-webkit-flex;display:flex;position:absolute;top:18px;right:24px;width:34px;height:34px;border-radius:50%;background:#000;color:#fff;text-align:center;opacity:.4;cursor:pointer;transition:opacity .3s ease-out;-webkit-tap-highlight-color:transparent}.whatsappme__close:hover{opacity:.6}.whatsappme__close svg{display:block;width:12px;height:12px;margin:auto}.whatsappme__message{position:relative;min-height:80px;padding:20px 2px 20px 0;margin:34px 26px;border-radius:32px;background-color:#fff;color:#4a4a4a;box-shadow:0 1px 2px 0 rgba(0,0,0,.3)}.whatsappme__message:before{content:'';display:block;position:absolute;bottom:30px;left:-18px;width:18px;height:18px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAAA1CAYAAADlE3NNAAAEr0lEQVRo3t2aT0gjVxzHf++9mcn8zWhW6bpELWzcogFNaRar7a4tBNy2WATbHpacpdZ6redeZE+9CL02B1ktXsRD/xwsilhoSwsqag/xYK09hCQlmCiTf28vGRnGmZhE183MFx5vmGQy7zO/P/P7PYLAHUIAQCqDAwDPxMREG3IpHL+zs/MZcgkYAgAMAIwOl8lkYm6xGgYAFgAEAGgZHx9/vVwun7nJJTkAEAGgdW9v73NKKXWLSzIA4AEAGQDazs/P/3ALnNEl1a2trY9oRW6wmu6SEgC0ZrPZn9wCp2dIHgCU1dXVtymlZafDIatEksvlfqYGueG9xgOAcnBw8JSa5GR3vIi1aDTaUSwWj5wOZ3RHPUN6U6nUN9RCTnZHDwDI+/v745TSkpPhrOpHcWlpqbdcLieojZwGpseZMDo66svn87/RKnIaGAsAfCAQ8J6dnX1Pr5DjwABAzmazMVqDHAd2enr6La1RjgGLRCJqLpeL0TrUjFDGrMgCAD8/P38vn8//QutUs1pLT/fC5ubmQKFQOKANqNmspbuhBwDEZDL5BaX0lDaoZoK62NxZXFzs1DRthV5TrxrKGFue/v5+KZ1Of1kul5P0BtQUUAAgxOPx9wuFwl/0BvWq3O8C6vDw8F1N036gL0G3ZaVLUEdHRxFN036kL1E3DWMHxAEAPzc3dyedTk+XSqUdegu6CRijy5mBPLOzs2oikfhU07RFSmmG3qKuaxkdxuhy/MzMjDeRSHyiadrz2wYyClUBMh9bzRfAu7u7PX6//z1RFB9zHBcBALUZKoRqUMgEgyvHeHt7+353d/cjQRBGWJZ9jBDqaMYKHKpYBAEAXltbawsGg2FFUd7iOO4hIeQhQuiOEzpdOzCSTCaftLS0fEUIGXbiHiBjU5njVCr1sc/nW6wkDcduS1u1HKRUKv2KMR4ABwvbAWKMA+BwYbsasFgs/uMWuEtxd3x8/J3b4C4Ag8Hg83g8/iyfz//n5IRi1eZzla00HgA8oijyDMNwlFJCCGH0axiGQQAAXq+XyLLMeL1eRlEURpZlRpIkhud5oigK297eLvl8Prm1tVVSFEWSJEkWRVESBMGrqupriqLcFQThLsaYu612n6vUip4KMFv5HJssjhooEi5laoZh0NjYWNvw8PC9np6ejkAg8MDv9w+oqnrfxsNqhgNTh2wE1MGYChyyWGA9RYJVFWTM3MhwjMPhsDw9PT0QDocHOjs731RV9Y1rv+cMlb4Oiy3garWW1b2sPMfceZgHmZqa6pycnPywr6/vA47jfPXAWbU0xOCOqE44u2K8Wl9oBUfMa+rq6hIWFhbGBwcHn9pBohogcRWwRiCRTUiACQ6ZYpxY9JAkFAopy8vLM4FAYKyRrgA1GGf1JperLGgEM4cNG4vF3olGo18TQkT9JsRmAdQw66NsGlbn7Ibdd0um2XzOblz6/ZWVlX8JIb8PDQ090gFJDU+e2sBeZ1hBU9NcqvIQzDMFALq+vp7GGP85MjLyBCHE1tPO1LP4eq4FG/hqnlGyeSiwsbHxfygUOu7t7Y00059JUY3ZHFm8k1lT0cGfnJw8c0ojepWFzd6CMpnM3y8AJPEkZ9khO4IAAAAASUVORK5CYII=);background-size:100%}.whatsappme__message__wrap{max-height:calc(100vh - 270px);padding:0 20px 0 22px;overflow:auto}.whatsappme__message__wrap::-webkit-scrollbar{width:5px;background:rgba(0,0,0,0)}.whatsappme__message__wrap::-webkit-scrollbar-thumb{border-radius:3px;background:rgba(0,0,0,0)}.whatsappme__message__wrap:hover::-webkit-scrollbar-thumb{background:rgba(0,0,0,.2)}.whatsappme__message a{text-decoration:underline;color:#2e8c7d}.whatsappme__copy{position:absolute;bottom:9px;left:28px;color:#2e8c7d;font-size:11px;letter-spacing:.2px;line-height:16px;opacity:.4;transition:opacity .25s}.whatsappme__copy:hover{opacity:.8;transition:opacity .5s ease-out .5s}.whatsappme__copy a,.whatsappme__copy a:active,.whatsappme__copy a:hover{color:inherit;text-decoration:none}.whatsappme__copy svg{width:40px;height:10px;vertical-align:inherit}.whatsappme--left{right:auto;left:20px}.whatsappme--left .whatsappme__button{right:auto;left:8px;-ms-flex-direction:row-reverse;-webkit-flex-direction:row-reverse;flex-direction:row-reverse}.whatsappme--left.whatsappme--dialog .whatsappme__button__sendtext{padding:0 24px 0 4px}.whatsappme--left .whatsappme__tooltip{right:auto;left:76px}.whatsappme--left .whatsappme__tooltip::after{content:'\e901';left:-12px;right:auto;text-align:left;text-shadow:-2px 1px 3px rgba(0,0,0,.4)}.whatsappme--left .whatsappme__box{right:auto;left:0}.whatsappme--left .whatsappme__copy{left:auto;right:28px;text-align:right}[dir=rtl] .whatsappme__close{right:auto;left:24px}[dir=rtl] .whatsappme__message:before{left:auto;right:-18px;transform:rotateY(180deg)}[dir=rtl] .whatsappme--left .whatsappme__button{-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.whatsappme{bottom:6px;right:6px}.whatsappme--left{right:auto;left:6px}.whatsappme__box{width:calc(100vw - 12px);min-height:0}.whatsappme__header{height:55px}.whatsappme__close{top:13px;width:28px;height:28px}.whatsappme__message{padding:16px 0;margin:15px 21px 20px;line-height:24px}.whatsappme__message__wrap{max-height:calc(100vh - 194px);padding:0 14px}}@media (max-width:360px){.whatsappme__copy{width:70px}}@keyframes wame_badge_in{from{opacity:0;transform:translateY(50px)}to{opacity:1;transform:translateY(0)}}@keyframes wame_badge_out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes wame_plain{45%,5%{stroke-dashoffset:0}100%,50%{stroke-dashoffset:1096.67}}@keyframes wame_chat{50%{stroke-dashoffset:1019.22}55%,95%{stroke-dashoffset:0}}@keyframes wame_image_loop{0%{opacity:0}20%,3%{opacity:1}100%,23%{opacity:0}}@keyframes wame_tootlip{0%{opacity:0;transform:scaleY(0)}1%,20%{opacity:1;transform:scaleY(1)}100%,23%{opacity:0;transform:scaleY(1)}}
public/js/whatsappme.js CHANGED
@@ -30,7 +30,7 @@
30
  }
31
  }
32
 
33
- // only works if whatsappme is defined
34
  if ($whatsappme.length && !!wame_settings && !!wame_settings.telephone) {
35
  whatsappme_magic();
36
  }
@@ -38,37 +38,40 @@
38
  function whatsappme_magic() {
39
  var is_mobile = !!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);
40
  var button_delay = wame_settings.button_delay * 1000;
 
41
  var has_cta = wame_settings.message_text !== '';
42
  var wa_web = wame_settings.whatsapp_web && !is_mobile;
43
- var message_hash, is_viewed, timeoutID, timeoutCTA;
44
 
45
- // check WebP support
46
  var webP = new Image();
47
  webP.src = 'data:image/webp;base64,UklGRi4AAABXRUJQVlA4TCEAAAAvAUAAEB8wAiMwAgSSNtse/cXjxyCCmrYNWPwmHRH9jwMA';
48
- webP.onload = webP.onerror = function () {
49
- if (webP.height !== 2) $whatsappme.addClass('nowebp');
50
- }
51
 
52
- // stored values
53
  var messages_viewed = (store.getItem('whatsappme_hashes') || '').split(',').filter(Boolean);
54
  var is_second_visit = store.getItem('whatsappme_visited') == 'yes';
55
 
56
- if (has_cta) {
57
- message_hash = hash(wame_settings.message_text).toString();
58
- is_viewed = messages_viewed.indexOf(message_hash) > -1;
59
- }
60
 
61
  store.setItem('whatsappme_visited', 'yes');
62
 
63
  if (!wame_settings.mobile_only || is_mobile) {
64
- // show button
65
- setTimeout(function () { $whatsappme.addClass('whatsappme--show'); }, button_delay);
66
-
67
- if (has_cta && !is_viewed) {
68
- if (wame_settings.message_badge) { // show badge
69
- timeoutCTA = setTimeout(function () { $badge.addClass('whatsappme__badge--in'); }, button_delay + (wame_settings.message_delay * 1000));
70
- } else if (is_second_visit) { // show dialog
71
- timeoutCTA = setTimeout(function () { $whatsappme.addClass('whatsappme--dialog'); }, button_delay + (wame_settings.message_delay * 1000));
 
 
 
 
 
 
72
  }
73
  }
74
  }
@@ -86,7 +89,7 @@
86
  var args = { link: whatsapp_link(wa_web, wame_settings.telephone, wame_settings.message_send) };
87
  var secure_link = new RegExp("^https?:\/\/(wa\.me|(api|web|chat)\.whatsapp\.com|" + location.hostname.replace('.', '\.') + ")\/.*", 'i');
88
 
89
- $whatsappme.removeClass('whatsappme--dialog');
90
  save_message_viewed();
91
  // Trigger custom event (args obj allow edit link by third party scripts)
92
  $(document).trigger('whatsappme:open', [args, wame_settings]);
@@ -98,13 +101,13 @@
98
  // Open WhatsApp link
99
  window.open(args.link, 'whatsappme');
100
  } else {
101
- console.error("WAme: the link doesn't seem safe, it must point to the current domain or whatsapp.com")
102
  }
103
  }
104
  });
105
 
106
  $('.whatsappme__close', $whatsappme).click(function () {
107
- $whatsappme.removeClass('whatsappme--dialog');
108
  save_message_viewed();
109
  });
110
 
@@ -119,8 +122,8 @@
119
  }
120
 
121
  function save_message_viewed() {
122
- if (has_cta && !is_viewed) {
123
- messages_viewed.push(message_hash)
124
  store.setItem('whatsappme_hashes', messages_viewed.join(','));
125
  is_viewed = true;
126
  }
30
  }
31
  }
32
 
33
+ // Only works if whatsappme is defined
34
  if ($whatsappme.length && !!wame_settings && !!wame_settings.telephone) {
35
  whatsappme_magic();
36
  }
38
  function whatsappme_magic() {
39
  var is_mobile = !!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);
40
  var button_delay = wame_settings.button_delay * 1000;
41
+ var chat_delay = wame_settings.message_delay * 1000;
42
  var has_cta = wame_settings.message_text !== '';
43
  var wa_web = wame_settings.whatsapp_web && !is_mobile;
44
+ var timeoutID, timeoutCTA;
45
 
46
+ // Check WebP support
47
  var webP = new Image();
48
  webP.src = 'data:image/webp;base64,UklGRi4AAABXRUJQVlA4TCEAAAAvAUAAEB8wAiMwAgSSNtse/cXjxyCCmrYNWPwmHRH9jwMA';
49
+ webP.onload = webP.onerror = function () { if (webP.height !== 2) $whatsappme.addClass('nowebp'); }
 
 
50
 
51
+ // Stored values
52
  var messages_viewed = (store.getItem('whatsappme_hashes') || '').split(',').filter(Boolean);
53
  var is_second_visit = store.getItem('whatsappme_visited') == 'yes';
54
 
55
+ var message_hash = has_cta ? hash(wame_settings.message_text).toString() : 'no_cta';
56
+ var is_viewed = messages_viewed.indexOf(message_hash) > -1;
 
 
57
 
58
  store.setItem('whatsappme_visited', 'yes');
59
 
60
  if (!wame_settings.mobile_only || is_mobile) {
61
+ var classes = 'whatsappme--show';
62
+ if (!is_viewed && (!has_cta || !chat_delay || wame_settings.message_badge || !is_second_visit)) {
63
+ classes += ' whatsappme--tooltip';
64
+ }
65
+ // Show button (and tooltip)
66
+ setTimeout(function () { $whatsappme.addClass(classes); }, button_delay);
67
+
68
+ if (has_cta && !is_viewed && chat_delay) {
69
+ if (wame_settings.message_badge) {
70
+ // Show badge
71
+ timeoutCTA = setTimeout(function () { $badge.addClass('whatsappme__badge--in'); }, button_delay + chat_delay);
72
+ } else if (is_second_visit) {
73
+ // Show dialog
74
+ timeoutCTA = setTimeout(show_dialog, button_delay + chat_delay);
75
  }
76
  }
77
  }
89
  var args = { link: whatsapp_link(wa_web, wame_settings.telephone, wame_settings.message_send) };
90
  var secure_link = new RegExp("^https?:\/\/(wa\.me|(api|web|chat)\.whatsapp\.com|" + location.hostname.replace('.', '\.') + ")\/.*", 'i');
91
 
92
+ $whatsappme.removeClass('whatsappme--dialog whatsappme--tooltip');
93
  save_message_viewed();
94
  // Trigger custom event (args obj allow edit link by third party scripts)
95
  $(document).trigger('whatsappme:open', [args, wame_settings]);
101
  // Open WhatsApp link
102
  window.open(args.link, 'whatsappme');
103
  } else {
104
+ console.error("WAme: the link doesn't seem safe, it must point to the current domain or whatsapp.com");
105
  }
106
  }
107
  });
108
 
109
  $('.whatsappme__close', $whatsappme).click(function () {
110
+ $whatsappme.removeClass('whatsappme--dialog whatsappme--tooltip');
111
  save_message_viewed();
112
  });
113
 
122
  }
123
 
124
  function save_message_viewed() {
125
+ if (!is_viewed) {
126
+ messages_viewed.push(message_hash);
127
  store.setItem('whatsappme_hashes', messages_viewed.join(','));
128
  is_viewed = true;
129
  }
public/js/whatsappme.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";function t(e,t,a){return(e?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(a||"")}e(function(){var a,s=e(".whatsappme"),n=s.find(".whatsappme__badge"),o=s.data("settings");try{localStorage.setItem("test",1),localStorage.removeItem("test"),a=localStorage}catch(e){a={_data:{},setItem:function(e,t){this._data[e]=String(t)},getItem:function(e){return this._data.hasOwnProperty(e)?this._data[e]:null}}}if(void 0===o)try{o=JSON.parse(s.attr("data-settings"))}catch(e){o=void 0}s.length&&o&&o.telephone&&function(){var i,p,c,l,m=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i),r=1e3*o.button_delay,h=""!==o.message_text,d=o.whatsapp_web&&!m,u=new Image;u.src="data:image/webp;base64,UklGRi4AAABXRUJQVlA4TCEAAAAvAUAAEB8wAiMwAgSSNtse/cXjxyCCmrYNWPwmHRH9jwMA",u.onload=u.onerror=function(){2!==u.height&&s.addClass("nowebp")};var g=(a.getItem("whatsappme_hashes")||"").split(",").filter(Boolean),w="yes"==a.getItem("whatsappme_visited");h&&(i=function(e){for(var t=0,a=1;t<e.length;t++)a=Math.imul(a+e.charCodeAt(t)|0,2654435761);return(a^a>>>17)>>>0}(o.message_text).toString(),p=g.indexOf(i)>-1);a.setItem("whatsappme_visited","yes"),(!o.mobile_only||m)&&(setTimeout(function(){s.addClass("whatsappme--show")},r),h&&!p&&(o.message_badge?l=setTimeout(function(){n.addClass("whatsappme__badge--in")},r+1e3*o.message_delay):w&&(l=setTimeout(function(){s.addClass("whatsappme--dialog")},r+1e3*o.message_delay))));h&&!m&&e(".whatsappme__button",s).mouseenter(function(){c=setTimeout(f,1500)}).mouseleave(function(){clearTimeout(c)});function f(){s.addClass("whatsappme--dialog"),clearTimeout(l),o.message_badge&&n.hasClass("whatsappme__badge--in")&&(n.removeClass("whatsappme__badge--in").addClass("whatsappme__badge--out"),_())}function _(){h&&!p&&(g.push(i),a.setItem("whatsappme_hashes",g.join(",")),p=!0)}e(".whatsappme__button",s).click(function(){if(h&&!s.hasClass("whatsappme--dialog"))f();else{var a={link:t(d,o.telephone,o.message_send)},n=new RegExp("^https?://(wa.me|(api|web|chat).whatsapp.com|"+location.hostname.replace(".",".")+")/.*","i");s.removeClass("whatsappme--dialog"),_(),e(document).trigger("whatsappme:open",[a,o]),n.test(a.link)?(!function(e){"object"==typeof dataLayer&&dataLayer.push({event:"WhatsAppMe",eventAction:"click",eventLabel:e});if("function"==typeof gtag)gtag("event","click",{event_category:"WhatsAppMe",event_label:e,transport_type:"beacon"});else if("function"==typeof ga&&"function"==typeof ga.getAll){ga("set","transport","beacon");var t=ga.getAll();t.forEach(function(t){t.send("event","WhatsAppMe","click",e)})}"function"==typeof fbq&&fbq("trackCustom","WhatsAppMe",{eventAction:"click",eventLabel:e})}(a.link),window.open(a.link,"whatsappme")):console.error("WAme: the link doesn't seem safe, it must point to the current domain or whatsapp.com")}}),e(".whatsappme__close",s).click(function(){s.removeClass("whatsappme--dialog"),_()})}()}),Math.imul=Math.imul||function(e,t){var a=65535&e,s=65535&t;return a*s+((e>>>16&65535)*s+a*(t>>>16&65535)<<16>>>0)|0}}(jQuery);
1
+ !function(e){"use strict";function t(e,t,a){return(e?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(a||"")}e(function(){var a,s=e(".whatsappme"),n=s.find(".whatsappme__badge"),o=s.data("settings");try{localStorage.setItem("test",1),localStorage.removeItem("test"),a=localStorage}catch(e){a={_data:{},setItem:function(e,t){this._data[e]=String(t)},getItem:function(e){return this._data.hasOwnProperty(e)?this._data[e]:null}}}if(void 0===o)try{o=JSON.parse(s.attr("data-settings"))}catch(e){o=void 0}s.length&&o&&o.telephone&&function(){var i,p,m=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i),c=1e3*o.button_delay,l=1e3*o.message_delay,h=""!==o.message_text,r=o.whatsapp_web&&!m,d=new Image;d.src="data:image/webp;base64,UklGRi4AAABXRUJQVlA4TCEAAAAvAUAAEB8wAiMwAgSSNtse/cXjxyCCmrYNWPwmHRH9jwMA",d.onload=d.onerror=function(){2!==d.height&&s.addClass("nowebp")};var u=(a.getItem("whatsappme_hashes")||"").split(",").filter(Boolean),g="yes"==a.getItem("whatsappme_visited"),w=h?function(e){for(var t=0,a=1;t<e.length;t++)a=Math.imul(a+e.charCodeAt(t)|0,2654435761);return(a^a>>>17)>>>0}(o.message_text).toString():"no_cta",f=u.indexOf(w)>-1;if(a.setItem("whatsappme_visited","yes"),!o.mobile_only||m){var _="whatsappme--show";f||h&&l&&!o.message_badge&&g||(_+=" whatsappme--tooltip"),setTimeout(function(){s.addClass(_)},c),h&&!f&&l&&(o.message_badge?p=setTimeout(function(){n.addClass("whatsappme__badge--in")},c+l):g&&(p=setTimeout(v,c+l)))}h&&!m&&e(".whatsappme__button",s).mouseenter(function(){i=setTimeout(v,1500)}).mouseleave(function(){clearTimeout(i)});function v(){s.addClass("whatsappme--dialog"),clearTimeout(p),o.message_badge&&n.hasClass("whatsappme__badge--in")&&(n.removeClass("whatsappme__badge--in").addClass("whatsappme__badge--out"),b())}function b(){f||(u.push(w),a.setItem("whatsappme_hashes",u.join(",")),f=!0)}e(".whatsappme__button",s).click(function(){if(h&&!s.hasClass("whatsappme--dialog"))v();else{var a={link:t(r,o.telephone,o.message_send)},n=new RegExp("^https?://(wa.me|(api|web|chat).whatsapp.com|"+location.hostname.replace(".",".")+")/.*","i");s.removeClass("whatsappme--dialog whatsappme--tooltip"),b(),e(document).trigger("whatsappme:open",[a,o]),n.test(a.link)?(!function(e){"object"==typeof dataLayer&&dataLayer.push({event:"WhatsAppMe",eventAction:"click",eventLabel:e});if("function"==typeof gtag)gtag("event","click",{event_category:"WhatsAppMe",event_label:e,transport_type:"beacon"});else if("function"==typeof ga&&"function"==typeof ga.getAll){ga("set","transport","beacon");var t=ga.getAll();t.forEach(function(t){t.send("event","WhatsAppMe","click",e)})}"function"==typeof fbq&&fbq("trackCustom","WhatsAppMe",{eventAction:"click",eventLabel:e})}(a.link),window.open(a.link,"whatsappme")):console.error("WAme: the link doesn't seem safe, it must point to the current domain or whatsapp.com")}}),e(".whatsappme__close",s).click(function(){s.removeClass("whatsappme--dialog whatsappme--tooltip"),b()})}()}),Math.imul=Math.imul||function(e,t){var a=65535&e,s=65535&t;return a*s+((e>>>16&65535)*s+a*(t>>>16&65535)<<16>>>0)|0}}(jQuery);
whatsappme.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: WAme chat
10
  * Plugin URI: https://wame.chat
11
  * Description: Connect a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
12
- * Version: 3.0.3
13
  * Author: Creame
14
  * Author URI: https://crea.me
15
  * License: GPL-2.0+
@@ -27,7 +27,7 @@ if ( ! defined( 'WPINC' ) ) {
27
  * Currently plugin version.
28
  * Start at version 1.0.0 and use SemVer - https://semver.org
29
  */
30
- define( 'WHATSAPPME_VERSION', '3.0.3' );
31
 
32
  /**
33
  * The core plugin class that is used to define internationalization,
9
  * Plugin Name: WAme chat
10
  * Plugin URI: https://wame.chat
11
  * Description: Connect a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
12
+ * Version: 3.1.0
13
  * Author: Creame
14
  * Author URI: https://crea.me
15
  * License: GPL-2.0+
27
  * Currently plugin version.
28
  * Start at version 1.0.0 and use SemVer - https://semver.org
29
  */
30
+ define( 'WHATSAPPME_VERSION', '3.1.0' );
31
 
32
  /**
33
  * The core plugin class that is used to define internationalization,