Contact Form & SMTP Plugin for WordPress by PirateForms - Version 1.2.5

Version Description

  • 2017-07-30
Download this release

Release Info

Developer codeinwp
Plugin Icon 128x128 Contact Form & SMTP Plugin for WordPress by PirateForms
Version 1.2.5
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.5

Files changed (73) hide show
  1. CHANGELOG.md +6 -13
  2. LICENSE.txt +339 -0
  3. admin/class-pirateforms-admin.php +554 -0
  4. admin/css/wp-admin.css +293 -0
  5. admin/index.php +1 -0
  6. admin/js/scripts-admin.js +65 -0
  7. admin/partials/pirateforms-settings-display.php +316 -0
  8. admin/partials/pirateforms-settings-sidebar-subscribe.php +45 -0
  9. admin/partials/pirateforms-settings-sidebar-theme.php +36 -0
  10. bin/deploy.sh +0 -71
  11. bin/install-dependencies.sh +0 -40
  12. bin/install-wp-tests.sh +0 -127
  13. bin/prepare-deploy.sh +0 -46
  14. css/front.css +1 -1
  15. css/wp-admin.css +20 -5
  16. inc/settings.php +36 -0
  17. includes/class-pirateforms-activator.php +36 -0
  18. includes/class-pirateforms-deactivator.php +36 -0
  19. includes/class-pirateforms-i18n.php +47 -0
  20. includes/class-pirateforms-loader.php +129 -0
  21. includes/class-pirateforms-phpformbuilder.php +607 -0
  22. includes/class-pirateforms-util.php +78 -0
  23. includes/class-pirateforms-widget.php +99 -0
  24. includes/class-pirateforms.php +248 -0
  25. includes/index.php +1 -0
  26. index.php +1 -0
  27. languages/pirate-forms.pot +187 -155
  28. pirate-forms.php +110 -756
  29. public/class-pirateforms-public.php +826 -0
  30. public/css/front.css +49 -0
  31. public/index.php +1 -0
  32. public/js/scripts-general.js +18 -0
  33. public/js/scripts.js +23 -0
  34. public/partials/pirateforms-form.php +76 -0
  35. readme.txt +19 -4
  36. tests/bootstrap.php +0 -34
  37. tests/test-pirate-forms.php +0 -21
  38. uninstall.php +34 -0
  39. vendor/autoload.php +7 -0
  40. vendor/autoload_52.php +7 -0
  41. vendor/codeinwp/themeisle-sdk/LICENSE +674 -0
  42. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-deactivate.php +357 -0
  43. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-factory.php +50 -0
  44. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-review.php +174 -0
  45. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback.php +88 -0
  46. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php +683 -0
  47. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php +88 -0
  48. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php +204 -0
  49. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-notification-manager.php +119 -0
  50. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php +392 -0
  51. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget-dashboard-blog.php +354 -0
  52. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget.php +50 -0
  53. vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widgets-factory.php +37 -0
  54. vendor/codeinwp/themeisle-sdk/composer.json +24 -0
  55. vendor/codeinwp/themeisle-sdk/index.php +5 -0
  56. vendor/codeinwp/themeisle-sdk/load.php +35 -0
  57. vendor/codeinwp/themeisle-sdk/start.php +35 -0
  58. vendor/composer/ClassLoader.php +413 -0
  59. vendor/composer/ClassLoader52.php +271 -0
  60. vendor/composer/LICENSE +21 -0
  61. vendor/composer/autoload_classmap.php +9 -0
  62. vendor/composer/autoload_files.php +10 -0
  63. vendor/composer/autoload_namespaces.php +10 -0
  64. vendor/composer/autoload_psr4.php +9 -0
  65. vendor/composer/autoload_real.php +59 -0
  66. vendor/composer/autoload_real_52.php +46 -0
  67. vendor/composer/installed.json +78 -0
  68. vendor/xrstf/composer-php52/LICENSE +19 -0
  69. vendor/xrstf/composer-php52/README.md +37 -0
  70. vendor/xrstf/composer-php52/composer.json +26 -0
  71. vendor/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php +346 -0
  72. vendor/xrstf/composer-php52/lib/xrstf/Composer52/ClassLoader.php +271 -0
  73. vendor/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php +39 -0
CHANGELOG.md CHANGED
@@ -1,16 +1,12 @@
1
 
2
- ### v1.2.0 - 2017-05-08
3
  **Changes:**
4
- - Changed sent email format to a HTML type
 
 
 
 
5
 
6
-
7
-
8
-
9
- Update readme.txt
10
-
11
-
12
-
13
-
14
- Improved description
15
-
16
 
17
 
18
 
19
- Fixed security error for file field.
1
 
2
+ ### v1.2.5 - 2017-07-30
3
  **Changes:**
4
+
5
+ ### v1.2.5 - 2017-05-31
6
+ **Changes:**
7
+ - Added themeisle-sdk.
8
+ - Added new deployment stack.
9
 
 
 
 
 
 
 
 
 
 
 
10
 
11
 
12
 
 
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.
admin/class-pirateforms-admin.php ADDED
@@ -0,0 +1,554 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The admin-specific functionality of the plugin.
5
+ *
6
+ * @link http://example.com
7
+ * @since 1.0.0
8
+ *
9
+ * @package PirateForms
10
+ * @subpackage PirateForms/admin
11
+ */
12
+
13
+ /**
14
+ * The admin-specific functionality of the plugin.
15
+ *
16
+ * Defines the plugin name, version, and two examples hooks for how to
17
+ * enqueue the admin-specific stylesheet and JavaScript.
18
+ *
19
+ * @package PirateForms
20
+ * @subpackage PirateForms/admin
21
+ * @author Your Name <email@example.com>
22
+ */
23
+ class PirateForms_Admin {
24
+
25
+ /**
26
+ * The ID of this plugin.
27
+ *
28
+ * @since 1.0.0
29
+ * @access private
30
+ * @var string $plugin_name The ID of this plugin.
31
+ */
32
+ private $plugin_name;
33
+
34
+ /**
35
+ * The version of this plugin.
36
+ *
37
+ * @since 1.0.0
38
+ * @access private
39
+ * @var string $version The current version of this plugin.
40
+ */
41
+ private $version;
42
+
43
+ /**
44
+ * Initialize the class and set its properties.
45
+ *
46
+ * @since 1.0.0
47
+ * @param string $plugin_name The name of this plugin.
48
+ * @param string $version The version of this plugin.
49
+ */
50
+ public function __construct( $plugin_name, $version ) {
51
+
52
+ $this->plugin_name = $plugin_name;
53
+ $this->version = $version;
54
+
55
+ }
56
+
57
+ /**
58
+ * Register the stylesheets for the admin area.
59
+ *
60
+ * @since 1.0.0
61
+ */
62
+ public function enqueue_styles_and_scripts() {
63
+ global $pagenow;
64
+ if ( ! empty( $pagenow ) && ( $pagenow == 'options-general.php' || $pagenow == 'admin.php' )
65
+ && isset( $_GET['page'] ) && $_GET['page'] == 'pirateforms-admin'
66
+ ) {
67
+ wp_enqueue_style( 'pirateforms_admin_styles', PIRATEFORMS_URL . 'admin/css/wp-admin.css', array(), $this->version );
68
+ wp_enqueue_script( 'pirateforms_scripts_admin', PIRATEFORMS_URL . 'admin/js/scripts-admin.js', array( 'jquery' ), $this->version );
69
+ wp_localize_script( 'pirateforms_scripts_admin', 'cwp_top_ajaxload', array(
70
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
71
+ ) );
72
+ }
73
+ }
74
+
75
+
76
+ /**
77
+ * Loads the sidebar
78
+ *
79
+ * @since 1.0.0
80
+ */
81
+ public function load_sidebar() {
82
+ ob_start();
83
+ do_action( 'pirate_forms_load_sidebar_theme' );
84
+ do_action( 'pirate_forms_load_sidebar_subscribe' );
85
+ echo ob_get_clean();
86
+ }
87
+
88
+ /**
89
+ * Loads the theme-specific sidebar box
90
+ *
91
+ * @since 1.0.0
92
+ */
93
+ public function load_sidebar_theme() {
94
+ include_once PIRATEFORMS_DIR . 'admin/partials/pirateforms-settings-sidebar-theme.php';
95
+ }
96
+
97
+ /**
98
+ * Loads the sidebar subscription box
99
+ *
100
+ * @since 1.0.0
101
+ */
102
+ public function load_sidebar_subscribe() {
103
+ include_once PIRATEFORMS_DIR . 'admin/partials/pirateforms-settings-sidebar-subscribe.php';
104
+ }
105
+
106
+ /**
107
+ * Add the settings link in the plugin page
108
+ *
109
+ * @since 1.0.0
110
+ */
111
+ public function add_settings_link( $links ) {
112
+ $settings_link = '<a href="options-general.php?page=pirateforms-admin">' . __( 'Settings', 'pirate-forms' ) . '</a>';
113
+ if ( function_exists( 'array_unshift' ) ) :
114
+ array_unshift( $links, $settings_link );
115
+ else :
116
+ array_push( $links, $settings_link );
117
+ endif;
118
+
119
+ return $links;
120
+ }
121
+
122
+ /**
123
+ *
124
+ * Add page to the dashbord menu
125
+ *
126
+ * @since 1.0.0
127
+ */
128
+ public function add_to_admin() {
129
+ add_menu_page( PIRATEFORMS_NAME, PIRATEFORMS_NAME, 'manage_options', 'pirateforms-admin', array( $this, 'pirate_forms_admin' ), 'dashicons-feedback' );
130
+ add_submenu_page( 'pirateforms-admin', PIRATEFORMS_NAME, __( 'Settings', 'pirate-forms' ), 'manage_options', 'pirateforms-admin', array( $this, 'pirate_forms_admin' ) );
131
+ }
132
+
133
+
134
+ /**
135
+ * Admin area setting page for the plugin
136
+ *
137
+ * @since 1.0.0
138
+ */
139
+ function pirate_forms_admin() {
140
+ global $current_user;
141
+ $pirate_forms_options = PirateForms_Util::get_option();
142
+ $plugin_options = $this->pirate_forms_plugin_options();
143
+ include_once PIRATEFORMS_DIR . 'admin/partials/pirateforms-settings-display.php';
144
+ }
145
+ /**
146
+ * ******** Save default options if none exist ***********/
147
+ public function settings_init() {
148
+ if ( ! PirateForms_Util::get_option() ) {
149
+ $new_opt = array();
150
+ foreach ( $this->pirate_forms_plugin_options() as $temparr ) {
151
+ foreach ( $temparr as $key => $opt ) {
152
+ $new_opt[ $key ] = $opt[3];
153
+ }
154
+ }
155
+ PirateForms_Util::set_option( $new_opt );
156
+ }
157
+ }
158
+
159
+ /**
160
+ * Get the list of all pages
161
+ *
162
+ * @since 1.0.0
163
+ */
164
+ function pirate_forms_get_pages_array( $type = 'page' ) {
165
+ $content = array(
166
+ '' => __( 'None', 'pirate-forms' ),
167
+ );
168
+ $items = get_posts( array(
169
+ 'post_type' => $type,
170
+ 'numberposts' => - 1,
171
+ ) );
172
+ if ( ! empty( $items ) ) :
173
+ foreach ( $items as $item ) :
174
+ $content[ $item->ID ] = $item->post_title;
175
+ endforeach;
176
+ endif;
177
+
178
+ return $content;
179
+
180
+ }
181
+
182
+ /**
183
+ *
184
+ * OPTIONS
185
+ *
186
+ * @since 1.0.0
187
+ * name; id; desc; type; default; options
188
+ */
189
+ function pirate_forms_plugin_options() {
190
+ /**
191
+ ********** Default values from Zerif Lite */
192
+ $zerif_contactus_sitekey = get_theme_mod( 'zerif_contactus_sitekey' );
193
+ if ( ! empty( $zerif_contactus_sitekey ) ) :
194
+ $pirate_forms_contactus_sitekey = $zerif_contactus_sitekey;
195
+ else :
196
+ $pirate_forms_contactus_sitekey = '';
197
+ endif;
198
+ $zerif_contactus_secretkey = get_theme_mod( 'zerif_contactus_secretkey' );
199
+ if ( ! empty( $zerif_contactus_secretkey ) ) :
200
+ $pirate_forms_contactus_secretkey = $zerif_contactus_secretkey;
201
+ else :
202
+ $pirate_forms_contactus_secretkey = '';
203
+ endif;
204
+ $zerif_contactus_recaptcha_show = get_theme_mod( 'zerif_contactus_recaptcha_show' );
205
+ if ( isset( $zerif_contactus_recaptcha_show ) && ( $zerif_contactus_recaptcha_show == '1' ) ) :
206
+ $pirate_forms_contactus_recaptcha_show = '';
207
+ else :
208
+ $pirate_forms_contactus_recaptcha_show = 'yes';
209
+ endif;
210
+ $zerif_contactus_button_label = get_theme_mod( 'zerif_contactus_button_label', __( 'Send Message', 'pirate-forms' ) );
211
+ if ( ! empty( $zerif_contactus_button_label ) ) :
212
+ $pirate_forms_contactus_button_label = $zerif_contactus_button_label;
213
+ else :
214
+ $pirate_forms_contactus_button_label = __( 'Send Message', 'pirate-forms' );
215
+ endif;
216
+ $zerif_contactus_email = get_theme_mod( 'zerif_contactus_email' );
217
+ $zerif_email = get_theme_mod( 'zerif_email' );
218
+ $pirate_forms_contactus_email = '';
219
+ if ( ! empty( $zerif_contactus_email ) ) :
220
+ $pirate_forms_contactus_email = $zerif_contactus_email;
221
+ elseif ( ! empty( $zerif_email ) ) :
222
+ $pirate_forms_contactus_email = $zerif_email;
223
+ else :
224
+ $pirate_forms_contactus_email = get_bloginfo( 'admin_email' );
225
+ endif;
226
+
227
+ return array(
228
+ 'fourth_tab' => array(
229
+ 'header_options' => array(
230
+ __( 'Form processing options', 'pirate-forms' ),
231
+ '',
232
+ 'title',
233
+ '',
234
+ ),
235
+ 'pirateformsopt_email' => array(
236
+ __( 'Contact notification sender email', 'pirate-forms' ),
237
+ '<strong>' . __( "Insert [email] to use the contact form submitter's email.", 'pirate-forms' ) . '</strong><br>' . __( "Email to use for the sender of the contact form emails both to the recipients below and the contact form submitter (if this is activated below). The domain for this email address should match your site's domain.", 'pirate-forms' ),
238
+ 'text',
239
+ PirateForms_Util::get_from_email(),
240
+ ),
241
+ 'pirateformsopt_email_recipients' => array(
242
+ __( 'Contact submission recipients', 'pirate-forms' ),
243
+ __( 'Email address(es) to receive contact submission notifications. You can separate multiple emails with a comma.', 'pirate-forms' ),
244
+ 'text',
245
+ PirateForms_Util::get_option( 'pirateformsopt_email' ) ? PirateForms_Util::get_option( 'pirateformsopt_email' ) : $pirate_forms_contactus_email,
246
+ ),
247
+ 'pirateformsopt_store' => array(
248
+ __( 'Store submissions in the database', 'pirate-forms' ),
249
+ __( 'Should the submissions be stored in the admin area? If chosen, contact form submissions will be saved in Contacts on the left (appears after this option is activated).', 'pirate-forms' ),
250
+ 'checkbox',
251
+ 'yes',
252
+ ),
253
+ 'pirateformsopt_nonce' => array(
254
+ __( 'Add a nonce to the contact form:', 'pirate-forms' ),
255
+ __( 'Should the form use a WordPress nonce? This helps reduce spam by ensuring that the form submittor is on the site when submitting the form rather than submitting remotely. This could, however, cause problems with sites using a page caching plugin. Turn this off if you are getting complaints about forms not being able to be submitted with an error of "Nonce failed!"', 'pirate-forms' ),
256
+ 'checkbox',
257
+ 'yes',
258
+ ),
259
+ 'pirateformsopt_confirm_email' => array(
260
+ __( 'Send email confirmation to form submitter', 'pirate-forms' ),
261
+ __( 'Adding text here will send an email to the form submitter. The email uses the "Successful form submission text" field from the "Alert Messages" tab as the subject line. Plain text only here, no HTML.', 'pirate-forms' ),
262
+ 'textarea',
263
+ '',
264
+ ),
265
+ 'pirateformsopt_thank_you_url' => array(
266
+ __( '"Thank You" URL', 'pirate-forms' ),
267
+ __( 'Select the post-submit page for all forms submitted', 'pirate-forms' ),
268
+ 'select',
269
+ '',
270
+ $this->pirate_forms_get_pages_array(),
271
+ ),
272
+ ),
273
+ 'first_tab' => array(
274
+ 'header_fields' => array(
275
+ __( 'Fields Settings', 'pirate-forms' ),
276
+ '',
277
+ 'title',
278
+ '',
279
+ ),
280
+ /* Name */
281
+ 'pirateformsopt_name_field' => array(
282
+ __( 'Name', 'pirate-forms' ),
283
+ __( 'Do you want the name field to be displayed?', 'pirate-forms' ),
284
+ 'select',
285
+ 'req',
286
+ array(
287
+ '' => __( 'None', 'pirate-forms' ),
288
+ 'yes' => __( 'Yes but not required', 'pirate-forms' ),
289
+ 'req' => __( 'Required', 'pirate-forms' ),
290
+ ),
291
+ ),
292
+ /* Email */
293
+ 'pirateformsopt_email_field' => array(
294
+ __( 'Email address', 'pirate-forms' ),
295
+ __( 'Do you want the email address field be displayed?', 'pirate-forms' ),
296
+ 'select',
297
+ 'req',
298
+ array(
299
+ '' => __( 'None', 'pirate-forms' ),
300
+ 'yes' => __( 'Yes but not required', 'pirate-forms' ),
301
+ 'req' => __( 'Required', 'pirate-forms' ),
302
+ ),
303
+ ),
304
+ /* Subject */
305
+ 'pirateformsopt_subject_field' => array(
306
+ __( 'Subject', 'pirate-forms' ),
307
+ __( 'Do you want the subject field be displayed?', 'pirate-forms' ),
308
+ 'select',
309
+ 'req',
310
+ array(
311
+ '' => __( 'None', 'pirate-forms' ),
312
+ 'yes' => __( 'Yes but not required', 'pirate-forms' ),
313
+ 'req' => __( 'Required', 'pirate-forms' ),
314
+ ),
315
+ ),
316
+ /* Message */
317
+ 'pirateformsopt_message_field' => array(
318
+ __( 'Message', 'pirate-forms' ),
319
+ '',
320
+ 'select',
321
+ 'req',
322
+ array(
323
+ '' => __( 'None', 'pirate-forms' ),
324
+ 'yes' => __( 'Yes but not required', 'pirate-forms' ),
325
+ 'req' => __( 'Required', 'pirate-forms' ),
326
+ ),
327
+ ),
328
+ /* Recaptcha */
329
+ 'pirateformsopt_recaptcha_field' => array(
330
+ __( 'Add a reCAPTCHA', 'pirate-forms' ),
331
+ '',
332
+ 'checkbox',
333
+ $pirate_forms_contactus_recaptcha_show,
334
+ ),
335
+ /* Site key */
336
+ 'pirateformsopt_recaptcha_sitekey' => array(
337
+ __( 'Site key', 'pirate-forms' ),
338
+ '<a href="https://www.google.com/recaptcha/admin#list" target="_blank">' . __( 'Create an account here ', 'pirate-forms' ) . '</a>' . __( 'to get the Site key and the Secret key for the reCaptcha.', 'pirate-forms' ),
339
+ 'text',
340
+ $pirate_forms_contactus_sitekey,
341
+ ),
342
+ /* Secret key */
343
+ 'pirateformsopt_recaptcha_secretkey' => array(
344
+ __( 'Secret key', 'pirate-forms' ),
345
+ '',
346
+ 'text',
347
+ $pirate_forms_contactus_secretkey,
348
+ ),
349
+ /* Attachment */
350
+ 'pirateformsopt_attachment_field' => array(
351
+ __( 'Add an attachment field', 'pirate-forms' ),
352
+ '',
353
+ 'checkbox',
354
+ '',
355
+ ),
356
+ ),
357
+ 'second_tab' => array(
358
+ 'header_labels' => array(
359
+ __( 'Fields Labels', 'pirate-forms' ),
360
+ '',
361
+ 'title',
362
+ '',
363
+ ),
364
+ 'pirateformsopt_label_name' => array(
365
+ __( 'Name', 'pirate-forms' ),
366
+ '',
367
+ 'text',
368
+ __( 'Your Name', 'pirate-forms' ),
369
+ ),
370
+ 'pirateformsopt_label_email' => array(
371
+ __( 'Email', 'pirate-forms' ),
372
+ '',
373
+ 'text',
374
+ __( 'Your Email', 'pirate-forms' ),
375
+ ),
376
+ 'pirateformsopt_label_subject' => array(
377
+ __( 'Subject', 'pirate-forms' ),
378
+ '',
379
+ 'text',
380
+ __( 'Subject', 'pirate-forms' ),
381
+ ),
382
+ 'pirateformsopt_label_message' => array(
383
+ __( 'Message', 'pirate-forms' ),
384
+ '',
385
+ 'text',
386
+ __( 'Your message', 'pirate-forms' ),
387
+ ),
388
+ 'pirateformsopt_label_submit_btn' => array(
389
+ __( 'Submit button', 'pirate-forms' ),
390
+ '',
391
+ 'text',
392
+ $pirate_forms_contactus_button_label,
393
+ ),
394
+ ),
395
+ 'third_tab' => array(
396
+ 'header_messages' => array(
397
+ __( 'Alert Messages', 'pirate-forms' ),
398
+ '',
399
+ 'title',
400
+ '',
401
+ ),
402
+ 'pirateformsopt_label_err_name' => array(
403
+ __( 'Name required and missing', 'pirate-forms' ),
404
+ '',
405
+ 'text',
406
+ __( 'Enter your name', 'pirate-forms' ),
407
+ ),
408
+ 'pirateformsopt_label_err_email' => array(
409
+ __( 'E-mail required and missing', 'pirate-forms' ),
410
+ '',
411
+ 'text',
412
+ __( 'Enter a valid email', 'pirate-forms' ),
413
+ ),
414
+ 'pirateformsopt_label_err_subject' => array(
415
+ __( 'Subject required and missing', 'pirate-forms' ),
416
+ '',
417
+ 'text',
418
+ __( 'Please enter a subject', 'pirate-forms' ),
419
+ ),
420
+ 'pirateformsopt_label_err_no_content' => array(
421
+ __( 'Question/comment is missing', 'pirate-forms' ),
422
+ '',
423
+ 'text',
424
+ __( 'Enter your question or comment', 'pirate-forms' ),
425
+ ),
426
+ 'pirateformsopt_label_submit' => array(
427
+ __( 'Successful form submission text', 'pirate-forms' ),
428
+ __( 'This text is used on the page if no "Thank You" URL is set above. This is also used as the confirmation email title, if one is set to send out.', 'pirate-forms' ),
429
+ 'text',
430
+ __( 'Thanks, your email was sent successfully!', 'pirate-forms' ),
431
+ ),
432
+ ),
433
+ 'fifth_tab' => array(
434
+ 'header_smtp' => array(
435
+ __( 'SMTP Options', 'pirate-forms' ),
436
+ '',
437
+ 'title',
438
+ '',
439
+ ),
440
+ 'pirateformsopt_use_smtp' => array(
441
+ __( 'Use SMTP to send emails?', 'pirate-forms' ),
442
+ __( 'Instead of PHP mail function', 'pirate-forms' ),
443
+ 'checkbox',
444
+ '',
445
+ ),
446
+ 'pirateformsopt_smtp_host' => array(
447
+ __( 'SMTP Host', 'pirate-forms' ),
448
+ '',
449
+ 'text',
450
+ '',
451
+ ),
452
+ 'pirateformsopt_smtp_port' => array(
453
+ __( 'SMTP Port', 'pirate-forms' ),
454
+ '',
455
+ 'text',
456
+ '',
457
+ ),
458
+ 'pirateformsopt_use_smtp_authentication' => array(
459
+ __( 'Use SMTP Authentication?', 'pirate-forms' ),
460
+ __( 'If you check this box, make sure the SMTP Username and SMTP Password are completed.', 'pirate-forms' ),
461
+ 'checkbox',
462
+ 'yes',
463
+ ),
464
+ 'pirateformsopt_use_secure' => array(
465
+ __( 'Security?', 'pirate-forms' ),
466
+ __( 'If you check this box, make sure the SMTP Username and SMTP Password are completed.', 'pirate-forms' ),
467
+ 'radio',
468
+ array(
469
+ '' => __( 'No', 'pirate-forms' ),
470
+ 'ssl' => __( 'SSL', 'pirate-forms' ),
471
+ 'tls' => __( 'TLS', 'pirate-forms' ),
472
+ ),
473
+ ),
474
+ 'pirateformsopt_smtp_username' => array(
475
+ __( 'SMTP Username', 'pirate-forms' ),
476
+ '',
477
+ 'text',
478
+ '',
479
+ ),
480
+ 'pirateformsopt_smtp_password' => array(
481
+ __( 'SMTP Password', 'pirate-forms' ),
482
+ '',
483
+ 'text',
484
+ '',
485
+ ),
486
+ ),
487
+ );
488
+ }
489
+
490
+ /**
491
+ * Save the data
492
+ *
493
+ * @since 1.0.0
494
+ */
495
+ public function save_callback() {
496
+ if ( isset( $_POST['dataSent'] ) ) :
497
+ $dataSent = $_POST['dataSent'];
498
+ $params = array();
499
+ if ( ! empty( $dataSent ) ) :
500
+ parse_str( $dataSent, $params );
501
+ endif;
502
+ if ( ! empty( $params ) ) :
503
+ /**
504
+ ****** Important fix for saving inputs of type checkbox */
505
+ if ( ! isset( $params['pirateformsopt_store'] ) ) {
506
+ $params['pirateformsopt_store'] = '';
507
+ }
508
+ if ( ! isset( $params['pirateformsopt_recaptcha_field'] ) ) {
509
+ $params['pirateformsopt_recaptcha_field'] = '';
510
+ }
511
+ if ( ! isset( $params['pirateformsopt_nonce'] ) ) {
512
+ $params['pirateformsopt_nonce'] = '';
513
+ }
514
+ if ( ! isset( $params['pirateformsopt_attachment_field'] ) ) {
515
+ $params['pirateformsopt_attachment_field'] = '';
516
+ }
517
+ if ( ! isset( $params['pirateformsopt_use_smtp'] ) ) {
518
+ $params['pirateformsopt_use_smtp'] = '';
519
+ }
520
+ if ( ! isset( $params['pirateformsopt_use_smtp_authentication'] ) ) {
521
+ $params['pirateformsopt_use_smtp_authentication'] = '';
522
+ }
523
+ PirateForms_Util::set_option( $params );
524
+ $pirate_forms_zerif_lite_mods = get_option( 'theme_mods_zerif-lite' );
525
+ if ( empty( $pirate_forms_zerif_lite_mods ) ) :
526
+ $pirate_forms_zerif_lite_mods = array();
527
+ endif;
528
+ if ( isset( $params['pirateformsopt_label_submit_btn'] ) ) :
529
+ $pirate_forms_zerif_lite_mods['zerif_contactus_button_label'] = $params['pirateformsopt_label_submit_btn'];
530
+ endif;
531
+ if ( isset( $params['pirateformsopt_email'] ) ) :
532
+ $pirate_forms_zerif_lite_mods['zerif_contactus_email'] = $params['pirateformsopt_email'];
533
+ endif;
534
+ if ( isset( $params['pirateformsopt_email_recipients'] ) ) :
535
+ $pirate_forms_zerif_lite_mods['zerif_contactus_email'] = $params['pirateformsopt_email_recipients'];
536
+ endif;
537
+ if ( isset( $params['pirateformsopt_recaptcha_field'] ) && ( $params['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
538
+ $pirate_forms_zerif_lite_mods['zerif_contactus_recaptcha_show'] = 0;
539
+ else :
540
+ $pirate_forms_zerif_lite_mods['zerif_contactus_recaptcha_show'] = 1;
541
+ endif;
542
+ if ( isset( $params['pirateformsopt_recaptcha_sitekey'] ) ) :
543
+ $pirate_forms_zerif_lite_mods['zerif_contactus_sitekey'] = $params['pirateformsopt_recaptcha_sitekey'];
544
+ endif;
545
+ if ( isset( $params['pirateformsopt_recaptcha_secretkey'] ) ) :
546
+ $pirate_forms_zerif_lite_mods['zerif_contactus_secretkey'] = $params['pirateformsopt_recaptcha_secretkey'];
547
+ endif;
548
+ update_option( 'theme_mods_zerif-lite', $pirate_forms_zerif_lite_mods );
549
+ endif;
550
+ endif;
551
+ die();
552
+
553
+ }
554
+ }
admin/css/wp-admin.css ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .pirate-forms-nav-tabs a {
2
+ -webkit-box-shadow: none !important;
3
+ box-shadow: none !important;
4
+ }
5
+
6
+ .pirate-forms-postbox {
7
+ margin-top: 20px;
8
+ padding: 10px 20px;
9
+ background: #fff;
10
+ }
11
+
12
+ .pirate-forms-nav-tabs {
13
+ margin-bottom: 0;
14
+ }
15
+
16
+ .pirate-forms-nav-tabs:after {
17
+ display: table;
18
+ clear: both;
19
+ content: " ";
20
+ }
21
+
22
+ .pirate-forms-nav-tabs > li {
23
+ display: block;
24
+ float: left;
25
+ margin-bottom: -1px;
26
+ }
27
+
28
+ .pirate-forms-nav-tabs > li > a {
29
+ display: block;
30
+ padding: 10px 15px;
31
+ border: 1px solid transparent;
32
+ border-radius: 4px 4px 0 0;
33
+ text-decoration: none;
34
+ }
35
+
36
+ .pirate-forms-nav-tabs > li.active > a,
37
+ .pirate-forms-nav-tabs > li.active > a:focus,
38
+ .pirate-forms-nav-tabs > li.active > a:hover {
39
+ border: 1px solid #ddd;
40
+ border-bottom-color: transparent;
41
+ color: #555;
42
+ background-color: #fff;
43
+ font-weight: bold;
44
+ }
45
+
46
+ .pirate-forms-nav-tabs > li.zerif-lite-w-red-tab > a {
47
+ color: red;
48
+ font-weight: bold;
49
+ }
50
+
51
+ .pirate-forms-tab-content {
52
+ float: left;
53
+ width: 700px;
54
+ border-right: 1px solid #ddd;
55
+ border-bottom: 1px solid #ddd;
56
+ border-left: 1px solid #ddd;
57
+ background-color: #fff;
58
+ }
59
+
60
+ .pirate-forms-tab-content > .tab-pane {
61
+ display: none;
62
+ }
63
+
64
+ .pirate-forms-tab-content > .active {
65
+ display: block;
66
+ }
67
+
68
+ .pirate-forms-tab-pane {
69
+ display: none;
70
+ padding: 30px;
71
+ }
72
+
73
+ .pirate-forms-tab-pane.active {
74
+ display: block;
75
+ }
76
+
77
+ .pirate-forms-grouped {
78
+ display: -webkit-box;
79
+ display: -webkit-flex;
80
+ display: -ms-flexbox;
81
+ display: flex;
82
+ margin-bottom: 20px;
83
+
84
+ -webkit-align-items: center;
85
+ align-items: center;
86
+ -webkit-box-align: center;
87
+ -ms-flex-align: center;
88
+ }
89
+
90
+ .pirate-forms-grouped label {
91
+ display: inline-block;
92
+ width: 260px;
93
+ margin: 0 1em 0 0;
94
+ color: #333;
95
+ font-size: 15px;
96
+ font-weight: bold;
97
+ }
98
+
99
+ .pirate-forms-grouped label .pirate_forms_option_description {
100
+ font-size: 11px;
101
+ font-weight: normal;
102
+ }
103
+
104
+ .pirate-forms-grouped select,
105
+ .pirate-forms-grouped input[type="text"] {
106
+ display: inline-block;
107
+ }
108
+
109
+ .pirate-forms-grouped input[type="text"] {
110
+ width: 30%;
111
+ }
112
+
113
+ .pirate-options {
114
+ display: inline-block;
115
+ }
116
+
117
+ .pirate-subscribe.postbox {
118
+ display: inline-block;
119
+ width: 90%;
120
+ margin-top: 0;
121
+ vertical-align: top;
122
+ }
123
+
124
+ .wrap {
125
+ margin-right: 0;
126
+ }
127
+
128
+ #\31 > form > div > label > span.dashicons {
129
+ margin-left: 10px;
130
+ color: #888;
131
+ }
132
+
133
+ #\31 > form > div > label > span.dashicons:after {
134
+ display: none;
135
+ position: absolute;
136
+ margin-left: 5px;
137
+ border-right: 5px solid transparent;
138
+ border-bottom: 5px solid black;
139
+ border-left: 5px solid transparent;
140
+ content: "";
141
+ }
142
+
143
+ #\31 > form > div > label > .pirate_forms_option_description {
144
+ display: none;
145
+ position: absolute;
146
+ z-index: 999;
147
+ width: 200px;
148
+ margin-top: 4px;
149
+ margin-left: 190px;
150
+ padding: 15px;
151
+ border-radius: 5px;
152
+ color: #fff;
153
+ background: rgba(0,0,0,0.8);
154
+ font-size: 11px;
155
+ line-height: 16px;
156
+ text-align: left;
157
+ }
158
+
159
+ #\31 > form > div > label > span.dashicons:hover + .pirate_forms_option_description,
160
+ #\31 > form > div > label > span.dashicons:hover::after {
161
+ display: block;
162
+ }
163
+
164
+ #\31 > form > div > label {
165
+ width: 400px;
166
+ font-weight: normal;
167
+ }
168
+
169
+ .pirate_forms_contact_settings h3.title,
170
+ .pirate_forms_welcome_text {
171
+ margin: 10px 0 30px;
172
+ color: #555;
173
+ font-size: 23px;
174
+ text-align: center;
175
+ }
176
+
177
+ .pirate-forms-tab-pane hr {
178
+ margin-bottom: 30px;
179
+ }
180
+
181
+ .pirate-forms-tab-pane ol {
182
+ margin: 20px 0 20px 50px;
183
+ list-style: inherit;
184
+ }
185
+
186
+ .pirate_forms_subheading {
187
+ color: #333;
188
+ font-size: 14px;
189
+ text-align: center;
190
+ }
191
+
192
+ .rate_plugin_invite {
193
+ text-align: center;
194
+ }
195
+
196
+ .rate_plugin_invite .dashicons {
197
+ width: auto;
198
+ color: #0073aa;
199
+ font-size: 12px;
200
+ }
201
+
202
+ .pirate_forms_preview {
203
+ display: inherit;
204
+ margin: 0 auto 10px;
205
+ }
206
+
207
+ @media( max-width: 1360px) {
208
+ .pirate-subscribe.postbox {
209
+ display: block;
210
+ margin-left: 0;
211
+ }
212
+ }
213
+
214
+ .ajaxAnimation {
215
+ display: none;
216
+ position: absolute;
217
+ top: 0;
218
+ right: 0;
219
+ bottom: 0;
220
+ left: 0;
221
+ background: url("../img/loader.gif") no-repeat center center, rgba(255,255,255,0.8);
222
+ }
223
+
224
+ .pirate-forms-hidden {
225
+ display: none !important;
226
+ }
227
+
228
+ #pirate-forms-main {
229
+ float: left;
230
+ }
231
+
232
+ #pirate-forms-sidebar {
233
+ float: left;
234
+ width: 300px;
235
+ margin-top: 94px;
236
+ margin-left: 50px;
237
+ }
238
+
239
+ .pirate-custom-emails a:hover {
240
+ -webkit-box-shadow: none;
241
+ box-shadow: none;
242
+ -webkit-transform: translateY(4px);
243
+ -ms-transform: translateY(4px);
244
+ transform: translateY(4px);
245
+ }
246
+
247
+ .pirate-custom-emails a,
248
+ .pirate-upgrade-hestia a {
249
+ display: inline-block;
250
+ margin-top: 10px;
251
+ padding: 9px;
252
+ border-radius: 3px;
253
+ color: #fff;
254
+ background: #ff7f65;
255
+ -webkit-box-shadow: 0 4px 0 #da6f5a;
256
+ box-shadow: 0 4px 0 #da6f5a;
257
+ font-size: 12px;
258
+ font-weight: 700;
259
+ text-decoration: none;
260
+ text-transform: uppercase;
261
+ cursor: pointer;
262
+ -webkit-transition: ease 0.25s;
263
+ transition: ease 0.25s;
264
+ }
265
+
266
+ .pirate-custom-emails {
267
+ width: 90%;
268
+ margin-top: 10px;
269
+ border-color: #fdbda9;
270
+ }
271
+
272
+ .pirate-upgrade-hestia {
273
+ width: 90%;
274
+ margin-top: 0;
275
+ border-color: #fdbda9;
276
+ }
277
+
278
+ .pirate-forms-upgrade-hestia-content {
279
+ padding-top: 15px;
280
+ }
281
+
282
+ @media screen and (max-width: 1024px) {
283
+ #pirate-forms-sidebar {
284
+ margin: 10px 0;
285
+ }
286
+ }
287
+
288
+ @media screen and (max-width: 780px) {
289
+ #pirate-forms-sidebar {
290
+ width: 100%;
291
+ margin: 4px;
292
+ }
293
+ }
admin/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
admin/js/scripts-admin.js ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global cwp_top_ajaxload */
2
+ /* global console */
3
+
4
+ jQuery(document).ready(function() {
5
+ jQuery('.pirate-forms-nav-tabs a').click(function (event) {
6
+ event.preventDefault();
7
+ jQuery(this).parent().addClass('active');
8
+ jQuery(this).parent().siblings().removeClass('active');
9
+ var tab = jQuery(this).attr('href');
10
+ jQuery('.pirate-forms-tab-pane').not(tab).css('display', 'none');
11
+ jQuery(tab).fadeIn();
12
+ });
13
+
14
+ jQuery('.pirate-forms-save-button').click(function (e) {
15
+ e.preventDefault();
16
+ cwpTopUpdateForm();
17
+ return false;
18
+ });
19
+ function cwpTopUpdateForm() {
20
+
21
+ startAjaxIntro();
22
+
23
+ var data = jQuery('.pirate_forms_contact_settings').serialize();
24
+
25
+ jQuery.ajax({
26
+ type: 'POST',
27
+ url: cwp_top_ajaxload.ajaxurl,
28
+
29
+ data: {
30
+ action: 'pirate_forms_save',
31
+ dataSent: data
32
+ },
33
+ success: function (response) {
34
+ console.log(response);
35
+ },
36
+ error: function (MLHttpRequest, textStatus, errorThrown) {
37
+ console.log('There was an error: ' + errorThrown);
38
+ }
39
+ });
40
+
41
+ endAjaxIntro();
42
+ return false;
43
+ }
44
+
45
+ // Starting the AJAX intro animation
46
+ function startAjaxIntro() {
47
+ jQuery('.ajaxAnimation').fadeIn();
48
+ }
49
+
50
+ // Ending the AJAX intro animation
51
+ function endAjaxIntro() {
52
+ jQuery('.ajaxAnimation').fadeOut();
53
+ }
54
+
55
+ /* Recaptcha site key and secret key should appear only when Add a recaptcha is selected */
56
+ jQuery('input#pirateformsopt_recaptcha_field').change(function(){
57
+ jQuery('.pirate-forms-grouped #pirateformsopt_recaptcha_sitekey').parent().addClass('pirate-forms-hidden');
58
+ jQuery('.pirate-forms-grouped #pirateformsopt_recaptcha_secretkey').parent().addClass('pirate-forms-hidden');
59
+ if( jQuery(this).is(':checked') ) {
60
+ jQuery('.pirate-forms-grouped #pirateformsopt_recaptcha_sitekey').parent().removeClass('pirate-forms-hidden');
61
+ jQuery('.pirate-forms-grouped #pirateformsopt_recaptcha_secretkey').parent().removeClass('pirate-forms-hidden');
62
+ }
63
+ });
64
+
65
+ });
admin/partials/pirateforms-settings-display.php ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Provide a admin area view for the plugin
5
+ *
6
+ * This file is used to markup the admin-facing aspects of the plugin.
7
+ *
8
+ * @link http://example.com
9
+ * @since 1.0.0
10
+ *
11
+ * @package Plugin_Name
12
+ * @subpackage Plugin_Name/admin/partials
13
+ */
14
+ ?>
15
+
16
+ <!-- This file should primarily consist of HTML with a little bit of PHP. -->
17
+
18
+ <div class="wrap">
19
+ <div id="pirate-forms-main">
20
+ <h1><?php esc_html_e( 'Pirate Forms', 'pirate-forms' ); ?></h1>
21
+
22
+ <div class="pirate-options">
23
+ <ul class="pirate-forms-nav-tabs" role="tablist">
24
+ <li role="presentation" class="active"><a href="#0" aria-controls="how_to_use" role="tab"
25
+ data-toggle="tab"><?php esc_html_e( 'How to use', 'pirate-forms' ); ?></a>
26
+ </li>
27
+ <li role="presentation"><a href="#1" aria-controls="options" role="tab"
28
+ data-toggle="tab"><?php esc_html_e( 'Options', 'pirate-forms' ); ?></a>
29
+ </li>
30
+ <li role="presentation"><a href="#2" aria-controls="fields" role="tab"
31
+ data-toggle="tab"><?php esc_html_e( 'Fields Settings', 'pirate-forms' ); ?></a>
32
+ </li>
33
+ <li role="presentation"><a href="#3" aria-controls="labels" role="tab"
34
+ data-toggle="tab"><?php esc_html_e( 'Fields Labels', 'pirate-forms' ); ?></a>
35
+ </li>
36
+ <li role="presentation"><a href="#4" aria-controls="messages" role="tab"
37
+ data-toggle="tab"><?php esc_html_e( 'Alert Messages', 'pirate-forms' ); ?></a>
38
+ </li>
39
+ <li role="presentation"><a href="#5" aria-controls="smtp" role="tab"
40
+ data-toggle="tab"><?php esc_html_e( 'SMTP', 'pirate-forms' ); ?></a></li>
41
+ </ul>
42
+
43
+ <div class="pirate-forms-tab-content">
44
+
45
+ <div id="0" class="pirate-forms-tab-pane active">
46
+
47
+ <h2 class="pirate_forms_welcome_text"><?php esc_html_e( 'Welcome to Pirate Forms!', 'pirate-forms' ); ?></h2>
48
+ <p class="pirate_forms_subheading"><?php esc_html_e( 'To get started, just ', 'pirate-forms' ); ?>
49
+ <b><?php esc_html_e( 'configure all the options ', 'pirate-forms' ); ?></b><?php esc_html_e( 'you need, hit save and start using the created form.', 'pirate-forms' ); ?>
50
+ </p>
51
+
52
+ <hr>
53
+
54
+ <p><?php esc_html_e( 'There are 3 ways of using the newly created form:', 'pirate-forms' ); ?></p>
55
+ <ol>
56
+ <li><?php esc_html_e( 'Add a ', 'pirate-forms' ); ?><strong><a
57
+ href="<?php echo admin_url( 'widgets.php' ); ?>"><?php esc_html_e( 'widget', 'pirate-forms' ); ?></a></strong>
58
+ </li>
59
+ <li><?php esc_html_e( 'Use the shortcode ', 'pirate-forms' ); ?>
60
+ <strong><code>[pirate_forms]</code></strong><?php esc_html_e( ' in any page or post.', 'pirate-forms' ); ?>
61
+ </li>
62
+ <li><?php esc_html_e( 'Use the shortcode ', 'pirate-forms' ); ?><strong><code>&lt;?php echo
63
+ do_shortcode( '[pirate_forms]' )
64
+ ?&gt;</code></strong><?php esc_html_e( ' in the theme\'s files.', 'pirate-forms' ); ?>
65
+ </li>
66
+ </ol>
67
+
68
+ <hr>
69
+
70
+ <div class="rate_plugin_invite">
71
+
72
+ <h4><?php esc_html_e( 'Are you enjoying Pirate Forms?', 'pirate-forms' ); ?></h4>
73
+
74
+ <p class="review-link">
75
+ <?php
76
+ /* translators: link to WordPress.org repo for PirateForms */
77
+ echo sprintf( esc_html__( 'Rate our plugin on %1$s WordPress.org %2$s. We\'d really appreciate it!', 'pirate-forms' ), '<a href="https://wordpress.org/support/view/plugin-reviews/pirate-forms" target="_blank" rel="nofollow"> ', '</a>' );
78
+ ?>
79
+ </p>
80
+
81
+ <p><span class="dashicons dashicons-star-filled"></span><span
82
+ class="dashicons dashicons-star-filled"></span><span
83
+ class="dashicons dashicons-star-filled"></span><span
84
+ class="dashicons dashicons-star-filled"></span><span
85
+ class="dashicons dashicons-star-filled"></span></p>
86
+
87
+ <p>
88
+ <small>
89
+ <?php
90
+ /* translators: link to blog article about contact form plugins */
91
+ echo sprintf( esc_html__( 'If you want a more complex Contact Form Plugin please check %1$s this link %2$s.', 'pirate-forms' ), '<a href="http://www.codeinwp.com/blog/best-contact-form-plugins-wordpress/" target="_blank" >', '</a>' );
92
+ ?>
93
+ </small>
94
+ </p>
95
+ </div>
96
+
97
+ </div>
98
+
99
+ <?php
100
+ $pirate_forms_nr_tabs = 1;
101
+ foreach ( $plugin_options as $plugin_options_tab ) :
102
+ echo '<div id="' . $pirate_forms_nr_tabs . '" class="pirate-forms-tab-pane">';
103
+ ?>
104
+ <form method="post" class="pirate_forms_contact_settings">
105
+
106
+ <?php
107
+ $pirate_forms_nr_tabs ++;
108
+ foreach ( $plugin_options_tab as $key => $value ) :
109
+ /* Label */
110
+ if ( ! empty( $value[0] ) ) :
111
+ $opt_name = $value[0];
112
+ endif;
113
+ /* ID */
114
+ $opt_id = $key;
115
+ /* Description */
116
+ if ( ! empty( $value[1] ) ) :
117
+ $opt_desc = $value[1];
118
+ else :
119
+ $opt_desc = '';
120
+ endif;
121
+ /* Input type */
122
+ if ( ! empty( $value[2] ) ) :
123
+ $opt_type = $value[2];
124
+ else :
125
+ $opt_type = '';
126
+ endif;
127
+ /* Default value */
128
+ if ( ! empty( $value[3] ) ) :
129
+ $opt_default = $value[3];
130
+ else :
131
+ $opt_default = '';
132
+ endif;
133
+ /* Value */
134
+ $opt_val = isset( $pirate_forms_options[ $opt_id ] ) ? $pirate_forms_options[ $opt_id ] : $opt_default;
135
+ /* Options if checkbox, select, or radio */
136
+ $opt_options = empty( $value[4] ) ? array() : $value[4];
137
+ switch ( $opt_type ) {
138
+ case 'title':
139
+ if ( ! empty( $opt_name ) ) :
140
+ echo '<h3 class="title">' . $opt_name . '</h3><hr />';
141
+ endif;
142
+ break;
143
+ case 'text':
144
+ /* Display recaptcha secret key and site key only if the Add a reCAPTCHA option is checked */
145
+ $pirateformsopt_recaptcha_field = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_field' );
146
+ if ( ! empty( $opt_id ) && ( ( $opt_id != 'pirateformsopt_recaptcha_sitekey' ) && ( $opt_id != 'pirateformsopt_recaptcha_secretkey' ) ) || ( ! empty( $pirateformsopt_recaptcha_field ) && ( $pirateformsopt_recaptcha_field == 'yes' ) && ( ( $opt_id == 'pirateformsopt_recaptcha_sitekey' ) || ( $opt_id == 'pirateformsopt_recaptcha_secretkey' ) ) ) ) {
147
+ $pirate_forms_is_hidden_class = '';
148
+ } else {
149
+ $pirate_forms_is_hidden_class = 'pirate-forms-hidden';
150
+ }
151
+ ?>
152
+
153
+ <div class="pirate-forms-grouped <?php echo $pirate_forms_is_hidden_class; ?>">
154
+
155
+ <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
156
+ if ( ! empty( $opt_desc ) ) {
157
+ if ( ( $opt_id == 'pirateformsopt_email' ) || ( $opt_id == 'pirateformsopt_email_recipients' ) || ( $opt_id == 'pirateformsopt_confirm_email' ) ) {
158
+ echo '<span class="dashicons dashicons-editor-help"></span>';
159
+
160
+ }
161
+ echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
162
+ } ?>
163
+
164
+ </label>
165
+
166
+ <input name="<?php echo $opt_id; ?>" id="<?php echo $opt_id ?>"
167
+ type="<?php echo $opt_type; ?>"
168
+ value="<?php echo stripslashes( $opt_val ); ?>" class="widefat">
169
+ </div>
170
+
171
+ <?php
172
+ break;
173
+ case 'textarea':
174
+ ?>
175
+
176
+ <div class="pirate-forms-grouped">
177
+
178
+ <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
179
+ if ( ! empty( $opt_desc ) ) {
180
+ if ( ( $opt_id == 'pirateformsopt_confirm_email' ) ) {
181
+ echo '<span class="dashicons dashicons-editor-help"></span>';
182
+
183
+ }
184
+ echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
185
+ } ?>
186
+
187
+ </label>
188
+
189
+ <textarea name="<?php echo $opt_id; ?>" id="<?php echo $opt_id ?>"
190
+ type="<?php echo $opt_type; ?>" rows="5"
191
+ cols="30"><?php echo stripslashes( $opt_val ); ?></textarea>
192
+ </div>
193
+
194
+ <?php
195
+ break;
196
+ case 'select':
197
+ ?>
198
+ <div class="pirate-forms-grouped">
199
+
200
+ <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
201
+ if ( ! empty( $opt_desc ) ) {
202
+ if ( ( $opt_id == 'pirateformsopt_thank_you_url' ) ) {
203
+ echo '<span class="dashicons dashicons-editor-help"></span>';
204
+
205
+ }
206
+ echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
207
+
208
+ } ?>
209
+
210
+ </label>
211
+
212
+ <select name="<?php echo $opt_id ?>" id="<?php echo $opt_id; ?>">
213
+ <?php
214
+ foreach ( $opt_options as $key => $val ) :
215
+ $selected = '';
216
+ if ( $opt_val == $key ) {
217
+ $selected = 'selected';
218
+ }
219
+ ?>
220
+ <option value="<?php echo $key ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
221
+ <?php endforeach; ?>
222
+ </select>
223
+
224
+ </div>
225
+
226
+ <?php
227
+ break;
228
+ case 'radio':
229
+ if ( ! is_array( $value[3] ) ) {
230
+ break;
231
+ }
232
+ ?>
233
+ <div class="pirate-forms-grouped">
234
+ <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
235
+ if ( ! empty( $opt_desc ) ) {
236
+ if ( ( $opt_id == 'pirateformsopt_store' ) || ( $opt_id == 'pirateformsopt_nonce' ) ) {
237
+ echo '<span class="dashicons dashicons-editor-help"></span>';
238
+
239
+ }
240
+ echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
241
+ } ?>
242
+
243
+ </label>
244
+
245
+ <?php
246
+ $index_radio = 0;
247
+ foreach ( $value[3] as $key1 => $label1 ) {
248
+ $checked = $opt_val == $key1 ? 'checked' : '';
249
+ if ( $index_radio++ == 0 ) {
250
+ $checked = 'checked';
251
+ }
252
+ ?>
253
+ <input type="radio" value="<?php echo $key1;?>" name="<?php echo $opt_id; ?>"
254
+ id="<?php echo $opt_id; ?><?php echo $key1 ?>" <?php echo $checked; ?>><?php echo $label1;?>
255
+ &nbsp;
256
+
257
+ <?php
258
+ }
259
+ ?>
260
+ </div>
261
+ <?php
262
+ break;
263
+ case 'checkbox':
264
+ ?>
265
+ <div class="pirate-forms-grouped">
266
+
267
+ <label for="<?php echo $opt_id ?>"><?php echo $opt_name;
268
+ if ( ! empty( $opt_desc ) ) {
269
+ if ( ( $opt_id == 'pirateformsopt_store' ) || ( $opt_id == 'pirateformsopt_nonce' ) ) {
270
+ echo '<span class="dashicons dashicons-editor-help"></span>';
271
+
272
+ }
273
+ echo '<div class="pirate_forms_option_description">' . $opt_desc . '</div>';
274
+ } ?>
275
+
276
+ </label>
277
+
278
+ <?php
279
+ $checked = '';
280
+ if ( ( $opt_val == 'yes' ) ) {
281
+ $checked = 'checked';
282
+ }
283
+ ?>
284
+
285
+ <input type="checkbox" value="yes" name="<?php echo $opt_id; ?>"
286
+ id="<?php echo $opt_id; ?>" <?php echo $checked; ?>>Yes
287
+
288
+ </div>
289
+
290
+ <?php
291
+ break;
292
+ }// End switch().
293
+ endforeach;
294
+ ?>
295
+ <input name="save" type="submit" value="<?php _e( 'Save changes', 'pirate-forms' ) ?>"
296
+ class="button-primary pirate-forms-save-button">
297
+ <input type="hidden" name="action" value="save">
298
+ <input type="hidden" name="proper_nonce"
299
+ value="<?php echo wp_create_nonce( $current_user->user_email ) ?>">
300
+
301
+ </form><!-- .pirate_forms_contact_settings -->
302
+ <div class="ajaxAnimation"></div>
303
+ </div><!-- .pirate-forms-tab-pane -->
304
+
305
+ <?php endforeach; ?>
306
+
307
+ </div><!-- .pirate-forms-tab-content -->
308
+ </div><!-- .pirate-options -->
309
+ </div><!-- .pirate-options -->
310
+
311
+ <div id="pirate-forms-sidebar">
312
+ <?php do_action( 'pirate_forms_load_sidebar' ); ?>
313
+ </div>
314
+
315
+ <div class="clear"></div>
316
+ </div><!-- .wrap -->
admin/partials/pirateforms-settings-sidebar-subscribe.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="pirate-subscribe postbox card">
2
+ <h3 class="title"><?php esc_html_e( 'Get Our Free Email Course', 'pirate-forms' ) ?></h3>
3
+ <div class="pirate-forms-subscribe-content">
4
+ <?php
5
+ if ( ! empty( $_POST['pirate_forms_mail'] ) ) {
6
+ require( PIRATE_FORMS_PATH . 'mailin.php' );
7
+ $user_info = get_userdata( 1 );
8
+ $mailin = new Mailin( 'https://api.sendinblue.com/v2.0', 'cHW5sxZnzE7mhaYb' );
9
+ $data = array(
10
+ 'email' => $_POST['pirate_forms_mail'],
11
+ 'attributes' => array(
12
+ 'NAME' => $user_info->first_name,
13
+ 'SURNAME' => $user_info->last_name,
14
+ ),
15
+ 'blacklisted' => 0,
16
+ 'listid' => array( 51 ),
17
+ 'blacklisted_sms' => 0,
18
+ );
19
+ $status = $mailin->create_update_user( $data );
20
+ if ( $status['code'] == 'success' ) {
21
+ update_option( 'pirate_forms_subscribe', true );
22
+ }
23
+ }
24
+ $was_submited = get_option( 'pirate_forms_subscribe', false );
25
+ if ( $was_submited == false ) {
26
+ echo sprintf( '<p> %s </p><form class="pirate-forms-submit-mail" method="post"><input name="pirate_forms_mail" type="email" value="' . get_option( 'admin_email' ) . '" /><input class="button" type="submit" value="Submit"></form>', esc_html__( 'Ready to learn how to reduce your website loading times by half? Come and join the 1st lesson here!', 'pirate-forms' ) );
27
+ } else {
28
+ echo sprintf( '<p> %s </p>', esc_html__( 'Thank you for subscribing! You have been added to the mailing list and will receive the next email information in the coming weeks. If you ever wish to unsubscribe, simply use the "Unsubscribe" link included in each newsletter.', 'pirate-forms' ) );
29
+ } ?>
30
+ </div>
31
+ </div>
32
+ <?php
33
+ if ( ! class_exists( 'Dev7CustomEmails' ) ) {
34
+ ?>
35
+ <div class="pirate-custom-emails postbox card">
36
+ <h3 class="title"><?php esc_html_e( 'Control Emails in WordPress', 'pirate-forms' ) ?></h3>
37
+ <div class="pirate-forms-custom-emails-content">
38
+ Change default WordPress email templates using <strong>Custom Emails</strong> plugin
39
+ <a href="https://themeisle.com/plugins/custom-emails-wordpress-plugin/" target="_blank">View more
40
+ details</a>
41
+ </div>
42
+ </div>
43
+ <?php
44
+ }
45
+ ?>
admin/partials/pirateforms-settings-sidebar-theme.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Upgrade to Hestia notification box */
3
+ $pirate_current_theme = '';
4
+
5
+ $theme = wp_get_theme();
6
+
7
+ if ( ! empty( $theme ) ) {
8
+ if ( is_child_theme() ) {
9
+ $pirate_current_theme = $theme->parent()->get( 'Name' );
10
+ } else {
11
+ $pirate_current_theme = $theme->get( 'Name' );
12
+ }
13
+ }
14
+
15
+ if ( ( $pirate_current_theme != 'Hestia' ) && ( $pirate_current_theme != 'Hestia Pro' ) ) {
16
+
17
+ $pirate_upgrade_hestia_box_text = 'Check-out our latest FREE multi-purpose theme: <strong>Hestia</strong>';
18
+
19
+ if ( $pirate_current_theme == 'Zerif Lite' ) {
20
+ $pirate_upgrade_hestia_box_text = 'Check-out our latest FREE multi-purpose theme: <strong>Hestia</strong>, your Zerif Lite content will be imported automatically! ';
21
+ }
22
+ ?>
23
+ <div class="pirate-upgrade-hestia postbox card">
24
+ <div class="pirate-forms-upgrade-hestia-content">
25
+ <?php echo wp_kses_post( $pirate_upgrade_hestia_box_text ); ?><br>
26
+ <?php
27
+ $pirate_upgrade_hestia_url = add_query_arg( array(
28
+ 'theme' => 'hestia',
29
+ ), admin_url( 'theme-install.php' ) );
30
+ ?>
31
+ <a href="<?php echo $pirate_upgrade_hestia_url; ?>" target="_blank">Preview Hestia</a>
32
+ </div>
33
+ </div>
34
+ <?php
35
+ }
36
+ ?>
bin/deploy.sh DELETED
@@ -1,71 +0,0 @@
1
- #!/bin/bash
2
-
3
- # We run this just one time, for a first job from the buid and just at once after_deploy hook.
4
- if ! [ $AFTER_DEPLOY_RUN ] && [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then
5
-
6
- # Flag the run in order to not be trigged again on the next after_deploy.
7
- export AFTER_DEPLOY_RUN=1;
8
- echo " Started deploy script. ";
9
-
10
- # Setup git username and email.
11
-
12
- git config user.name "selul"
13
- git config user.email ${GITHUB_EMAIL}
14
- git fetch
15
-
16
- # Check if we already have a tag with this version.
17
- if ! git rev-parse "v$THEMEISLE_VERSION" >/dev/null 2>&1
18
- then
19
-
20
- # Send changelog changes to git.
21
- git checkout $MASTER_BRANCH
22
- git add -v .
23
-
24
- # We use [skip ci] in message to prevent this commit to trigger the build.
25
- git commit -a -m "[AUTO][skip ci] Updating changelog for v"$THEMEISLE_VERSION
26
- git push --quiet "https://${GITHUB_TOKEN}@github.com/$UPSTREAM_REPO.git" HEAD:$MASTER_BRANCH
27
-
28
- # Tag the new release.
29
- git tag -a "v$THEMEISLE_VERSION" -m "[AUTO] Release of $THEMEISLE_VERSION ";
30
- git push --quiet "https://${GITHUB_TOKEN}@github.com/$UPSTREAM_REPO.git" --tags ;
31
- sleep 5;
32
-
33
- # Sends the api call for creating the release.
34
- # We use this as the travis release provider does not offer any way
35
- # to set the body of the release.
36
- API_JSON='{"tag_name": "v'$THEMEISLE_VERSION'","target_commitish": "'$MASTER_BRANCH'","name": "v'$THEMEISLE_VERSION'","body": "'$CHANGES'","draft": false,"prerelease": false}';
37
- curl -s --data "$API_JSON" "https://api.github.com/repos/$UPSTREAM_REPO/releases?access_token="$GITHUB_TOKEN > /dev/null;
38
- fi
39
- # Send update to the store
40
- STORE_JSON='{"version": "'$THEMEISLE_VERSION'","id": "'$THEMEISLE_ID'","body": "'$CHANGES'"}';
41
- curl -s -H "Content-Type: application/json" -H "x-themeisle-auth: $THEMEISLE_AUTH" --data "$STORE_JSON" "$STORE_URL/wp-json/ti-endpoint/v1/update_changelog_new/" > /dev/null
42
-
43
- # Send data to demo server.
44
- grunt sftp
45
-
46
- # Upload to Wordpress SVN
47
- if [ ! -z "$WPORG_PASS" ]; then
48
-
49
- svn co -q "http://svn.wp-plugins.org/$THEMEISLE_REPO" svn
50
-
51
- # Copy new content to svn trunk.
52
- rsync -r -p --delete --exclude=".*" dist/* svn/trunk
53
-
54
- # Create new SVN tag.
55
- mkdir -p svn/tags/$THEMEISLE_VERSION
56
- rsync -r -p dist/* svn/tags/$THEMEISLE_VERSION
57
- # Add new files to SVN
58
- svn stat svn | grep '^?' | awk '{print $2}' | xargs -I x svn add x@
59
- # Remove deleted files from SVN
60
- svn stat svn | grep '^!' | awk '{print $2}' | xargs -I x svn rm --force x@
61
-
62
- svn stat svn
63
-
64
- # Commit to SVN
65
- svn commit svn --no-auth-cache -m "Release v$THEMEISLE_VERSION" --username $WPORG_USER --password $WPORG_PASS
66
- # Remove svn dir.
67
- rm -fR svn
68
-
69
- fi
70
-
71
- fi;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bin/install-dependencies.sh DELETED
@@ -1,40 +0,0 @@
1
- #!/bin/bash
2
-
3
- # We run this on PR or on push to MASTER_BRANCH.
4
- if [ "$TRAVIS_PULL_REQUEST" != "false" ] || ( [ "$TRAVIS_EVENT_TYPE" == "push" ] && [ "$TRAVIS_REPO_SLUG" == "$UPSTREAM_REPO" ] && [ "$TRAVIS_BRANCH" == "$MASTER_BRANCH" ] && [ "$TRAVIS_PHP_VERSION" == "7.0" ] ) ; then
5
-
6
- . $HOME/.nvm/nvm.sh
7
- nvm install stable
8
- nvm use stable
9
-
10
- npm install
11
- npm install grunt-cli -g
12
-
13
- phpenv local 5.6
14
-
15
- composer selfupdate 1.0.0 --no-interaction
16
- composer install --no-interaction
17
- phpenv local --unset
18
-
19
- fi;
20
- # We dont install PHPCS if is not a PR.
21
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
22
-
23
- # Install PHPCS.
24
- pear install pear/PHP_CodeSniffer-2.8.1
25
-
26
- # Install WPCS standards.
27
- git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $HOME/wordpress-coding-standards
28
- phpenv rehash
29
- phpcs --config-set installed_paths $HOME/wordpress-coding-standards
30
- phpenv rehash
31
-
32
- # Install wordpress for testing.
33
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
34
- export PATH="$HOME/.composer/vendor/bin:$PATH"
35
-
36
- # Use phpunit 5.7 as WP dont support 6.
37
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
38
- composer global require "phpunit/phpunit=5.7.*" ;
39
- fi;
40
- fi;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bin/install-wp-tests.sh DELETED
@@ -1,127 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
-
4
- if [ $# -lt 3 ]; then
5
- echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [force download]"
6
- exit 1
7
- fi
8
-
9
- DB_NAME=$1
10
- DB_USER=$2
11
- DB_PASS=$3
12
- DB_HOST=${4-localhost}
13
- WP_VERSION=${5-latest}
14
- FORCE=${6-false}
15
-
16
- WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
17
- WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
18
-
19
- download() {
20
- if [ `which curl` ]; then
21
- curl -s "$1" > "$2";
22
- elif [ `which wget` ]; then
23
- wget -nv -O "$2" "$1"
24
- fi
25
- }
26
-
27
- if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
28
- WP_TESTS_TAG="tags/$WP_VERSION"
29
- else
30
- # http serves a single offer, whereas https serves multiple. we only want one
31
- download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
32
- grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
33
- LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
34
- if [[ -z "$LATEST_VERSION" ]]; then
35
- echo "Latest WordPress version could not be found"
36
- exit 1
37
- fi
38
- WP_TESTS_TAG="tags/$LATEST_VERSION"
39
- fi
40
-
41
- if [[ $WP_TESTS_TAG == *"beta"* ]]
42
- then
43
- WP_TESTS_TAG="trunk"
44
- fi
45
-
46
- set -ex
47
-
48
- install_wp() {
49
- if [ $FORCE == 'true' ]; then
50
- rm -Rf $WP_CORE_DIR
51
- fi
52
-
53
- if [ -d $WP_CORE_DIR ]; then
54
- return;
55
- fi
56
-
57
- mkdir -p $WP_CORE_DIR
58
-
59
- if [ $WP_VERSION == 'latest' ]; then
60
- local ARCHIVE_NAME='latest'
61
- else
62
- local ARCHIVE_NAME="wordpress-$WP_VERSION"
63
- fi
64
-
65
- download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz
66
- tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
67
-
68
- download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
69
- }
70
-
71
- install_test_suite() {
72
- if [ $FORCE == 'true' ]; then
73
- rm -Rf $WP_TESTS_DIR
74
- fi
75
-
76
- # portable in-place argument for both GNU sed and Mac OSX sed
77
- if [[ $(uname -s) == 'Darwin' ]]; then
78
- local ioption='-i .bak'
79
- else
80
- local ioption='-i'
81
- fi
82
-
83
- # set up testing suite if it doesn't yet exist
84
- if [ ! -d $WP_TESTS_DIR ]; then
85
- # set up testing suite
86
- mkdir -p $WP_TESTS_DIR
87
- svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
88
- svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data
89
- fi
90
-
91
- cd $WP_TESTS_DIR
92
-
93
- if [ ! -f wp-tests-config.php ]; then
94
- download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
95
- sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php
96
- sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
97
- sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
98
- sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
99
- sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
100
- fi
101
-
102
- }
103
-
104
- install_db() {
105
- # parse DB_HOST for port or socket references
106
- local PARTS=(${DB_HOST//\:/ })
107
- local DB_HOSTNAME=${PARTS[0]};
108
- local DB_SOCK_OR_PORT=${PARTS[1]};
109
- local EXTRA=""
110
-
111
- if ! [ -z $DB_HOSTNAME ] ; then
112
- if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
113
- EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
114
- elif ! [ -z $DB_SOCK_OR_PORT ] ; then
115
- EXTRA=" --socket=$DB_SOCK_OR_PORT"
116
- elif ! [ -z $DB_HOSTNAME ] ; then
117
- EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
118
- fi
119
- fi
120
-
121
- # create database
122
- mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
123
- }
124
-
125
- install_wp
126
- install_test_suite
127
- install_db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bin/prepare-deploy.sh DELETED
@@ -1,46 +0,0 @@
1
- #!/bin/bash
2
-
3
- #We make sure we run this just at one before_deploy hook.
4
- if ! [ $BEFORE_DEPLOY_RUN ] && [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then
5
-
6
- echo " Preparing deploy. ";
7
-
8
- # Flag the run.
9
- export BEFORE_DEPLOY_RUN=1;
10
-
11
- # Parse the name of the repo.
12
- export THEMEISLE_REPO=$(node -pe "require('./package.json').name")
13
-
14
- # Parse the version of the product.
15
-
16
- export THEMEISLE_VERSION=$(node -pe "require('./package.json').version")
17
-
18
- # Parse product category.
19
- export THEMEISLE_CATEGORY=$(node -pe "require('./package.json').category")
20
-
21
- export DEMO_THEMEISLE_PATH="/sites/demo.themeisle.com/wp-content/$THEMEISLE_CATEGORY/$THEMEISLE_REPO";
22
-
23
- # Build changelog based on commit message description.
24
- CHANGELOG="\n ### v$THEMEISLE_VERSION - "$(date +'%Y-%m-%d')" \n **Changes:** \n";
25
-
26
- # Remove first line from the commit as is it used as commit title.
27
- NORMALIZED_MESSAGE=$(sed "1d" <<< "$TRAVIS_COMMIT_MESSAGE");
28
-
29
- # Save changes list in a sepparately variable as we use it in the release body.
30
- export CHANGES="";
31
- while read -r line; do
32
- if ! [ -z $line ]; then
33
- line=$(echo "${line//[$'\r\n']}");
34
- export CHANGES=$CHANGES'- '$line'\n';
35
- fi;
36
- done <<< "$NORMALIZED_MESSAGE"
37
-
38
- # Concat changes and changelog title and prepend to the changelog file.
39
-
40
- CHANGELOG="$CHANGELOG $CHANGES";
41
- echo -e "$CHANGELOG $(cat CHANGELOG.md)" > CHANGELOG.md
42
-
43
- # Run the prepare deployment action
44
-
45
- grunt deploy
46
- fi;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/front.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Version: 1.2.2
3
  */
4
  .pirate_forms_wrap .form_field_wrap {
5
  margin-bottom: 20px;
1
  /*
2
+ Version: 1.2.5
3
  */
4
  .pirate_forms_wrap .form_field_wrap {
5
  margin-bottom: 20px;
css/wp-admin.css CHANGED
@@ -50,7 +50,7 @@
50
 
51
  .pirate-forms-tab-content {
52
  float: left;
53
- width: 860px;
54
  border-right: 1px solid #ddd;
55
  border-bottom: 1px solid #ddd;
56
  border-left: 1px solid #ddd;
@@ -117,7 +117,7 @@
117
  .pirate-subscribe.postbox {
118
  display: inline-block;
119
  width: 90%;
120
- margin: auto;
121
  vertical-align: top;
122
  }
123
 
@@ -207,7 +207,6 @@
207
  @media( max-width: 1360px) {
208
  .pirate-subscribe.postbox {
209
  display: block;
210
- margin-top: 40px;
211
  margin-left: 0;
212
  }
213
  }
@@ -245,7 +244,8 @@
245
  transform: translateY(4px);
246
  }
247
 
248
- .pirate-custom-emails a {
 
249
  display: inline-block;
250
  margin-top: 10px;
251
  padding: 9px;
@@ -265,11 +265,26 @@
265
 
266
  .pirate-custom-emails {
267
  width: 90%;
268
- margin: auto;
269
  margin-top: 10px;
270
  border-color: #fdbda9;
271
  }
272
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  @media screen and (max-width: 780px) {
274
  #pirate-forms-sidebar {
275
  width: 100%;
50
 
51
  .pirate-forms-tab-content {
52
  float: left;
53
+ width: 700px;
54
  border-right: 1px solid #ddd;
55
  border-bottom: 1px solid #ddd;
56
  border-left: 1px solid #ddd;
117
  .pirate-subscribe.postbox {
118
  display: inline-block;
119
  width: 90%;
120
+ margin-top: 0;
121
  vertical-align: top;
122
  }
123
 
207
  @media( max-width: 1360px) {
208
  .pirate-subscribe.postbox {
209
  display: block;
 
210
  margin-left: 0;
211
  }
212
  }
244
  transform: translateY(4px);
245
  }
246
 
247
+ .pirate-custom-emails a,
248
+ .pirate-upgrade-hestia a {
249
  display: inline-block;
250
  margin-top: 10px;
251
  padding: 9px;
265
 
266
  .pirate-custom-emails {
267
  width: 90%;
 
268
  margin-top: 10px;
269
  border-color: #fdbda9;
270
  }
271
 
272
+ .pirate-upgrade-hestia {
273
+ width: 90%;
274
+ margin-top: 0;
275
+ border-color: #fdbda9;
276
+ }
277
+
278
+ .pirate-forms-upgrade-hestia-content {
279
+ padding-top: 15px;
280
+ }
281
+
282
+ @media screen and (max-width: 1024px) {
283
+ #pirate-forms-sidebar {
284
+ margin: 10px 0;
285
+ }
286
+ }
287
+
288
  @media screen and (max-width: 780px) {
289
  #pirate-forms-sidebar {
290
  width: 100%;
inc/settings.php CHANGED
@@ -692,6 +692,42 @@ function pirate_forms_admin() {
692
  </div><!-- .pirate-options -->
693
  </div><!-- .pirate-options -->
694
  <div id="pirate-forms-sidebar">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
695
  <div class="pirate-subscribe postbox card">
696
  <h3 class="title"><?php esc_html_e( 'Get Our Free Email Course', 'pirate-forms' ) ?></h3>
697
  <div class="pirate-forms-subscribe-content">
692
  </div><!-- .pirate-options -->
693
  </div><!-- .pirate-options -->
694
  <div id="pirate-forms-sidebar">
695
+ <?php
696
+ /* Upgrade to Hestia notification box */
697
+ $pirate_current_theme = '';
698
+
699
+ $theme = wp_get_theme();
700
+
701
+ if ( ! empty( $theme ) ) {
702
+ if ( is_child_theme() ) {
703
+ $pirate_current_theme = $theme->parent()->get( 'Name' );
704
+ } else {
705
+ $pirate_current_theme = $theme->get( 'Name' );
706
+ }
707
+ }
708
+
709
+ if ( ( $pirate_current_theme != 'Hestia' ) && ( $pirate_current_theme != 'Hestia Pro' ) ) {
710
+
711
+ $pirate_upgrade_hestia_box_text = 'Check-out our latest FREE multi-purpose theme: <strong>Hestia</strong>';
712
+
713
+ if ( $pirate_current_theme == 'Zerif Lite' ) {
714
+ $pirate_upgrade_hestia_box_text = 'Check-out our latest FREE multi-purpose theme: <strong>Hestia</strong>, your Zerif Lite content will be imported automatically! ';
715
+ }
716
+ ?>
717
+ <div class="pirate-upgrade-hestia postbox card">
718
+ <div class="pirate-forms-upgrade-hestia-content">
719
+ <?php echo wp_kses_post( $pirate_upgrade_hestia_box_text ); ?><br>
720
+ <?php
721
+ $pirate_upgrade_hestia_url = add_query_arg( array(
722
+ 'theme' => 'hestia',
723
+ ), admin_url( 'theme-install.php' ) );
724
+ ?>
725
+ <a href="<?php echo $pirate_upgrade_hestia_url; ?>" target="_blank">Preview Hestia</a>
726
+ </div>
727
+ </div>
728
+ <?php
729
+ }
730
+ ?>
731
  <div class="pirate-subscribe postbox card">
732
  <h3 class="title"><?php esc_html_e( 'Get Our Free Email Course', 'pirate-forms' ) ?></h3>
733
  <div class="pirate-forms-subscribe-content">
includes/class-pirateforms-activator.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired during plugin activation
5
+ *
6
+ * @link http://example.com
7
+ * @since 1.0.0
8
+ *
9
+ * @package PirateForms
10
+ * @subpackage PirateForms/includes
11
+ */
12
+
13
+ /**
14
+ * Fired during plugin activation.
15
+ *
16
+ * This class defines all code necessary to run during the plugin's activation.
17
+ *
18
+ * @since 1.0.0
19
+ * @package PirateForms
20
+ * @subpackage PirateForms/includes
21
+ * @author Your Name <email@example.com>
22
+ */
23
+ class PirateForms_Activator {
24
+
25
+ /**
26
+ * Short Description. (use period)
27
+ *
28
+ * Long Description.
29
+ *
30
+ * @since 1.0.0
31
+ */
32
+ public static function activate() {
33
+
34
+ }
35
+
36
+ }
includes/class-pirateforms-deactivator.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired during plugin deactivation
5
+ *
6
+ * @link http://example.com
7
+ * @since 1.0.0
8
+ *
9
+ * @package PirateForms
10
+ * @subpackage PirateForms/includes
11
+ */
12
+
13
+ /**
14
+ * Fired during plugin deactivation.
15
+ *
16
+ * This class defines all code necessary to run during the plugin's deactivation.
17
+ *
18
+ * @since 1.0.0
19
+ * @package PirateForms
20
+ * @subpackage PirateForms/includes
21
+ * @author Your Name <email@example.com>
22
+ */
23
+ class PirateForms_Deactivator {
24
+
25
+ /**
26
+ * Short Description. (use period)
27
+ *
28
+ * Long Description.
29
+ *
30
+ * @since 1.0.0
31
+ */
32
+ public static function deactivate() {
33
+
34
+ }
35
+
36
+ }
includes/class-pirateforms-i18n.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * @link http://example.com
10
+ * @since 1.0.0
11
+ *
12
+ * @package PirateForms
13
+ * @subpackage PirateForms/includes
14
+ */
15
+
16
+ /**
17
+ * Define the internationalization functionality.
18
+ *
19
+ * Loads and defines the internationalization files for this plugin
20
+ * so that it is ready for translation.
21
+ *
22
+ * @since 1.0.0
23
+ * @package PirateForms
24
+ * @subpackage PirateForms/includes
25
+ * @author Your Name <email@example.com>
26
+ */
27
+ class PirateForms_I18n {
28
+
29
+
30
+ /**
31
+ * Load the plugin text domain for translation.
32
+ *
33
+ * @since 1.0.0
34
+ */
35
+ public function load_plugin_textdomain() {
36
+
37
+ load_plugin_textdomain(
38
+ 'pirate-forms',
39
+ false,
40
+ dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
41
+ );
42
+
43
+ }
44
+
45
+
46
+
47
+ }
includes/class-pirateforms-loader.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Register all actions and filters for the plugin
5
+ *
6
+ * @link http://example.com
7
+ * @since 1.0.0
8
+ *
9
+ * @package PirateForms
10
+ * @subpackage PirateForms/includes
11
+ */
12
+
13
+ /**
14
+ * Register all actions and filters for the plugin.
15
+ *
16
+ * Maintain a list of all hooks that are registered throughout
17
+ * the plugin, and register them with the WordPress API. Call the
18
+ * run function to execute the list of actions and filters.
19
+ *
20
+ * @package PirateForms
21
+ * @subpackage PirateForms/includes
22
+ * @author Your Name <email@example.com>
23
+ */
24
+ class PirateForms_Loader {
25
+
26
+ /**
27
+ * The array of actions registered with WordPress.
28
+ *
29
+ * @since 1.0.0
30
+ * @access protected
31
+ * @var array $actions The actions registered with WordPress to fire when the plugin loads.
32
+ */
33
+ protected $actions;
34
+
35
+ /**
36
+ * The array of filters registered with WordPress.
37
+ *
38
+ * @since 1.0.0
39
+ * @access protected
40
+ * @var array $filters The filters registered with WordPress to fire when the plugin loads.
41
+ */
42
+ protected $filters;
43
+
44
+ /**
45
+ * Initialize the collections used to maintain the actions and filters.
46
+ *
47
+ * @since 1.0.0
48
+ */
49
+ public function __construct() {
50
+
51
+ $this->actions = array();
52
+ $this->filters = array();
53
+
54
+ }
55
+
56
+ /**
57
+ * Add a new action to the collection to be registered with WordPress.
58
+ *
59
+ * @since 1.0.0
60
+ * @param string $hook The name of the WordPress action that is being registered.
61
+ * @param object $component A reference to the instance of the object on which the action is defined.
62
+ * @param string $callback The name of the function definition on the $component.
63
+ * @param int $priority Optional. he priority at which the function should be fired. Default is 10.
64
+ * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
65
+ */
66
+ public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
67
+ $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
68
+ }
69
+
70
+ /**
71
+ * Add a new filter to the collection to be registered with WordPress.
72
+ *
73
+ * @since 1.0.0
74
+ * @param string $hook The name of the WordPress filter that is being registered.
75
+ * @param object $component A reference to the instance of the object on which the filter is defined.
76
+ * @param string $callback The name of the function definition on the $component.
77
+ * @param int $priority Optional. he priority at which the function should be fired. Default is 10.
78
+ * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
79
+ */
80
+ public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
81
+ $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
82
+ }
83
+
84
+ /**
85
+ * A utility function that is used to register the actions and hooks into a single
86
+ * collection.
87
+ *
88
+ * @since 1.0.0
89
+ * @access private
90
+ * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
91
+ * @param string $hook The name of the WordPress filter that is being registered.
92
+ * @param object $component A reference to the instance of the object on which the filter is defined.
93
+ * @param string $callback The name of the function definition on the $component.
94
+ * @param int $priority The priority at which the function should be fired.
95
+ * @param int $accepted_args The number of arguments that should be passed to the $callback.
96
+ * @return array The collection of actions and filters registered with WordPress.
97
+ */
98
+ private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
99
+
100
+ $hooks[] = array(
101
+ 'hook' => $hook,
102
+ 'component' => $component,
103
+ 'callback' => $callback,
104
+ 'priority' => $priority,
105
+ 'accepted_args' => $accepted_args,
106
+ );
107
+
108
+ return $hooks;
109
+
110
+ }
111
+
112
+ /**
113
+ * Register the filters and actions with WordPress.
114
+ *
115
+ * @since 1.0.0
116
+ */
117
+ public function run() {
118
+
119
+ foreach ( $this->filters as $hook ) {
120
+ add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
121
+ }
122
+
123
+ foreach ( $this->actions as $hook ) {
124
+ add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
125
+ }
126
+
127
+ }
128
+
129
+ }
includes/class-pirateforms-phpformbuilder.php ADDED
@@ -0,0 +1,607 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Builds the form
5
+ *
6
+ * @since 1.0.0
7
+ */
8
+ class PirateForms_PhpFormBuilder {
9
+
10
+ /**
11
+ * Stores all form inputs
12
+ *
13
+ * @var string $inputs
14
+ * @since 1.0.0
15
+ */
16
+ private $inputs = array();
17
+
18
+ /**
19
+ * Stores all form attributes
20
+ *
21
+ * @var array $form
22
+ * @since 1.0.0
23
+ */
24
+ private $form = array();
25
+
26
+ /**
27
+ * Does this form have a submit value?
28
+ *
29
+ * @var bool $has_submit
30
+ * @since 1.0.0
31
+ */
32
+ private $has_submit = false;
33
+
34
+ /**
35
+ * Constructor function to set form action and attributes
36
+ */
37
+ function __construct( $action = '', $args = false ) {
38
+
39
+ /* if the form has an attachment option change the enctype to multipart/form-data */
40
+
41
+ $pirateformsopt_attachment_field = PirateForms_Util::get_option( 'pirateformsopt_attachment_field' );
42
+ if ( ! empty( $pirateformsopt_attachment_field ) && ($pirateformsopt_attachment_field == 'yes') ) {
43
+ $pirate_forms_enctype = 'multipart/form-data';
44
+ } else {
45
+ $pirate_forms_enctype = 'application/x-www-form-urlencoded';
46
+ }
47
+
48
+ // Default form attributes
49
+ $defaults = array(
50
+ 'action' => $action,
51
+ 'method' => 'post',
52
+ 'enctype' => $pirate_forms_enctype,
53
+ 'class' => array(),
54
+ 'id' => '',
55
+ 'markup' => 'html',
56
+ 'novalidate' => false,
57
+ 'add_nonce' => false,
58
+ 'add_honeypot' => true,
59
+ 'form_element' => true,
60
+ 'add_submit' => true,
61
+ );
62
+
63
+ // Merge with arguments, if present
64
+ if ( $args ) {
65
+ $settings = array_merge( $defaults, $args );
66
+ } // End if().
67
+ else {
68
+ $settings = $defaults;
69
+ }
70
+
71
+ // Iterate through and save each option
72
+ foreach ( $settings as $key => $val ) {
73
+ // Try setting with user-passed setting
74
+ // If not, try the default with the same key name
75
+ if ( ! $this->set_att( $key, $val ) ) {
76
+ $this->set_att( $key, $defaults[ $key ] );
77
+ }
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Validate and set form
83
+ *
84
+ * @param string $key A valid key; switch statement ensures validity.
85
+ * @param string | bool $val A valid value; validated for each key.
86
+ *
87
+ * @return bool
88
+ */
89
+ function set_att( $key, $val ) {
90
+
91
+ switch ( $key ) :
92
+
93
+ case 'action':
94
+ break;
95
+
96
+ case 'method':
97
+ if ( ! in_array( $val, array( 'post', 'get' ) ) ) {
98
+ return false;
99
+ }
100
+ break;
101
+
102
+ case 'enctype':
103
+ if ( ! in_array( $val, array( 'application/x-www-form-urlencoded', 'multipart/form-data' ) ) ) {
104
+ return false;
105
+ }
106
+ break;
107
+
108
+ case 'markup':
109
+ if ( ! in_array( $val, array( 'html', 'xhtml' ) ) ) {
110
+ return false;
111
+ }
112
+ break;
113
+
114
+ case 'class':
115
+ case 'id':
116
+ if ( ! $this->_check_valid_attr( $val ) ) {
117
+ return false;
118
+ }
119
+ break;
120
+
121
+ case 'novalidate':
122
+ case 'add_honeypot':
123
+ case 'form_element':
124
+ case 'add_submit':
125
+ if ( ! is_bool( $val ) ) {
126
+ return false;
127
+ }
128
+ break;
129
+
130
+ case 'add_nonce':
131
+ if ( ! is_string( $val ) && ! is_bool( $val ) ) {
132
+ return false;
133
+ }
134
+ break;
135
+
136
+ default:
137
+ return false;
138
+
139
+ endswitch;
140
+
141
+ $this->form[ $key ] = $val;
142
+
143
+ return true;
144
+
145
+ }
146
+
147
+ /**
148
+ * Add an input field to the form for outputting later
149
+ */
150
+ function add_input( $label, $args = '', $slug = '' ) {
151
+
152
+ if ( empty( $args ) ) {
153
+ $args = array();
154
+ }
155
+
156
+ // Create a valid id or class attribute
157
+ if ( empty( $slug ) ) {
158
+ $slug = $this->_make_slug( $label );
159
+ }
160
+
161
+ $defaults = array(
162
+ 'type' => 'text',
163
+ 'name' => $slug,
164
+ 'id' => $slug,
165
+ 'label' => $label,
166
+ 'value' => '',
167
+ 'placeholder' => '',
168
+ 'class' => array(),
169
+ 'min' => '',
170
+ 'max' => '',
171
+ 'step' => '',
172
+ 'autofocus' => false,
173
+ 'checked' => false,
174
+ 'selected' => false,
175
+ 'required' => false,
176
+ 'add_label' => true,
177
+ 'options' => array(),
178
+ 'wrap_tag' => 'div',
179
+ 'wrap_class' => array( 'form_field_wrap' ),
180
+ 'wrap_id' => '',
181
+ 'wrap_style' => '',
182
+ 'before_html' => '',
183
+ 'after_html' => '',
184
+ 'request_populate' => true,
185
+ );
186
+
187
+ // Combined defaults and arguments
188
+ // Arguments override defaults
189
+ $args = array_merge( $defaults, $args );
190
+ $this->inputs[ $slug ] = $args;
191
+
192
+ }
193
+
194
+ /**
195
+ * Add multiple inputs to the input queue
196
+ *
197
+ * @return bool
198
+ */
199
+ function add_inputs( $arr ) {
200
+
201
+ if ( ! is_array( $arr ) ) {
202
+ return false;
203
+ }
204
+
205
+ foreach ( $arr as $field ) {
206
+ $this->add_input(
207
+ $field[0], isset( $field[1] ) ? $field[1] : '',
208
+ isset( $field[2] ) ? $field[2] : ''
209
+ );
210
+ }
211
+
212
+ return true;
213
+ }
214
+
215
+ /**
216
+ * Build the HTML for the form based on the input queue
217
+ *
218
+ * @param bool $echo Should the HTML be echoed or returned?.
219
+ *
220
+ * @return string
221
+ */
222
+ function build_form( $echo = true ) {
223
+
224
+ $output = '';
225
+
226
+ if ( $this->form['form_element'] ) {
227
+ $output .= '<form method="' . $this->form['method'] . '" ';
228
+
229
+ if ( ! empty( $this->form['enctype'] ) ) {
230
+ $output .= ' enctype="' . $this->form['enctype'] . '"';
231
+ }
232
+
233
+ if ( ! empty( $this->form['action'] ) ) {
234
+ $output .= ' action="' . $this->form['action'] . '"';
235
+ }
236
+
237
+ if ( ! empty( $this->form['id'] ) ) {
238
+ $output .= ' id="' . $this->form['id'] . '"';
239
+ }
240
+
241
+ if ( count( $this->form['class'] ) > 0 ) {
242
+ $output .= $this->_output_classes( $this->form['class'] );
243
+ }
244
+
245
+ if ( $this->form['novalidate'] ) {
246
+ $output .= ' novalidate';
247
+ }
248
+
249
+ $output .= '>';
250
+ $this->set_element( 'form_start', $output );
251
+ }
252
+
253
+ $form_end = '';
254
+
255
+ // Add honeypot anti-spam field
256
+ if ( $this->form['add_honeypot'] ) {
257
+ $this->add_input( 'Leave blank to submit', array(
258
+ 'name' => 'honeypot',
259
+ 'slug' => 'honeypot',
260
+ 'id' => 'form_honeypot',
261
+ 'wrap_tag' => 'div',
262
+ 'wrap_class' => array( 'form_field_wrap', 'hidden' ),
263
+ 'wrap_id' => '',
264
+ 'wrap_style' => 'display: none',
265
+ 'request_populate' => false,
266
+ ) );
267
+ }
268
+
269
+ // Add a WordPress nonce field
270
+ if ( $this->form['add_nonce'] && function_exists( 'wp_create_nonce' ) ) {
271
+ $this->add_input( 'WordPress nonce', array(
272
+ 'value' => wp_create_nonce( $this->form['add_nonce'] ),
273
+ 'add_label' => false,
274
+ 'type' => 'hidden',
275
+ 'request_populate' => false,
276
+ ) );
277
+ }
278
+
279
+ // Iterate through the input queue and add input HTML
280
+ foreach ( $this->inputs as $val ) :
281
+
282
+ $add_to_form_end = false;
283
+ $min_max_range = '';
284
+ $element = '';
285
+ $end = '';
286
+ $attr = '';
287
+ $field = '';
288
+ $label_html = '';
289
+
290
+ // Automatic population of values using $_REQUEST data
291
+ if ( $val['request_populate'] && isset( $_REQUEST[ $val['name'] ] ) ) {
292
+
293
+ // Can this field be populated directly?
294
+ if ( ! in_array( $val['type'], array( 'html', 'title', 'radio', 'checkbox', 'select', 'submit' ) ) ) {
295
+ $val['value'] = $_REQUEST[ $val['name'] ];
296
+ }
297
+ }
298
+
299
+ // Automatic population for checkboxes and radios
300
+ if (
301
+ $val['request_populate'] &&
302
+ ( $val['type'] == 'radio' || $val['type'] == 'checkbox' ) &&
303
+ empty( $val['options'] )
304
+ ) {
305
+ $val['checked'] = isset( $_REQUEST[ $val['name'] ] ) ? true : $val['checked'];
306
+ }
307
+
308
+ switch ( $val['type'] ) {
309
+
310
+ case 'html':
311
+ $element = '';
312
+ $end = $val['label'];
313
+ break;
314
+
315
+ case 'title':
316
+ $element = '';
317
+ $end = '
318
+ <h3>' . $val['label'] . '</h3>';
319
+ break;
320
+
321
+ case 'textarea':
322
+ $element = 'textarea';
323
+ $end = ' class="form-control" placeholder="' . $val['placeholder'] . '">' . esc_attr( $val['value'] ) . '</textarea>';
324
+ break;
325
+
326
+ case 'select':
327
+ $element = 'select';
328
+ $end .= '>';
329
+ foreach ( $val['options'] as $key => $opt ) {
330
+ $opt_insert = '';
331
+ if (
332
+ // Is this field set to automatically populate?
333
+ $val['request_populate'] &&
334
+
335
+ // Do we have $_REQUEST data to use?
336
+ isset( $_REQUEST[ $val['name'] ] ) &&
337
+
338
+ // Are we currently outputting the selected value?
339
+ $_REQUEST[ $val['name'] ] === $key
340
+ ) {
341
+ $opt_insert = ' selected';
342
+
343
+ // Does the field have a default selected value?
344
+ } elseif ( $val['selected'] === $key ) {
345
+ $opt_insert = ' selected';
346
+ }
347
+ $end .= '<option value="' . $key . '"' . $opt_insert . '>' . $opt . '</option>';
348
+ }
349
+ $end .= '</select>';
350
+ break;
351
+ case 'captcha':
352
+ $element = 'div';
353
+ $end = ' class="g-recaptcha pirate-forms-g-recaptcha" data-sitekey="' . $val['value'] . '"></div>';
354
+ break;
355
+ case 'file':
356
+ $element = 'input';
357
+ $end = ' class="" type="' . $val['type'] . '">';
358
+ break;
359
+ case 'radio':
360
+ case 'checkbox':
361
+
362
+ // Special case for multiple check boxes
363
+ if ( count( $val['options'] ) > 0 ) :
364
+ $element = '';
365
+ foreach ( $val['options'] as $key => $opt ) {
366
+ $slug = $this->_make_slug( $opt );
367
+ $end .= sprintf(
368
+ '<input type="%s" name="%s[]" value="%s" id="%s"',
369
+ $val['type'],
370
+ $val['name'],
371
+ $key,
372
+ $slug
373
+ );
374
+ if (
375
+ // Is this field set to automatically populate?
376
+ $val['request_populate'] &&
377
+
378
+ // Do we have $_REQUEST data to use?
379
+ isset( $_REQUEST[ $val['name'] ] ) &&
380
+
381
+ // Is the selected item(s) in the $_REQUEST data?
382
+ in_array( $key, $_REQUEST[ $val['name'] ] )
383
+ ) {
384
+ $end .= ' checked';
385
+ }
386
+ $end .= $this->field_close();
387
+ $end .= ' <label for="' . $slug . '">' . $opt . '</label>';
388
+ }
389
+ $label_html = '<div class="checkbox_header">' . $val['label'] . '</div>';
390
+ break;
391
+ endif;
392
+ case 'submit':
393
+ $element = 'div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap"><button';
394
+ $end .= ' type="' . $val['type'] . '">' . $val['value'] . '</button></div>';
395
+ break;
396
+ default :
397
+ $element = 'input';
398
+
399
+ /* don't add a placeholder attribute for input type=hidden */
400
+ if ( ! empty( $val['type'] ) && ($val['type'] == 'hidden' ) ) {
401
+ $add_to_form_end = true;
402
+ $end .= ' class="form-control" type="' . $val['type'] . '" value="' . esc_attr( $val['value'] ) . '"';
403
+ } else {
404
+ $end .= ' class="form-control" type="' . $val['type'] . '" value="' . esc_attr( $val['value'] ) . '" placeholder="' . $val['placeholder'] . '"';
405
+ }
406
+ if ( 'form_honeypot' === $val['id'] ) {
407
+ $add_to_form_end = true;
408
+ }
409
+ $end .= $val['checked'] ? ' checked' : '';
410
+ $end .= $this->field_close();
411
+ break;
412
+
413
+ }// End switch().
414
+
415
+ // Added a submit button, no need to auto-add one
416
+ if ( $val['type'] === 'submit' ) {
417
+ $this->has_submit = true;
418
+ }
419
+
420
+ // Special number values for range and number types
421
+ if ( $val['type'] === 'range' || $val['type'] === 'number' ) {
422
+ $min_max_range .= ! empty( $val['min'] ) ? ' min="' . $val['min'] . '"' : '';
423
+ $min_max_range .= ! empty( $val['max'] ) ? ' max="' . $val['max'] . '"' : '';
424
+ $min_max_range .= ! empty( $val['step'] ) ? ' step="' . $val['step'] . '"' : '';
425
+ }
426
+
427
+ // Add an ID field, if one is present
428
+ $id = ! empty( $val['id'] ) ? ' id="' . $val['id'] . '"' : '';
429
+
430
+ // Output classes
431
+ $class = $this->_output_classes( $val['class'] );
432
+
433
+ // Special HTML5 fields, if set
434
+ $attr .= $val['autofocus'] ? ' autofocus' : '';
435
+ $attr .= $val['checked'] ? ' checked' : '';
436
+ $attr .= $val['required'] ? ' required' : '';
437
+
438
+ // Build the label
439
+ if ( ! empty( $label_html ) ) {
440
+ $field .= $label_html;
441
+ } elseif ( $val['add_label'] && ! in_array( $val['type'], array( 'hidden', 'submit', 'title', 'html', 'textarea', 'captcha' ) ) ) {
442
+ $field .= '<label for="' . $val['id'] . '">' . $val['label'] . '</label>';
443
+ }
444
+
445
+ // An $element was set in the $val['type'] switch statement above so use that
446
+ if ( ! empty( $element ) ) {
447
+ if ( $val['type'] === 'checkbox' ) {
448
+ $field = '
449
+ <' . $element . $id . ' name="' . $val['name'] . '"' . $min_max_range . $class . $attr . $end .
450
+ $field;
451
+ } elseif ( $val['type'] === 'captcha' ) { /* don't add name attribute to div's holding recaptcha keys */
452
+ $field .= '
453
+ <' . $element . $id . ' ' . $min_max_range . $class . $attr . $end;
454
+ } else {
455
+ $field .= '
456
+ <' . $element . $id . ' name="' . $val['name'] . '"' . $min_max_range . $class . $attr . $end;
457
+ }
458
+ } else {
459
+ $field .= $end;
460
+ }
461
+
462
+ // Parse and create wrap, if needed
463
+ if ( $val['type'] != 'hidden' && $val['type'] != 'html' ) :
464
+
465
+ $wrap_before = $val['before_html'];
466
+ if ( ! empty( $val['wrap_tag'] ) ) {
467
+ $wrap_before .= '<' . $val['wrap_tag'];
468
+ $wrap_before .= count( $val['wrap_class'] ) > 0 ? $this->_output_classes( $val['wrap_class'] ) : '';
469
+ $wrap_before .= ! empty( $val['wrap_style'] ) ? ' style="' . $val['wrap_style'] . '"' : '';
470
+ $wrap_before .= ! empty( $val['wrap_id'] ) ? ' id="' . $val['wrap_id'] . '"' : '';
471
+ $wrap_before .= '>';
472
+ }
473
+
474
+ $wrap_after = $val['after_html'];
475
+ if ( ! empty( $val['wrap_tag'] ) ) {
476
+ $wrap_after = '</' . $val['wrap_tag'] . '>' . $wrap_after;
477
+ }
478
+
479
+ $output .= $wrap_before . $field . $wrap_after;
480
+ else :
481
+ $output .= $field;
482
+ endif;
483
+
484
+ if ( $add_to_form_end ) {
485
+ $form_end .= $output;
486
+ } else {
487
+ $this->set_element( $val['id'], $output );
488
+ }
489
+
490
+ endforeach;
491
+
492
+ // Auto-add submit button
493
+ if ( ! $this->has_submit && $this->form['add_submit'] ) {
494
+ $output .= '<div class="form_field_wrap"><input type="submit" value="Submit" name="submit"></div>';
495
+ $this->set_element( 'contact_submit', $output );
496
+ }
497
+
498
+ // Close the form tag if one was added
499
+ if ( $this->form['form_element'] ) {
500
+ $form_end .= '</form>';
501
+ $this->set_element( 'form_end', $form_end );
502
+ }
503
+
504
+ $output = $this->load_theme();
505
+ // Output or return?
506
+ if ( $echo ) {
507
+ echo $output;
508
+ } else {
509
+ return $output;
510
+ }
511
+ }
512
+
513
+ /**
514
+ * Easy way to auto-close fields, if necessary
515
+ *
516
+ * @since 1.0.0
517
+ */
518
+ function field_close() {
519
+ return $this->form['markup'] === 'xhtml' ? ' />' : '>';
520
+ }
521
+
522
+ /**
523
+ * Validates id and class attributes
524
+ *
525
+ * @since 1.0.0
526
+ */
527
+ private function _check_valid_attr( $string ) {
528
+
529
+ $result = true;
530
+
531
+ // Check $name for correct characters
532
+ // "^[a-zA-Z0-9_-]*$"
533
+ return $result;
534
+
535
+ }
536
+
537
+ /**
538
+ * Create a slug from a label name
539
+ *
540
+ * @since 1.0.0
541
+ */
542
+ private function _make_slug( $string ) {
543
+
544
+ $result = '';
545
+
546
+ $result = str_replace( '"', '', $string );
547
+ $result = str_replace( "'", '', $result );
548
+ $result = str_replace( '_', '-', $result );
549
+ $result = preg_replace( '~[\W\s]~', '-', $result );
550
+
551
+ $result = strtolower( $result );
552
+
553
+ return $result;
554
+
555
+ }
556
+
557
+ /**
558
+ * Parses and builds the classes in multiple places
559
+ *
560
+ * @since 1.0.0
561
+ */
562
+ private function _output_classes( $classes ) {
563
+
564
+ $output = '';
565
+
566
+ if ( is_array( $classes ) && count( $classes ) > 0 ) {
567
+ $output .= ' class="';
568
+ foreach ( $classes as $class ) {
569
+ $output .= $class . ' ';
570
+ }
571
+ $output .= '"';
572
+ } elseif ( is_string( $classes ) ) {
573
+ $output .= ' class="' . $classes . '"';
574
+ }
575
+
576
+ return $output;
577
+ }
578
+
579
+ /**
580
+ * Sets the element as a variable that can be used in the templates
581
+ *
582
+ * @since 1.2.6
583
+ */
584
+ public function set_element( $element_name, &$output ) {
585
+ $name = str_replace( array( 'pirate-forms-', '-' ), array( '', '_' ), $element_name );
586
+ $this->$name = $output;
587
+ $output = '';
588
+ }
589
+
590
+ /**
591
+ * Load the correct template
592
+ *
593
+ * @since 1.2.6
594
+ */
595
+ private function load_theme() {
596
+ $default = PIRATEFORMS_DIR . 'public/partials/pirateforms-form.php';
597
+ $custom = trailingslashit( get_template_directory() ) . 'pirate-forms/form.php';
598
+ $file = $default;
599
+ if ( is_readable( $custom ) ) {
600
+ $file = $custom;
601
+ }
602
+ ob_start();
603
+ include $file;
604
+ $output = ob_get_clean();
605
+ return $output;
606
+ }
607
+ }
includes/class-pirateforms-util.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Utility functions
5
+ *
6
+ * @since 1.0.0
7
+ */
8
+ class PirateForms_Util {
9
+
10
+ /**
11
+ * Returns if the domain is localhost
12
+ *
13
+ * @since 1.0.0
14
+ */
15
+ public static function is_localhost() {
16
+ $server_name = strtolower( $_SERVER['SERVER_NAME'] );
17
+ return in_array( $server_name, array( 'localhost', '127.0.0.1' ) );
18
+ }
19
+
20
+ /**
21
+ * Gets the from email
22
+ *
23
+ * @since 1.0.0
24
+ */
25
+ public static function get_from_email() {
26
+ $admin_email = get_option( 'admin_email' );
27
+ $sitename = strtolower( $_SERVER['SERVER_NAME'] );
28
+ if ( PirateForms_Util::is_localhost() ) {
29
+ return $admin_email;
30
+ }
31
+ if ( substr( $sitename, 0, 4 ) == 'www.' ) {
32
+ $sitename = substr( $sitename, 4 );
33
+ }
34
+ if ( strpbrk( $admin_email, '@' ) == '@' . $sitename ) {
35
+ return $admin_email;
36
+ }
37
+
38
+ return 'wordpress@' . $sitename;
39
+ }
40
+
41
+ /**
42
+ * Get the settings key
43
+ *
44
+ * @since 1.0.0
45
+ */
46
+ public static function get_option( $id = null ) {
47
+ $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
48
+ if ( is_null( $id ) ) {
49
+ return $pirate_forms_options;
50
+ }
51
+ return isset( $pirate_forms_options[ $id ] ) ? $pirate_forms_options[ $id ] : '';
52
+ }
53
+
54
+ /**
55
+ * Set all the settings
56
+ *
57
+ * @since 1.0.0
58
+ */
59
+ public static function set_option( $data ) {
60
+ update_option( 'pirate_forms_settings_array', $data );
61
+ }
62
+
63
+ /**
64
+ * Update a key in the settings
65
+ *
66
+ * @since 1.0.0
67
+ */
68
+ public static function update_option( $id, $value ) {
69
+ $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
70
+ if ( is_null( $id ) ) {
71
+ return false;
72
+ }
73
+ $pirate_forms_options[ $id ] = $value;
74
+ self::set_option( $pirate_forms_options );
75
+ return true;
76
+ }
77
+
78
+ }
includes/class-pirateforms-widget.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Template for new WordPress widget
5
+ *
6
+ * @see WP_Widget::widget()
7
+ */
8
+ // @codingStandardsIgnoreStart
9
+ class pirate_forms_contact_widget extends WP_Widget {
10
+ // @codingStandardsIgnoreEnd
11
+
12
+ /**
13
+ * Widget constructor
14
+ */
15
+ public function __construct() {
16
+ parent::__construct(
17
+ 'pirate_forms_contact_widget',
18
+ __( 'Pirate Forms', 'pirate-forms' ),
19
+ array(
20
+ 'classname' => __FUNCTION__,
21
+ 'description' => __( 'Pirate Forms', 'pirate-forms' ),
22
+ )
23
+ );
24
+ }
25
+
26
+ /**
27
+ * Register the widget
28
+ */
29
+ public static function register_widget() {
30
+ register_widget( 'pirate_forms_contact_widget' );
31
+ }
32
+
33
+ /**
34
+ * Widget logic and display
35
+ */
36
+ function widget( $args, $instance ) {
37
+ // Pulling out all settings
38
+ $args = wp_parse_args( $args, array(
39
+ 'before_widget' => '',
40
+ 'after_widget' => '',
41
+ 'before_title' => '',
42
+ 'after_title' => '',
43
+ ) );
44
+ $instance = wp_parse_args( $instance, array(
45
+ 'pirate_forms_widget_title' => 'Pirate Forms',
46
+ 'pirate_forms_widget_subtext' => 'Pirate Forms',
47
+ ) );
48
+ // Output all wrappers
49
+ echo $args['before_widget'] . '<div class="pirate-forms-contact-widget">';
50
+ if ( ! empty( $instance['pirate_forms_widget_title'] ) ) {
51
+ echo $args['before_title'] . $instance['pirate_forms_widget_title'] . $args['after_title'];
52
+ }
53
+ if ( ! empty( $instance['pirate_forms_widget_subtext'] ) ) {
54
+ echo wpautop( stripslashes( $instance['pirate_forms_widget_subtext'] ) );
55
+ }
56
+ echo do_shortcode( '[pirate_forms from="widget"]' );
57
+ echo '<div class="pirate_forms_clearfix"></div>';
58
+ echo '</div>' . $args['after_widget'];
59
+
60
+ }
61
+
62
+ /**
63
+ * Used to update widget settings
64
+ *
65
+ * @return array
66
+ */
67
+ function update( $new_instance, $old_instance ) {
68
+ $instance = $old_instance;
69
+ // Storing widget title as inputted option or category name
70
+ $instance['pirate_forms_widget_title'] = apply_filters( 'widget_title', sanitize_text_field( $new_instance['pirate_forms_widget_title'] ) );
71
+ $instance['pirate_forms_widget_subtext'] = $new_instance['pirate_forms_widget_subtext'];
72
+
73
+ return $instance;
74
+ }
75
+
76
+ /**
77
+ * Used to generate the widget admin view
78
+ *
79
+ * @return string|void
80
+ */
81
+ function form( $instance ) {
82
+ $pirate_forms_widget_title = ! empty( $instance['pirate_forms_widget_title'] ) ? $instance['pirate_forms_widget_title'] : __( 'Title', 'pirate-forms' );
83
+ $pirate_forms_widget_subtext = ! empty( $instance['pirate_forms_widget_subtext'] ) ? $instance['pirate_forms_widget_subtext'] : __( 'Text above form', 'pirate-forms' );
84
+ ?>
85
+ <p>
86
+ <label for="<?php echo $this->get_field_id( 'pirate_forms_widget_title' ); ?>"><?php _e( 'Title:','pirate-forms' ); ?></label>
87
+ <input class="widefat" id="<?php echo $this->get_field_id( 'pirate_forms_widget_title' ); ?>"
88
+ name="<?php echo $this->get_field_name( 'pirate_forms_widget_title' ); ?>" type="text"
89
+ value="<?php echo esc_attr( $pirate_forms_widget_title ); ?>">
90
+ </p>
91
+ <p>
92
+ <label for="<?php echo $this->get_field_id( 'pirate_forms_widget_subtext' ); ?>"><?php _e( 'Subtext:','pirate-forms' ); ?></label>
93
+ <textarea class="widefat" id="<?php echo $this->get_field_id( 'pirate_forms_widget_subtext' ); ?>"
94
+ name="<?php echo $this->get_field_name( 'pirate_forms_widget_subtext' ); ?>"><?php echo esc_attr( $pirate_forms_widget_subtext ); ?></textarea>
95
+ </p>
96
+ <?php
97
+
98
+ }
99
+ }
includes/class-pirateforms.php ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The file that defines the core plugin class
5
+ *
6
+ * A class definition that includes attributes and functions used across both the
7
+ * public-facing side of the site and the admin area.
8
+ *
9
+ * @link http://example.com
10
+ * @since 1.0.0
11
+ *
12
+ * @package PirateForms
13
+ * @subpackage PirateForms/includes
14
+ */
15
+
16
+ /**
17
+ * The core plugin class.
18
+ *
19
+ * This is used to define internationalization, admin-specific hooks, and
20
+ * public-facing site hooks.
21
+ *
22
+ * Also maintains the unique identifier of this plugin as well as the current
23
+ * version of the plugin.
24
+ *
25
+ * @since 1.0.0
26
+ * @package PirateForms
27
+ * @subpackage PirateForms/includes
28
+ * @author Your Name <email@example.com>
29
+ */
30
+ class PirateForms {
31
+
32
+ /**
33
+ * The loader that's responsible for maintaining and registering all hooks that power
34
+ * the plugin.
35
+ *
36
+ * @since 1.0.0
37
+ * @access protected
38
+ * @var PirateForms_Loader $loader Maintains and registers all hooks for the plugin.
39
+ */
40
+ protected $loader;
41
+
42
+ /**
43
+ * The unique identifier of this plugin.
44
+ *
45
+ * @since 1.0.0
46
+ * @access protected
47
+ * @var string $plugin_name The string used to uniquely identify this plugin.
48
+ */
49
+ protected $plugin_name;
50
+
51
+ /**
52
+ * The current version of the plugin.
53
+ *
54
+ * @since 1.0.0
55
+ * @access protected
56
+ * @var string $version The current version of the plugin.
57
+ */
58
+ protected $version;
59
+
60
+ /**
61
+ * Define the core functionality of the plugin.
62
+ *
63
+ * Set the plugin name and the plugin version that can be used throughout the plugin.
64
+ * Load the dependencies, define the locale, and set the hooks for the admin area and
65
+ * the public-facing side of the site.
66
+ *
67
+ * @since 1.0.0
68
+ */
69
+ public function __construct() {
70
+
71
+ $this->plugin_name = 'pirateforms';
72
+ $this->version = '1.2.5';
73
+
74
+ $this->load_dependencies();
75
+ $this->set_locale();
76
+ $this->define_admin_hooks();
77
+ $this->define_public_hooks();
78
+
79
+ }
80
+
81
+ /**
82
+ * Load the required dependencies for this plugin.
83
+ *
84
+ * Include the following files that make up the plugin:
85
+ *
86
+ * - PirateForms_Loader. Orchestrates the hooks of the plugin.
87
+ * - PirateForms_I18n. Defines internationalization functionality.
88
+ * - PirateForms_Admin. Defines all hooks for the admin area.
89
+ * - PirateForms_Public. Defines all hooks for the public side of the site.
90
+ *
91
+ * Create an instance of the loader which will be used to register the hooks
92
+ * with WordPress.
93
+ *
94
+ * @since 1.0.0
95
+ * @access private
96
+ */
97
+ private function load_dependencies() {
98
+
99
+ require_once PIRATEFORMS_DIR . 'includes/class-pirateforms-widget.php';
100
+
101
+ $this->loader = new PirateForms_Loader();
102
+
103
+ }
104
+
105
+ /**
106
+ * Define the locale for this plugin for internationalization.
107
+ *
108
+ * Uses the PirateForms_I18n class in order to set the domain and to register the hook
109
+ * with WordPress.
110
+ *
111
+ * @since 1.0.0
112
+ * @access private
113
+ */
114
+ private function set_locale() {
115
+
116
+ $plugin_i18n = new PirateForms_I18n();
117
+
118
+ $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
119
+
120
+ }
121
+
122
+ /**
123
+ * Register all of the hooks related to the admin area functionality
124
+ * of the plugin.
125
+ *
126
+ * @since 1.0.0
127
+ * @access private
128
+ */
129
+ private function define_admin_hooks() {
130
+
131
+ $plugin_admin = new PirateForms_Admin( $this->get_plugin_name(), $this->get_version() );
132
+
133
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles_and_scripts' );
134
+ $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_to_admin' );
135
+ $this->loader->add_action( 'admin_head', $plugin_admin, 'settings_init' );
136
+ $this->loader->add_filter( 'plugin_action_links_' . PIRATEFORMS_BASENAME, $plugin_admin, 'add_settings_link' );
137
+ $this->loader->add_action( 'wp_ajax_pirate_forms_save', $plugin_admin, 'save_callback' );
138
+ $this->loader->add_action( 'pirate_forms_load_sidebar', $plugin_admin, 'load_sidebar' );
139
+ $this->loader->add_action( 'pirate_forms_load_sidebar_theme', $plugin_admin, 'load_sidebar_theme' );
140
+ $this->loader->add_action( 'pirate_forms_load_sidebar_subscribe', $plugin_admin, 'load_sidebar_subscribe' );
141
+
142
+ $this->loader->add_action( 'init', $this, 'register_content_type' );
143
+ }
144
+
145
+
146
+ /**
147
+ * Register all of the hooks related to the public-facing functionality
148
+ * of the plugin.
149
+ *
150
+ * @since 1.0.0
151
+ * @access private
152
+ */
153
+ private function define_public_hooks() {
154
+
155
+ $plugin_public = new PirateForms_Public( $this->get_plugin_name(), $this->get_version() );
156
+
157
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles_and_scripts' );
158
+ $this->loader->add_action( 'template_redirect', $plugin_public, 'template_redirect' );
159
+ $this->loader->add_action( 'init', $this, 'register_content_type' );
160
+
161
+ $this->loader->add_filter( 'widget_text', $plugin_public, 'widget_text_filter', 9 );
162
+
163
+ add_shortcode( 'pirate_forms', array( $plugin_public, 'display_form' ) );
164
+ }
165
+
166
+ /**
167
+ * Run the loader to execute all of the hooks with WordPress.
168
+ *
169
+ * @since 1.0.0
170
+ */
171
+ public function run() {
172
+ $this->loader->add_action( 'widgets_init', 'pirate_forms_contact_widget', 'register_widget' );
173
+
174
+ $this->loader->run();
175
+ }
176
+
177
+ /**
178
+ * The name of the plugin used to uniquely identify it within the context of
179
+ * WordPress and to define internationalization functionality.
180
+ *
181
+ * @since 1.0.0
182
+ * @return string The name of the plugin.
183
+ */
184
+ public function get_plugin_name() {
185
+ return $this->plugin_name;
186
+ }
187
+
188
+ /**
189
+ * The reference to the class that orchestrates the hooks with the plugin.
190
+ *
191
+ * @since 1.0.0
192
+ * @return PirateForms_Loader Orchestrates the hooks of the plugin.
193
+ */
194
+ public function get_loader() {
195
+ return $this->loader;
196
+ }
197
+
198
+ /**
199
+ * Retrieve the version number of the plugin.
200
+ *
201
+ * @since 1.0.0
202
+ * @return string The version number of the plugin.
203
+ */
204
+ public function get_version() {
205
+ return $this->version;
206
+ }
207
+
208
+ /**
209
+ * Register the contacts CPT
210
+ *
211
+ * @since 1.0.0
212
+ */
213
+ public function register_content_type() {
214
+ if ( PirateForms_Util::get_option( 'pirateformsopt_store' ) === 'yes' ) {
215
+ $labels = array(
216
+ 'name' => _x( 'Contacts', 'post type general name', 'pirate-forms' ),
217
+ 'singular_name' => _x( 'Contact', 'post type singular name', 'pirate-forms' ),
218
+ 'menu_name' => _x( 'Contacts', 'admin menu', 'pirate-forms' ),
219
+ 'name_admin_bar' => _x( 'Contact', 'add new on admin bar', 'pirate-forms' ),
220
+ 'add_new' => _x( 'Add New', 'contact', 'pirate-forms' ),
221
+ 'add_new_item' => __( 'Add New Contact', 'pirate-forms' ),
222
+ 'new_item' => __( 'New Contact', 'pirate-forms' ),
223
+ 'edit_item' => __( 'Edit Contact', 'pirate-forms' ),
224
+ 'view_item' => __( 'View Contact', 'pirate-forms' ),
225
+ 'all_items' => __( 'All Contacts', 'pirate-forms' ),
226
+ 'search_items' => __( 'Search Contacts', 'pirate-forms' ),
227
+ 'parent_item_colon' => __( 'Parent Contacts:', 'pirate-forms' ),
228
+ 'not_found' => __( 'No contacts found.', 'pirate-forms' ),
229
+ 'not_found_in_trash' => __( 'No contacts found in Trash.', 'pirate-forms' ),
230
+ );
231
+ $args = array(
232
+ 'labels' => $labels,
233
+ 'description' => __( 'Contacts from Pirate Forms', 'pirate-forms' ),
234
+ 'public' => true,
235
+ 'publicly_queryable' => true,
236
+ 'show_ui' => true,
237
+ 'show_in_menu' => 'pirateforms-admin',
238
+ 'query_var' => true,
239
+ 'capability_type' => 'post',
240
+ 'has_archive' => true,
241
+ 'hierarchical' => false,
242
+ 'menu_position' => null,
243
+ 'supports' => array( 'title', 'editor', 'custom-fields' ),
244
+ );
245
+ register_post_type( 'pf_contact', $args );
246
+ }
247
+ }
248
+ }
includes/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/pirate-forms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPLv2.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Free & Simple Contact Form Plugin - PirateForms 1.2.0\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/pirate-forms/issues\n"
7
- "POT-Creation-Date: 2017-01-19 17:18:12+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -24,64 +24,65 @@ msgstr ""
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
- #: inc/helpers.php:16
28
- msgid "Sorry, an error occured."
29
  msgstr ""
30
 
31
- #: inc/settings.php:27 inc/settings.php:148 inc/settings.php:160
32
- #: inc/settings.php:172 inc/settings.php:184
 
33
  msgid "None"
34
  msgstr ""
35
 
36
- #: inc/settings.php:71 inc/settings.php:75
37
  msgid "Send Message"
38
  msgstr ""
39
 
40
- #: inc/settings.php:91
41
  msgid "Form processing options"
42
  msgstr ""
43
 
44
- #: inc/settings.php:97
45
  msgid "Contact notification sender email"
46
  msgstr ""
47
 
48
- #: inc/settings.php:98
49
  msgid "Insert [email] to use the contact form submitter's email."
50
  msgstr ""
51
 
52
- #: inc/settings.php:98
53
  msgid ""
54
  "Email to use for the sender of the contact form emails both to the "
55
  "recipients below and the contact form submitter (if this is activated "
56
  "below). The domain for this email address should match your site's domain."
57
  msgstr ""
58
 
59
- #: inc/settings.php:103
60
  msgid "Contact submission recipients"
61
  msgstr ""
62
 
63
- #: inc/settings.php:104
64
  msgid ""
65
  "Email address(es) to receive contact submission notifications. You can "
66
  "separate multiple emails with a comma."
67
  msgstr ""
68
 
69
- #: inc/settings.php:109
70
  msgid "Store submissions in the database"
71
  msgstr ""
72
 
73
- #: inc/settings.php:110
74
  msgid ""
75
  "Should the submissions be stored in the admin area? If chosen, contact form "
76
  "submissions will be saved in Contacts on the left (appears after this "
77
  "option is activated)."
78
  msgstr ""
79
 
80
- #: inc/settings.php:115
81
  msgid "Add a nonce to the contact form:"
82
  msgstr ""
83
 
84
- #: inc/settings.php:116
85
  msgid ""
86
  "Should the form use a WordPress nonce? This helps reduce spam by ensuring "
87
  "that the form submittor is on the site when submitting the form rather than "
@@ -90,293 +91,313 @@ msgid ""
90
  "forms not being able to be submitted with an error of \"Nonce failed!\""
91
  msgstr ""
92
 
93
- #: inc/settings.php:121
94
  msgid "Send email confirmation to form submitter"
95
  msgstr ""
96
 
97
- #: inc/settings.php:122
98
  msgid ""
99
  "Adding text here will send an email to the form submitter. The email uses "
100
  "the \"Successful form submission text\" field from the \"Alert Messages\" "
101
  "tab as the subject line. Plain text only here, no HTML."
102
  msgstr ""
103
 
104
- #: inc/settings.php:127
105
  msgid "\"Thank You\" URL"
106
  msgstr ""
107
 
108
- #: inc/settings.php:128
109
  msgid "Select the post-submit page for all forms submitted"
110
  msgstr ""
111
 
112
- #: inc/settings.php:136 inc/settings.php:450
 
113
  msgid "Fields Settings"
114
  msgstr ""
115
 
116
- #: inc/settings.php:143 inc/settings.php:226
117
  msgid "Name"
118
  msgstr ""
119
 
120
- #: inc/settings.php:144
121
  msgid "Do you want the name field to be displayed?"
122
  msgstr ""
123
 
124
- #: inc/settings.php:149 inc/settings.php:161 inc/settings.php:173
125
- #: inc/settings.php:185
126
  msgid "Yes but not required"
127
  msgstr ""
128
 
129
- #: inc/settings.php:150 inc/settings.php:162 inc/settings.php:174
130
- #: inc/settings.php:186
131
  msgid "Required"
132
  msgstr ""
133
 
134
- #: inc/settings.php:155
135
  msgid "Email address"
136
  msgstr ""
137
 
138
- #: inc/settings.php:156
139
  msgid "Do you want the email address field be displayed?"
140
  msgstr ""
141
 
142
- #: inc/settings.php:167 inc/settings.php:238 inc/settings.php:241
 
143
  msgid "Subject"
144
  msgstr ""
145
 
146
- #: inc/settings.php:168
147
  msgid "Do you want the subject field be displayed?"
148
  msgstr ""
149
 
150
- #: inc/settings.php:179 inc/settings.php:244
151
  msgid "Message"
152
  msgstr ""
153
 
154
- #: inc/settings.php:191
155
  msgid "Add a reCAPTCHA"
156
  msgstr ""
157
 
158
- #: inc/settings.php:198
159
  msgid "Site key"
160
  msgstr ""
161
 
162
- #: inc/settings.php:199
163
  msgid "Create an account here "
164
  msgstr ""
165
 
166
- #: inc/settings.php:199
167
  msgid "to get the Site key and the Secret key for the reCaptcha."
168
  msgstr ""
169
 
170
- #: inc/settings.php:205
171
  msgid "Secret key"
172
  msgstr ""
173
 
174
- #: inc/settings.php:212
175
  msgid "Add an attachment field"
176
  msgstr ""
177
 
178
- #: inc/settings.php:220 inc/settings.php:453
 
179
  msgid "Fields Labels"
180
  msgstr ""
181
 
182
- #: inc/settings.php:229
183
  msgid "Your Name"
184
  msgstr ""
185
 
186
- #: inc/settings.php:232
187
  msgid "Email"
188
  msgstr ""
189
 
190
- #: inc/settings.php:235
191
  msgid "Your Email"
192
  msgstr ""
193
 
194
- #: inc/settings.php:247
195
  msgid "Your message"
196
  msgstr ""
197
 
198
- #: inc/settings.php:250
199
  msgid "Submit button"
200
  msgstr ""
201
 
202
- #: inc/settings.php:258 inc/settings.php:456
 
203
  msgid "Alert Messages"
204
  msgstr ""
205
 
206
- #: inc/settings.php:264
207
  msgid "Name required and missing"
208
  msgstr ""
209
 
210
- #: inc/settings.php:267
211
  msgid "Enter your name"
212
  msgstr ""
213
 
214
- #: inc/settings.php:270
215
  msgid "E-mail required and missing"
216
  msgstr ""
217
 
218
- #: inc/settings.php:273
219
  msgid "Enter a valid email"
220
  msgstr ""
221
 
222
- #: inc/settings.php:276
223
  msgid "Subject required and missing"
224
  msgstr ""
225
 
226
- #: inc/settings.php:279
227
  msgid "Please enter a subject"
228
  msgstr ""
229
 
230
- #: inc/settings.php:282
231
  msgid "Question/comment is missing"
232
  msgstr ""
233
 
234
- #: inc/settings.php:285
235
  msgid "Enter your question or comment"
236
  msgstr ""
237
 
238
- #: inc/settings.php:288
239
  msgid "Successful form submission text"
240
  msgstr ""
241
 
242
- #: inc/settings.php:289
243
  msgid ""
244
  "This text is used on the page if no \"Thank You\" URL is set above. This is "
245
  "also used as the confirmation email title, if one is set to send out."
246
  msgstr ""
247
 
248
- #: inc/settings.php:291
249
  msgid "Thanks, your email was sent successfully!"
250
  msgstr ""
251
 
252
- #: inc/settings.php:296
253
  msgid "SMTP Options"
254
  msgstr ""
255
 
256
- #: inc/settings.php:302
257
  msgid "Use SMTP to send emails?"
258
  msgstr ""
259
 
260
- #: inc/settings.php:303
261
  msgid "Instead of PHP mail function"
262
  msgstr ""
263
 
264
- #: inc/settings.php:308
265
  msgid "SMTP Host"
266
  msgstr ""
267
 
268
- #: inc/settings.php:314
269
  msgid "SMTP Port"
270
  msgstr ""
271
 
272
- #: inc/settings.php:320
273
  msgid "Use SMTP Authentication?"
274
  msgstr ""
275
 
276
- #: inc/settings.php:321
277
  msgid ""
278
  "If you check this box, make sure the SMTP Username and SMTP Password are "
279
  "completed."
280
  msgstr ""
281
 
282
- #: inc/settings.php:326
283
- msgid "SMTP Username"
284
  msgstr ""
285
 
286
- #: inc/settings.php:332
287
- msgid "SMTP Password"
 
 
 
 
 
 
 
 
 
 
 
 
288
  msgstr ""
289
 
290
- #: inc/settings.php:349
291
- msgid "Pirate Forms settings"
292
  msgstr ""
293
 
294
- #: inc/settings.php:350 inc/settings.php:439 inc/widget.php:18
295
- #: inc/widget.php:19
 
296
  msgid "Pirate Forms"
297
  msgstr ""
298
 
299
- #: inc/settings.php:444
300
  msgid "How to use"
301
  msgstr ""
302
 
303
- #: inc/settings.php:447
304
  msgid "Options"
305
  msgstr ""
306
 
307
- #: inc/settings.php:459
308
  msgid "SMTP"
309
  msgstr ""
310
 
311
- #: inc/settings.php:466
312
  msgid "Welcome to Pirate Forms!"
313
  msgstr ""
314
 
315
- #: inc/settings.php:467
316
  msgid "To get started, just "
317
  msgstr ""
318
 
319
- #: inc/settings.php:468
320
  msgid "configure all the options "
321
  msgstr ""
322
 
323
- #: inc/settings.php:468
324
  msgid "you need, hit save and start using the created form."
325
  msgstr ""
326
 
327
- #: inc/settings.php:473
328
  msgid "There are 3 ways of using the newly created form:"
329
  msgstr ""
330
 
331
- #: inc/settings.php:475
332
  msgid "Add a "
333
  msgstr ""
334
 
335
- #: inc/settings.php:476
336
  msgid "widget"
337
  msgstr ""
338
 
339
- #: inc/settings.php:478 inc/settings.php:481
 
340
  msgid "Use the shortcode "
341
  msgstr ""
342
 
343
- #: inc/settings.php:479
344
  msgid " in any page or post."
345
  msgstr ""
346
 
347
- #: inc/settings.php:483
348
  msgid " in the theme's files."
349
  msgstr ""
350
 
351
- #: inc/settings.php:491
352
  msgid "Are you enjoying Pirate Forms?"
353
  msgstr ""
354
 
355
- #: inc/settings.php:493
 
356
  msgid "Rate our plugin on %1$s WordPress.org %2$s. We'd really appreciate it!"
357
  msgstr ""
358
 
359
- #: inc/settings.php:502
 
360
  msgid ""
361
  "If you want a more complex Contact Form Plugin please check %1$s this link "
362
  "%2$s."
363
  msgstr ""
364
 
365
- #: inc/settings.php:669
366
  msgid "Save changes"
367
  msgstr ""
368
 
369
- #: inc/settings.php:686
370
  msgid "Get Our Free Email Course"
371
  msgstr ""
372
 
373
- #: inc/settings.php:710
374
  msgid ""
375
  "Ready to learn how to reduce your website loading times by half? Come and "
376
  "join the 1st lesson here!"
377
  msgstr ""
378
 
379
- #: inc/settings.php:712
380
  msgid ""
381
  "Thank you for subscribing! You have been added to the mailing list and will "
382
  "receive the next email information in the coming weeks. If you ever wish to "
@@ -384,132 +405,143 @@ msgid ""
384
  "newsletter."
385
  msgstr ""
386
 
387
- #: inc/settings.php:720
388
  msgid "Control Emails in WordPress"
389
  msgstr ""
390
 
391
- #: inc/widget.php:80
392
  msgid "Title"
393
  msgstr ""
394
 
395
- #: inc/widget.php:81
396
  msgid "Text above form"
397
  msgstr ""
398
 
399
- #: inc/widget.php:84
400
  msgid "Title:"
401
  msgstr ""
402
 
403
- #: inc/widget.php:90
404
  msgid "Subtext:"
405
  msgstr ""
406
 
407
- #: pirate-forms.php:245
408
- msgid "Contact Referrer"
409
  msgstr ""
410
 
411
- #: pirate-forms.php:255
412
- msgid "Referring page"
413
  msgstr ""
414
 
415
- #: pirate-forms.php:387
416
- msgid "Nonce failed!"
417
  msgstr ""
418
 
419
- #: pirate-forms.php:394
420
- msgid "Form submission failed!"
421
  msgstr ""
422
 
423
- #: pirate-forms.php:399
424
- msgid "Contact form submission from"
425
  msgstr ""
426
 
427
- #: pirate-forms.php:452 pirate-forms.php:462
428
- msgid "Wrong reCAPTCHA"
429
  msgstr ""
430
 
431
- #: pirate-forms.php:469
432
- msgid "Please enter one or more Contact submission recipients"
433
  msgstr ""
434
 
435
- #: pirate-forms.php:483
436
- msgid "IP address: "
437
  msgstr ""
438
 
439
- #: pirate-forms.php:483
440
- msgid "IP search:"
441
  msgstr ""
442
 
443
- #: pirate-forms.php:487
444
- msgid "Came from: "
445
  msgstr ""
446
 
447
- #: pirate-forms.php:490
448
- msgid "Sent from page: "
449
  msgstr ""
450
 
451
- #: pirate-forms.php:498
452
- msgid "Form submission blocked!"
453
  msgstr ""
454
 
455
- #: pirate-forms.php:556
456
- msgid "Uploaded file is not allowed for file type"
457
  msgstr ""
458
 
459
- #: pirate-forms.php:563
460
- msgid "Uploaded file is too large"
461
  msgstr ""
462
 
463
- #: pirate-forms.php:576
464
- msgid "There was an unknown error uploading the file."
465
  msgstr ""
466
 
467
- #: pirate-forms.php:727
468
- msgid "Add New Contact"
469
  msgstr ""
470
 
471
- #: pirate-forms.php:728
472
- msgid "New Contact"
473
  msgstr ""
474
 
475
- #: pirate-forms.php:729
476
- msgid "Edit Contact"
477
  msgstr ""
478
 
479
- #: pirate-forms.php:730
480
- msgid "View Contact"
481
  msgstr ""
482
 
483
- #: pirate-forms.php:731
484
- msgid "All Contacts"
485
  msgstr ""
486
 
487
- #: pirate-forms.php:732
488
- msgid "Search Contacts"
489
  msgstr ""
490
 
491
- #: pirate-forms.php:733
492
- msgid "Parent Contacts:"
 
493
  msgstr ""
494
 
495
- #: pirate-forms.php:734
496
- msgid "No contacts found."
497
  msgstr ""
498
 
499
- #: pirate-forms.php:735
500
- msgid "No contacts found in Trash."
501
  msgstr ""
502
 
503
- #: pirate-forms.php:739
504
- msgid "Contacts from Pirate Forms"
505
  msgstr ""
506
 
507
- #: pirate-forms.php:758
508
- msgid "Settings"
 
 
 
 
 
 
 
 
 
 
509
  msgstr ""
510
 
511
  #. Plugin Name of the plugin/theme
512
- msgid "Free & Simple Contact Form Plugin - PirateForms"
513
  msgstr ""
514
 
515
  #. Plugin URI of the plugin/theme
@@ -528,27 +560,27 @@ msgstr ""
528
  msgid "http://themeisle.com"
529
  msgstr ""
530
 
531
- #: pirate-forms.php:722
532
  msgctxt "post type general name"
533
  msgid "Contacts"
534
  msgstr ""
535
 
536
- #: pirate-forms.php:723
537
  msgctxt "post type singular name"
538
  msgid "Contact"
539
  msgstr ""
540
 
541
- #: pirate-forms.php:724
542
  msgctxt "admin menu"
543
  msgid "Contacts"
544
  msgstr ""
545
 
546
- #: pirate-forms.php:725
547
  msgctxt "add new on admin bar"
548
  msgid "Contact"
549
  msgstr ""
550
 
551
- #: pirate-forms.php:726
552
  msgctxt "contact"
553
  msgid "Add New"
554
  msgstr ""
2
  # This file is distributed under the GPLv2.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Free & Simple Contact Form Plugin - Pirateforms 1.2.6\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/pirate-forms/issues\n"
7
+ "POT-Creation-Date: 2017-07-06 14:00:16+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
+ #: admin/class-pirateforms-admin.php:112 admin/class-pirateforms-admin.php:130
28
+ msgid "Settings"
29
  msgstr ""
30
 
31
+ #: admin/class-pirateforms-admin.php:166 admin/class-pirateforms-admin.php:287
32
+ #: admin/class-pirateforms-admin.php:299 admin/class-pirateforms-admin.php:311
33
+ #: admin/class-pirateforms-admin.php:323
34
  msgid "None"
35
  msgstr ""
36
 
37
+ #: admin/class-pirateforms-admin.php:210 admin/class-pirateforms-admin.php:214
38
  msgid "Send Message"
39
  msgstr ""
40
 
41
+ #: admin/class-pirateforms-admin.php:230
42
  msgid "Form processing options"
43
  msgstr ""
44
 
45
+ #: admin/class-pirateforms-admin.php:236
46
  msgid "Contact notification sender email"
47
  msgstr ""
48
 
49
+ #: admin/class-pirateforms-admin.php:237
50
  msgid "Insert [email] to use the contact form submitter's email."
51
  msgstr ""
52
 
53
+ #: admin/class-pirateforms-admin.php:237
54
  msgid ""
55
  "Email to use for the sender of the contact form emails both to the "
56
  "recipients below and the contact form submitter (if this is activated "
57
  "below). The domain for this email address should match your site's domain."
58
  msgstr ""
59
 
60
+ #: admin/class-pirateforms-admin.php:242
61
  msgid "Contact submission recipients"
62
  msgstr ""
63
 
64
+ #: admin/class-pirateforms-admin.php:243
65
  msgid ""
66
  "Email address(es) to receive contact submission notifications. You can "
67
  "separate multiple emails with a comma."
68
  msgstr ""
69
 
70
+ #: admin/class-pirateforms-admin.php:248
71
  msgid "Store submissions in the database"
72
  msgstr ""
73
 
74
+ #: admin/class-pirateforms-admin.php:249
75
  msgid ""
76
  "Should the submissions be stored in the admin area? If chosen, contact form "
77
  "submissions will be saved in Contacts on the left (appears after this "
78
  "option is activated)."
79
  msgstr ""
80
 
81
+ #: admin/class-pirateforms-admin.php:254
82
  msgid "Add a nonce to the contact form:"
83
  msgstr ""
84
 
85
+ #: admin/class-pirateforms-admin.php:255
86
  msgid ""
87
  "Should the form use a WordPress nonce? This helps reduce spam by ensuring "
88
  "that the form submittor is on the site when submitting the form rather than "
91
  "forms not being able to be submitted with an error of \"Nonce failed!\""
92
  msgstr ""
93
 
94
+ #: admin/class-pirateforms-admin.php:260
95
  msgid "Send email confirmation to form submitter"
96
  msgstr ""
97
 
98
+ #: admin/class-pirateforms-admin.php:261
99
  msgid ""
100
  "Adding text here will send an email to the form submitter. The email uses "
101
  "the \"Successful form submission text\" field from the \"Alert Messages\" "
102
  "tab as the subject line. Plain text only here, no HTML."
103
  msgstr ""
104
 
105
+ #: admin/class-pirateforms-admin.php:266
106
  msgid "\"Thank You\" URL"
107
  msgstr ""
108
 
109
+ #: admin/class-pirateforms-admin.php:267
110
  msgid "Select the post-submit page for all forms submitted"
111
  msgstr ""
112
 
113
+ #: admin/class-pirateforms-admin.php:275
114
+ #: admin/partials/pirateforms-settings-display.php:31
115
  msgid "Fields Settings"
116
  msgstr ""
117
 
118
+ #: admin/class-pirateforms-admin.php:282 admin/class-pirateforms-admin.php:365
119
  msgid "Name"
120
  msgstr ""
121
 
122
+ #: admin/class-pirateforms-admin.php:283
123
  msgid "Do you want the name field to be displayed?"
124
  msgstr ""
125
 
126
+ #: admin/class-pirateforms-admin.php:288 admin/class-pirateforms-admin.php:300
127
+ #: admin/class-pirateforms-admin.php:312 admin/class-pirateforms-admin.php:324
128
  msgid "Yes but not required"
129
  msgstr ""
130
 
131
+ #: admin/class-pirateforms-admin.php:289 admin/class-pirateforms-admin.php:301
132
+ #: admin/class-pirateforms-admin.php:313 admin/class-pirateforms-admin.php:325
133
  msgid "Required"
134
  msgstr ""
135
 
136
+ #: admin/class-pirateforms-admin.php:294
137
  msgid "Email address"
138
  msgstr ""
139
 
140
+ #: admin/class-pirateforms-admin.php:295
141
  msgid "Do you want the email address field be displayed?"
142
  msgstr ""
143
 
144
+ #: admin/class-pirateforms-admin.php:306 admin/class-pirateforms-admin.php:377
145
+ #: admin/class-pirateforms-admin.php:380
146
  msgid "Subject"
147
  msgstr ""
148
 
149
+ #: admin/class-pirateforms-admin.php:307
150
  msgid "Do you want the subject field be displayed?"
151
  msgstr ""
152
 
153
+ #: admin/class-pirateforms-admin.php:318 admin/class-pirateforms-admin.php:383
154
  msgid "Message"
155
  msgstr ""
156
 
157
+ #: admin/class-pirateforms-admin.php:330
158
  msgid "Add a reCAPTCHA"
159
  msgstr ""
160
 
161
+ #: admin/class-pirateforms-admin.php:337
162
  msgid "Site key"
163
  msgstr ""
164
 
165
+ #: admin/class-pirateforms-admin.php:338
166
  msgid "Create an account here "
167
  msgstr ""
168
 
169
+ #: admin/class-pirateforms-admin.php:338
170
  msgid "to get the Site key and the Secret key for the reCaptcha."
171
  msgstr ""
172
 
173
+ #: admin/class-pirateforms-admin.php:344
174
  msgid "Secret key"
175
  msgstr ""
176
 
177
+ #: admin/class-pirateforms-admin.php:351
178
  msgid "Add an attachment field"
179
  msgstr ""
180
 
181
+ #: admin/class-pirateforms-admin.php:359
182
+ #: admin/partials/pirateforms-settings-display.php:34
183
  msgid "Fields Labels"
184
  msgstr ""
185
 
186
+ #: admin/class-pirateforms-admin.php:368
187
  msgid "Your Name"
188
  msgstr ""
189
 
190
+ #: admin/class-pirateforms-admin.php:371
191
  msgid "Email"
192
  msgstr ""
193
 
194
+ #: admin/class-pirateforms-admin.php:374
195
  msgid "Your Email"
196
  msgstr ""
197
 
198
+ #: admin/class-pirateforms-admin.php:386
199
  msgid "Your message"
200
  msgstr ""
201
 
202
+ #: admin/class-pirateforms-admin.php:389
203
  msgid "Submit button"
204
  msgstr ""
205
 
206
+ #: admin/class-pirateforms-admin.php:397
207
+ #: admin/partials/pirateforms-settings-display.php:37
208
  msgid "Alert Messages"
209
  msgstr ""
210
 
211
+ #: admin/class-pirateforms-admin.php:403
212
  msgid "Name required and missing"
213
  msgstr ""
214
 
215
+ #: admin/class-pirateforms-admin.php:406
216
  msgid "Enter your name"
217
  msgstr ""
218
 
219
+ #: admin/class-pirateforms-admin.php:409
220
  msgid "E-mail required and missing"
221
  msgstr ""
222
 
223
+ #: admin/class-pirateforms-admin.php:412
224
  msgid "Enter a valid email"
225
  msgstr ""
226
 
227
+ #: admin/class-pirateforms-admin.php:415
228
  msgid "Subject required and missing"
229
  msgstr ""
230
 
231
+ #: admin/class-pirateforms-admin.php:418
232
  msgid "Please enter a subject"
233
  msgstr ""
234
 
235
+ #: admin/class-pirateforms-admin.php:421
236
  msgid "Question/comment is missing"
237
  msgstr ""
238
 
239
+ #: admin/class-pirateforms-admin.php:424
240
  msgid "Enter your question or comment"
241
  msgstr ""
242
 
243
+ #: admin/class-pirateforms-admin.php:427
244
  msgid "Successful form submission text"
245
  msgstr ""
246
 
247
+ #: admin/class-pirateforms-admin.php:428
248
  msgid ""
249
  "This text is used on the page if no \"Thank You\" URL is set above. This is "
250
  "also used as the confirmation email title, if one is set to send out."
251
  msgstr ""
252
 
253
+ #: admin/class-pirateforms-admin.php:430
254
  msgid "Thanks, your email was sent successfully!"
255
  msgstr ""
256
 
257
+ #: admin/class-pirateforms-admin.php:435
258
  msgid "SMTP Options"
259
  msgstr ""
260
 
261
+ #: admin/class-pirateforms-admin.php:441
262
  msgid "Use SMTP to send emails?"
263
  msgstr ""
264
 
265
+ #: admin/class-pirateforms-admin.php:442
266
  msgid "Instead of PHP mail function"
267
  msgstr ""
268
 
269
+ #: admin/class-pirateforms-admin.php:447
270
  msgid "SMTP Host"
271
  msgstr ""
272
 
273
+ #: admin/class-pirateforms-admin.php:453
274
  msgid "SMTP Port"
275
  msgstr ""
276
 
277
+ #: admin/class-pirateforms-admin.php:459
278
  msgid "Use SMTP Authentication?"
279
  msgstr ""
280
 
281
+ #: admin/class-pirateforms-admin.php:460 admin/class-pirateforms-admin.php:466
282
  msgid ""
283
  "If you check this box, make sure the SMTP Username and SMTP Password are "
284
  "completed."
285
  msgstr ""
286
 
287
+ #: admin/class-pirateforms-admin.php:465
288
+ msgid "Security?"
289
  msgstr ""
290
 
291
+ #: admin/class-pirateforms-admin.php:469
292
+ msgid "No"
293
+ msgstr ""
294
+
295
+ #: admin/class-pirateforms-admin.php:470
296
+ msgid "SSL"
297
+ msgstr ""
298
+
299
+ #: admin/class-pirateforms-admin.php:471
300
+ msgid "TLS"
301
+ msgstr ""
302
+
303
+ #: admin/class-pirateforms-admin.php:475
304
+ msgid "SMTP Username"
305
  msgstr ""
306
 
307
+ #: admin/class-pirateforms-admin.php:481
308
+ msgid "SMTP Password"
309
  msgstr ""
310
 
311
+ #: admin/partials/pirateforms-settings-display.php:20
312
+ #: includes/class-pirateforms-widget.php:18
313
+ #: includes/class-pirateforms-widget.php:21
314
  msgid "Pirate Forms"
315
  msgstr ""
316
 
317
+ #: admin/partials/pirateforms-settings-display.php:25
318
  msgid "How to use"
319
  msgstr ""
320
 
321
+ #: admin/partials/pirateforms-settings-display.php:28
322
  msgid "Options"
323
  msgstr ""
324
 
325
+ #: admin/partials/pirateforms-settings-display.php:40
326
  msgid "SMTP"
327
  msgstr ""
328
 
329
+ #: admin/partials/pirateforms-settings-display.php:47
330
  msgid "Welcome to Pirate Forms!"
331
  msgstr ""
332
 
333
+ #: admin/partials/pirateforms-settings-display.php:48
334
  msgid "To get started, just "
335
  msgstr ""
336
 
337
+ #: admin/partials/pirateforms-settings-display.php:49
338
  msgid "configure all the options "
339
  msgstr ""
340
 
341
+ #: admin/partials/pirateforms-settings-display.php:49
342
  msgid "you need, hit save and start using the created form."
343
  msgstr ""
344
 
345
+ #: admin/partials/pirateforms-settings-display.php:54
346
  msgid "There are 3 ways of using the newly created form:"
347
  msgstr ""
348
 
349
+ #: admin/partials/pirateforms-settings-display.php:56
350
  msgid "Add a "
351
  msgstr ""
352
 
353
+ #: admin/partials/pirateforms-settings-display.php:57
354
  msgid "widget"
355
  msgstr ""
356
 
357
+ #: admin/partials/pirateforms-settings-display.php:59
358
+ #: admin/partials/pirateforms-settings-display.php:62
359
  msgid "Use the shortcode "
360
  msgstr ""
361
 
362
+ #: admin/partials/pirateforms-settings-display.php:60
363
  msgid " in any page or post."
364
  msgstr ""
365
 
366
+ #: admin/partials/pirateforms-settings-display.php:64
367
  msgid " in the theme's files."
368
  msgstr ""
369
 
370
+ #: admin/partials/pirateforms-settings-display.php:72
371
  msgid "Are you enjoying Pirate Forms?"
372
  msgstr ""
373
 
374
+ #: admin/partials/pirateforms-settings-display.php:77
375
+ #. translators: link to WordPress.org repo for PirateForms
376
  msgid "Rate our plugin on %1$s WordPress.org %2$s. We'd really appreciate it!"
377
  msgstr ""
378
 
379
+ #: admin/partials/pirateforms-settings-display.php:91
380
+ #. translators: link to blog article about contact form plugins
381
  msgid ""
382
  "If you want a more complex Contact Form Plugin please check %1$s this link "
383
  "%2$s."
384
  msgstr ""
385
 
386
+ #: admin/partials/pirateforms-settings-display.php:295
387
  msgid "Save changes"
388
  msgstr ""
389
 
390
+ #: admin/partials/pirateforms-settings-sidebar-subscribe.php:2
391
  msgid "Get Our Free Email Course"
392
  msgstr ""
393
 
394
+ #: admin/partials/pirateforms-settings-sidebar-subscribe.php:26
395
  msgid ""
396
  "Ready to learn how to reduce your website loading times by half? Come and "
397
  "join the 1st lesson here!"
398
  msgstr ""
399
 
400
+ #: admin/partials/pirateforms-settings-sidebar-subscribe.php:28
401
  msgid ""
402
  "Thank you for subscribing! You have been added to the mailing list and will "
403
  "receive the next email information in the coming weeks. If you ever wish to "
405
  "newsletter."
406
  msgstr ""
407
 
408
+ #: admin/partials/pirateforms-settings-sidebar-subscribe.php:36
409
  msgid "Control Emails in WordPress"
410
  msgstr ""
411
 
412
+ #: includes/class-pirateforms-widget.php:82
413
  msgid "Title"
414
  msgstr ""
415
 
416
+ #: includes/class-pirateforms-widget.php:83
417
  msgid "Text above form"
418
  msgstr ""
419
 
420
+ #: includes/class-pirateforms-widget.php:86
421
  msgid "Title:"
422
  msgstr ""
423
 
424
+ #: includes/class-pirateforms-widget.php:92
425
  msgid "Subtext:"
426
  msgstr ""
427
 
428
+ #: includes/class-pirateforms.php:221
429
+ msgid "Add New Contact"
430
  msgstr ""
431
 
432
+ #: includes/class-pirateforms.php:222
433
+ msgid "New Contact"
434
  msgstr ""
435
 
436
+ #: includes/class-pirateforms.php:223
437
+ msgid "Edit Contact"
438
  msgstr ""
439
 
440
+ #: includes/class-pirateforms.php:224
441
+ msgid "View Contact"
442
  msgstr ""
443
 
444
+ #: includes/class-pirateforms.php:225
445
+ msgid "All Contacts"
446
  msgstr ""
447
 
448
+ #: includes/class-pirateforms.php:226
449
+ msgid "Search Contacts"
450
  msgstr ""
451
 
452
+ #: includes/class-pirateforms.php:227
453
+ msgid "Parent Contacts:"
454
  msgstr ""
455
 
456
+ #: includes/class-pirateforms.php:228
457
+ msgid "No contacts found."
458
  msgstr ""
459
 
460
+ #: includes/class-pirateforms.php:229
461
+ msgid "No contacts found in Trash."
462
  msgstr ""
463
 
464
+ #: includes/class-pirateforms.php:233
465
+ msgid "Contacts from Pirate Forms"
466
  msgstr ""
467
 
468
+ #: public/class-pirateforms-public.php:114
469
+ msgid "Nonce failed!"
470
  msgstr ""
471
 
472
+ #: public/class-pirateforms-public.php:122
473
+ msgid "Form submission failed!"
474
  msgstr ""
475
 
476
+ #: public/class-pirateforms-public.php:132
477
+ msgid "Contact form submission from"
478
  msgstr ""
479
 
480
+ #: public/class-pirateforms-public.php:159
481
+ msgid "Please enter one or more Contact submission recipients"
482
  msgstr ""
483
 
484
+ #: public/class-pirateforms-public.php:174
485
+ msgid "IP address: "
486
  msgstr ""
487
 
488
+ #: public/class-pirateforms-public.php:175
489
+ msgid "IP search:"
490
  msgstr ""
491
 
492
+ #: public/class-pirateforms-public.php:180
493
+ msgid "Came from: "
494
  msgstr ""
495
 
496
+ #: public/class-pirateforms-public.php:184
497
+ msgid "Sent from page: "
498
  msgstr ""
499
 
500
+ #: public/class-pirateforms-public.php:511
501
+ msgid "Contact Referrer"
502
  msgstr ""
503
 
504
+ #: public/class-pirateforms-public.php:522
505
+ msgid "Referring page"
506
  msgstr ""
507
 
508
+ #: public/class-pirateforms-public.php:582
509
+ msgid "Form submission blocked!"
510
  msgstr ""
511
 
512
+ #: public/class-pirateforms-public.php:757
513
+ #: public/class-pirateforms-public.php:768
514
+ msgid "Wrong reCAPTCHA"
515
  msgstr ""
516
 
517
+ #: public/class-pirateforms-public.php:796
518
+ msgid "Uploaded file is not allowed for file type"
519
  msgstr ""
520
 
521
+ #: public/class-pirateforms-public.php:802
522
+ msgid "Uploaded file is too large"
523
  msgstr ""
524
 
525
+ #: public/class-pirateforms-public.php:816
526
+ msgid "There was an unknown error uploading the file."
527
  msgstr ""
528
 
529
+ #: public/partials/pirateforms-form.php:25
530
+ msgid "Sorry, an error occured."
531
+ msgstr ""
532
+
533
+ #: vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php:476
534
+ msgid ""
535
+ "Updating this theme will lose any customizations you have made. Cancel to "
536
+ "stop, OK to update."
537
+ msgstr ""
538
+
539
+ #: vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget-dashboard-blog.php:197
540
+ msgid "Install"
541
  msgstr ""
542
 
543
  #. Plugin Name of the plugin/theme
544
+ msgid "Free & Simple Contact Form Plugin - Pirateforms"
545
  msgstr ""
546
 
547
  #. Plugin URI of the plugin/theme
560
  msgid "http://themeisle.com"
561
  msgstr ""
562
 
563
+ #: includes/class-pirateforms.php:216
564
  msgctxt "post type general name"
565
  msgid "Contacts"
566
  msgstr ""
567
 
568
+ #: includes/class-pirateforms.php:217
569
  msgctxt "post type singular name"
570
  msgid "Contact"
571
  msgstr ""
572
 
573
+ #: includes/class-pirateforms.php:218
574
  msgctxt "admin menu"
575
  msgid "Contacts"
576
  msgstr ""
577
 
578
+ #: includes/class-pirateforms.php:219
579
  msgctxt "add new on admin bar"
580
  msgid "Contact"
581
  msgstr ""
582
 
583
+ #: includes/class-pirateforms.php:220
584
  msgctxt "contact"
585
  msgid "Add New"
586
  msgstr ""
pirate-forms.php CHANGED
@@ -1,794 +1,148 @@
1
  <?php
2
- /*
3
- Plugin Name: Free & Simple Contact Form Plugin - PirateForms
4
- Plugin URI: http://themeisle.com/plugins/pirate-forms/
5
- Description: Easily creates a nice looking, simple contact form on your WP site.
6
- Version: 1.2.2
7
- Author: Themeisle
8
- Author URI: http://themeisle.com
9
- Text Domain: pirate-forms
10
- Domain Path: /languages
11
- License: GPLv2
12
- License URI: https://www.gnu.org/licenses/gpl-2.0.html
13
- */
14
- if ( ! function_exists( 'add_action' ) ) {
15
- die( 'Nothing to do...' );
16
- }
17
- /* Important constants */
18
- define( 'PIRATE_FORMS_VERSION', '1.2.2' );
19
- define( 'PIRATE_FORMS_URL', plugin_dir_url( __FILE__ ) );
20
- define( 'PIRATE_FORMS_PATH', plugin_dir_path( __FILE__ ) );
21
- /* Required helper functions */
22
- include_once( dirname( __FILE__ ) . '/inc/helpers.php' );
23
- include_once( dirname( __FILE__ ) . '/inc/settings.php' );
24
- include_once( dirname( __FILE__ ) . '/inc/widget.php' );
25
- add_action( 'plugins_loaded', 'pirate_forms_load_textdomain' );
26
- /**
27
- * Load plugin textdomain.
28
- *
29
- * @since 1.0.0
30
- */
31
- function pirate_forms_load_textdomain() {
32
- load_plugin_textdomain( 'pirate-forms', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
33
- }
34
 
35
  /**
36
- * Display the contact form or a confirmation message if submitted
 
 
 
 
 
37
  *
38
- * @param $atts
39
- * @param null $content
 
40
  *
41
- * @return string
 
 
 
 
 
 
 
 
 
 
 
 
42
  */
43
- add_shortcode( 'pirate_forms', 'pirate_forms_display_form' );
44
- function pirate_forms_display_form( $atts, $content = null ) {
45
- /* thank you message */
46
- $pirate_forms_thankyou_message = '';
47
- if ( ( ( isset( $_GET['pcf'] ) && $_GET['pcf'] == 1 ) || ( isset( $_POST['pirate-forms-contact-submit'] ) ) ) && empty( $_SESSION['pirate_forms_contact_errors'] ) ) {
48
- $pirate_forms_thankyou_message .= '
49
- <div class="col-sm-12 col-lg-12 pirate_forms_thankyou_wrap">
50
- <p>' . sanitize_text_field( pirate_forms_get_key( 'pirateformsopt_label_submit' ) ) . '</p>
51
- </div>';
52
- }
53
- /**
54
- ******** FormBuilder */
55
- if ( ! class_exists( 'PhpFormBuilder' ) ) {
56
- require_once( dirname( __FILE__ ) . '/inc/PhpFormBuilder.php' );
57
- }
58
- $pirate_form = new PhpFormBuilder();
59
- $pirate_form->set_att( 'id', 'pirate_forms_' . ( get_the_id() ? get_the_id() : 1 ) );
60
- $pirate_form->set_att( 'class', array( 'pirate_forms' ) );
61
- if ( 'yes' === pirate_forms_get_key( 'pirateformsopt_nonce' ) ) {
62
- $pirate_form->set_att( 'add_nonce', get_bloginfo( 'admin_email' ) );
63
- }
64
- $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
65
- if ( ! empty( $pirate_forms_options ) ) :
66
- /* Count the number of requested fields from Name, Email and Subject to add a certain class col-12, col-6 or col-4 */
67
- $pirate_forms_required_fields = 0;
68
- if ( ! empty( $pirate_forms_options['pirateformsopt_name_field'] ) && ! empty( $pirate_forms_options['pirateformsopt_label_name'] ) ) :
69
- $pirateformsopt_name_field = $pirate_forms_options['pirateformsopt_name_field'];
70
- $pirateformsopt_name_label = $pirate_forms_options['pirateformsopt_label_name'];
71
- if ( ! empty( $pirateformsopt_name_field ) && ! empty( $pirateformsopt_name_label ) && ( $pirateformsopt_name_field != '' ) ) :
72
- $pirate_forms_required_fields ++;
73
- endif;
74
- endif;
75
- if ( ! empty( $pirate_forms_options['pirateformsopt_email_field'] ) && ! empty( $pirate_forms_options['pirateformsopt_label_email'] ) ) :
76
- $pirateformsopt_email_field = $pirate_forms_options['pirateformsopt_email_field'];
77
- $pirateformsopt_email_label = $pirate_forms_options['pirateformsopt_label_email'];
78
- if ( ! empty( $pirateformsopt_email_field ) && ! empty( $pirateformsopt_email_label ) && ( $pirateformsopt_email_field != '' ) ) :
79
- $pirate_forms_required_fields ++;
80
- endif;
81
- endif;
82
- if ( ! empty( $pirate_forms_options['pirateformsopt_subject_field'] ) && ! empty( $pirate_forms_options['pirateformsopt_label_subject'] ) ) :
83
- $pirateformsopt_subject_field = $pirate_forms_options['pirateformsopt_subject_field'];
84
- $pirateformsopt_subject_label = $pirate_forms_options['pirateformsopt_label_subject'];
85
- if ( ! empty( $pirateformsopt_subject_field ) && ! empty( $pirateformsopt_subject_label ) && ( $pirateformsopt_subject_field != '' ) ) :
86
- $pirate_forms_required_fields ++;
87
- endif;
88
- endif;
89
- $pirate_forms_layout_input = '';
90
- switch ( $pirate_forms_required_fields ) {
91
- case 1:
92
- $pirate_forms_layout_input = 'col-sm-12 col-lg-12';
93
- break;
94
- case 2:
95
- $pirate_forms_layout_input = 'col-sm-6 col-lg-6';
96
- break;
97
- case 3:
98
- $pirate_forms_layout_input = 'col-sm-4 col-lg-4';
99
- break;
100
- default:
101
- $pirate_forms_layout_input = 'col-sm-4 col-lg-4';
102
- }
103
- /**
104
- ****** Name field */
105
- if ( ! empty( $pirateformsopt_name_field ) && ! empty( $pirateformsopt_name_label ) ) :
106
- $required = $pirateformsopt_name_field === 'req' ? true : false;
107
- $wrap_classes = array(
108
- $pirate_forms_layout_input . ' form_field_wrap',
109
- 'contact_name_wrap pirate_forms_three_inputs ',
110
- );
111
- // If this field was submitted with invalid data
112
- if ( isset( $_SESSION['pirate_forms_contact_errors']['contact-name'] ) ) {
113
- $wrap_classes[] = 'error';
114
- }
115
- $pirate_form->add_input(
116
- '',
117
- array(
118
- 'placeholder' => stripslashes( sanitize_text_field( $pirateformsopt_name_label ) ),
119
- 'required' => $required,
120
- 'wrap_class' => $wrap_classes,
121
- ),
122
- 'pirate-forms-contact-name'
123
- );
124
- endif;
125
- /**
126
- ****** Email field */
127
- if ( ! empty( $pirateformsopt_email_field ) && ! empty( $pirateformsopt_email_label ) ) :
128
- $required = $pirateformsopt_email_field === 'req' ? true : false;
129
- $wrap_classes = array(
130
- $pirate_forms_layout_input . ' form_field_wrap',
131
- 'contact_email_wrap pirate_forms_three_inputs ',
132
- );
133
- // If this field was submitted with invalid data
134
- if ( isset( $_SESSION['pirate_forms_contact_errors']['contact-email'] ) ) {
135
- $wrap_classes[] = 'error';
136
- }
137
- $pirate_form->add_input(
138
- '',
139
- array(
140
- 'placeholder' => stripslashes( sanitize_text_field( $pirateformsopt_email_label ) ),
141
- 'required' => $required,
142
- 'type' => 'email',
143
- 'wrap_class' => $wrap_classes,
144
- ),
145
- 'pirate-forms-contact-email'
146
- );
147
- endif;
148
- /**
149
- ****** Subject field */
150
- if ( ! empty( $pirateformsopt_subject_field ) && ! empty( $pirateformsopt_subject_label ) ) :
151
- $required = $pirateformsopt_subject_field === 'req' ? true : false;
152
- $wrap_classes = array(
153
- $pirate_forms_layout_input . ' form_field_wrap',
154
- 'contact_subject_wrap pirate_forms_three_inputs ',
155
- );
156
- // If this field was submitted with invalid data
157
- if ( isset( $_SESSION['pirate_forms_contact_errors']['contact-subject'] ) ) {
158
- $wrap_classes[] = 'error';
159
- }
160
- $pirate_form->add_input(
161
- '',
162
- array(
163
- 'placeholder' => stripslashes( sanitize_text_field( $pirateformsopt_subject_label ) ),
164
- 'required' => $required,
165
- 'wrap_class' => $wrap_classes,
166
- ),
167
- 'pirate-forms-contact-subject'
168
- );
169
- endif;
170
- /**
171
- ****** Message field */
172
- if ( ! empty( $pirate_forms_options['pirateformsopt_message_field'] ) && ! empty( $pirate_forms_options['pirateformsopt_label_message'] ) ) :
173
- $pirateformsopt_message_field = $pirate_forms_options['pirateformsopt_message_field'];
174
- $pirateformsopt_message_label = $pirate_forms_options['pirateformsopt_label_message'];
175
- if ( ! empty( $pirateformsopt_message_field ) && ! empty( $pirateformsopt_message_label ) ) :
176
- $required = $pirateformsopt_message_field === 'req' ? true : false;
177
- $wrap_classes = array( 'col-sm-12 col-lg-12 form_field_wrap', 'contact_message_wrap ' );
178
- // If this field was submitted with invalid data
179
- if ( isset( $_SESSION['pirate_forms_contact_errors']['contact-message'] ) ) {
180
- $wrap_classes[] = 'error';
181
- }
182
- $pirate_form->add_input(
183
- '',
184
- array(
185
- 'placeholder' => stripslashes( sanitize_text_field( $pirateformsopt_message_label ) ),
186
- 'required' => $required,
187
- 'wrap_class' => $wrap_classes,
188
- 'type' => 'textarea',
189
- ),
190
- 'pirate-forms-contact-message'
191
- );
192
- endif;
193
- endif;
194
- /**
195
- ******* ReCaptcha */
196
- if ( ! empty( $pirate_forms_options['pirateformsopt_recaptcha_secretkey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_sitekey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_field'] ) && ( $pirate_forms_options['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
197
- $pirateformsopt_recaptcha_sitekey = $pirate_forms_options['pirateformsopt_recaptcha_sitekey'];
198
- $pirateformsopt_recaptcha_secretkey = $pirate_forms_options['pirateformsopt_recaptcha_secretkey'];
199
- $pirate_form->add_input(
200
- '',
201
- array(
202
- 'value' => $pirateformsopt_recaptcha_sitekey,
203
- 'wrap_class' => 'col-xs-12 col-sm-6 col-lg-6 form_field_wrap form_captcha_wrap',
204
- 'type' => 'captcha',
205
- ),
206
- 'pirate-forms-captcha'
207
- );
208
- endif;
209
- /**
210
- ******** Attachment */
211
- if ( ! empty( $pirate_forms_options['pirateformsopt_attachment_field'] ) && ( $pirate_forms_options['pirateformsopt_attachment_field'] == 'yes' ) ) {
212
- $pirate_form->add_input(
213
- '',
214
- array(
215
- 'wrap_class' => $wrap_classes,
216
- 'type' => 'file',
217
- ),
218
- 'pirate-forms-attachment'
219
- );
220
-
221
- }
222
- /**
223
- ****** Submit button */
224
- if ( ! empty( $pirate_forms_options['pirateformsopt_label_submit_btn'] ) ) :
225
- $pirateformsopt_label_submit_btn = $pirate_forms_options['pirateformsopt_label_submit_btn'];
226
- if ( ! empty( $pirateformsopt_label_submit_btn ) ) :
227
- $wrap_classes = array();
228
- $pirate_form->add_input(
229
- '',
230
- array(
231
- 'value' => stripslashes( sanitize_text_field( $pirateformsopt_label_submit_btn ) ),
232
- 'wrap_class' => $wrap_classes,
233
- 'type' => 'submit',
234
- 'wrap_tag' => '',
235
- 'class' => 'pirate-forms-submit-button',
236
- ),
237
- 'pirate-forms-contact-submit'
238
- );
239
- endif;
240
- endif;
241
- endif;
242
- /* Referring site or page, if any */
243
- if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
244
- $pirate_form->add_input(
245
- __( 'Contact Referrer', 'pirate-forms' ),
246
- array(
247
- 'type' => 'hidden',
248
- 'value' => $_SERVER['HTTP_REFERER'],
249
- )
250
- );
251
- }
252
- /* Referring page, if sent via URL query */
253
- if ( ! empty( $_REQUEST['src'] ) || ! empty( $_REQUEST['ref'] ) ) {
254
- $pirate_form->add_input(
255
- __( 'Referring page', 'pirate-forms' ),
256
- array(
257
- 'type' => 'hidden',
258
- 'value' => ! empty( $_REQUEST['src'] ) ? $_REQUEST['src'] : $_REQUEST['ref'],
259
- )
260
- );
261
- }
262
- /* Are there any submission errors? */
263
- $errors = '';
264
- if ( ! empty( $_SESSION['pirate_forms_contact_errors'] ) ) {
265
- $errors = pirate_forms_display_errors( $_SESSION['pirate_forms_contact_errors'] );
266
- unset( $_SESSION['pirate_forms_contact_errors'] );
267
- }
268
-
269
- /* Display the form */
270
-
271
- return $pirate_forms_thankyou_message . '
272
- <div class="pirate_forms_wrap">
273
- ' . $errors . '
274
- ' . $pirate_form->build_form( false ) . '
275
- <div class="pirate_forms_clearfix"></div>
276
- </div>';
277
 
 
 
 
278
  }
279
 
 
 
 
 
 
 
 
 
280
  /**
281
- * Functions to Process uploaded files
 
282
  */
283
- function pirate_forms_canonicalize( $text ) {
284
- if ( function_exists( 'mb_convert_kana' )
285
- && 'UTF-8' == get_option( 'blog_charset' )
286
- ) {
287
- $text = mb_convert_kana( $text, 'asKV', 'UTF-8' );
288
- }
289
- $text = strtolower( $text );
290
- $text = trim( $text );
291
-
292
- return $text;
293
- }
294
-
295
- function pirate_forms_antiscript_file_name( $filename ) {
296
- $filename = basename( $filename );
297
- $parts = explode( '.', $filename );
298
- if ( count( $parts ) < 2 ) {
299
- return $filename;
300
- }
301
- $script_pattern = '/^(php|phtml|pl|py|rb|cgi|asp|aspx)\d?$/i';
302
- $filename = array_shift( $parts );
303
- $extension = array_pop( $parts );
304
- foreach ( (array) $parts as $part ) {
305
- if ( preg_match( $script_pattern, $part ) ) {
306
- $filename .= '.' . $part . '_';
307
- } else {
308
- $filename .= '.' . $part;
309
- }
310
- }
311
- if ( preg_match( $script_pattern, $extension ) ) {
312
- $filename .= '.' . $extension . '_.txt';
313
- } else {
314
- $filename .= '.' . $extension;
315
- }
316
-
317
- return $filename;
318
- }
319
-
320
- function pirate_forms_upload_dir( $type = false ) {
321
- $uploads = wp_upload_dir();
322
- $uploads = apply_filters( 'pirate_forms_upload_dir', array(
323
- 'dir' => $uploads['basedir'],
324
- 'url' => $uploads['baseurl'],
325
- ) );
326
- if ( 'dir' == $type ) {
327
- return $uploads['dir'];
328
- }
329
- if ( 'url' == $type ) {
330
- return $uploads['url'];
331
- }
332
-
333
- return $uploads;
334
- }
335
-
336
- function pirate_forms_upload_tmp_dir() {
337
- return pirate_forms_upload_dir( 'dir' ) . '/pirate_forms_uploads';
338
  }
339
 
340
- function pirate_forms_init_uploads() {
341
- $dir = pirate_forms_upload_tmp_dir();
342
- wp_mkdir_p( $dir );
343
- $htaccess_file = trailingslashit( $dir ) . '.htaccess';
344
- if ( file_exists( $htaccess_file ) ) {
345
- return;
346
- }
347
- try {
348
- $handle = fopen( $htaccess_file, 'w' );
349
-
350
- if ( ! $handle ) {
351
- throw new Exception( 'File open failed.' );
352
- } else {
353
- fwrite( $handle, "Deny from all\n" );
354
- fclose( $handle );
355
- }
356
- } catch ( Exception $e ) {
357
-
358
- }
359
  }
360
 
361
- function pirate_forms_maybe_add_random_dir( $dir ) {
362
- do {
363
- $rand_max = mt_getrandmax();
364
- $rand = zeroise( mt_rand( 0, $rand_max ), strlen( $rand_max ) );
365
- $dir_new = path_join( $dir, $rand );
366
- } while ( file_exists( $dir_new ) );
367
- if ( wp_mkdir_p( $dir_new ) ) {
368
- return $dir_new;
369
- }
370
-
371
- return $dir;
372
- }
373
-
374
- function pirate_forms_table_row( $key, $value ) {
375
- return '<tr><th>' . $key . '</th><td>' . $value . '</td></tr>';
376
- }
377
 
378
  /**
379
- * Process the incoming contact form data, if any
 
380
  */
381
- add_action( 'template_redirect', 'pirate_forms_process_contact' );
382
- function pirate_forms_process_contact() {
383
- // If POST and honeypot are not set, beat it
384
- if ( empty( $_POST ) || ! isset( $_POST['honeypot'] ) ) {
385
- return false;
386
- }
387
- // Session variable for form errors
388
- $_SESSION['pirate_forms_contact_errors'] = array();
389
- // If nonce is not valid, beat it
390
- if ( 'yes' === pirate_forms_get_key( 'pirateformsopt_nonce' ) ) {
391
- if ( ! wp_verify_nonce( $_POST['wordpress-nonce'], get_bloginfo( 'admin_email' ) ) ) {
392
- $_SESSION['pirate_forms_contact_errors']['nonce'] = __( 'Nonce failed!', 'pirate-forms' );
 
 
 
 
 
 
 
 
 
 
 
393
 
394
- return false;
395
- }
396
- }
397
- // If the honeypot caught a bear, beat it
398
- if ( ! empty( $_POST['honeypot'] ) ) {
399
- $_SESSION['pirate_forms_contact_errors']['honeypot'] = __( 'Form submission failed!', 'pirate-forms' );
400
 
401
- return false;
402
- }
403
- // Start the body of the contact email
404
- $body = '<h2>' . __( 'Contact form submission from', 'pirate-forms' ) . ' ' .
405
- get_bloginfo( 'name' ) . ' (' . site_url() . ') </h2>';
406
 
407
- $body .= '<table>';
408
- /**
409
- ******* Sanitize and validate name */
410
- $pirate_forms_contact_name = isset( $_POST['pirate-forms-contact-name'] ) ? sanitize_text_field( trim( $_POST['pirate-forms-contact-name'] ) ) : '';
411
- // if name is required and is missing
412
- if ( ( pirate_forms_get_key( 'pirateformsopt_name_field' ) === 'req' ) && empty( $pirate_forms_contact_name ) ) {
413
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-contact-name'] = pirate_forms_get_key( 'pirateformsopt_label_err_name' );
414
- } // If not required and empty, leave it out
415
- elseif ( ! empty( $pirate_forms_contact_name ) ) {
416
- $body .= pirate_forms_table_row( stripslashes( pirate_forms_get_key( 'pirateformsopt_label_name' ) ), $pirate_forms_contact_name );
417
- }
418
- /**
419
- ***** Sanitize and validate email */
420
- $pirate_forms_contact_email = isset( $_POST['pirate-forms-contact-email'] ) ? sanitize_email( $_POST['pirate-forms-contact-email'] ) : '';
421
- // If required, is it valid?
422
- if ( ( pirate_forms_get_key( 'pirateformsopt_email_field' ) === 'req' ) && ! filter_var( $pirate_forms_contact_email, FILTER_VALIDATE_EMAIL ) ) {
423
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-contact-email'] = pirate_forms_get_key( 'pirateformsopt_label_err_email' );
424
- } // If not required and empty, leave it out
425
- elseif ( ! empty( $pirate_forms_contact_email ) ) {
426
- $body .= pirate_forms_table_row( stripslashes( pirate_forms_get_key( 'pirateformsopt_label_email' ) ), $pirate_forms_contact_email );
427
- }
428
- /**
429
- ******* Sanitize and validate subject */
430
- $pirate_forms_contact_subject = isset( $_POST['pirate-forms-contact-subject'] ) ? sanitize_text_field( trim( $_POST['pirate-forms-contact-subject'] ) ) : '';
431
- // if subject is required and is missing
432
- if ( ( pirate_forms_get_key( 'pirateformsopt_subject_field' ) === 'req' ) && empty( $pirate_forms_contact_subject ) ) {
433
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-contact-subject'] = pirate_forms_get_key( 'pirateformsopt_label_err_subject' );
434
- } // If not required and empty, leave it out
435
- elseif ( ! empty( $pirate_forms_contact_subject ) ) {
436
- $body .= pirate_forms_table_row( stripslashes( pirate_forms_get_key( 'pirateformsopt_label_subject' ) ), $pirate_forms_contact_subject );
437
- }
438
- /**
439
- ******* Sanitize and validate message */
440
- $pirate_forms_contact_message = isset( $_POST['pirate-forms-contact-message'] ) ? sanitize_text_field( trim( $_POST['pirate-forms-contact-message'] ) ) : '';
441
- // if message is required and is missing
442
- if ( ( pirate_forms_get_key( 'pirateformsopt_message_field' ) === 'req' ) && empty( $pirate_forms_contact_message ) ) {
443
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-contact-message'] = pirate_forms_get_key( 'pirateformsopt_label_err_message' );
444
- } // If not required and empty, leave it out
445
- elseif ( ! empty( $pirate_forms_contact_message ) ) {
446
- $body .= pirate_forms_table_row( stripslashes( pirate_forms_get_key( 'pirateformsopt_label_message' ) ), $pirate_forms_contact_message );
447
- }
448
- /**
449
- *********** Validate reCAPTCHA */
450
- $pirateformsopt_recaptcha_sitekey = pirate_forms_get_key( 'pirateformsopt_recaptcha_sitekey' );
451
- $pirateformsopt_recaptcha_secretkey = pirate_forms_get_key( 'pirateformsopt_recaptcha_secretkey' );
452
- $pirateformsopt_recaptcha_field = pirate_forms_get_key( 'pirateformsopt_recaptcha_field' );
453
- if ( ! empty( $pirateformsopt_recaptcha_secretkey ) && ! empty( $pirateformsopt_recaptcha_sitekey ) && ! empty( $pirateformsopt_recaptcha_field ) && ( $pirateformsopt_recaptcha_field == 'yes' ) ) :
454
- if ( isset( $_POST['g-recaptcha-response'] ) ) {
455
- $captcha = $_POST['g-recaptcha-response'];
456
- }
457
- if ( ! $captcha ) {
458
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-captcha'] = __( 'Wrong reCAPTCHA', 'pirate-forms' );
459
- }
460
- $response = wp_remote_get( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $pirateformsopt_recaptcha_secretkey . '&response=' . $captcha . '&remoteip=' . $_SERVER['REMOTE_ADDR'] );
461
- if ( ! empty( $response ) ) :
462
- $response_body = wp_remote_retrieve_body( $response );
463
- endif;
464
- if ( ! empty( $response_body ) ) :
465
- $result = json_decode( $response_body, true );
466
- endif;
467
- if ( isset( $result['success'] ) && ( $result['success'] == false ) ) {
468
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-captcha'] = __( 'Wrong reCAPTCHA', 'pirate-forms' );
469
- }
470
- endif;
471
- /**
472
- ******** Validate recipients email */
473
- $site_recipients = sanitize_text_field( pirate_forms_get_key( 'pirateformsopt_email_recipients' ) );
474
- if ( empty( $site_recipients ) ) {
475
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-recipients-email'] = __( 'Please enter one or more Contact submission recipients', 'pirate-forms' );
476
- }
477
- /**
478
- ****** Sanitize and validate IP */
479
- $contact_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP );
480
- /* for the case of a Web server behind a reverse proxy */
481
- if ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $_SERVER ) ) {
482
- $contact_ip_tmp = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
483
- if ( ! empty( $contact_ip_tmp ) ) {
484
- $contact_ip = array_pop( $contact_ip_tmp );
485
- }
486
- }
487
- // If valid and present, create a link to an IP search
488
- if ( ! empty( $contact_ip ) ) {
489
- $body .= pirate_forms_table_row( __( 'IP address: ', 'pirate-forms' ), $contact_ip );
490
- $body .= pirate_forms_table_row( __( 'IP search:', 'pirate-forms' ), "http://whatismyipaddress.com/ip/$contact_ip" );
491
- }
492
- // Sanitize and prepare referrer;
493
- if ( ! empty( $_POST['pirate-forms-contact-referrer'] ) ) {
494
- $body .= pirate_forms_table_row( __( 'Came from: ', 'pirate-forms' ), sanitize_text_field( $_POST['pirate-forms-contact-referrer'] ) );
495
- }
496
- // Show the page this contact form was submitted on
497
- $body .= pirate_forms_table_row( __( 'Sent from page: ', 'pirate-forms' ), get_permalink( get_the_id() ) );
498
- // Check the blacklist
499
- $blocked = pirate_forms_get_blacklist();
500
- if ( ! empty( $blocked ) ) {
501
- if (
502
- in_array( $pirate_forms_contact_email, $blocked ) ||
503
- in_array( $contact_ip, $blocked )
504
- ) {
505
- $_SESSION['pirate_forms_contact_errors']['blacklist-blocked'] = __( 'Form submission blocked!', 'pirate-forms' );
506
 
507
- return false;
508
- }
509
- }
510
- $body .= '</table>';
511
 
512
- // No errors? Go ahead and process the contact
513
- if ( empty( $_SESSION['pirate_forms_contact_errors'] ) ) {
514
- $pirate_forms_options_tmp = get_option( 'pirate_forms_settings_array' );
515
- if ( isset( $pirate_forms_options_tmp['pirateformsopt_email'] ) ) {
516
- $site_email = $pirate_forms_options_tmp['pirateformsopt_email'];
517
- }
518
- if ( ! empty( $pirate_forms_contact_name ) ) :
519
- $site_name = $pirate_forms_contact_name;
520
- else :
521
- $site_name = htmlspecialchars_decode( get_bloginfo( 'name' ) );
522
- endif;
523
- // Notification recipients
524
- $site_recipients = sanitize_text_field( pirate_forms_get_key( 'pirateformsopt_email_recipients' ) );
525
- $site_recipients = explode( ',', $site_recipients );
526
- $site_recipients = array_map( 'trim', $site_recipients );
527
- $site_recipients = array_map( 'sanitize_email', $site_recipients );
528
- $site_recipients = implode( ',', $site_recipients );
529
- // No name? Use the submitter email address, if one is present
530
- if ( empty( $pirate_forms_contact_name ) ) {
531
- $pirate_forms_contact_name = ! empty( $pirate_forms_contact_email ) ? $pirate_forms_contact_email : '[None given]';
532
- }
533
- // Need an email address for the email notification
534
- if ( ! empty( $site_email ) ) {
535
- if ( $site_email == '[email]' ) {
536
- if ( ! empty( $pirate_forms_contact_email ) ) {
537
- $send_from = $pirate_forms_contact_email;
538
- } else {
539
- $send_from = pirate_forms_from_email();
540
- }
541
- } else {
542
- $send_from = $site_email;
543
  }
544
- } else {
545
- $send_from = pirate_forms_from_email();
546
  }
547
- $send_from_name = $site_name;
548
- // Sent an email notification to the correct address
549
- $headers = "From: $send_from_name <$send_from>\r\nReply-To: $pirate_forms_contact_name <$pirate_forms_contact_email>\r\nContent-type: text/html";
550
- add_action( 'phpmailer_init', 'pirate_forms_phpmailer' );
551
- /**
552
- ******* Validate Attachment */
553
- $attachments = '';
554
- $use_files = pirate_forms_get_key( 'pirateformsopt_attachment_field' );
555
- if ( ! empty( $use_files ) && ( $use_files == 'yes' ) ) {
556
- $attachments = '';
557
- $pirate_forms_attach_file = isset( $_FILES['pirate-forms-attachment'] ) ? $_FILES['pirate-forms-attachment'] : '';
558
- if ( ! empty( $pirate_forms_attach_file ) && ! empty( $pirate_forms_attach_file['name'] ) ) {
559
- /* Validate file type */
560
- $pirate_forms_file_types_allowed = 'jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv';
561
- $pirate_forms_file_types_allowed = trim( $pirate_forms_file_types_allowed, '|' );
562
- $pirate_forms_file_types_allowed = '(' . $pirate_forms_file_types_allowed . ')';
563
- $pirate_forms_file_types_allowed = '/\.' . $pirate_forms_file_types_allowed . '$/i';
564
- if ( ! preg_match( $pirate_forms_file_types_allowed, $pirate_forms_attach_file['name'] ) ) {
565
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-upload-failed-type'] = __( 'Uploaded file is not allowed for file type', 'pirate-forms' );
566
 
567
- return false;
568
- }
569
- /* Validate file size */
570
- $pirate_forms_file_size_allowed = 1048576; // default size 1 MB
571
- if ( $pirate_forms_attach_file['size'] > $pirate_forms_file_size_allowed ) {
572
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-upload-failed-size'] = __( 'Uploaded file is too large', 'pirate-forms' );
573
- }
574
- pirate_forms_init_uploads();
575
- $uploads_dir = pirate_forms_upload_tmp_dir();
576
- $uploads_dir = pirate_forms_maybe_add_random_dir( $uploads_dir );
577
- $filename = $pirate_forms_attach_file['name'];
578
- $filename = pirate_forms_canonicalize( $filename );
579
- $filename = sanitize_file_name( $filename );
580
- $filename = pirate_forms_antiscript_file_name( $filename );
581
- $filename = wp_unique_filename( $uploads_dir, $filename );
582
- $new_file = trailingslashit( $uploads_dir ) . $filename;
583
- try {
584
- if ( false === move_uploaded_file( $pirate_forms_attach_file['tmp_name'], $new_file ) ) {
585
- throw new Exception( __( 'There was an unknown error uploading the file.', 'pirate-forms' ) );
586
- }
587
- } catch ( Exception $ex ) {
588
- $_SESSION['pirate_forms_contact_errors']['pirate-forms-upload-failed-general'] = $ex->getMessage();
589
- }
590
- if ( ! empty( $new_file ) ) {
591
- $attachments = $new_file;
592
- }
593
- }
594
- }
595
 
596
- wp_mail( $site_recipients, 'Contact on ' . htmlspecialchars_decode( get_bloginfo( 'name' ) ), $body, $headers, $attachments );
597
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
598
- WP_Filesystem();
599
- global $wp_filesystem;
600
- $wp_filesystem->delete( pirate_forms_upload_tmp_dir(), true, 'd' );
601
- // Should a confirm email be sent?
602
- $confirm_body = stripslashes( trim( pirate_forms_get_key( 'pirateformsopt_confirm_email' ) ) );
603
- if ( ! empty( $confirm_body ) && ! empty( $pirate_forms_contact_email ) ) {
604
- // Removing entities
605
- $confirm_body = htmlspecialchars_decode( $confirm_body );
606
- $confirm_body = html_entity_decode( $confirm_body );
607
- $confirm_body = str_replace( '&#39;', "'", $confirm_body );
608
- $headers = "From: $site_name <$site_email>\r\nReply-To: $site_name <$site_email>";
609
- wp_mail(
610
- $pirate_forms_contact_email,
611
- pirate_forms_get_key( 'pirateformsopt_label_submit' ) . ' - ' . $site_name,
612
- $confirm_body,
613
- $headers
614
- );
615
- }
616
- /**
617
- *********** Store the entries in the DB */
618
- if ( pirate_forms_get_key( 'pirateformsopt_store' ) === 'yes' ) {
619
- $new_post_id = wp_insert_post(
620
- array(
621
- 'post_type' => 'pf_contact',
622
- 'post_title' => date( 'l, M j, Y', time() ) . ' by "' . $pirate_forms_contact_name . '"',
623
- 'post_content' => $body,
624
- 'post_author' => 1,
625
- 'post_status' => 'private',
626
- )
627
- );
628
- if ( isset( $pirate_forms_contact_email ) && ! empty( $pirate_forms_contact_email ) ) {
629
- add_post_meta( $new_post_id, 'Contact email', $pirate_forms_contact_email );
630
- }
631
  }
632
- $pirate_forms_current_theme = wp_get_theme();
633
- /* If a Thank you page is selected, redirect to that page */
634
- if ( pirate_forms_get_key( 'pirateformsopt_thank_you_url' ) ) {
635
- $redirect_id = intval( pirate_forms_get_key( 'pirateformsopt_thank_you_url' ) );
636
- $redirect = get_permalink( $redirect_id );
637
- wp_safe_redirect( $redirect );
638
- } /* Redirect to ?pcf=1#contact only if the theme is Zerif */
639
- elseif ( ( 'Zerif Lite' == $pirate_forms_current_theme->name ) || ( 'Zerif Lite' == $pirate_forms_current_theme->parent_theme ) || ( 'Zerif PRO' == $pirate_forms_current_theme->name ) || ( 'Zerif PRO' == $pirate_forms_current_theme->parent_theme ) ) {
640
- $redirect = $_SERVER['HTTP_REFERER'] . ( strpos( $_SERVER['HTTP_REFERER'], '?' ) === false ? '?' : '&' ) . 'pcf=1#contact';
641
- wp_safe_redirect( $redirect );
642
- }
643
- }
644
 
 
645
  }
646
 
647
  /**
648
- * Alter the phpmailer object
649
  *
650
- * @param $phpmailer PHPMailer object
651
- */
652
- function pirate_forms_phpmailer( $phpmailer ) {
653
- $pirateformsopt_use_smtp = pirate_forms_get_key( 'pirateformsopt_use_smtp' );
654
- $pirateformsopt_smtp_host = pirate_forms_get_key( 'pirateformsopt_smtp_host' );
655
- $pirateformsopt_smtp_port = pirate_forms_get_key( 'pirateformsopt_smtp_port' );
656
- $pirateformsopt_smtp_username = pirate_forms_get_key( 'pirateformsopt_smtp_username' );
657
- $pirateformsopt_smtp_password = pirate_forms_get_key( 'pirateformsopt_smtp_password' );
658
- $pirateformsopt_use_smtp_authentication = pirate_forms_get_key( 'pirateformsopt_use_smtp_authentication' );
659
- if ( ! empty( $pirateformsopt_use_smtp ) && ( $pirateformsopt_use_smtp == 'yes' ) && ! empty( $pirateformsopt_smtp_host ) && ! empty( $pirateformsopt_smtp_port ) ) :
660
- // @codingStandardsIgnoreStart
661
- $phpmailer->isSMTP();
662
- $phpmailer->Host = $pirateformsopt_smtp_host;
663
- if ( ! empty( $pirateformsopt_use_smtp_authentication ) && ( $pirateformsopt_use_smtp_authentication == 'yes' ) && ! empty( $pirateformsopt_smtp_username ) && ! empty( $pirateformsopt_smtp_password ) ) :
664
- $phpmailer->SMTPAuth = true; // Force it to use Username and Password to authenticate
665
- $phpmailer->Port = $pirateformsopt_smtp_port;
666
- $phpmailer->Username = $pirateformsopt_smtp_username;
667
- $phpmailer->Password = $pirateformsopt_smtp_password;
668
- endif;
669
- // @codingStandardsIgnoreEnd
670
- endif;
671
- }
672
-
673
- /* Get a settings value */
674
- function pirate_forms_get_key( $id ) {
675
- $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
676
-
677
- return isset( $pirate_forms_options[ $id ] ) ? $pirate_forms_options[ $id ] : '';
678
- }
679
-
680
- /**
681
- ************************** Scripts and Styles */
682
- add_action( 'wp_enqueue_scripts', 'pirate_forms_add_styles_and_scripts' );
683
- function pirate_forms_add_styles_and_scripts() {
684
- /* style for frontpage contact */
685
- wp_enqueue_style( 'pirate_forms_front_styles', PIRATE_FORMS_URL . 'css/front.css' );
686
- /* recaptcha js */
687
- $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
688
- if ( ! empty( $pirate_forms_options ) ) :
689
- if ( ! empty( $pirate_forms_options['pirateformsopt_recaptcha_secretkey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_sitekey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_field'] ) && ( $pirate_forms_options['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
690
- if ( defined( 'POLYLANG_VERSION' ) && function_exists( 'pll_current_language' ) ) {
691
- $pirate_forms_contactus_language = pll_current_language();
692
- } else {
693
- $pirate_forms_contactus_language = get_locale();
694
- }
695
- wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . $pirate_forms_contactus_language . '' );
696
- wp_enqueue_script( 'pirate_forms_scripts', plugins_url( 'js/scripts.js', __FILE__ ), array(
697
- 'jquery',
698
- 'recaptcha',
699
- ) );
700
- endif;
701
- endif;
702
- wp_enqueue_script( 'pirate_forms_scripts_general', plugins_url( 'js/scripts-general.js', __FILE__ ), array( 'jquery' ) );
703
- $pirate_forms_errors = '';
704
- if ( ! empty( $_SESSION['pirate_forms_contact_errors'] ) ) :
705
- $pirate_forms_errors = $_SESSION['pirate_forms_contact_errors'];
706
- endif;
707
- wp_localize_script( 'pirate_forms_scripts_general', 'pirateFormsObject', array(
708
- 'errors' => $pirate_forms_errors,
709
- ) );
710
-
711
- }
712
-
713
- add_action( 'admin_enqueue_scripts', 'pirate_forms_admin_css' );
714
- function pirate_forms_admin_css() {
715
- global $pagenow;
716
- if ( ! empty( $pagenow ) && ( $pagenow == 'options-general.php' || $pagenow == 'admin.php' )
717
- && isset( $_GET['page'] ) && $_GET['page'] == 'pirate-forms-admin'
718
- ) {
719
- wp_enqueue_style( 'pirate_forms_admin_styles', PIRATE_FORMS_URL . 'css/wp-admin.css' );
720
- wp_enqueue_script( 'pirate_forms_scripts_admin', plugins_url( 'js/scripts-admin.js', __FILE__ ), array( 'jquery' ) );
721
- wp_localize_script( 'pirate_forms_scripts_admin', 'cwp_top_ajaxload', array(
722
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
723
- ) );
724
- }
725
- }
726
-
727
- /**
728
- * If submissions should be stored in the DB, create the Contacts CPT */
729
- if ( pirate_forms_get_key( 'pirateformsopt_store' ) === 'yes' ) {
730
- add_action( 'init', 'pirate_forms_register_content_type' );
731
- function pirate_forms_register_content_type() {
732
- $labels = array(
733
- 'name' => _x( 'Contacts', 'post type general name', 'pirate-forms' ),
734
- 'singular_name' => _x( 'Contact', 'post type singular name', 'pirate-forms' ),
735
- 'menu_name' => _x( 'Contacts', 'admin menu', 'pirate-forms' ),
736
- 'name_admin_bar' => _x( 'Contact', 'add new on admin bar', 'pirate-forms' ),
737
- 'add_new' => _x( 'Add New', 'contact', 'pirate-forms' ),
738
- 'add_new_item' => __( 'Add New Contact', 'pirate-forms' ),
739
- 'new_item' => __( 'New Contact', 'pirate-forms' ),
740
- 'edit_item' => __( 'Edit Contact', 'pirate-forms' ),
741
- 'view_item' => __( 'View Contact', 'pirate-forms' ),
742
- 'all_items' => __( 'All Contacts', 'pirate-forms' ),
743
- 'search_items' => __( 'Search Contacts', 'pirate-forms' ),
744
- 'parent_item_colon' => __( 'Parent Contacts:', 'pirate-forms' ),
745
- 'not_found' => __( 'No contacts found.', 'pirate-forms' ),
746
- 'not_found_in_trash' => __( 'No contacts found in Trash.', 'pirate-forms' ),
747
- );
748
- $args = array(
749
- 'labels' => $labels,
750
- 'description' => __( 'Contacts from Pirate Forms', 'pirate-forms' ),
751
- 'public' => true,
752
- 'publicly_queryable' => true,
753
- 'show_ui' => true,
754
- 'show_in_menu' => true,
755
- 'query_var' => true,
756
- 'capability_type' => 'post',
757
- 'has_archive' => true,
758
- 'hierarchical' => false,
759
- 'menu_position' => null,
760
- 'supports' => array( 'title', 'editor', 'custom-fields' ),
761
- );
762
- register_post_type( 'pf_contact', $args );
763
- }
764
- }
765
- /**
766
- * Add a Settings link in the plugins list for the Pirate Forms
767
  */
768
- function pirate_forms_add_settings_link( $links ) {
769
- $settings_link = '<a href="options-general.php?page=pirate-forms-admin">' . __( 'Settings', 'pirate-forms' ) . '</a>';
770
- if ( function_exists( 'array_unshift' ) ) :
771
- array_unshift( $links, $settings_link );
772
- else :
773
- array_push( $links, $settings_link );
774
- endif;
775
 
776
- return $links;
777
- }
778
 
779
- $plugin = plugin_basename( __FILE__ );
780
- add_filter( "plugin_action_links_$plugin", 'pirate_forms_add_settings_link' );
781
- /**
782
- * Allow [pirate_forms] shortcode in text widget
783
- */
784
- add_filter( 'widget_text', 'pirate_forms_widget_text_filter', 9 );
785
- function pirate_forms_widget_text_filter( $content ) {
786
- if ( ! preg_match( '[pirate_forms]', $content ) ) {
787
- return $content;
788
  }
789
- $content = do_shortcode( $content );
790
-
791
- return $content;
 
792
  }
793
-
794
- require dirname( __FILE__ ) . '/dashboard/dashboard.php';
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  /**
4
+ * The plugin bootstrap file
5
+ *
6
+ * This file is read by WordPress to generate the plugin information in the plugin
7
+ * admin area. This file also includes all of the dependencies used by the plugin,
8
+ * registers the activation and deactivation functions, and defines a function
9
+ * that starts the plugin.
10
  *
11
+ * @link http://example.com
12
+ * @since 1.2.6
13
+ * @package PirateForms
14
  *
15
+ * @wordpress-plugin
16
+ * Plugin Name: Free & Simple Contact Form Plugin - Pirateforms
17
+ * Plugin URI: http://themeisle.com/plugins/pirate-forms/
18
+ * Description: Easily creates a nice looking, simple contact form on your WP site.
19
+ * Version: 1.2.6
20
+ * Author: Themeisle
21
+ * Author URI: http://themeisle.com
22
+ * Text Domain: pirate-forms
23
+ * Domain Path: /languages
24
+ * License: GPLv2
25
+ * WordPress Available: yes
26
+ * Requires License: no
27
+ * License URI: https://www.gnu.org/licenses/gpl-2.0.html
28
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ // If this file is called directly, abort.
31
+ if ( ! defined( 'WPINC' ) ) {
32
+ die;
33
  }
34
 
35
+ define( 'PIRATEFORMS_NAME', 'Pirate Forms' );
36
+ define( 'PIRATEFORMS_SLUG', 'pirate-forms' );
37
+ define( 'PIRATEFORMS_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
38
+ define( 'PIRATEFORMS_URL', plugin_dir_url( __FILE__ ) );
39
+ define( 'PIRATEFORMS_BASENAME', plugin_basename( __FILE__ ) );
40
+ define( 'PIRATEFORMS_BASEFILE', __FILE__ );
41
+ define( 'PIRATEFORMS_ROOT', trailingslashit( plugins_url( '', __FILE__ ) ) );
42
+
43
  /**
44
+ * The code that runs during plugin activation.
45
+ * This action is documented in includes/class-plugin-name-activator.php
46
  */
47
+ function activate_pirate_forms() {
48
+ PirateForms_Activator::activate();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
 
51
+ /**
52
+ * The code that runs during plugin deactivation.
53
+ * This action is documented in includes/class-plugin-name-deactivator.php
54
+ */
55
+ function deactivate_pirate_forms() {
56
+ PirateForms_Deactivator::deactivate();
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
+ register_activation_hook( __FILE__, 'activate_pirate_forms' );
60
+ register_deactivation_hook( __FILE__, 'deactivate_pirate_forms' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  /**
63
+ * The core plugin class that is used to define internationalization,
64
+ * admin-specific hooks, and public-facing site hooks.
65
  */
66
+ /**
67
+ * The core plugin class that is used to define internationalization,
68
+ * admin-specific hooks, and public-facing site hooks.
69
+ *
70
+ * @param string $class The class name to load.
71
+ *
72
+ * @return bool Either was loaded or not.
73
+ * @since 3.0.0
74
+ */
75
+ function pirate_forms_autoload( $class ) {
76
+ $namespaces = array( 'PirateForms' );
77
+ $class1 = str_replace( '_', '-', strtolower( 'class-' . $class ) );
78
+ foreach ( $namespaces as $namespace ) {
79
+ if ( substr( $class, 0, strlen( $namespace ) ) == $namespace ) {
80
+ $filename = PIRATEFORMS_DIR . 'includes/' . $class1 . '.php';
81
+ if ( is_readable( $filename ) ) {
82
+ require_once $filename;
83
+
84
+ return true;
85
+ }
86
+ $filename = PIRATEFORMS_DIR . 'admin/' . $class1 . '.php';
87
+ if ( is_readable( $filename ) ) {
88
+ require_once $filename;
89
 
90
+ return true;
91
+ }
92
+ $filename = PIRATEFORMS_DIR . 'admin/partials/' . $class1 . '.php';
93
+ if ( is_readable( $filename ) ) {
94
+ require_once $filename;
 
95
 
96
+ return true;
97
+ }
98
+ $filename = PIRATEFORMS_DIR . 'public/' . $class1 . '.php';
99
+ if ( is_readable( $filename ) ) {
100
+ require_once $filename;
101
 
102
+ return true;
103
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
+ $filename = PIRATEFORMS_DIR . 'public/partials/' . $class1 . '.php';
106
+ if ( is_readable( $filename ) ) {
107
+ require_once $filename;
 
108
 
109
+ return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
 
 
111
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
+ $filename = PIRATEFORMS_DIR . 'includes/class-pirateforms-widget.php';
114
+ if ( is_readable( $filename ) ) {
115
+ require_once $filename;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
+ return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
119
+ }// End foreach().
 
 
 
 
 
 
 
 
 
 
 
120
 
121
+ return false;
122
  }
123
 
124
  /**
125
+ * Begins execution of the plugin.
126
  *
127
+ * Since everything within the plugin is registered via hooks,
128
+ * then kicking off the plugin from this point in the file does
129
+ * not affect the page life cycle.
130
+ *
131
+ * @since 1.0.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  */
133
+ function run_pirate_forms() {
 
 
 
 
 
 
134
 
135
+ $plugin = new PirateForms();
136
+ $plugin->run();
137
 
138
+ $vendor_file = PIRATEFORMS_DIR . '/vendor/autoload_52.php';
139
+ if ( is_readable( $vendor_file ) ) {
140
+ require_once $vendor_file;
 
 
 
 
 
 
141
  }
142
+ add_filter( 'themeisle_sdk_products', function ( $products ) {
143
+ $products[] = PIRATEFORMS_BASEFILE;
144
+ return $products;
145
+ } );
146
  }
147
+ spl_autoload_register( 'pirate_forms_autoload' );
148
+ run_pirate_forms();
public/class-pirateforms-public.php ADDED
@@ -0,0 +1,826 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The public-facing functionality of the plugin.
5
+ *
6
+ * @link http://example.com
7
+ * @since 1.0.0
8
+ *
9
+ * @package PirateForms
10
+ * @subpackage PirateForms/public
11
+ */
12
+
13
+ /**
14
+ * The public-facing functionality of the plugin.
15
+ *
16
+ * Defines the plugin name, version, and two examples hooks for how to
17
+ * enqueue the admin-specific stylesheet and JavaScript.
18
+ *
19
+ * @package PirateForms
20
+ * @subpackage PirateForms/public
21
+ * @author Your Name <email@example.com>
22
+ */
23
+ class PirateForms_Public {
24
+
25
+ /**
26
+ * The ID of this plugin.
27
+ *
28
+ * @since 1.0.0
29
+ * @access private
30
+ * @var string $plugin_name The ID of this plugin.
31
+ */
32
+ private $plugin_name;
33
+
34
+ /**
35
+ * The version of this plugin.
36
+ *
37
+ * @since 1.0.0
38
+ * @access private
39
+ * @var string $version The current version of this plugin.
40
+ */
41
+ private $version;
42
+
43
+ /**
44
+ * Initialize the class and set its properties.
45
+ *
46
+ * @since 1.0.0
47
+ * @param string $plugin_name The name of the plugin.
48
+ * @param string $version The version of this plugin.
49
+ */
50
+ public function __construct( $plugin_name, $version ) {
51
+
52
+ $this->plugin_name = $plugin_name;
53
+ $this->version = $version;
54
+
55
+ }
56
+
57
+ /**
58
+ * Register the stylesheets for the public-facing side of the site.
59
+ *
60
+ * @since 1.0.0
61
+ */
62
+ public function enqueue_styles_and_scripts() {
63
+
64
+ /* style for frontpage contact */
65
+ wp_enqueue_style( 'pirate_forms_front_styles', PIRATEFORMS_URL . 'public/css/front.css', array(), $this->version );
66
+ /* recaptcha js */
67
+ $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
68
+ if ( ! empty( $pirate_forms_options ) ) :
69
+ if ( ! empty( $pirate_forms_options['pirateformsopt_recaptcha_secretkey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_sitekey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_field'] ) && ( $pirate_forms_options['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
70
+ if ( defined( 'POLYLANG_VERSION' ) && function_exists( 'pll_current_language' ) ) {
71
+ $pirate_forms_contactus_language = pll_current_language();
72
+ } else {
73
+ $pirate_forms_contactus_language = get_locale();
74
+ }
75
+ wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . $pirate_forms_contactus_language . '' );
76
+ wp_enqueue_script( 'pirate_forms_scripts', PIRATEFORMS_URL . 'public/js/scripts.js', array(
77
+ 'jquery',
78
+ 'recaptcha',
79
+ ), $this->version );
80
+ endif;
81
+ endif;
82
+ wp_enqueue_script( 'pirate_forms_scripts_general', PIRATEFORMS_URL . 'public/js/scripts-general.js', array( 'jquery' ), $this->version );
83
+ $pirate_forms_errors = '';
84
+ if ( ! empty( $_SESSION['pirate_forms_contact_errors'] ) ) :
85
+ $pirate_forms_errors = $_SESSION['pirate_forms_contact_errors'];
86
+ endif;
87
+ wp_localize_script( 'pirate_forms_scripts_general', 'pirateFormsObject', array(
88
+ 'errors' => $pirate_forms_errors,
89
+ ) );
90
+ }
91
+
92
+ /**
93
+ * Process the form after submission
94
+ *
95
+ * @since 1.0.0
96
+ * @throws Exception When file uploading fails.
97
+ */
98
+ public function template_redirect() {
99
+ // If POST and honeypot are not set, beat it
100
+ if ( empty( $_POST ) || ! isset( $_POST['honeypot'] ) ) {
101
+ return false;
102
+ }
103
+
104
+ // separate the nonce from a form that is displayed in the widget vs. one that is not
105
+ $nonce_append = isset( $_POST['pirate_forms_from_widget'] ) && intval( $_POST['pirate_forms_from_widget'] ) === 1 ? 'yes' : 'no';
106
+
107
+ // Session variable for form errors
108
+ $error_key = wp_create_nonce( get_bloginfo( 'admin_email' ) . $nonce_append );
109
+ $_SESSION[ $error_key ] = array();
110
+
111
+ // If nonce is not valid, beat it
112
+ if ( 'yes' === PirateForms_Util::get_option( 'pirateformsopt_nonce' ) ) {
113
+ if ( ! wp_verify_nonce( $_POST['wordpress-nonce'], get_bloginfo( 'admin_email' ) . $nonce_append ) ) {
114
+ $_SESSION[ $error_key ]['nonce'] = __( 'Nonce failed!', 'pirate-forms' );
115
+
116
+ return false;
117
+ }
118
+ }
119
+
120
+ // If the honeypot caught a bear, beat it
121
+ if ( ! empty( $_POST['honeypot'] ) ) {
122
+ $_SESSION[ $error_key ]['honeypot'] = __( 'Form submission failed!', 'pirate-forms' );
123
+
124
+ return false;
125
+ }
126
+
127
+ if ( ! $this->validate_captcha( $error_key ) ) {
128
+ return false;
129
+ }
130
+
131
+ // Start the body of the contact email
132
+ $body = '<h2>' . __( 'Contact form submission from', 'pirate-forms' ) . ' ' .
133
+ get_bloginfo( 'name' ) . ' (' . site_url() . ') </h2>';
134
+
135
+ $body .= '<table>';
136
+
137
+ $pirate_forms_contact_email = null;
138
+ $fields = array( 'name', 'email', 'subject', 'message' );
139
+ foreach ( $fields as $field ) {
140
+ $value = isset( $_POST[ 'pirate-forms-contact-' . $field ] ) ? sanitize_text_field( trim( $_POST[ 'pirate-forms-contact-' . $field ] ) ) : '';
141
+ if ( PirateForms_Util::get_option( 'pirateformsopt_' . $field . '_field' ) === 'req' && empty( $value ) ) {
142
+ $_SESSION[ $error_key ][ 'pirate-forms-contact-' . $field ] = PirateForms_Util::get_option( 'pirateformsopt_label_err_' . $field );
143
+ } elseif ( ! empty( $value ) ) {
144
+ if ( 'email' === $field && ! filter_var( $value, FILTER_VALIDATE_EMAIL ) ) {
145
+ $_SESSION[ $error_key ][ 'pirate-forms-contact-' . $field ] = PirateForms_Util::get_option( 'pirateformsopt_label_err_' . $field );
146
+ } else {
147
+ if ( 'email' === $field ) {
148
+ $pirate_forms_contact_email = $value;
149
+ }
150
+ $body .= $this->table_row( stripslashes( PirateForms_Util::get_option( 'pirateformsopt_label_' . $field ) ), $value );
151
+ }
152
+ }
153
+ }
154
+
155
+ /**
156
+ ******** Validate recipients email */
157
+ $site_recipients = sanitize_text_field( PirateForms_Util::get_option( 'pirateformsopt_email_recipients' ) );
158
+ if ( empty( $site_recipients ) ) {
159
+ $_SESSION[ $error_key ]['pirate-forms-recipients-email'] = __( 'Please enter one or more Contact submission recipients', 'pirate-forms' );
160
+ }
161
+ /**
162
+ ****** Sanitize and validate IP */
163
+ $contact_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP );
164
+ /* for the case of a Web server behind a reverse proxy */
165
+ if ( array_key_exists( 'HTTP_X_FORWARDED_FOR', $_SERVER ) ) {
166
+ $contact_ip_tmp = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
167
+ if ( ! empty( $contact_ip_tmp ) ) {
168
+ $contact_ip = array_pop( $contact_ip_tmp );
169
+ }
170
+ }
171
+
172
+ // If valid and present, create a link to an IP search
173
+ if ( ! empty( $contact_ip ) ) {
174
+ $body .= $this->table_row( __( 'IP address: ', 'pirate-forms' ), $contact_ip );
175
+ $body .= $this->table_row( __( 'IP search:', 'pirate-forms' ), "http://whatismyipaddress.com/ip/$contact_ip" );
176
+ }
177
+
178
+ // Sanitize and prepare referrer;
179
+ if ( ! empty( $_POST['pirate-forms-contact-referrer'] ) ) {
180
+ $body .= $this->table_row( __( 'Came from: ', 'pirate-forms' ), sanitize_text_field( $_POST['pirate-forms-contact-referrer'] ) );
181
+ }
182
+
183
+ // Show the page this contact form was submitted on
184
+ $body .= $this->table_row( __( 'Sent from page: ', 'pirate-forms' ), get_permalink( get_the_id() ) );
185
+
186
+ // Check the blacklist
187
+ $blocked = $this->is_blacklisted( $error_key, $pirate_forms_contact_email, $contact_ip );
188
+ if ( $blocked ) {
189
+ return false;
190
+ }
191
+
192
+ $body .= '</table>';
193
+
194
+ // No errors? Go ahead and process the contact
195
+ if ( empty( $_SESSION[ $error_key ] ) ) {
196
+ $pirate_forms_options_tmp = get_option( 'pirate_forms_settings_array' );
197
+ if ( isset( $pirate_forms_options_tmp['pirateformsopt_email'] ) ) {
198
+ $site_email = $pirate_forms_options_tmp['pirateformsopt_email'];
199
+ }
200
+ if ( ! empty( $pirate_forms_contact_name ) ) :
201
+ $site_name = $pirate_forms_contact_name;
202
+ else :
203
+ $site_name = htmlspecialchars_decode( get_bloginfo( 'name' ) );
204
+ endif;
205
+ // Notification recipients
206
+ $site_recipients = sanitize_text_field( PirateForms_Util::get_option( 'pirateformsopt_email_recipients' ) );
207
+ $site_recipients = explode( ',', $site_recipients );
208
+ $site_recipients = array_map( 'trim', $site_recipients );
209
+ $site_recipients = array_map( 'sanitize_email', $site_recipients );
210
+ $site_recipients = implode( ',', $site_recipients );
211
+ // No name? Use the submitter email address, if one is present
212
+ if ( empty( $pirate_forms_contact_name ) ) {
213
+ $pirate_forms_contact_name = ! empty( $pirate_forms_contact_email ) ? $pirate_forms_contact_email : '[None given]';
214
+ }
215
+ // Need an email address for the email notification
216
+ if ( ! empty( $site_email ) ) {
217
+ if ( $site_email == '[email]' ) {
218
+ if ( ! empty( $pirate_forms_contact_email ) ) {
219
+ $send_from = $pirate_forms_contact_email;
220
+ } else {
221
+ $send_from = PirateForms::pirate_forms_from_email();
222
+ }
223
+ } else {
224
+ $send_from = $site_email;
225
+ }
226
+ } else {
227
+ $send_from = PirateForms::pirate_forms_from_email();
228
+ }
229
+ $send_from_name = $site_name;
230
+
231
+ // Sent an email notification to the correct address
232
+ $headers = "From: $send_from_name <$send_from>\r\nReply-To: $pirate_forms_contact_name <$pirate_forms_contact_email>\r\nContent-type: text/html";
233
+ add_action( 'phpmailer_init', array( $this, 'phpmailer' ) );
234
+
235
+ $attachments = $this->get_attachments( $error_key );
236
+ if ( is_bool( $attachments ) ) {
237
+ return false;
238
+ }
239
+
240
+ wp_mail( $site_recipients, 'Contact on ' . htmlspecialchars_decode( get_bloginfo( 'name' ) ), $body, $headers, $attachments );
241
+
242
+ // delete the tmp directory
243
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
244
+ WP_Filesystem();
245
+ global $wp_filesystem;
246
+ $wp_filesystem->delete( $this->get_upload_tmp_dir(), true, 'd' );
247
+
248
+ // Should a confirm email be sent?
249
+ $confirm_body = stripslashes( trim( PirateForms_Util::get_option( 'pirateformsopt_confirm_email' ) ) );
250
+ if ( ! empty( $confirm_body ) && ! empty( $pirate_forms_contact_email ) ) {
251
+ // Removing entities
252
+ $confirm_body = htmlspecialchars_decode( $confirm_body );
253
+ $confirm_body = html_entity_decode( $confirm_body );
254
+ $confirm_body = str_replace( '&#39;', "'", $confirm_body );
255
+ $headers = "From: $site_name <$site_email>\r\nReply-To: $site_name <$site_email>";
256
+ $response = wp_mail(
257
+ $pirate_forms_contact_email,
258
+ PirateForms_Util::get_option( 'pirateformsopt_label_submit' ) . ' - ' . $site_name,
259
+ $confirm_body,
260
+ $headers
261
+ );
262
+ if ( ! $response ) {
263
+ error_log( 'Email not sent' );
264
+ }
265
+ }
266
+
267
+ /**
268
+ *********** Store the entries in the DB */
269
+ if ( PirateForms_Util::get_option( 'pirateformsopt_store' ) === 'yes' ) {
270
+ $new_post_id = wp_insert_post(
271
+ array(
272
+ 'post_type' => 'pf_contact',
273
+ 'post_title' => date( 'l, M j, Y', time() ) . ' by "' . $pirate_forms_contact_name . '"',
274
+ 'post_content' => $body,
275
+ 'post_author' => 1,
276
+ 'post_status' => 'private',
277
+ )
278
+ );
279
+ if ( isset( $pirate_forms_contact_email ) && ! empty( $pirate_forms_contact_email ) ) {
280
+ add_post_meta( $new_post_id, 'Contact email', $pirate_forms_contact_email );
281
+ }
282
+ }
283
+ $pirate_forms_current_theme = wp_get_theme();
284
+
285
+ /* If a Thank you page is selected, redirect to that page */
286
+ if ( PirateForms_Util::get_option( 'pirateformsopt_thank_you_url' ) ) {
287
+ $redirect_id = intval( PirateForms_Util::get_option( 'pirateformsopt_thank_you_url' ) );
288
+ $redirect = get_permalink( $redirect_id );
289
+ wp_safe_redirect( $redirect );
290
+ } elseif ( ( 'Zerif Lite' == $pirate_forms_current_theme->name ) || ( 'Zerif Lite' == $pirate_forms_current_theme->parent_theme ) || ( 'Zerif PRO' == $pirate_forms_current_theme->name ) || ( 'Zerif PRO' == $pirate_forms_current_theme->parent_theme ) ) {
291
+ $redirect = $_SERVER['HTTP_REFERER'] . ( strpos( $_SERVER['HTTP_REFERER'], '?' ) === false ? '?' : '&' ) . 'pcf=1#contact';
292
+ wp_safe_redirect( $redirect );
293
+ }
294
+ }// End if().
295
+ }
296
+
297
+ /**
298
+ * Change the content of the widget
299
+ *
300
+ * @since 1.0.0
301
+ */
302
+ public function widget_text_filter( $content ) {
303
+ if ( ! preg_match( '[pirate_forms]', $content ) ) {
304
+ return $content;
305
+ }
306
+ $content = do_shortcode( $content );
307
+
308
+ return $content;
309
+ }
310
+
311
+ /**
312
+ * Display the form
313
+ *
314
+ * @since 1.0.0
315
+ */
316
+ public function display_form( $atts, $content = null ) {
317
+ $atts = shortcode_atts( array(
318
+ 'from' => '',
319
+ ), $atts );
320
+
321
+ $pirate_form = new PirateForms_PhpFormBuilder();
322
+
323
+ $pirate_form->add_input(
324
+ '',
325
+ array(
326
+ 'type' => 'hidden',
327
+ 'name' => 'pirate_forms_from_widget',
328
+ 'id' => 'pirate_forms_from_widget',
329
+ 'value' => empty( $atts['from'] ) ? 0 : 1,
330
+ 'request_populate' => false,
331
+ ),
332
+ 'pirate-forms-from-widget'
333
+ );
334
+
335
+ $nonce_append = isset( $_POST['pirate_forms_from_widget'] ) && intval( $_POST['pirate_forms_from_widget'] ) === 1 ? 'yes' : 'no';
336
+
337
+ $error_key = wp_create_nonce( get_bloginfo( 'admin_email' ) . ( empty( $atts['from'] ) ? 'no' : 'yes' ) );
338
+
339
+ $thank_you_message = '';
340
+ /* thank you message */
341
+ if ( ( ( isset( $_GET['pcf'] ) && $_GET['pcf'] == 1 ) || ( isset( $_POST['pirate-forms-contact-submit'] ) ) )
342
+ && empty( $_SESSION[ $error_key ] )
343
+ && wp_verify_nonce( $_POST['wordpress-nonce'], get_bloginfo( 'admin_email' ) . ( empty( $atts['from'] ) ? 'no' : 'yes' ) )
344
+ ) {
345
+ $thank_you_message = sanitize_text_field( PirateForms_Util::get_option( 'pirateformsopt_label_submit' ) );
346
+ }
347
+ $pirate_form->set_element( 'thank_you_message', $thank_you_message );
348
+
349
+ /**
350
+ ******** FormBuilder */
351
+ $pirate_form->set_att( 'id', 'pirate_forms_' . ( get_the_id() ? get_the_id() : 1 ) );
352
+ $pirate_form->set_att( 'class', array( 'pirate_forms' ) );
353
+ if ( 'yes' === PirateForms_Util::get_option( 'pirateformsopt_nonce' ) ) {
354
+ $pirate_form->set_att( 'add_nonce', get_bloginfo( 'admin_email' ) . ( empty( $atts['from'] ) ? 'no' : 'yes' ) );
355
+ }
356
+ $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
357
+ if ( ! empty( $pirate_forms_options ) ) :
358
+ $field = $pirate_forms_options['pirateformsopt_name_field'];
359
+ $label = $pirate_forms_options['pirateformsopt_label_name'];
360
+
361
+ /**
362
+ ****** Name field */
363
+ if ( ! empty( $field ) && ! empty( $label ) ) :
364
+ $required = $field === 'req' ? true : false;
365
+ $wrap_classes = array(
366
+ 'contact_name_wrap pirate_forms_three_inputs ',
367
+ );
368
+ // If this field was submitted with invalid data
369
+ if ( isset( $_SESSION[ $error_key ]['contact-name'] ) ) {
370
+ $wrap_classes[] = 'error';
371
+ }
372
+ $pirate_form->add_input(
373
+ '',
374
+ array(
375
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
376
+ 'required' => $required,
377
+ 'wrap_class' => apply_filters( 'pirateform_wrap_classes_name', $wrap_classes ),
378
+ ),
379
+ 'pirate-forms-contact-name'
380
+ );
381
+ endif;
382
+
383
+ $field = $pirate_forms_options['pirateformsopt_email_field'];
384
+ $label = $pirate_forms_options['pirateformsopt_label_email'];
385
+
386
+ /**
387
+ ****** Email field */
388
+ if ( ! empty( $field ) && ! empty( $label ) ) :
389
+ $required = $field === 'req' ? true : false;
390
+ $wrap_classes = array(
391
+ 'contact_email_wrap pirate_forms_three_inputs ',
392
+ );
393
+ // If this field was submitted with invalid data
394
+ if ( isset( $_SESSION[ $error_key ]['contact-email'] ) ) {
395
+ $wrap_classes[] = 'error';
396
+ }
397
+ $pirate_form->add_input(
398
+ '',
399
+ array(
400
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
401
+ 'required' => $required,
402
+ 'type' => 'email',
403
+ 'wrap_class' => apply_filters( 'pirateform_wrap_classes_email', $wrap_classes ),
404
+ ),
405
+ 'pirate-forms-contact-email'
406
+ );
407
+ endif;
408
+
409
+ $field = $pirate_forms_options['pirateformsopt_subject_field'];
410
+ $label = $pirate_forms_options['pirateformsopt_label_subject'];
411
+
412
+ /**
413
+ ****** Subject field */
414
+ if ( ! empty( $field ) && ! empty( $label ) ) :
415
+ $required = $field === 'req' ? true : false;
416
+ $wrap_classes = array(
417
+ 'contact_subject_wrap pirate_forms_three_inputs ',
418
+ );
419
+ // If this field was submitted with invalid data
420
+ if ( isset( $_SESSION[ $error_key ]['contact-subject'] ) ) {
421
+ $wrap_classes[] = 'error';
422
+ }
423
+ $pirate_form->add_input(
424
+ '',
425
+ array(
426
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
427
+ 'required' => $required,
428
+ 'wrap_class' => apply_filters( 'pirateform_wrap_classes_subject', $wrap_classes ),
429
+ ),
430
+ 'pirate-forms-contact-subject'
431
+ );
432
+ endif;
433
+
434
+ $field = $pirate_forms_options['pirateformsopt_message_field'];
435
+ $label = $pirate_forms_options['pirateformsopt_label_message'];
436
+
437
+ /**
438
+ ****** Message field */
439
+ if ( ! empty( $field ) && ! empty( $label ) ) :
440
+ $required = $field === 'req' ? true : false;
441
+ $wrap_classes = array( 'contact_message_wrap ' );
442
+ // If this field was submitted with invalid data
443
+ if ( isset( $_SESSION[ $error_key ]['contact-message'] ) ) {
444
+ $wrap_classes[] = 'error';
445
+ }
446
+ $pirate_form->add_input(
447
+ '',
448
+ array(
449
+ 'placeholder' => stripslashes( sanitize_text_field( $label ) ),
450
+ 'required' => $required,
451
+ 'wrap_class' => apply_filters( 'pirateform_wrap_classes_message', $wrap_classes ),
452
+ 'type' => 'textarea',
453
+ ),
454
+ 'pirate-forms-contact-message'
455
+ );
456
+ endif;
457
+
458
+ /**
459
+ ******* ReCaptcha */
460
+ if ( ! empty( $pirate_forms_options['pirateformsopt_recaptcha_secretkey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_sitekey'] ) && ! empty( $pirate_forms_options['pirateformsopt_recaptcha_field'] ) && ( $pirate_forms_options['pirateformsopt_recaptcha_field'] == 'yes' ) ) :
461
+ $pirateformsopt_recaptcha_sitekey = $pirate_forms_options['pirateformsopt_recaptcha_sitekey'];
462
+ $pirateformsopt_recaptcha_secretkey = $pirate_forms_options['pirateformsopt_recaptcha_secretkey'];
463
+ $pirate_form->add_input(
464
+ '',
465
+ array(
466
+ 'value' => $pirateformsopt_recaptcha_sitekey,
467
+ 'wrap_class' => apply_filters( 'pirateform_wrap_classes_captcha', array('col-xs-12 col-sm-6 col-lg-6 form_field_wrap form_captcha_wrap') ),
468
+ 'type' => 'captcha',
469
+ ),
470
+ 'pirate-forms-captcha'
471
+ );
472
+ endif;
473
+
474
+ /**
475
+ ******** Attachment */
476
+ if ( ! empty( $pirate_forms_options['pirateformsopt_attachment_field'] ) && ( $pirate_forms_options['pirateformsopt_attachment_field'] == 'yes' ) ) {
477
+ $pirate_form->add_input(
478
+ '',
479
+ array(
480
+ 'wrap_class' => apply_filters( 'pirateform_wrap_classes_attachment', array() ),
481
+ 'type' => 'file',
482
+ ),
483
+ 'pirate-forms-attachment'
484
+ );
485
+
486
+ }
487
+
488
+ /**
489
+ ****** Submit button */
490
+ if ( ! empty( $pirate_forms_options['pirateformsopt_label_submit_btn'] ) ) :
491
+ $pirateformsopt_label_submit_btn = $pirate_forms_options['pirateformsopt_label_submit_btn'];
492
+ if ( ! empty( $pirateformsopt_label_submit_btn ) ) :
493
+ $pirate_form->add_input(
494
+ '',
495
+ array(
496
+ 'value' => stripslashes( sanitize_text_field( $pirateformsopt_label_submit_btn ) ),
497
+ 'wrap_class' => apply_filters( 'pirateform_wrap_classes_submit', array() ),
498
+ 'type' => 'submit',
499
+ 'wrap_tag' => '',
500
+ 'class' => 'pirate-forms-submit-button',
501
+ ),
502
+ 'pirate-forms-contact-submit'
503
+ );
504
+ endif;
505
+ endif;
506
+ endif;
507
+
508
+ /* Referring site or page, if any */
509
+ if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
510
+ $pirate_form->add_input(
511
+ __( 'Contact Referrer', 'pirate-forms' ),
512
+ array(
513
+ 'type' => 'hidden',
514
+ 'value' => $_SERVER['HTTP_REFERER'],
515
+ )
516
+ );
517
+ }
518
+
519
+ /* Referring page, if sent via URL query */
520
+ if ( ! empty( $_REQUEST['src'] ) || ! empty( $_REQUEST['ref'] ) ) {
521
+ $pirate_form->add_input(
522
+ __( 'Referring page', 'pirate-forms' ),
523
+ array(
524
+ 'type' => 'hidden',
525
+ 'value' => ! empty( $_REQUEST['src'] ) ? $_REQUEST['src'] : $_REQUEST['ref'],
526
+ )
527
+ );
528
+ }
529
+
530
+ /* Are there any submission errors? */
531
+ $errors = '';
532
+ if ( ! empty( $_SESSION[ $error_key ] ) ) {
533
+ $pirate_form->set_element( 'errors', $_SESSION[ $error_key ] );
534
+ unset( $_SESSION[ $error_key ] );
535
+ }
536
+
537
+ return $pirate_form->build_form( false );
538
+
539
+ }
540
+
541
+ /**
542
+ * Return the table row
543
+ *
544
+ * @since 1.0.0
545
+ */
546
+ public function table_row( $key, $value ) {
547
+ return '<tr><th>' . $key . '</th><td>' . $value . '</td></tr>';
548
+ }
549
+
550
+ /**
551
+ * Check if the email/IP is blacklisted
552
+ *
553
+ * @param string $error_key the key for the session object.
554
+ * @param string $email the email id to check.
555
+ * @param string $ip the IP to check.
556
+ * @since 1.0.0
557
+ */
558
+ public function is_blacklisted( $error_key, $email, $ip ) {
559
+ $final_blocked_arr = array();
560
+
561
+ $blocked = get_option( 'blacklist_keys' );
562
+ $blocked = str_replace( "\r", "\n", $blocked );
563
+
564
+ $blocked_arr = explode( "\n", $blocked );
565
+ $blocked_arr = array_map( 'trim', $blocked_arr );
566
+
567
+ foreach ( $blocked_arr as $ip_or_email ) {
568
+ $ip_or_email = trim( $ip_or_email );
569
+ if (
570
+ filter_var( $ip_or_email, FILTER_VALIDATE_IP ) ||
571
+ filter_var( $ip_or_email, FILTER_VALIDATE_EMAIL )
572
+ ) {
573
+ $final_blocked_arr[] = $ip_or_email;
574
+ }
575
+ }
576
+
577
+ if ( ! empty( $final_blocked_arr ) ) {
578
+ if (
579
+ in_array( $email, $final_blocked_arr ) ||
580
+ in_array( $ip, $final_blocked_arr )
581
+ ) {
582
+ $_SESSION[ $error_key ]['blacklist-blocked'] = __( 'Form submission blocked!', 'pirate-forms' );
583
+ return true;
584
+ }
585
+ }
586
+
587
+ return false;
588
+ }
589
+
590
+ /**
591
+ * Return the upload dir
592
+ *
593
+ * @since 1.0.0
594
+ */
595
+ function get_upload_dir( $type = false ) {
596
+ $uploads = wp_upload_dir();
597
+ $uploads = apply_filters( 'pirate_forms_upload_dir', array(
598
+ 'dir' => $uploads['basedir'],
599
+ 'url' => $uploads['baseurl'],
600
+ ) );
601
+ if ( 'dir' == $type ) {
602
+ return $uploads['dir'];
603
+ }
604
+ if ( 'url' == $type ) {
605
+ return $uploads['url'];
606
+ }
607
+
608
+ return $uploads;
609
+ }
610
+
611
+ /**
612
+ * Return the temporary upload dir
613
+ *
614
+ * @since 1.0.0
615
+ */
616
+ function get_upload_tmp_dir() {
617
+ return $this->get_upload_dir( 'dir' ) . '/pirate_forms_uploads';
618
+ }
619
+
620
+ /**
621
+ * Prepare the uploading process
622
+ *
623
+ * @since 1.0.0
624
+ * @throws Exception When file could not be opened.
625
+ */
626
+ function init_uploads() {
627
+ $dir = $this->get_upload_tmp_dir();
628
+ wp_mkdir_p( $dir );
629
+ $htaccess_file = trailingslashit( $dir ) . '.htaccess';
630
+ if ( file_exists( $htaccess_file ) ) {
631
+ return;
632
+ }
633
+ try {
634
+ $handle = fopen( $htaccess_file, 'w' );
635
+
636
+ if ( ! $handle ) {
637
+ throw new Exception( 'File open failed.' );
638
+ } else {
639
+ fwrite( $handle, "Deny from all\n" );
640
+ fclose( $handle );
641
+ }
642
+ } catch ( Exception $e ) {
643
+ // nothing
644
+ }
645
+ }
646
+
647
+ /**
648
+ * Add a random directory for uploading
649
+ *
650
+ * @since 1.0.0
651
+ */
652
+ function maybe_add_random_dir( $dir ) {
653
+ do {
654
+ $rand_max = mt_getrandmax();
655
+ $rand = zeroise( mt_rand( 0, $rand_max ), strlen( $rand_max ) );
656
+ $dir_new = path_join( $dir, $rand );
657
+ } while ( file_exists( $dir_new ) );
658
+ if ( wp_mkdir_p( $dir_new ) ) {
659
+ return $dir_new;
660
+ }
661
+
662
+ return $dir;
663
+ }
664
+
665
+ /**
666
+ * Functions to Process uploaded files
667
+ */
668
+ function canonicalize( $text ) {
669
+ if ( function_exists( 'mb_convert_kana' )
670
+ && 'UTF-8' == get_option( 'blog_charset' )
671
+ ) {
672
+ $text = mb_convert_kana( $text, 'asKV', 'UTF-8' );
673
+ }
674
+ $text = strtolower( $text );
675
+ $text = trim( $text );
676
+
677
+ return $text;
678
+ }
679
+
680
+ /**
681
+ * Prevent uploading any script files
682
+ *
683
+ * @since 1.0.0
684
+ */
685
+ function antiscript_file_name( $filename ) {
686
+ $filename = basename( $filename );
687
+ $parts = explode( '.', $filename );
688
+ if ( count( $parts ) < 2 ) {
689
+ return $filename;
690
+ }
691
+ $script_pattern = '/^(php|phtml|pl|py|rb|cgi|asp|aspx)\d?$/i';
692
+ $filename = array_shift( $parts );
693
+ $extension = array_pop( $parts );
694
+ foreach ( (array) $parts as $part ) {
695
+ if ( preg_match( $script_pattern, $part ) ) {
696
+ $filename .= '.' . $part . '_';
697
+ } else {
698
+ $filename .= '.' . $part;
699
+ }
700
+ }
701
+ if ( preg_match( $script_pattern, $extension ) ) {
702
+ $filename .= '.' . $extension . '_.txt';
703
+ } else {
704
+ $filename .= '.' . $extension;
705
+ }
706
+
707
+ return $filename;
708
+ }
709
+
710
+ /**
711
+ * Alter the phpmailer object
712
+ *
713
+ * @param object $phpmailer PHPMailer object.
714
+ */
715
+ function phpmailer( $phpmailer ) {
716
+ $pirateformsopt_use_smtp = PirateForms_Util::get_option( 'pirateformsopt_use_smtp' );
717
+ $pirateformsopt_smtp_host = PirateForms_Util::get_option( 'pirateformsopt_smtp_host' );
718
+ $pirateformsopt_smtp_port = PirateForms_Util::get_option( 'pirateformsopt_smtp_port' );
719
+ $pirateformsopt_smtp_username = PirateForms_Util::get_option( 'pirateformsopt_smtp_username' );
720
+ $pirateformsopt_smtp_password = PirateForms_Util::get_option( 'pirateformsopt_smtp_password' );
721
+ $pirateformsopt_use_secure = PirateForms_Util::get_option( 'pirateformsopt_use_secure' );
722
+ $pirateformsopt_use_smtp_authentication = PirateForms_Util::get_option( 'pirateformsopt_use_smtp_authentication' );
723
+ if ( ! empty( $pirateformsopt_use_smtp ) && ( $pirateformsopt_use_smtp == 'yes' ) && ! empty( $pirateformsopt_smtp_host ) && ! empty( $pirateformsopt_smtp_port ) ) :
724
+ // @codingStandardsIgnoreStart
725
+ $phpmailer->isSMTP();
726
+ $phpmailer->Host = $pirateformsopt_smtp_host;
727
+ if ( ! empty( $pirateformsopt_use_smtp_authentication ) && ( $pirateformsopt_use_smtp_authentication == 'yes' ) && ! empty( $pirateformsopt_smtp_username ) && ! empty( $pirateformsopt_smtp_password ) ) :
728
+ $phpmailer->SMTPAuth = true; // Force it to use Username and Password to authenticate
729
+ $phpmailer->Port = $pirateformsopt_smtp_port;
730
+ $phpmailer->Username = $pirateformsopt_smtp_username;
731
+ $phpmailer->Password = $pirateformsopt_smtp_password;
732
+ endif;
733
+
734
+ if ( ! empty( $pirateformsopt_use_secure ) ) {
735
+ $phpmailer->SMTPSecure = $pirateformsopt_use_secure;
736
+ }
737
+ // @codingStandardsIgnoreEnd
738
+ endif;
739
+ }
740
+
741
+ /**
742
+ * Validate CAPTCHA
743
+ *
744
+ * @param string $error_key the key for the session object.
745
+ */
746
+ function validate_captcha( $error_key ) {
747
+ $pirateformsopt_recaptcha_sitekey = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_sitekey' );
748
+ $pirateformsopt_recaptcha_secretkey = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_secretkey' );
749
+ $pirateformsopt_recaptcha_field = PirateForms_Util::get_option( 'pirateformsopt_recaptcha_field' );
750
+ if ( ! empty( $pirateformsopt_recaptcha_secretkey ) && ! empty( $pirateformsopt_recaptcha_sitekey ) && ! empty( $pirateformsopt_recaptcha_field ) && ( $pirateformsopt_recaptcha_field == 'yes' ) ) :
751
+ if ( isset( $_POST['g-recaptcha-response'] ) ) {
752
+ $captcha = $_POST['g-recaptcha-response'];
753
+ }
754
+ if ( ! $captcha ) {
755
+ $_SESSION[ $error_key ]['pirate-forms-captcha'] = __( 'Wrong reCAPTCHA', 'pirate-forms' );
756
+ return false;
757
+ }
758
+ $response = wp_remote_get( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $pirateformsopt_recaptcha_secretkey . '&response=' . $captcha . '&remoteip=' . $_SERVER['REMOTE_ADDR'] );
759
+ if ( ! empty( $response ) ) :
760
+ $response_body = wp_remote_retrieve_body( $response );
761
+ endif;
762
+ if ( ! empty( $response_body ) ) :
763
+ $result = json_decode( $response_body, true );
764
+ endif;
765
+ if ( isset( $result['success'] ) && ( $result['success'] == false ) ) {
766
+ $_SESSION[ $error_key ]['pirate-forms-captcha'] = __( 'Wrong reCAPTCHA', 'pirate-forms' );
767
+ return false;
768
+ }
769
+ endif;
770
+
771
+ return true;
772
+ }
773
+
774
+ /**
775
+ * Get attachments, if any
776
+ *
777
+ * @param string $error_key the key for the session object.
778
+ * @throws Exception When file uploading fails.
779
+ */
780
+ function get_attachments( $error_key ) {
781
+ $attachments = '';
782
+ /**
783
+ ******* Validate Attachment */
784
+ $use_files = PirateForms_Util::get_option( 'pirateformsopt_attachment_field' );
785
+ if ( ! empty( $use_files ) && ( $use_files == 'yes' ) ) {
786
+ $pirate_forms_attach_file = isset( $_FILES['pirate-forms-attachment'] ) ? $_FILES['pirate-forms-attachment'] : '';
787
+ if ( ! empty( $pirate_forms_attach_file ) && ! empty( $pirate_forms_attach_file['name'] ) ) {
788
+ /* Validate file type */
789
+ $pirate_forms_file_types_allowed = 'jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv';
790
+ $pirate_forms_file_types_allowed = trim( $pirate_forms_file_types_allowed, '|' );
791
+ $pirate_forms_file_types_allowed = '(' . $pirate_forms_file_types_allowed . ')';
792
+ $pirate_forms_file_types_allowed = '/\.' . $pirate_forms_file_types_allowed . '$/i';
793
+ if ( ! preg_match( $pirate_forms_file_types_allowed, $pirate_forms_attach_file['name'] ) ) {
794
+ $_SESSION[ $error_key ]['pirate-forms-upload-failed-type'] = __( 'Uploaded file is not allowed for file type', 'pirate-forms' );
795
+ return false;
796
+ }
797
+ /* Validate file size */
798
+ $pirate_forms_file_size_allowed = 1048576; // default size 1 MB
799
+ if ( $pirate_forms_attach_file['size'] > $pirate_forms_file_size_allowed ) {
800
+ $_SESSION[ $error_key ]['pirate-forms-upload-failed-size'] = __( 'Uploaded file is too large', 'pirate-forms' );
801
+ return false;
802
+ }
803
+ $this->init_uploads();
804
+ $uploads_dir = $this->get_upload_tmp_dir();
805
+ $uploads_dir = $this->maybe_add_random_dir( $uploads_dir );
806
+ $filename = $pirate_forms_attach_file['name'];
807
+ $filename = $this->canonicalize( $filename );
808
+ $filename = sanitize_file_name( $filename );
809
+ $filename = $this->antiscript_file_name( $filename );
810
+ $filename = wp_unique_filename( $uploads_dir, $filename );
811
+ $new_file = trailingslashit( $uploads_dir ) . $filename;
812
+ try {
813
+ if ( false === move_uploaded_file( $pirate_forms_attach_file['tmp_name'], $new_file ) ) {
814
+ throw new Exception( __( 'There was an unknown error uploading the file.', 'pirate-forms' ) );
815
+ }
816
+ } catch ( Exception $ex ) {
817
+ $_SESSION[ $error_key ]['pirate-forms-upload-failed-general'] = $ex->getMessage();
818
+ }
819
+ if ( ! empty( $new_file ) ) {
820
+ $attachments = $new_file;
821
+ }
822
+ }// End if().
823
+ }// End if().
824
+ return $attachments;
825
+ }
826
+ }
public/css/front.css ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Version: 1.2.5
3
+ */
4
+ .pirate_forms_wrap .form_field_wrap {
5
+ margin-bottom: 20px;
6
+ }
7
+
8
+ .pirate-forms-g-recaptcha {
9
+ display: none;
10
+ }
11
+
12
+ .pirate_forms_wrap {
13
+ float: left;
14
+ width: 100%;
15
+ }
16
+
17
+ .sidebar .pirate_forms_wrap,
18
+ .sidebar-wrap .pirate_forms_wrap,
19
+ #sidebar-secondary .pirate_forms_wrap {
20
+ margin-bottom: 20px;
21
+ }
22
+
23
+ .sidebar .form_field_wrap,
24
+ .sidebar-wrap .form_field_wrap,
25
+ #sidebar-secondary .form_field_wrap {
26
+ width: 100%;
27
+ }
28
+
29
+ .sidebar .pirate-forms-submit-button,
30
+ .sidebar-wrap .pirate-forms-submit-button,
31
+ #sidebar-secondary .pirate-forms-submit-button {
32
+ float: left !important;
33
+ width: 100%;
34
+ margin-left: 0;
35
+ }
36
+
37
+ .sidebar .pirate_forms_wrap label,
38
+ .sidebar-wrap .pirate_forms_wrap label,
39
+ #sidebar-secondary .pirate_forms_wrap label {
40
+ display: none;
41
+ }
42
+
43
+ .pirate_forms_clearfix {
44
+ clear: both;
45
+ }
46
+
47
+ .contact_submit_wrap {
48
+ text-align: right;
49
+ }
public/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
public/js/scripts-general.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global pirateFormsObject */
2
+ jQuery(document).ready(function() {
3
+
4
+ var session_var = pirateFormsObject.errors;
5
+
6
+ if( (typeof session_var !== 'undefined') && (session_var !== '') && (typeof jQuery('#contact') !== 'undefined') && (typeof jQuery('#contact').offset() !== 'undefined') ) {
7
+
8
+ jQuery('html, body').animate({
9
+ scrollTop: jQuery('#contact').offset().top
10
+ }, 'slow');
11
+ }
12
+
13
+ if( typeof jQuery('.pirate_forms_three_inputs').val() !== 'undefined' ) {
14
+ jQuery('.pirate_forms ').each(function(){
15
+ jQuery(this).find('.pirate_forms_three_inputs').wrapAll('<div class="pirate_forms_three_inputs_wrap">');
16
+ });
17
+ }
18
+ });
public/js/scripts.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+
3
+ /* show/hide reCaptcha */
4
+
5
+ var thisOpen = false;
6
+ jQuery('.pirate_forms .form-control').each(function(){
7
+ if ( jQuery(this).val().length > 0 ){
8
+ thisOpen = true;
9
+ jQuery('.zerif-g-recaptcha').css('display','block').delay(1000).css('opacity','1');
10
+ return false;
11
+ }
12
+ });
13
+ if ( thisOpen === false && (typeof jQuery('.pirate_forms textarea').val() !== 'undefined') && (jQuery('.pirate_forms textarea').val().length > 0) ) {
14
+ thisOpen = true;
15
+ jQuery('.pirate-forms-g-recaptcha').css('display','block').delay(1000).css('opacity','1');
16
+ }
17
+ jQuery('.pirate_forms input, .pirate_forms textarea').focus(function(){
18
+ if ( !jQuery('.pirate-forms-g-recaptcha').hasClass('recaptcha-display') ) {
19
+ jQuery('.pirate-forms-g-recaptcha').css('display','block').delay(1000).css('opacity','1');
20
+ }
21
+ });
22
+
23
+ });
public/partials/pirateforms-form.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Provide a public-facing view for the form
5
+ *
6
+ * This file provide a public-facing view for the form
7
+ *
8
+ * @link http://example.com
9
+ * @since 1.0.0
10
+ *
11
+ * @package PirateForms
12
+ * @subpackage PirateForms/public/partials
13
+ */
14
+ ?>
15
+
16
+ <div class="col-sm-12 col-lg-12 pirate_forms_thankyou_wrap">
17
+ <p><?php echo $this->thank_you_message; ?></p>
18
+ </div>
19
+
20
+ <div class="pirate_forms_wrap">
21
+ <?php
22
+ $output = '';
23
+ if ( ! empty( $this->errors ) ) :
24
+ $output .= '<div class="col-sm-12 col-lg-12 pirate_forms_error_box">';
25
+ $output .= '<p>' . __( 'Sorry, an error occured.','pirate-forms' ) . '</p>';
26
+ $output .= '</div>';
27
+ foreach ( $this->errors as $err ) :
28
+ $output .= '<div class="col-sm-12 col-lg-12 pirate_forms_error_box">';
29
+ $output .= "<p>$err</p>";
30
+ $output .= '</div>';
31
+ endforeach;
32
+
33
+ endif;
34
+
35
+ echo $output;
36
+ ?>
37
+
38
+ <?php echo $this->form_start ;?>
39
+
40
+ <div class="pirate_forms_three_inputs_wrap">
41
+ <div class="col-sm-4 col-lg-4 form_field_wrap contact_name_wrap pirate_forms_three_inputs ">
42
+ <?php echo $this->contact_name;?>
43
+ </div>
44
+
45
+ <div class="col-sm-4 col-lg-4 form_field_wrap contact_email_wrap pirate_forms_three_inputs ">
46
+ <?php echo $this->contact_email;?>
47
+ </div>
48
+
49
+ <div class="col-sm-4 col-lg-4 form_field_wrap contact_subject_wrap pirate_forms_three_inputs ">
50
+ <?php echo $this->contact_subject;?>
51
+ </div>
52
+ </div>
53
+
54
+ <div class="col-sm-12 col-lg-12 form_field_wrap contact_message_wrap ">
55
+ <?php echo $this->contact_message;?>
56
+ </div>
57
+
58
+ <?php if ( isset( $this->captcha ) ) { ?>
59
+ <div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap form_captcha_wrap">
60
+ <?php echo $this->captcha;?>
61
+ </div>
62
+ <?php } ?>
63
+
64
+ <?php if ( isset( $this->attachment ) ) { ?>
65
+ <div class="col-sm-12 col-lg-12 form_field_wrap contact_attachment_wrap ">
66
+ <?php echo $this->attachment;?>
67
+ </div>
68
+ <?php } ?>
69
+
70
+ <div class="col-xs-12 col-sm-6 col-lg-6 form_field_wrap contact_submit_wrap">
71
+ <?php echo $this->contact_submit;?>
72
+ </div>
73
+
74
+ <?php echo $this->form_end ;?>
75
+ <div class="pirate_forms_clearfix"></div>
76
+ </div>
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
- === Contact Form & SMTP Plugin by PirateForms ===
2
  Contributors: themeisle, codeinwp, rodicaelena, hardeepasrani, pirateforms
3
- Tags: contact forms plugin, contact form, contact us, contact us form, contacts form plugin, custom form, subscribe form, feedback form, wordpress contact form
4
  Requires at least: 3.0
5
- Tested up to: 4.7
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- A simple and effective WordPress contact form & SMTP plugin. Compatible with best themes out there, is both secure and responsive.
11
 
12
  == Description ==
13
 
@@ -63,6 +63,13 @@ If are you looking for other alternatives check-out our article on <a href="http
63
 
64
  This plugin started as a fork of https://wordpress.org/plugins/proper-contact-form/.
65
 
 
 
 
 
 
 
 
66
  == Installation ==
67
 
68
  Activating the Pirate Contact Form plugin is just like any other plugin. If you've uploaded the plugin package to your server already, skip to step 5 below:
@@ -83,6 +90,10 @@ Activating the Pirate Contact Form plugin is just like any other plugin. If you'
83
  4. Screenshot 4. Enabling SMTP
84
 
85
  == Changelog ==
 
 
 
 
86
 
87
  = 1.2.0 =
88
 
@@ -137,6 +148,10 @@ Activating the Pirate Contact Form plugin is just like any other plugin. If you'
137
  = 1.0.9 =
138
  * Fixed layout issues #52
139
  * Update readme.txt with == Changelog == section #51
 
 
 
 
140
 
141
  = 1.0.8 =
142
  * Update readme.txt
1
+ === Contact Form & SMTP Plugin for WordPress by PirateForms ===
2
  Contributors: themeisle, codeinwp, rodicaelena, hardeepasrani, pirateforms
3
+ Tags: contact form, contact form plugin, forms, smtp, custom form, subscribe form, feedback form, wordpress contact form
4
  Requires at least: 3.0
5
+ Tested up to: 4.8
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ A simple and effective WordPress contact form & SMTP plugin. Compatible with best themes out there, is both a secure and responsive contact form plugin.
11
 
12
  == Description ==
13
 
63
 
64
  This plugin started as a fork of https://wordpress.org/plugins/proper-contact-form/.
65
 
66
+ == Frequently Asked Questions ==
67
+
68
+ = How I can get support for this contact form plugin ? =
69
+
70
+ You can learn more about PirateForms and ask for help by <a href="https://themeisle.com/contact/" >visiting ThemeIsle website</a>.
71
+
72
+
73
  == Installation ==
74
 
75
  Activating the Pirate Contact Form plugin is just like any other plugin. If you've uploaded the plugin package to your server already, skip to step 5 below:
90
  4. Screenshot 4. Enabling SMTP
91
 
92
  == Changelog ==
93
+ = 1.2.5 - 2017-07-30 =
94
+
95
+
96
+
97
 
98
  = 1.2.0 =
99
 
148
  = 1.0.9 =
149
  * Fixed layout issues #52
150
  * Update readme.txt with == Changelog == section #51
151
+ = 1.2.5 - 2017-07-30 =
152
+
153
+
154
+
155
 
156
  = 1.0.8 =
157
  * Update readme.txt
tests/bootstrap.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
- /**
3
- * PHPUnit bootstrap file
4
- *
5
- * @package Revive_Network
6
- */
7
- $_tests_dir = getenv( 'WP_TESTS_DIR' );
8
- if ( ! $_tests_dir ) {
9
- $_tests_dir = '/tmp/wordpress-tests-lib';
10
- }
11
- /**
12
- * The path to the main file of the plugin to test.
13
- */
14
- define( 'WP_USE_THEMES', false );
15
- define( 'WP_TESTS_FORCE_KNOWN_BUGS', true );
16
- // Give access to tests_add_filter() function.
17
- require_once $_tests_dir . '/includes/functions.php';
18
- /**
19
- * Manually load the plugin being tested.
20
- */
21
- function _manually_load_plugin() {
22
- require dirname( dirname( __FILE__ ) ) . '/pirate-forms.php';
23
- }
24
-
25
- tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
26
- define( 'REVIVE_NETWORK_ENABLE_LOG', false );
27
- define( 'REVIVE_NETWORK_PREVENT_SHARING', true );
28
- // Start up the WP testing environment.
29
- require $_tests_dir . '/includes/bootstrap.php';
30
- activate_plugin( 'revive-network/pirate-forms.php' );
31
- global $current_user;
32
- $current_user = new WP_User( 1 );
33
- $current_user->set_role( 'administrator' );
34
- wp_update_user( array( 'ID' => 1, 'first_name' => 'Admin', 'last_name' => 'User' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-pirate-forms.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * Sample class for PHPUnit.
4
- *
5
- * @package nivo-slider
6
- * @subpackage Tests
7
- * @copyright Copyright (c) 2017, Marius Cristea
8
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since 3.0.0
10
- */
11
-
12
- /**
13
- * Sample test class.
14
- */
15
- class Test_Pirate_Forms extends WP_UnitTestCase {
16
-
17
- public function test_generic() {
18
- $this->assertTrue(true);
19
- }
20
-
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
uninstall.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired when the plugin is uninstalled.
5
+ *
6
+ * When populating this file, consider the following flow
7
+ * of control:
8
+ *
9
+ * - This method should be static
10
+ * - Check if the $_REQUEST content actually is the plugin name
11
+ * - Run an admin referrer check to make sure it goes through authentication
12
+ * - Verify the output of $_GET makes sense
13
+ * - Repeat with other user roles. Best directly by using the links/query string parameters.
14
+ * - Repeat things for multisite. Once for a single site in the network, once sitewide.
15
+ *
16
+ * This file may be updated more in future version of the Boilerplate; however, this is the
17
+ * general skeleton and outline for how the file should work.
18
+ *
19
+ * For more information, see the following discussion:
20
+ * https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
21
+ *
22
+ * @link http://example.com
23
+ * @since 1.0.0
24
+ *
25
+ * @package PirateForms
26
+ */
27
+
28
+ // If uninstall not called from WordPress, then exit.
29
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
30
+ exit;
31
+ }
32
+
33
+ delete_option( 'pirate_forms_subscribe' );
34
+ delete_option( 'pirate_forms_settings_array' );
vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer' . '/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb::getLoader();
vendor/autoload_52.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_52.php generated by xrstf/composer-php52
4
+
5
+ require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
+
7
+ return ComposerAutoloaderInit2a536e1db4e183eb34c6df9616eae0e9::getLoader();
vendor/codeinwp/themeisle-sdk/LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ {one line to give the program's name and a brief idea of what it does.}
635
+ Copyright (C) {year} {name of author}
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ {project} Copyright (C) {year} {fullname}
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-deactivate.php ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The deactivate feedback model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Feedback
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Feedback_Deactivate' ) ) :
16
+ /**
17
+ * Deactivate feedback model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Feedback_Deactivate extends ThemeIsle_SDK_Feedback {
20
+
21
+ /**
22
+ * @var array $options The main options list
23
+ */
24
+ private $options = array(
25
+ 'I only needed the plugin for a short period' => array(
26
+ 'id' => 1,
27
+ ),
28
+ 'The plugin broke my site' => array(
29
+ 'id' => 2,
30
+ ),
31
+ 'I found a better plugin' => array(
32
+ 'id' => 3,
33
+ 'type' => 'text',
34
+ 'placeholder' => 'What\'s the plugin\'s name?',
35
+ ),
36
+ 'The plugin suddenly stopped working' => array(
37
+ 'id' => 4,
38
+ ),
39
+ 'I no longer need the plugin' => array(
40
+ 'id' => 5,
41
+ 'type' => 'textarea',
42
+ 'placeholder' => 'If you could improve one thing about our product, what would it be?',
43
+ ),
44
+ 'It\'s a temporary deactivation. I\'m just debugging an issue.' => array(
45
+ 'id' => 6,
46
+ ),
47
+ );
48
+
49
+ /**
50
+ * @var array $other The other option
51
+ */
52
+ private $other = array(
53
+ 'Other' => array(
54
+ 'id' => 999,
55
+ 'type' => 'textarea',
56
+ 'placeholder' => 'cmon cmon tell us',
57
+ ),
58
+ );
59
+
60
+ /**
61
+ * @var string $heading The heading of the modal
62
+ */
63
+ private $heading = 'If you have a moment, please let us know why you are deactivating:';
64
+
65
+ /**
66
+ * @var string $button_submit_before The text of the deactivate button before an option is chosen
67
+ */
68
+ private $button_submit_before = 'Skip &amp; Deactivate';
69
+
70
+ /**
71
+ * @var string $button_submit The text of the deactivate button
72
+ */
73
+ private $button_submit = 'Submit &amp; Deactivate';
74
+
75
+ /**
76
+ * @var string $button_cancel The text of the cancel button
77
+ */
78
+ private $button_cancel = 'Cancel';
79
+
80
+ /**
81
+ * ThemeIsle_SDK_Feedback_Deactivate constructor.
82
+ *
83
+ * @param ThemeIsle_SDK_Product $product_object The product object.
84
+ */
85
+ public function __construct( $product_object ) {
86
+ parent::__construct( $product_object );
87
+ }
88
+
89
+ /**
90
+ * Registers the hooks
91
+ */
92
+ public function setup_hooks_child() {
93
+ global $pagenow;
94
+ if ( 'plugins.php' === $pagenow ) {
95
+ add_action( 'admin_head', array( $this, 'load_resources' ) );
96
+ }
97
+ add_action( 'wp_ajax_' . $this->product->get_key() . __CLASS__, array( $this, 'post_deactivate' ) );
98
+ }
99
+
100
+ /**
101
+ * Loads the additional resources
102
+ */
103
+ function load_resources() {
104
+ add_thickbox();
105
+
106
+ $id = $this->product->get_key() . '_deactivate';
107
+
108
+ $this->add_css( $this->product->get_key() );
109
+ $this->add_js( $this->product->get_key(), '#TB_inline?' . apply_filters( $this->product->get_key() . '_feedback_deactivate_attributes', 'width=600&height=550' ) . '&inlineId=' . $id );
110
+
111
+ echo '<div id="' . $id . '" style="display:none;" class="themeisle-deactivate-box">' . $this->get_html( $this->product->get_key() ) . '</div>';
112
+ }
113
+
114
+ /**
115
+ * Loads the css
116
+ *
117
+ * @param string $key The product key.
118
+ */
119
+ function add_css( $key ) {
120
+ ?>
121
+ <style type="text/css" id="<?php echo $key; ?>ti-deactivate-css">
122
+ input[name="ti-deactivate-option"] ~ div {
123
+ display: none;
124
+ }
125
+
126
+ input[name="ti-deactivate-option"]:checked ~ div {
127
+ display: block;
128
+ }
129
+
130
+ body.plugins-php .<?php echo $key; ?>-container #TB_window.thickbox-loading:before {
131
+ background: none !important;
132
+ }
133
+
134
+ body.plugins-php .<?php echo $key; ?>-container #TB_title {
135
+ font-size: 21px;
136
+ padding: 20px 0;
137
+ background-color: #f3f3f3;
138
+ }
139
+
140
+ body.plugins-php .<?php echo $key; ?>-container div.actions {
141
+ padding: 20px 0;
142
+ background-color: #f3f3f3;
143
+ border-top: 1px solid #dddddd;
144
+ }
145
+
146
+ body.plugins-php .<?php echo $key; ?>-container input.button.button-primary {
147
+ margin-right: 20px;
148
+ }
149
+
150
+ body.plugins-php .<?php echo $key; ?>-container input.button {
151
+ margin-right: 20px;
152
+ }
153
+
154
+ body.plugins-php .<?php echo $key; ?>-container #TB_ajaxWindowTitle {
155
+ text-align: left;
156
+ margin-left: 15px;
157
+ }
158
+
159
+ body.plugins-php .<?php echo $key; ?>-container div.revive_network-container {
160
+ background-color: #ffffff;
161
+ }
162
+
163
+ body.plugins-php .<?php echo $key; ?>-container ul.ti-list li {
164
+ font-size: 14px;
165
+ }
166
+
167
+ body.plugins-php .<?php echo $key; ?>-container ul.ti-list li label {
168
+ margin-left: 10px;
169
+ line-height: 32px;
170
+ font-size: 16px;
171
+ }
172
+
173
+ body.plugins-php .<?php echo $key; ?>-container #TB_ajaxContent {
174
+ padding: 10px 20px;
175
+ }
176
+
177
+ body.plugins-php .<?php echo $key; ?>-container li div textarea {
178
+ padding: 10px 15px;
179
+ width: 100%;
180
+ }
181
+
182
+ body.plugins-php .<?php echo $key; ?>-container ul.ti-list li div {
183
+ margin: 10px 30px;
184
+ }
185
+
186
+ .<?php echo $key; ?>-container #TB_title #TB_ajaxWindowTitle {
187
+ display: block;
188
+ }
189
+
190
+ body.plugins-php .<?php echo $key; ?>-container .actions {
191
+
192
+ width: 100%;
193
+ display: block;
194
+ position: absolute;
195
+ left: 0px;
196
+ bottom: 0px;
197
+ text-align: right;
198
+ }
199
+
200
+ body.plugins-php .<?php echo $key; ?>-container #TB_title {
201
+
202
+ height: 33px;
203
+ width: 100%;
204
+ text-align: center;
205
+ }
206
+
207
+ body.plugins-php .<?php echo $key; ?>-container {
208
+
209
+ margin: auto !important;
210
+ height: 550px !important;
211
+ top: 0 !important;
212
+ left: 0 !important;
213
+ bottom: 0 !important;
214
+ right: 0 !important;
215
+ }
216
+ </style>
217
+ <?php
218
+ }
219
+
220
+ /**
221
+ * Loads the js
222
+ *
223
+ * @param string $key The product key.
224
+ * @param string $src The url that will hijack the deactivate button url.
225
+ */
226
+ function add_js( $key, $src ) {
227
+
228
+ $heading = apply_filters( $this->product->get_key() . '_feedback_deactivate_heading', $this->heading );
229
+ ?>
230
+ <script type="text/javascript" id="ti-deactivate-js">
231
+ (function ($) {
232
+ $(document).ready(function () {
233
+
234
+ var href = $('tr[data-plugin^="<?php echo $this->product->get_slug();?>/"] span.deactivate a').attr('href');
235
+ $('#<?php echo $key;?>ti-deactivate-no').on('click', function (e) {
236
+ e.preventDefault();
237
+ e.stopPropagation();
238
+ $('body').unbind('thickbox:removed');
239
+ tb_remove();
240
+ });
241
+
242
+ $('#<?php echo $key;?> ul.ti-list label, #<?php echo $key;?> ul.ti-list input[name="ti-deactivate-option"]').on('click', function (e) {
243
+ $('#<?php echo $key;?>ti-deactivate-yes').val($('#<?php echo $key;?>ti-deactivate-yes').attr('data-after-text'));
244
+
245
+ var radio = $(this).prop('tagName') === 'LABEL' ? $(this).parent() : $(this);
246
+ if (radio.parent().find('textarea').length > 0 && radio.parent().find('textarea').val().length === 0) {
247
+ $('#<?php echo $key;?>ti-deactivate-yes').attr('disabled', 'disabled');
248
+ radio.parent().find('textarea').on('keyup', function (ee) {
249
+ if ($(this).val().length === 0) {
250
+ $('#<?php echo $key;?>ti-deactivate-yes').attr('disabled', 'disabled');
251
+ } else {
252
+ $('#<?php echo $key;?>ti-deactivate-yes').removeAttr('disabled');
253
+ }
254
+ });
255
+ } else {
256
+ $('#<?php echo $key;?>ti-deactivate-yes').removeAttr('disabled');
257
+ }
258
+ });
259
+
260
+ $('#<?php echo $key;?>ti-deactivate-yes').attr('data-ti-action', href).on('click', function (e) {
261
+ e.preventDefault();
262
+ e.stopPropagation();
263
+ $.ajax({
264
+ url: ajaxurl,
265
+ method: 'post',
266
+ data: {
267
+ 'action': '<?php echo $key . __CLASS__;?>',
268
+ 'nonce': '<?php echo wp_create_nonce( (string) __CLASS__ );?>',
269
+ 'id': $('#<?php echo $key;?> input[name="ti-deactivate-option"]:checked').parent().attr('ti-option-id'),
270
+ 'msg': $('#<?php echo $key;?> input[name="ti-deactivate-option"]:checked').parent().find('textarea').val()
271
+ },
272
+ });
273
+ location.href = $(this).attr('data-ti-action');
274
+ });
275
+ $('tr[data-plugin^="<?php echo $this->product->get_slug();?>/"] span.deactivate a').attr('name', '<?php echo esc_html( $heading ); ?>').attr('href', '<?php echo $src;?>').addClass('thickbox');
276
+ var thicbox_timer;
277
+ $('tr[data-plugin^="<?php echo $this->product->get_slug();?>/"] span.deactivate a').on('click', function () {
278
+ tiBindThickbox();
279
+ });
280
+
281
+ function tiBindThickbox() {
282
+ var thicbox_timer = setTimeout(function () {
283
+ if ($("#<?php echo esc_html( $key ); ?>").is(":visible")) {
284
+ $("body").trigger('thickbox:iframe:loaded');
285
+ $("#TB_window").addClass("<?php echo $key; ?>-container");
286
+ clearTimeout(thicbox_timer);
287
+ $('body').unbind('thickbox:removed');
288
+ } else {
289
+ tiBindThickbox();
290
+ }
291
+ }, 100);
292
+ }
293
+ });
294
+ })(jQuery);
295
+ </script>
296
+ <?php
297
+ }
298
+
299
+ /**
300
+ * Generates the HTML
301
+ *
302
+ * @param string $key The product key.
303
+ */
304
+ function get_html( $key ) {
305
+ $options = $this->randomize_options( apply_filters( $this->product->get_key() . '_feedback_deactivate_options', $this->options ) );
306
+ $button_submit_before = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit_before', $this->button_submit_before );
307
+ $button_submit = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit', $this->button_submit );
308
+ $button_cancel = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_cancel', $this->button_cancel );
309
+
310
+ $options += $this->other;
311
+
312
+ $list = '';
313
+ foreach ( $options as $title => $attributes ) {
314
+ $id = $attributes['id'];
315
+ $list .= '<li ti-option-id="' . $id . '"><input type="radio" name="ti-deactivate-option" id="' . $key . $id . '"><label for="' . $key . $id . '">' . __( $title ) . '</label>';
316
+ if ( array_key_exists( 'type', $attributes ) ) {
317
+ $list .= '<div>';
318
+ $placeholder = array_key_exists( 'placeholder', $attributes ) ? __( $attributes['placeholder'] ) : '';
319
+ switch ( $attributes['type'] ) {
320
+ case 'text':
321
+ $list .= '<textarea style="width: 100%" rows="1" name="comments" placeholder="' . $placeholder . '"></textarea>';
322
+ break;
323
+ case 'textarea':
324
+ $list .= '<textarea style="width: 100%" rows="2" name="comments" placeholder="' . $placeholder . '"></textarea>';
325
+ break;
326
+ }
327
+ $list .= '</div>';
328
+ }
329
+ $list .= '</li>';
330
+ }
331
+
332
+ return '<div id="' . $this->product->get_key() . '">'
333
+ . '<ul class="ti-list">' . $list . '</ul>'
334
+ . '<div class="actions">'
335
+ . get_submit_button( __( $button_submit_before ), 'secondary', $this->product->get_key() . 'ti-deactivate-yes', false, array(
336
+ 'data-after-text' => $button_submit,
337
+ ) )
338
+ . get_submit_button( __( $button_cancel ), 'primary', $this->product->get_key() . 'ti-deactivate-no', false )
339
+ . '</div></div>';
340
+ }
341
+
342
+ /**
343
+ * Called when the deactivate button is clicked
344
+ */
345
+ function post_deactivate() {
346
+ check_ajax_referer( (string) __CLASS__, 'nonce' );
347
+
348
+ if ( ! empty( $_POST['id'] ) ) {
349
+ $this->call_api( array(
350
+ 'type' => 'deactivate',
351
+ 'id' => $_POST['id'],
352
+ 'comment' => isset( $_POST['msg'] ) ? $_POST['msg'] : '',
353
+ ) );
354
+ }
355
+ }
356
+ }
357
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-factory.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The feedback factory class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Feedback
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Feedback_Factory' ) ) :
16
+ /**
17
+ * Feedback model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Feedback_Factory {
20
+
21
+ /**
22
+ * @var array $instances collection of the instances that are registered with the factory
23
+ */
24
+ private $_instances = array();
25
+
26
+ /**
27
+ * ThemeIsle_SDK_Feedback_Factory constructor.
28
+ *
29
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
30
+ * @param array $feedback_types the feedback types.
31
+ */
32
+ public function __construct( $product_object, $feedback_types ) {
33
+ if ( $product_object instanceof ThemeIsle_SDK_Product && $feedback_types && is_array( $feedback_types ) ) {
34
+ foreach ( $feedback_types as $type ) {
35
+ $class = 'ThemeIsle_SDK_Feedback_' . ucwords( $type );
36
+ $instance = new $class( $product_object );
37
+ $this->_instances[ $type ] = $instance;
38
+ $instance->setup_hooks();
39
+ }
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Get the registered instances
45
+ */
46
+ public function get_instances() {
47
+ return $this->_instances;
48
+ }
49
+ }
50
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback-review.php ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The review feedback model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Feedback
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Feedback_Review' ) ) :
16
+ /**
17
+ * Deactivate feedback model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Feedback_Review extends ThemeIsle_SDK_Feedback {
20
+
21
+ /**
22
+ * @var string $heading The heading of the modal
23
+ */
24
+ private $heading = 'Hey, it’s great to see you have {product} active for a few days now. How is everything going? If you can spare a few moments to rate it on WordPress.org it would help us a lot (and boost my motivation). Cheers! <br/> <br/>~ Marius, developer of {product}';
25
+
26
+ /**
27
+ * @var string $button_cancel The text of the cancel button
28
+ */
29
+ private $button_cancel = 'No, thanks.';
30
+ /**
31
+ * @var string $button_already The text of the already did it button
32
+ */
33
+ private $button_do = 'Ok, I will gladly help.';
34
+
35
+ /**
36
+ * ThemeIsle_SDK_Feedback_Deactivate constructor.
37
+ *
38
+ * @param ThemeIsle_SDK_Product $product_object The product object.
39
+ */
40
+ public function __construct( $product_object ) {
41
+ parent::__construct( $product_object );
42
+ }
43
+
44
+ /**
45
+ * Registers the hooks
46
+ */
47
+ public function setup_hooks_child() {
48
+ add_action( 'wp_ajax_' . $this->product->get_key() . __CLASS__, array( $this, 'dismiss' ) );
49
+ }
50
+
51
+ /**
52
+ * Shows the notification
53
+ */
54
+ function show_notification() {
55
+ if ( ! $this->product->is_wordpress_available() ) {
56
+ $this->disable();
57
+
58
+ return false;
59
+ }
60
+ $show = get_option( $this->product->get_key() . '_review_flag', 'yes' );
61
+ if ( 'no' === $show ) {
62
+ return false;
63
+ }
64
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
65
+
66
+ return true;
67
+ }
68
+
69
+ /**
70
+ * Shows the admin notice
71
+ */
72
+ function admin_notices() {
73
+ $id = $this->product->get_key() . '_review';
74
+
75
+ $this->add_css( $this->product->get_key() );
76
+ $this->add_js( $this->product->get_key() );
77
+
78
+ echo '<div class="notice notice-success is-dismissible" id="' . $id . '" ><div class="themeisle-review-box">' . $this->get_html( $this->product->get_key() ) . '</div></div>';
79
+ }
80
+
81
+ /**
82
+ * Loads the css
83
+ *
84
+ * @param string $key The product key.
85
+ */
86
+ function add_css( $key ) {
87
+ ?>
88
+ <style type="text/css" id="<?php echo $key; ?>ti-review-css">
89
+ #<?php echo $key; ?>-review-notification {
90
+ padding-bottom: 5px;
91
+ }
92
+
93
+ #<?php echo $key; ?>-review-notification .review-dismiss {
94
+ margin-left: 5px;
95
+ }
96
+ </style>
97
+ <?php
98
+ }
99
+
100
+ /**
101
+ * Loads the js
102
+ *
103
+ * @param string $key The product key.
104
+ */
105
+ function add_js( $key ) {
106
+ ?>
107
+ <script type="text/javascript" id="<?php echo $key; ?>ti-review-js">
108
+ (function ($) {
109
+ $(document).ready(function () {
110
+ $('#<?php echo $key?>_review').on('click', '.notice-dismiss, .review-dismiss', function (e) {
111
+
112
+ $.ajax({
113
+ url: ajaxurl,
114
+ method: "post",
115
+ data: {
116
+ 'nonce': '<?php echo wp_create_nonce( (string) __CLASS__ );?>',
117
+ 'action': '<?php echo $this->product->get_key() . __CLASS__;?>'
118
+ },
119
+ success: function () {
120
+ $('#<?php echo $key;?>_review').hide();
121
+ }
122
+ });
123
+ });
124
+ });
125
+ })(jQuery);
126
+ </script>
127
+ <?php
128
+ }
129
+
130
+ /**
131
+ * Generates the HTML
132
+ *
133
+ * @param string $key The product key.
134
+ */
135
+ function get_html( $key ) {
136
+ $link = 'https://wordpress.org/support/plugin/' . $this->product->get_slug() . '/reviews/#wporg-footer';
137
+ $heading = apply_filters( $this->product->get_key() . '_feedback_review_heading', $this->heading );
138
+ $heading = str_replace( array( '{product}' ),
139
+ trim( str_replace( 'Lite', '', $this->product->get_name() ) ), $heading );
140
+ $button_cancel = apply_filters( $this->product->get_key() . '_feedback_review_button_cancel', $this->button_cancel );
141
+ $button_do = apply_filters( $this->product->get_key() . '_feedback_review_button_do', $this->button_do );
142
+
143
+ return '<div id="' . $this->product->get_key() . '-review-notification" class="themeisle-sdk-review-box">'
144
+ . '<p>' . $heading . '</p>'
145
+ . '<div class="actions">'
146
+ . '<a href="' . $link . '" target="_blank" class="button button-primary review-dismiss"> ' . $button_do . '</a>'
147
+ . get_submit_button( $button_cancel, 'review-dismiss ' . $this->product->get_key() . '-ti-review', $this->product->get_key() . 'ti-review-no', false )
148
+ . '</div></div>';
149
+ }
150
+
151
+ /**
152
+ * Called when the either button is clicked
153
+ */
154
+ function dismiss() {
155
+ check_ajax_referer( (string) __CLASS__, 'nonce' );
156
+
157
+ $this->disable();
158
+ }
159
+
160
+ /**
161
+ * Disables the notification
162
+ */
163
+ protected function disable() {
164
+ update_option( $this->product->get_key() . '_review_flag', 'no' );
165
+ }
166
+
167
+ /**
168
+ * Enables the notification
169
+ */
170
+ protected function enable() {
171
+ update_option( $this->product->get_key() . '_review_flag', 'yes' );
172
+ }
173
+ }
174
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-feedback.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The feedback model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Feedback
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Feedback' ) ) :
16
+ /**
17
+ * Feedback model for ThemeIsle SDK.
18
+ */
19
+ abstract class ThemeIsle_SDK_Feedback {
20
+ /**
21
+ * @var ThemeIsle_SDK_Product $product Themeisle Product.
22
+ */
23
+ protected $product;
24
+
25
+ /**
26
+ * @var string $feedback_url Url where to send the feedback
27
+ */
28
+ private $feedback_url = 'http://feedback.themeisle.com/wordpress/wp-json/__pirate_feedback_/v1/feedback';
29
+
30
+ /**
31
+ * ThemeIsle_SDK_Feedback constructor.
32
+ *
33
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
34
+ */
35
+ public function __construct( $product_object ) {
36
+ if ( $product_object instanceof ThemeIsle_SDK_Product ) {
37
+ $this->product = $product_object;
38
+ }
39
+ $this->setup_hooks();
40
+ }
41
+
42
+ /**
43
+ * Registers the hooks and then delegates to the child
44
+ */
45
+ public function setup_hooks() {
46
+ $this->setup_hooks_child();
47
+ }
48
+
49
+ /**
50
+ * Calls the API
51
+ *
52
+ * @param string $attributes The attributes of the post body.
53
+ */
54
+ protected function call_api( $attributes ) {
55
+ $slug = $this->product->get_slug();
56
+ $version = $this->product->get_version();
57
+ $attributes['slug'] = $slug;
58
+ $attributes['version'] = $version;
59
+
60
+ $response = wp_remote_post( $this->feedback_url, array(
61
+ 'body' => $attributes,
62
+ ) );
63
+ }
64
+
65
+ /**
66
+ * Randomizes the options array
67
+ *
68
+ * @param array $options The options array.
69
+ */
70
+ function randomize_options( $options ) {
71
+ $new = array();
72
+ $keys = array_keys( $options );
73
+ shuffle( $keys );
74
+
75
+ foreach ( $keys as $key ) {
76
+ $new[ $key ] = $options[ $key ];
77
+ }
78
+
79
+ return $new;
80
+ }
81
+
82
+ /**
83
+ * Abstract function for delegating to the child
84
+ */
85
+ protected abstract function setup_hooks_child();
86
+
87
+ }
88
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php ADDED
@@ -0,0 +1,683 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The main loader class for license handling.
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Licenser
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ if ( ! class_exists( 'ThemeIsle_SDK_Licenser' ) ) :
12
+ /**
13
+ * Class ThemeIsle_SDK_Licenser
14
+ *
15
+ * Used to update the themeisle products
16
+ */
17
+ class ThemeIsle_SDK_Licenser {
18
+
19
+ /**
20
+ * @var string $license_key The license key string
21
+ */
22
+ public $license_key;
23
+
24
+ /**
25
+ * @var bool $do_check This ensures that the custom API request only runs on the second time that WP fires the update check
26
+ */
27
+ private $do_check = false;
28
+
29
+ /**
30
+ * @var bool $failed_checks Number of failed checks to the api endpoint
31
+ */
32
+ private $failed_checks = 0;
33
+ /**
34
+ * @var ThemeIsle_SDK_Product $product The ThemeIsle Product.
35
+ */
36
+ private $product;
37
+ /**
38
+ * @var string $product_key The product update response key.
39
+ */
40
+ private $product_key;
41
+ /**
42
+ * @var int $max_failed Maximum failed checks allowed before show the notice
43
+ */
44
+ private static $max_failed = 5;
45
+
46
+ /**
47
+ * ThemeIsle_SDK_Licenser constructor.
48
+ *
49
+ * @param ThemeIsle_SDK_Product $product The product object.
50
+ */
51
+ public function __construct( $product ) {
52
+ $this->product = $product;
53
+ $this->product_key = $this->product->get_key() . '-update-response';
54
+ if ( ! $this->product->requires_license() ) {
55
+ $this->license_key = 'free';
56
+ } else {
57
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
58
+ $this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
59
+ if ( $license_data !== '' ) {
60
+ $this->license_key = isset( $license_data->key ) ? $license_data->key : get_option( $this->product->get_key() . '_license', '' );
61
+ } else {
62
+ $this->license_key = get_option( $this->product->get_key() . '_license', '' );
63
+ }
64
+ $this->register_license_hooks();
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Register license hooks for the themeisle products
70
+ */
71
+ public function register_license_hooks() {
72
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
73
+ add_action( 'admin_init', array( $this, 'activate_license' ) );
74
+ add_action( 'admin_init', array( $this, 'product_valid' ), 99999999 );
75
+ add_action( 'admin_notices', array( $this, 'show_notice' ) );
76
+ }
77
+
78
+ /**
79
+ * @param string $r Update payload.
80
+ * @param string $url The api url.
81
+ *
82
+ * @return mixed List of themes to check for update.
83
+ */
84
+ function disable_wporg_update( $r, $url ) {
85
+
86
+ if ( 0 !== strpos( $url, 'https://api.wordpress.org/themes/update-check/' ) ) {
87
+ return $r;
88
+ }
89
+
90
+ // Decode the JSON response
91
+ $themes = json_decode( $r['body']['themes'] );
92
+
93
+ unset( $themes->themes->{ $this->product->get_slug() } );
94
+
95
+ // Encode the updated JSON response
96
+ $r['body']['themes'] = json_encode( $themes );
97
+
98
+ return $r;
99
+ }
100
+ /**
101
+ * Register the setting for the license of the product
102
+ *
103
+ * @return bool
104
+ */
105
+ public function register_settings() {
106
+ if ( ! is_admin() ) {
107
+ return false;
108
+ }
109
+ add_settings_field(
110
+ $this->product->get_key() . '_license',
111
+ $this->product->get_name() . ' license',
112
+ array( $this, 'license_view' ),
113
+ 'general'
114
+ );
115
+ }
116
+
117
+ /**
118
+ * The license view field
119
+ */
120
+ public function license_view() {
121
+ $status = $this->get_license_status();
122
+ $value = $this->license_key;
123
+
124
+ $activate_string = apply_filters( $this->product->get_key() . '_lc_activate_string', 'Activate' );
125
+ $deactivate_string = apply_filters( $this->product->get_key() . '_lc_deactivate_string', 'Deactivate' );
126
+ $valid_string = apply_filters( $this->product->get_key() . '_lc_valid_string', 'Valid' );
127
+ $invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', 'Invalid' );
128
+ $license_message = apply_filters( $this->product->get_key() . '_lc_license_message', 'Enter your license from %s purchase history in order to get %s updates' );
129
+
130
+ echo '<p ><input ' . ( ( $status === 'valid' ) ? ( 'style="border:1px solid #7ad03a; "' ) : '' ) . ' type="text" id="' . $this->product->get_key() . '_license" name="' . $this->product->get_key() . '_license" value="' . $value . '" /><a ' . ( ( $status === 'valid' ) ? ( 'style="color:#fff;background: #7ad03a; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $valid_string ) : ( 'style="color:#fff;background: #dd3d36; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $invalid_string ) ) . ' </a>&nbsp;&nbsp;&nbsp;<button name="' . $this->product->get_key() . '_btn_trigger" ' . ( ( $status === 'valid' ) ? ( ' class="button button-primary">' . $deactivate_string ) : ( ' class="button button-primary" value="yes" type="submit" >' . $activate_string ) ) . ' </button></p><p class="description">' . sprintf( $license_message, '<a href="' . $this->product->get_store_url() . '">' . $this->product->get_store_name() . '</a> ', $this->product->get_type() ) . '</p>';
131
+
132
+ }
133
+
134
+ /**
135
+ * Return the license status.
136
+ *
137
+ * @return string The License status.
138
+ */
139
+ public function get_license_status() {
140
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
141
+ if ( $license_data !== '' ) {
142
+ return isset( $license_data->license ) ? $license_data->license : get_option( $this->product->get_key() . '_license_status', 'not_active' );
143
+ } else {
144
+ return get_option( $this->product->get_key() . '_license_status', 'not_active' );
145
+ }
146
+
147
+ }
148
+
149
+ /**
150
+ * Check if the license is active or not
151
+ *
152
+ * @return bool
153
+ */
154
+ public function check_activation() {
155
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
156
+ if ( $license_data !== '' ) {
157
+ return isset( $license_data->error ) ? ( $license_data->error == 'no_activations_left' ) : false;
158
+ }
159
+
160
+ return false;
161
+ }
162
+
163
+ /**
164
+ * Check if the license is about to expire in the next month
165
+ *
166
+ * @return bool
167
+ */
168
+ function check_expiration() {
169
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
170
+ if ( $license_data !== '' ) {
171
+ if ( isset( $license_data->expires ) ) {
172
+ if ( strtotime( $license_data->expires ) - time() < 30 * 24 * 3600 ) {
173
+ return true;
174
+ }
175
+ }
176
+ }
177
+
178
+ return false;
179
+ }
180
+
181
+ /**
182
+ * Return the renew url from the store used
183
+ *
184
+ * @return string The renew url.
185
+ */
186
+ function renew_url() {
187
+ $license_data = get_option( $this->product->get_key() . '_license_data', '' );
188
+ if ( $license_data !== '' ) {
189
+ if ( isset( $license_data->download_id ) && isset( $license_data->key ) ) {
190
+ return $this->product->get_store_url() . '/checkout/?edd_license_key=' . $license_data->key . '&download_id=' . $license_data->download_id;
191
+ }
192
+ }
193
+
194
+ return $this->product->get_store_url();
195
+ }
196
+
197
+ /**
198
+ * Check if we hide the notificatin nag or not
199
+ *
200
+ * @param string $hide The notification to hide.
201
+ *
202
+ * @return bool Either hide them or not.
203
+ */
204
+ function check_hide( $hide ) {
205
+ if ( isset( $_GET[ $this->product->get_key() . '_hide_' . $hide ] ) ) {
206
+ if ( $_GET[ $this->product->get_key() . '_hide_' . $hide ] === 'yes' ) {
207
+ update_option( $this->product->get_key() . '_hide_' . $hide, 'yes' );
208
+
209
+ return false;
210
+ }
211
+ } else {
212
+ $license = get_option( $this->product->get_key() . '_hide_' . $hide, '' );
213
+ if ( $license === 'yes' ) {
214
+ return false;
215
+ }
216
+ }
217
+
218
+ return true;
219
+ }
220
+
221
+ /**
222
+ * Show the admin notice regarding the license status
223
+ *
224
+ * @return bool
225
+ */
226
+ function show_notice() {
227
+ if ( ! is_admin() ) {
228
+ return false;
229
+ }
230
+ $status = $this->get_license_status();
231
+ $no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No activations left for %s !!!. You need to
232
+ upgrade your plan in order to use %s on more
233
+ websites. Please ask the %s
234
+ Staff for more details.' );
235
+ $no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s , please add
236
+ your license code from your <a href="%s" target="_blank">purchase history</a> and validate it <a
237
+ href="%s">here</a> ' );
238
+ $expiration_string = apply_filters( $this->product->get_key() . '_lc_expiration_string', 'Your license is about to expire
239
+ for %s. You can go to %s and renew it ' );
240
+ $hide_notice_string = apply_filters( $this->product->get_key() . '_lc_hide_notice_string', 'Hide Notice' );
241
+ if ( $status != 'valid' ) {
242
+ if ( $this->check_activation() ) {
243
+ if ( $this->check_hide( 'activation' ) ) {
244
+ ?>
245
+ <div class="error">
246
+ <p><strong><?php
247
+ echo sprintf( $no_activations_string, $this->product->get_name(), $this->product->get_name(), '<a href="' . $this->product->get_store_url() . '"
248
+ target="_blank">' . $this->product->get_store_name() . '</a>' );
249
+ ?></strong> | <a
250
+ href="<?php echo add_query_arg( $this->product->get_key() . '_activation', 'yes' ); ?> "><?php echo $hide_notice_string; ?></a>
251
+ </p>
252
+ </div>
253
+ <?php
254
+ return false;
255
+ }
256
+ }
257
+ ?>
258
+ <?php if ( $this->check_hide( 'valid' ) ) : ?>
259
+ <div class="error">
260
+ <p>
261
+ <strong><?php echo sprintf( $no_valid_string, $this->product->get_name() . ' ' . $this->product->get_type(), $this->product->get_store_url(), admin_url( 'options-general.php' ) . '#' . $this->product->get_key() ); ?> </strong>|
262
+ <a
263
+ href="<?php echo add_query_arg( $this->product->get_key() . '_hide_valid', 'yes' ); ?> "><?php echo $hide_notice_string; ?></a>
264
+ </p>
265
+ </div>
266
+ <?php endif; ?>
267
+ <?php
268
+ } else {
269
+ if ( $this->check_expiration() ) {
270
+ if ( $this->check_hide( 'expiration' ) ) {
271
+ ?>
272
+ <div class="update-nag">
273
+ <p>
274
+ <strong><?php echo sprintf( $expiration_string, $this->product->get_name() . ' ' . $this->product->get_type(), '<a
275
+ href="' . $this->renew_url() . '"
276
+ target="_blank">' . $this->product->get_store_name() . '</a>' ); ?> </strong> |
277
+ <a
278
+ href="<?php echo add_query_arg( $this->product->get_key() . '_hide_expiration', 'yes' ); ?> "><?php echo $hide_notice_string; ?></a>
279
+ </p>
280
+ </div>
281
+ <?php
282
+ }
283
+ }
284
+ }
285
+ }
286
+
287
+ /**
288
+ * Run the license check call
289
+ */
290
+ public function product_valid() {
291
+ if ( false === ( $license = get_transient( $this->product->get_key() . '_license_data' ) ) ) {
292
+ $license = $this->check_license();
293
+ set_transient( $this->product->get_key() . '_license_data', $license, 12 * HOUR_IN_SECONDS );
294
+ update_option( $this->product->get_key() . '_license_data', $license );
295
+ }
296
+
297
+ }
298
+
299
+ /**
300
+ * Increment the failed checks
301
+ */
302
+ private function increment_failed_checks() {
303
+ $this->failed_checks ++;
304
+ update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
305
+ }
306
+
307
+ /**
308
+ * Reset the failed checks
309
+ */
310
+ private function reset_failed_checks() {
311
+ $this->failed_checks = 1;
312
+ update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
313
+ }
314
+
315
+ /**
316
+ * Check the license status
317
+ *
318
+ * @return object The license data.
319
+ */
320
+ public function check_license() {
321
+ $status = $this->get_license_status();
322
+ if ( $status == 'not_active' ) {
323
+ $license_data = new stdClass();
324
+ $license_data->license = 'not_active';
325
+
326
+ return $license_data;
327
+ }
328
+ $license = trim( $this->license_key );
329
+ $api_params = array(
330
+ 'edd_action' => 'check_license',
331
+ 'license' => $license,
332
+ 'item_name' => rawurlencode( $this->product->get_name() ),
333
+ 'url' => rawurlencode( home_url() ),
334
+ );
335
+ // Call the custom API.
336
+ $response = wp_remote_get( add_query_arg( $api_params, $this->product->get_store_url() ), array(
337
+ 'timeout' => 15,
338
+ 'sslverify' => false,
339
+ ) );
340
+ if ( is_wp_error( $response ) ) {
341
+ $license_data = new stdClass();
342
+ $license_data->license = 'valid';
343
+
344
+ } else {
345
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
346
+ if ( ! is_object( $license_data ) ) {
347
+ $license_data = new stdClass();
348
+ $license_data->license = 'valid';
349
+ }
350
+ }
351
+ $license_old = get_option( $this->product->get_key() . '_license_data', '' );
352
+ if ( $license_old->license == 'valid' && ( $license_data->license != $license_old->license ) ) {
353
+ $this->increment_failed_checks();
354
+ } else {
355
+ $this->reset_failed_checks();
356
+ }
357
+
358
+ if ( $this->failed_checks <= self::$max_failed ) {
359
+ return $license_old;
360
+ }
361
+
362
+ if ( isset( $license_old->hide_valid ) ) {
363
+ $license_data->hide_valid = true;
364
+ }
365
+
366
+ if ( ! isset( $license_data->key ) ) {
367
+ $license_data->key = isset( $license_old->key ) ? $license_old->key : '';
368
+ }
369
+
370
+ if ( isset( $license_old->hide_expiration ) ) {
371
+ $license_data->hide_expiration = true;
372
+ }
373
+
374
+ if ( isset( $license_old->hide_activation ) ) {
375
+ $license_data->hide_activation = true;
376
+ }
377
+
378
+ return $license_data;
379
+
380
+ }
381
+
382
+ /**
383
+ * Activate the license remotely
384
+ */
385
+ function activate_license() {
386
+ // listen for our activate button to be clicked
387
+ if ( isset( $_POST[ $this->product->get_key() . '_btn_trigger' ] ) ) {
388
+ $status = $this->get_license_status();
389
+ // retrieve the license from the database
390
+ $license = $_POST[ $this->product->get_key() . '_license' ];
391
+ $api_params = array(
392
+ 'license' => $license,
393
+ 'item_name' => rawurlencode( $this->product->get_name() ),
394
+ 'url' => rawurlencode( home_url() ),
395
+ );
396
+ if ( $status != 'valid' ) {
397
+ // data to send in our API request
398
+ $api_params['edd_action'] = 'activate_license';
399
+ } else {
400
+ $api_params['edd_action'] = 'deactivate_license';
401
+ }
402
+ // Call the custom API.
403
+ $response = wp_remote_get( add_query_arg( $api_params, $this->product->get_store_url() ) );
404
+ // make sure the response came back okay
405
+ if ( is_wp_error( $response ) ) {
406
+ $license_data = new stdClass();
407
+ $license_data->license = ( $status != 'valid' ) ? 'valid' : 'invalid';
408
+
409
+ } else {
410
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
411
+ if ( ! is_object( $license_data ) ) {
412
+ $license_data = new stdClass();
413
+ $license_data->license = ( $status != 'valid' ) ? 'valid' : 'invalid';
414
+ }
415
+ }
416
+ if ( ! isset( $license_data->key ) ) {
417
+ $license_data->key = $license;
418
+ }
419
+ if ( $license_data->license == 'valid' ) {
420
+ $this->reset_failed_checks();
421
+ }
422
+
423
+ if ( isset( $license_data->plan ) ) {
424
+ update_option( $this->product->get_key() . '_license_plan', $license_data->plan );
425
+ }
426
+
427
+ update_option( $this->product->get_key() . '_license_data', $license_data );
428
+ delete_transient( $this->product->get_key() . '_license_data' );
429
+ set_transient( $this->product->get_key() . '_license_data', $license_data, 12 * HOUR_IN_SECONDS );
430
+
431
+ }
432
+ }
433
+
434
+ /**
435
+ * Enable the license system
436
+ */
437
+ public function enable() {
438
+ if ( $this->product->get_type() == 'plugin' ) {
439
+ add_filter( 'pre_set_site_transient_update_plugins', array(
440
+ $this,
441
+ 'pre_set_site_transient_update_plugins_filter',
442
+ ) );
443
+ add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
444
+ add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
445
+ }
446
+ if ( $this->product->get_type() == 'theme' ) {
447
+ add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
448
+ add_filter( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
449
+ add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
450
+ add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
451
+ add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
452
+ add_filter( 'http_request_args', array( $this, 'disable_wporg_update' ), 5, 2 );
453
+
454
+ }
455
+
456
+ }
457
+
458
+ /**
459
+ * Load the Themes screen
460
+ */
461
+ function load_themes_screen() {
462
+ add_thickbox();
463
+ add_action( 'admin_notices', array( &$this, 'update_nag' ) );
464
+ }
465
+
466
+ /**
467
+ * Alter the nag for themes update
468
+ */
469
+ function update_nag() {
470
+ $theme = wp_get_theme( $this->product->get_slug() );
471
+ $api_response = get_transient( $this->product_key );
472
+ if ( false === $api_response ) {
473
+ return;
474
+ }
475
+ $update_url = wp_nonce_url( 'update.php?action=upgrade-theme&amp;theme=' . urlencode( $this->product->get_slug() ), 'upgrade-theme_' . $this->product->get_slug() );
476
+ $update_onclick = ' onclick="if ( confirm(\'' . esc_js( __( 'Updating this theme will lose any customizations you have made. Cancel to stop, OK to update.' ) ) . '\') ) {return true;}return false;"';
477
+ if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
478
+ echo '<div id="update-nag">';
479
+ printf( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.',
480
+ $theme->get( 'Name' ),
481
+ $api_response->new_version,
482
+ '#TB_inline?width=640&amp;inlineId=' . $this->product->get_version() . '_changelog',
483
+ $theme->get( 'Name' ),
484
+ $update_url,
485
+ $update_onclick
486
+ );
487
+ echo '</div>';
488
+ echo '<div id="' . $this->product->get_slug() . '_' . 'changelog" style="display:none;">';
489
+ echo wpautop( $api_response->sections['changelog'] );
490
+ echo '</div>';
491
+ }
492
+ }
493
+
494
+ /**
495
+ * @param mixed $value The transient data.
496
+ *
497
+ * @return mixed
498
+ */
499
+ function theme_update_transient( $value ) {
500
+ $update_data = $this->check_for_update();
501
+ if ( $update_data ) {
502
+ $value->response[ $this->product->get_slug() ] = $update_data;
503
+ }
504
+
505
+ return $value;
506
+ }
507
+
508
+ /**
509
+ * Delete the update transient
510
+ */
511
+ function delete_theme_update_transient() {
512
+ delete_transient( $this->product_key );
513
+ }
514
+
515
+ /**
516
+ * Check for updates
517
+ *
518
+ * @return array|bool Either the update data or false in case of failure
519
+ */
520
+ function check_for_update() {
521
+ $theme = wp_get_theme( $this->product->get_slug() );
522
+ $update_data = get_transient( $this->product_key );
523
+ if ( false === $update_data ) {
524
+ $failed = false;
525
+ if ( empty( $this->license_key ) ) {
526
+ return false;
527
+ }
528
+ $api_params = array(
529
+ 'edd_action' => 'get_version',
530
+ 'version' => $this->product->get_version(),
531
+ 'license' => $this->license_key,
532
+ 'name' => $this->product->get_name(),
533
+ 'slug' => $this->product->get_slug(),
534
+ 'author' => $this->product->get_store_name(),
535
+ 'url' => rawurlencode( home_url() ),
536
+ );
537
+ $response = wp_remote_post( $this->product->get_store_url(), array(
538
+ 'timeout' => 15,
539
+ 'sslverify' => false,
540
+ 'body' => $api_params,
541
+ ) );
542
+ // make sure the response was successful
543
+ if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
544
+ $failed = true;
545
+ }
546
+ $update_data = json_decode( wp_remote_retrieve_body( $response ) );
547
+ if ( ! is_object( $update_data ) ) {
548
+ $failed = true;
549
+ }
550
+ // if the response failed, try again in 30 minutes
551
+ if ( $failed ) {
552
+ $data = new stdClass;
553
+ $data->new_version = $this->product->get_version();
554
+ set_transient( $this->product_key, $data, strtotime( '+30 minutes' ) );
555
+
556
+ return false;
557
+ }
558
+ // if the status is 'ok', return the update arguments
559
+ if ( ! $failed ) {
560
+ $update_data->sections = maybe_unserialize( $update_data->sections );
561
+ set_transient( $this->product_key, $update_data, strtotime( '+12 hours' ) );
562
+ }
563
+ }
564
+ if ( version_compare( $this->product->get_version(), $update_data->new_version, '>=' ) ) {
565
+ return false;
566
+ }
567
+
568
+ return (array) $update_data;
569
+ }
570
+
571
+ /**
572
+ * Check for Updates at the defined API endpoint and modify the update array.
573
+ *
574
+ * This function dives into the update API just when WordPress creates its update array,
575
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
576
+ * It is reassembled from parts of the native WordPress plugin update code.
577
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
578
+ *
579
+ * @uses api_request()
580
+ *
581
+ * @param array $_transient_data Update array build by WordPress.
582
+ *
583
+ * @return array Modified update array with custom plugin data.
584
+ */
585
+ public function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
586
+ if ( empty( $_transient_data ) || ! $this->do_check ) {
587
+ $this->do_check = true;
588
+
589
+ return $_transient_data;
590
+ }
591
+ $api_response = $this->api_request();
592
+ if ( false !== $api_response && is_object( $api_response ) && isset( $api_response->new_version ) ) {
593
+ if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
594
+ $_transient_data->response[ $this->product->get_slug() . '/' . $this->product->get_file() ] = $api_response;
595
+ }
596
+ }
597
+
598
+ return $_transient_data;
599
+ }
600
+
601
+ /**
602
+ * Calls the API and, if successfull, returns the object delivered by the API.
603
+ *
604
+ * @uses get_bloginfo()
605
+ * @uses wp_remote_post()
606
+ * @uses is_wp_error()
607
+ *
608
+ * @param string $_action The requested action.
609
+ * @param array $_data Parameters for the API action.
610
+ *
611
+ * @return false||object
612
+ */
613
+ private function api_request( $_action = '', $_data = '' ) {
614
+ if ( empty( $this->license_key ) ) {
615
+ return;
616
+ }
617
+ $api_params = array(
618
+ 'edd_action' => 'get_version',
619
+ 'license' => $this->license_key,
620
+ 'name' => rawurlencode( $this->product->get_name() ),
621
+ 'slug' => rawurlencode( $this->product->get_slug() ),
622
+ 'author' => $this->product->get_store_name(),
623
+ 'url' => rawurlencode( home_url() ),
624
+ );
625
+ $request = wp_remote_post( $this->product->get_store_url(), array(
626
+ 'timeout' => 15,
627
+ 'sslverify' => false,
628
+ 'body' => $api_params,
629
+ ) );
630
+ if ( ! is_wp_error( $request ) ) :
631
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
632
+ if ( $request && isset( $request->sections ) ) {
633
+ $request->sections = maybe_unserialize( $request->sections );
634
+ }
635
+
636
+ return $request;
637
+ else :
638
+ return false;
639
+ endif;
640
+ }
641
+
642
+ /**
643
+ * Updates information on the "View version x.x details" page with custom data.
644
+ *
645
+ * @uses api_request()
646
+ *
647
+ * @param mixed $_data Plugin data.
648
+ * @param string $_action Action to send.
649
+ * @param object $_args Arguments to use.
650
+ *
651
+ * @return object $_data
652
+ */
653
+ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
654
+ if ( ( $_action != 'plugin_information' ) || ! isset( $_args->slug ) || ( $_args->slug != $this->product->get_slug() ) ) {
655
+ return $_data;
656
+ }
657
+ $api_response = $this->api_request();
658
+ if ( false !== $api_response ) {
659
+ $_data = $api_response;
660
+ }
661
+
662
+ return $_data;
663
+ }
664
+
665
+ /**
666
+ * Disable SSL verification in order to prevent download update failures
667
+ *
668
+ * @param array $args Http args.
669
+ * @param string $url Url to check.
670
+ *
671
+ * @return object $array
672
+ */
673
+ function http_request_args( $args, $url ) {
674
+ // If it is an https request and we are performing a package download, disable ssl verification
675
+ if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
676
+ $args['sslverify'] = false;
677
+ }
678
+
679
+ return $args;
680
+ }
681
+
682
+ }
683
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The main loader class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Loader
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Loader' ) ) :
16
+ /**
17
+ * Singleton loader for ThemeIsle SDK.
18
+ */
19
+ final class ThemeIsle_SDK_Loader {
20
+ /**
21
+ * @var ThemeIsle_SDK_Loader instance The singleton instance
22
+ */
23
+ private static $instance;
24
+ /**
25
+ * @var string $version The class version.
26
+ */
27
+ private static $version = '1.0.0';
28
+ /**
29
+ * @var array The products which use the SDK.
30
+ */
31
+ private static $products;
32
+
33
+ /**
34
+ * Register product into SDK.
35
+ *
36
+ * @param string $basefile The product basefile.
37
+ *
38
+ * @return ThemeIsle_SDK_Loader The singleton object.
39
+ */
40
+ public static function init_product( $basefile ) {
41
+
42
+ if ( ! isset( self::$instance ) && ! ( self::$instance instanceof ThemeIsle_SDK_Loader ) ) {
43
+ self::$instance = new ThemeIsle_SDK_Loader;
44
+
45
+ }
46
+ $product_object = new ThemeIsle_SDK_Product( $basefile );
47
+ self::$products[ $product_object->get_slug() ] = $product_object;
48
+
49
+ $notifications = array();
50
+ // Based on the Wordpress Available file header we enable the logger or not.
51
+ if ( ! $product_object->is_wordpress_available() ) {
52
+ $licenser = new ThemeIsle_SDK_Licenser( $product_object );
53
+ $licenser->enable();
54
+ }
55
+
56
+ $logger = new ThemeIsle_SDK_Logger( $product_object );
57
+ if ( $product_object->is_logger_active() ) {
58
+ $logger->enable();
59
+ } else {
60
+ $notifications[] = $logger;
61
+ }
62
+
63
+ $feedback = new ThemeIsle_SDK_Feedback_Factory( $product_object, $product_object->get_feedback_types() );
64
+
65
+ $instances = $feedback->get_instances();
66
+ if ( array_key_exists( 'review', $instances ) ) {
67
+ $notifications[] = $instances['review'];
68
+ }
69
+ new ThemeIsle_SDK_Notification_Manager( $product_object, $notifications );
70
+ if ( ! $product_object->is_external_author() ) {
71
+ new ThemeIsle_SDK_Widgets_Factory( $product_object, $product_object->get_widget_types() );
72
+ }
73
+
74
+ return self::$instance;
75
+ }
76
+
77
+ /**
78
+ * Get all products using the SDK.
79
+ *
80
+ * @return array Products available.
81
+ */
82
+ public static function get_products() {
83
+ return self::$products;
84
+ }
85
+
86
+
87
+ }
88
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The main loader class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Logger
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ if ( ! class_exists( 'ThemeIsle_SDK_Logger' ) ) :
12
+ /**
13
+ * Class ThemeIsle_SDK_Logger
14
+ *
15
+ * Send the statistics to the Themeisle Endpoint
16
+ */
17
+ /**
18
+ * Class ThemeIsle_SDK_Logger
19
+ */
20
+ class ThemeIsle_SDK_Logger {
21
+
22
+ /**
23
+ * @var string $logging_url Url where to send the logs
24
+ */
25
+ private $logging_url = 'http://log.themeisle.com/wp-json/v1/logs/';
26
+
27
+ /**
28
+ * @var ThemeIsle_SDK_Product $product Themeisle Product.
29
+ */
30
+ private $product;
31
+
32
+ /**
33
+ * @var string $product_cron Cron name handler
34
+ */
35
+ private $product_cron;
36
+
37
+ /**
38
+ * @var string $heading The heading of the modal
39
+ */
40
+ private $heading = 'Do you enjoy {product}? Become a contributor by opting in to our anonymous plugin data tracking. We guarantee no sensitive data is collected.';
41
+
42
+ /**
43
+ * @var string $button_submit The text of the submit button
44
+ */
45
+ private $button_submit = 'Sure, I would love to help.';
46
+
47
+ /**
48
+ * @var string $button_cancel The text of the cancel button
49
+ */
50
+ private $button_cancel = 'No, thanks.';
51
+
52
+ /**
53
+ * ThemeIsle_SDK_Logger constructor.
54
+ *
55
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
56
+ */
57
+ public function __construct( $product_object ) {
58
+ if ( $product_object instanceof ThemeIsle_SDK_Product ) {
59
+ $this->product = $product_object;
60
+ $this->product_cron = $product_object->get_key() . '_log_activity';
61
+ }
62
+ add_action( 'wp_ajax_' . $this->product->get_key() . __CLASS__, array( $this, 'dismiss' ) );
63
+ }
64
+
65
+
66
+ /**
67
+ * Start the cron to send the log. It will randomize the interval in order to not send all the logs at the same time.
68
+ */
69
+ public function enable() {
70
+ if ( ! wp_next_scheduled( $this->product_cron ) ) {
71
+ wp_schedule_single_event( time() + ( rand( 15, 24 ) * 3600 ), $this->product_cron );
72
+ }
73
+ add_action( $this->product_cron, array( $this, 'send_log' ) );
74
+ }
75
+
76
+ /**
77
+ * Send the statistics to the api endpoint
78
+ */
79
+ public function send_log() {
80
+ wp_remote_post( $this->logging_url, array(
81
+ 'method' => 'POST',
82
+ 'timeout' => 3,
83
+ 'redirection' => 5,
84
+ 'headers' => array(
85
+ 'X-ThemeIsle-Event' => 'log_site',
86
+ ),
87
+ 'body' => array(
88
+ 'site' => get_site_url(),
89
+ 'slug' => $this->product->get_slug(),
90
+ 'version' => $this->product->get_version(),
91
+ 'data' => apply_filters( $this->product->get_key() . '_logger_data', array() ),
92
+ ),
93
+ ) );
94
+ }
95
+
96
+ /**
97
+ * Dismiss the notification
98
+ */
99
+ function dismiss() {
100
+ check_ajax_referer( (string) __CLASS__, 'nonce' );
101
+
102
+ $flag = intval( $_POST['enable'] ) === 1;
103
+ update_option( $this->product->logger_option, ( $flag ? 'yes' : 'no' ) );
104
+
105
+ if ( true === $flag ) {
106
+ $this->enable();
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Shows the notification
112
+ */
113
+ function show_notification() {
114
+ $show = $this->product->is_logger_active();
115
+ $checked = get_option( $this->product->logger_option, '' );
116
+ if ( ! $show && $checked == '' ) {
117
+ add_action( 'admin_notices', array( $this, 'admin_notices' ) );
118
+
119
+ return true;
120
+ }
121
+
122
+ return false;
123
+ }
124
+
125
+ /**
126
+ * Shows the admin notice
127
+ */
128
+ function admin_notices() {
129
+ $id = $this->product->get_key() . '_logger';
130
+
131
+ $this->add_media( $this->product->get_key() );
132
+
133
+ echo '<div class="notice notice-success is-dismissible " id="' . $this->product->get_key() . '-logger-notification" ><div id="' . $id . '" class="themeisle-logger-box">' . $this->get_html( $this->product->get_key() ) . '</div></div>';
134
+ }
135
+
136
+ /**
137
+ * Generates the HTML
138
+ *
139
+ * @param string $key The product key.
140
+ */
141
+ function get_html( $key ) {
142
+ $heading = apply_filters( $this->product->get_key() . '_logger_heading', $this->heading );
143
+ $heading = str_replace( array( '{product}' ), array(
144
+ trim( str_replace( 'Lite', '', $this->product->get_name() ) )
145
+ ),
146
+ $heading
147
+ );
148
+ $button_submit = apply_filters( $this->product->get_key() . '_logger_button_submit', $this->button_submit );
149
+ $button_cancel = apply_filters( $this->product->get_key() . '_logger_button_cancel', $this->button_cancel );
150
+
151
+ return '<div >'
152
+ . '<p>' . $heading . '</p>'
153
+ . '<div class="actions">'
154
+ . get_submit_button( __( $button_submit ), 'primary ' . $this->product->get_key() . '-ti-logger', $this->product->get_key() . 'ti-logger-yes', false, array(
155
+ 'data-ti-log-enable' => 1,
156
+ ) )
157
+ . get_submit_button( __( $button_cancel ), 'secondary ' . $this->product->get_key() . '-ti-logger', $this->product->get_key() . 'ti-logger-no', false, array(
158
+ 'data-ti-log-enable' => 0,
159
+ ) )
160
+ . '</div></div>';
161
+ }
162
+
163
+ /**
164
+ * Loads the js
165
+ *
166
+ * @param string $key The product key.
167
+ */
168
+ function add_media( $key ) {
169
+ ?>
170
+ <style type="text/css">
171
+ #<?php echo $key; ?>-logger-notification {
172
+ padding-bottom: 5px;
173
+ }
174
+
175
+ #<?php echo $key; ?>-logger-notification .button {
176
+ margin-left: 5px;
177
+ }
178
+ </style>
179
+ <script type="text/javascript" id="<?php echo $key; ?>ti-logger-js">
180
+ (function ($) {
181
+ $(document).ready(function () {
182
+ $('.<?php echo $key?>-ti-logger').on('click', function (e) {
183
+
184
+ $.ajax({
185
+ url: ajaxurl,
186
+ method: "post",
187
+ data: {
188
+ 'nonce': '<?php echo wp_create_nonce( (string) __CLASS__ );?>',
189
+ 'action': '<?php echo $this->product->get_key() . __CLASS__;?>',
190
+ 'enable': $(this).attr('data-ti-log-enable')
191
+ },
192
+ success: function () {
193
+ $('#<?php echo $key;?>-logger-notification').hide();
194
+ }
195
+ });
196
+ });
197
+ });
198
+ })(jQuery);
199
+ </script>
200
+ <?php
201
+ }
202
+
203
+ }
204
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-notification-manager.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The notification manager class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Notification
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Notification_Manager' ) ) :
16
+ /**
17
+ * Notification manager model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Notification_Manager {
20
+ /**
21
+ * Time between notifications.
22
+ */
23
+ const NOTIFICATION_INTERVAL_HOURS = 100;
24
+ /**
25
+ * @var array Notifications for the current product.
26
+ */
27
+ private $notifications = array();
28
+ /**
29
+ * @var ThemeIsle_SDK_Product Current product.
30
+ */
31
+ private $product;
32
+ /**
33
+ * @var array ThemeIsle_SDK_Feedback Feedbacks available.
34
+ */
35
+ private $callbacks = array();
36
+
37
+ /**
38
+ * ThemeIsle_SDK_Notification_Manager constructor.
39
+ *
40
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
41
+ * @param array $callbacks the objects that will be called when a notification is due.
42
+ */
43
+ public function __construct( $product_object, $callbacks ) {
44
+ $this->product = $product_object;
45
+ $this->callbacks = $callbacks;
46
+ $this->setup_hooks();
47
+ }
48
+
49
+ /**
50
+ * Setup the notifications.
51
+ */
52
+ function setup_notifications() {
53
+ if ( ! current_user_can( 'manage_options' ) ) {
54
+ return;
55
+ }
56
+ // Load the notifications only if we have it installed after the required interval.
57
+ if ( ( time() - $this->product->get_install_time() ) > self::NOTIFICATION_INTERVAL_HOURS * HOUR_IN_SECONDS ) {
58
+ if ( $this->product instanceof ThemeIsle_SDK_Product && $this->callbacks && is_array( $this->callbacks ) ) {
59
+ foreach ( $this->callbacks as $instance ) {
60
+ $this->notifications[ $this->product->get_key() . get_class( $instance ) ] = $instance;
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Setup the internal hooks
68
+ */
69
+ private function setup_hooks() {
70
+ add_action( 'admin_head', array( $this, 'show_notification' ) );
71
+ add_action( 'admin_init', array( $this, 'setup_notifications' ) );
72
+ }
73
+
74
+ /**
75
+ * Shows the notification
76
+ */
77
+ function show_notification() {
78
+
79
+ $hidden = get_option( 'themeisle_sdk_notification_hidden', array() );
80
+ $instances = $this->notifications;
81
+ if ( empty( $instances ) ) {
82
+ return;
83
+ }
84
+
85
+ // Get timestamp of last notification.
86
+ $old = 0;
87
+ if ( ! empty( $hidden ) ) {
88
+ $old = $hidden[ count( $hidden ) - 1 ]['time'];
89
+ }
90
+ // Check if the current one is expired.
91
+ if ( ( time() - $old ) > self::NOTIFICATION_INTERVAL_HOURS * HOUR_IN_SECONDS ) {
92
+ // Get hidden notifications key.
93
+ $hidden_ones = wp_list_pluck( $hidden, 'key' );
94
+ // Get the non-hidden notifications.
95
+ $available_notifications = array_diff( array_keys( $instances ), $hidden_ones );
96
+ if ( empty( $available_notifications ) ) {
97
+ return;
98
+ }
99
+ // Get the first notification available.
100
+ $new_one = reset( $available_notifications );
101
+
102
+ $instance = $instances[ $new_one ];
103
+ $hidden[] = array(
104
+ 'time' => time(),
105
+ 'key' => $new_one,
106
+ );
107
+ update_option( 'themeisle_sdk_notification_hidden', $hidden );
108
+ } else {
109
+ $key = $hidden[ count( $hidden ) - 1 ]['key'];
110
+ if ( ! isset( $this->notifications[ $key ] ) ) {
111
+ return;
112
+ } else {
113
+ $instance = $this->notifications[ $key ];
114
+ }
115
+ }
116
+ $instance->show_notification();
117
+ }
118
+ }
119
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The product model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Product
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Product' ) ) :
16
+ /**
17
+ * Product model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Product {
20
+ /**
21
+ * @var string $slug THe product slug.
22
+ */
23
+ private $slug;
24
+ /**
25
+ * @var string $basefile The file with headers.
26
+ */
27
+ private $basefile;
28
+ /**
29
+ * @var string $type The product type ( plugin | theme ).
30
+ */
31
+ private $type;
32
+ /**
33
+ * @var string $file The file name.
34
+ */
35
+ private $file;
36
+ /**
37
+ * @var string $name The product name.
38
+ */
39
+ private $name;
40
+ /**
41
+ * @var string $key The product ready key.
42
+ */
43
+ private $key;
44
+ /**
45
+ * @var string $author_url The url of the author.
46
+ */
47
+ private $author_url;
48
+ /**
49
+ * @var string $store_url The store url.
50
+ */
51
+ private $store_url;
52
+ /**
53
+ * @var int $install The date of install.
54
+ */
55
+ private $install;
56
+ /**
57
+ * @var string $store_name The store name.
58
+ */
59
+ private $store_name;
60
+ /**
61
+ * @var array $allowed_authors The allowed authors.
62
+ */
63
+ private $allowed_authors = array( 'proteusthemes.com' );
64
+ /**
65
+ * @var bool $requires_license Either user needs to activate it with license.
66
+ */
67
+ private $requires_license;
68
+ /**
69
+ * @var bool $wordpress_available Either is available on wordpress or not.
70
+ */
71
+ private $wordpress_available;
72
+ /**
73
+ * @var string $version The product version.
74
+ */
75
+ private $version;
76
+ /**
77
+ * @var string $logger_option Logger option key.
78
+ */
79
+ public $logger_option;
80
+ /**
81
+ * @var string $pro_slug Pro slug, if available.
82
+ */
83
+ public $pro_slug;
84
+ /**
85
+ * @var string $feedback_types All the feedback types the product supports
86
+ */
87
+ private $feedback_types = array();
88
+
89
+ /**
90
+ * @var string $widget_types All the widget types the product supports
91
+ */
92
+ private $widget_types = array( 'dashboard_blog' );
93
+
94
+ /**
95
+ * ThemeIsle_SDK_Product constructor.
96
+ *
97
+ * @param string $basefile Product basefile.
98
+ */
99
+ public function __construct( $basefile ) {
100
+ if ( ! empty( $basefile ) ) {
101
+ if ( is_readable( $basefile ) ) {
102
+ $this->basefile = $basefile;
103
+ $this->setup_from_path();
104
+ $this->setup_from_fileheaders();
105
+ }
106
+ }
107
+ $install = get_option( $this->get_key() . '_install', 0 );
108
+ if ( $install === 0 ) {
109
+ $install = time();
110
+ update_option( $this->get_key() . '_install', time() );
111
+ }
112
+ $this->install = $install;
113
+
114
+ $this->logger_option = $this->get_key() . '_logger_flag';
115
+
116
+ }
117
+
118
+ /**
119
+ * Setup props from fileheaders.
120
+ */
121
+ public function setup_from_fileheaders() {
122
+ $file_headers = array(
123
+ 'Requires License' => 'Requires License',
124
+ 'WordPress Available' => 'WordPress Available',
125
+ 'Pro Slug' => 'Pro Slug',
126
+ 'Version' => 'Version',
127
+ );
128
+ if ( $this->type == 'plugin' ) {
129
+ $file_headers['Name'] = 'Plugin Name';
130
+ $file_headers['AuthorName'] = 'Author';
131
+ $file_headers['AuthorURI'] = 'Author URI';
132
+ }
133
+ if ( $this->type == 'theme' ) {
134
+ $file_headers['Name'] = 'Theme Name';
135
+ $file_headers['AuthorName'] = 'Author';
136
+ $file_headers['AuthorURI'] = 'Author URI';
137
+ }
138
+ $file_headers = get_file_data( $this->basefile, $file_headers );
139
+
140
+ $this->name = $file_headers['Name'];
141
+ $this->store_name = $file_headers['AuthorName'];
142
+ $this->author_url = $file_headers['AuthorURI'];
143
+ $this->store_url = $file_headers['AuthorURI'];
144
+ if ( $this->is_external_author() ) {
145
+ $this->store_url = 'https://themeisle.com';
146
+ $this->store_name = 'ThemeIsle';
147
+ }
148
+ $this->requires_license = ( $file_headers['Requires License'] == 'yes' ) ? true : false;
149
+ $this->wordpress_available = ( $file_headers['WordPress Available'] == 'yes' ) ? true : false;
150
+ $this->pro_slug = ! empty( $file_headers['Pro Slug'] ) ? $file_headers['Pro Slug'] : '';
151
+ $this->version = $file_headers['Version'];
152
+ if ( $this->require_uninstall_feedback() ) {
153
+ $this->feedback_types[] = 'deactivate';
154
+ }
155
+ if ( $this->is_wordpress_available() && $this->get_type() === 'plugin' ) {
156
+ $this->feedback_types[] = 'review';
157
+ }
158
+ }
159
+
160
+ /**
161
+ * Check if the product is by external author or not.
162
+ *
163
+ * @return bool Either is external author or no.
164
+ */
165
+ public function is_external_author() {
166
+ foreach ( $this->allowed_authors as $author ) {
167
+ if ( strpos( $this->author_url, $author ) !== false ) {
168
+ return true;
169
+ }
170
+ }
171
+
172
+ return false;
173
+ }
174
+
175
+ /**
176
+ * The magic var_dump info method.
177
+ *
178
+ * @return array Debug info.
179
+ */
180
+ public function __debugInfo() {
181
+ return array(
182
+ 'name' => $this->name,
183
+ 'slug' => $this->slug,
184
+ 'version' => $this->version,
185
+ 'basefile' => $this->basefile,
186
+ 'key' => $this->key,
187
+ 'type' => $this->type,
188
+ 'store_name' => $this->store_name,
189
+ 'store_url' => $this->store_url,
190
+ 'wordpress_available' => $this->wordpress_available,
191
+ 'requires_license' => $this->requires_license,
192
+ );
193
+
194
+ }
195
+
196
+ /**
197
+ * Setup props from path.
198
+ */
199
+ public function setup_from_path() {
200
+ $this->file = basename( $this->basefile );
201
+ $dir = dirname( $this->basefile );
202
+ $this->slug = basename( $dir );
203
+ $exts = explode( '.', $this->basefile );
204
+ $ext = $exts[ count( $exts ) - 1 ];
205
+ if ( $ext == 'css' ) {
206
+ $this->type = 'theme';
207
+ }
208
+ if ( $ext == 'php' ) {
209
+ $this->type = 'plugin';
210
+ }
211
+ $this->key = self::key_ready_name( $this->slug );
212
+ }
213
+
214
+ /**
215
+ * @param string $string the String to be normalized for cron handler.
216
+ *
217
+ * @return string $name The normalized string.
218
+ */
219
+ static function key_ready_name( $string ) {
220
+ return str_replace( '-', '_', strtolower( trim( $string ) ) );
221
+ }
222
+
223
+ /**
224
+ * Getter for product name.
225
+ *
226
+ * @return string The product name.
227
+ */
228
+ public function get_name() {
229
+ return $this->name;
230
+ }
231
+
232
+ /**
233
+ * Getter for product version.
234
+ *
235
+ * @return string The product version.
236
+ */
237
+ public function get_version() {
238
+ return $this->version;
239
+ }
240
+
241
+ /**
242
+ * If product is available on wordpress.org or not.
243
+ *
244
+ * @return bool Either is wp available or not.
245
+ */
246
+ public function is_wordpress_available() {
247
+ return $this->wordpress_available;
248
+ }
249
+
250
+ /**
251
+ * Return the product key.
252
+ *
253
+ * @return string The product key.
254
+ */
255
+ public function get_key() {
256
+ return $this->key;
257
+ }
258
+
259
+ /**
260
+ * Either the product requires license or not.
261
+ *
262
+ * @return bool Either requires license or not.
263
+ */
264
+ public function requires_license() {
265
+ return $this->requires_license;
266
+ }
267
+
268
+ /**
269
+ * Check if the product is either theme or plugin.
270
+ *
271
+ * @return string Product type.
272
+ */
273
+ public function get_type() {
274
+ return $this->type;
275
+ }
276
+
277
+ /**
278
+ * Returns the Store name.
279
+ *
280
+ * @return string Store name.
281
+ */
282
+ public function get_store_name() {
283
+ return $this->store_name;
284
+ }
285
+
286
+ /**
287
+ * Returns the store url.
288
+ *
289
+ * @return string The store url.
290
+ */
291
+ public function get_store_url() {
292
+ return $this->store_url;
293
+ }
294
+
295
+ /**
296
+ * Returns the product slug.
297
+ *
298
+ * @return string The product slug.
299
+ */
300
+ public function get_slug() {
301
+ return $this->slug;
302
+ }
303
+
304
+ /**
305
+ * Returns product basefile, which holds the metaheaders.
306
+ *
307
+ * @return string The product basefile.
308
+ */
309
+ public function get_basefile() {
310
+ return $this->basefile;
311
+ }
312
+
313
+ /**
314
+ * Returns product filename.
315
+ *
316
+ * @return string The product filename.
317
+ */
318
+ public function get_file() {
319
+ return $this->file;
320
+ }
321
+
322
+ /**
323
+ * Returns feedback types
324
+ *
325
+ * @return array The feedback types.
326
+ */
327
+ public function get_feedback_types() {
328
+ return apply_filters( $this->get_key() . '_feedback_types', $this->feedback_types );
329
+ }
330
+
331
+ /**
332
+ * Returns widget types
333
+ *
334
+ * @return array The widget types.
335
+ */
336
+ public function get_widget_types() {
337
+ return apply_filters( $this->get_key() . '_widget_types', $this->widget_types );
338
+ }
339
+
340
+ /**
341
+ * We log the user website and product version.
342
+ *
343
+ * @return bool Either we log the data or not.
344
+ */
345
+ public function is_logger_active() {
346
+ // If is not available on wordpress log this automatically.
347
+ if ( ! $this->is_wordpress_available() ) {
348
+ return true;
349
+ } else {
350
+ $pro_slug = $this->get_pro_slug();
351
+ if ( ! empty( $pro_slug ) ) {
352
+
353
+ $all_products = ThemeIsle_SDK_Loader::get_products();
354
+ if ( isset( $all_products[ $pro_slug ] ) ) {
355
+ return true;
356
+ }
357
+ }
358
+
359
+ return ( get_option( $this->get_key() . '_logger_flag', 'no' ) === 'yes' );
360
+
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Returns the pro slug, if available.
366
+ *
367
+ * @return string The pro slug.
368
+ */
369
+ public function get_pro_slug() {
370
+ return $this->pro_slug;
371
+ }
372
+
373
+ /**
374
+ * Return the install timestamp.
375
+ *
376
+ * @return int The install timestamp.
377
+ */
378
+ public function get_install_time() {
379
+ return $this->install;
380
+ }
381
+
382
+ /**
383
+ * We require feedback on uninstall.
384
+ *
385
+ * @return bool Either we should require feedback on uninstall or not.
386
+ */
387
+ public function require_uninstall_feedback() {
388
+ return $this->get_type() === 'plugin';
389
+ }
390
+
391
+ }
392
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget-dashboard-blog.php ADDED
@@ -0,0 +1,354 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The blog dashboard model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Widgets
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Widget_Dashboard_Blog' ) ) :
16
+ /**
17
+ * Blog dashboard widget model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Widget_Dashboard_Blog extends ThemeIsle_SDK_Widget {
20
+
21
+ /**
22
+ * @var array instance The instances.
23
+ */
24
+ protected $product;
25
+ /**
26
+ * @var array Feed items.
27
+ */
28
+ private $items = array();
29
+
30
+ /**
31
+ * ThemeIsle_SDK_Widget_Dashboard_Blog constructor.
32
+ *
33
+ * @param ThemeIsle_SDK_Product $product_object The product object.
34
+ */
35
+ public function __construct( $product_object ) {
36
+ $this->product = $product_object;
37
+ parent::__construct( $product_object );
38
+ }
39
+
40
+ /**
41
+ * Registers the hooks
42
+ */
43
+ public function setup_hooks_child() {
44
+ $this->setup_vars();
45
+ add_action( 'wp_dashboard_setup', array( &$this, 'add_widget' ) );
46
+ add_action( 'wp_network_dashboard_setup', array( &$this, 'add_widget' ) );
47
+ add_filter( 'themeisle_sdk_recommend_plugin_or_theme', array( &$this, 'recommend_plugin_or_theme' ) );
48
+ }
49
+
50
+ /**
51
+ * Setup class variables
52
+ */
53
+ function setup_vars() {
54
+ $this->dashboard_name = apply_filters( 'themeisle_sdk_dashboard_widget_name', 'WordPress Guides/Tutorials' );
55
+ $this->feeds = apply_filters( 'themeisle_sdk_dashboard_widget_feeds', array(
56
+ 'https://themeisle.com/blog/feed'
57
+ ) );
58
+ }
59
+
60
+ /**
61
+ * Add widget to the dashboard
62
+ *
63
+ * @return string|void
64
+ */
65
+ function add_widget() {
66
+ global $wp_meta_boxes;
67
+ if ( isset( $wp_meta_boxes['dashboard']['normal']['core']['themeisle'] ) ) {
68
+ return;
69
+ }
70
+ wp_add_dashboard_widget( 'themeisle', $this->dashboard_name, array(
71
+ &$this,
72
+ 'render_dashboard_widget',
73
+ ) );
74
+ }
75
+
76
+ /**
77
+ * Setup feed items.
78
+ */
79
+ private function setup_feeds() {
80
+ $items_normalized = array();
81
+ if ( false === ( $items_normalized = get_transient( 'themeisle_sdk_feed_items' ) ) ) {
82
+ // Load SimplePie Instance
83
+ $feed = fetch_feed( $this->feeds );
84
+ // TODO report error when is an error loading the feed
85
+ if ( is_wp_error( $feed ) ) {
86
+ return;
87
+ }
88
+
89
+ $items = $feed->get_items( 0, 5 );
90
+ foreach ( (array) $items as $item ) {
91
+ $items_normalized[] = array(
92
+ 'title' => $item->get_title(),
93
+ 'date' => $item->get_date( 'U' ),
94
+ 'link' => $item->get_permalink(),
95
+ );
96
+ }
97
+ set_transient( 'themeisle_sdk_feed_items', $items_normalized, 48 * HOUR_IN_SECONDS );
98
+ }
99
+ $this->items = $items_normalized;
100
+ }
101
+
102
+ /**
103
+ * Render widget content
104
+ */
105
+ function render_dashboard_widget() {
106
+ $this->setup_feeds();
107
+ ?>
108
+ <style type="text/css">
109
+ #themeisle ul {
110
+ margin-bottom: 0px;
111
+ }
112
+
113
+ #themeisle ul li.ti-dw-recommend-item {
114
+
115
+ padding-left: 7px;
116
+ border-top: 1px solid #eee;
117
+
118
+ margin-bottom: 0px;
119
+ padding-top: 6px;
120
+ }
121
+
122
+ #themeisle h2.hndle {
123
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAALfSURBVEhL7VW/ayJBFL7/5ZqziBzIcSCHxUE4hAiCgnAQsBASOAikEAIeCAaCiJAyIBICQURYwoJoEUmxa6MWioWxURu30mq77b57s86acX+oOQhp8sFjdmbfzrfve2/efMI74IP0VTB0gz/th/8iNbQxOt0eOmoN6WgAn78cwJeoYcLf78KrSPVneU3isEQZoz0D3pt03jhDrDTERJXxWM3A5yAOIPmgce/t2IvUGFzjkDa+7C5RTx0gWbxG0v8bBXUG3fLReigk4rh55gtbsAfpGDfhVTS+VA19bYbH7BkqU/56AzNU7nrYpbI7qfbEcxfBkSOHJGO27Vk0htqEYoXvARdS+tsEJyAJY1GRkOxnGTdq2zuaRZOkJ1Wi1+h7ODlJB/l1kYRKZVyKhMwoSmUw5M4uWMhIcl9f1l1qB2m/aMkZQIE2d5BeDTGiSD0VfC4jZPmSKiO+LMJGuoRE1bkiOIW00CAdW3NuxzLmxhD1hyHmug7dbBRD9KdLc4dR6Zfgn0ffXN2EjVSMLIcOrWxuwiyyPhYGI7X0m/agqPeIib5+yit/LWILKYuUlrTa5kbMwjko7J0AXc1RLZwifRF58Us1YXMzYSMV5WQ5ZWsG5VnYaG1BxM7zKBRzOAkHac460gxK9sUnVBqbu9rhKCS9lRaq1/poCeUq7tL6uPnjSLeoBRo9/KXjslqP4Na1gbiQssiULK9gP+VVqPnFQMblnwi+WmTfIji5amLES1mn/mz9yCFVuddZdiFlIJlTK+JtH2/AaPMogzipzrZ+4yQ1qCL1JSaNDL6bf81y1aOb5R6Vhow6G1tPNK9Borl0R2NLRiEaxNEF9Wa3yrHBSarTbeHot7ySqVmYR4AucDYuaJyzkfptZ0e/FeGa03m3jOQPizCAo0QG9W2ktL5HgGt45JRgaBh1x9R1WHY0KCTnLZOW5Kw0miuZq01ITGa6Z18Db9I3xAfpm+IdSIF/du91gSA2+I8AAAAASUVORK5CYII=');
124
+ background-repeat: no-repeat;
125
+ background-position: 90% 50%;
126
+ background-size: 29px;
127
+ }
128
+
129
+ .ti-dw-feed-item {
130
+ display: flex;
131
+ align-items: center;
132
+ }
133
+
134
+ .ti-dw-feed-item a {
135
+ float: left;
136
+ width: 89.9%;
137
+ }
138
+
139
+ .ti-dw-feed-item .ti-dw-day-container {
140
+ width: 100%;
141
+ letter-spacing: 3px;
142
+ display: block;
143
+ }
144
+
145
+ .ti-dw-feed-item .ti-dw-month-container {
146
+
147
+ width: 100%;
148
+ display: block;
149
+ font-weight: 600;
150
+ padding: 0px;
151
+ margin-top: -6px;
152
+ text-transform: uppercase;
153
+ font-size: 10px;
154
+ letter-spacing: 1px;
155
+ }
156
+
157
+ .ti-dw-feed-item .ti-dw-date-container {
158
+ float: left;
159
+ min-height: 30px;
160
+ margin-right: 0.1%;
161
+ width: 10%;
162
+ text-align: center;
163
+ }
164
+
165
+ .ti-dw-recommend-item span {
166
+ color: #72777c;
167
+ }
168
+
169
+ </style>
170
+ <ul>
171
+ <?php
172
+ foreach ( $this->items as $item ) {
173
+ ?>
174
+ <li class="ti-dw-feed-item"><span class="ti-dw-date-container"><span
175
+ class="ti-dw-day-container"><?php echo date( 'd', $item['date'] ); ?></span> <span
176
+ class="ti-dw-month-container"><?php echo substr( date( 'M', $item['date'] ), 0, 3 ); ?></span></span><a
177
+ href="<?php echo add_query_arg(
178
+ array(
179
+ 'utm_campaign' => 'feed',
180
+ 'utm_medium' => 'dashboard_widget',
181
+ ), $item['link'] ); ?>" target="_blank"><?php echo $item['title']; ?></a>
182
+ <div class="clear"></div>
183
+ </li>
184
+ <?php
185
+ }
186
+
187
+ $recommend = apply_filters( 'themeisle_sdk_recommend_plugin_or_theme', array() );
188
+ if ( is_array( $recommend ) && ! empty( $recommend ) ) {
189
+
190
+ $type = $recommend['type'];
191
+ if ( ( $type == 'theme' && current_user_can( 'install_themes' ) ) || ( $type == 'plugin' && current_user_can( 'install_plugins' ) ) ) {
192
+ add_thickbox();
193
+ $url = add_query_arg( array(
194
+ 'theme' => $recommend['slug'],
195
+ ), network_admin_url( 'theme-install.php' ) );
196
+
197
+ if ( 'plugin' === $type ) {
198
+
199
+ $url = add_query_arg( array(
200
+ 'tab' => 'plugin-information',
201
+ 'plugin' => $recommend['slug'],
202
+ ), network_admin_url( 'plugin-install.php' ) );
203
+ }
204
+ ?>
205
+ <li class="ti-dw-recommend-item ">
206
+ <span class="ti-dw-recommend"><?php echo apply_filters( 'themeisle_sdk_dashboard_popular_label', sprintf( 'Popular %s', ucwords( $type ) ) ); ?>
207
+ : </span><?php echo trim( str_replace( array(
208
+ 'lite',
209
+ 'Lite',
210
+ ), '', $recommend['name'] ) ); ?>
211
+ (<a class="thickbox open-plugin-details-modal"
212
+ href="<?php echo $url . '&TB_iframe=true&width=600&height=500'; ?>"><?php _e( 'Install' ); ?></a>)
213
+ </li>
214
+
215
+ <?php
216
+ }
217
+ }
218
+ ?>
219
+ </ul>
220
+
221
+ <?php
222
+
223
+ }
224
+
225
+ /**
226
+ * Either the current product is installed or not.
227
+ *
228
+ * @param array $val The current recommended product.
229
+ *
230
+ * @return bool Either we should exclude the plugin or not.
231
+ */
232
+ public function remove_current_products( $val ) {
233
+ if ( $val['type'] === 'theme' ) {
234
+ $exist = wp_get_theme( $val['slug'] );
235
+
236
+ return ! $exist->exists();
237
+ } else {
238
+ $all_plugins = array_keys( get_plugins() );
239
+ foreach ( $all_plugins as $slug ) {
240
+ if ( strpos( $slug, $val['slug'] ) !== false ) {
241
+ return false;
242
+ }
243
+ }
244
+
245
+ return true;
246
+ }
247
+ }
248
+
249
+ /**
250
+ * Fetch themes from wporg api.
251
+ *
252
+ * @param string $author The author name.
253
+ *
254
+ * @return array The list of themes.
255
+ */
256
+ function get_themes_from_wporg( $author ) {
257
+ $products = wp_remote_get(
258
+ 'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[author]=' . $author . '&request[per_page]=30&request[fields][active_installs]=true'
259
+ );
260
+ $products = json_decode( wp_remote_retrieve_body( $products ) );
261
+ if ( is_object( $products ) ) {
262
+ $products = isset( $products->themes ) ? $products->themes : array();
263
+ } else {
264
+ $products = array();
265
+ }
266
+
267
+ return $products;
268
+ }
269
+
270
+ /**
271
+ * Fetch plugin from wporg api.
272
+ *
273
+ * @param string $author The author slug.
274
+ *
275
+ * @return array The list of plugins for the selected author.
276
+ */
277
+ function get_plugins_from_wporg( $author ) {
278
+ $products = wp_remote_get(
279
+ 'https://api.wordpress.org/plugins/info/1.1/?action=query_plugins&request[author]=' . $author . '&request[author]=codeinwp&request[per_page]=20&request[fields][active_installs]=true'
280
+ );
281
+ $products = json_decode( wp_remote_retrieve_body( $products ) );
282
+ if ( is_object( $products ) ) {
283
+ $products = isset( $products->plugins ) ? $products->plugins : array();
284
+ } else {
285
+ $products = array();
286
+ }
287
+
288
+ return $products;
289
+ }
290
+
291
+ /**
292
+ * Fetch products from the recomended section.
293
+ *
294
+ * @return array|mixed The list of products to use in recomended section.
295
+ */
296
+ function get_product_from_api() {
297
+ if ( false === ( $products = get_transient( 'themeisle_sdk_products' ) ) ) {
298
+ $products = array();
299
+ $themeisle_themes = $this->get_themes_from_wporg( 'themeisle' );
300
+ $codeinwp_themes = $this->get_themes_from_wporg( 'codeinwp' );
301
+
302
+ $themeisle_plugins = $this->get_plugins_from_wporg( 'themeisle' );
303
+ $codeinwp_plugins = $this->get_plugins_from_wporg( 'codeinwp' );
304
+
305
+ $all_themes = array_merge( $themeisle_themes, $codeinwp_themes );
306
+ foreach ( $all_themes as $theme ) {
307
+ if ( $theme->active_installs < 4999 ) {
308
+ continue;
309
+ }
310
+ $products[] = array(
311
+ 'name' => $theme->name,
312
+ 'type' => 'theme',
313
+ 'slug' => $theme->slug,
314
+ 'installs' => $theme->active_installs,
315
+ );
316
+ }
317
+ $all_plugins = array_merge( $themeisle_plugins, $codeinwp_plugins );
318
+ foreach ( $all_plugins as $plugin ) {
319
+ if ( $plugin->active_installs < 5999 ) {
320
+ continue;
321
+ }
322
+ $products[] = array(
323
+ 'name' => $plugin->name,
324
+ 'type' => 'plugin',
325
+ 'slug' => $plugin->slug,
326
+ 'installs' => $plugin->active_installs,
327
+ );
328
+ }
329
+ set_transient( 'themeisle_sdk_products', $products, 6 * HOUR_IN_SECONDS );
330
+ }
331
+
332
+ return $products;
333
+ }
334
+
335
+ /**
336
+ * Contact the API and fetch the recommended plugins/themes
337
+ */
338
+ function recommend_plugin_or_theme() {
339
+ $products = $this->get_product_from_api();
340
+ if ( ! is_array( $products ) ) {
341
+ $products = array();
342
+ }
343
+ $products = array_filter( $products, array( $this, 'remove_current_products' ) );
344
+ $products = array_merge( $products );
345
+ if ( count( $products ) > 1 ) {
346
+ shuffle( $products );
347
+ $products = array_slice( $products, 0, 1 );
348
+ }
349
+ $to_recommend = isset( $products[0] ) ? $products[0] : $products;
350
+
351
+ return $to_recommend;
352
+ }
353
+ }
354
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widget.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The widget model class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Widgets
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Widget' ) ) :
16
+ /**
17
+ * Widget model for ThemeIsle SDK.
18
+ */
19
+ abstract class ThemeIsle_SDK_Widget {
20
+ /**
21
+ * @var ThemeIsle_SDK_Product $product Themeisle Product.
22
+ */
23
+ protected $product;
24
+
25
+ /**
26
+ * ThemeIsle_SDK_Widget constructor.
27
+ *
28
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
29
+ */
30
+ public function __construct( $product_object ) {
31
+ if ( $product_object instanceof ThemeIsle_SDK_Product ) {
32
+ $this->product = $product_object;
33
+ }
34
+ $this->setup_hooks();
35
+ }
36
+
37
+ /**
38
+ * Registers the hooks and then delegates to the child
39
+ */
40
+ public function setup_hooks() {
41
+ $this->setup_hooks_child();
42
+ }
43
+
44
+ /**
45
+ * Abstract function for delegating to the child
46
+ */
47
+ protected abstract function setup_hooks_child();
48
+
49
+ }
50
+ endif;
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-widgets-factory.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The widgets factory class for ThemeIsle SDK
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @subpackage Widgets
7
+ * @copyright Copyright (c) 2017, Marius Cristea
8
+ * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9
+ * @since 1.0.0
10
+ */
11
+ // Exit if accessed directly.
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+ if ( ! class_exists( 'ThemeIsle_SDK_Widgets_Factory' ) ) :
16
+ /**
17
+ * Widgets factory model for ThemeIsle SDK.
18
+ */
19
+ class ThemeIsle_SDK_Widgets_Factory {
20
+
21
+ /**
22
+ * ThemeIsle_SDK_Widgets_Factory constructor.
23
+ *
24
+ * @param ThemeIsle_SDK_Product $product_object Product Object.
25
+ * @param array $widgets the widgets.
26
+ */
27
+ public function __construct( $product_object, $widgets ) {
28
+ if ( $product_object instanceof ThemeIsle_SDK_Product && $widgets && is_array( $widgets ) ) {
29
+ foreach ( $widgets as $widget ) {
30
+ $class = 'ThemeIsle_SDK_Widget_' . str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) );
31
+ $instance = new $class( $product_object );
32
+ $instance->setup_hooks();
33
+ }
34
+ }
35
+ }
36
+ }
37
+ endif;
vendor/codeinwp/themeisle-sdk/composer.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "codeinwp/themeisle-sdk",
3
+ "description": "ThemeIsle SDK ",
4
+ "keywords": [
5
+ "wordpress"
6
+ ],
7
+ "homepage": "https://github.com/Codeinwp/themeisle-sdk",
8
+ "license": "GPL-2.0+",
9
+ "authors": [
10
+ {
11
+ "name": "ThemeIsle team",
12
+ "email": "friends@themeisle.com",
13
+ "homepage": "https://themeisle.com"
14
+ }
15
+ ],
16
+ "autoload": {
17
+ "files": [
18
+ "load.php"
19
+ ]
20
+ },
21
+ "support": {
22
+ "issues": "https://github.com/Codeinwp/themeisle-sdk/issues"
23
+ }
24
+ }
vendor/codeinwp/themeisle-sdk/index.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package ThemeIsleSDK
4
+ * Ignore this.
5
+ */
vendor/codeinwp/themeisle-sdk/load.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loader for the ThemeIsleSDK
4
+ *
5
+ * Logic for loading always the latest SDK from the installed themes/plugins.
6
+ *
7
+ * @package ThemeIsleSDK
8
+ * @copyright Copyright (c) 2017, Marius Cristea
9
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
10
+ * @since 1.1.0
11
+ */
12
+
13
+ // Current SDK version and path.
14
+ $themeisle_sdk_version = '1.4.0';
15
+ $themeisle_sdk_path = dirname( __FILE__ );
16
+
17
+ global $themeisle_sdk_max_version;
18
+ global $themeisle_sdk_max_path;
19
+
20
+ if ( version_compare( $themeisle_sdk_version, $themeisle_sdk_max_version ) >= 0 ) {
21
+ $themeisle_sdk_max_version = $themeisle_sdk_version;
22
+ $themeisle_sdk_max_path = $themeisle_sdk_path;
23
+ }
24
+
25
+ // load the latest sdk version from the active Themeisle products
26
+ if ( ! function_exists( 'themeisle_sdk_load_latest' ) ) :
27
+ /**
28
+ * Always load the latest sdk version.
29
+ */
30
+ function themeisle_sdk_load_latest() {
31
+ global $themeisle_sdk_max_path;
32
+ require_once $themeisle_sdk_max_path . '/start.php';
33
+ }
34
+ endif;
35
+ add_action( 'init', 'themeisle_sdk_load_latest' );
vendor/codeinwp/themeisle-sdk/start.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File responsible for sdk files loading.
4
+ *
5
+ * @package ThemeIsleSDK
6
+ * @copyright Copyright (c) 2017, Marius Cristea
7
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
+ * @since 1.1.0
9
+ */
10
+ $products = apply_filters( 'themeisle_sdk_products', array() );
11
+ $path = dirname( __FILE__ );
12
+ $files_to_load = array(
13
+ 'class-themeisle-sdk-loader.php',
14
+ 'class-themeisle-sdk-product.php',
15
+ 'class-themeisle-sdk-logger.php',
16
+ 'class-themeisle-sdk-licenser.php',
17
+ 'class-themeisle-sdk-feedback-factory.php',
18
+ 'class-themeisle-sdk-feedback.php',
19
+ 'class-themeisle-sdk-feedback-deactivate.php',
20
+ 'class-themeisle-sdk-feedback-review.php',
21
+ 'class-themeisle-sdk-notification-manager.php',
22
+ 'class-themeisle-sdk-widget.php',
23
+ 'class-themeisle-sdk-widget-dashboard-blog.php',
24
+ 'class-themeisle-sdk-widgets-factory.php',
25
+ );
26
+
27
+ foreach ( $files_to_load as $file ) {
28
+ $file_path = $path . '/' . $file;
29
+ if ( is_readable( $file_path ) ) {
30
+ require_once $file_path;
31
+ }
32
+ }
33
+ foreach ( $products as $product ) {
34
+ ThemeIsle_SDK_Loader::init_product( $product );
35
+ }
vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+
57
+ private $classMapAuthoritative = false;
58
+
59
+ public function getPrefixes()
60
+ {
61
+ if (!empty($this->prefixesPsr0)) {
62
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
63
+ }
64
+
65
+ return array();
66
+ }
67
+
68
+ public function getPrefixesPsr4()
69
+ {
70
+ return $this->prefixDirsPsr4;
71
+ }
72
+
73
+ public function getFallbackDirs()
74
+ {
75
+ return $this->fallbackDirsPsr0;
76
+ }
77
+
78
+ public function getFallbackDirsPsr4()
79
+ {
80
+ return $this->fallbackDirsPsr4;
81
+ }
82
+
83
+ public function getClassMap()
84
+ {
85
+ return $this->classMap;
86
+ }
87
+
88
+ /**
89
+ * @param array $classMap Class to filename map
90
+ */
91
+ public function addClassMap(array $classMap)
92
+ {
93
+ if ($this->classMap) {
94
+ $this->classMap = array_merge($this->classMap, $classMap);
95
+ } else {
96
+ $this->classMap = $classMap;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Registers a set of PSR-0 directories for a given prefix, either
102
+ * appending or prepending to the ones previously set for this prefix.
103
+ *
104
+ * @param string $prefix The prefix
105
+ * @param array|string $paths The PSR-0 root directories
106
+ * @param bool $prepend Whether to prepend the directories
107
+ */
108
+ public function add($prefix, $paths, $prepend = false)
109
+ {
110
+ if (!$prefix) {
111
+ if ($prepend) {
112
+ $this->fallbackDirsPsr0 = array_merge(
113
+ (array) $paths,
114
+ $this->fallbackDirsPsr0
115
+ );
116
+ } else {
117
+ $this->fallbackDirsPsr0 = array_merge(
118
+ $this->fallbackDirsPsr0,
119
+ (array) $paths
120
+ );
121
+ }
122
+
123
+ return;
124
+ }
125
+
126
+ $first = $prefix[0];
127
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
+
130
+ return;
131
+ }
132
+ if ($prepend) {
133
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
134
+ (array) $paths,
135
+ $this->prefixesPsr0[$first][$prefix]
136
+ );
137
+ } else {
138
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
139
+ $this->prefixesPsr0[$first][$prefix],
140
+ (array) $paths
141
+ );
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Registers a set of PSR-4 directories for a given namespace, either
147
+ * appending or prepending to the ones previously set for this namespace.
148
+ *
149
+ * @param string $prefix The prefix/namespace, with trailing '\\'
150
+ * @param array|string $paths The PSR-4 base directories
151
+ * @param bool $prepend Whether to prepend the directories
152
+ *
153
+ * @throws \InvalidArgumentException
154
+ */
155
+ public function addPsr4($prefix, $paths, $prepend = false)
156
+ {
157
+ if (!$prefix) {
158
+ // Register directories for the root namespace.
159
+ if ($prepend) {
160
+ $this->fallbackDirsPsr4 = array_merge(
161
+ (array) $paths,
162
+ $this->fallbackDirsPsr4
163
+ );
164
+ } else {
165
+ $this->fallbackDirsPsr4 = array_merge(
166
+ $this->fallbackDirsPsr4,
167
+ (array) $paths
168
+ );
169
+ }
170
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+ // Register directories for a new namespace.
172
+ $length = strlen($prefix);
173
+ if ('\\' !== $prefix[$length - 1]) {
174
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
175
+ }
176
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
177
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
+ } elseif ($prepend) {
179
+ // Prepend directories for an already registered namespace.
180
+ $this->prefixDirsPsr4[$prefix] = array_merge(
181
+ (array) $paths,
182
+ $this->prefixDirsPsr4[$prefix]
183
+ );
184
+ } else {
185
+ // Append directories for an already registered namespace.
186
+ $this->prefixDirsPsr4[$prefix] = array_merge(
187
+ $this->prefixDirsPsr4[$prefix],
188
+ (array) $paths
189
+ );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Registers a set of PSR-0 directories for a given prefix,
195
+ * replacing any others previously set for this prefix.
196
+ *
197
+ * @param string $prefix The prefix
198
+ * @param array|string $paths The PSR-0 base directories
199
+ */
200
+ public function set($prefix, $paths)
201
+ {
202
+ if (!$prefix) {
203
+ $this->fallbackDirsPsr0 = (array) $paths;
204
+ } else {
205
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Registers a set of PSR-4 directories for a given namespace,
211
+ * replacing any others previously set for this namespace.
212
+ *
213
+ * @param string $prefix The prefix/namespace, with trailing '\\'
214
+ * @param array|string $paths The PSR-4 base directories
215
+ *
216
+ * @throws \InvalidArgumentException
217
+ */
218
+ public function setPsr4($prefix, $paths)
219
+ {
220
+ if (!$prefix) {
221
+ $this->fallbackDirsPsr4 = (array) $paths;
222
+ } else {
223
+ $length = strlen($prefix);
224
+ if ('\\' !== $prefix[$length - 1]) {
225
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226
+ }
227
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Turns on searching the include path for class files.
234
+ *
235
+ * @param bool $useIncludePath
236
+ */
237
+ public function setUseIncludePath($useIncludePath)
238
+ {
239
+ $this->useIncludePath = $useIncludePath;
240
+ }
241
+
242
+ /**
243
+ * Can be used to check if the autoloader uses the include path to check
244
+ * for classes.
245
+ *
246
+ * @return bool
247
+ */
248
+ public function getUseIncludePath()
249
+ {
250
+ return $this->useIncludePath;
251
+ }
252
+
253
+ /**
254
+ * Turns off searching the prefix and fallback directories for classes
255
+ * that have not been registered with the class map.
256
+ *
257
+ * @param bool $classMapAuthoritative
258
+ */
259
+ public function setClassMapAuthoritative($classMapAuthoritative)
260
+ {
261
+ $this->classMapAuthoritative = $classMapAuthoritative;
262
+ }
263
+
264
+ /**
265
+ * Should class lookup fail if not found in the current class map?
266
+ *
267
+ * @return bool
268
+ */
269
+ public function isClassMapAuthoritative()
270
+ {
271
+ return $this->classMapAuthoritative;
272
+ }
273
+
274
+ /**
275
+ * Registers this instance as an autoloader.
276
+ *
277
+ * @param bool $prepend Whether to prepend the autoloader or not
278
+ */
279
+ public function register($prepend = false)
280
+ {
281
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
282
+ }
283
+
284
+ /**
285
+ * Unregisters this instance as an autoloader.
286
+ */
287
+ public function unregister()
288
+ {
289
+ spl_autoload_unregister(array($this, 'loadClass'));
290
+ }
291
+
292
+ /**
293
+ * Loads the given class or interface.
294
+ *
295
+ * @param string $class The name of the class
296
+ * @return bool|null True if loaded, null otherwise
297
+ */
298
+ public function loadClass($class)
299
+ {
300
+ if ($file = $this->findFile($class)) {
301
+ includeFile($file);
302
+
303
+ return true;
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Finds the path to the file where the class is defined.
309
+ *
310
+ * @param string $class The name of the class
311
+ *
312
+ * @return string|false The path if found, false otherwise
313
+ */
314
+ public function findFile($class)
315
+ {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
+ // class map lookup
322
+ if (isset($this->classMap[$class])) {
323
+ return $this->classMap[$class];
324
+ }
325
+ if ($this->classMapAuthoritative) {
326
+ return false;
327
+ }
328
+
329
+ $file = $this->findFileWithExtension($class, '.php');
330
+
331
+ // Search for Hack files if we are running on HHVM
332
+ if ($file === null && defined('HHVM_VERSION')) {
333
+ $file = $this->findFileWithExtension($class, '.hh');
334
+ }
335
+
336
+ if ($file === null) {
337
+ // Remember that this class does not exist.
338
+ return $this->classMap[$class] = false;
339
+ }
340
+
341
+ return $file;
342
+ }
343
+
344
+ private function findFileWithExtension($class, $ext)
345
+ {
346
+ // PSR-4 lookup
347
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
348
+
349
+ $first = $class[0];
350
+ if (isset($this->prefixLengthsPsr4[$first])) {
351
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
+ if (0 === strpos($class, $prefix)) {
353
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
355
+ return $file;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ // PSR-4 fallback dirs
363
+ foreach ($this->fallbackDirsPsr4 as $dir) {
364
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
365
+ return $file;
366
+ }
367
+ }
368
+
369
+ // PSR-0 lookup
370
+ if (false !== $pos = strrpos($class, '\\')) {
371
+ // namespaced class name
372
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
373
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
374
+ } else {
375
+ // PEAR-like class name
376
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
377
+ }
378
+
379
+ if (isset($this->prefixesPsr0[$first])) {
380
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
381
+ if (0 === strpos($class, $prefix)) {
382
+ foreach ($dirs as $dir) {
383
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
384
+ return $file;
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ // PSR-0 fallback dirs
392
+ foreach ($this->fallbackDirsPsr0 as $dir) {
393
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
394
+ return $file;
395
+ }
396
+ }
397
+
398
+ // PSR-0 include paths.
399
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
+ return $file;
401
+ }
402
+ }
403
+ }
404
+
405
+ /**
406
+ * Scope isolated include.
407
+ *
408
+ * Prevents access to $this/self from included files.
409
+ */
410
+ function includeFile($file)
411
+ {
412
+ include $file;
413
+ }
vendor/composer/ClassLoader52.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
4
+ *
5
+ * This file is released under the terms of the MIT license. You can find the
6
+ * complete text in the attached LICENSE file or online at:
7
+ *
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ * --------------------------------------------------------------------------
11
+ *
12
+ * 99% of this is copied as-is from the original Composer source code and is
13
+ * released under MIT license as well. Copyright goes to:
14
+ *
15
+ * - Fabien Potencier <fabien@symfony.com>
16
+ * - Jordi Boggiano <j.boggiano@seld.be>
17
+ */
18
+
19
+ class xrstf_Composer52_ClassLoader {
20
+ private $prefixes = array();
21
+ private $fallbackDirs = array();
22
+ private $useIncludePath = false;
23
+ private $classMap = array();
24
+ private $classMapAuthoratative = false;
25
+ private $allowUnderscore = false;
26
+
27
+ /**
28
+ * @param boolean $flag true to allow class names with a leading underscore, false to disable
29
+ */
30
+ public function setAllowUnderscore($flag) {
31
+ $this->allowUnderscore = (boolean) $flag;
32
+ }
33
+
34
+ /**
35
+ * @return array
36
+ */
37
+ public function getPrefixes() {
38
+ return $this->prefixes;
39
+ }
40
+
41
+ /**
42
+ * Turns off searching the prefix and fallback directories for classes
43
+ * that have not been registered with the class map.
44
+ *
45
+ * @param bool $classMapAuthoratative
46
+ */
47
+ public function setClassMapAuthoritative($classMapAuthoratative) {
48
+ $this->classMapAuthoratative = $classMapAuthoratative;
49
+ }
50
+
51
+ /**
52
+ * Should class lookup fail if not found in the current class map?
53
+ *
54
+ * @return bool
55
+ */
56
+ public function getClassMapAuthoratative() {
57
+ return $this->classMapAuthoratative;
58
+ }
59
+
60
+ /**
61
+ * @return array
62
+ */
63
+ public function getFallbackDirs() {
64
+ return $this->fallbackDirs;
65
+ }
66
+
67
+ /**
68
+ * @return array
69
+ */
70
+ public function getClassMap() {
71
+ return $this->classMap;
72
+ }
73
+
74
+ /**
75
+ * @param array $classMap class to filename map
76
+ */
77
+ public function addClassMap(array $classMap) {
78
+ if ($this->classMap) {
79
+ $this->classMap = array_merge($this->classMap, $classMap);
80
+ }
81
+ else {
82
+ $this->classMap = $classMap;
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Registers a set of classes, merging with any others previously set.
88
+ *
89
+ * @param string $prefix the classes prefix
90
+ * @param array|string $paths the location(s) of the classes
91
+ * @param bool $prepend prepend the location(s)
92
+ */
93
+ public function add($prefix, $paths, $prepend = false) {
94
+ if (!$prefix) {
95
+ if ($prepend) {
96
+ $this->fallbackDirs = array_merge(
97
+ (array) $paths,
98
+ $this->fallbackDirs
99
+ );
100
+ }
101
+ else {
102
+ $this->fallbackDirs = array_merge(
103
+ $this->fallbackDirs,
104
+ (array) $paths
105
+ );
106
+ }
107
+
108
+ return;
109
+ }
110
+
111
+ if (!isset($this->prefixes[$prefix])) {
112
+ $this->prefixes[$prefix] = (array) $paths;
113
+ return;
114
+ }
115
+
116
+ if ($prepend) {
117
+ $this->prefixes[$prefix] = array_merge(
118
+ (array) $paths,
119
+ $this->prefixes[$prefix]
120
+ );
121
+ }
122
+ else {
123
+ $this->prefixes[$prefix] = array_merge(
124
+ $this->prefixes[$prefix],
125
+ (array) $paths
126
+ );
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Registers a set of classes, replacing any others previously set.
132
+ *
133
+ * @param string $prefix the classes prefix
134
+ * @param array|string $paths the location(s) of the classes
135
+ */
136
+ public function set($prefix, $paths) {
137
+ if (!$prefix) {
138
+ $this->fallbackDirs = (array) $paths;
139
+ return;
140
+ }
141
+
142
+ $this->prefixes[$prefix] = (array) $paths;
143
+ }
144
+
145
+ /**
146
+ * Turns on searching the include path for class files.
147
+ *
148
+ * @param bool $useIncludePath
149
+ */
150
+ public function setUseIncludePath($useIncludePath) {
151
+ $this->useIncludePath = $useIncludePath;
152
+ }
153
+
154
+ /**
155
+ * Can be used to check if the autoloader uses the include path to check
156
+ * for classes.
157
+ *
158
+ * @return bool
159
+ */
160
+ public function getUseIncludePath() {
161
+ return $this->useIncludePath;
162
+ }
163
+
164
+ /**
165
+ * Registers this instance as an autoloader.
166
+ */
167
+ public function register() {
168
+ spl_autoload_register(array($this, 'loadClass'), true);
169
+ }
170
+
171
+ /**
172
+ * Unregisters this instance as an autoloader.
173
+ */
174
+ public function unregister() {
175
+ spl_autoload_unregister(array($this, 'loadClass'));
176
+ }
177
+
178
+ /**
179
+ * Loads the given class or interface.
180
+ *
181
+ * @param string $class the name of the class
182
+ * @return bool|null true, if loaded
183
+ */
184
+ public function loadClass($class) {
185
+ if ($file = $this->findFile($class)) {
186
+ include $file;
187
+ return true;
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Finds the path to the file where the class is defined.
193
+ *
194
+ * @param string $class the name of the class
195
+ * @return string|null the path, if found
196
+ */
197
+ public function findFile($class) {
198
+ if ('\\' === $class[0]) {
199
+ $class = substr($class, 1);
200
+ }
201
+
202
+ if (isset($this->classMap[$class])) {
203
+ return $this->classMap[$class];
204
+ }
205
+ elseif ($this->classMapAuthoratative) {
206
+ return false;
207
+ }
208
+
209
+ $classPath = $this->getClassPath($class);
210
+
211
+ foreach ($this->prefixes as $prefix => $dirs) {
212
+ if (0 === strpos($class, $prefix)) {
213
+ foreach ($dirs as $dir) {
214
+ if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
215
+ return $dir.DIRECTORY_SEPARATOR.$classPath;
216
+ }
217
+ }
218
+ }
219
+ }
220
+
221
+ foreach ($this->fallbackDirs as $dir) {
222
+ if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
223
+ return $dir.DIRECTORY_SEPARATOR.$classPath;
224
+ }
225
+ }
226
+
227
+ if ($this->useIncludePath && $file = self::resolveIncludePath($classPath)) {
228
+ return $file;
229
+ }
230
+
231
+ return $this->classMap[$class] = false;
232
+ }
233
+
234
+ private function getClassPath($class) {
235
+ if (false !== $pos = strrpos($class, '\\')) {
236
+ // namespaced class name
237
+ $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)).DIRECTORY_SEPARATOR;
238
+ $className = substr($class, $pos + 1);
239
+ }
240
+ else {
241
+ // PEAR-like class name
242
+ $classPath = null;
243
+ $className = $class;
244
+ }
245
+
246
+ $className = str_replace('_', DIRECTORY_SEPARATOR, $className);
247
+
248
+ // restore the prefix
249
+ if ($this->allowUnderscore && DIRECTORY_SEPARATOR === $className[0]) {
250
+ $className[0] = '_';
251
+ }
252
+
253
+ $classPath .= $className.'.php';
254
+
255
+ return $classPath;
256
+ }
257
+
258
+ public static function resolveIncludePath($classPath) {
259
+ $paths = explode(PATH_SEPARATOR, get_include_path());
260
+
261
+ foreach ($paths as $path) {
262
+ $path = rtrim($path, '/\\');
263
+
264
+ if ($file = file_exists($path.DIRECTORY_SEPARATOR.$file)) {
265
+ return $file;
266
+ }
267
+ }
268
+
269
+ return false;
270
+ }
271
+ }
vendor/composer/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Copyright (c) 2016 Nils Adermann, Jordi Boggiano
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_files.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_files.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ '957c51f8f334b5ea3be310bfb8b3492c' => $vendorDir . '/codeinwp/themeisle-sdk/load.php',
10
+ );
vendor/composer/autoload_namespaces.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'xrstf\\Composer52' => array($vendorDir . '/xrstf/composer-php52/lib'),
10
+ );
vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit6c900de3a683aa1c4c3fdcdf03f448fb', 'loadClassLoader'));
25
+
26
+ $map = require __DIR__ . '/autoload_namespaces.php';
27
+ foreach ($map as $namespace => $path) {
28
+ $loader->set($namespace, $path);
29
+ }
30
+
31
+ $map = require __DIR__ . '/autoload_psr4.php';
32
+ foreach ($map as $namespace => $path) {
33
+ $loader->setPsr4($namespace, $path);
34
+ }
35
+
36
+ $classMap = require __DIR__ . '/autoload_classmap.php';
37
+ if ($classMap) {
38
+ $loader->addClassMap($classMap);
39
+ }
40
+
41
+ $loader->register(true);
42
+
43
+ $includeFiles = require __DIR__ . '/autoload_files.php';
44
+ foreach ($includeFiles as $fileIdentifier => $file) {
45
+ composerRequire6c900de3a683aa1c4c3fdcdf03f448fb($fileIdentifier, $file);
46
+ }
47
+
48
+ return $loader;
49
+ }
50
+ }
51
+
52
+ function composerRequire6c900de3a683aa1c4c3fdcdf03f448fb($fileIdentifier, $file)
53
+ {
54
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
+ require $file;
56
+
57
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
58
+ }
59
+ }
vendor/composer/autoload_real_52.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real_52.php generated by xrstf/composer-php52
4
+
5
+ class ComposerAutoloaderInit2a536e1db4e183eb34c6df9616eae0e9 {
6
+ private static $loader;
7
+
8
+ public static function loadClassLoader($class) {
9
+ if ('xrstf_Composer52_ClassLoader' === $class) {
10
+ require dirname(__FILE__).'/ClassLoader52.php';
11
+ }
12
+ }
13
+
14
+ /**
15
+ * @return xrstf_Composer52_ClassLoader
16
+ */
17
+ public static function getLoader() {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit2a536e1db4e183eb34c6df9616eae0e9', 'loadClassLoader'), true /*, true */);
23
+ self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit2a536e1db4e183eb34c6df9616eae0e9', 'loadClassLoader'));
25
+
26
+ $vendorDir = dirname(dirname(__FILE__));
27
+ $baseDir = dirname($vendorDir);
28
+ $dir = dirname(__FILE__);
29
+
30
+ $map = require $dir.'/autoload_namespaces.php';
31
+ foreach ($map as $namespace => $path) {
32
+ $loader->add($namespace, $path);
33
+ }
34
+
35
+ $classMap = require $dir.'/autoload_classmap.php';
36
+ if ($classMap) {
37
+ $loader->addClassMap($classMap);
38
+ }
39
+
40
+ $loader->register(true);
41
+
42
+ require $vendorDir . '/codeinwp/themeisle-sdk/load.php';
43
+
44
+ return $loader;
45
+ }
46
+ }
vendor/composer/installed.json ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "xrstf/composer-php52",
4
+ "version": "v1.0.20",
5
+ "version_normalized": "1.0.20.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/composer-php52/composer-php52.git",
9
+ "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/composer-php52/composer-php52/zipball/bd41459d5e27df8d33057842b32377c39e97a5a8",
14
+ "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8",
15
+ "shasum": ""
16
+ },
17
+ "time": "2016-04-16 21:52:24",
18
+ "type": "library",
19
+ "extra": {
20
+ "branch-alias": {
21
+ "dev-default": "1.x-dev"
22
+ }
23
+ },
24
+ "installation-source": "dist",
25
+ "autoload": {
26
+ "psr-0": {
27
+ "xrstf\\Composer52": "lib/"
28
+ }
29
+ },
30
+ "notification-url": "https://packagist.org/downloads/",
31
+ "license": [
32
+ "MIT"
33
+ ]
34
+ },
35
+ {
36
+ "name": "codeinwp/themeisle-sdk",
37
+ "version": "dev-master",
38
+ "version_normalized": "9999999-dev",
39
+ "source": {
40
+ "type": "git",
41
+ "url": "https://github.com/Codeinwp/themeisle-sdk.git",
42
+ "reference": "ebbbe0398ef8ee9922d17704e1dd2e9114e53ccb"
43
+ },
44
+ "dist": {
45
+ "type": "zip",
46
+ "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/ebbbe0398ef8ee9922d17704e1dd2e9114e53ccb",
47
+ "reference": "ebbbe0398ef8ee9922d17704e1dd2e9114e53ccb",
48
+ "shasum": ""
49
+ },
50
+ "time": "2017-07-04 13:54:14",
51
+ "type": "library",
52
+ "installation-source": "dist",
53
+ "autoload": {
54
+ "files": [
55
+ "load.php"
56
+ ]
57
+ },
58
+ "license": [
59
+ "GPL-2.0+"
60
+ ],
61
+ "authors": [
62
+ {
63
+ "name": "ThemeIsle team",
64
+ "email": "friends@themeisle.com",
65
+ "homepage": "https://themeisle.com"
66
+ }
67
+ ],
68
+ "description": "ThemeIsle SDK ",
69
+ "homepage": "https://github.com/Codeinwp/themeisle-sdk",
70
+ "keywords": [
71
+ "wordpress"
72
+ ],
73
+ "support": {
74
+ "issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
75
+ "source": "https://github.com/Codeinwp/themeisle-sdk/tree/master"
76
+ }
77
+ }
78
+ ]
vendor/xrstf/composer-php52/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2013 Christoph Mewes
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
vendor/xrstf/composer-php52/README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PHP 5.2 Autoloading for Composer
2
+ ================================
3
+
4
+ This package provides an easy way to get a PHP 5.2 compatible autoloader out of Composer. The generated autoloader is fully compatible to the original and is written into separate files, each ending with `_52.php`.
5
+
6
+ Legacy
7
+ ------
8
+
9
+ Please do not use this, if you can avoid it. It's a horrible hack, often breaks and is extremely tied to Composer's interna. This package was originally developed in 2012, when PHP 5.2 was much more common on cheap webhosts.
10
+
11
+ In 2016, this package has been moved from Bitbucket to a Github organization, because the original developer could no longer reliably maintain it. This is the reason for this legacy package name ``xrstf/...``.
12
+
13
+ Usage
14
+ -----
15
+
16
+ In your project's `composer.json`, add the following lines:
17
+
18
+ ```json
19
+ {
20
+ "require": {
21
+ "xrstf/composer-php52": "1.*"
22
+ },
23
+ "scripts": {
24
+ "post-install-cmd": [
25
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
26
+ ],
27
+ "post-update-cmd": [
28
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
29
+ ],
30
+ "post-autoload-dump": [
31
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
32
+ ]
33
+ }
34
+ }
35
+ ```
36
+
37
+ After the next update/install, you will have a `vendor/autoload_52.php` file, that you can simply include and use in PHP 5.2 projects.
vendor/xrstf/composer-php52/composer.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "xrstf/composer-php52",
3
+ "license": "MIT",
4
+ "support": {
5
+ "source": "https://github.com/composer-php52/composer-php52",
6
+ "issues": "https://github.com/composer-php52/composer-php52/issues"
7
+ },
8
+ "autoload": {
9
+ "psr-0": {
10
+ "xrstf\\Composer52": "lib/"
11
+ }
12
+ },
13
+ "scripts": {
14
+ "post-install-cmd": [
15
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
16
+ ],
17
+ "post-update-cmd": [
18
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
19
+ ]
20
+ },
21
+ "extra": {
22
+ "branch-alias": {
23
+ "dev-default": "1.x-dev"
24
+ }
25
+ }
26
+ }
vendor/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
4
+ *
5
+ * This file is released under the terms of the MIT license. You can find the
6
+ * complete text in the attached LICENSE file or online at:
7
+ *
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ * --------------------------------------------------------------------------
11
+ *
12
+ * 99% of this is copied as-is from the original Composer source code and is
13
+ * released under MIT license as well. Copyright goes to:
14
+ *
15
+ * - Igor Wiedler <igor@wiedler.ch>
16
+ * - Jordi Boggiano <j.boggiano@seld.be>
17
+ */
18
+
19
+ namespace xrstf\Composer52;
20
+
21
+ use Composer\Autoload\AutoloadGenerator as BaseGenerator;
22
+ use Composer\Autoload\ClassMapGenerator;
23
+ use Composer\Config;
24
+ use Composer\Installer\InstallationManager;
25
+ use Composer\Package\AliasPackage;
26
+ use Composer\Package\PackageInterface;
27
+ use Composer\Repository\InstalledRepositoryInterface;
28
+ use Composer\Util\Filesystem;
29
+
30
+ class AutoloadGenerator extends BaseGenerator {
31
+
32
+ /**
33
+ * @var bool
34
+ */
35
+ private $classMapAuthoritative = false;
36
+
37
+ public function __construct() {
38
+ // do nothing (but keep this constructor so we can build an instance without the need for an event dispatcher)
39
+ }
40
+
41
+ /**
42
+ * Whether or not generated autoloader considers the class map
43
+ * authoritative.
44
+ *
45
+ * @param bool $classMapAuthoritative
46
+ */
47
+ public function setClassMapAuthoritative($classMapAuthoritative)
48
+ {
49
+ $this->classMapAuthoritative = (boolean) $classMapAuthoritative;
50
+ }
51
+
52
+ public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '') {
53
+ if ($this->classMapAuthoritative) {
54
+ // Force scanPsr0Packages when classmap is authoritative
55
+ $scanPsr0Packages = true;
56
+ }
57
+
58
+ $filesystem = new Filesystem();
59
+ $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
60
+
61
+ $cwd = getcwd();
62
+ $basePath = $filesystem->normalizePath($cwd);
63
+ $vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir')));
64
+ $targetDir = $vendorPath.'/'.$targetDir;
65
+ $filesystem->ensureDirectoryExists($targetDir);
66
+
67
+ $useGlobalIncludePath = (bool) $config->get('use-include-path');
68
+ $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
69
+ $classMapAuthoritative = $config->get('classmap-authoritative');
70
+
71
+ $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
72
+ $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
73
+
74
+ $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
75
+ $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
76
+
77
+ // add 5.2 compat
78
+ $vendorPathCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
79
+ $vendorPathToTargetDirCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathToTargetDirCode);
80
+
81
+ $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
82
+ $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
83
+
84
+ // add custom psr-0 autoloading if the root package has a target dir
85
+ $targetDirLoader = null;
86
+ $mainAutoload = $mainPackage->getAutoload();
87
+ if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
88
+ $levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
89
+ $prefixes = implode(', ', array_map(function ($prefix) {
90
+ return var_export($prefix, true);
91
+ }, array_keys($mainAutoload['psr-0'])));
92
+
93
+ $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
94
+
95
+ $targetDirLoader = <<<EOF
96
+
97
+ public static function autoload(\$class) {
98
+ \$dir = $baseDirFromTargetDirCode.'/';
99
+ \$prefixes = array($prefixes);
100
+
101
+ foreach (\$prefixes as \$prefix) {
102
+ if (0 !== strpos(\$class, \$prefix)) {
103
+ continue;
104
+ }
105
+
106
+ \$path = explode(DIRECTORY_SEPARATOR, self::getClassPath(\$class));
107
+ \$path = \$dir.implode('/', array_slice(\$path, $levels));
108
+
109
+ if (!\$path = self::resolveIncludePath(\$path)) {
110
+ return false;
111
+ }
112
+
113
+ require \$path;
114
+ return true;
115
+ }
116
+ }
117
+
118
+ EOF;
119
+ }
120
+
121
+ $filesCode = "";
122
+ $autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files']));
123
+ foreach ($autoloads['files'] as $functionFile) {
124
+ // don't include file if it is using PHP 5.3+ syntax
125
+ // https://bitbucket.org/xrstf/composer-php52/issue/4
126
+ if ($this->isPHP53($functionFile)) {
127
+ $filesCode .= '// require '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile)."; // disabled because of PHP 5.3 syntax\n";
128
+ }
129
+ else {
130
+ $filesCode .= ' require '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile).";\n";
131
+ }
132
+ }
133
+
134
+ if (!$suffix) {
135
+ $suffix = md5(uniqid('', true));
136
+ }
137
+
138
+ $includePathFile = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode);
139
+
140
+ file_put_contents($vendorPath.'/autoload_52.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
141
+ file_put_contents($targetDir.'/autoload_real_52.php', $this->getAutoloadRealFile(true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader));
142
+
143
+ // use stream_copy_to_stream instead of copy
144
+ // to work around https://bugs.php.net/bug.php?id=64634
145
+ $sourceLoader = fopen(__DIR__.'/ClassLoader.php', 'r');
146
+ $targetLoader = fopen($targetDir.'/ClassLoader52.php', 'w+');
147
+ stream_copy_to_stream($sourceLoader, $targetLoader);
148
+ fclose($sourceLoader);
149
+ fclose($targetLoader);
150
+ unset($sourceLoader, $targetLoader);
151
+ }
152
+
153
+ protected function isPHP53($file) {
154
+ $tokens = token_get_all(file_get_contents($file));
155
+ $php53 = array(T_DIR, T_GOTO, T_NAMESPACE, T_NS_C, T_NS_SEPARATOR, T_USE);
156
+
157
+ // PHP 5.4+
158
+ if (defined('T_TRAIT')) {
159
+ $php53[] = T_TRAIT;
160
+ $php53[] = T_TRAIT_C;
161
+ $php53[] = T_TRAIT_C;
162
+ }
163
+
164
+ // PHP 5.5+
165
+ if (defined('T_FINALLY')) {
166
+ $php53[] = T_FINALLY;
167
+ $php53[] = T_YIELD;
168
+ }
169
+
170
+ foreach ($tokens as $token) {
171
+ if (is_array($token) && in_array($token[0], $php53)) {
172
+ return true;
173
+ }
174
+ }
175
+
176
+ return false;
177
+ }
178
+
179
+ protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode) {
180
+ $includePaths = array();
181
+
182
+ foreach ($packageMap as $item) {
183
+ list($package, $installPath) = $item;
184
+
185
+ if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
186
+ $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
187
+ }
188
+
189
+ foreach ($package->getIncludePaths() as $includePath) {
190
+ $includePath = trim($includePath, '/');
191
+ $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
192
+ }
193
+ }
194
+
195
+ if (!$includePaths) {
196
+ return;
197
+ }
198
+
199
+ $includePathsFile = <<<EOF
200
+ <?php
201
+
202
+ // include_paths_52.php generated by xrstf/composer-php52
203
+
204
+ \$vendorDir = $vendorPathCode;
205
+ \$baseDir = $appBaseDirCode;
206
+
207
+ return array(
208
+
209
+ EOF;
210
+
211
+ foreach ($includePaths as $path) {
212
+ $includePathsFile .= "\t" . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
213
+ }
214
+
215
+ return $includePathsFile . ");\n";
216
+ }
217
+
218
+ protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix) {
219
+ return <<<AUTOLOAD
220
+ <?php
221
+
222
+ // autoload_52.php generated by xrstf/composer-php52
223
+
224
+ require_once $vendorPathToTargetDirCode.'/autoload_real_52.php';
225
+
226
+ return ComposerAutoloaderInit$suffix::getLoader();
227
+
228
+ AUTOLOAD;
229
+ }
230
+
231
+ protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000) {
232
+ // TODO the class ComposerAutoloaderInit should be revert to a closure
233
+ // when APC has been fixed:
234
+ // - https://github.com/composer/composer/issues/959
235
+ // - https://bugs.php.net/bug.php?id=52144
236
+ // - https://bugs.php.net/bug.php?id=61576
237
+ // - https://bugs.php.net/bug.php?id=59298
238
+
239
+ if ($filesCode) {
240
+ $filesCode = "\n\n".rtrim($filesCode);
241
+ }
242
+
243
+ $file = <<<HEADER
244
+ <?php
245
+
246
+ // autoload_real_52.php generated by xrstf/composer-php52
247
+
248
+ class ComposerAutoloaderInit$suffix {
249
+ private static \$loader;
250
+
251
+ public static function loadClassLoader(\$class) {
252
+ if ('xrstf_Composer52_ClassLoader' === \$class) {
253
+ require dirname(__FILE__).'/ClassLoader52.php';
254
+ }
255
+ }
256
+
257
+ /**
258
+ * @return xrstf_Composer52_ClassLoader
259
+ */
260
+ public static function getLoader() {
261
+ if (null !== self::\$loader) {
262
+ return self::\$loader;
263
+ }
264
+
265
+ spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true /*, true */);
266
+ self::\$loader = \$loader = new xrstf_Composer52_ClassLoader();
267
+ spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
268
+
269
+ \$vendorDir = $vendorPathCode;
270
+ \$baseDir = $appBaseDirCode;
271
+ \$dir = dirname(__FILE__);
272
+
273
+
274
+ HEADER;
275
+
276
+ if ($useIncludePath) {
277
+ $file .= <<<'INCLUDE_PATH'
278
+ $includePaths = require $dir.'/include_paths.php';
279
+ array_push($includePaths, get_include_path());
280
+ set_include_path(implode(PATH_SEPARATOR, $includePaths));
281
+
282
+
283
+ INCLUDE_PATH;
284
+ }
285
+
286
+ $file .= <<<'PSR0'
287
+ $map = require $dir.'/autoload_namespaces.php';
288
+ foreach ($map as $namespace => $path) {
289
+ $loader->add($namespace, $path);
290
+ }
291
+
292
+
293
+ PSR0;
294
+
295
+ if ($useClassMap) {
296
+ $file .= <<<'CLASSMAP'
297
+ $classMap = require $dir.'/autoload_classmap.php';
298
+ if ($classMap) {
299
+ $loader->addClassMap($classMap);
300
+ }
301
+
302
+
303
+ CLASSMAP;
304
+ }
305
+
306
+ if ($this->classMapAuthoritative) {
307
+ $file .= <<<'CLASSMAPAUTHORITATIVE'
308
+ $loader->setClassMapAuthoritative(true);
309
+
310
+ CLASSMAPAUTHORITATIVE;
311
+ }
312
+
313
+ if ($useGlobalIncludePath) {
314
+ $file .= <<<'INCLUDEPATH'
315
+ $loader->setUseIncludePath(true);
316
+
317
+
318
+ INCLUDEPATH;
319
+ }
320
+
321
+ if ($targetDirLoader) {
322
+ $file .= <<<REGISTER_AUTOLOAD
323
+ spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true);
324
+
325
+
326
+ REGISTER_AUTOLOAD;
327
+
328
+ }
329
+
330
+ $file .= <<<METHOD_FOOTER
331
+ \$loader->register($prependAutoloader);{$filesCode}
332
+
333
+ return \$loader;
334
+ }
335
+
336
+ METHOD_FOOTER;
337
+
338
+ $file .= $targetDirLoader;
339
+
340
+ return $file . <<<FOOTER
341
+ }
342
+
343
+ FOOTER;
344
+
345
+ }
346
+ }
vendor/xrstf/composer-php52/lib/xrstf/Composer52/ClassLoader.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
4
+ *
5
+ * This file is released under the terms of the MIT license. You can find the
6
+ * complete text in the attached LICENSE file or online at:
7
+ *
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ *
10
+ * --------------------------------------------------------------------------
11
+ *
12
+ * 99% of this is copied as-is from the original Composer source code and is
13
+ * released under MIT license as well. Copyright goes to:
14
+ *
15
+ * - Fabien Potencier <fabien@symfony.com>
16
+ * - Jordi Boggiano <j.boggiano@seld.be>
17
+ */
18
+
19
+ class xrstf_Composer52_ClassLoader {
20
+ private $prefixes = array();
21
+ private $fallbackDirs = array();
22
+ private $useIncludePath = false;
23
+ private $classMap = array();
24
+ private $classMapAuthoratative = false;
25
+ private $allowUnderscore = false;
26
+
27
+ /**
28
+ * @param boolean $flag true to allow class names with a leading underscore, false to disable
29
+ */
30
+ public function setAllowUnderscore($flag) {
31
+ $this->allowUnderscore = (boolean) $flag;
32
+ }
33
+
34
+ /**
35
+ * @return array
36
+ */
37
+ public function getPrefixes() {
38
+ return $this->prefixes;
39
+ }
40
+
41
+ /**
42
+ * Turns off searching the prefix and fallback directories for classes
43
+ * that have not been registered with the class map.
44
+ *
45
+ * @param bool $classMapAuthoratative
46
+ */
47
+ public function setClassMapAuthoritative($classMapAuthoratative) {
48
+ $this->classMapAuthoratative = $classMapAuthoratative;
49
+ }
50
+
51
+ /**
52
+ * Should class lookup fail if not found in the current class map?
53
+ *
54
+ * @return bool
55
+ */
56
+ public function getClassMapAuthoratative() {
57
+ return $this->classMapAuthoratative;
58
+ }
59
+
60
+ /**
61
+ * @return array
62
+ */
63
+ public function getFallbackDirs() {
64
+ return $this->fallbackDirs;
65
+ }
66
+
67
+ /**
68
+ * @return array
69
+ */
70
+ public function getClassMap() {
71
+ return $this->classMap;
72
+ }
73
+
74
+ /**
75
+ * @param array $classMap class to filename map
76
+ */
77
+ public function addClassMap(array $classMap) {
78
+ if ($this->classMap) {
79
+ $this->classMap = array_merge($this->classMap, $classMap);
80
+ }
81
+ else {
82
+ $this->classMap = $classMap;
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Registers a set of classes, merging with any others previously set.
88
+ *
89
+ * @param string $prefix the classes prefix
90
+ * @param array|string $paths the location(s) of the classes
91
+ * @param bool $prepend prepend the location(s)
92
+ */
93
+ public function add($prefix, $paths, $prepend = false) {
94
+ if (!$prefix) {
95
+ if ($prepend) {
96
+ $this->fallbackDirs = array_merge(
97
+ (array) $paths,
98
+ $this->fallbackDirs
99
+ );
100
+ }
101
+ else {
102
+ $this->fallbackDirs = array_merge(
103
+ $this->fallbackDirs,
104
+ (array) $paths
105
+ );
106
+ }
107
+
108
+ return;
109
+ }
110
+
111
+ if (!isset($this->prefixes[$prefix])) {
112
+ $this->prefixes[$prefix] = (array) $paths;
113
+ return;
114
+ }
115
+
116
+ if ($prepend) {
117
+ $this->prefixes[$prefix] = array_merge(
118
+ (array) $paths,
119
+ $this->prefixes[$prefix]
120
+ );
121
+ }
122
+ else {
123
+ $this->prefixes[$prefix] = array_merge(
124
+ $this->prefixes[$prefix],
125
+ (array) $paths
126
+ );
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Registers a set of classes, replacing any others previously set.
132
+ *
133
+ * @param string $prefix the classes prefix
134
+ * @param array|string $paths the location(s) of the classes
135
+ */
136
+ public function set($prefix, $paths) {
137
+ if (!$prefix) {
138
+ $this->fallbackDirs = (array) $paths;
139
+ return;
140
+ }
141
+
142
+ $this->prefixes[$prefix] = (array) $paths;
143
+ }
144
+
145
+ /**
146
+ * Turns on searching the include path for class files.
147
+ *
148
+ * @param bool $useIncludePath
149
+ */
150
+ public function setUseIncludePath($useIncludePath) {
151
+ $this->useIncludePath = $useIncludePath;
152
+ }
153
+
154
+ /**
155
+ * Can be used to check if the autoloader uses the include path to check
156
+ * for classes.
157
+ *
158
+ * @return bool
159
+ */
160
+ public function getUseIncludePath() {
161
+ return $this->useIncludePath;
162
+ }
163
+
164
+ /**
165
+ * Registers this instance as an autoloader.
166
+ */
167
+ public function register() {
168
+ spl_autoload_register(array($this, 'loadClass'), true);
169
+ }
170
+
171
+ /**
172
+ * Unregisters this instance as an autoloader.
173
+ */
174
+ public function unregister() {
175
+ spl_autoload_unregister(array($this, 'loadClass'));
176
+ }
177
+
178
+ /**
179
+ * Loads the given class or interface.
180
+ *
181
+ * @param string $class the name of the class
182
+ * @return bool|null true, if loaded
183
+ */
184
+ public function loadClass($class) {
185
+ if ($file = $this->findFile($class)) {
186
+ include $file;
187
+ return true;
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Finds the path to the file where the class is defined.
193
+ *
194
+ * @param string $class the name of the class
195
+ * @return string|null the path, if found
196
+ */
197
+ public function findFile($class) {
198
+ if ('\\' === $class[0]) {
199
+ $class = substr($class, 1);
200
+ }
201
+
202
+ if (isset($this->classMap[$class])) {
203
+ return $this->classMap[$class];
204
+ }
205
+ elseif ($this->classMapAuthoratative) {
206
+ return false;
207
+ }
208
+
209
+ $classPath = $this->getClassPath($class);
210
+
211
+ foreach ($this->prefixes as $prefix => $dirs) {
212
+ if (0 === strpos($class, $prefix)) {
213
+ foreach ($dirs as $dir) {
214
+ if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
215
+ return $dir.DIRECTORY_SEPARATOR.$classPath;
216
+ }
217
+ }
218
+ }
219
+ }
220
+
221
+ foreach ($this->fallbackDirs as $dir) {
222
+ if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
223
+ return $dir.DIRECTORY_SEPARATOR.$classPath;
224
+ }
225
+ }
226
+
227
+ if ($this->useIncludePath && $file = self::resolveIncludePath($classPath)) {
228
+ return $file;
229
+ }
230
+
231
+ return $this->classMap[$class] = false;
232
+ }
233
+
234
+ private function getClassPath($class) {
235
+ if (false !== $pos = strrpos($class, '\\')) {
236
+ // namespaced class name
237
+ $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)).DIRECTORY_SEPARATOR;
238
+ $className = substr($class, $pos + 1);
239
+ }
240
+ else {
241
+ // PEAR-like class name
242
+ $classPath = null;
243
+ $className = $class;
244
+ }
245
+
246
+ $className = str_replace('_', DIRECTORY_SEPARATOR, $className);
247
+
248
+ // restore the prefix
249
+ if ($this->allowUnderscore && DIRECTORY_SEPARATOR === $className[0]) {
250
+ $className[0] = '_';
251
+ }
252
+
253
+ $classPath .= $className.'.php';
254
+
255
+ return $classPath;
256
+ }
257
+
258
+ public static function resolveIncludePath($classPath) {
259
+ $paths = explode(PATH_SEPARATOR, get_include_path());
260
+
261
+ foreach ($paths as $path) {
262
+ $path = rtrim($path, '/\\');
263
+
264
+ if ($file = file_exists($path.DIRECTORY_SEPARATOR.$file)) {
265
+ return $file;
266
+ }
267
+ }
268
+
269
+ return false;
270
+ }
271
+ }
vendor/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
4
+ *
5
+ * This file is released under the terms of the MIT license. You can find the
6
+ * complete text in the attached LICENSE file or online at:
7
+ *
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ */
10
+
11
+ namespace xrstf\Composer52;
12
+
13
+ use Composer\Repository\CompositeRepository;
14
+ use Composer\Script\Event;
15
+
16
+ class Generator {
17
+ public static function onPostInstallCmd(Event $event) {
18
+ $composer = $event->getComposer();
19
+ $installationManager = $composer->getInstallationManager();
20
+ $repoManager = $composer->getRepositoryManager();
21
+ $localRepo = $repoManager->getLocalRepository();
22
+ $package = $composer->getPackage();
23
+ $config = $composer->getConfig();
24
+
25
+ // We can't gain access to the Command's input object, so we have to look
26
+ // for -o / --optimize-autoloader ourselves. Sadly, neither getopt() works
27
+ // (always returns an empty array), nor does Symfony's Console Input, as
28
+ // it expects a full definition of the current command line and we can't
29
+ // provide that.
30
+
31
+ $args = $_SERVER['argv'];
32
+ $optimize = in_array('-o', $args) || in_array('--optimize-autoloader', $args) || in_array('--optimize', $args);
33
+
34
+ $suffix = $config->get('autoloader-suffix');
35
+
36
+ $generator = new AutoloadGenerator();
37
+ $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize, $suffix);
38
+ }
39
+ }