WhatsApp me - Version 1.0.1

Version Description

  • Fix text domain
Download this release

Release Info

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

Version 1.0.1

LICENSE.txt ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
README.txt ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WhatsApp me ===
2
+ Contributors: creapuntome, pacotole
3
+ Tags: whatsapp, button, chat, support, contact
4
+ Requires at least: 3.0.1
5
+ Tested up to: 4.9.2
6
+ Requires PHP: 5.3
7
+ Stable tag: 1.0.1
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Add support to your visitors directly with WhatsApp.
12
+
13
+ == Description ==
14
+
15
+ ### The perfect plugin to engage and retain customers.
16
+
17
+ #### Communicate with your customers can be very easy
18
+
19
+ With **WhatsApp me** you will get the visitors of your website to contact you through WhatsApp with a single click.
20
+
21
+ #### Why WhatsApp?
22
+ 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**.
23
+
24
+ Options:
25
+ 1. Phone: Enter the phone number.
26
+ 1. 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).
27
+ 1. Call to action: Write a message to encourage users to contact through WhatsApp.
28
+ 1. Delay: You can define a timeout to display the call-to-action message.
29
+ 1. If you have Google Analytics, an event is triggered when the user launches WhatsApp
30
+
31
+ == Installation ==
32
+
33
+ 1. Upload the entire `whatsappme` folder to the `/wp-content/plugins/` directory.
34
+ 1. Activate the plugin through the 'Plugins' menu in WordPress.
35
+
36
+ == Screenshots ==
37
+
38
+ 1. WhatsApp me settings.
39
+ 2. Button on desktop.
40
+ 3. Call to action on desktop.
41
+ 4. Button and call to action on mobile.
42
+
43
+ == Changelog ==
44
+
45
+ = 1.0.1 =
46
+ * Fix text domain
47
+
48
+ = 1.0.0 =
49
+ * First version
admin/class-whatsappme-admin.php ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The admin-specific functionality of the plugin.
5
+ *
6
+ * Defines the plugin name, version, and two examples hooks for how to
7
+ * enqueue the admin-specific stylesheet and JavaScript.
8
+ *
9
+ * @since 1.0.0
10
+ * @package WhatsAppMe
11
+ * @subpackage WhatsAppMe/admin
12
+ * @author Creame <hola@crea.me>
13
+ */
14
+ class WhatsAppMe_Admin {
15
+
16
+ /**
17
+ * The ID of this plugin.
18
+ *
19
+ * @since 1.0.0
20
+ * @access private
21
+ * @var string $plugin_name The ID of this plugin.
22
+ */
23
+ private $plugin_name;
24
+
25
+ /**
26
+ * The version of this plugin.
27
+ *
28
+ * @since 1.0.0
29
+ * @access private
30
+ * @var string $version The current version of this plugin.
31
+ */
32
+ private $version;
33
+
34
+ /**
35
+ * The setings of this plugin.
36
+ *
37
+ * @since 1.0.0
38
+ * @access private
39
+ * @var array $settings The current settings of this plugin.
40
+ */
41
+ private $settings;
42
+
43
+
44
+ /**
45
+ * Initialize the class and set its properties.
46
+ *
47
+ * @since 1.0.0
48
+ * @param string $plugin_name The name of this plugin.
49
+ * @param string $version The version of this plugin.
50
+ */
51
+ public function __construct( $plugin_name, $version ) {
52
+
53
+ $this->plugin_name = $plugin_name;
54
+ $this->version = $version;
55
+ $this->get_settings();
56
+
57
+ }
58
+
59
+ /**
60
+ * Get all settings or set defaults
61
+ *
62
+ * @since 1.0.0
63
+ */
64
+ private function get_settings() {
65
+
66
+ $this->settings = array(
67
+ 'telephone' => '',
68
+ 'mobile_only' => 'no',
69
+ 'message_text' => '',
70
+ 'message_delay' => 10000,
71
+ );
72
+
73
+ $saved_settings = get_option( 'whatsappme' );
74
+
75
+ if ( is_array( $saved_settings ) ) {
76
+ // clean unused saved settings
77
+ $saved_settings = array_intersect_key( $saved_settings, $this->settings );
78
+ // merge defaults with saved settings
79
+ $this->settings = array_merge( $this->settings, $saved_settings );
80
+ }
81
+
82
+ }
83
+
84
+ /**
85
+ * Initialize the settings for wordpress admin
86
+ *
87
+ * @since 1.0.0
88
+ * @access public
89
+ * @return void
90
+ */
91
+ public function settings_init(){
92
+
93
+ register_setting( 'whatsappme', 'whatsappme', array( $this, 'settings_validate' ) );
94
+ add_settings_section( 'whatsappme_section', null, array( $this, 'section_text' ), 'whatsappme' );
95
+
96
+ $field_names = array(
97
+ 'telephone' => __( 'Telephone', 'creame-whatsapp-me' ),
98
+ 'mobile_only' => __( 'Mobile only', 'creame-whatsapp-me' ),
99
+ 'message_text' => __( 'Call to action', 'creame-whatsapp-me' ),
100
+ 'message_delay' => __( 'Delay', 'creame-whatsapp-me' ),
101
+ );
102
+
103
+ foreach ( $this->settings as $key => $value ) {
104
+ add_settings_field( 'whatsappme_' . $key, $field_names[ $key ], array( $this, 'field_' . $key ), 'whatsappme', 'whatsappme_section' );
105
+ }
106
+ }
107
+
108
+ /**
109
+ * Validate settings, claen and set defaults before save
110
+ *
111
+ * @since 1.0.0
112
+ * @return array
113
+ */
114
+ public function settings_validate($input) {
115
+
116
+ if ( !array_key_exists( 'mobile_only', $input) ){
117
+ $input['mobile_only'] = 'no';
118
+ }
119
+ $input['telephone'] = sanitize_text_field($input['telephone']);
120
+ $input['message_text'] = trim($input['message_text']);
121
+ $input['message_delay'] = intval($input['message_delay']);
122
+
123
+ add_settings_error( 'whatsappme', 'settings_updated', __( 'Settings saved', 'creame-whatsapp-me' ), 'updated' );
124
+
125
+ return $input;
126
+ }
127
+
128
+ /**
129
+ * Section 'whatsappme_section' output
130
+ *
131
+ * @since 1.0.0
132
+ * @return void
133
+ */
134
+ public function section_text() {
135
+ echo '<p>' . __( 'From here you can configure the behavior of the WhatsApp button on your site.', 'creame-whatsapp-me' ) . '</p>';
136
+ }
137
+
138
+ /**
139
+ * Field 'telephone' output
140
+ *
141
+ * @since 1.0.0
142
+ * @return void
143
+ */
144
+ public function field_telephone() {
145
+ echo '<input name="whatsappme[telephone]" value="' . $this->settings['telephone'] . '" class="regular-text" type="text">' .
146
+ '<p class="description">' . __( "Contact phone number. <strong>The button will not be shown if it's empty.</strong>", 'creame-whatsapp-me' ) . '</p>';
147
+ }
148
+
149
+ /**
150
+ * Field 'message_text' output
151
+ *
152
+ * @since 1.0.0
153
+ * @return void
154
+ */
155
+ public function field_message_text() {
156
+ echo '<textarea name="whatsappme[message_text]" rows="3" class="regular-text">' . $this->settings['message_text'] . '</textarea>' .
157
+ '<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>';
158
+ }
159
+
160
+ /**
161
+ * Field 'message_delay' output
162
+ *
163
+ * @since 1.0.0
164
+ * @return void
165
+ */
166
+ public function field_message_delay() {
167
+ echo '<input name="whatsappme[message_delay]" value="' . $this->settings['message_delay'] . '" class="small-text" type="number" min="0"> ' . __( 'milliseconds', 'creame-whatsapp-me' ) .
168
+ '<p class="description"> ' . __( 'The <strong>Call to action</strong> will only be displayed once when the user exceeds the estimated delay on a page. It will also be displayed when the user stops the cursor over the WhatsApp button.', 'creame-whatsapp-me' ) . '</p>';
169
+ }
170
+
171
+ /**
172
+ * Field 'mobile_only' output
173
+ *
174
+ * @since 1.0.0
175
+ * @return void
176
+ */
177
+ public function field_mobile_only() {
178
+ echo '<fieldset><legend class="screen-reader-text"><span>' . __( 'Mobile only', 'creame-whatsapp-me' ) . '</span></legend>' .
179
+ '<label><input name="whatsappme[mobile_only]" value="yes" type="checkbox"' . checked( 'yes', $this->settings['mobile_only'], false ) . '> ' .
180
+ __('Only display the button on mobile devices', 'creame-whatsapp-me' ) . '</label></fieldset>';
181
+ }
182
+
183
+ /**
184
+ * Add menu to the options page in the wordpress admin
185
+ *
186
+ * @since 1.0.0
187
+ * @access public
188
+ * @return void
189
+ */
190
+ public function add_menu() {
191
+
192
+ add_options_page('WhatsApp me', 'WhatsApp me', 'manage_options', 'whatsappme', array( $this, 'options_page' ));
193
+
194
+ }
195
+
196
+ /**
197
+ * Add link to options page on plugins page
198
+ *
199
+ * @since 1.0.0
200
+ * @access public
201
+ * @return void
202
+ */
203
+ public function settings_link( $links ) {
204
+
205
+ $settings_link = '<a href="options-general.php?page=' . $this->plugin_name . '">' . __( 'Settings', 'creame-whatsapp-me' ) . '</a>';
206
+ array_unshift( $links, $settings_link );
207
+ return $links;
208
+
209
+ }
210
+
211
+ /**
212
+ * Generate the options page in the wordpress admin
213
+ *
214
+ * @since 1.0.0
215
+ * @access public
216
+ * @return void
217
+ */
218
+ function options_page() {
219
+ ?>
220
+ <div class="wrap">
221
+ <h1>WhatsApp me</h1>
222
+
223
+ <form method="post" id="whatsappme_form" action="options.php">
224
+ <?php
225
+ settings_fields('whatsappme');
226
+ do_settings_sections('whatsappme');
227
+ submit_button();
228
+ ?>
229
+ </form>
230
+ </div>
231
+ <?php
232
+ }
233
+ }
admin/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
includes/class-whatsappme-i18n.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Define the internationalization functionality.
5
+ *
6
+ * Loads and defines the internationalization files for this plugin
7
+ * so that it is ready for translation.
8
+ *
9
+ * @since 1.0.0
10
+ * @package WhatsAppMe
11
+ * @subpackage WhatsAppMe/includes
12
+ * @author Creame <hola@crea.me>
13
+ */
14
+ class WhatsAppMe_i18n {
15
+
16
+
17
+ /**
18
+ * Load the plugin text domain for translation.
19
+ *
20
+ * @since 1.0.0
21
+ */
22
+ public function load_plugin_textdomain() {
23
+
24
+ load_plugin_textdomain(
25
+ 'creame-whatsapp-me',
26
+ false,
27
+ dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
28
+ );
29
+
30
+ }
31
+
32
+
33
+
34
+ }
includes/class-whatsappme-loader.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Register all actions and filters for the plugin.
5
+ *
6
+ * Maintain a list of all hooks that are registered throughout
7
+ * the plugin, and register them with the WordPress API. Call the
8
+ * run function to execute the list of actions and filters.
9
+ *
10
+ * @since 1.0.0
11
+ * @package WhatsAppMe
12
+ * @subpackage WhatsAppMe/includes
13
+ * @author Creame <hola@crea.me>
14
+ */
15
+ class WhatsAppMe_Loader {
16
+
17
+ /**
18
+ * The array of actions registered with WordPress.
19
+ *
20
+ * @since 1.0.0
21
+ * @access protected
22
+ * @var array $actions The actions registered with WordPress to fire when the plugin loads.
23
+ */
24
+ protected $actions;
25
+
26
+ /**
27
+ * The array of filters registered with WordPress.
28
+ *
29
+ * @since 1.0.0
30
+ * @access protected
31
+ * @var array $filters The filters registered with WordPress to fire when the plugin loads.
32
+ */
33
+ protected $filters;
34
+
35
+ /**
36
+ * Initialize the collections used to maintain the actions and filters.
37
+ *
38
+ * @since 1.0.0
39
+ */
40
+ public function __construct() {
41
+
42
+ $this->actions = array();
43
+ $this->filters = array();
44
+
45
+ }
46
+
47
+ /**
48
+ * Add a new action to the collection to be registered with WordPress.
49
+ *
50
+ * @since 1.0.0
51
+ * @param string $hook The name of the WordPress action that is being registered.
52
+ * @param object $component A reference to the instance of the object on which the action is defined.
53
+ * @param string $callback The name of the function definition on the $component.
54
+ * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
55
+ * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
56
+ */
57
+ public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
58
+ $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
59
+ }
60
+
61
+ /**
62
+ * Add a new filter to the collection to be registered with WordPress.
63
+ *
64
+ * @since 1.0.0
65
+ * @param string $hook The name of the WordPress filter that is being registered.
66
+ * @param object $component A reference to the instance of the object on which the filter is defined.
67
+ * @param string $callback The name of the function definition on the $component.
68
+ * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
69
+ * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
70
+ */
71
+ public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
72
+ $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
73
+ }
74
+
75
+ /**
76
+ * A utility function that is used to register the actions and hooks into a single
77
+ * collection.
78
+ *
79
+ * @since 1.0.0
80
+ * @access private
81
+ * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
82
+ * @param string $hook The name of the WordPress filter that is being registered.
83
+ * @param object $component A reference to the instance of the object on which the filter is defined.
84
+ * @param string $callback The name of the function definition on the $component.
85
+ * @param int $priority The priority at which the function should be fired.
86
+ * @param int $accepted_args The number of arguments that should be passed to the $callback.
87
+ * @return array The collection of actions and filters registered with WordPress.
88
+ */
89
+ private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
90
+
91
+ $hooks[] = array(
92
+ 'hook' => $hook,
93
+ 'component' => $component,
94
+ 'callback' => $callback,
95
+ 'priority' => $priority,
96
+ 'accepted_args' => $accepted_args
97
+ );
98
+
99
+ return $hooks;
100
+
101
+ }
102
+
103
+ /**
104
+ * Register the filters and actions with WordPress.
105
+ *
106
+ * @since 1.0.0
107
+ */
108
+ public function run() {
109
+
110
+ foreach ( $this->filters as $hook ) {
111
+ add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
112
+ }
113
+
114
+ foreach ( $this->actions as $hook ) {
115
+ add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
116
+ }
117
+
118
+ }
119
+
120
+ }
includes/class-whatsappme.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The core plugin class.
5
+ *
6
+ * This is used to define internationalization, admin-specific hooks, and
7
+ * public-facing site hooks.
8
+ *
9
+ * Also maintains the unique identifier of this plugin as well as the current
10
+ * version of the plugin.
11
+ *
12
+ * @since 1.0.0
13
+ * @package WhatsAppMe
14
+ * @subpackage WhatsAppMe/includes
15
+ * @author Creame <hola@crea.me>
16
+ */
17
+ class WhatsAppMe {
18
+
19
+ /**
20
+ * The loader that's responsible for maintaining and registering all hooks that power
21
+ * the plugin.
22
+ *
23
+ * @since 1.0.0
24
+ * @access protected
25
+ * @var WhatsAppMe_Loader $loader Maintains and registers all hooks for the plugin.
26
+ */
27
+ protected $loader;
28
+
29
+ /**
30
+ * The unique identifier of this plugin.
31
+ *
32
+ * @since 1.0.0
33
+ * @access protected
34
+ * @var string $plugin_name The string used to uniquely identify this plugin.
35
+ */
36
+ protected $plugin_name;
37
+
38
+ /**
39
+ * The current version of the plugin.
40
+ *
41
+ * @since 1.0.0
42
+ * @access protected
43
+ * @var string $version The current version of the plugin.
44
+ */
45
+ protected $version;
46
+
47
+ /**
48
+ * Define the core functionality of the plugin.
49
+ *
50
+ * Set the plugin name and the plugin version that can be used throughout the plugin.
51
+ * Load the dependencies, define the locale, and set the hooks for the admin area and
52
+ * the public-facing side of the site.
53
+ *
54
+ * @since 1.0.0
55
+ */
56
+ public function __construct() {
57
+ if ( defined( 'WHATSAPPME_VERSION' ) ) {
58
+ $this->version = WHATSAPPME_VERSION;
59
+ } else {
60
+ $this->version = '1.0.1';
61
+ }
62
+ $this->plugin_name = 'whatsappme';
63
+
64
+ $this->load_dependencies();
65
+ $this->set_locale();
66
+ $this->define_admin_hooks();
67
+ $this->define_public_hooks();
68
+
69
+ }
70
+
71
+ /**
72
+ * Load the required dependencies for this plugin.
73
+ *
74
+ * Include the following files that make up the plugin:
75
+ *
76
+ * - WhatsAppMe_Loader. Orchestrates the hooks of the plugin.
77
+ * - WhatsAppMe_i18n. Defines internationalization functionality.
78
+ * - WhatsAppMe_Admin. Defines all hooks for the admin area.
79
+ * - WhatsAppMe_Public. Defines all hooks for the public side of the site.
80
+ *
81
+ * Create an instance of the loader which will be used to register the hooks
82
+ * with WordPress.
83
+ *
84
+ * @since 1.0.0
85
+ * @access private
86
+ */
87
+ private function load_dependencies() {
88
+
89
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-whatsappme-loader.php';
90
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-whatsappme-i18n.php';
91
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-whatsappme-admin.php';
92
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-whatsappme-public.php';
93
+
94
+ $this->loader = new WhatsAppMe_Loader();
95
+
96
+ }
97
+
98
+ /**
99
+ * Define the locale for this plugin for internationalization.
100
+ *
101
+ * Uses the WhatsAppMe_i18n class in order to set the domain and to register the hook
102
+ * with WordPress.
103
+ *
104
+ * @since 1.0.0
105
+ * @access private
106
+ */
107
+ private function set_locale() {
108
+
109
+ $plugin_i18n = new WhatsAppMe_i18n();
110
+
111
+ $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
112
+
113
+ }
114
+
115
+ /**
116
+ * Register all of the hooks related to the admin area functionality
117
+ * of the plugin.
118
+ *
119
+ * @since 1.0.0
120
+ * @access private
121
+ */
122
+ private function define_admin_hooks() {
123
+
124
+ $plugin_admin = new WhatsAppMe_Admin( $this->get_plugin_name(), $this->get_version() );
125
+
126
+ $this->loader->add_action( 'admin_init', $plugin_admin, 'settings_init' );
127
+ $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_menu' );
128
+
129
+ $this->loader->add_filter( "plugin_action_links_creame-whatsapp-me/{$this->plugin_name}.php", $plugin_admin, 'settings_link' );
130
+
131
+ }
132
+
133
+ /**
134
+ * Register all of the hooks related to the public-facing functionality
135
+ * of the plugin.
136
+ *
137
+ * @since 1.0.0
138
+ * @access private
139
+ */
140
+ private function define_public_hooks() {
141
+
142
+ $plugin_public = new WhatsAppMe_Public( $this->get_plugin_name(), $this->get_version() );
143
+
144
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
145
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
146
+ $this->loader->add_action( 'wp_footer', $plugin_public, 'footer_html' );
147
+
148
+ }
149
+
150
+ /**
151
+ * Run the loader to execute all of the hooks with WordPress.
152
+ *
153
+ * @since 1.0.0
154
+ */
155
+ public function run() {
156
+ $this->loader->run();
157
+ }
158
+
159
+ /**
160
+ * The name of the plugin used to uniquely identify it within the context of
161
+ * WordPress and to define internationalization functionality.
162
+ *
163
+ * @since 1.0.0
164
+ * @return string The name of the plugin.
165
+ */
166
+ public function get_plugin_name() {
167
+ return $this->plugin_name;
168
+ }
169
+
170
+ /**
171
+ * The reference to the class that orchestrates the hooks with the plugin.
172
+ *
173
+ * @since 1.0.0
174
+ * @return WhatsAppMe_Loader Orchestrates the hooks of the plugin.
175
+ */
176
+ public function get_loader() {
177
+ return $this->loader;
178
+ }
179
+
180
+ /**
181
+ * Retrieve the version number of the plugin.
182
+ *
183
+ * @since 1.0.0
184
+ * @return string The version number of the plugin.
185
+ */
186
+ public function get_version() {
187
+ return $this->version;
188
+ }
189
+
190
+ }
includes/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/creame-whatsapp-me-es_ES.mo ADDED
Binary file
languages/creame-whatsapp-me-es_ES.po ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WordPress Blank Pot
2
+ # Copyright (C) 2014 ...
3
+ # This file is distributed under the GNU General Public License v2 or later.
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: WhatsApp me\n"
7
+ "Report-Msgid-Bugs-To: Translator Name <translations@example.com>\n"
8
+ "POT-Creation-Date: 2018-02-12 19:16+0100\n"
9
+ "PO-Revision-Date: \n"
10
+ "Last-Translator: Pacotole <pacotole@crea.me>\n"
11
+ "Language-Team: Creame <hola@crea.me>\n"
12
+ "Language: es_ES\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: 8bit\n"
16
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
+ "X-Textdomain-Support: yesX-Generator: Poedit 1.6.4\n"
18
+ "X-Poedit-SourceCharset: UTF-8\n"
19
+ "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
20
+ "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
21
+ "_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
22
+ "X-Poedit-Basepath: ..\n"
23
+ "X-Generator: Poedit 1.8.7.1\n"
24
+ "X-Poedit-SearchPath-0: .\n"
25
+
26
+ #: admin/class-whatsappme-admin.php:97
27
+ msgid "Telephone"
28
+ msgstr "Teléfono"
29
+
30
+ #: admin/class-whatsappme-admin.php:98 admin/class-whatsappme-admin.php:178
31
+ msgid "Mobile only"
32
+ msgstr "Solo Móvil"
33
+
34
+ #: admin/class-whatsappme-admin.php:99
35
+ msgid "Call to action"
36
+ msgstr "Llamada a la acción"
37
+
38
+ #: admin/class-whatsappme-admin.php:100
39
+ msgid "Delay"
40
+ msgstr "Retardo"
41
+
42
+ #: admin/class-whatsappme-admin.php:123
43
+ msgid "Settings saved"
44
+ msgstr "Ajustes guardados"
45
+
46
+ #: admin/class-whatsappme-admin.php:135
47
+ msgid ""
48
+ "From here you can configure the behavior of the WhatsApp button on your site."
49
+ msgstr ""
50
+ "Desde aquí puedes configurar el comportamiento del botón de WhatsApp en tu "
51
+ "sitio web."
52
+
53
+ #: admin/class-whatsappme-admin.php:146
54
+ msgid ""
55
+ "Contact phone number. <strong>The button will not be shown if it's empty.</"
56
+ "strong>"
57
+ msgstr ""
58
+ "Número de teléfono de contacto. <strong>El botón no se mostrará si está "
59
+ "vacío.</strong>"
60
+
61
+ #: admin/class-whatsappme-admin.php:157
62
+ msgid ""
63
+ "Optional text to invite the user to use the contact via WhatsApp. "
64
+ "<strong>Leave empty to disable.</strong>"
65
+ msgstr ""
66
+ "Texto opcional para invitar al usuario a usar el contacto por WhatsApp. "
67
+ "<strong>Dejar vacío para desactivarlo.</strong>"
68
+
69
+ #: admin/class-whatsappme-admin.php:167
70
+ msgid "milliseconds"
71
+ msgstr "milisegundos"
72
+
73
+ #: admin/class-whatsappme-admin.php:168
74
+ msgid ""
75
+ "The <strong>Call to action</strong> will only be displayed once when the "
76
+ "user exceeds the estimated delay on a page. It will also be displayed when "
77
+ "the user stops the cursor over the WhatsApp button."
78
+ msgstr ""
79
+ "La <strong>llamada a la acción</strong> sólo se mostrará una única vez "
80
+ "cuando el usuario supere el retardo estimado en una página. También se "
81
+ "mostrará cuando el usuario detenga el cursor sobre el botón de WhastApp."
82
+
83
+ #: admin/class-whatsappme-admin.php:180
84
+ msgid "Only display the button on mobile devices"
85
+ msgstr "Solo mostrar el botón en móviles"
86
+
87
+ #: admin/class-whatsappme-admin.php:205
88
+ msgid "Settings"
89
+ msgstr "Ajustes"
90
+
91
+ #. Name of the plugin
92
+ msgid "WhatsApp me"
93
+ msgstr "WhatsApp me"
94
+
95
+ #. Description of the theme
96
+ msgid "Add support to your clients directly with WhatsApp."
97
+ msgstr "Da soporte a tus clientes directamente con WhatsApp."
98
+
99
+ #. URI of the plugin
100
+ msgid "https://github.com/creame/whatsappme"
101
+ msgstr "https://github.com/creame/whatsappme"
102
+
103
+ #. Author of the plugin
104
+ msgid "Creame"
105
+ msgstr "Creame"
106
+
107
+ #. Author URI of the plugin
108
+ msgid "https://crea.me"
109
+ msgstr "https://crea.me"
languages/creame-whatsapp-me.pot ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #, fuzzy
2
+ msgid ""
3
+ msgstr ""
4
+ "Project-Id-Version: WhatsApp Me\n"
5
+ "POT-Creation-Date: 2018-02-12 18:14+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"
9
+ "Report-Msgid-Bugs-To: Translator Name <translations@example.com>\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION\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;_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: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
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
+ msgid "WhatsApp me"
82
+ msgstr ""
83
+
84
+ #. Description of the theme
85
+ msgid "Add support to your clients directly with WhatsApp."
86
+ msgstr ""
87
+
88
+ #. URI of the plugin
89
+ msgid "https://github.com/creame/whatsappme"
90
+ msgstr ""
91
+
92
+ #. Author of the plugin
93
+ msgid "Creame"
94
+ msgstr ""
95
+
96
+ #. Author URI of the plugin
97
+ msgid "https://crea.me"
98
+ msgstr ""
public/class-whatsappme-public.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The public-facing functionality of the plugin.
5
+ *
6
+ * Defines the plugin name, version, and two examples hooks for how to
7
+ * enqueue the public-facing stylesheet and JavaScript.
8
+ *
9
+ * @package WhatsAppMe
10
+ * @subpackage WhatsAppMe/public
11
+ * @author Creame <hola@crea.me>
12
+ */
13
+ class WhatsAppMe_Public {
14
+
15
+ /**
16
+ * The ID of this plugin.
17
+ *
18
+ * @since 1.0.0
19
+ * @access private
20
+ * @var string $plugin_name The ID of this plugin.
21
+ */
22
+ private $plugin_name;
23
+
24
+ /**
25
+ * The version of this plugin.
26
+ *
27
+ * @since 1.0.0
28
+ * @access private
29
+ * @var string $version The current version of this plugin.
30
+ */
31
+ private $version;
32
+
33
+ /**
34
+ * The setings of this plugin.
35
+ *
36
+ * @since 1.0.0
37
+ * @access private
38
+ * @var array $settings The current settings of this plugin.
39
+ */
40
+ private $settings;
41
+
42
+ /**
43
+ * Initialize the class and set its properties.
44
+ *
45
+ * @since 1.0.0
46
+ * @param string $plugin_name The name of the plugin.
47
+ * @param string $version The version of this plugin.
48
+ */
49
+ public function __construct( $plugin_name, $version ) {
50
+
51
+ $this->plugin_name = $plugin_name;
52
+ $this->version = $version;
53
+ $this->get_settings();
54
+
55
+ }
56
+
57
+ /**
58
+ * Get all settings or set defaults
59
+ *
60
+ * @since 1.0.0
61
+ */
62
+ private function get_settings() {
63
+
64
+ $this->settings = array(
65
+ 'telephone' => '',
66
+ 'message_text' => '',
67
+ 'message_delay' => 10000,
68
+ 'mobile_only' => 'no',
69
+ );
70
+
71
+ $saved_settings = get_option( 'whatsappme' );
72
+
73
+ if ( is_array( $saved_settings ) ) {
74
+ // clean unused saved settings
75
+ $saved_settings = array_intersect_key( $saved_settings, $this->settings );
76
+ // merge defaults with saved settings
77
+ $this->settings = array_merge( $this->settings, $saved_settings );
78
+ }
79
+
80
+ }
81
+
82
+ /**
83
+ * Register the stylesheets for the public-facing side of the site.
84
+ *
85
+ * @since 1.0.0
86
+ */
87
+ public function enqueue_styles() {
88
+
89
+ wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/whatsappme.css', array(), $this->version, 'all' );
90
+
91
+ }
92
+
93
+ /**
94
+ * Register the JavaScript for the public-facing side of the site.
95
+ *
96
+ * @since 1.0.0
97
+ */
98
+ public function enqueue_scripts() {
99
+
100
+ wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/whatsappme.js', array( 'jquery' ), $this->version, false );
101
+
102
+ }
103
+
104
+ /**
105
+ * Outputs WhatsApp button html and his settings on footer
106
+ *
107
+ * @since 1.0.0
108
+ */
109
+ public function footer_html() {
110
+
111
+ if ( $this->settings['telephone']) {
112
+ ?>
113
+ <div class="whatsappme" data-settings="<?php echo esc_attr(json_encode($this->settings)); ?>">
114
+ <div class="whatsappme__button">
115
+ <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>
116
+ </div>
117
+ <?php if ($this->settings['message_text']): ?>
118
+ <div class="whatsappme__box">
119
+ <header class="whatsappme__header">
120
+ <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.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" fill="currentColor" fill-rule="evenodd"/></svg>
121
+ <div class="whatsappme__close">&times;</div>
122
+ </header>
123
+ <div class="whatsappme__message"><?php echo nl2br(esc_html($this->settings['message_text'])); ?></div>
124
+ </div>
125
+ <?php endif; ?>
126
+ </div>
127
+ <?php
128
+ }
129
+
130
+ }
131
+ }
public/css/whatsappme.css ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .whatsappme {
2
+ position: fixed;
3
+ z-index: 400;
4
+ right: 20px;
5
+ bottom: 20px;
6
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
7
+ font-size: 16px;
8
+ line-height: 26px;
9
+ color: #262626;
10
+ transform: scale3d(0, 0, 0);
11
+ transition: transform .3s ease-in-out;
12
+ user-select: none;
13
+ }
14
+
15
+ .whatsappme--show {
16
+ transform: scale3d(1, 1, 1);
17
+ transition: transform .5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
18
+ }
19
+
20
+ .whatsappme__button {
21
+ position: absolute;
22
+ z-index: 2;
23
+ bottom: 8px;
24
+ right: 8px;
25
+ height: 60px;
26
+ min-width: 60px;
27
+ max-width: 95vw;
28
+ background-color: #25D366;
29
+ color: #fff;
30
+ border-radius: 30px;
31
+ box-shadow: 1px 6px 24px 0 rgba(7, 94, 84, .24);
32
+ cursor: pointer;
33
+ transition: background-color 500ms ease-in-out;
34
+ }
35
+
36
+ .whatsappme__button svg {
37
+ width: 36px;
38
+ height: 60px;
39
+ margin: 0 12px;
40
+ }
41
+
42
+ .whatsappme--dialog .whatsappme__button {
43
+ box-shadow: 0 1px 2px 0 rgba(0,0,0,0.3);
44
+ }
45
+
46
+ .whatsappme__box {
47
+ position: absolute;
48
+ bottom: 0;
49
+ right: 0;
50
+ z-index: 1;
51
+ width: calc(100vw - 40px);
52
+ max-width: 400px;
53
+ min-height: 280px;
54
+ padding-bottom: 60px;
55
+ border-radius: 32px;
56
+ background: #ede4dd url(../images/background.png) center repeat-y;
57
+ background-size: 100% auto;
58
+ box-shadow: 0 2px 6px 0 rgba(0, 0, 0, .5);
59
+ overflow: hidden;
60
+ transform: scale3d(0, 0, 0);
61
+ opacity: 0;
62
+ transition: opacity 300ms ease-out, transform 0ms linear 300ms;
63
+ }
64
+
65
+ .whatsappme--dialog .whatsappme__box {
66
+ opacity: 1;
67
+ transform: scale3d(1, 1, 1);
68
+ transition: opacity 100ms ease-out, transform 0ms linear;
69
+ }
70
+
71
+ .whatsappme__header {
72
+ height: 70px;
73
+ padding: 0 26px;
74
+ background-color: #2e8c7d;
75
+ color: rgba(255, 255, 255, .5);
76
+ }
77
+
78
+ .whatsappme__header svg {
79
+ height: 100%;
80
+ }
81
+
82
+ .whatsappme__close {
83
+ position: absolute;
84
+ top: 18px;
85
+ right: 24px;
86
+ width: 34px;
87
+ height: 34px;
88
+ border-radius: 50%;
89
+ background: #000;
90
+ color: #fff;
91
+ line-height: 34px;
92
+ font-size: 25px;
93
+ text-align: center;
94
+ opacity: .4;
95
+ cursor: pointer;
96
+ transition: opacity 300ms ease-out;
97
+ }
98
+ .whatsappme__close:hover {
99
+ opacity: .6;
100
+ }
101
+
102
+ .whatsappme__message {
103
+ position: relative;
104
+ min-height: 80px;
105
+ padding: 20px 22px;
106
+ margin: 34px 26px;
107
+ border-radius: 32px;
108
+ background-color: #fff;
109
+ color: #4A4A4A;
110
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
111
+ }
112
+
113
+ .whatsappme__message:before {
114
+ content: '';
115
+ display: block;
116
+ position: absolute;
117
+ bottom: 30px;
118
+ left: -18px;
119
+ width: 18px;
120
+ height: 18px;
121
+ 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=');
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;
134
+ }
135
+
136
+ .whatsappme__header {
137
+ height: 55px;
138
+ }
139
+
140
+ .whatsappme__close {
141
+ top: 13px;
142
+ width: 28px;
143
+ height: 28px;
144
+ line-height: 28px;
145
+ }
146
+
147
+ .whatsappme__message {
148
+ padding: 14px 20px;
149
+ margin: 15px 21px 20px;
150
+ line-height: 24px;
151
+ }
152
+ }
public/images/background.png ADDED
Binary file
public/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/js/whatsappme.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
+ 'use strict';
3
+
4
+ $(function () {
5
+ var delay_on_start = 3000;
6
+ var $whatsappme = $('.whatsappme');
7
+
8
+ // only works if whatsappme is defined
9
+ if ($whatsappme.length && typeof ($whatsappme.data('settings')) == 'object') {
10
+ whatsappme_magic();
11
+ }
12
+
13
+ function whatsappme_magic() {
14
+ var is_mobile = !!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);
15
+ var timeoutID = null;
16
+ var settings = $whatsappme.data('settings');
17
+
18
+ // stored values
19
+ var is_clicked = localStorage.whatsappme_click == 'yes';
20
+ var views = settings.message_text === '' ? 0 : parseInt(localStorage.whatsappme_views || 0) + 1;
21
+ localStorage.whatsappme_views = views;
22
+
23
+ // show button / dialog
24
+ if (settings.mobile_only == 'no' || is_mobile) {
25
+ setTimeout(function () {
26
+ $whatsappme.addClass('whatsappme--show');
27
+ }, delay_on_start);
28
+ if (views > 1 && !is_clicked) {
29
+ setTimeout(function () {
30
+ $whatsappme.addClass('whatsappme--dialog');
31
+ }, delay_on_start + settings.message_delay);
32
+ }
33
+ }
34
+
35
+ if (!is_mobile && settings.message_text !== '') {
36
+ $('.whatsappme__button').mouseenter(function () {
37
+ timeoutID = setTimeout(function () {
38
+ $whatsappme.addClass('whatsappme--dialog');
39
+ }, 1600);
40
+ }).mouseleave(function () {
41
+ clearTimeout(timeoutID);
42
+ });
43
+ }
44
+
45
+ $('.whatsappme__button').click(function () {
46
+ $whatsappme.removeClass('whatsappme--dialog');
47
+ localStorage.whatsappme_click = 'yes';
48
+
49
+ // Send Google Analytics event
50
+ if (typeof (ga) !== 'undefined') {
51
+ ga('send', 'event', 'WhatsAppMe', 'click');
52
+ }
53
+
54
+ // open WhatsApp link
55
+ window.open('https://api.whatsapp.com/send?phone=' + settings.telephone, 'whatsappme');
56
+ });
57
+
58
+ $('.whatsappme__close').click(function () {
59
+ $whatsappme.removeClass('whatsappme--dialog');
60
+ localStorage.whatsappme_click = 'yes';
61
+ });
62
+ }
63
+
64
+ });
65
+
66
+ })(jQuery);
uninstall.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired when the plugin is uninstalled.
5
+ *
6
+ * @link https://crea.me
7
+ * @since 1.0.0
8
+ *
9
+ * @package WhatsAppMe
10
+ */
11
+
12
+ // If uninstall not called from WordPress, then exit.
13
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
14
+ exit;
15
+ }
16
+
17
+ // Delete option added by plugin
18
+ delete_option( 'whatsappme' );
whatsappme.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @link https://crea.me
5
+ * @since 1.0.0
6
+ * @package WhatsAppMe
7
+ *
8
+ * @wordpress-plugin
9
+ * Plugin Name: WhatsApp me
10
+ * Plugin URI: https://github.com/creame/whatsappme
11
+ * Description: Add support to your clients directly with WhatsApp.
12
+ * Version: 1.0.1
13
+ * Author: Creame
14
+ * Author URI: https://crea.me
15
+ * License: GPL-2.0+
16
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
17
+ * Text Domain: creame-whatsapp-me
18
+ * Domain Path: /languages
19
+ */
20
+
21
+ // If this file is called directly, abort.
22
+ if ( ! defined( 'WPINC' ) ) {
23
+ die;
24
+ }
25
+
26
+ /**
27
+ * Currently plugin version.
28
+ * Start at version 1.0.0 and use SemVer - https://semver.org
29
+ */
30
+ define( 'WHATSAPPME_VERSION', '1.0.1' );
31
+
32
+ /**
33
+ * The core plugin class that is used to define internationalization,
34
+ * admin-specific hooks, and public-facing site hooks.
35
+ */
36
+ require plugin_dir_path( __FILE__ ) . 'includes/class-whatsappme.php';
37
+
38
+ /**
39
+ * Begins execution of the plugin.
40
+ *
41
+ * Since everything within the plugin is registered via hooks,
42
+ * then kicking off the plugin from this point in the file does
43
+ * not affect the page life cycle.
44
+ *
45
+ * @since 1.0.0
46
+ */
47
+ function run_whatsappme() {
48
+
49
+ $plugin = new WhatsAppMe();
50
+ $plugin->run();
51
+
52
+ }
53
+ run_whatsappme();