Version Description
- New filter 'anr_same_settings_for_all_sites' added, Now same settings can be used for all sites in Multisite.
- Multisite User Signup Form added.
- Some bug fix.
Download this release
Release Info
Developer | shamim51 |
Plugin | Advanced noCaptcha & invisible Captcha |
Version | 1.3 |
Comparing to | |
See all releases |
Code changes from version 1.2 to 1.3
- admin/anr-admin-class.php +31 -12
- advanced-nocaptcha-recaptcha.php +1 -1
- anr-captcha-class.php +32 -0
- functions.php +15 -9
- readme.txt +15 -2
admin/anr-admin-class.php
CHANGED
@@ -16,7 +16,17 @@ if (!class_exists('anr_admin_class'))
|
|
16 |
|
17 |
function actions_filters()
|
18 |
{
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
add_filter('plugin_action_links', array(&$this, 'add_settings_link'), 10, 2 );
|
21 |
}
|
22 |
|
@@ -39,7 +49,6 @@ if (!class_exists('anr_admin_class'))
|
|
39 |
{
|
40 |
$token = wp_create_nonce( 'anr-admin-settings' );
|
41 |
$url = 'https://shamimbiplob.wordpress.com/contact-us/';
|
42 |
-
$actionURL = admin_url( 'admin.php?page=anr-admin-settings' );
|
43 |
$ReviewURL = 'https://wordpress.org/support/view/plugin-reviews/advanced-nocaptcha-recaptcha';
|
44 |
echo "<style>
|
45 |
input[type='text'], textarea, select {
|
@@ -98,13 +107,14 @@ if (!class_exists('anr_admin_class'))
|
|
98 |
);
|
99 |
|
100 |
$locations = array(
|
101 |
-
__( 'Login Form', 'anr' )
|
102 |
-
__( 'Registration Form', 'anr' )
|
103 |
-
__( '
|
104 |
-
__( '
|
105 |
-
__( '
|
106 |
-
__( '
|
107 |
-
__( 'bbPress
|
|
|
108 |
|
109 |
);
|
110 |
|
@@ -125,7 +135,7 @@ if (!class_exists('anr_admin_class'))
|
|
125 |
<div class='postbox'><div class='inside'>
|
126 |
<h2>".__("Advanced noCaptcha reCaptcha Settings", 'anr')."</h2>
|
127 |
<h5>".sprintf(__("If you like this plugin please <a href='%s' target='_blank'>Review in Wordpress.org</a> and give 5 star", 'anr'),esc_url($ReviewURL))."</h5>
|
128 |
-
<form method='post' action='
|
129 |
<table>
|
130 |
<thead>
|
131 |
<tr><th width = '50%'>".__("Setting", 'anr')."</th><th width = '50%'>".__("Value", 'anr')."</th></tr>
|
@@ -227,7 +237,16 @@ function anr_admin_sidebar()
|
|
227 |
//var_dump($options);
|
228 |
|
229 |
if (count($errors->get_error_codes())==0){
|
230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
return $errors;
|
233 |
}
|
@@ -248,7 +267,7 @@ function anr_admin_sidebar()
|
|
248 |
<h2>".__("Advanced noCaptcha reCaptcha Setup Instruction", 'anr')."</h2>
|
249 |
<p><ul>
|
250 |
<li>".sprintf(__("Get your site key and secret key from <a href='%s' target='_blank'>GOOGLE</a> if you do not have already.", 'anr'),esc_url('https://www.google.com/recaptcha/admin'))."</li>
|
251 |
-
<li>".
|
252 |
<h3>".__("Implement noCaptcha in Contact Form 7", 'anr')."</h3><br />
|
253 |
<li>".__("To show noCaptcha use ", 'anr')."<code>[anr_nocaptcha g-recaptcha-response]</code></li><br />
|
254 |
<h3>".__("If you want to implement noCaptcha in any other custom form", 'anr')."</h3><br />
|
16 |
|
17 |
function actions_filters()
|
18 |
{
|
19 |
+
if ( is_multisite() ) {
|
20 |
+
$same_settings = apply_filters( 'anr_same_settings_for_all_sites', false );
|
21 |
+
} else {
|
22 |
+
$same_settings = false;
|
23 |
+
}
|
24 |
+
if ( $same_settings ) {
|
25 |
+
add_action('network_admin_menu', array(&$this, 'MenuPage'));
|
26 |
+
} else {
|
27 |
+
add_action('admin_menu', array(&$this, 'MenuPage'));
|
28 |
+
}
|
29 |
+
|
30 |
add_filter('plugin_action_links', array(&$this, 'add_settings_link'), 10, 2 );
|
31 |
}
|
32 |
|
49 |
{
|
50 |
$token = wp_create_nonce( 'anr-admin-settings' );
|
51 |
$url = 'https://shamimbiplob.wordpress.com/contact-us/';
|
|
|
52 |
$ReviewURL = 'https://wordpress.org/support/view/plugin-reviews/advanced-nocaptcha-recaptcha';
|
53 |
echo "<style>
|
54 |
input[type='text'], textarea, select {
|
107 |
);
|
108 |
|
109 |
$locations = array(
|
110 |
+
__( 'Login Form', 'anr' ) => 'login',
|
111 |
+
__( 'Registration Form', 'anr' ) => 'registration',
|
112 |
+
__( 'Multisite User Signup Form', 'anr' ) => 'ms_user_signup',
|
113 |
+
__( 'Lost Password Form', 'anr' ) => 'lost_password',
|
114 |
+
__( 'Reset Password Form', 'anr' ) => 'reset_password',
|
115 |
+
__( 'Comment Form', 'anr' ) => 'comment',
|
116 |
+
__( 'bbPress New topic', 'anr' ) => 'bb_new',
|
117 |
+
__( 'bbPress reply to topic', 'anr' ) => 'bb_reply',
|
118 |
|
119 |
);
|
120 |
|
135 |
<div class='postbox'><div class='inside'>
|
136 |
<h2>".__("Advanced noCaptcha reCaptcha Settings", 'anr')."</h2>
|
137 |
<h5>".sprintf(__("If you like this plugin please <a href='%s' target='_blank'>Review in Wordpress.org</a> and give 5 star", 'anr'),esc_url($ReviewURL))."</h5>
|
138 |
+
<form method='post' action=''>
|
139 |
<table>
|
140 |
<thead>
|
141 |
<tr><th width = '50%'>".__("Setting", 'anr')."</th><th width = '50%'>".__("Value", 'anr')."</th></tr>
|
237 |
//var_dump($options);
|
238 |
|
239 |
if (count($errors->get_error_codes())==0){
|
240 |
+
if ( is_multisite() ) {
|
241 |
+
$same_settings = apply_filters( 'anr_same_settings_for_all_sites', false );
|
242 |
+
} else {
|
243 |
+
$same_settings = false;
|
244 |
+
}
|
245 |
+
if ( $same_settings ) {
|
246 |
+
update_site_option('anr_admin_options', $options);
|
247 |
+
} else {
|
248 |
+
update_option('anr_admin_options', $options);
|
249 |
+
}
|
250 |
}
|
251 |
return $errors;
|
252 |
}
|
267 |
<h2>".__("Advanced noCaptcha reCaptcha Setup Instruction", 'anr')."</h2>
|
268 |
<p><ul>
|
269 |
<li>".sprintf(__("Get your site key and secret key from <a href='%s' target='_blank'>GOOGLE</a> if you do not have already.", 'anr'),esc_url('https://www.google.com/recaptcha/admin'))."</li>
|
270 |
+
<li>".__("Goto SETTINGS page of this plugin and set up as you need. and ENJOY...", 'anr')."</li><br/>
|
271 |
<h3>".__("Implement noCaptcha in Contact Form 7", 'anr')."</h3><br />
|
272 |
<li>".__("To show noCaptcha use ", 'anr')."<code>[anr_nocaptcha g-recaptcha-response]</code></li><br />
|
273 |
<h3>".__("If you want to implement noCaptcha in any other custom form", 'anr')."</h3><br />
|
advanced-nocaptcha-recaptcha.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Advanced noCaptcha reCaptcha
|
4 |
Plugin URI: https://shamimbiplob.wordpress.com/contact-us/
|
5 |
Description: Show noCaptcha in Comment Form (after Comment textarea before submit button), Contact Form 7, bbPress, Login, Register, Lost Password, Reset Password. Also can implement in any other form easily.
|
6 |
-
Version: 1.
|
7 |
Author: Shamim
|
8 |
Author URI: https://shamimbiplob.wordpress.com/contact-us/
|
9 |
Text Domain: anr
|
3 |
Plugin Name: Advanced noCaptcha reCaptcha
|
4 |
Plugin URI: https://shamimbiplob.wordpress.com/contact-us/
|
5 |
Description: Show noCaptcha in Comment Form (after Comment textarea before submit button), Contact Form 7, bbPress, Login, Register, Lost Password, Reset Password. Also can implement in any other form easily.
|
6 |
+
Version: 1.3
|
7 |
Author: Shamim
|
8 |
Author URI: https://shamimbiplob.wordpress.com/contact-us/
|
9 |
Text Domain: anr
|
anr-captcha-class.php
CHANGED
@@ -31,6 +31,11 @@ if (!class_exists('anr_captcha_class'))
|
|
31 |
add_filter ('registration_errors', array(&$this, 'registration_verify'), 10, 3 );
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
if ( '1' == anr_get_option( 'lost_password' )) {
|
35 |
add_action ('lostpassword_form', array(&$this, 'form_field'), 99);
|
36 |
add_action ('allow_password_reset', array(&$this, 'lostpassword_verify'), 10, 2); //lostpassword_post does not return wp_error
|
@@ -73,6 +78,22 @@ if (!class_exists('anr_captcha_class'))
|
|
73 |
anr_captcha_form_field();
|
74 |
|
75 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
function comment_form_field( $defaults )
|
78 |
{
|
@@ -127,6 +148,17 @@ if (!class_exists('anr_captcha_class'))
|
|
127 |
|
128 |
return $errors;
|
129 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
function lostpassword_verify( $result, $user_id )
|
132 |
{
|
31 |
add_filter ('registration_errors', array(&$this, 'registration_verify'), 10, 3 );
|
32 |
}
|
33 |
|
34 |
+
if ( '1' == anr_get_option( 'ms_user_signup' )) {
|
35 |
+
add_action ('signup_extra_fields', array(&$this, 'ms_form_field'), 99);
|
36 |
+
add_filter ('wpmu_validate_user_signup', array(&$this, 'ms_form_field_verify'));
|
37 |
+
}
|
38 |
+
|
39 |
if ( '1' == anr_get_option( 'lost_password' )) {
|
40 |
add_action ('lostpassword_form', array(&$this, 'form_field'), 99);
|
41 |
add_action ('allow_password_reset', array(&$this, 'lostpassword_verify'), 10, 2); //lostpassword_post does not return wp_error
|
78 |
anr_captcha_form_field();
|
79 |
|
80 |
}
|
81 |
+
|
82 |
+
function ms_form_field( $errors )
|
83 |
+
|
84 |
+
{
|
85 |
+
$loggedin_hide = anr_get_option( 'loggedin_hide' );
|
86 |
+
|
87 |
+
if ( is_user_logged_in() && $loggedin_hide )
|
88 |
+
return;
|
89 |
+
|
90 |
+
if ( $errmsg = $errors->get_error_message('anr_error') ) {
|
91 |
+
echo '<p class="error">' . $errmsg . '</p>';
|
92 |
+
}
|
93 |
+
|
94 |
+
anr_captcha_form_field();
|
95 |
+
|
96 |
+
}
|
97 |
|
98 |
function comment_form_field( $defaults )
|
99 |
{
|
148 |
|
149 |
return $errors;
|
150 |
}
|
151 |
+
|
152 |
+
function ms_form_field_verify( $result )
|
153 |
+
|
154 |
+
{
|
155 |
+
if ( ! $this->verify() ) {
|
156 |
+
$error_message = str_replace(__('<strong>ERROR</strong>: ', 'anr'), '', anr_get_option( 'error_message' ));
|
157 |
+
$result['errors']->add( 'anr_error', $error_message );
|
158 |
+
}
|
159 |
+
|
160 |
+
return $result;
|
161 |
+
}
|
162 |
|
163 |
function lostpassword_verify( $result, $user_id )
|
164 |
{
|
functions.php
CHANGED
@@ -1,11 +1,18 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
4 |
-
if ( !function_exists('anr_get_option') ) :
|
5 |
-
|
6 |
function anr_get_option( $option, $default = '', $section = 'anr_admin_options' ) {
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
if ( isset( $options[$option] ) ) {
|
11 |
return $options[$option];
|
@@ -14,8 +21,6 @@ function anr_get_option( $option, $default = '', $section = 'anr_admin_options'
|
|
14 |
return $default;
|
15 |
}
|
16 |
|
17 |
-
endif;
|
18 |
-
|
19 |
function anr_translation()
|
20 |
{
|
21 |
//SETUP TEXT DOMAIN FOR TRANSLATIONS
|
@@ -118,10 +123,11 @@ function anr_captcha_form_field( $echo = true )
|
|
118 |
</noscript>";
|
119 |
}
|
120 |
|
121 |
-
if ( $echo )
|
122 |
echo $field;
|
123 |
-
|
124 |
-
|
|
|
125 |
|
126 |
}
|
127 |
|
@@ -140,7 +146,7 @@ function anr_verify_captcha()
|
|
140 |
$url = "https://www.google.com/recaptcha/api/siteverify";
|
141 |
|
142 |
// make a POST request to the Google reCAPTCHA Server
|
143 |
-
$request = wp_remote_post( $url, array('body' => array( 'secret' => $secre_key, 'response' => $response, 'remoteip' => $remoteip ) ) );
|
144 |
|
145 |
if ( is_wp_error( $request ) )
|
146 |
return false;
|
1 |
<?php
|
2 |
|
3 |
|
|
|
|
|
4 |
function anr_get_option( $option, $default = '', $section = 'anr_admin_options' ) {
|
5 |
|
6 |
+
if ( is_multisite() ) {
|
7 |
+
$same_settings = apply_filters( 'anr_same_settings_for_all_sites', false );
|
8 |
+
} else {
|
9 |
+
$same_settings = false;
|
10 |
+
}
|
11 |
+
if ( $same_settings ) {
|
12 |
+
$options = get_site_option( $section );
|
13 |
+
} else {
|
14 |
+
$options = get_option( $section );
|
15 |
+
}
|
16 |
|
17 |
if ( isset( $options[$option] ) ) {
|
18 |
return $options[$option];
|
21 |
return $default;
|
22 |
}
|
23 |
|
|
|
|
|
24 |
function anr_translation()
|
25 |
{
|
26 |
//SETUP TEXT DOMAIN FOR TRANSLATIONS
|
123 |
</noscript>";
|
124 |
}
|
125 |
|
126 |
+
if ( $echo ) {
|
127 |
echo $field;
|
128 |
+
} else {
|
129 |
+
return $field;
|
130 |
+
}
|
131 |
|
132 |
}
|
133 |
|
146 |
$url = "https://www.google.com/recaptcha/api/siteverify";
|
147 |
|
148 |
// make a POST request to the Google reCAPTCHA Server
|
149 |
+
$request = wp_remote_post( $url, array( 'timeout' => 10, 'body' => array( 'secret' => $secre_key, 'response' => $response, 'remoteip' => $remoteip ) ) );
|
150 |
|
151 |
if ( is_wp_error( $request ) )
|
152 |
return false;
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Advanced noCaptcha reCaptcha ===
|
2 |
Contributors: shamim51
|
3 |
-
Tags: recaptcha,nocaptcha,no captcha,bot,spam,captcha,contact form 7 captcha,widget,plugin,sidebar,shortcode,page,posts,comments,google,bbpress
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=4HKBQ3QFSCPHJ&lc=US&item_name=Front%20End%20PM&item_number=Front%20End%20PM¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to: 4.3
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -20,6 +20,7 @@ Show noCaptcha in Comment Form (after Comment textarea before submit button), Co
|
|
20 |
* Contact Form 7
|
21 |
* Login
|
22 |
* Register
|
|
|
23 |
* Lost Password
|
24 |
* Reset Password
|
25 |
* FEP Contact Form
|
@@ -60,6 +61,12 @@ Yes. this plugin is translate ready. But If your language is not available you c
|
|
60 |
|
61 |
== Changelog ==
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
= 1.2 =
|
64 |
|
65 |
* Now captcha size can be changed.
|
@@ -74,6 +81,12 @@ Yes. this plugin is translate ready. But If your language is not available you c
|
|
74 |
|
75 |
== Upgrade Notice ==
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
= 1.2 =
|
78 |
|
79 |
* Now captcha size can be changed.
|
1 |
=== Advanced noCaptcha reCaptcha ===
|
2 |
Contributors: shamim51
|
3 |
+
Tags: recaptcha,nocaptcha,no captcha,bot,spam,captcha,contact form 7 captcha,widget,plugin,sidebar,shortcode,page,posts,comments,google,bbpress,multisite
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=4HKBQ3QFSCPHJ&lc=US&item_name=Front%20End%20PM&item_number=Front%20End%20PM¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 4.3.1
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
20 |
* Contact Form 7
|
21 |
* Login
|
22 |
* Register
|
23 |
+
* Multisite User Signup
|
24 |
* Lost Password
|
25 |
* Reset Password
|
26 |
* FEP Contact Form
|
61 |
|
62 |
== Changelog ==
|
63 |
|
64 |
+
= 1.3 =
|
65 |
+
|
66 |
+
* New filter 'anr_same_settings_for_all_sites' added, Now same settings can be used for all sites in Multisite.
|
67 |
+
* Multisite User Signup Form added.
|
68 |
+
* Some bug fix.
|
69 |
+
|
70 |
= 1.2 =
|
71 |
|
72 |
* Now captcha size can be changed.
|
81 |
|
82 |
== Upgrade Notice ==
|
83 |
|
84 |
+
= 1.3 =
|
85 |
+
|
86 |
+
* New filter 'anr_same_settings_for_all_sites' added, Now same settings can be used for all sites in Multisite.
|
87 |
+
* Multisite User Signup Form added.
|
88 |
+
* Some bug fix.
|
89 |
+
|
90 |
= 1.2 =
|
91 |
|
92 |
* Now captcha size can be changed.
|