WhatsApp me - Version 1.3.0

Version Description

  • Added option to change position of button to left
  • Added formatting styles for Call to action text like in WhatsApp: italic bold ~strikethrough~
Download this release

Release Info

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

Code changes from version 1.2.0 to 1.3.0

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: whatsapp, button, chat, support, contact
5
  Requires at least: 3.0.1
6
  Tested up to: 4.9.4
7
  Requires PHP: 5.3
8
- Stable tag: 1.2.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -44,6 +44,10 @@ Options:
44
 
45
  == Changelog ==
46
 
 
 
 
 
47
  = 1.2.0 =
48
  * Added International Telephone Input for enhanced phone input
49
  * Phone number is cleared to generate correct WhatsApp links
5
  Requires at least: 3.0.1
6
  Tested up to: 4.9.4
7
  Requires PHP: 5.3
8
+ Stable tag: 1.3.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
44
 
45
  == Changelog ==
46
 
47
+ = 1.3.0 =
48
+ * Added option to change position of button to left
49
+ * Added formatting styles for Call to action text like in WhatsApp: _italic_ *bold* ~strikethrough~
50
+
51
  = 1.2.0 =
52
  * Added International Telephone Input for enhanced phone input
53
  * Phone number is cleared to generate correct WhatsApp links
admin/class-whatsappme-admin.php CHANGED
@@ -77,6 +77,7 @@ class WhatsAppMe_Admin {
77
  'mobile_only' => 'no',
78
  'message_text' => '',
79
  'message_delay' => 10000,
 
80
  );
81
 
82
  $saved_settings = get_option( 'whatsappme' );
@@ -135,6 +136,7 @@ class WhatsAppMe_Admin {
135
  'mobile_only' => __( 'Mobile only', 'creame-whatsapp-me' ),
136
  'message_text' => __( 'Call to action', 'creame-whatsapp-me' ),
137
  'message_delay' => __( 'Delay', 'creame-whatsapp-me' ),
 
138
  );
139
 
140
  foreach ( $this->settings as $key => $value ) {
@@ -158,6 +160,7 @@ class WhatsAppMe_Admin {
158
  $input['telephone'] = sanitize_text_field($input['telephone']);
159
  $input['message_text'] = trim($input['message_text']);
160
  $input['message_delay'] = intval($input['message_delay']);
 
161
 
162
  add_settings_error( 'whatsappme', 'settings_updated', __( 'Settings saved', 'creame-whatsapp-me' ), 'updated' );
163
 
@@ -193,8 +196,9 @@ class WhatsAppMe_Admin {
193
  * @return void
194
  */
195
  public function field_message_text() {
196
- echo '<textarea name="whatsappme[message_text]" rows="3" class="regular-text">' . $this->settings['message_text'] . '</textarea>' .
197
- '<p class="description">' . __( 'Optional text to invite the user to use the contact via WhatsApp. <strong>Leave empty to disable.</strong>', 'creame-whatsapp-me' ) . '</p>';
 
198
  }
199
 
200
  /**
@@ -220,6 +224,20 @@ class WhatsAppMe_Admin {
220
  __('Only display the button on mobile devices', 'creame-whatsapp-me' ) . '</label></fieldset>';
221
  }
222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  /**
224
  * Add menu to the options page in the wordpress admin
225
  *
77
  'mobile_only' => 'no',
78
  'message_text' => '',
79
  'message_delay' => 10000,
80
+ 'position' => 'right',
81
  );
82
 
83
  $saved_settings = get_option( 'whatsappme' );
136
  'mobile_only' => __( 'Mobile only', 'creame-whatsapp-me' ),
137
  'message_text' => __( 'Call to action', 'creame-whatsapp-me' ),
138
  'message_delay' => __( 'Delay', 'creame-whatsapp-me' ),
139
+ 'position' => __( 'Position on screen', 'creame-whatsapp-me' ),
140
  );
141
 
142
  foreach ( $this->settings as $key => $value ) {
160
  $input['telephone'] = sanitize_text_field($input['telephone']);
161
  $input['message_text'] = trim($input['message_text']);
162
  $input['message_delay'] = intval($input['message_delay']);
163
+ $input['position'] = $input['position'] != 'left' ? 'right' : 'left';
164
 
165
  add_settings_error( 'whatsappme', 'settings_updated', __( 'Settings saved', 'creame-whatsapp-me' ), 'updated' );
166
 
196
  * @return void
197
  */
198
  public function field_message_text() {
199
+ echo '<textarea name="whatsappme[message_text]" rows="5" class="regular-text">' . $this->settings['message_text'] . '</textarea>' .
200
+ '<p class="description">' . __( 'Optional text to invite the user to use the contact via WhatsApp. <strong>Leave empty to disable.</strong>', 'creame-whatsapp-me' ) . '</p>' .
201
+ '<p>' . __( 'You can use formatting styles like in WhatsApp: _<em>italic</em>_ *<strong>bold</strong>* ~<del>strikethrough</del>~', 'creame-whatsapp-me' ) . '</p>';
202
  }
203
 
204
  /**
224
  __('Only display the button on mobile devices', 'creame-whatsapp-me' ) . '</label></fieldset>';
225
  }
226
 
227
+ /**
228
+ * Field 'position' output
229
+ *
230
+ * @since 1.3.0
231
+ * @return void
232
+ */
233
+ public function field_position() {
234
+ echo '<fieldset><legend class="screen-reader-text"><span>' . __( 'Position on screen', 'creame-whatsapp-me' ) . '</span></legend>' .
235
+ '<p><label><input name="whatsappme[position]" value="right" type="radio"' . checked( 'right', $this->settings['position'], false ) . '> ' .
236
+ __('Right', 'creame-whatsapp-me' ) . '</label>' .
237
+ '<br><label><input name="whatsappme[position]" value="left" type="radio"' . checked( 'left', $this->settings['position'], false ) . '> ' .
238
+ __('Left', 'creame-whatsapp-me' ) . '</label></p></fieldset>';
239
+ }
240
+
241
  /**
242
  * Add menu to the options page in the wordpress admin
243
  *
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-02-20 11:03+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"
@@ -21,68 +21,86 @@ msgstr ""
21
  "X-Generator: Loco https://localise.biz/\n"
22
  "X-Poedit-SearchPath-0: ."
23
 
24
- #: admin/class-whatsappme-admin.php:97
25
  msgid "Telephone"
26
  msgstr ""
27
 
28
- #: admin/class-whatsappme-admin.php:98 admin/class-whatsappme-admin.php:178
29
  msgid "Mobile only"
30
  msgstr ""
31
 
32
- #: admin/class-whatsappme-admin.php:99 admin/class-whatsappme-admin.php:280
33
  msgid "Call to action"
34
  msgstr ""
35
 
36
- #: admin/class-whatsappme-admin.php:100
37
  msgid "Delay"
38
  msgstr ""
39
 
40
- #: admin/class-whatsappme-admin.php:123
 
 
 
 
41
  msgid "Settings saved"
42
  msgstr ""
43
 
44
- #: admin/class-whatsappme-admin.php:135
45
  msgid ""
46
  "From here you can configure the behavior of the WhatsApp button on your site."
47
  msgstr ""
48
 
49
- #: admin/class-whatsappme-admin.php:146
50
  msgid ""
51
  "Contact phone number. <strong>The button will not be shown if it's empty."
52
  "</strong>"
53
  msgstr ""
54
 
55
- #: admin/class-whatsappme-admin.php:157
56
  msgid ""
57
  "Optional text to invite the user to use the contact via WhatsApp. <strong>"
58
  "Leave empty to disable.</strong>"
59
  msgstr ""
60
 
61
- #: admin/class-whatsappme-admin.php:167
 
 
 
 
 
 
62
  msgid "milliseconds"
63
  msgstr ""
64
 
65
- #: admin/class-whatsappme-admin.php:168
66
  msgid ""
67
  "The <strong>Call to action</strong> will only be displayed once when the "
68
  "user exceeds the estimated delay on a page. It will also be displayed when "
69
  "the user stops the cursor over the WhatsApp button."
70
  msgstr ""
71
 
72
- #: admin/class-whatsappme-admin.php:180
73
  msgid "Only display the button on mobile devices"
74
  msgstr ""
75
 
76
- #: admin/class-whatsappme-admin.php:205
 
 
 
 
 
 
 
 
77
  msgid "Settings"
78
  msgstr ""
79
 
80
  #. Name of the plugin
81
- #: admin/class-whatsappme-admin.php:253
82
  msgid "WhatsApp me"
83
  msgstr ""
84
 
85
- #: admin/class-whatsappme-admin.php:285
86
  #, php-format
87
  msgid "Hide on this %s"
88
  msgstr ""
@@ -92,7 +110,7 @@ msgid "Add support to your clients directly with WhatsApp."
92
  msgstr ""
93
 
94
  #. URI of the plugin
95
- msgid "https://github.com/creame/whatsappme"
96
  msgstr ""
97
 
98
  #. Author of the plugin
2
  msgid ""
3
  msgstr ""
4
  "Project-Id-Version: WhatsApp Me\n"
5
+ "POT-Creation-Date: 2018-02-26 19:19+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"
21
  "X-Generator: Loco https://localise.biz/\n"
22
  "X-Poedit-SearchPath-0: ."
23
 
24
+ #: admin/class-whatsappme-admin.php:135
25
  msgid "Telephone"
26
  msgstr ""
27
 
28
+ #: admin/class-whatsappme-admin.php:136 admin/class-whatsappme-admin.php:222
29
  msgid "Mobile only"
30
  msgstr ""
31
 
32
+ #: admin/class-whatsappme-admin.php:137 admin/class-whatsappme-admin.php:341
33
  msgid "Call to action"
34
  msgstr ""
35
 
36
+ #: admin/class-whatsappme-admin.php:138
37
  msgid "Delay"
38
  msgstr ""
39
 
40
+ #: admin/class-whatsappme-admin.php:139 admin/class-whatsappme-admin.php:234
41
+ msgid "Position on screen"
42
+ msgstr ""
43
+
44
+ #: admin/class-whatsappme-admin.php:165
45
  msgid "Settings saved"
46
  msgstr ""
47
 
48
+ #: admin/class-whatsappme-admin.php:177
49
  msgid ""
50
  "From here you can configure the behavior of the WhatsApp button on your site."
51
  msgstr ""
52
 
53
+ #: admin/class-whatsappme-admin.php:189
54
  msgid ""
55
  "Contact phone number. <strong>The button will not be shown if it's empty."
56
  "</strong>"
57
  msgstr ""
58
 
59
+ #: admin/class-whatsappme-admin.php:200
60
  msgid ""
61
  "Optional text to invite the user to use the contact via WhatsApp. <strong>"
62
  "Leave empty to disable.</strong>"
63
  msgstr ""
64
 
65
+ #: admin/class-whatsappme-admin.php:201
66
+ msgid ""
67
+ "You can use formatting styles like in WhatsApp: _<em>italic</em>_ *<strong>"
68
+ "bold</strong>* ~<del>strikethrough</del>~"
69
+ msgstr ""
70
+
71
+ #: admin/class-whatsappme-admin.php:211
72
  msgid "milliseconds"
73
  msgstr ""
74
 
75
+ #: admin/class-whatsappme-admin.php:212
76
  msgid ""
77
  "The <strong>Call to action</strong> will only be displayed once when the "
78
  "user exceeds the estimated delay on a page. It will also be displayed when "
79
  "the user stops the cursor over the WhatsApp button."
80
  msgstr ""
81
 
82
+ #: admin/class-whatsappme-admin.php:224
83
  msgid "Only display the button on mobile devices"
84
  msgstr ""
85
 
86
+ #: admin/class-whatsappme-admin.php:236
87
+ msgid "Right"
88
+ msgstr ""
89
+
90
+ #: admin/class-whatsappme-admin.php:238
91
+ msgid "Left"
92
+ msgstr ""
93
+
94
+ #: admin/class-whatsappme-admin.php:263
95
  msgid "Settings"
96
  msgstr ""
97
 
98
  #. Name of the plugin
99
+ #: admin/class-whatsappme-admin.php:311
100
  msgid "WhatsApp me"
101
  msgstr ""
102
 
103
+ #: admin/class-whatsappme-admin.php:346
104
  #, php-format
105
  msgid "Hide on this %s"
106
  msgstr ""
110
  msgstr ""
111
 
112
  #. URI of the plugin
113
+ msgid "https://crea.me/productos/whatsapp-me/"
114
  msgstr ""
115
 
116
  #. Author of the plugin
public/class-whatsappme-public.php CHANGED
@@ -56,6 +56,7 @@ class WhatsAppMe_Public {
56
  'message_text' => '',
57
  'message_delay' => 10000,
58
  'mobile_only' => false,
 
59
  );
60
 
61
  }
@@ -81,8 +82,9 @@ class WhatsAppMe_Public {
81
  $post_settings = get_post_meta( $post->ID, '_whatsappme', true ) ?: array();
82
 
83
  // Prepare settings
84
- $settings['telephone'] = preg_replace( '/^0+|\D/', '', $settings['telephone'] );
85
- $settings['show'] = $settings['telephone'] != '' && ! isset( $post_settings['hide'] );
 
86
  $settings['mobile_only'] = $settings['mobile_only'] == 'yes';
87
  if ( isset( $post_settings['message_text'] ) ) {
88
  $settings['message_text'] = $post_settings['message_text'];
@@ -135,7 +137,7 @@ class WhatsAppMe_Public {
135
 
136
  if ( $this->settings['show'] ) {
137
  ?>
138
- <div class="whatsappme" data-settings="<?php echo esc_attr(json_encode($this->settings)); ?>">
139
  <div class="whatsappme__button">
140
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M.057 24l1.687-6.163c-1.041-1.804-1.588-3.849-1.587-5.946.003-6.556 5.338-11.891 11.893-11.891 3.181.001 6.167 1.24 8.413 3.488 2.245 2.248 3.481 5.236 3.48 8.414-.003 6.557-5.338 11.892-11.893 11.892-1.99-.001-3.951-.5-5.688-1.448l-6.305 1.654zm6.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" fill="currentColor"/></svg>
141
  </div>
@@ -145,7 +147,7 @@ class WhatsAppMe_Public {
145
  <svg xmlns="http://www.w3.org/2000/svg" width="120" height="28" viewBox="0 0 120 28"><path 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.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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" fill="currentColor" fill-rule="evenodd"/></svg>
146
  <div class="whatsappme__close">&times;</div>
147
  </header>
148
- <div class="whatsappme__message"><?php echo nl2br(esc_html($this->settings['message_text'])); ?></div>
149
  </div>
150
  <?php endif; ?>
151
  </div>
@@ -154,4 +156,31 @@ class WhatsAppMe_Public {
154
 
155
  }
156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
56
  'message_text' => '',
57
  'message_delay' => 10000,
58
  'mobile_only' => false,
59
+ 'position' => 'right',
60
  );
61
 
62
  }
82
  $post_settings = get_post_meta( $post->ID, '_whatsappme', true ) ?: array();
83
 
84
  // Prepare settings
85
+ $settings['telephone'] = preg_replace( '/^0+|\D/', '', $settings['telephone'] );
86
+ $settings['show'] = $settings['telephone'] != '' && ! isset( $post_settings['hide'] );
87
+ $settings['position'] = $settings['position'] != 'left' ? 'right' : 'left';
88
  $settings['mobile_only'] = $settings['mobile_only'] == 'yes';
89
  if ( isset( $post_settings['message_text'] ) ) {
90
  $settings['message_text'] = $post_settings['message_text'];
137
 
138
  if ( $this->settings['show'] ) {
139
  ?>
140
+ <div class="whatsappme whatsappme--<?php echo $this->settings['position']; ?>" data-settings="<?php echo esc_attr(json_encode($this->settings)); ?>">
141
  <div class="whatsappme__button">
142
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M.057 24l1.687-6.163c-1.041-1.804-1.588-3.849-1.587-5.946.003-6.556 5.338-11.891 11.893-11.891 3.181.001 6.167 1.24 8.413 3.488 2.245 2.248 3.481 5.236 3.48 8.414-.003 6.557-5.338 11.892-11.893 11.892-1.99-.001-3.951-.5-5.688-1.448l-6.305 1.654zm6.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" fill="currentColor"/></svg>
143
  </div>
147
  <svg xmlns="http://www.w3.org/2000/svg" width="120" height="28" viewBox="0 0 120 28"><path 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-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.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" fill="currentColor" fill-rule="evenodd"/></svg>
148
  <div class="whatsappme__close">&times;</div>
149
  </header>
150
+ <div class="whatsappme__message"><?php echo $this->formated_message(); ?></div>
151
  </div>
152
  <?php endif; ?>
153
  </div>
156
 
157
  }
158
 
159
+
160
+ /**
161
+ * Format raw message text for html output.
162
+ * Also apply styles transformations like WhatsApp app.
163
+ *
164
+ * @since 1.3.0
165
+ * @return string message formated string
166
+ */
167
+ public function formated_message() {
168
+
169
+ $replacements = apply_filters( 'whatsappme_message_replacements', array(
170
+ '/_(\S[^_]*\S)_/mu' => '<em>$1</em>',
171
+ '/\*(\S[^\*]*\S)\*/mu' => '<strong>$1</strong>',
172
+ '/~(\S[^~]*\S)~/mu' => '<del>$1</del>',
173
+ ) );
174
+
175
+ $replacements_keys = array_keys( $replacements );
176
+
177
+ // Split text into lines and apply replacements line by line
178
+ $lines = explode( "\n", $this->settings['message_text'] );
179
+ foreach ($lines as $key => $line) {
180
+ $lines[$key] = preg_replace( $replacements_keys, $replacements, esc_html( $line ) );
181
+ }
182
+
183
+ return implode( '<br>', $lines );
184
+
185
+ }
186
  }
public/css/whatsappme.css CHANGED
@@ -122,12 +122,34 @@
122
  background-size: 100%;
123
  }
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  @media (max-width: 480px) {
126
  .whatsappme {
127
  bottom: 6px;
128
  right: 6px;
129
  }
130
 
 
 
 
 
 
131
  .whatsappme__box {
132
  width: calc(100vw - 12px);
133
  min-height: 0;
122
  background-size: 100%;
123
  }
124
 
125
+ /* Align left */
126
+
127
+ .whatsappme--left {
128
+ right: auto;
129
+ left: 20px;
130
+ }
131
+
132
+ .whatsappme--left .whatsappme__button {
133
+ right: auto;
134
+ left: 8px;
135
+ }
136
+
137
+ .whatsappme--left .whatsappme__box {
138
+ right: auto;
139
+ left: 0;
140
+ }
141
+
142
  @media (max-width: 480px) {
143
  .whatsappme {
144
  bottom: 6px;
145
  right: 6px;
146
  }
147
 
148
+ .whatsappme--left {
149
+ right: auto;
150
+ left: 6px;
151
+ }
152
+
153
  .whatsappme__box {
154
  width: calc(100vw - 12px);
155
  min-height: 0;
whatsappme.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: WhatsApp me
10
  * Plugin URI: https://crea.me/productos/whatsapp-me/
11
  * Description: Add support to your clients directly with WhatsApp.
12
- * Version: 1.2.0
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', '1.2.0' );
31
 
32
  /**
33
  * The core plugin class that is used to define internationalization,
9
  * Plugin Name: WhatsApp me
10
  * Plugin URI: https://crea.me/productos/whatsapp-me/
11
  * Description: Add support to your clients directly with WhatsApp.
12
+ * Version: 1.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', '1.3.0' );
31
 
32
  /**
33
  * The core plugin class that is used to define internationalization,