WhatsApp me - Version 2.3.0

Version Description

  • NEW: WPML/Polylang integration.
  • NEW: Added setting to launch WhatsApp Web on desktop.
  • NEW: Separated button delay and chat delay settings.
  • NEW: dynamic variables {SITE}, {URL} and {TITLE} now also works on Call To Action.
  • CHANGED Better ordered settings panel.
  • FIX incorrect post id on loops can return post config instead main config.
  • FIX typo error on filter "whatsappme_whastapp_web"
Download this release

Release Info

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

Code changes from version 2.2.3 to 2.3.0

README.txt CHANGED
@@ -1,42 +1,63 @@
1
  === WhatsApp me ===
2
  Contributors: creapuntome, pacotole, davidlillo
3
  Donate link: https://www.paypal.me/creapuntome/
4
- Tags: whatsapp, button, chat, support, contact, click to chat, directly message whatsapp, floating whatsapp, whatsapp chat, whatsapp support, whatsapp business, wame chat, messaging, help desk
5
  Requires at least: 3.0.1
6
- Tested up to: 5.1
7
  Requires PHP: 5.3
8
- Stable tag: 2.2.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- Add support to your visitors directly with WhatsApp.
13
 
14
  == Description ==
15
 
16
- ### The perfect plugin to engage and retain customers. Support for ecommerce and online stores. Your clients will love it. Analytics integration.
17
 
18
- #### Communication with your customers can be very easy
19
 
20
- With **WhatsApp me** you will get the visitors of your website to contact you through WhatsApp with a single click.
21
 
22
- #### Why WhatsApp?
23
- WhatsApp is used in more than 100 countries and supports more than 50 languages. Recent surveys say that 96% of users prefer to use a *messaging app* before calling by phone. If none of this has convinced you, think one thing, your grandmother knows how to use WhatsApp. Do not lose more customers and sales. Try **WhatsApp me**.
24
 
25
- Options:
 
26
 
27
- **[NEW!!]** Now support specific phone number on every post, page or custom post, to provide a successful contact to the different support agents of your organization.
 
28
 
29
- 1. Phone: Enter the phone number.
30
- 2. Mobile only: Select if you want the button to be visible only on mobile devices. WhatsApp Web/App will open on the desktop (if available).
31
- 3. Call to action: Write a message to encourage users to contact you through WhatsApp.
32
- 4. Delay: You can define a timeout to display the call-to-action message.
33
- 5. Badge: Show a button badge for a less intrusive mode.
34
- 6. Message: You can define the first message to send.
35
- 7. Advanced: configure on which pages you want to show or hide your WhatsApp button.
36
- 8. If you have Google Analytics, an event is triggered when the user launches WhatsApp.
37
- 9. Can override **phone number**, call to action, message or visibility on every post, page or custom post.
38
 
39
- More info, news and tricks in [wame.chat](https://wame.chat)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  == Installation ==
42
 
@@ -51,7 +72,9 @@ By default, WhatsApp me always opens api.whatsapp.com and try to launch the nati
51
 
52
  If you prefer always open WhatsApp Web on desktop you can add this code in your functions.php:
53
 
54
- `add_filter( 'whatsappme_whastapp_web', '__return_true' );`
 
 
55
 
56
  = I can't see the button or it's over / under another thing =
57
 
@@ -94,6 +117,15 @@ WhatsApp me send an event (if GTM detected) when user click to launch WhatsApp:
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
 
 
 
 
97
  = 2.2.3 =
98
  * **NEW:** Hide in front if editing with Elementor.
99
  * CHANGED improvements in public styles.
@@ -179,3 +211,11 @@ WhatsApp me send an event (if GTM detected) when user click to launch WhatsApp:
179
 
180
  = 1.0.0 =
181
  * First version
 
 
 
 
 
 
 
 
1
  === WhatsApp me ===
2
  Contributors: creapuntome, pacotole, davidlillo
3
  Donate link: https://www.paypal.me/creapuntome/
4
+ Tags: whatsapp business, whatsapp, click to chat, button, whatsapp support chat, support, contact, directly message whatsapp, floating whatsapp, whatsapp chat
5
  Requires at least: 3.0.1
6
+ Tested up to: 5.2
7
  Requires PHP: 5.3
8
+ Stable tag: 2.3.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ The perfect plugin to engage and retain customers. Support for ecommerce and online stores.
13
 
14
  == Description ==
15
 
16
+ [wame.chat](https://wame.chat) | [Chatbot demo (es)](https://wame.chat/es/wame-chatbot/) | [Plugin support](https://wordpress.org/support/plugin/creame-whatsapp-me/)
17
 
18
+ ### Connect a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
19
 
20
+ ### What you can do with WAme
21
 
22
+ #### 🛎 Insert a WhatsApp button on your website.
23
+ Define in which pages or zones it should appear, the delay time, if you want it to the right or to the left, only on mobile phones or also on the desktop.
24
 
25
+ #### 📱 Add multiple phone numbers.
26
+ You can serve users in different terminals, you can insert a different one in each page, product or section.
27
 
28
+ #### 🔴 Show a notification.
29
+ Use a balloon on the button to get the user's attention. In this way, you ensure that you do not miss any important message you want to give them, surprise them in a less intrusive way.
30
 
31
+ #### 📯 Create call-to-action messages.
32
+ For users to click on the button, use custom CTAs on each page, product or section. Welcome them, help them and offer them offers or promotions. [You can read more about this topic here](https://wame.chat/es/whatsapp-me-mucho-mas-que-un-click-to-chat/).
 
 
 
 
 
 
 
33
 
34
+ #### 💬 Customize conversation start messages.
35
+ So that the user does not waste time in writing. This way you will be able to know from which page it comes or what product is being consulted when you start the first conversation.
36
+
37
+ #### 🏁 Analyze the conversion data in Google Analytics.
38
+ Remember, you do not have to do anything, the plugin already creates and computes the events by itself. [You can read more about this topic here](https://wame.chat/es/wame-mide-los-eventos-de-whatsapp-en-google-analytics/).
39
+
40
+ #### 💱 Customize different languages.
41
+ To be able to support all your users, wherever they are. Our plugin is compatible with WPML and Polylang.
42
+
43
+ ### ⌁ What you can´t do with WAme ⛔️
44
+
45
+ #### 👨‍🎨 Modify the appearance of the button.
46
+ Users recognize it instantly because it is in thousands of web pages and they know what it is for, it generates trust. If you modify it, you lose these important values.
47
+
48
+ #### 😡 Wasting time configuring other similar plugins.
49
+ Having many options is not an advantage, the configuration of WAme is so easy that in less than 2 minutes you will be ‘wasapeando’ with your clients.
50
+
51
+ ### ⌁ Translations 🇦🇶
52
+ -[English (US)](https://wordpress.org/plugins/creame-whatsapp-me/)
53
+ -[Portuguese (Brazil)](https://br.wordpress.org/plugins/creame-whatsapp-me/)
54
+ -[Spanish (Spain)](https://es.wordpress.org/plugins/creame-whatsapp-me/)
55
+ -[Translate into your language](https://translate.wordpress.org/projects/wp-plugins/creame-whatsapp-me)
56
+
57
+ ### ⌁ If you like WAme 😍
58
+ 1. Subscribe to [our newsletter and our blog].(https://wame.chat/blog/)
59
+ 2. Learn from our tutorials on [Youtube Channel].(https://www.youtube.com/channel/UCqHiSNPBaQ918fpVnCU1wog/)
60
+ 3. Or rate us [on WordPress].(https://wordpress.org/support/plugin/creame-whatsapp-me/reviews/?filter=5/#new-post)
61
 
62
  == Installation ==
63
 
72
 
73
  If you prefer always open WhatsApp Web on desktop you can add this code in your functions.php:
74
 
75
+ `add_filter( 'whatsappme_whatsapp_web', '__return_true' );`
76
+
77
+ **Note:** From version 2.3.0 you can mark an option to open WhatsApp Web.
78
 
79
  = I can't see the button or it's over / under another thing =
80
 
117
 
118
  == Changelog ==
119
 
120
+ = 2.3.0 =
121
+ * **NEW:** WPML/Polylang integration.
122
+ * **NEW:** Added setting to launch WhatsApp Web on desktop.
123
+ * **NEW:** Separated button delay and chat delay settings.
124
+ * **NEW:** dynamic variables {SITE}, {URL} and {TITLE} now also works on Call To Action.
125
+ * CHANGED Better ordered settings panel.
126
+ * FIX incorrect post id on loops can return post config instead main config.
127
+ * FIX typo error on filter "whatsappme_whastapp_web"
128
+
129
  = 2.2.3 =
130
  * **NEW:** Hide in front if editing with Elementor.
131
  * CHANGED improvements in public styles.
211
 
212
  = 1.0.0 =
213
  * First version
214
+
215
+ == Upgrade Notice ==
216
+
217
+ = 2.3.0 =
218
+ WPML and Polylang integration.
219
+ Added new settings to control delay and launch WhatsApp Web on desktop.
220
+ Dynamic variables {SITE}, {URL} and {TITLE} now also works on Call To Action.
221
+ Fixed incorrect WAme post settings on loops.
admin/class-whatsappme-admin.php CHANGED
@@ -72,14 +72,17 @@ class WhatsAppMe_Admin {
72
  * @since 1.0.0
73
  * @since 2.0.0 Added visibility setting
74
  * @since 2.1.0 Added message_badge
 
75
  */
76
  private function get_settings() {
77
 
78
  $this->settings = array(
79
  'telephone' => '',
80
  'mobile_only' => 'no',
 
 
81
  'message_text' => '',
82
- 'message_delay' => 10000,
83
  'message_badge' => 'no',
84
  'message_send' => '',
85
  'position' => 'right',
@@ -93,6 +96,10 @@ class WhatsAppMe_Admin {
93
  $saved_settings = array_intersect_key( $saved_settings, $this->settings );
94
  // merge defaults with saved settings
95
  $this->settings = array_merge( $this->settings, $saved_settings );
 
 
 
 
96
  }
97
 
98
  }
@@ -146,6 +153,7 @@ class WhatsAppMe_Admin {
146
  *
147
  * @since 1.0.0
148
  * @since 2.0.0 Added tabs for general and Advanced settings
 
149
  * @access public
150
  * @return void
151
  */
@@ -159,18 +167,31 @@ class WhatsAppMe_Admin {
159
 
160
  add_settings_section( 'whatsappme_section_general', null, array( $this, 'section_text' ), 'whatsappme' );
161
 
162
- $general_fields = array(
163
- 'telephone' => __( 'Telephone', 'creame-whatsapp-me' ),
164
- 'mobile_only' => __( 'Mobile only', 'creame-whatsapp-me' ),
165
- 'message_text' => __( 'Call to action', 'creame-whatsapp-me' ),
166
- 'message_delay' => __( 'Delay', 'creame-whatsapp-me' ),
167
- 'message_badge' => __( 'Button Badge', 'creame-whatsapp-me' ),
168
- 'message_send' => __( 'Message', 'creame-whatsapp-me' ),
169
- 'position' => __( 'Position on screen', 'creame-whatsapp-me' ),
170
  );
171
 
172
- foreach ( $general_fields as $key => $value ) {
173
- add_settings_field( 'whatsappme_' . $key, $value, array( $this, 'field_' . $key ), 'whatsappme', 'whatsappme_section_general' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
 
176
  /*
@@ -269,13 +290,16 @@ class WhatsAppMe_Admin {
269
  * @since 1.0.0
270
  * @since 2.0.0 Added visibility setting
271
  * @since 2.1.0 Added message_badge
 
272
  * @param array $input contain keys 'id', 'title' and 'callback'.
273
  * @return array
274
  */
275
  public function settings_validate($input) {
276
 
277
- $input['mobile_only'] = isset( $input['mobile_only'] ) ? 'yes' : 'no';
278
  $input['telephone'] = $this->clean_input( $input['telephone'] );
 
 
 
279
  $input['message_text'] = $this->clean_input( $input['message_text'] );
280
  $input['message_delay'] = intval( $input['message_delay'] );
281
  $input['message_badge'] = isset( $input['message_badge'] ) ? 'yes' : 'no';
@@ -286,6 +310,16 @@ class WhatsAppMe_Admin {
286
  unset( $input['view'] );
287
  }
288
 
 
 
 
 
 
 
 
 
 
 
289
  add_settings_error( 'whatsappme', 'settings_updated', __( 'Settings saved', 'creame-whatsapp-me' ), 'updated' );
290
 
291
  return $input;
@@ -307,12 +341,26 @@ class WhatsAppMe_Admin {
307
  '<a href="#tab-advanced" class="nav-tab">' . __( 'Advanced', 'creame-whatsapp-me' ) . '</a>' .
308
  '</h2>' .
309
  '<div class="tabs">' .
310
- '<div id="tab-general" class="tab tab-active">' .
311
- '<p>' . __( 'From here you can configure the behavior of the WhatsApp button on your site.', 'creame-whatsapp-me' ) . '</p>';
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  break;
313
 
314
  case 'whatsappme_section_advanced_all':
315
  echo '</div><div id="tab-advanced" class="tab">' .
 
316
  '<p>' . __( 'From here you can configure on which pages the WhatsApp button will be visible.', 'creame-whatsapp-me' ) .
317
  ' <a href="#" class="whatsappme_view_reset">' . __( 'Restore default visibility', 'creame-whatsapp-me' ) . '</a></p>';
318
  break;
@@ -338,7 +386,7 @@ class WhatsAppMe_Admin {
338
  */
339
  public function field_telephone() {
340
  echo '<input id="whatsappme_phone" ' . ( $this->enhanced_phone ? 'data-' : '') . 'name="whatsappme[telephone]" value="' . $this->settings['telephone'] . '" type="text" style="width:15em">' .
341
- '<p class="description">' . __( "Contact phone number. <strong>The button will not be shown if it's empty.</strong>", 'creame-whatsapp-me' ) . '</p>';
342
  }
343
 
344
  /**
@@ -348,9 +396,8 @@ class WhatsAppMe_Admin {
348
  * @return void
349
  */
350
  public function field_message_text() {
351
- echo '<textarea name="whatsappme[message_text]" rows="3" class="regular-text" placeholder="' . esc_attr__( "Hello 👋\nCan we help you?", 'creame-whatsapp-me' ) . '">' . $this->settings['message_text'] . '</textarea>' .
352
- '<p class="description">' . __( '<strong>Optional.</strong> Text to invite the user to use the contact via WhatsApp.', 'creame-whatsapp-me' ) . '</p>' .
353
- '<p>' . __( 'You can use formatting styles like in WhatsApp: _<em>italic</em>_ *<strong>bold</strong>* ~<del>strikethrough</del>~', 'creame-whatsapp-me' ) . '</p>';
354
  }
355
 
356
  /**
@@ -360,8 +407,8 @@ class WhatsAppMe_Admin {
360
  * @return void
361
  */
362
  public function field_message_delay() {
363
- echo '<input name="whatsappme[message_delay]" value="' . $this->settings['message_delay'] . '" type="number" min="0" style="width:6em"> ' . __( 'milliseconds', 'creame-whatsapp-me' ) .
364
- '<p class="description"> ' . __( 'The <strong>Call to action</strong> will be automatically displayed once when the user exceeds the estimated delay on a page.', 'creame-whatsapp-me' ) . '</p>';
365
  }
366
 
367
  /**
@@ -371,9 +418,9 @@ class WhatsAppMe_Admin {
371
  * @return void
372
  */
373
  public function field_message_badge() {
374
- echo '<fieldset><legend class="screen-reader-text"><span>' . __( 'Button Badge', 'creame-whatsapp-me' ) . '</span></legend>' .
375
  '<label><input name="whatsappme[message_badge]" value="yes" type="checkbox"' . checked( 'yes', $this->settings['message_badge'], false ) . '> ' .
376
- __('Display a button badge instead of opening the <strong>Call to action</strong> for a "less intrusive" mode', 'creame-whatsapp-me' ) . '</label></fieldset>';
377
  }
378
 
379
  /**
@@ -383,9 +430,8 @@ class WhatsAppMe_Admin {
383
  * @return void
384
  */
385
  public function field_message_send() {
386
- echo '<textarea name="whatsappme[message_send]" rows="3" class="regular-text" placeholder="' . esc_attr__( "Hi {SITE}! I need more info about {TITLE}", 'creame-whatsapp-me' ) . '">' . $this->settings['message_send'] . '</textarea>' .
387
- '<p class="description">' . __( '<strong>Optional.</strong> Default message to start the conversation.', 'creame-whatsapp-me' ) . '</p>' .
388
- '<p>' . __( 'You can use vars <code>{SITE} {URL} {TITLE}</code> that will be replaced with the values of the current page.', 'creame-whatsapp-me' ) . '</p>';
389
  }
390
 
391
  /**
@@ -395,11 +441,22 @@ class WhatsAppMe_Admin {
395
  * @return void
396
  */
397
  public function field_mobile_only() {
398
- echo '<fieldset><legend class="screen-reader-text"><span>' . __( 'Mobile only', 'creame-whatsapp-me' ) . '</span></legend>' .
399
- '<label><input name="whatsappme[mobile_only]" value="yes" type="checkbox"' . checked( 'yes', $this->settings['mobile_only'], false ) . '> ' .
400
  __('Only display the button on mobile devices', 'creame-whatsapp-me' ) . '</label></fieldset>';
401
  }
402
 
 
 
 
 
 
 
 
 
 
 
 
403
  /**
404
  * Field 'position' output
405
  *
@@ -407,11 +464,23 @@ class WhatsAppMe_Admin {
407
  * @return void
408
  */
409
  public function field_position() {
410
- echo '<fieldset><legend class="screen-reader-text"><span>' . __( 'Position on screen', 'creame-whatsapp-me' ) . '</span></legend>' .
411
- '<p><label><input name="whatsappme[position]" value="right" type="radio"' . checked( 'right', $this->settings['position'], false ) . '> ' .
412
- __('Right', 'creame-whatsapp-me' ) . '</label>' .
413
- '<br><label><input name="whatsappme[position]" value="left" type="radio"' . checked( 'left', $this->settings['position'], false ) . '> ' .
414
- __('Left', 'creame-whatsapp-me' ) . '</label></p></fieldset>';
 
 
 
 
 
 
 
 
 
 
 
 
415
  }
416
 
417
  /**
@@ -581,7 +650,7 @@ class WhatsAppMe_Admin {
581
  <input id="whatsappme_phone" <?php echo $this->enhanced_phone ? 'data-' : ''; ?>name="whatsappme_telephone" value="<?php echo $metadata['telephone']; ?>" type="text">
582
  </p>
583
  <p>
584
- <label for="whatsappme_message"><?php _e( 'Call to action', 'creame-whatsapp-me' ); ?></label><br>
585
  <textarea name="whatsappme_message" rows="2" class="large-text"><?php echo $metadata['message_text']; ?></textarea>
586
  </p>
587
  <p>
72
  * @since 1.0.0
73
  * @since 2.0.0 Added visibility setting
74
  * @since 2.1.0 Added message_badge
75
+ * @since 2.3.0 Added button_delay and whatsapp_web settings, message_delay in seconds
76
  */
77
  private function get_settings() {
78
 
79
  $this->settings = array(
80
  'telephone' => '',
81
  'mobile_only' => 'no',
82
+ 'button_delay' => 3,
83
+ 'whatsapp_web' => 'no',
84
  'message_text' => '',
85
+ 'message_delay' => 10,
86
  'message_badge' => 'no',
87
  'message_send' => '',
88
  'position' => 'right',
96
  $saved_settings = array_intersect_key( $saved_settings, $this->settings );
97
  // merge defaults with saved settings
98
  $this->settings = array_merge( $this->settings, $saved_settings );
99
+ // miliseconds (<v2.3) to seconds
100
+ if ( $this->settings['message_delay'] > 120 ) {
101
+ $this->settings['message_delay'] = round( $this->settings['message_delay'] / 1000 );
102
+ }
103
  }
104
 
105
  }
153
  *
154
  * @since 1.0.0
155
  * @since 2.0.0 Added tabs for general and Advanced settings
156
+ * @since 2.3.0 Split general settings in Button and Window Chat
157
  * @access public
158
  * @return void
159
  */
167
 
168
  add_settings_section( 'whatsappme_section_general', null, array( $this, 'section_text' ), 'whatsappme' );
169
 
170
+ $button_fields = array(
171
+ 'telephone' => '<label for="whatsappme_phone">' . __( 'Telephone', 'creame-whatsapp-me' ) . '</label>',
172
+ 'mobile_only' => __( 'Mobile Only', 'creame-whatsapp-me' ),
173
+ 'position' => __( 'Position On Screen', 'creame-whatsapp-me' ),
174
+ 'button_delay' => '<label for="whatsappme_button_delay">' . __( 'Button Delay', 'creame-whatsapp-me' ) . '</label>',
175
+ 'whatsapp_web' => __( 'WhatsApp Web', 'creame-whatsapp-me' ),
 
 
176
  );
177
 
178
+ add_settings_section( 'whatsappme_section_general_btn', null, array( $this, 'section_text' ), 'whatsappme' );
179
+
180
+ foreach ( $button_fields as $key => $value ) {
181
+ add_settings_field( 'whatsappme_' . $key, $value, array( $this, 'field_' . $key ), 'whatsappme', 'whatsappme_section_general_btn' );
182
+ }
183
+
184
+ $chat_fields = array(
185
+ 'message_text' => '<label for="whatsappme_message_text">' . __( 'Call To Action', 'creame-whatsapp-me' ) . '</label>',
186
+ 'message_send' => '<label for="whatsappme_message_send">' . __( 'Message', 'creame-whatsapp-me' ) . '</label>',
187
+ 'message_delay' => '<label for="whatsappme_message_delay">' . __( 'Chat Delay', 'creame-whatsapp-me' ) . '</label>',
188
+ 'message_badge' => __( 'Hide Chat', 'creame-whatsapp-me' ),
189
+ );
190
+
191
+ add_settings_section( 'whatsappme_section_general_cta', null, array( $this, 'section_text' ), 'whatsappme' );
192
+
193
+ foreach ( $chat_fields as $key => $value ) {
194
+ add_settings_field( 'whatsappme_' . $key, $value, array( $this, 'field_' . $key ), 'whatsappme', 'whatsappme_section_general_cta' );
195
  }
196
 
197
  /*
290
  * @since 1.0.0
291
  * @since 2.0.0 Added visibility setting
292
  * @since 2.1.0 Added message_badge
293
+ * @since 2.3.0 Added button_delay and whatsapp_web settings, WPML integration
294
  * @param array $input contain keys 'id', 'title' and 'callback'.
295
  * @return array
296
  */
297
  public function settings_validate($input) {
298
 
 
299
  $input['telephone'] = $this->clean_input( $input['telephone'] );
300
+ $input['mobile_only'] = isset( $input['mobile_only'] ) ? 'yes' : 'no';
301
+ $input['button_delay'] = intval( $input['button_delay'] );
302
+ $input['whatsapp_web'] = isset( $input['whatsapp_web'] ) ? 'yes' : 'no';
303
  $input['message_text'] = $this->clean_input( $input['message_text'] );
304
  $input['message_delay'] = intval( $input['message_delay'] );
305
  $input['message_badge'] = isset( $input['message_badge'] ) ? 'yes' : 'no';
310
  unset( $input['view'] );
311
  }
312
 
313
+ /**
314
+ * Register WPML/Polylang strings for translation
315
+ * https://wpml.org/wpml-hook/wpml_register_single_string/
316
+ *
317
+ * Note: don't translate string $name to prevent missing translations if
318
+ * public front lang is different of admin lang
319
+ */
320
+ do_action( 'wpml_register_single_string', 'WhatsApp me', 'Call To Action', $input['message_text'] );
321
+ do_action( 'wpml_register_single_string', 'WhatsApp me', 'Message', $input['message_send'] );
322
+
323
  add_settings_error( 'whatsappme', 'settings_updated', __( 'Settings saved', 'creame-whatsapp-me' ), 'updated' );
324
 
325
  return $input;
341
  '<a href="#tab-advanced" class="nav-tab">' . __( 'Advanced', 'creame-whatsapp-me' ) . '</a>' .
342
  '</h2>' .
343
  '<div class="tabs">' .
344
+ '<div id="tab-general" class="tab tab-active">';
345
+ break;
346
+
347
+ case 'whatsappme_section_general_btn':
348
+ echo '<h2 class="title">' . __( 'Button', 'creame-whatsapp-me' ) . '</h2>' .
349
+ '<p>' . __( 'Set the contact number and where you want the WhatsApp button to be displayed.', 'creame-whatsapp-me' ) . '</p>';
350
+ break;
351
+
352
+ case 'whatsappme_section_general_cta':
353
+ echo '<h2 class="title">' . __( 'Chat Window', 'creame-whatsapp-me' ) . '</h2>' .
354
+ '<p>' .
355
+ __( 'Set the behavior of the chat window.', 'creame-whatsapp-me' ) . ' ' .
356
+ __( "You can use the dynamic variables <code>{SITE}</code>, <code>{URL}</code> and <code>{TITLE}</code> which will be replaced by the values of the user's current page.", 'creame-whatsapp-me' ) . ' ' .
357
+ __( 'You can also use formatting styles like in WhatsApp: _<em>italic</em>_ *<strong>bold</strong>* ~<del>strikethrough</del>~.', 'creame-whatsapp-me' ) .
358
+ '</p>';
359
  break;
360
 
361
  case 'whatsappme_section_advanced_all':
362
  echo '</div><div id="tab-advanced" class="tab">' .
363
+ '<h2 class="title">' . __( 'Advanced Visibility Settings', 'creame-whatsapp-me' ) . '</h2>' .
364
  '<p>' . __( 'From here you can configure on which pages the WhatsApp button will be visible.', 'creame-whatsapp-me' ) .
365
  ' <a href="#" class="whatsappme_view_reset">' . __( 'Restore default visibility', 'creame-whatsapp-me' ) . '</a></p>';
366
  break;
386
  */
387
  public function field_telephone() {
388
  echo '<input id="whatsappme_phone" ' . ( $this->enhanced_phone ? 'data-' : '') . 'name="whatsappme[telephone]" value="' . $this->settings['telephone'] . '" type="text" style="width:15em">' .
389
+ '<p class="description">' . __( "Contact phone number <strong>(the button will not be shown if it's empty)</strong>", 'creame-whatsapp-me' ) . '</p>';
390
  }
391
 
392
  /**
396
  * @return void
397
  */
398
  public function field_message_text() {
399
+ echo '<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' ) . '">' . $this->settings['message_text'] . '</textarea>' .
400
+ '<p class="description">' . __( 'Define a text to encourage users to contact by WhatsApp <strong>(optional)</strong>', 'creame-whatsapp-me' ) . '</p>';
 
401
  }
402
 
403
  /**
407
  * @return void
408
  */
409
  public function field_message_delay() {
410
+ echo '<input id="whatsappme_message_delay" name="whatsappme[message_delay]" value="' . $this->settings['message_delay'] . '" type="number" min="0" max="120" style="width:5em"> ' . __( 'seconds', 'creame-whatsapp-me' ) .
411
+ '<p class="description">' . __( 'Time since the the WhatsApp button is displayed until the Chat Window opens', 'creame-whatsapp-me' ) . '</p>';
412
  }
413
 
414
  /**
418
  * @return void
419
  */
420
  public function field_message_badge() {
421
+ echo '<fieldset><legend class="screen-reader-text"><span>' . __( 'Hide Chat', 'creame-whatsapp-me' ) . '</span></legend>' .
422
  '<label><input name="whatsappme[message_badge]" value="yes" type="checkbox"' . checked( 'yes', $this->settings['message_badge'], false ) . '> ' .
423
+ __('Display a notification balloon instead of opening the Chat Window for a "less intrusive" mode', 'creame-whatsapp-me' ) . '</label></fieldset>';
424
  }
425
 
426
  /**
430
  * @return void
431
  */
432
  public function field_message_send() {
433
+ echo '<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' ) . '">' . $this->settings['message_send'] . '</textarea>' .
434
+ '<p class="description">' . __( 'Predefined text with which user can start the conversation <strong>(optional)</strong>', 'creame-whatsapp-me' ) . '</p>';
 
435
  }
436
 
437
  /**
441
  * @return void
442
  */
443
  public function field_mobile_only() {
444
+ echo '<fieldset><legend class="screen-reader-text"><span>' . __( 'Mobile Only', 'creame-whatsapp-me' ) . '</span></legend>' .
445
+ '<label><input id="whatsappme_mobile_only" name="whatsappme[mobile_only]" value="yes" type="checkbox"' . checked( 'yes', $this->settings['mobile_only'], false ) . '> ' .
446
  __('Only display the button on mobile devices', 'creame-whatsapp-me' ) . '</label></fieldset>';
447
  }
448
 
449
+ /**
450
+ * Field 'button_delay' output
451
+ *
452
+ * @since 2.3.0
453
+ * @return void
454
+ */
455
+ public function field_button_delay() {
456
+ echo '<input id="whatsappme_button_delay" name="whatsappme[button_delay]" value="' . $this->settings['button_delay'] . '" type="number" min="0" max="120" style="width:5em"> ' . __( 'seconds', 'creame-whatsapp-me' ) .
457
+ '<p class="description">' . __( 'Time since the page is opened until the WhatsApp button is displayed', 'creame-whatsapp-me' ) . '</p>';
458
+ }
459
+
460
  /**
461
  * Field 'position' output
462
  *
464
  * @return void
465
  */
466
  public function field_position() {
467
+ echo '<fieldset><legend class="screen-reader-text"><span>' . __( 'Position On Screen', 'creame-whatsapp-me' ) . '</span></legend>' .
468
+ '<label><input name="whatsappme[position]" value="left" type="radio"' . checked( 'left', $this->settings['position'], false ) . '> ' .
469
+ __('Left', 'creame-whatsapp-me' ) . '</label><br>' .
470
+ '<label><input name="whatsappme[position]" value="right" type="radio"' . checked( 'right', $this->settings['position'], false ) . '> ' .
471
+ __('Right', 'creame-whatsapp-me' ) . '</label></fieldset>';
472
+ }
473
+
474
+ /**
475
+ * Field 'whatsapp_web' output
476
+ *
477
+ * @since 2.3.0
478
+ * @return void
479
+ */
480
+ public function field_whatsapp_web() {
481
+ echo '<fieldset><legend class="screen-reader-text"><span>' . __( 'WhatsApp Web', 'creame-whatsapp-me' ) . '</span></legend>' .
482
+ '<label><input id="whatsappme_whatsapp_web" name="whatsappme[whatsapp_web]" value="yes" type="checkbox"' . checked( 'yes', $this->settings['whatsapp_web'], false ) . '> ' .
483
+ __('Open <em>WhatsApp Web</em> directly on desktop', 'creame-whatsapp-me' ) . '</label></fieldset>';
484
  }
485
 
486
  /**
650
  <input id="whatsappme_phone" <?php echo $this->enhanced_phone ? 'data-' : ''; ?>name="whatsappme_telephone" value="<?php echo $metadata['telephone']; ?>" type="text">
651
  </p>
652
  <p>
653
+ <label for="whatsappme_message"><?php _e( 'Call To Action', 'creame-whatsapp-me' ); ?></label><br>
654
  <textarea name="whatsappme_message" rows="2" class="large-text"><?php echo $metadata['message_text']; ?></textarea>
655
  </p>
656
  <p>
admin/js/whatsappme.js CHANGED
@@ -65,6 +65,10 @@
65
  $($tab.attr('href')).addClass('tab-active');
66
  });
67
 
 
 
 
 
68
  var $tab_advanced = $('#tab-advanced');
69
  var inheritance = {
70
  'all': ['front_page', 'blog_page', '404_page', 'search', 'archive', 'singular', 'woocommerce', 'cpts'],
65
  $($tab.attr('href')).addClass('tab-active');
66
  });
67
 
68
+ $('#whatsappme_mobile_only').change(function () {
69
+ $('#whatsappme_whatsapp_web').closest('tr').toggleClass('hide-if-js', this.checked);
70
+ }).change();
71
+
72
  var $tab_advanced = $('#tab-advanced');
73
  var inheritance = {
74
  'all': ['front_page', 'blog_page', '404_page', 'search', 'archive', 'singular', 'woocommerce', 'cpts'],
admin/js/whatsappme.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";e(function(){if("function"==typeof intlTelInput){var t=JSON.parse(localStorage.whatsappme_country_code||"{}"),a=!(!t.code||t.date!=(new Date).toDateString())&&t.code,n=e("#whatsappme_phone"),i=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/15.0.1/js/utils.js"});n.on("keyup change",function(){n.css("border-color",""),i.hiddenInput.value=i.getNumber()}),n.on("blur",function(){n.css("border-color",n.val().trim()&&!i.isValidNumber()?"#ff0000":"")})}function o(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 s){var n=e('input[name="whatsappme[view]['+t+']"]:checked').val();n=""===n?a:n,e.each(s[t],function(){o(this,n)})}}if(1===e("#whatsappme_form").length){e(".nav-tab").click(function(t){var a=e(this);t.preventDefault(),e(".nav-tab").removeClass("nav-tab-active"),a.addClass("nav-tab-active").blur(),e(".tab").removeClass("tab-active"),e(a.attr("href")).addClass("tab-active")});var c=e("#tab-advanced"),s={all:["front_page","blog_page","404_page","search","archive","singular","woocommerce","cpts"],archive:["date","author"],singular:["page","post"],woocommerce:["product","cart","checkout","account_page"]};e("input",c).change(function(){o()}),e(".whatsappme_view_reset").click(function(t){t.preventDefault(),e('input[value=""]',c).prop("checked",!0),e(".whatsappme_view_all input",c).first().prop("checked",!0),o()}),o()}})}(jQuery);
1
+ !function(e){"use strict";e(function(){if("function"==typeof intlTelInput){var t=JSON.parse(localStorage.whatsappme_country_code||"{}"),a=!(!t.code||t.date!=(new Date).toDateString())&&t.code,n=e("#whatsappme_phone"),i=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/15.0.1/js/utils.js"});n.on("keyup change",function(){n.css("border-color",""),i.hiddenInput.value=i.getNumber()}),n.on("blur",function(){n.css("border-color",n.val().trim()&&!i.isValidNumber()?"#ff0000":"")})}function c(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 s){var n=e('input[name="whatsappme[view]['+t+']"]:checked').val();n=""===n?a:n,e.each(s[t],function(){c(this,n)})}}if(1===e("#whatsappme_form").length){e(".nav-tab").click(function(t){var a=e(this);t.preventDefault(),e(".nav-tab").removeClass("nav-tab-active"),a.addClass("nav-tab-active").blur(),e(".tab").removeClass("tab-active"),e(a.attr("href")).addClass("tab-active")}),e("#whatsappme_mobile_only").change(function(){e("#whatsappme_whatsapp_web").closest("tr").toggleClass("hide-if-js",this.checked)}).change();var o=e("#tab-advanced"),s={all:["front_page","blog_page","404_page","search","archive","singular","woocommerce","cpts"],archive:["date","author"],singular:["page","post"],woocommerce:["product","cart","checkout","account_page"]};e("input",o).change(function(){c()}),e(".whatsappme_view_reset").click(function(t){t.preventDefault(),e('input[value=""]',o).prop("checked",!0),e(".whatsappme_view_all input",o).first().prop("checked",!0),c()}),c()}})}(jQuery);
languages/creame-whatsapp-me.pot CHANGED
@@ -2,7 +2,7 @@
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WhatsApp Me\n"
5
- "POT-Creation-Date: 2018-09-13 08:06+0000\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"
@@ -14,245 +14,266 @@ msgstr ""
14
  "X-Textdomain-Support: yesX-Generator: Poedit 1.6.4\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
17
- "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_x:"
18
- "1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
19
  "X-Poedit-Basepath: ..\n"
20
- "Language: \n"
21
- "X-Generator: Loco https://localise.biz/\n"
22
- "X-Poedit-SearchPath-0: ."
23
 
24
- #: admin/class-whatsappme-admin.php:153
25
  msgid "Telephone"
26
  msgstr ""
27
 
28
- #: admin/class-whatsappme-admin.php:154 admin/class-whatsappme-admin.php:387
29
- msgid "Mobile only"
30
  msgstr ""
31
 
32
- #: admin/class-whatsappme-admin.php:155 admin/class-whatsappme-admin.php:551
33
- msgid "Call to action"
34
  msgstr ""
35
 
36
- #: admin/class-whatsappme-admin.php:156
37
- msgid "Delay"
38
  msgstr ""
39
 
40
- #: admin/class-whatsappme-admin.php:157 admin/class-whatsappme-admin.php:363
41
- msgid "Button Badge"
42
  msgstr ""
43
 
44
- #: admin/class-whatsappme-admin.php:158 admin/class-whatsappme-admin.php:555
 
 
 
 
45
  msgid "Message"
46
  msgstr ""
47
 
48
- #: admin/class-whatsappme-admin.php:159 admin/class-whatsappme-admin.php:399
49
- msgid "Position on screen"
50
  msgstr ""
51
 
52
- #: admin/class-whatsappme-admin.php:171
 
 
 
 
53
  msgid "Global"
54
  msgstr ""
55
 
56
- #: admin/class-whatsappme-admin.php:180
57
  msgid "Front Page"
58
  msgstr ""
59
 
60
- #: admin/class-whatsappme-admin.php:181
61
  msgid "Blog Page"
62
  msgstr ""
63
 
64
- #: admin/class-whatsappme-admin.php:182
65
  msgid "404 Page"
66
  msgstr ""
67
 
68
- #: admin/class-whatsappme-admin.php:183
69
  msgid "Search Results"
70
  msgstr ""
71
 
72
- #: admin/class-whatsappme-admin.php:184
73
  msgid "Archives"
74
  msgstr ""
75
 
76
- #: admin/class-whatsappme-admin.php:185
77
  msgid "Date Archives"
78
  msgstr ""
79
 
80
- #: admin/class-whatsappme-admin.php:186
81
  msgid "Author Archives"
82
  msgstr ""
83
 
84
- #: admin/class-whatsappme-admin.php:187
85
  msgid "Singular"
86
  msgstr ""
87
 
88
- #: admin/class-whatsappme-admin.php:188
89
  msgid "Page"
90
  msgstr ""
91
 
92
- #: admin/class-whatsappme-admin.php:189
93
  msgid "Post"
94
  msgstr ""
95
 
96
- #: admin/class-whatsappme-admin.php:210
97
  msgid "Shop"
98
  msgstr ""
99
 
100
- #: admin/class-whatsappme-admin.php:212
101
  msgid "Product Page"
102
  msgstr ""
103
 
104
- #: admin/class-whatsappme-admin.php:213
105
  msgid "Cart"
106
  msgstr ""
107
 
108
- #: admin/class-whatsappme-admin.php:214
109
  msgid "Checkout"
110
  msgstr ""
111
 
112
- #: admin/class-whatsappme-admin.php:215
113
  msgid "My Account"
114
  msgstr ""
115
 
116
- #: admin/class-whatsappme-admin.php:238
117
  msgid "Custom Post Types"
118
  msgstr ""
119
 
120
- #: admin/class-whatsappme-admin.php:277
121
  msgid "Settings saved"
122
  msgstr ""
123
 
124
- #: admin/class-whatsappme-admin.php:294
125
  msgid "General"
126
  msgstr ""
127
 
128
- #: admin/class-whatsappme-admin.php:295
129
  msgid "Advanced"
130
  msgstr ""
131
 
132
- #: admin/class-whatsappme-admin.php:299
 
 
 
 
133
  msgid ""
134
- "From here you can configure the behavior of the WhatsApp button on your site."
 
 
 
 
 
135
  msgstr ""
136
 
137
- #: admin/class-whatsappme-admin.php:304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  msgid ""
139
  "From here you can configure on which pages the WhatsApp button will be "
140
  "visible."
141
  msgstr ""
142
 
143
- #: admin/class-whatsappme-admin.php:305
144
  msgid "Restore default visibility"
145
  msgstr ""
146
 
147
- #: admin/class-whatsappme-admin.php:330
148
  msgid ""
149
- "Contact phone number. <strong>The button will not be shown if it's empty."
150
- "</strong>"
151
  msgstr ""
152
 
153
- #: admin/class-whatsappme-admin.php:340
154
  msgid ""
155
  "Hello 👋\n"
156
  "Can we help you?"
157
  msgstr ""
158
 
159
- #: admin/class-whatsappme-admin.php:341
160
  msgid ""
161
- "<strong>Optional.</strong> Text to invite the user to use the contact via "
162
- "WhatsApp."
163
  msgstr ""
164
 
165
- #: admin/class-whatsappme-admin.php:342
166
- msgid ""
167
- "You can use formatting styles like in WhatsApp: _<em>italic</em>_ *<strong>"
168
- "bold</strong>* ~<del>strikethrough</del>~"
169
  msgstr ""
170
 
171
- #: admin/class-whatsappme-admin.php:352
172
- msgid "milliseconds"
 
173
  msgstr ""
174
 
175
- #: admin/class-whatsappme-admin.php:353
176
  msgid ""
177
- "The <strong>Call to action</strong> will be automatically displayed once "
178
- "when the user exceeds the estimated delay on a page."
179
  msgstr ""
180
 
181
- #: admin/class-whatsappme-admin.php:365
182
- msgid ""
183
- "Display a button badge instead of opening the <strong>Call to action</strong>"
184
- " for a \"less intrusive\" mode"
185
  msgstr ""
186
 
187
- #: admin/class-whatsappme-admin.php:375
188
- msgid "Hi {SITE}! I need more info about {TITLE}"
 
 
189
  msgstr ""
190
 
191
- #: admin/class-whatsappme-admin.php:376
192
- msgid "<strong>Optional.</strong> Default message to start the conversation."
193
  msgstr ""
194
 
195
- #: admin/class-whatsappme-admin.php:377
196
- msgid ""
197
- "You can use vars <code>{SITE} {URL} {TITLE}</code> that will be replaced "
198
- "with the values of the current page."
199
  msgstr ""
200
 
201
- #: admin/class-whatsappme-admin.php:389
202
- msgid "Only display the button on mobile devices"
203
  msgstr ""
204
 
205
- #: admin/class-whatsappme-admin.php:401
206
  msgid "Right"
207
  msgstr ""
208
 
209
- #: admin/class-whatsappme-admin.php:403
210
- msgid "Left"
211
  msgstr ""
212
 
213
- #: admin/class-whatsappme-admin.php:420 admin/class-whatsappme-admin.php:437
214
- #: admin/class-whatsappme-admin.php:561
215
  msgid "Show"
216
  msgstr ""
217
 
218
- #: admin/class-whatsappme-admin.php:422 admin/class-whatsappme-admin.php:439
219
- #: admin/class-whatsappme-admin.php:563
220
  msgid "Hide"
221
  msgstr ""
222
 
223
- #: admin/class-whatsappme-admin.php:441
224
  msgid "Inherit"
225
  msgstr ""
226
 
227
- #: admin/class-whatsappme-admin.php:466
228
  msgid "Settings"
229
  msgstr ""
230
 
231
- #. Name of the plugin
232
- #: admin/class-whatsappme-admin.php:514
233
  msgid "WhatsApp me"
234
  msgstr ""
235
 
236
- #: admin/class-whatsappme-admin.php:557
237
  msgid "You can use vars <code>{SITE} {URL} {TITLE}</code>"
238
  msgstr ""
239
 
240
- #: admin/class-whatsappme-admin.php:565
241
  msgid "Default visibility"
242
  msgstr ""
243
 
244
- #. Description of the theme
245
- msgid "Add support to your clients directly with WhatsApp."
246
- msgstr ""
247
-
248
- #. URI of the plugin
249
- msgid "http://wame.chat"
250
- msgstr ""
251
-
252
- #. Author of the plugin
253
- msgid "Creame"
254
- msgstr ""
255
-
256
- #. Author URI of the plugin
257
- msgid "https://crea.me"
258
  msgstr ""
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WhatsApp Me\n"
5
+ "POT-Creation-Date: 2019-06-25 19:24+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"
14
  "X-Textdomain-Support: yesX-Generator: Poedit 1.6.4\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
17
+ "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
18
+ "_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
19
  "X-Poedit-Basepath: ..\n"
20
+ "X-Generator: Poedit 1.8.7.1\n"
21
+ "X-Poedit-SearchPath-0: .\n"
 
22
 
23
+ #: admin/class-whatsappme-admin.php:171 admin/class-whatsappme-admin.php:649
24
  msgid "Telephone"
25
  msgstr ""
26
 
27
+ #: admin/class-whatsappme-admin.php:172 admin/class-whatsappme-admin.php:444
28
+ msgid "Mobile Only"
29
  msgstr ""
30
 
31
+ #: admin/class-whatsappme-admin.php:173 admin/class-whatsappme-admin.php:467
32
+ msgid "Position On Screen"
33
  msgstr ""
34
 
35
+ #: admin/class-whatsappme-admin.php:174
36
+ msgid "Button Delay"
37
  msgstr ""
38
 
39
+ #: admin/class-whatsappme-admin.php:175 admin/class-whatsappme-admin.php:481
40
+ msgid "WhatsApp Web"
41
  msgstr ""
42
 
43
+ #: admin/class-whatsappme-admin.php:185 admin/class-whatsappme-admin.php:653
44
+ msgid "Call To Action"
45
+ msgstr ""
46
+
47
+ #: admin/class-whatsappme-admin.php:186 admin/class-whatsappme-admin.php:657
48
  msgid "Message"
49
  msgstr ""
50
 
51
+ #: admin/class-whatsappme-admin.php:187
52
+ msgid "Chat Delay"
53
  msgstr ""
54
 
55
+ #: admin/class-whatsappme-admin.php:188 admin/class-whatsappme-admin.php:421
56
+ msgid "Hide Chat"
57
+ msgstr ""
58
+
59
+ #: admin/class-whatsappme-admin.php:202
60
  msgid "Global"
61
  msgstr ""
62
 
63
+ #: admin/class-whatsappme-admin.php:211
64
  msgid "Front Page"
65
  msgstr ""
66
 
67
+ #: admin/class-whatsappme-admin.php:212
68
  msgid "Blog Page"
69
  msgstr ""
70
 
71
+ #: admin/class-whatsappme-admin.php:213
72
  msgid "404 Page"
73
  msgstr ""
74
 
75
+ #: admin/class-whatsappme-admin.php:214
76
  msgid "Search Results"
77
  msgstr ""
78
 
79
+ #: admin/class-whatsappme-admin.php:215
80
  msgid "Archives"
81
  msgstr ""
82
 
83
+ #: admin/class-whatsappme-admin.php:216
84
  msgid "Date Archives"
85
  msgstr ""
86
 
87
+ #: admin/class-whatsappme-admin.php:217
88
  msgid "Author Archives"
89
  msgstr ""
90
 
91
+ #: admin/class-whatsappme-admin.php:218
92
  msgid "Singular"
93
  msgstr ""
94
 
95
+ #: admin/class-whatsappme-admin.php:219
96
  msgid "Page"
97
  msgstr ""
98
 
99
+ #: admin/class-whatsappme-admin.php:220
100
  msgid "Post"
101
  msgstr ""
102
 
103
+ #: admin/class-whatsappme-admin.php:241
104
  msgid "Shop"
105
  msgstr ""
106
 
107
+ #: admin/class-whatsappme-admin.php:243
108
  msgid "Product Page"
109
  msgstr ""
110
 
111
+ #: admin/class-whatsappme-admin.php:244
112
  msgid "Cart"
113
  msgstr ""
114
 
115
+ #: admin/class-whatsappme-admin.php:245
116
  msgid "Checkout"
117
  msgstr ""
118
 
119
+ #: admin/class-whatsappme-admin.php:246
120
  msgid "My Account"
121
  msgstr ""
122
 
123
+ #: admin/class-whatsappme-admin.php:269
124
  msgid "Custom Post Types"
125
  msgstr ""
126
 
127
+ #: admin/class-whatsappme-admin.php:323
128
  msgid "Settings saved"
129
  msgstr ""
130
 
131
+ #: admin/class-whatsappme-admin.php:340
132
  msgid "General"
133
  msgstr ""
134
 
135
+ #: admin/class-whatsappme-admin.php:341
136
  msgid "Advanced"
137
  msgstr ""
138
 
139
+ #: admin/class-whatsappme-admin.php:348
140
+ msgid "Button"
141
+ msgstr ""
142
+
143
+ #: admin/class-whatsappme-admin.php:349
144
  msgid ""
145
+ "Set the contact number and where you want the WhatsApp button to be "
146
+ "displayed."
147
+ msgstr ""
148
+
149
+ #: admin/class-whatsappme-admin.php:353
150
+ msgid "Chat Window"
151
  msgstr ""
152
 
153
+ #: admin/class-whatsappme-admin.php:355
154
+ msgid "Set the behavior of the chat window."
155
+ msgstr ""
156
+
157
+ #: admin/class-whatsappme-admin.php:356
158
+ msgid ""
159
+ "You can use the dynamic variables <code>{SITE}</code>, <code>{URL}</code> "
160
+ "and <code>{TITLE}</code> which will be replaced by the values of the user's "
161
+ "current page."
162
+ msgstr ""
163
+
164
+ #: admin/class-whatsappme-admin.php:357
165
+ msgid ""
166
+ "You can also use formatting styles like in WhatsApp: _<em>italic</em>_ "
167
+ "*<strong>bold</strong>* ~<del>strikethrough</del>~."
168
+ msgstr ""
169
+
170
+ #: admin/class-whatsappme-admin.php:363
171
+ msgid "Advanced Visibility Settings"
172
+ msgstr ""
173
+
174
+ #: admin/class-whatsappme-admin.php:364
175
  msgid ""
176
  "From here you can configure on which pages the WhatsApp button will be "
177
  "visible."
178
  msgstr ""
179
 
180
+ #: admin/class-whatsappme-admin.php:365
181
  msgid "Restore default visibility"
182
  msgstr ""
183
 
184
+ #: admin/class-whatsappme-admin.php:389
185
  msgid ""
186
+ "Contact phone number <strong>(the button will not be shown if it's empty)</"
187
+ "strong>"
188
  msgstr ""
189
 
190
+ #: admin/class-whatsappme-admin.php:399
191
  msgid ""
192
  "Hello 👋\n"
193
  "Can we help you?"
194
  msgstr ""
195
 
196
+ #: admin/class-whatsappme-admin.php:400
197
  msgid ""
198
+ "Define a text to encourage users to contact by WhatsApp <strong>(optional)</"
199
+ "strong>"
200
  msgstr ""
201
 
202
+ #: admin/class-whatsappme-admin.php:410 admin/class-whatsappme-admin.php:456
203
+ msgid "seconds"
 
 
204
  msgstr ""
205
 
206
+ #: admin/class-whatsappme-admin.php:411
207
+ msgid ""
208
+ "Time since the the WhatsApp button is displayed until the Chat Window opens"
209
  msgstr ""
210
 
211
+ #: admin/class-whatsappme-admin.php:423
212
  msgid ""
213
+ "Display a notification balloon instead of opening the Chat Window for a "
214
+ "\"less intrusive\" mode"
215
  msgstr ""
216
 
217
+ #: admin/class-whatsappme-admin.php:433
218
+ msgid "Hi *{SITE}*! I need more info about {TITLE}"
 
 
219
  msgstr ""
220
 
221
+ #: admin/class-whatsappme-admin.php:434
222
+ msgid ""
223
+ "Predefined text with which user can start the conversation "
224
+ "<strong>(optional)</strong>"
225
  msgstr ""
226
 
227
+ #: admin/class-whatsappme-admin.php:446
228
+ msgid "Only display the button on mobile devices"
229
  msgstr ""
230
 
231
+ #: admin/class-whatsappme-admin.php:457
232
+ msgid "Time since the page is opened until the WhatsApp button is displayed"
 
 
233
  msgstr ""
234
 
235
+ #: admin/class-whatsappme-admin.php:469
236
+ msgid "Left"
237
  msgstr ""
238
 
239
+ #: admin/class-whatsappme-admin.php:471
240
  msgid "Right"
241
  msgstr ""
242
 
243
+ #: admin/class-whatsappme-admin.php:483
244
+ msgid "Open <em>WhatsApp Web</em> directly on desktop"
245
  msgstr ""
246
 
247
+ #: admin/class-whatsappme-admin.php:500 admin/class-whatsappme-admin.php:517
248
+ #: admin/class-whatsappme-admin.php:663
249
  msgid "Show"
250
  msgstr ""
251
 
252
+ #: admin/class-whatsappme-admin.php:502 admin/class-whatsappme-admin.php:519
253
+ #: admin/class-whatsappme-admin.php:665
254
  msgid "Hide"
255
  msgstr ""
256
 
257
+ #: admin/class-whatsappme-admin.php:521
258
  msgid "Inherit"
259
  msgstr ""
260
 
261
+ #: admin/class-whatsappme-admin.php:546
262
  msgid "Settings"
263
  msgstr ""
264
 
265
+ #: admin/class-whatsappme-admin.php:603
 
266
  msgid "WhatsApp me"
267
  msgstr ""
268
 
269
+ #: admin/class-whatsappme-admin.php:659
270
  msgid "You can use vars <code>{SITE} {URL} {TITLE}</code>"
271
  msgstr ""
272
 
273
+ #: admin/class-whatsappme-admin.php:667
274
  msgid "Default visibility"
275
  msgstr ""
276
 
277
+ #: public/class-whatsappme-public.php:189
278
+ msgid "Powered by"
 
 
 
 
 
 
 
 
 
 
 
 
279
  msgstr ""
public/class-whatsappme-public.php CHANGED
@@ -45,6 +45,7 @@ class WhatsAppMe_Public {
45
  * @since 1.0.0
46
  * @since 2.0.0 Added visibility setting
47
  * @since 2.1.0 Added message_badge
 
48
  * @param string $plugin_name The name of the plugin.
49
  * @param string $version The version of this plugin.
50
  */
@@ -55,11 +56,13 @@ class WhatsAppMe_Public {
55
  $this->settings = array(
56
  'show' => false,
57
  'telephone' => '',
 
 
 
58
  'message_text' => '',
59
- 'message_delay' => 10000,
60
  'message_badge' => 'no',
61
  'message_send' => '',
62
- 'mobile_only' => false,
63
  'position' => 'right',
64
  'visibility' => array( 'all' => 'yes' ),
65
  );
@@ -72,11 +75,13 @@ class WhatsAppMe_Public {
72
  * @since 1.0.0
73
  * @since 2.0.0 Check visibility
74
  * @since 2.2.0 Post settings can also change "telephone". Added 'whastapp_web' setting
 
75
  * @return void
76
  */
77
  public function get_settings() {
78
 
79
- global $post;
 
80
 
81
  $global_settings = get_option( 'whatsappme' );
82
 
@@ -86,40 +91,45 @@ class WhatsAppMe_Public {
86
  // Merge defaults with saved settings
87
  $settings = array_merge( $this->settings, $settings );
88
 
 
 
 
 
 
 
 
 
 
89
  // Post custom settings
90
  $post_settings = is_object( $post ) ? get_post_meta( $post->ID, '_whatsappme', true ) : '';
91
 
92
- // Move old 'hide' to new 'view' field
93
- if ( isset( $post_settings['hide'] ) ) {
94
- $post_settings['view'] = 'no';
95
- unset( $post_settings['hide'] );
96
- }
 
97
 
98
- if ( isset( $post_settings['telephone'] ) ) {
99
- $settings['telephone'] = $post_settings['telephone'];
100
- }
101
- if ( isset( $post_settings['message_text'] ) ) {
102
- $settings['message_text'] = $post_settings['message_text'];
103
- }
104
- if ( isset( $post_settings['message_send'] ) ) {
105
- $settings['message_send'] = $post_settings['message_send'];
106
  }
 
107
  // Prepare settings
108
- $settings['telephone'] = preg_replace( '/^0+|\D/', '', $settings['telephone'] );
109
- $settings['position'] = $settings['position'] != 'left' ? 'right' : 'left';
110
- $settings['mobile_only'] = $settings['mobile_only'] == 'yes';
111
  $settings['message_badge'] = $settings['message_text'] && $settings['message_badge'] == 'yes';
112
- $settings['message_send'] = $this->formated_message_send( $settings['message_send'] );
113
 
114
  $settings['show'] = $settings['telephone'] != '';
115
  if ( $settings['show'] ) {
116
- $settings['show'] = isset( $post_settings['view'] ) ?
117
- $post_settings['view'] == 'yes' :
118
  $this->check_visibility( $settings['visibility'] );
119
  }
 
120
 
121
  // Set true to link http://web.whatsapp.com instead http://api.whatsapp.com
122
- $settings['whastapp_web'] = apply_filters( 'whatsappme_whastapp_web', false );
123
 
124
  $this->settings = $settings;
125
  }
@@ -169,34 +179,41 @@ class WhatsAppMe_Public {
169
  * @since 1.0.0
170
  */
171
  public function footer_html() {
 
172
 
173
- // Clean unnecessary settings on front
174
- $data = array_diff_key( $this->settings, array_flip( array( 'show', 'visibility', 'position' ) ) );
175
 
176
- $copy = apply_filters( 'whatsappme_copy', __( 'Powered by', 'creame-whatsapp-me' ) );
 
177
 
178
- if ( $this->settings['show'] ) {
179
- ?>
180
- <div class="whatsappme whatsappme--<?php echo $this->settings['position']; ?>" data-settings="<?php echo esc_attr( json_encode( $data ) ); ?>">
181
- <div class="whatsappme__button">
182
- <svg width="24" height="24" viewBox="0 0 24 24">
183
- <path id="wa_ico" fill="#fff" d="M.057 24l1.687-6.163a11.867 11.867 0 0 1-1.587-5.946C.16 5.335 5.495 0 12.05 0a11.817 11.817 0 0 1 8.413 3.488 11.824 11.824 0 0 1 3.48 8.414c-.003 6.557-5.338 11.892-11.893 11.892a11.9 11.9 0 0 1-5.688-1.448L.057 24zm6.597-3.807c1.676.995 3.276 1.591 5.392 1.592 5.448 0 9.886-4.434 9.889-9.885.002-5.462-4.415-9.89-9.881-9.892-5.452 0-9.887 4.434-9.889 9.884-.001 2.225.651 3.891 1.746 5.634l-.999 3.648 3.742-.981zm11.387-5.464c-.074-.124-.272-.198-.57-.347-.297-.149-1.758-.868-2.031-.967-.272-.099-.47-.149-.669.149-.198.297-.768.967-.941 1.165-.173.198-.347.223-.644.074-.297-.149-1.255-.462-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.297-.347.446-.521.151-.172.2-.296.3-.495.099-.198.05-.372-.025-.521-.075-.148-.669-1.611-.916-2.206-.242-.579-.487-.501-.669-.51l-.57-.01c-.198 0-.52.074-.792.372s-1.04 1.016-1.04 2.479 1.065 2.876 1.213 3.074c.149.198 2.095 3.2 5.076 4.487.709.306 1.263.489 1.694.626.712.226 1.36.194 1.872.118.571-.085 1.758-.719 2.006-1.413.248-.695.248-1.29.173-1.414z"/>
184
- <path id="send_ico" fill="#fff" d="M1.101 21.757L23.8 12.028 1.101 2.3l.011 7.912 13.623 1.816-13.623 1.817-.011 7.912z"/>
185
- </svg>
186
- <?php if ($this->settings['message_badge']): ?><div class="whatsappme__badge">1</div><?php endif; ?>
187
- </div>
188
- <?php if ($this->settings['message_text']): ?>
189
- <div class="whatsappme__box">
190
- <header class="whatsappme__header">
191
- <svg width="120" height="28" 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>
192
- <div class="whatsappme__close"><svg width="24" height="24" 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>
193
- </header>
194
- <div class="whatsappme__message"><?php echo $this->formated_message(); ?></div>
195
- <?php if ($copy): ?><div class="whatsappme__copy"><?php echo $copy; ?> <a href="https://wame.chat" rel="noopener" target="_blank"><svg width="72" height="17" 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><?php endif; ?>
196
  </div>
197
- <?php endif; ?>
198
- </div>
199
- <?php
 
 
 
 
 
 
 
 
 
200
  }
201
 
202
  }
@@ -207,6 +224,7 @@ class WhatsAppMe_Public {
207
  * Also apply styles transformations like WhatsApp app.
208
  *
209
  * @since 1.3.0
 
210
  * @return string message formated string
211
  */
212
  public function formated_message() {
@@ -225,7 +243,7 @@ class WhatsAppMe_Public {
225
  $lines[$key] = preg_replace( $replacements_keys, $replacements, esc_html( $line ) );
226
  }
227
 
228
- return implode( '<br>', $lines );
229
 
230
  }
231
 
@@ -233,9 +251,10 @@ class WhatsAppMe_Public {
233
  * Format message send, replace vars.
234
  *
235
  * @since 1.4.0
 
236
  * @return string message formated string
237
  */
238
- public function formated_message_send( $string ) {
239
  global $wp;
240
 
241
  $replacements = apply_filters( 'whatsappme_message_send_replacements', array(
45
  * @since 1.0.0
46
  * @since 2.0.0 Added visibility setting
47
  * @since 2.1.0 Added message_badge
48
+ * @since 2.3.0 Added button_delay and whatsapp_web settings, message_delay in seconds
49
  * @param string $plugin_name The name of the plugin.
50
  * @param string $version The version of this plugin.
51
  */
56
  $this->settings = array(
57
  'show' => false,
58
  'telephone' => '',
59
+ 'mobile_only' => false,
60
+ 'button_delay' => 3,
61
+ 'whatsapp_web' => false,
62
  'message_text' => '',
63
+ 'message_delay' => 10,
64
  'message_badge' => 'no',
65
  'message_send' => '',
 
66
  'position' => 'right',
67
  'visibility' => array( 'all' => 'yes' ),
68
  );
75
  * @since 1.0.0
76
  * @since 2.0.0 Check visibility
77
  * @since 2.2.0 Post settings can also change "telephone". Added 'whastapp_web' setting
78
+ * @since 2.3.0 Fix global $post incorrect post id on loops. WPML integration.
79
  * @return void
80
  */
81
  public function get_settings() {
82
 
83
+ // If use "global $post;" take first post in loop on archive pages
84
+ $post = get_queried_object();
85
 
86
  $global_settings = get_option( 'whatsappme' );
87
 
91
  // Merge defaults with saved settings
92
  $settings = array_merge( $this->settings, $settings );
93
 
94
+ // miliseconds (<v2.3) to seconds
95
+ if ( $settings['message_delay'] > 120 ) {
96
+ $settings['message_delay'] = round( $settings['message_delay'] / 1000 );
97
+ }
98
+
99
+ // Load WPML/Polylang translated strings
100
+ $settings['message_text'] = apply_filters( 'wpml_translate_single_string', $settings['message_text'], 'WhatsApp me', 'Call To Action' );
101
+ $settings['message_send'] = apply_filters( 'wpml_translate_single_string', $settings['message_send'], 'WhatsApp me', 'Message' );
102
+
103
  // Post custom settings
104
  $post_settings = is_object( $post ) ? get_post_meta( $post->ID, '_whatsappme', true ) : '';
105
 
106
+ if ( is_array( $post_settings ) ) {
107
+ // Move old 'hide' to new 'view' field
108
+ if ( isset( $post_settings['hide'] ) ) {
109
+ $post_settings['view'] = 'no';
110
+ unset( $post_settings['hide'] );
111
+ }
112
 
113
+ $settings = array_merge( $settings, $post_settings );
 
 
 
 
 
 
 
114
  }
115
+
116
  // Prepare settings
117
+ $settings['telephone'] = preg_replace( '/^0+|\D/', '', $settings['telephone'] );
118
+ $settings['position'] = $settings['position'] != 'left' ? 'right' : 'left';
119
+ $settings['mobile_only'] = $settings['mobile_only'] == 'yes';
120
  $settings['message_badge'] = $settings['message_text'] && $settings['message_badge'] == 'yes';
121
+ $settings['message_send'] = $this->replace_message_variables( $settings['message_send'] );
122
 
123
  $settings['show'] = $settings['telephone'] != '';
124
  if ( $settings['show'] ) {
125
+ $settings['show'] = isset( $settings['view'] ) ?
126
+ $settings['view'] == 'yes' :
127
  $this->check_visibility( $settings['visibility'] );
128
  }
129
+ unset( $settings['view'] );
130
 
131
  // Set true to link http://web.whatsapp.com instead http://api.whatsapp.com
132
+ $settings['whatsapp_web'] = apply_filters( 'whatsappme_whatsapp_web', $settings['whatsapp_web'] == 'yes' );
133
 
134
  $this->settings = $settings;
135
  }
179
  * @since 1.0.0
180
  */
181
  public function footer_html() {
182
+ global $wp;
183
 
184
+ if ( $this->settings['show'] ) {
 
185
 
186
+ // Clean unnecessary settings on front
187
+ $data = array_diff_key( $this->settings, array_flip( array( 'show', 'visibility', 'position' ) ) );
188
 
189
+ $copy = apply_filters( 'whatsappme_copy', __( 'Powered by', 'creame-whatsapp-me' ) );
190
+
191
+ $link_url = urlencode( home_url( $wp->request ) );
192
+ $link_site = urlencode( get_bloginfo( 'name' ) );
193
+ $link = "https://wame.chat/powered/?site=$link_site&url=$link_url";
194
+
195
+ ?>
196
+ <div class="whatsappme <?php echo apply_filters( 'whatsappme_classes', "whatsappme--{$this->settings['position']}" ); ?>" data-settings="<?php echo esc_attr( json_encode( $data ) ); ?>">
197
+ <div class="whatsappme__button">
198
+ <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>
199
+ <svg class="whatsappme__button__send" viewbox="0 0 400 400" fill="none" fill-rule="evenodd" stroke="#fff" stroke-linecap="round" stroke-width="33">
200
+ <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"/>
201
+ <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"/>
202
+ </svg>
203
+ <?php if ($this->settings['message_badge']): ?><div class="whatsappme__badge">1</div><?php endif; ?>
 
 
 
204
  </div>
205
+ <?php if ($this->settings['message_text']): ?>
206
+ <div class="whatsappme__box">
207
+ <div class="whatsappme__header">
208
+ <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>
209
+ <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>
210
+ </div>
211
+ <div class="whatsappme__message"><?php echo $this->formated_message(); ?></div>
212
+ <?php if ($copy): ?><div class="whatsappme__copy"><?php echo $copy; ?> <a href="<?php echo $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><?php endif; ?>
213
+ </div>
214
+ <?php endif; ?>
215
+ </div>
216
+ <?php
217
  }
218
 
219
  }
224
  * Also apply styles transformations like WhatsApp app.
225
  *
226
  * @since 1.3.0
227
+ * @since 2.3.0 apply replace_message_variables
228
  * @return string message formated string
229
  */
230
  public function formated_message() {
243
  $lines[$key] = preg_replace( $replacements_keys, $replacements, esc_html( $line ) );
244
  }
245
 
246
+ return $this->replace_message_variables( implode( '<br>', $lines ) );
247
 
248
  }
249
 
251
  * Format message send, replace vars.
252
  *
253
  * @since 1.4.0
254
+ * @since 2.3.0 renamed from formated_message_send to replace_message_variables
255
  * @return string message formated string
256
  */
257
+ public function replace_message_variables( $string ) {
258
  global $wp;
259
 
260
  $replacements = apply_filters( 'whatsappme_message_send_replacements', array(
public/css/whatsappme.css CHANGED
@@ -47,14 +47,31 @@
47
  }
48
 
49
  .whatsappme--dialog .whatsappme__button {
 
50
  transition: background-color 0.2s linear;
51
  }
52
 
 
 
 
 
53
  .whatsappme__button:active {
54
  background-color: #075E54;
55
  transition: none;
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  .whatsappme__button svg {
59
  width: 36px;
60
  height: 36px;
@@ -92,16 +109,26 @@
92
  }
93
 
94
  .whatsappme--dialog .whatsappme__button svg {
95
- margin: 12px 10px 12px 14px;
96
  }
97
 
98
- #wa_ico,
99
- .whatsappme--dialog #send_ico {
 
 
 
 
 
 
 
 
 
 
100
  display: block;
101
  }
102
 
103
- #send_ico,
104
- .whatsappme--dialog #wa_ico {
105
  display: none;
106
  }
107
 
@@ -115,7 +142,7 @@
115
  min-height: 280px;
116
  padding-bottom: 60px;
117
  border-radius: 32px;
118
- background: #ede4dd url(../images/background.png) center repeat-y;
119
  background-size: 100% auto;
120
  box-shadow: 0 2px 6px 0 rgba(0, 0, 0, .5);
121
  overflow: hidden;
@@ -124,6 +151,10 @@
124
  transition: opacity 400ms ease-out, transform 0ms linear 300ms;
125
  }
126
 
 
 
 
 
127
  .whatsappme--dialog .whatsappme__box {
128
  opacity: 1;
129
  transform: scale3d(1, 1, 1);
@@ -131,6 +162,7 @@
131
  }
132
 
133
  .whatsappme__header {
 
134
  display: block;
135
  position: static;
136
  width: 100%;
@@ -142,6 +174,7 @@
142
  }
143
 
144
  .whatsappme__header svg {
 
145
  height: 100%;
146
  }
147
 
@@ -285,6 +318,7 @@
285
  opacity: 0;
286
  transform: translateY(50px);
287
  }
 
288
  to {
289
  opacity: 1;
290
  transform: translateY(0);
@@ -292,12 +326,45 @@
292
  }
293
 
294
  @keyframes badge--out {
295
- 0% {
296
  opacity: 1;
297
  transform: translateY(0);
298
  }
299
- 100% {
 
300
  opacity: 0;
301
  transform: translateY(-20px);
302
  }
303
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
 
49
  .whatsappme--dialog .whatsappme__button {
50
+ background-color: #128C7E;
51
  transition: background-color 0.2s linear;
52
  }
53
 
54
+ .whatsappme--dialog .whatsappme__button:hover {
55
+ background-color: #075E54;
56
+ }
57
+
58
  .whatsappme__button:active {
59
  background-color: #075E54;
60
  transition: none;
61
  }
62
 
63
+ /* iOS styles */
64
+ @supports (-webkit-overflow-scrolling: touch) {
65
+ .whatsappme--dialog .whatsappme__button {
66
+ background-color: #34B7F1;
67
+ }
68
+
69
+ .whatsappme--dialog .whatsappme__button:hover,
70
+ .whatsappme__button:active {
71
+ background-color: #228bb9;
72
+ }
73
+ }
74
+
75
  .whatsappme__button svg {
76
  width: 36px;
77
  height: 36px;
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;
118
+ animation: wame_plain 6s 0s ease-in-out infinite;
119
+ }
120
+
121
+ .whatsappme .whatsappme__button__send path.wame_chat {
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
 
142
  min-height: 280px;
143
  padding-bottom: 60px;
144
  border-radius: 32px;
145
+ background: #ede4dd url(../images/background.webp) center repeat-y;
146
  background-size: 100% auto;
147
  box-shadow: 0 2px 6px 0 rgba(0, 0, 0, .5);
148
  overflow: hidden;
151
  transition: opacity 400ms ease-out, transform 0ms linear 300ms;
152
  }
153
 
154
+ .nowebp .whatsappme__box {
155
+ background-image: url(../images/background.png);
156
+ }
157
+
158
  .whatsappme--dialog .whatsappme__box {
159
  opacity: 1;
160
  transform: scale3d(1, 1, 1);
162
  }
163
 
164
  .whatsappme__header {
165
+ float: none;
166
  display: block;
167
  position: static;
168
  width: 100%;
174
  }
175
 
176
  .whatsappme__header svg {
177
+ width: 120px;
178
  height: 100%;
179
  }
180
 
318
  opacity: 0;
319
  transform: translateY(50px);
320
  }
321
+
322
  to {
323
  opacity: 1;
324
  transform: translateY(0);
326
  }
327
 
328
  @keyframes badge--out {
329
+ from {
330
  opacity: 1;
331
  transform: translateY(0);
332
  }
333
+
334
+ to {
335
  opacity: 0;
336
  transform: translateY(-20px);
337
  }
338
  }
339
+
340
+ @keyframes wame_plain {
341
+ 5% {
342
+ stroke-dashoffset: 0;
343
+ }
344
+
345
+ 45% {
346
+ stroke-dashoffset: 0;
347
+ }
348
+
349
+ 50% {
350
+ stroke-dashoffset: 1096.67;
351
+ }
352
+
353
+ 100% {
354
+ stroke-dashoffset: 1096.67;
355
+ }
356
+ }
357
+
358
+ @keyframes wame_chat {
359
+ 50% {
360
+ stroke-dashoffset: 1019.22;
361
+ }
362
+
363
+ 55% {
364
+ stroke-dashoffset: 0;
365
+ }
366
+
367
+ 95% {
368
+ stroke-dashoffset: 0;
369
+ }
370
+ }
public/css/whatsappme.min.css CHANGED
@@ -1 +1 @@
1
- .whatsappme{position:fixed;z-index:400;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{transition:background-color .2s linear}.whatsappme__button:active{background-color:#075e54;transition:none}.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 10px 12px 14px}#wa_ico,.whatsappme--dialog #send_ico{display:block}#send_ico,.whatsappme--dialog #wa_ico{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.png) 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}.whatsappme--dialog .whatsappme__box{opacity:1;transform:scale3d(1,1,1);transition:opacity .2s ease-out,transform 0s linear}.whatsappme__header{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{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}.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 22px;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__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){.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:14px 20px;margin:15px 21px 20px;line-height:24px}}@keyframes badge--in{from{opacity:0;transform:translateY(50px)}to{opacity:1;transform:translateY(0)}}@keyframes badge--out{0%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(-20px)}}
1
+ .whatsappme{position:fixed;z-index:400;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}.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 22px;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__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){.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:14px 20px;margin:15px 21px 20px;line-height:24px}}@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}}
public/images/background.png CHANGED
Binary file
public/images/background.webp ADDED
Binary file
public/js/whatsappme.js CHANGED
@@ -2,7 +2,6 @@
2
  'use strict';
3
 
4
  $(function () {
5
- var delay_on_start = 3000;
6
  var $whatsappme = $('.whatsappme');
7
  var $badge = $whatsappme.find('.whatsappme__badge');
8
  var wame_settings = $whatsappme.data('settings');
@@ -38,10 +37,18 @@
38
 
39
  function whatsappme_magic() {
40
  var is_mobile = !!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);
 
41
  var has_cta = wame_settings.message_text !== '';
42
- var wa_web = wame_settings.whastapp_web && !is_mobile;
43
  var message_hash, is_viewed, timeoutID, timeoutCTA;
44
 
 
 
 
 
 
 
 
45
  // stored values
46
  var messages_viewed = (store.getItem('whatsappme_hashes') || '').split(',').filter(Boolean);
47
  var is_second_visit = store.getItem('whatsappme_visited') == 'yes';
@@ -55,13 +62,13 @@
55
 
56
  if (!wame_settings.mobile_only || is_mobile) {
57
  // show button
58
- setTimeout(function () { $whatsappme.addClass('whatsappme--show'); }, delay_on_start);
59
 
60
  if (has_cta && !is_viewed) {
61
  if (wame_settings.message_badge) { // show badge
62
- timeoutCTA = setTimeout(function () { $badge.addClass('whatsappme__badge--in'); }, delay_on_start + wame_settings.message_delay);
63
  } else if (is_second_visit) { // show dialog
64
- timeoutCTA = setTimeout(function () { $whatsappme.addClass('whatsappme--dialog'); }, delay_on_start + wame_settings.message_delay);
65
  }
66
  }
67
  }
2
  'use strict';
3
 
4
  $(function () {
 
5
  var $whatsappme = $('.whatsappme');
6
  var $badge = $whatsappme.find('.whatsappme__badge');
7
  var wame_settings = $whatsappme.data('settings');
37
 
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';
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
  }
public/js/whatsappme.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){"use strict";e(function(){var t,a=3e3,s=e(".whatsappme"),n=s.find(".whatsappme__badge"),o=s.data("settings");try{localStorage.setItem("test",1),localStorage.removeItem("test"),t=localStorage}catch(e){t={_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,c,h=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i),l=""!==o.message_text,r=o.whastapp_web&&!h,d=(t.getItem("whatsappme_hashes")||"").split(",").filter(Boolean),u="yes"==t.getItem("whatsappme_visited");l&&(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=d.indexOf(i)>-1);t.setItem("whatsappme_visited","yes"),(!o.mobile_only||h)&&(setTimeout(function(){s.addClass("whatsappme--show")},a),l&&!p&&(o.message_badge?c=setTimeout(function(){n.addClass("whatsappme__badge--in")},a+o.message_delay):u&&(c=setTimeout(function(){s.addClass("whatsappme--dialog")},a+o.message_delay))));l&&!h&&e(".whatsappme__button",s).mouseenter(function(){m=setTimeout(g,1500)}).mouseleave(function(){clearTimeout(m)});function g(){s.addClass("whatsappme--dialog"),clearTimeout(c),o.message_badge&&n.hasClass("whatsappme__badge--in")&&(n.removeClass("whatsappme__badge--in").addClass("whatsappme__badge--out"),_())}function _(){l&&!p&&(d.push(i),t.setItem("whatsappme_hashes",d.join(",")),p=!0)}e(".whatsappme__button",s).click(function(){var e=function(e,t,a){return(e?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(a||"")}(r,o.telephone,o.message_send);l&&!s.hasClass("whatsappme--dialog")?g():(s.removeClass("whatsappme--dialog"),_(),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){ga("set","transport","beacon");var t=ga.getAll();t.forEach(function(t){t.send("event","WhatsAppMe","click",e)})}}(e),window.open(e,"whatsappme"))}),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";e(function(){var t,a=e(".whatsappme"),s=a.find(".whatsappme__badge"),n=a.data("settings");try{localStorage.setItem("test",1),localStorage.removeItem("test"),t=localStorage}catch(e){t={_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===n)try{n=JSON.parse(a.attr("data-settings"))}catch(e){n=void 0}a.length&&n&&n.telephone&&function(){var o,i,p,m,l=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i),c=1e3*n.button_delay,h=""!==n.message_text,r=n.whatsapp_web&&!l,d=new Image;d.src="data:image/webp;base64,UklGRi4AAABXRUJQVlA4TCEAAAAvAUAAEB8wAiMwAgSSNtse/cXjxyCCmrYNWPwmHRH9jwMA",d.onload=d.onerror=function(){2!==d.height&&a.addClass("nowebp")};var u=(t.getItem("whatsappme_hashes")||"").split(",").filter(Boolean),g="yes"==t.getItem("whatsappme_visited");h&&(o=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}(n.message_text).toString(),i=u.indexOf(o)>-1);t.setItem("whatsappme_visited","yes"),(!n.mobile_only||l)&&(setTimeout(function(){a.addClass("whatsappme--show")},c),h&&!i&&(n.message_badge?m=setTimeout(function(){s.addClass("whatsappme__badge--in")},c+1e3*n.message_delay):g&&(m=setTimeout(function(){a.addClass("whatsappme--dialog")},c+1e3*n.message_delay))));h&&!l&&e(".whatsappme__button",a).mouseenter(function(){p=setTimeout(_,1500)}).mouseleave(function(){clearTimeout(p)});function _(){a.addClass("whatsappme--dialog"),clearTimeout(m),n.message_badge&&s.hasClass("whatsappme__badge--in")&&(s.removeClass("whatsappme__badge--in").addClass("whatsappme__badge--out"),w())}function w(){h&&!i&&(u.push(o),t.setItem("whatsappme_hashes",u.join(",")),i=!0)}e(".whatsappme__button",a).click(function(){var e=function(e,t,a){return(e?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(a||"")}(r,n.telephone,n.message_send);h&&!a.hasClass("whatsappme--dialog")?_():(a.removeClass("whatsappme--dialog"),w(),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){ga("set","transport","beacon");var t=ga.getAll();t.forEach(function(t){t.send("event","WhatsAppMe","click",e)})}}(e),window.open(e,"whatsappme"))}),e(".whatsappme__close",a).click(function(){a.removeClass("whatsappme--dialog"),w()})}()}),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: WhatsApp me
10
  * Plugin URI: https://wame.chat
11
  * Description: The perfect plugin to engage and retain customers. Support for ecommerce and online stores.
12
- * Version: 2.2.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', '2.2.3' );
31
 
32
  /**
33
  * The core plugin class that is used to define internationalization,
9
  * Plugin Name: WhatsApp me
10
  * Plugin URI: https://wame.chat
11
  * Description: The perfect plugin to engage and retain customers. Support for ecommerce and online stores.
12
+ * Version: 2.3.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', '2.3.0' );
31
 
32
  /**
33
  * The core plugin class that is used to define internationalization,