Contact Form 7 Captcha - Version 0.0.3

Version Description

Download this release

Release Info

Developer 247wd
Plugin Icon wp plugin Contact Form 7 Captcha
Version 0.0.3
Comparing to
See all releases

Code changes from version 0.0.2 to 0.0.3

Files changed (4) hide show
  1. captcha.jpg +0 -0
  2. contact-form-7-simple-recaptcha.php +27 -9
  3. donate.png +0 -0
  4. readme.txt +6 -4
captcha.jpg ADDED
Binary file
contact-form-7-simple-recaptcha.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Contact Form 7 Captcha
4
  Description: Add No CAPTCHA reCAPTCHA to Contact Form 7 using [cf7sr-simple-recaptcha] shortcode
5
- Version: 0.0.2
6
  Author: 247wd
7
  */
8
 
@@ -58,6 +58,10 @@ if (!empty($cf7sr_key) && !empty($cf7sr_secret) && !is_admin()) {
58
  add_shortcode('cf7sr-simple-recaptcha', 'cf7sr_shortcode');
59
 
60
  function cf7sr_verify_recaptcha($result) {
 
 
 
 
61
  $_wpcf7 = ! empty($_POST['_wpcf7']) ? absint($_POST['_wpcf7']) : 0;
62
  if (empty($_wpcf7)) {
63
  return $result;
@@ -102,7 +106,7 @@ if (!empty($cf7sr_key) && !empty($cf7sr_secret) && !is_admin()) {
102
  if (is_admin()) {
103
  function cf7sr_add_action_links($links) {
104
  array_unshift($links , '<a href="' . admin_url( 'options-general.php?page=cf7sr_edit' ) . '">Settings</a>');
105
- array_unshift($links , '<a target="captcha" style="font-weight: 900; color: #d54e21;" href="http://www.cf7captcha.com">Upgrade To Pro</a>');
106
  return $links;
107
  }
108
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'cf7sr_add_action_links', 10, 2 );
@@ -111,6 +115,10 @@ if (is_admin()) {
111
  if (!current_user_can('manage_options')) {
112
  wp_die(__('You do not have sufficient permissions to access this page.'));
113
  }
 
 
 
 
114
  if (!empty ($_POST['update'])) {
115
  $cf7sr_key = !empty ($_POST['cf7sr_key']) ? sanitize_text_field($_POST['cf7sr_key']) : '';
116
  update_option('cf7sr_key', $cf7sr_key);
@@ -129,26 +137,36 @@ if (is_admin()) {
129
  }
130
  ?>
131
  <div class="cf7sr-wrap" style="font-size: 15px; background: #fff; border: 1px solid #e5e5e5; margin-top: 20px; padding: 20px; margin-right: 20px;">
132
- <h2>Contact Form 7 Captcha Settings</h2>
133
- You can generate Site key and Secret key <a target="_blank" href="https://www.google.com/recaptcha/admin/create">here</a>. Once generated, paste them below for this plugin to work.<br>
134
- To add Recaptcha to CF7 form, add <strong>[cf7sr-simple-recaptcha]</strong> in your form ( preferable above submit button )<br><br>
 
 
 
 
 
 
135
  <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
136
  <input type="hidden" value="1" name="update">
137
  <ul>
138
  <li><input type="text" style="width: 370px;" value="<?php echo $cf7sr_key; ?>" name="cf7sr_key"> Site key</li>
139
  <li><input type="text" style="width: 370px;" value="<?php echo $cf7sr_secret; ?>" name="cf7sr_secret"> Secret key</li>
140
  <li><input type="text" style="width: 370px;" value="<?php echo $cf7sr_message; ?>" name="cf7sr_message"> Invalid captcha error message</li>
141
- </ul><br>
142
  <input type="submit" class="button-primary" value="Save Settings">
143
- </form>
 
 
 
144
  <?php if (!empty($updated)): ?>
145
  <p>Settings were updated successfully!</p>
146
  <?php endif; ?>
147
  </div>
148
  <div class="cf7sr-wrap" style="font-size: 15px; background: #fff; border: 1px solid #e5e5e5; margin-top: 20px; padding: 20px; margin-right: 20px;">
 
149
  <ul>
150
- <li><a target="captcha" style="font-weight: 900; color: #d54e21;" href="http://www.cf7captcha.com">CLICK HERE</a> to upgrade to Pro Version and get: <br></li>
151
- <li>Render captcha widget in a specific language, choose from 70 languages. Free version auto-detects the user's language</li>
152
  <li>Switch between the color theme of the widget, light or dark</li>
153
  <li>Switch between the type of the widget, image or audio</li>
154
  <li>Switch between the size of the widget, normal or compact</li>
2
  /*
3
  Plugin Name: Contact Form 7 Captcha
4
  Description: Add No CAPTCHA reCAPTCHA to Contact Form 7 using [cf7sr-simple-recaptcha] shortcode
5
+ Version: 0.0.3
6
  Author: 247wd
7
  */
8
 
58
  add_shortcode('cf7sr-simple-recaptcha', 'cf7sr_shortcode');
59
 
60
  function cf7sr_verify_recaptcha($result) {
61
+ if (! class_exists('WPCF7_Submission')) {
62
+ return $result;
63
+ }
64
+
65
  $_wpcf7 = ! empty($_POST['_wpcf7']) ? absint($_POST['_wpcf7']) : 0;
66
  if (empty($_wpcf7)) {
67
  return $result;
106
  if (is_admin()) {
107
  function cf7sr_add_action_links($links) {
108
  array_unshift($links , '<a href="' . admin_url( 'options-general.php?page=cf7sr_edit' ) . '">Settings</a>');
109
+ array_unshift($links , '<a target="_blank" style="font-weight: 900; color: #d54e21;" href="http://www.cf7captcha.com">Upgrade To Pro Free Limited Offer</a>');
110
  return $links;
111
  }
112
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'cf7sr_add_action_links', 10, 2 );
115
  if (!current_user_can('manage_options')) {
116
  wp_die(__('You do not have sufficient permissions to access this page.'));
117
  }
118
+ if (! class_exists('WPCF7_Submission')) {
119
+ echo '<p>To use <strong>Contact Form 7 Captcha</strong> please update <strong>Contact Form 7</strong> plugin as current version is not supported.</p>';
120
+ return;
121
+ }
122
  if (!empty ($_POST['update'])) {
123
  $cf7sr_key = !empty ($_POST['cf7sr_key']) ? sanitize_text_field($_POST['cf7sr_key']) : '';
124
  update_option('cf7sr_key', $cf7sr_key);
137
  }
138
  ?>
139
  <div class="cf7sr-wrap" style="font-size: 15px; background: #fff; border: 1px solid #e5e5e5; margin-top: 20px; padding: 20px; margin-right: 20px;">
140
+ <h2>
141
+ Captcha Settings
142
+ <a style="text-decoration: none" target="_blank" href="https://www.paypal.me/cf7captcha">
143
+ <img style="vertical-align:middle;display:inline-block;width:100px;margin-left:5px;" src="<?php echo plugin_dir_url( __FILE__ ); ?>donate.png" alt="Donate">
144
+ </a>
145
+ <a target="_blank" style="font-size:14px;color:#d54e21;border:1px solid #d54e21;padding:5px;text-decoration:none;margin-left:4px;border-radius:3px;" href="http://www.cf7captcha.com">Upgrade To Pro Free Limited Offer</a>
146
+ </h2>
147
+ This plugin implements "I'm not a robot" checkbox.<br><br>
148
+ To add Recaptcha to CF7 form, add <strong>[cf7sr-simple-recaptcha]</strong> in your form ( preferable above submit button )<br>
149
  <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
150
  <input type="hidden" value="1" name="update">
151
  <ul>
152
  <li><input type="text" style="width: 370px;" value="<?php echo $cf7sr_key; ?>" name="cf7sr_key"> Site key</li>
153
  <li><input type="text" style="width: 370px;" value="<?php echo $cf7sr_secret; ?>" name="cf7sr_secret"> Secret key</li>
154
  <li><input type="text" style="width: 370px;" value="<?php echo $cf7sr_message; ?>" name="cf7sr_message"> Invalid captcha error message</li>
155
+ </ul>
156
  <input type="submit" class="button-primary" value="Save Settings">
157
+ </form><br>
158
+ You can generate Site key and Secret key <strong><a target="_blank" href="https://www.google.com/recaptcha/admin">here</a></strong><br>
159
+ <strong style="color:red">Choose reCAPTCHA v2 -> Checkbox</strong><br>
160
+ <a target="_blank" href="https://www.google.com/recaptcha/admin"><img src="<?php echo plugin_dir_url( __FILE__ ); ?>captcha.jpg" width="400" alt="captcha" /></a><br><br>
161
  <?php if (!empty($updated)): ?>
162
  <p>Settings were updated successfully!</p>
163
  <?php endif; ?>
164
  </div>
165
  <div class="cf7sr-wrap" style="font-size: 15px; background: #fff; border: 1px solid #e5e5e5; margin-top: 20px; padding: 20px; margin-right: 20px;">
166
+ <strong>Pro Version features: </strong>
167
  <ul>
168
+ <li>WPML and POLYLANG language integration</li>
169
+ <li>Render captcha widget in a specific language, choose from 70 languages.</li>
170
  <li>Switch between the color theme of the widget, light or dark</li>
171
  <li>Switch between the type of the widget, image or audio</li>
172
  <li>Switch between the size of the widget, normal or compact</li>
donate.png ADDED
Binary file
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Contact Form 7 Captcha ===
2
  Contributors: 247wd
3
- Donate link: http://wordpress.org/plugins/contact-form-7-simple-recaptcha
4
  Tags: captcha, recaptcha, new recaptcha, contact form 7, no captcha
5
  Requires at least: 4.1.2
6
- Tested up to: 4.9.6
7
- Stable tag: 0.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,10 +12,12 @@ Add CAPTCHA to Contact Form 7
12
 
13
  == Description ==
14
 
 
 
15
  Add Google CAPTCHA to Contact Form 7.<br>
16
  Protect your Contact Form 7 forms from spam and abuse.<br>
17
  Can be used to protect multiple forms on same page.<br>
18
- Tested with Contact Form 7 version 5.0.2 and WordPress version 4.9.6<br>
19
  Configure plugin from Settings => CF7 Simple Recaptcha.<br>
20
  After configuration, add [cf7sr-simple-recaptcha] to any Contact Form 7 form.<br>
21
 
1
  === Contact Form 7 Captcha ===
2
  Contributors: 247wd
3
+ Donate link: https://www.paypal.me/cf7captcha
4
  Tags: captcha, recaptcha, new recaptcha, contact form 7, no captcha
5
  Requires at least: 4.1.2
6
+ Tested up to: 5.0.1
7
+ Stable tag: 0.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ To use this plugin, you need to sign up for API keys for your site via google site: https://www.google.com/recaptcha/admin<br>
16
+ This plugin implements "I'm not a robot" checkbox. When generating keys, choose reCAPTCHA v2 -> Checkbox<br>
17
  Add Google CAPTCHA to Contact Form 7.<br>
18
  Protect your Contact Form 7 forms from spam and abuse.<br>
19
  Can be used to protect multiple forms on same page.<br>
20
+ Tested with Contact Form 7 version 5.1 and WordPress version 5.1.1<br>
21
  Configure plugin from Settings => CF7 Simple Recaptcha.<br>
22
  After configuration, add [cf7sr-simple-recaptcha] to any Contact Form 7 form.<br>
23