Version Description
Download this release
Release Info
Developer | folkhack |
Plugin | Gravity Forms No CAPTCHA reCAPTCHA |
Version | 1.0.4 |
Comparing to | |
See all releases |
Version 1.0.4
- LICENSE.txt +339 -0
- README.txt +67 -0
- admin/class-gf-no-captcha-recaptcha-admin.php +241 -0
- admin/index.php +1 -0
- admin/partials/gf-no-captcha-recaptcha-admin-display.php +34 -0
- gf-no-captcha-recaptcha.php +60 -0
- includes/class-gf-no-captcha-recaptcha-deactivator.php +37 -0
- includes/class-gf-no-captcha-recaptcha-i18n.php +63 -0
- includes/class-gf-no-captcha-recaptcha-loader.php +129 -0
- includes/class-gf-no-captcha-recaptcha.php +240 -0
- includes/index.php +1 -0
- index.php +1 -0
- languages/gf-no-captcha-recaptcha.pot +0 -0
- public/class-gf-no-captcha-recaptcha-public.php +314 -0
- public/index.php +1 -0
- public/js/gf-no-captcha-recaptcha-public.js +35 -0
- public/partials/gf-no-captcha-recaptcha-public-gforms-editor-js.php +32 -0
- public/partials/gf-no-captcha-recaptcha-public-theme-dropdown.php +9 -0
- uninstall.php +31 -0
LICENSE.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
README.txt
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Gravity Forms No CAPTCHA reCAPTCHA ===
|
2 |
+
Contributors: folkhack
|
3 |
+
Tags: CAPTCHA, Gravity Forms, No CAPTCHA, reCAPTCHA
|
4 |
+
Requires at least: 4.0.0
|
5 |
+
Tested up to: 4.0.0
|
6 |
+
License: GPLv2 or later
|
7 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
+
Stable tag: trunk
|
9 |
+
|
10 |
+
Adds a No CAPTCHA reCAPTCHA to field Gravity Forms
|
11 |
+
|
12 |
+
[Official GitHub Repository](https://github.com/folkhack/Gravity-Forms-No-CAPTCHA-reCAPTCHA)
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
|
16 |
+
Adds a No CAPTCHA reCAPTCHA to field type Gravity Forms form builder with light/dark theme options. Forms with No CAPTCHA reCAPTCHA will then validate the field before successful submission.
|
17 |
+
|
18 |
+
== Installation ==
|
19 |
+
|
20 |
+
1. Upload "gravity-forms-no-captcha-recaptcha" to "plugins" directory
|
21 |
+
2. Activate the plugin through the "Plugins" menu in WordPress
|
22 |
+
3. Sign-up for reCAPTCHA at https://www.google.com/recaptcha/
|
23 |
+
4. Drop "Site Key" and "Secret Key" in "Settings > No CAPTCHA reCAPTCHA" page
|
24 |
+
5. Add "No CAPTCHA" field into forms which you desire to have No CAPTCHA on via "Advanced Fields > No CAPTCHA" in Gravity Forms Form Editor
|
25 |
+
6. Set label for "No CAPTCHA" field in Form Editor
|
26 |
+
|
27 |
+
== Frequently Asked Questions ==
|
28 |
+
|
29 |
+
= Does this work for AJAX submitted forms? =
|
30 |
+
|
31 |
+
Yes.
|
32 |
+
|
33 |
+
= What versions of Gravity Forms/WordPress have you formally tested this with? =
|
34 |
+
|
35 |
+
* Gravity Forms: 1.8.19
|
36 |
+
* WordPress: 4.0.0, 4.0.1, 4.1.0
|
37 |
+
|
38 |
+
= Can I have multiple No CAPTCHA reCAPTCHA fields on one page? =
|
39 |
+
|
40 |
+
Normally this situation comes up if you have more than one Gravity Form with CAPTCHA on one page. As of version 1.0.2 this is supported.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
|
44 |
+
1. Plugin in action on contact form
|
45 |
+
2. Plugin administrative settings page with "Site" and "Secret" key settings
|
46 |
+
3. Adding the No CAPTCHA field to the Gravity Forms form builder
|
47 |
+
|
48 |
+
== Changelog ==
|
49 |
+
|
50 |
+
= 1.0.3 =
|
51 |
+
* Updated README.txt documentation
|
52 |
+
* Added README.txt documentation to README.md and CHANGELOG.md
|
53 |
+
* Added icon, banner, and screenshots
|
54 |
+
* Re-organized assets into "trunk" and "assets" directories
|
55 |
+
* Prepping to submit to WordPress Plugin Directory
|
56 |
+
|
57 |
+
= 1.0.2 =
|
58 |
+
* Added theme support (light/dark)
|
59 |
+
* Fixed "Cannot use reCAPTCHA more than once on a page" bug (resolves issue #1)
|
60 |
+
|
61 |
+
= 1.0.1 =
|
62 |
+
* Fixed tabs->spaces formatting issue
|
63 |
+
* Added better URL validation/sanitization/filtering
|
64 |
+
* Fixed missing documentation issue
|
65 |
+
|
66 |
+
= 1.0 =
|
67 |
+
* Preliminary version developed based on Tom McFarlin's [WP Plugin Boilerplate](https://tommcfarlin.com/wordpress-plugin-boilerplate/) - [GitHub Project](https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate)
|
admin/class-gf-no-captcha-recaptcha-admin.php
ADDED
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The settings/dashboard-specific functionality of the plugin.
|
5 |
+
*
|
6 |
+
* @link http://folkhack.com
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package GFNoCaptchaReCaptcha
|
10 |
+
* @subpackage GFNoCaptchaReCaptcha/admin
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The settings/dashboard-specific functionality of the plugin.
|
15 |
+
*
|
16 |
+
* Defines the plugin name, version, and two examples hooks for how to
|
17 |
+
* enqueue the dashboard-specific stylesheet and JavaScript.
|
18 |
+
*
|
19 |
+
* @package GFNoCaptchaReCaptcha
|
20 |
+
* @subpackage GFNoCaptchaReCaptcha/admin
|
21 |
+
* @author John Parks <john@folkhack.com>
|
22 |
+
*/
|
23 |
+
class GFNoCaptchaReCaptcha_Admin {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The ID of this plugin.
|
27 |
+
*
|
28 |
+
* @since 1.0.0
|
29 |
+
* @access private
|
30 |
+
* @var string $GFNoCaptchaReCaptcha The ID of this plugin.
|
31 |
+
*/
|
32 |
+
private $GFNoCaptchaReCaptcha;
|
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 |
+
* Name for private/public key options
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @access private
|
48 |
+
* @var string $options_name Name for options (ie: Private/public keys)
|
49 |
+
*/
|
50 |
+
private $options_name;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Holds applicable setting option values (ie: private/public keys from settings page)
|
54 |
+
*
|
55 |
+
* @since 1.0.0
|
56 |
+
* @access private
|
57 |
+
* @var string $options_values Applicable setting option values (ie: private/public keys from settings page)
|
58 |
+
*/
|
59 |
+
private $options_values;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Initialize the class and set its properties.
|
63 |
+
*
|
64 |
+
* @since 1.0.0
|
65 |
+
*
|
66 |
+
* @param string $GFNoCaptchaReCaptcha The name of this plugin.
|
67 |
+
* @param string $version The version of this plugin.
|
68 |
+
* @param string $options_name Name for options (ie: Private/public keys)
|
69 |
+
*/
|
70 |
+
public function __construct( $GFNoCaptchaReCaptcha, $version, $options_name ) {
|
71 |
+
|
72 |
+
$this->GFNoCaptchaReCaptcha = $GFNoCaptchaReCaptcha;
|
73 |
+
$this->version = $version;
|
74 |
+
$this->options_name = $options_name;
|
75 |
+
$this->options_values = get_option( $this->options_name );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Registers plugin settings, settings section, and setting fields
|
80 |
+
*
|
81 |
+
* @since 1.0.0
|
82 |
+
* @access public
|
83 |
+
*/
|
84 |
+
public function settings_page_init() {
|
85 |
+
|
86 |
+
// Register setting "$this->options_name"
|
87 |
+
register_setting(
|
88 |
+
'gf_nocaptcha_recaptcha_group', // Option group
|
89 |
+
$this->options_name, // Option name
|
90 |
+
array( $this, 'sanitize_input' ) // Sanitize_input
|
91 |
+
);
|
92 |
+
|
93 |
+
// Add section for settings
|
94 |
+
add_settings_section(
|
95 |
+
'gf_nocaptcha_recaptcha_section', // ID
|
96 |
+
__( 'Google No CAPTCHA reCAPTCHA Settings', 'gf-no-captcha-recaptcha' ), // Title
|
97 |
+
array( $this, 'section_callback' ), // Callback
|
98 |
+
'gf-nocaptcha-settings-admin' // Page
|
99 |
+
);
|
100 |
+
|
101 |
+
// Public key setting field
|
102 |
+
add_settings_field(
|
103 |
+
'public_key', // ID
|
104 |
+
__( 'Site (Public) Key:', 'gf-no-captcha-recaptcha' ), // Title
|
105 |
+
array( $this, 'public_key_field_callback' ), // Callback
|
106 |
+
'gf-nocaptcha-settings-admin', // Page
|
107 |
+
'gf_nocaptcha_recaptcha_section' // Section
|
108 |
+
);
|
109 |
+
|
110 |
+
// Private key setting field
|
111 |
+
add_settings_field(
|
112 |
+
'private_key', // ID
|
113 |
+
__( 'Secret (Private) Key:', 'gf-no-captcha-recaptcha' ), // Title
|
114 |
+
array( $this, 'private_key_field_callback' ), // Callback
|
115 |
+
'gf-nocaptcha-settings-admin', // Page
|
116 |
+
'gf_nocaptcha_recaptcha_section' // Section
|
117 |
+
);
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Registers settings page in "Settings" sidebar menu
|
122 |
+
*
|
123 |
+
* @since 1.0.0
|
124 |
+
* @access public
|
125 |
+
*/
|
126 |
+
public function create_settings_menu_item() {
|
127 |
+
|
128 |
+
add_options_page(
|
129 |
+
'No CAPTCHA reCAPTCHA Settings',
|
130 |
+
'No CAPTCHA reCAPTCHA',
|
131 |
+
'manage_options',
|
132 |
+
'gf-no-captcha-recaptcha-admin',
|
133 |
+
array( $this, 'create_admin_page' )
|
134 |
+
);
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Creates plugin settings page by loading in admin display partial
|
139 |
+
*
|
140 |
+
* @since 1.0.0
|
141 |
+
* @access public
|
142 |
+
*/
|
143 |
+
public function create_admin_page() {
|
144 |
+
|
145 |
+
// Include dashboard partial
|
146 |
+
include( 'partials/gf-no-captcha-recaptcha-admin-display.php' );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Sanitizes input by stripping tags from public/private key
|
151 |
+
*
|
152 |
+
* @param array $input Un-sanitized input array
|
153 |
+
*
|
154 |
+
* @since 1.0.0
|
155 |
+
* @access public
|
156 |
+
*
|
157 |
+
* @return array Sanitized array with public_key and private_key set
|
158 |
+
*/
|
159 |
+
public function sanitize_input( $input )
|
160 |
+
{
|
161 |
+
$sanitize_inputd_input = array();
|
162 |
+
|
163 |
+
$sanitize_inputd_input['public_key'] = ( isset( $input['public_key'] ) ) ?
|
164 |
+
strip_tags( $input['public_key'] ) :
|
165 |
+
'';
|
166 |
+
|
167 |
+
$sanitize_inputd_input['private_key'] = ( isset( $input['private_key'] ) ) ?
|
168 |
+
strip_tags( $input['private_key'] ) :
|
169 |
+
'';
|
170 |
+
|
171 |
+
return $sanitize_inputd_input;
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Renders section content for plugin settings
|
176 |
+
*
|
177 |
+
* @since 1.0.0
|
178 |
+
* @access public
|
179 |
+
*/
|
180 |
+
public function section_callback() {
|
181 |
+
|
182 |
+
echo __( 'Enter <a href="https://www.google.com/recaptcha" target="_blank">Google No CAPTCHA reCAPTCHA</a> key settings below:', 'gf-no-captcha-recaptcha' );
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Renders Public Key input field for plugin settings
|
187 |
+
*
|
188 |
+
* @since 1.0.0
|
189 |
+
* @access public
|
190 |
+
*/
|
191 |
+
public function public_key_field_callback() {
|
192 |
+
|
193 |
+
$val = isset( $this->options_values['public_key'] ) ?
|
194 |
+
esc_attr( $this->options_values['public_key']) :
|
195 |
+
'';
|
196 |
+
|
197 |
+
echo '<input type="text" id="public_key" name="' . $this->options_name . '[public_key]" value="' . $val . '" />';
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Renders Private Key input field for plugin settings
|
202 |
+
*
|
203 |
+
* @since 1.0.0
|
204 |
+
* @access public
|
205 |
+
*/
|
206 |
+
public function private_key_field_callback() {
|
207 |
+
|
208 |
+
$val = isset( $this->options_values['private_key'] ) ?
|
209 |
+
esc_attr( $this->options_values['private_key']) :
|
210 |
+
'';
|
211 |
+
|
212 |
+
echo '<input type="text" id="private_key" name="' . $this->options_name . '[private_key]" value="' . $val . '" />';
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Checks for public/private keys properly set, if not then displays an administration notification with link to settings page to set
|
217 |
+
*
|
218 |
+
* @since 1.0.0
|
219 |
+
* @access public
|
220 |
+
*/
|
221 |
+
public function add_keys_notice() {
|
222 |
+
|
223 |
+
if( is_admin() && current_user_can( 'manage_options' ) ) {
|
224 |
+
|
225 |
+
if( ( ! isset( $this->options_values['public_key'] ) || empty( $this->options_values['public_key'] ) ) || ( ! isset( $this->options_values['private_key'] ) || empty( $this->options_values['private_key'] ) ) ) {
|
226 |
+
|
227 |
+
echo '<div class="updated"><p>';
|
228 |
+
|
229 |
+
// Message
|
230 |
+
echo __( 'You must enter a private/public key for Gravity Forms Google No CAPTCHA reCAPTCHA to work! ', 'gf-no-captcha-recaptcha' );
|
231 |
+
|
232 |
+
// Link to settings page
|
233 |
+
echo '<a href="' . admin_url( 'options-general.php?page=gf-no-captcha-recaptcha-admin' ) . '">';
|
234 |
+
echo __( 'Google No CAPTCHA reCAPTCHA Settings', 'gf-no-captcha-recaptcha' );
|
235 |
+
echo '</a>';
|
236 |
+
|
237 |
+
echo '</p></div>';
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
admin/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
admin/partials/gf-no-captcha-recaptcha-admin-display.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Provide a settings page for the plugin
|
5 |
+
*
|
6 |
+
* @link http://folkhack.com
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package GFNoCaptchaReCaptcha
|
10 |
+
* @subpackage GFNoCaptchaReCaptcha/admin/partials
|
11 |
+
*/
|
12 |
+
?>
|
13 |
+
|
14 |
+
<div class="wrap">
|
15 |
+
|
16 |
+
<h2><?php echo __( 'Gravity Forms No CAPTCHA reCAPTCHA Settings', 'gf-no-captcha-recaptcha' ); ?></h2>
|
17 |
+
|
18 |
+
<form method="post" action="options.php">
|
19 |
+
|
20 |
+
<?php
|
21 |
+
|
22 |
+
// This prints out all hidden setting fields
|
23 |
+
settings_fields( 'gf_nocaptcha_recaptcha_group' );
|
24 |
+
|
25 |
+
// Display setting sections
|
26 |
+
do_settings_sections( 'gf-nocaptcha-settings-admin' );
|
27 |
+
|
28 |
+
// Display submit button
|
29 |
+
submit_button();
|
30 |
+
?>
|
31 |
+
|
32 |
+
</form>
|
33 |
+
|
34 |
+
</div>
|
gf-no-captcha-recaptcha.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Gravity Forms No CAPTCHA reCAPTCHA plugin bootstrap file
|
5 |
+
*
|
6 |
+
* @link http://folkhack.com
|
7 |
+
* @since 1.0.0
|
8 |
+
* @package GFNoCaptchaReCaptcha
|
9 |
+
*
|
10 |
+
* @wordpress-plugin
|
11 |
+
* Plugin Name: Gravity Forms No CAPTCHA reCAPTCHA
|
12 |
+
* Plugin URI: http://folkhack.com
|
13 |
+
* Description: Adds "No CAPTCHA" field to Gravity Forms as alternative CAPTCHA option
|
14 |
+
* Version: 1.0.2
|
15 |
+
* Author: John Parks - Folkhack Studios
|
16 |
+
* Author URI: http://folkhack.com
|
17 |
+
* License: GPL-2.0+
|
18 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
19 |
+
* Text Domain: gf-no-captcha-recaptcha
|
20 |
+
* Domain Path: /languages
|
21 |
+
*/
|
22 |
+
|
23 |
+
// If this file is called directly, abort.
|
24 |
+
if ( ! defined( 'WPINC' ) ) {
|
25 |
+
die;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* The code that runs during plugin deactivation.
|
30 |
+
* This action is documented in includes/class-gf-no-captcha-recaptcha-deactivator.php
|
31 |
+
*/
|
32 |
+
function deactivate_GFNoCaptchaReCaptcha() {
|
33 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-gf-no-captcha-recaptcha-deactivator.php';
|
34 |
+
GFNoCaptchaReCaptcha_Deactivator::deactivate();
|
35 |
+
}
|
36 |
+
|
37 |
+
register_deactivation_hook( __FILE__, 'deactivate_GFNoCaptchaReCaptcha' );
|
38 |
+
|
39 |
+
/**
|
40 |
+
* The core plugin class that is used to define internationalization,
|
41 |
+
* dashboard-specific hooks, and public-facing site hooks.
|
42 |
+
*/
|
43 |
+
require plugin_dir_path( __FILE__ ) . 'includes/class-gf-no-captcha-recaptcha.php';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Begins execution of the plugin.
|
47 |
+
*
|
48 |
+
* Since everything within the plugin is registered via hooks,
|
49 |
+
* then kicking off the plugin from this point in the file does
|
50 |
+
* not affect the page life cycle.
|
51 |
+
*
|
52 |
+
* @since 1.0.0
|
53 |
+
*/
|
54 |
+
function run_GFNoCaptchaReCaptcha() {
|
55 |
+
|
56 |
+
$plugin = new GFNoCaptchaReCaptcha();
|
57 |
+
$plugin->run();
|
58 |
+
|
59 |
+
}
|
60 |
+
run_GFNoCaptchaReCaptcha();
|
includes/class-gf-no-captcha-recaptcha-deactivator.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Fired during plugin deactivation
|
5 |
+
*
|
6 |
+
* @link http://folkhack.com
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package GFNoCaptchaReCaptcha
|
10 |
+
* @subpackage GFNoCaptchaReCaptcha/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 GFNoCaptchaReCaptcha
|
20 |
+
* @subpackage GFNoCaptchaReCaptcha/includes
|
21 |
+
* @author John Parks <john@folkhack.com>
|
22 |
+
*/
|
23 |
+
class GFNoCaptchaReCaptcha_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 |
+
// Remove options from DB
|
35 |
+
delete_option( 'gf_nocaptcha_recaptcha_options' );
|
36 |
+
}
|
37 |
+
}
|
includes/class-gf-no-captcha-recaptcha-i18n.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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://folkhack.com
|
10 |
+
* @since 1.0.0
|
11 |
+
*
|
12 |
+
* @package GFNoCaptchaReCaptcha
|
13 |
+
* @subpackage GFNoCaptchaReCaptcha/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 GFNoCaptchaReCaptcha
|
24 |
+
* @subpackage GFNoCaptchaReCaptcha/includes
|
25 |
+
* @author John Parks <john@folkhack.com>
|
26 |
+
*/
|
27 |
+
class GFNoCaptchaReCaptcha_i18n {
|
28 |
+
|
29 |
+
/**
|
30 |
+
* The domain specified for this plugin.
|
31 |
+
*
|
32 |
+
* @since 1.0.0
|
33 |
+
* @access private
|
34 |
+
* @var string $domain The domain identifier for this plugin.
|
35 |
+
*/
|
36 |
+
private $domain;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Load the plugin text domain for translation.
|
40 |
+
*
|
41 |
+
* @since 1.0.0
|
42 |
+
*/
|
43 |
+
public function load_plugin_textdomain() {
|
44 |
+
|
45 |
+
load_plugin_textdomain(
|
46 |
+
$this->domain,
|
47 |
+
false,
|
48 |
+
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
|
49 |
+
);
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Set the domain equal to that of the specified domain.
|
55 |
+
*
|
56 |
+
* @since 1.0.0
|
57 |
+
* @param string $domain The domain that represents the locale of this plugin.
|
58 |
+
*/
|
59 |
+
public function set_domain( $domain ) {
|
60 |
+
$this->domain = $domain;
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
includes/class-gf-no-captcha-recaptcha-loader.php
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Register all actions and filters for the plugin
|
5 |
+
*
|
6 |
+
* @link http://folkhack.com
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package GFNoCaptchaReCaptcha
|
10 |
+
* @subpackage GFNoCaptchaReCaptcha/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 GFNoCaptchaReCaptcha
|
21 |
+
* @subpackage GFNoCaptchaReCaptcha/includes
|
22 |
+
* @author John Parks <john@folkhack.com>
|
23 |
+
*/
|
24 |
+
class GFNoCaptchaReCaptcha_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 |
+
* @var string $hook The name of the WordPress action that is being registered.
|
61 |
+
* @var object $component A reference to the instance of the object on which the action is defined.
|
62 |
+
* @var string $callback The name of the function definition on the $component.
|
63 |
+
* @var int Optional $priority The priority at which the function should be fired.
|
64 |
+
* @var int Optional $accepted_args The number of arguments that should be passed to the $callback.
|
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 |
+
* @var string $hook The name of the WordPress filter that is being registered.
|
75 |
+
* @var object $component A reference to the instance of the object on which the filter is defined.
|
76 |
+
* @var string $callback The name of the function definition on the $component.
|
77 |
+
* @var int Optional $priority The priority at which the function should be fired.
|
78 |
+
* @var int Optional $accepted_args The number of arguments that should be passed to the $callback.
|
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 |
+
* @var array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
91 |
+
* @var string $hook The name of the WordPress filter that is being registered.
|
92 |
+
* @var object $component A reference to the instance of the object on which the filter is defined.
|
93 |
+
* @var string $callback The name of the function definition on the $component.
|
94 |
+
* @var int Optional $priority The priority at which the function should be fired.
|
95 |
+
* @var int Optional $accepted_args The number of arguments that should be passed to the $callback.
|
96 |
+
* @return type 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-gf-no-captcha-recaptcha.php
ADDED
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 dashboard.
|
8 |
+
*
|
9 |
+
* @link http://folkhack.com
|
10 |
+
* @since 1.0.0
|
11 |
+
*
|
12 |
+
* @package GFNoCaptchaReCaptcha
|
13 |
+
* @subpackage GFNoCaptchaReCaptcha/includes
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The core plugin class.
|
18 |
+
*
|
19 |
+
* This is used to define internationalization, dashboard-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 GFNoCaptchaReCaptcha
|
27 |
+
* @subpackage GFNoCaptchaReCaptcha/includes
|
28 |
+
* @author John Parks <john@folkhack.com>
|
29 |
+
*/
|
30 |
+
class GFNoCaptchaReCaptcha {
|
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 GFNoCaptchaReCaptcha_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 $GFNoCaptchaReCaptcha The string used to uniquely identify this plugin.
|
48 |
+
*/
|
49 |
+
protected $GFNoCaptchaReCaptcha;
|
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 |
+
* Name for private/public key options
|
62 |
+
*
|
63 |
+
* @since 1.0.0
|
64 |
+
* @access private
|
65 |
+
* @var string $options_name Name for options (ie: Private/public keys)
|
66 |
+
*/
|
67 |
+
private $options_name;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Define the core functionality of the plugin.
|
71 |
+
*
|
72 |
+
* Set the plugin name and the plugin version that can be used throughout the plugin.
|
73 |
+
* Load the dependencies, define the locale, and set the hooks for the Dashboard and
|
74 |
+
* the public-facing side of the site.
|
75 |
+
*
|
76 |
+
* @since 1.0.0
|
77 |
+
*/
|
78 |
+
public function __construct() {
|
79 |
+
|
80 |
+
$this->GFNoCaptchaReCaptcha = 'gf-no-captcha-recaptcha';
|
81 |
+
$this->version = '1.0.0';
|
82 |
+
$this->options_name = 'gf_nocaptcha_recaptcha_options';
|
83 |
+
|
84 |
+
$this->load_dependencies();
|
85 |
+
$this->set_locale();
|
86 |
+
$this->define_admin_hooks();
|
87 |
+
$this->define_public_hooks();
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Load the required dependencies for this plugin.
|
92 |
+
*
|
93 |
+
* Include the following files that make up the plugin:
|
94 |
+
*
|
95 |
+
* - GFNoCaptchaReCaptcha_Loader. Orchestrates the hooks of the plugin.
|
96 |
+
* - GFNoCaptchaReCaptcha_i18n. Defines internationalization functionality.
|
97 |
+
* - GFNoCaptchaReCaptcha_Admin. Defines all hooks for the dashboard.
|
98 |
+
* - GFNoCaptchaReCaptcha_Public. Defines all hooks for the public side of the site.
|
99 |
+
*
|
100 |
+
* Create an instance of the loader which will be used to register the hooks
|
101 |
+
* with WordPress.
|
102 |
+
*
|
103 |
+
* @since 1.0.0
|
104 |
+
* @access private
|
105 |
+
*/
|
106 |
+
private function load_dependencies() {
|
107 |
+
|
108 |
+
/**
|
109 |
+
* The class responsible for orchestrating the actions and filters of the
|
110 |
+
* core plugin.
|
111 |
+
*/
|
112 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-gf-no-captcha-recaptcha-loader.php';
|
113 |
+
|
114 |
+
/**
|
115 |
+
* The class responsible for defining internationalization functionality
|
116 |
+
* of the plugin.
|
117 |
+
*/
|
118 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-gf-no-captcha-recaptcha-i18n.php';
|
119 |
+
|
120 |
+
/**
|
121 |
+
* The class responsible for defining all actions that occur in the Dashboard.
|
122 |
+
*/
|
123 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-gf-no-captcha-recaptcha-admin.php';
|
124 |
+
|
125 |
+
/**
|
126 |
+
* The class responsible for defining all actions that occur in the public-facing
|
127 |
+
* side of the site.
|
128 |
+
*/
|
129 |
+
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-gf-no-captcha-recaptcha-public.php';
|
130 |
+
|
131 |
+
$this->loader = new GFNoCaptchaReCaptcha_Loader();
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Define the locale for this plugin for internationalization.
|
137 |
+
*
|
138 |
+
* Uses the GFNoCaptchaReCaptcha_i18n class in order to set the domain and to register the hook
|
139 |
+
* with WordPress.
|
140 |
+
*
|
141 |
+
* @since 1.0.0
|
142 |
+
* @access private
|
143 |
+
*/
|
144 |
+
private function set_locale() {
|
145 |
+
|
146 |
+
$plugin_i18n = new GFNoCaptchaReCaptcha_i18n();
|
147 |
+
$plugin_i18n->set_domain( $this->get_GFNoCaptchaReCaptcha() );
|
148 |
+
|
149 |
+
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Register all of the hooks related to the dashboard functionality
|
155 |
+
* of the plugin.
|
156 |
+
*
|
157 |
+
* @since 1.0.0
|
158 |
+
* @access private
|
159 |
+
*/
|
160 |
+
private function define_admin_hooks() {
|
161 |
+
|
162 |
+
$plugin_admin = new GFNoCaptchaReCaptcha_Admin( $this->get_GFNoCaptchaReCaptcha(), $this->get_version(), $this->get_options_name() );
|
163 |
+
|
164 |
+
// Hook into correct admnistrative actions for settings page (private/public key options):
|
165 |
+
$this->loader->add_action( 'admin_init', $plugin_admin, 'settings_page_init' );
|
166 |
+
$this->loader->add_action( 'admin_menu', $plugin_admin, 'create_settings_menu_item' );
|
167 |
+
$this->loader->add_action( 'admin_notices', $plugin_admin, 'add_keys_notice' );
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Register all of the hooks related to the public-facing functionality
|
172 |
+
* of the plugin.
|
173 |
+
*
|
174 |
+
* @since 1.0.0
|
175 |
+
* @access private
|
176 |
+
*/
|
177 |
+
private function define_public_hooks() {
|
178 |
+
|
179 |
+
$plugin_public = new GFNoCaptchaReCaptcha_Public( $this->get_GFNoCaptchaReCaptcha(), $this->get_version(), $this->get_options_name() );
|
180 |
+
|
181 |
+
// Hook into correct filters/actions for Gravity Forms application logic:
|
182 |
+
$this->loader->add_filter( 'gform_add_field_buttons', $plugin_public, 'gravity_forms_field' );
|
183 |
+
$this->loader->add_filter( 'gform_field_type_title' , $plugin_public, 'gravity_forms_field_title' );
|
184 |
+
$this->loader->add_action( 'gform_field_input', $plugin_public, 'gravity_forms_field_input', 10, 5 );
|
185 |
+
$this->loader->add_action( 'gform_editor_js', $plugin_public, 'gravity_forms_field_editor_js' );
|
186 |
+
$this->loader->add_action( 'gform_field_advanced_settings', $plugin_public, 'gravity_forms_add_theme_setting', 10, 2 );
|
187 |
+
$this->loader->add_action( 'gform_enqueue_scripts' , $plugin_public, 'gravity_forms_recaptcha_api_enqueue_script' , 10 , 2 );
|
188 |
+
$this->loader->add_filter( 'gform_field_validation', $plugin_public, 'gravity_forms_validate', 10, 4 );
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Run the loader to execute all of the hooks with WordPress.
|
193 |
+
*
|
194 |
+
* @since 1.0.0
|
195 |
+
*/
|
196 |
+
public function run() {
|
197 |
+
$this->loader->run();
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* The name of the plugin used to uniquely identify it within the context of
|
202 |
+
* WordPress and to define internationalization functionality.
|
203 |
+
*
|
204 |
+
* @since 1.0.0
|
205 |
+
* @return string The name of the plugin.
|
206 |
+
*/
|
207 |
+
public function get_GFNoCaptchaReCaptcha() {
|
208 |
+
return $this->GFNoCaptchaReCaptcha;
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* The reference to the class that orchestrates the hooks with the plugin.
|
213 |
+
*
|
214 |
+
* @since 1.0.0
|
215 |
+
* @return GFNoCaptchaReCaptcha_Loader Orchestrates the hooks of the plugin.
|
216 |
+
*/
|
217 |
+
public function get_loader() {
|
218 |
+
return $this->loader;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Retrieve the version number of the plugin.
|
223 |
+
*
|
224 |
+
* @since 1.0.0
|
225 |
+
* @return string The version number of the plugin.
|
226 |
+
*/
|
227 |
+
public function get_version() {
|
228 |
+
return $this->version;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Return options name for reCAPTCHA private/public key settings
|
233 |
+
*
|
234 |
+
* @since 1.0.0
|
235 |
+
* @return string Name for private/public key options
|
236 |
+
*/
|
237 |
+
public function get_options_name() {
|
238 |
+
return $this->options_name;
|
239 |
+
}
|
240 |
+
}
|
includes/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
languages/gf-no-captcha-recaptcha.pot
ADDED
File without changes
|
public/class-gf-no-captcha-recaptcha-public.php
ADDED
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The public-facing functionality of the plugin.
|
5 |
+
*
|
6 |
+
* @link http://folkhack.com
|
7 |
+
* @since 1.0.0
|
8 |
+
*
|
9 |
+
* @package GFNoCaptchaReCaptcha
|
10 |
+
* @subpackage GFNoCaptchaReCaptcha/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 dashboard-specific stylesheet and JavaScript.
|
18 |
+
*
|
19 |
+
* @package GFNoCaptchaReCaptcha
|
20 |
+
* @subpackage GFNoCaptchaReCaptcha/public
|
21 |
+
* @author John Parks <john@folkhack.com>
|
22 |
+
*/
|
23 |
+
class GFNoCaptchaReCaptcha_Public {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* The ID of this plugin.
|
27 |
+
*
|
28 |
+
* @since 1.0.0
|
29 |
+
* @access private
|
30 |
+
* @var string $GFNoCaptchaReCaptcha The ID of this plugin.
|
31 |
+
*/
|
32 |
+
private $GFNoCaptchaReCaptcha;
|
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 |
+
* Name for private/public key options
|
45 |
+
*
|
46 |
+
* @since 1.0.0
|
47 |
+
* @access private
|
48 |
+
* @var string $options_name Name for options (ie: Private/public keys)
|
49 |
+
*/
|
50 |
+
private $options_name;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Holds applicable setting option values (ie: private/public keys from settings page)
|
54 |
+
*
|
55 |
+
* @since 1.0.0
|
56 |
+
* @access private
|
57 |
+
* @var string $options_values Applicable setting option values (ie: private/public keys from settings page)
|
58 |
+
*/
|
59 |
+
private $options_values;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Name for Gravity Forms new field type
|
63 |
+
*
|
64 |
+
* @since 1.0.0
|
65 |
+
* @access private
|
66 |
+
* @var string $gravity_forms_field_type Gravity Forms new field type
|
67 |
+
*/
|
68 |
+
private $gravity_forms_field_type;
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Public Google No CAPTCHA reCAPTCHA key
|
72 |
+
*
|
73 |
+
* @since 1.0.0
|
74 |
+
* @access private
|
75 |
+
* @var string $google_public_key Public Google No CAPTCHA reCAPTCHA key
|
76 |
+
*/
|
77 |
+
private $google_public_key;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Private Google No CAPTCHA reCAPTCHA key
|
81 |
+
*
|
82 |
+
* @since 1.0.0
|
83 |
+
* @access private
|
84 |
+
* @var string $google_public_key Private Google No CAPTCHA reCAPTCHA key
|
85 |
+
*/
|
86 |
+
private $google_private_key;
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Initialize the class and set its properties.
|
90 |
+
*
|
91 |
+
* @since 1.0.0
|
92 |
+
*
|
93 |
+
* @param string $GFNoCaptchaReCaptcha The name of the plugin.
|
94 |
+
* @param string $version The version of this plugin.
|
95 |
+
* @param string $options_name Name for options (ie: Private/public keys)
|
96 |
+
*
|
97 |
+
*/
|
98 |
+
public function __construct( $GFNoCaptchaReCaptcha, $version, $options_name ) {
|
99 |
+
|
100 |
+
$this->GFNoCaptchaReCaptcha = $GFNoCaptchaReCaptcha;
|
101 |
+
$this->version = $version;
|
102 |
+
$this->options_name = $options_name;
|
103 |
+
$this->options_values = get_option( $options_name );
|
104 |
+
$this->google_public_key = $this->options_values['public_key'];
|
105 |
+
$this->google_private_key = $this->options_values['private_key'];
|
106 |
+
$this->gravity_forms_field_type = 'gf_no_captcha_recaptcha';
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Filter to add "No CAPTCHA" button to "Advanced Fields" section in Gravity Forms form editor
|
111 |
+
*
|
112 |
+
* @since 1.0.0
|
113 |
+
* @access public
|
114 |
+
*
|
115 |
+
* @param array $field_groups The array to be filtered. It contains the field groups (i.e. Standard Fields, Advanced Fields, etc...)
|
116 |
+
*
|
117 |
+
* @return array $field_groups with "No CAPTCHA" button array added
|
118 |
+
*/
|
119 |
+
public function gravity_forms_field( $field_groups ) {
|
120 |
+
|
121 |
+
foreach( $field_groups as &$group ){
|
122 |
+
|
123 |
+
if( $group['name'] == 'advanced_fields' ) {
|
124 |
+
|
125 |
+
$group['fields'][] = array(
|
126 |
+
'class' => 'button',
|
127 |
+
'value' => __( 'No CAPTCHA', 'gf-no-captcha-recaptcha'),
|
128 |
+
'onclick' => 'StartAddField(\'' . $this->gravity_forms_field_type . '\');'
|
129 |
+
);
|
130 |
+
|
131 |
+
break;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
return $field_groups;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Filter to configure field title for "No CAPTCHA" field within Gravity Forms form editor
|
140 |
+
*
|
141 |
+
* @since 1.0.0
|
142 |
+
* @access public
|
143 |
+
*
|
144 |
+
* @param string $type Title to be filtered. Defaults to the field type
|
145 |
+
*
|
146 |
+
* @return string New title of field type
|
147 |
+
*/
|
148 |
+
public function gravity_forms_field_title( $type ) {
|
149 |
+
|
150 |
+
if ( $type == $this->gravity_forms_field_type ) {
|
151 |
+
|
152 |
+
return __( 'No CAPTCHA reCAPTCHA', 'gf-no-captcha-recaptcha' );
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Action to override "No CAPTCHA" input field output. Outputs "g-recaptcha" div wrapped in ginput_container if not logged in (needs CAPTCHA)
|
158 |
+
*
|
159 |
+
* @since 1.0.0
|
160 |
+
* @access public
|
161 |
+
*
|
162 |
+
* @param string $input Input tag string to be filtered
|
163 |
+
* @param array $field (Field Object) The Field Object that this input tag applies to
|
164 |
+
* @param string $value Default/initial value that the field should be pre-populated with
|
165 |
+
* @param int $lead_id On entry detail screen, $lead_id will be populated with the Entry ID. Otherwise, it will be 0
|
166 |
+
* @param int $form_id The current Form ID
|
167 |
+
*
|
168 |
+
* @return string Returns either Google reCAPTCHA div wrapped in ginput_container div if non-admin or nothing if admin
|
169 |
+
*/
|
170 |
+
public function gravity_forms_field_input( $input, $field, $value, $lead_id, $form_id ) {
|
171 |
+
|
172 |
+
if ( $field['type'] == $this->gravity_forms_field_type ) {
|
173 |
+
|
174 |
+
// Ensure not admin, and public/private keys exist before adding in form DIV
|
175 |
+
if( ! is_admin() && ! empty( $this->google_public_key ) && ! empty( $this->google_private_key ) ) {
|
176 |
+
|
177 |
+
// Public site key
|
178 |
+
$site_key = esc_html( $this->google_public_key );
|
179 |
+
|
180 |
+
// CAPTCHA Theme
|
181 |
+
$theme = ( isset( $field['recaptcha_theme'] ) && ! empty( $field['recaptcha_theme'] ) ) ?
|
182 |
+
esc_html( $field['recaptcha_theme'] ) :
|
183 |
+
'light';
|
184 |
+
|
185 |
+
// Public sees CAPTCHA field
|
186 |
+
return '<div class="ginput_container"><div class="g-recaptcha" data-sitekey="' . $site_key . '" data-theme="' . $theme . '"></div></div>';
|
187 |
+
|
188 |
+
} else {
|
189 |
+
|
190 |
+
// Do not display field if admin or missing public/private keys
|
191 |
+
return '';
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
return $input;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
*
|
200 |
+
* Action to inject "No CAPTCHA" field JS into the Gravity Forms editor page
|
201 |
+
*
|
202 |
+
* @since 1.0.0
|
203 |
+
* @access public
|
204 |
+
*
|
205 |
+
*/
|
206 |
+
public function gravity_forms_field_editor_js() {
|
207 |
+
|
208 |
+
include 'partials/gf-no-captcha-recaptcha-public-gforms-editor-js.php';
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
*
|
213 |
+
* Action to add "theme" dropdown to Gravity Forms editor page for CAPTCHA theme setting
|
214 |
+
*
|
215 |
+
* @since 1.0.2
|
216 |
+
* @access public
|
217 |
+
*
|
218 |
+
*/
|
219 |
+
public function gravity_forms_add_theme_setting( $position, $form_id ) {
|
220 |
+
|
221 |
+
// Create setting on position 0 (first item on "Advanced" tab)
|
222 |
+
if( $position == 0 ) {
|
223 |
+
|
224 |
+
// Include the dropdown partial
|
225 |
+
include 'partials/gf-no-captcha-recaptcha-public-theme-dropdown.php';
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Action to enque Google reCAPTCHA external API JS if there is a "No CAPTCHA" field in current form
|
231 |
+
*
|
232 |
+
* @since 1.0.0
|
233 |
+
* @access public
|
234 |
+
*
|
235 |
+
* @param array $form (Form Object) Current Form Object
|
236 |
+
* @param boolean $ajax Specifies if form is configured to be submitted via AJAX
|
237 |
+
*
|
238 |
+
*/
|
239 |
+
public function gravity_forms_recaptcha_api_enqueue_script( $form, $ajax ) {
|
240 |
+
|
241 |
+
// cycle through fields to see if tos is being used
|
242 |
+
foreach( $form['fields'] as $field ) {
|
243 |
+
|
244 |
+
if( ( $field['type'] == $this->gravity_forms_field_type ) && ! empty( $this->google_public_key ) ) {
|
245 |
+
|
246 |
+
// Enqueue External API JS
|
247 |
+
wp_enqueue_script( 'no_captcha_recaptcha_api', 'https://www.google.com/recaptcha/api.js?render=explicit', array(), '', true );
|
248 |
+
|
249 |
+
// Enqueue Internal JS (renders CAPTCHA explicitly - maintains AJAX submission compatibility)
|
250 |
+
wp_enqueue_script( 'no_captcha_recaptcha_internal', plugin_dir_url( __FILE__ ) . 'js/gf-no-captcha-recaptcha-public.js', array( 'jquery', 'no_captcha_recaptcha_api' ) );
|
251 |
+
|
252 |
+
break;
|
253 |
+
}
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Filter to add custom validation logic for "No CAPTCHA" input
|
259 |
+
*
|
260 |
+
* @since 1.0.0
|
261 |
+
* @access public
|
262 |
+
*
|
263 |
+
* @param array $result The validation result to be filtered
|
264 |
+
* @param string $value The field value to be validated
|
265 |
+
* @param array $form (Form Object) Current Form object
|
266 |
+
* @param array $field (Field Object) Current Field object
|
267 |
+
*
|
268 |
+
* @return array $result with 'is_valid' set to true on success or 'message' and 'is_valid' as error message and false respectively
|
269 |
+
*/
|
270 |
+
public function gravity_forms_validate( $result, $value, $form, $field ) {
|
271 |
+
|
272 |
+
if( $field['type'] == $this->gravity_forms_field_type ) {
|
273 |
+
|
274 |
+
// Check to ensure POST challenge is included
|
275 |
+
if( isset( $_POST['g-recaptcha-response'] ) && ! empty( $_POST['g-recaptcha-response'] ) && ! empty( $this->google_private_key ) ) {
|
276 |
+
|
277 |
+
$recaptcha_response = urlencode( $_POST['g-recaptcha-response'] );
|
278 |
+
$user_ip = $_SERVER['REMOTE_ADDR'];
|
279 |
+
$verify_url = $this->sanitize_url( 'https://www.google.com/recaptcha/api/siteverify?secret=' . $this->google_private_key . '&response=' . $recaptcha_response . '&remoteip=' . $user_ip );
|
280 |
+
$json_response = file_get_contents( $verify_url );
|
281 |
+
|
282 |
+
if( ! empty( $json_response ) && $result = json_decode( $json_response, true ) ) {
|
283 |
+
|
284 |
+
if( isset( $result['success'] ) && $result['success'] == true ) {
|
285 |
+
|
286 |
+
$result['is_valid'] = true;
|
287 |
+
|
288 |
+
return $result;
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
$result['message'] = __( 'CAPTCHA failed. Please try again!', 'gf-no-captcha-recaptcha' );
|
294 |
+
$result['is_valid'] = false;
|
295 |
+
}
|
296 |
+
|
297 |
+
return $result;
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Sanitize/filter URL helper function
|
302 |
+
*
|
303 |
+
* @since 1.0.0
|
304 |
+
* @access private
|
305 |
+
*
|
306 |
+
* @param string $url URL to be sanitized
|
307 |
+
*
|
308 |
+
* @return string Sanitized URL via "filter_var" FILTER_SANITIZE_URL
|
309 |
+
*/
|
310 |
+
private function sanitize_url( $url ) {
|
311 |
+
|
312 |
+
return filter_var( $url, FILTER_SANITIZE_URL, FILTER_FLAG_SCHEME_REQUIRED );
|
313 |
+
}
|
314 |
+
}
|
public/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden
|
public/js/gf-no-captcha-recaptcha-public.js
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
|
3 |
+
'use strict';
|
4 |
+
|
5 |
+
$( window ).load( function() {
|
6 |
+
|
7 |
+
// Render the CAPTCHA on "gform_post_render" event (maintains compatibility with AJAX)
|
8 |
+
$( document ).bind( 'gform_post_render', function() {
|
9 |
+
|
10 |
+
// Iterate over each "g-recaptcha" div
|
11 |
+
$( '.g-recaptcha' ).each( function( index, element ) {
|
12 |
+
|
13 |
+
// Ensure field is empty before rendering CAPTCHA
|
14 |
+
if( $( this ).is( ':empty' ) ) {
|
15 |
+
|
16 |
+
// Site key
|
17 |
+
var site_key = $( this ).attr( 'data-sitekey' );
|
18 |
+
|
19 |
+
// CAPTCHA theme
|
20 |
+
var theme = $( this ).attr( 'data-theme' );
|
21 |
+
|
22 |
+
// Native DOM element
|
23 |
+
var element = $( this ).get( 0 );
|
24 |
+
|
25 |
+
// Render CAPTCHA
|
26 |
+
grecaptcha.render( element, { 'sitekey': site_key, 'theme': theme } );
|
27 |
+
}
|
28 |
+
});
|
29 |
+
});
|
30 |
+
|
31 |
+
// Manually render CAPTCHA on window load
|
32 |
+
$( document ).trigger( 'gform_post_render' );
|
33 |
+
});
|
34 |
+
|
35 |
+
})( jQuery );
|
public/partials/gf-no-captcha-recaptcha-public-gforms-editor-js.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Javascript for limiting what field settings are available to new field within Gravity Forms
|
4 |
+
*
|
5 |
+
* @link http://folkhack.com
|
6 |
+
* @since 1.0.0
|
7 |
+
*
|
8 |
+
* @package GFNoCaptchaReCaptcha
|
9 |
+
* @subpackage GFNoCaptchaReCaptcha/public/partials
|
10 |
+
*/
|
11 |
+
?>
|
12 |
+
<script type="text/javascript">
|
13 |
+
|
14 |
+
(function( $ ) {
|
15 |
+
|
16 |
+
'use strict';
|
17 |
+
|
18 |
+
$(function() {
|
19 |
+
|
20 |
+
// Limit field settings to label and visiblity
|
21 |
+
fieldSettings['<?php echo $this->gravity_forms_field_type; ?>'] = '.label_setting, .visibility_setting, .recaptcha_theme_setting';
|
22 |
+
|
23 |
+
// Load CAPTCHA theme field settings
|
24 |
+
$( document ).bind( 'gform_load_field_settings', function( e, field, form ) {
|
25 |
+
|
26 |
+
$( '#field_recaptcha_theme_value' ).val( field['recaptcha_theme'] );
|
27 |
+
});
|
28 |
+
});
|
29 |
+
|
30 |
+
})( jQuery );
|
31 |
+
|
32 |
+
</script>
|
public/partials/gf-no-captcha-recaptcha-public-theme-dropdown.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<li class="recaptcha_theme_setting field_setting">
|
2 |
+
|
3 |
+
<label for="field_theme_setting"><?php _e( 'CAPTCHA Theme', 'gravityforms' ); ?></label>
|
4 |
+
|
5 |
+
<select id="field_recaptcha_theme_value" onchange="SetFieldProperty( 'recaptcha_theme', this.value );">
|
6 |
+
<option value="light">Light</option>
|
7 |
+
<option value="dark">Dark</option>
|
8 |
+
</select>
|
9 |
+
</li>
|
uninstall.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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://folkhack.com
|
23 |
+
* @since 1.0.0
|
24 |
+
*
|
25 |
+
* @package GFNoCaptchaReCaptcha
|
26 |
+
*/
|
27 |
+
|
28 |
+
// If uninstall not called from WordPress, then exit.
|
29 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
30 |
+
exit;
|
31 |
+
}
|